-
Notifications
You must be signed in to change notification settings - Fork 32
/
Laser War (Data East 1987) w VR Room v2.0.vbs
4972 lines (4188 loc) · 180 KB
/
Laser War (Data East 1987) w VR Room v2.0.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'
' LL AAAAA SSSSSSS EEEEEEEE RRRRRRRR WW WW AAAAA RRRRRRRR
' LL AA AA SS SS EE RR RR WW WW AA AA RR RR
' LL AA AA SS EE RR RR WW WW AA AA RR RR
' LL AA AA SS EE RR RR WW WW AA AA RR RR
' LL AAAAAAAAA SSSSSSS EEEEEEE RRRRRRRR WW WW AAAAAAAAA RRRRRRRR
' LL AA AA SS EE RR RR WW WW AA AA RR RR
' LL AA AA SS EE RR RR WW W WW AA AA RR RR
' LL AA AA SS SS EE RR RR WW W WW AA AA RR RR
' LLLLLLLLL AA AA SSSSSSS EEEEEEEEE RR RR WWWWWWW AA AA RR RR by Data East, 1987
'
'
' Development by Herweh 2019 for Visual Pinball 10
' Version 1.0
'
' Very special thanks to
' - Schreibi34: Thank you so much for the awesome laser tower and for cleaning up the plastic ramp
' - OldSkoolGamer: For providing me all the wonderful artwork he designed for the VP9 build
' - Francisco666: For the reworked playfield image of the VP9 build
'
' Special thanks to
' - OldSkoolGamer, ICPjuggla, Herweh (:-): For creating a very cool VP9 build from where I borrowed a few table elements
' - Flupper: For his plastic and wire ramp tutorial and for the flasher domes
' - Dark: For the gates primitives template and the flipper primitives from 'Jurassic Park'
' - Dark and nFozzy: For locknuts and screws
' - DJRobX, RothbauerW and maybe some other ones: For some code in my script like the SSF routines
' - Mark70, Thalamus and digable: For beta testing and a lot great helpful feedback. Without you guys the table wouldn't be what it is
' - VPX development team: For the continous improvement of VP
' - All I have forgotten. Please send me a PM if you think I should add you to the 'Thx' section here. My fault!
'
' Release notes:
' Version 1.0: Initial release
'
'******** Revisions done by UnclePaulie on Hybrid version 0.1 - 2.0 *********
' v0.01 Changed the desktop background image to something more simple
' Changed tilt sensitivity to 6, and nudge to 1
' Added FrameTimer and GameTimer; added display timers to them
' Added hybrid mode for VR room, cabinet, and desktop
' Added minimal VR room.
' Added VR elements (power cord, several options: clock, posters, topper)
' Added DTRails collection for left and right rails view in desktop mode
' Added 4 ball options, dark, bright, and brightest, and original
' Changed the desktop display digits intensity from 30 to 12.
' v0.02 Changed GIOverhead, GIOverheadBlue, GIOverheadRed and GIOverheadYellow to a flasher from a light. Looked wierd in VR, and wasn't angled correctly.
' Removed old ball shadow method
' Got rid of LetTheBallJump code. VPW physics will replace. Also removed old sound calls.
' Adjusted flipper size slightly to match table images, and other data east tables of that era. Also put VPW recommended physics settings.
' Insesrted Fleep Sounds
' v0.03 Removed rollingtimer, removed debug mode code and ballcontroltimer, ballsearch, and manual ball control.
' Removed old rollingtimer sub
' Removed startcontrol manual ball control trigger. No longer needed.
' Removed spinnertimer and added spinner sub to FrameTimer
' Added all script code for Fleep sounds, VPW physics, flippers, etc.
' Removed GetBallID and lockedBallID, as not a part of updated code.
' Completely changed the trough logic to handle balls on table
' Changed the apron wall structure to create a trough
' No longer destroy balls. Use a global gBOT throughout all of script.
' Removed all the getballs calls and am only useing gBOT. Will help eliminate stutter on slower CPU machines
' Added option to turn magnasave option on and off
' Updated to nFozzy / Roth flipper physics
' Flipper shadows and options moved to FlipperVisualUpdate timer. Removed graphicstimer.
' VPW ball rolling sounds implemented
' Added dynamic shadows solution to the solution created by iaakki, apophis, Wylte
' Added knocker solenoid subroutine and KnockerPosition Primitive for sound
' Enababled bumper sounds
' Put gilvl in GI Sub
' Added a ballcntover call in the SaucerAction sub. Didn't want that kicker eject sound at start of game.
' Added groove to plunger lane, and small ball release ramp to get up.
' Ensured all lights stayed within the playfield... could see lights outside of table in VR.
' v0.04 Moved the apron prim down from 75 to 20. Was way too high.
' Adjusted the VR cab Position
' Aligned the triggers per the real table, and adjusted the height. Also moved the plunger location slightly to the right to align correctly.
' Added sideblades to DTRails. Didn't look right in VR
' Added a startbutton and animated it. Also animated plunger and flippers in VR.
' v0.05 Modified the flippers slightly for size, angle, and physics. Similar to other VPW data east tables of that era, and matching photos.
' Tweaked physics of bumpers and slings slightly.
' Removed the "aphysics" materials and replaced with zCol_ physics
' Finished adding physics primitives for posts, sleeves, gates, rubber bands, etc for Fleep sounds and VPW physics
' Changed initial material on rApronPlunger to "apron".
' v0.06 Changed the physics on the ramps to VPW zCol physics. (they were set at zero friction and other properties)
' Adjusted the playfield physics and general table settings.
' Increased sling shot force a little stronger
' Changed the sensor switches on the top left rubberbands to the new physics collidable wall ZCol_RubberBand007 and 9.
' Adjusted the level of table difficulty from 5 to 6, and then set at 90% difficulty (= slope of 5.9). (was set at only 6.2)
' Added an adjustable kick variance to each saucer. SW25 - changed variance to 0, and set power a little lower (10 to 8), and angle (180 to 200).
' v0.07 Added animated VR backglass and lighting. Also the VR Digits, and stereo image.
' v0.08 Adjusted the physical upper left wall by red saucer to ensure the ball rolls off correctly and onto the left flipper
' There was an Iron Maiden Virtual Time mod done to this table. Ensuring the ROM sound comes on with this table.
' Slight adjustment of bumper force from 10 to 11, and hit threshold of 1.6 from 1.8.
' Added updated ramprolling sounds solution created by nFozzy and VPW.
' Added GI relay sounds
' v0.09 Added updated standup targets with VPW physics, original code created by Rothbauerw and VPW team
' Adjusted the height of standup targets and hiddin bouncer walls.
' Adjusted the ball brightness GI level, and ensured new stand up targets worked in GI
' v0.10 Added Flupper Domes. Required removing significant portions out of initflasher sub, and other code mods.
' Redid the VR Backglass flashers with new method.
' Added dome flasher relay sounds, and adjusted volume of all relay sounds.
' Adjusted the disablelighting of the flasher dome lights to fade with the same GI / GIStep like the rest of the table.
' Made the flupper dome flare less bright.(from 0.3 to 0.1)
' Adjusted the rubbers height up to align with posts.
' In VR, you could see the 3 saucers light up through the walls. Changed material to active.
' Put sensor walls in the holes between the posts in upper right side
' Modified the backwall image slightly for around flasher domes
' v0.11 Added GI Bulb primitives (pBase,pBulb,pFiliment) to all the GI Bulbs. The GI lights were a big "halo" in VR.
' Added bulb bases for GI, added to a collection and adjust the material like rest of GI materials
' Added option for desktop and cab sidewalls image (plywood or black)
' Adjusted the cab pov.
' v0.12 Added plywood cutouts for the target, sling, and trigger holes. Cut holes out of playfield.
' Moved the flippers end angle to 68. (was 65). Was a little too high up.
' v0.13 Added 3D insert prims. Updated the playfield for insert cutouts. Added a text only ramp overlay.
' Added Lampz in code
' Removed the pflightscount routines. No longer needed.
' Put the text image for inserts at alpha = 25
' Adjusting light insert values: started with default values: falloff 50, falloff power 2, intensity 5, scale mesh 10, transmit 0.5.
' Adjusted all the light colors
' Adjusted the Lampz.FadeSpeedDown(x) = 1/20 (VPW default is 1/40).
' Blue inserts were too bright, darkened the material for those.
' Lots of insert lighting adjustments
' Made the inserts fade faster, as hard to see blink. Lampz.fadespeedup to 1/3 and speed down to 1/8.
' Adjusted the inserts under the star triggers to look real. Was just an image on playfield... now inserts. Also the center explosion is an insert.
' Added GI control to the new inserts under star triggers and explosion insert.
' Changed the Playfield Material colors, and alpha level. The overall colors weren't right. Also adjusted day/night slider down some.
' v0.14 Some VR adjustments.
' The WAR inserts needed to be increased, as well as yellow triangles.
' Adjusted the insert blooms to different halo height, color, falloff, alloff power, intensity, speed, depth bias.
' Added script to make the insert lights get brighter as GI gets darker
' Adjusted insert light intensities: White = 8, Blue=8, Red=5, Green=5, Yellow=5, Star Trigger Inserts=3.5
' v0.15 Tomate fixed the primitives for the ramp and side curved metal walls. They didn't have correct faces, you can see through one side of them.
' Adjusted two white insert prims intensity slightly down.
' Adjusted the physics of the flippers slightly. Also set the strenght at 2700.
' v0.16 Slight adjustment to bumpers, matching videos.
' Updated the DMD speakers / stereo light image and added GI to it.
' A couple minor lighting adjustments
' v0.17 Sixtoe corrected the upper right peg/rubber location based on actual laser war rebuild screen shots. Corrected ball rolling down drain too easily.
' v0.18 Minor cleanups, and ensured VR checked to not visible.
' Updated the material on Playfield Outlines to match playfield. (for the insert text)
' Adjusted the slingshot force down down to 4 (was 5), based on VPW feedback.
' Reduced the power of the kickback as well as it's randomness addition; based on VPW feedback.
' v0.19 Added updated slingshot corrections based off of Apophis example. (Thanks AstroNasty for pointing out).
' Moved physical wall, rMetalWall5, to match wall primitive and Sixtoe's corrected rubbers.
' v0.20 Based on AstroNasty's testing and feedback, I was able to see a couple ball bounce areas... one on left and right orbit.
' Had to move rMetalWall5 a bit more and reshape it slightly.
' Also had to adjust the left gate and associated rubbers, peg, and prim. (rotated gate 2 degrees)
' v0.21 Backglass Flashers - Tied backglass flashers to solenoid 27 and 28, fade timers added and repositioned them to match real table. (leojreimroc)
' v2.0 Released version. Slight adjustment to overall table lighting.
' Thank you to the VPW team, especially Tomate, AstroNasty, Sixtoe, PinStratsDan, Smaug, leojreimroc, and Rajo Joey for testing, feedback, and some updates!
' -------------------------------------------------
' IF YOU HAVE PERFORMANCE ISSUES or LOW FRAME RATE:
' -------------------------------------------------
' Try disabling "Reflect Elements On Playfield". This will increase performance for lesser powerful systems, and increase frame rate.
' Try turning off dynamic shadows.
' Turn off In-gmae AO, Post-proc AA, and 4xAA on the table objects
' Try to set some of the objects to "Static rendering". Open layer 7, select all screws and/or locknuts and select "Static Rendering" in the options windows
Option Explicit
Randomize
Dim GIColorMod, EnableGI, EnableFlasher, EnableReflectionsAtBall, ShadowOpacityGIOff, ShadowOpacityGIOn, RampColorMod
'******************************************************************************************
'* TABLE OPTIONS **************************************************************************
'******************************************************************************************
const VR_Room = 0 ' 1 = VR Room; 0 = desktop or cab mode
Dim cab_mode, DesktopMode: DesktopMode = LaserWar.ShowDT
If Not DesktopMode and VR_Room=0 Then cab_mode=1 Else cab_mode=0
const BallBrightness = 2 '0 = dark, 1 = not as dark (Herweh's original ball), 2 = bright, 3 = brightest
const sidewalls = 0 '0 = black, 1 = plywood (for cabinet and desktop only. VR ONLY has black)
const cabsideblades = 1 '0 = off, 1 = on; some users want sideblades in the cabinet, some don't.
' *** If using VR Room: ***
const CustomWalls = 0 'set to 0 for Modern Minimal Walls, floor, and roof, 1 for Sixtoe's original walls and floor
const WallClock = 1 '1 Shows the clock in the VR room only
const topper = 1 '0 = Off 1= On - Topper visible in VR Room only
const poster = 1 '1 Shows the flyer posters in the VR room only
const poster2 = 1 '1 Shows the flyer posters in the VR room only
'----- Shadow Options -----
Const DynamicBallShadowsOn = 0 '0 = no dynamic ball shadow ("triangles" near slings and such), 1 = enable dynamic ball shadow
Const AmbientBallShadowOn = 0 '0 = Static shadow under ball ("flasher" image, like JP's)
'1 = Moving ball shadow ("primitive" object, like ninuzzu's) - This is the only one that shows up on the pf when in ramps and fades when close to lights!
'2 = flasher image shadow, but it moves like ninuzzu's
Const fovY = 0 'Offset y position under ball to account for layback or inclination (more pronounced need further back)
Const DynamicBSFactor = 0.95 '0 to 1, higher is darker
Const AmbientBSFactor = 0.7 '0 to 1, higher is darker
Const AmbientMovement = 2 '1 to 4, higher means more movement as the ball moves left and right
Const Wideness = 20 'Sets how wide the dynamic ball shadows can get (20 +5 thinness should be most realistic for a 50 unit ball)
Const Thinness = 5 'Sets minimum as ball moves away from source
'----- General Sound Options -----
Const VolumeDial = 0.8 ' Recommended values should be no greater than 1.
Const BallRollVolume = 0.5 'Level of ball rolling volume. Value between 0 and 1
Const RampRollVolume = 0.5 'Level of ramp rolling volume. Value between 0 and 1
'----- Phsyics Mods -----
Const FlipperCoilRampupMode = 0 '0 = fast, 1 = medium, 2 = slow (tap passes should work)
Const TargetBouncerEnabled = 1 '0 = normal standup targets, 1 = bouncy targets, 2 = orig TargetBouncer
Const TargetBouncerFactor = 0.7 'Level of bounces. Recommmended value of 0.7 when TargetBouncerEnabled
'************************************************
'************************************************
' ****************************************************
' OPTIONS
' ****************************************************
' GI COLOR MOD
' 0 = White GI (default)
' 1 = Colored GI
GIColorMod = 0
' MAGNA SAVE MOD ADJUSTMENTS
' Ability to adjust Color or Flipper Mod with Left / Right Magna Save buttons during gameplay
const MagnaOn = 0 '1 = Ability On, 0 = Ability Off
' SILVER OR BLACK RAMP MOD
' 0 = black
' 1 = silver
' 2 = random
RampColorMod = 1
' ENABLE/DISABLE GI (general illumination)
' 0 = GI is off
' 1 = GI is on (value is a multiplicator for GI intensity - decimal values like 0.7 or 1.33 are valid too)
EnableGI = 1
' ENABLE/DISABLE flasher
' 0 = Flashers are off
' 1 = Flashers are on
EnableFlasher = 1
' ENABLE/DISABLE insert reflections at the ball
' 0 = reflections are off
' 1 = reflections are on
EnableReflectionsAtBall = 1
' PLAYFIELD SHADOW INTENSITY DURING GI OFF OR ON (adds additional visual depth)
' usable range is 0 (lighter) - 100 (darker)
ShadowOpacityGIOff = 90
ShadowOpacityGIOn = 65
'***************************************************************************************************************************************************************
'***************************************************************************************************************************************************************
' ****************************************************
' standard definitions
' ****************************************************
Const UseSolenoids = 2
Const UseLamps = 0
Const UseSync = 0
Const HandleMech = 0
Const UseGI = 1
'***************************************************************************************************************************************************************
'***************************************************************************************************************************************************************
Const cDMDRotation = -1 '-1 for No change, 0 - DMD rotation of 0?, 1 - DMD rotation of 90?
Const cGameName = "lwar_a83" 'ROM name
Const ballsize = 50
Const ballmass = 1
Const UsingROM = True
'***********************
Const tnob = 3 'Total number of balls
Const lob = 0 'Locked balls
Dim tablewidth: tablewidth = LaserWar.width
Dim tableheight: tableheight = LaserWar.height
Dim i, MBall1, MBall2, MBall3, gBOT
Dim BIPL : BIPL = False 'Ball in plunger lane
dim bbgi 'Ball Brightness GI
If Version < 10600 Then
MsgBox "This table requires Visual Pinball 10.6 or newer!" & vbNewLine & "Your version: " & Replace(Version/1000,",","."), , "Laser War VPX"
End If
On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package."
On Error Goto 0
LoadVPM "01550000", "DE.VBS", 3.26
If RampColorMod = 2 Then RampColorMod = Int(Rnd()*2)
' ****************************************************
' table init
' ****************************************************
Sub LaserWar_Init()
vpmInit Me
With Controller
.GameName = cGameName
.SplashInfoLine = "Laser War (Data East 1987)"
.Games(cGameName).Settings.Value("sound") = 1 ' Set sound (0=OFF, 1=ON)
.HandleMechanics = False
.HandleKeyboard = False
.ShowDMDOnly = True
.ShowFrame = False
.ShowTitle = False
.Hidden = DesktopMode
If cDMDRotation >= 0 Then .Games(cGameName).Settings.Value("rol") = cDMDRotation
On Error Resume Next
.Run GetPlayerHWnd
If Err Then MsgBox Err.Description
On Error Goto 0
End With
' tilt
vpmNudge.TiltSwitch = 1
vpmNudge.Sensitivity = 6
vpmNudge.TiltObj = Array(Bumper43, Bumper44, Bumper45, LeftSlingshot, RightSlingshot)
'************ Trough **************
Set MBall1 = BallRelease.CreateSizedballWithMass(Ballsize/2,Ballmass)
Set MBall2 = sw11.CreateSizedballWithMass(Ballsize/2,Ballmass)
Set MBall3 = sw10.CreateSizedballWithMass(Ballsize/2,Ballmass)
gBOT = Array(MBall1,MBall2, MBall3)
Controller.Switch(10) = 1
Controller.Switch(11) = 1
Controller.Switch(12) = 1
' init lights, flippers, bumpers, ...
InitFlasher_orig
InitGI True
InitRamp
bbgi = 0
InitDomeLights
' init timers
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = True
GITimer.Interval = 15
FlasherTimer_Orig.Interval = 15
InsertFlasherTimer.Interval = 15
InsertLightsFlasherTimer.Interval = 15
' VR Backglass lighting
If VR_Room = 1 Then
SetBackglass
End If
End Sub
Sub LaserWar_Paused() : Controller.Pause = True : End Sub
Sub LaserWar_UnPaused() : Controller.Pause = False : End Sub
Sub LaserWar_Exit() : Controller.Stop : End Sub
'*******************************************
' Timers
'*******************************************
' The game timer interval is 10 ms
Sub GameTimer_Timer()
Cor.Update 'update ball tracking
RollingUpdate 'update rolling sounds
saucers_on()
DoSTAnim 'handle stand up target animations
End Sub
' The frame timer interval is -1, so executes at the display frame rate
Sub FrameTimer_Timer()
FlipperVisualUpdate 'update flipper shadows and primitives
If DynamicBallShadowsOn Or AmbientBallShadowOn Then DynamicBSUpdate 'update ball shadows
SpinnerTimer
UpdateBallBrightness
If VR_Room = 1 Then
DisplayTimerVR
End If
If VR_Room = 0 AND cab_mode = 0 Then
DisplayTimer
End If
End Sub
'***************************************************************************
' VR Plunger Code
'***************************************************************************
Sub TimerVRPlunger_Timer
If PinCab_Shooter.Y < -25 then
PinCab_Shooter.Y = PinCab_Shooter.Y + 5
End If
End Sub
Sub TimerVRPlunger1_Timer
PinCab_Shooter.Y = -115 + (5* Plunger.Position) -20
End Sub
' ****************************************************
' keys
' ****************************************************
Sub LaserWar_KeyDown(ByVal keycode)
If keycode = PlungerKey Then
Plunger.Pullback
SoundPlungerPull
TimerVRPlunger.Enabled = True
TimerVRPlunger1.Enabled = False
PinCab_Shooter.Y = -115
End If
If keycode = LeftFlipperKey Then
FlipperActivate LeftFlipper, LFPress
Controller.Switch(47) = True
Primary_flipperbuttonleft.X = Primary_flipperbuttonleft.X +10
End If
If keycode = RightFlipperKey Then
FlipperActivate RightFlipper, RFPress
Controller.Switch(46) = True
Primary_flipperbuttonright.X = Primary_flipperbuttonright.X - 10
End If
if keycode = StartGameKey then
Primary_start_button.y= 1100 - 5
SoundStartButton
End If
If keycode = keyInsertCoin1 or keycode = keyInsertCoin2 or keycode = keyInsertCoin3 or keycode = keyInsertCoin4 Then 'Use this for ROM based games
Select Case Int(rnd*3)
Case 0: PlaySound ("Coin_In_1"), 0, CoinSoundLevel, 0, 0.25
Case 1: PlaySound ("Coin_In_2"), 0, CoinSoundLevel, 0, 0.25
Case 2: PlaySound ("Coin_In_3"), 0, CoinSoundLevel, 0, 0.25
End Select
End If
If keycode = LeftTiltKey Then Nudge 90, 1 : SoundNudgeLeft
If keycode = RightTiltKey Then Nudge 270, 1 : SoundNudgeRight
If keycode = CenterTiltKey Then Nudge 0, 1 : SoundNudgeCenter
If Magnaon = 1 Then
If keycode = LeftMagnaSave Then RampColorMod = (RampColorMod + 1) MOD 2 : ResetRamp
If keycode = RightMagnaSave Then GIColorMod = (GIColorMod + 1) MOD 2 : ResetGI
End If
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub LaserWar_KeyUp(ByVal keycode)
If keycode = PlungerKey Then
Plunger.Fire
If BIPL = 1 Then
SoundPlungerReleaseBall() 'Plunger release sound when there is a ball in shooter lane
Else
SoundPlungerReleaseNoBall() 'Plunger release sound when there is no ball in shooter lane
End If
TimerVRPlunger.Enabled = False
TimerVRPlunger1.Enabled = True
PinCab_Shooter.Y = -160
end if
If keycode = LeftFlipperKey Then
FlipperDeActivate LeftFlipper, LFPress
Controller.Switch(47) = False
Primary_flipperbuttonleft.X = Primary_flipperbuttonleft.X -10
End If
If keycode = RightFlipperKey Then
FlipperDeActivate RightFlipper, RFPress
Controller.Switch(46) = False
Primary_flipperbuttonright.X = Primary_flipperbuttonright.X +10
End If
if keycode = StartGameKey then
Primary_start_button.y= 1100
End If
If vpmKeyUp(keycode) Then Exit Sub
End Sub
' ****************************************************
' *** solenoids
' ****************************************************
' flasher
SolCallback(1) = "SolFlasherInsert 1," ' explosion
SolCallback(2) = "SolFlasherInsert 2," ' red hotdog
SolCallback(3) = "SolFlasherInsert 3," ' yellow hotdog"
SolCallback(4) = "SolFlasherInsert 4," ' blue hotdog"
SolCallback(5) = "SolFlasherCannon" ' white flasher in cannon tower
SolCallback(6) = "Flash6" ' yellow flasher
SolCallback(7) = "Flash7" ' red flasher
SolCallback(8) = "Flash8" ' blue flasher and right backwall flasher
SolCallback(25) = "SolFlasherRampMultiplier" ' ramp multiplier flasher and middle backwall flasher
SolCallback(26) = "SolFlasherGreenShield " ' green shield and left backwall flasher
SolCallback(27) = "Sol27"
SolCallback(28) = "Sol28"
' tools
SolCallback(9) = "SolBallRelease"
SolCallback(11) = "SolGI"
SolCallback(12) = "SolRedEject"
SolCallback(13) = "SolYellowEject"
SolCallback(14) = "SolBlueEject"
SolCallback(15) = "SolKickback"
SolCallback(16) = "SolOuthole"
SolCallback(29) = "SolKnocker"
' flipper
SolCallback(sLLFlipper) = "SolLFlipper"
SolCallback(sLRFlipper) = "SolRFlipper"
'******************************************************
' TROUGH BASED ON FOZZY'S
'******************************************************
Sub BallRelease_Hit():Controller.Switch(12) = 1: UpdateTrough: End Sub
Sub BallRelease_UnHit():Controller.Switch(12) = 0: UpdateTrough:End Sub
Sub sw11_Hit():Controller.Switch(11) = 1: UpdateTrough:End Sub
Sub sw11_UnHit():Controller.Switch(11) = 0: UpdateTrough:End Sub
Sub sw10_Hit():Controller.Switch(10) = 1:UpdateTrough:End Sub
Sub sw10_UnHit():Controller.Switch(10) = 0:UpdateTrough:End Sub
Sub UpdateTrough()
UpdateTroughTimer.Interval = 300
UpdateTroughTimer.Enabled = 1
End Sub
Sub UpdateTroughTimer_Timer()
If BallRelease.BallCntOver = 0 Then
sw11.kick 60, 10
End If
If sw11.BallCntOver = 0 Then sw10.kick 60, 10
Me.Enabled = 0
End Sub
' ******************************************************
' outhole, drain and ball release
' ******************************************************
Sub SolOuthole(Enabled)
If Enabled Then
Drain.kick 60, 16
UpdateTrough
End If
End Sub
Sub SolBallRelease(Enabled)
If Enabled Then
RandomSoundBallRelease BallRelease
BallRelease.kick 60, 12
UpdateTrough
End If
End Sub
Sub Drain_Hit()
Controller.Switch(13) = 1
RandomSoundDrain Drain
End Sub
Sub Drain_UnHit()
Controller.Switch(13) = 0
End Sub
'*******************************************
' Flippers
'*******************************************
Const ReflipAngle = 20
' Flipper Solenoid Callbacks (these subs mimics how you would handle flippers in ROM based tables)
Sub SolLFlipper(Enabled)
If Enabled Then
LF.Fire 'leftflipper.rotatetoend
If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
RandomSoundReflipUpLeft LeftFlipper
Else
SoundFlipperUpAttackLeft LeftFlipper
RandomSoundFlipperUpLeft LeftFlipper
End If
Else
LeftFlipper.RotateToStart
If LeftFlipper.currentangle < LeftFlipper.startAngle - 5 Then
RandomSoundFlipperDownLeft LeftFlipper
End If
FlipperLeftHitParm = FlipperUpSoundLevel
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
RF.Fire 'rightflipper.rotatetoend
If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper
Else
SoundFlipperUpAttackRight RightFlipper
RandomSoundFlipperUpRight RightFlipper
End If
Else
RightFlipper.RotateToStart
If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper
End If
FlipperRightHitParm = FlipperUpSoundLevel
End If
End Sub
' Flipper collide subs
Sub LeftFlipper_Collide(parm)
CheckLiveCatch Activeball, LeftFlipper, LFCount, parm
LeftFlipperCollide parm
End Sub
Sub RightFlipper_Collide(parm)
CheckLiveCatch Activeball, RightFlipper, RFCount, parm
RightFlipperCollide parm
End Sub
' This subroutine updates the flipper shadows and visual primitives
Sub FlipperVisualUpdate
pLeftFlipper.ObjRotZ = LeftFlipper.CurrentAngle
pRightFlipper.ObjRotZ = RightFlipper.CurrentAngle
pLeftFlipperShadow.ObjRotZ = LeftFlipper.CurrentAngle + 1
pRightFlipperShadow.ObjRotZ = RightFlipper.CurrentAngle + 1
End Sub
' ****************************************************
' sling shots and animations
' ****************************************************
Dim LeftStep, RightStep
Sub LeftSlingShot_Slingshot()
LS.VelocityCorrect(ActiveBall)
vpmTimer.PulseSw 15
RandomSoundSlingshotLeft pLeftSlingHammer
LeftStep = 0
LeftSlingShot.TimerInterval = 15
LeftSlingShot_Timer
End Sub
Sub LeftSlingShot_Timer()
Select Case LeftStep
Case 0: LeftSling1.Visible = False : LeftSling3.Visible = True : pLeftSlingHammer.TransZ = -28 : LeftSlingShot.TimerEnabled = True
Case 1: LeftSling3.Visible = False : LeftSling2.Visible = True : pLeftSlingHammer.TransZ = -10
Case 2: LeftSling2.Visible = False : LeftSling1.Visible = True : pLeftSlingHammer.TransZ = 0 : LeftSlingShot.TimerEnabled = False
End Select
LeftStep = LeftStep + 1
End Sub
Sub RightSlingShot_Slingshot()
RS.VelocityCorrect(ActiveBall)
vpmTimer.PulseSw 14
RandomSoundSlingshotRight pRightSlingHammer
RightStep = 0
RightSlingShot.TimerInterval = 15
RightSlingShot_Timer
End Sub
Sub RightSlingShot_Timer()
Select Case RightStep
Case 0: RightSling1.Visible = False : RightSling3.Visible = True : pRightSlingHammer.TransZ = -28 : RightSlingShot.TimerEnabled = True
Case 1: RightSling3.Visible = False : RightSling2.Visible = True : pRightSlingHammer.TransZ = -10
Case 2: RightSling2.Visible = False : RightSling1.Visible = True : pRightSlingHammer.TransZ = 0 : RightSlingShot.TimerEnabled = False
End Select
RightStep = RightStep + 1
End Sub
' ****************************************************
' bumpers
' ****************************************************
Sub Bumper43_Hit() : vpmTimer.PulseSw 43 : RandomSoundBumperTop Bumper43 : End Sub
Sub Bumper44_Hit() : vpmTimer.PulseSw 44 : RandomSoundBumperBottom Bumper44 : End Sub
Sub Bumper45_Hit() : vpmTimer.PulseSw 45 : RandomSoundBumperTop Bumper45 : End Sub
' ****************************************************
' switches
' ****************************************************
' stand-up targets
Sub sw22_Hit
STHit 22
End Sub
Sub sw22o_Hit
TargetBouncer Activeball, 1
End Sub
Sub sw23_Hit
STHit 23
End Sub
Sub sw23o_Hit
TargetBouncer Activeball, 1
End Sub
Sub sw24_Hit
STHit 24
End Sub
Sub sw24o_Hit
TargetBouncer Activeball, 1
End Sub
Sub sw30_Hit
STHit 30
End Sub
Sub sw30o_Hit
TargetBouncer Activeball, 1
End Sub
Sub sw31_Hit
STHit 31
End Sub
Sub sw31o_Hit
TargetBouncer Activeball, 1
End Sub
Sub sw32_Hit
STHit 32
End Sub
Sub sw32o_Hit
TargetBouncer Activeball, 1
End Sub
Sub sw35_Hit
STHit 35
End Sub
Sub sw35o_Hit
TargetBouncer Activeball, 1
End Sub
Sub sw36_Hit
STHit 36
End Sub
Sub sw36o_Hit
TargetBouncer Activeball, 1
End Sub
Sub sw37_Hit
STHit 37
End Sub
Sub sw37o_Hit
TargetBouncer Activeball, 1
End Sub
' top lanes
Sub sw40_Hit() : Controller.Switch(40) = True : End Sub
Sub sw40_Unhit() : Controller.Switch(40) = False : End Sub
Sub sw41_Hit() : Controller.Switch(41) = True : End Sub
Sub sw41_Unhit() : Controller.Switch(41) = False : End Sub
Sub sw42_Hit() : Controller.Switch(42) = True : End Sub
Sub sw42_Unhit() : Controller.Switch(42) = False : End Sub
' rollover stars
Sub sw26_Hit() : Controller.Switch(26) = True : End Sub
Sub sw26_Unhit() : Controller.Switch(26) = False : End Sub
Sub sw34_Hit() : Controller.Switch(34) = True : End Sub
Sub sw34_Unhit() : Controller.Switch(34) = False : End Sub
Sub sw39_Hit() : Controller.Switch(39) = True : End Sub
Sub sw39_Unhit() : Controller.Switch(39) = False : End Sub
Sub sw48_Hit() : Controller.Switch(48) = True : End Sub
Sub sw48_Unhit() : Controller.Switch(48) = False : End Sub
Sub sw49_Hit() : Controller.Switch(49) = True : End Sub
Sub sw49_Unhit() : Controller.Switch(49) = False : End Sub
Sub sw50_Hit() : Controller.Switch(50) = True : End Sub
Sub sw50_Unhit() : Controller.Switch(50) = False : End Sub
' kickback at left outlane
Sub sw17_Hit() : Controller.Switch(17) = True : End Sub
Sub sw17_Unhit() : Controller.Switch(17) = False : End Sub
' inlanes and outlanes
Sub sw18_Hit() : Controller.Switch(18) = True : End Sub
Sub sw18_Unhit() : Controller.Switch(18) = False : End Sub
Sub sw19_Hit() : Controller.Switch(19) = True : End Sub
Sub sw19_Unhit() : Controller.Switch(19) = False : End Sub
Sub sw20_Hit() : Controller.Switch(20) = True : End Sub
Sub sw20_Unhit() : Controller.Switch(20) = False : End Sub
' shooter lane
Sub sw52_Hit() : Controller.Switch(52) = True : End Sub
Sub sw52_UnHit() : Controller.Switch(52) = False : isBallMovedStraightUp = False : End Sub
' ramp trigger
Sub sw29_Hit() : Controller.Switch(29) = True : End Sub
Sub sw29_Unhit() : Controller.Switch(29) = False : End Sub
' spinners
Sub sw27_Spin() : vpmTimer.PulseSw 27 : SoundSpinner sw27 : End Sub
Sub sw51_Spin() : vpmTimer.PulseSw 51 : SoundSpinner sw51 : End Sub
' wire loop triggers
Sub trOrbitLaneRampStart_Hit()
WireRampOn True 'Play Plastic Ramp Sound
End Sub
Sub trOrbitWireRampStart_Hit()
WireRampOff ' Turn off the Ramp Sound
End Sub
Sub trOrbitWireRampStart_UnHit()
WireRampOn False ' On Wire Ramp Play Wire Ramp Sound
End Sub
Sub trOrbitRampEnd_Hit()
WireRampOff ' Turn off the Ramp Sound
End Sub
Sub trShooterLaneRampStart_Hit()
WireRampOn False ' On Wire Ramp Play Wire Ramp Sound
End Sub
Sub trShooterLaneRampEnd_Hit()
WireRampOff ' Turn off the Ramp Sound
End Sub
Sub ZCol_RubberBand007_Hit() : vpmTimer.PulseSw 21 : ZCol_RubberBand007_Timer : End Sub
Sub ZCol_RubberBand007_Timer()
If Not ZCol_RubberBand007.TimerEnabled Then ZCol_RubberBand007.TimerEnabled = 20 : ZCol_RubberBand007.TimerEnabled = True
If rRubberBand5.Visible Then
rRubberBand5.Visible = False
rRubberBand5a.Visible = True
SwitchSound sw50
Else
rRubberBand5.Visible = True
rRubberBand5a.Visible = False
ZCol_RubberBand007.TimerEnabled = False
End If
End Sub
Sub ZCol_RubberBand009_Hit() : vpmTimer.PulseSw 21 : ZCol_RubberBand009_Timer : End Sub
Sub ZCol_RubberBand009_Timer()
If Not ZCol_RubberBand009.TimerEnabled Then ZCol_RubberBand009.TimerEnabled = 20 : ZCol_RubberBand009.TimerEnabled = True
If rRubberBand6.Visible Then
rRubberBand6.Visible = False
rRubberBand6a.Visible = True
SwitchSound sw49
Else
rRubberBand6.Visible = True
rRubberBand6a.Visible = False
ZCol_RubberBand009.TimerEnabled = False
End If
End Sub
Sub SwitchSound(switch)
PlaySoundAtLevelStatic ("fx_sensor"), 1, switch
End Sub
' add some variation to the ball direction under the top lanes
Dim isBallMovedStraightUp : isBallMovedStraightUp = False
Sub sw40Dir_Hit(): MoveBallUnderTopLane ActiveBall : End Sub
Sub sw41Dir_Hit(): MoveBallUnderTopLane ActiveBall : End Sub
Sub sw42Dir_Hit(): MoveBallUnderTopLane ActiveBall : End Sub
Sub MoveBallUnderTopLane(movingBall)
With movingBall
Do While True
.VelX = .VelX + Rnd() * 4 - 2
If Abs(.VelX) > 0.1 Then Exit Do
If Not isBallMovedStraightUp Then isBallMovedStraightUp = True : Exit Do
Loop
End With
End Sub
' ****************************************************
' rotating spinner
' ****************************************************
Sub SpinnerTimer()
pSpinner27.RotX = 360 - sw27.CurrentAngle
pSpinnerRod27.TransZ = -Sin(sw27.CurrentAngle * 2 * 3.14 / 360) * 5
pSpinnerRod27.TransX = Sin((sw27.CurrentAngle - 90) * 2 * 3.14 / 360) * -5
pSpinner51.RotX = 360 - sw51.CurrentAngle
pSpinnerRod51.TransZ = -Sin(sw51.CurrentAngle * 2 * 3.14 / 360) * 5
pSpinnerRod51.TransX = Sin((sw51.CurrentAngle - 90) * 2 * 3.14 / 360) * -5
End Sub
' ****************************************************
' saucer
' ****************************************************
Dim sw25Step : sw25Step = 0
Dim sw33Step : sw33Step = 0
Dim sw38Step : sw38Step = 0
Dim sw25Ball : Set sw25Ball = Nothing
Dim sw33Ball : Set sw33Ball = Nothing
Dim sw38Ball : Set sw38Ball = Nothing
Sub sw25_Hit() : SoundSaucerLock: SlowDownBall ActiveBall : End Sub
Sub sw25_Unhit() : Controller.Switch(25) = False : End Sub
Sub sw33_Hit() : SoundSaucerLock: SlowDownBall ActiveBall : End Sub
Sub sw33_Unhit() : Controller.Switch(33) = False : End Sub
Sub sw38_Hit() : SoundSaucerLock: SlowDownBall ActiveBall : End Sub
Sub sw38_Unhit() : Controller.Switch(38) = False : End Sub
Sub SolRedEject(Enabled)
If Enabled Then
MoveHammer pSaucer25Hammer, 0
sw25Step = 0
sw25.TimerInterval = 11
sw25.TimerEnabled = True
End If
End Sub
Sub SolYellowEject(Enabled)
If Enabled Then
MoveHammer pSaucer33Hammer, 0
sw33Step = 0
sw33.TimerInterval = 11
sw33.TimerEnabled = True
End If
End Sub
Sub SolBlueEject(Enabled)
If Enabled Then
MoveHammer pSaucer38Hammer, 0
sw38Step = 0
sw38.TimerInterval = 11
sw38.TimerEnabled = True
End If
End Sub
Sub sw25_Timer()
SaucerAction sw25Step, pSaucer25Hammer, sw25Ball, 25, sw25, 190, 6, 0 'red
sw25Step = sw25Step + 1
End Sub
Sub sw33_Timer()
SaucerAction sw33Step, pSaucer33Hammer, sw33Ball, 33, sw33, 80, 18, 10 'yellow
sw33Step = sw33Step + 1
End Sub
Sub sw38_Timer()
SaucerAction sw38Step, pSaucer38Hammer, sw38Ball, 38, sw38, 180, 11, 10 'blue
sw38Step = sw38Step + 1
End Sub
Sub SaucerAction(step, pHammer, kBall, id, switch, kickangle, kickpower, kickvar)
Select Case step
Case 0 : MoveHammer pHammer, -1 : If switch.ballcntover = 1 Then SoundSaucerKick 1, switch
Case 1 : MoveHammer pHammer, 16 : If Controller.Switch(id) Then KickBall kBall, kickangle, kickvar, kickpower, 5, 30
Case 13 : Controller.Switch(id) = False
Case 25,26,27,28,29 : MoveHammer pHammer, -2
Case 30 : MoveHammer pHammer, 0 : switch.TimerEnabled = False
Case Else : ' nothing to do
End Select
End Sub
Sub KickBall(kBall, kAngle, kAngleVar, kVel, kVelZ, kLiftZ)
Dim rAngle
rAngle = 3.14159265 * (kAngle + (kAngleVar / 2 - kAngleVar * Rnd()) - 90) / 180
kVel = kVel + (kVel/20 - kVel/10 * Rnd())
kVelZ = kVelZ + (kVelZ/20 - kVelZ/10 * Rnd())
With kBall
.Z = .Z + kLiftZ
.VelZ = kVelZ
.VelX = cos(rAngle) * kVel
.VelY = sin(rAngle) * kVel
End With
End Sub
Sub MoveHammer(hammer, rotZ)
If rotZ = 0 Then
hammer.RotZ = 0
Else
hammer.RotZ = hammer.RotZ + rotZ
End If
End Sub
Sub SlowDownBall(actBall)
With actBall
If .VelY < 0 Then .VelY = .VelY / 2 : .VelX = .VelX / 2
End With
End Sub
Sub saucers_on()
Dim b