-
Notifications
You must be signed in to change notification settings - Fork 31
/
Family Guy 1.0.vbs
executable file
·4994 lines (4229 loc) · 172 KB
/
Family Guy 1.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
'Family Guy / IPD No. 5219 / 2006 / 4 Players
Option Explicit
Randomize
'//////////////////////////////////////////////////////////////////////
'// OPTIONS
'//////////////////////////////////////////////////////////////////////
const VR_Room = 0 ' 1 = VR Room; 0 = desktop or cab mode
'//////////////////////////////////////////////////////////////////////
Const VolumeDial = 0.8
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
'//////////////////////////////////////////////////////////////////////
' *** 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 minimal rooms only
const topper = 1 '0 = Off 1 or 2 = On - Topper visible in VR Room only (1 = fun topper by addestratatore, 2 = Family Guy logo)
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
'//////////////////////////////////////////////////////////////////////
'// MODS
'//////////////////////////////////////////////////////////////////////
Const BallBright = 1 '0 - Normal, 1 - Bright
Const RubberColor = 0 '0 - Original (Black), 1 - White
'******************************************************
'* VPM INIT *******************************************
'******************************************************
Const BallSize = 50
Const BallMass = 1
Const tnob = 10
Const lob = 0 'Locked balls
Dim cab_mode, DesktopMode: DesktopMode = table1.ShowDT
If Not DesktopMode and VR_Room=0 Then cab_mode=1 Else cab_mode=0
Const AmbientBallShadowOn = 1
Const DynamicBallShadowsOn = 1
Const RubberizerEnabled = 1
Const TargetBouncerEnabled = 1 '0 = normal standup targets, 1 = bouncy targets
Const TargetBouncerFactor = 0.7 'Level of bounces. Recommmended value of 0.7
Dim tablewidth: tablewidth = Table1.width
Dim tableheight: tableheight = Table1.height
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
Dim UseVPMDMD:UseVPMDMD = DesktopMode
LoadVPM "01560000","sam.vbs",3.43
'********************
'Standard definitions
'********************
Const UseSolenoids = 1
Const UseLamps = 0
Const UseSync = 0
Const HandleMech = 0
Const SSolenoidOff = ""
Const SCoin = ""
'******************************************************
'* ROM VERSION ****************************************
'******************************************************
Const cGameName = "fg_1200af"
'******************************************************
'* VARIABLES ******************************************
'******************************************************
Dim bsTrough, PlungerIM, BIP, TVScoop, DrunkenClam, FARTBank, DeathTarget, CPUPos, CPDPos, MiniPF, MiniRight, MiniLeft
Dim CastleGatePos, CastleGatePos2, CGUp, StewiePos, StewiePos2, StewiePos3, StewieDir, StewiePinball, MegPos
'******************************************************
'******************************************************
'******************************************************
'* TABLE INIT *****************************************
'******************************************************
'******************************************************
'******************************************************
Sub Table1_Init
LoadLUT
'* ROM AND DMD ****************************************
With Controller
.GameName = cGameName
.SplashInfoLine = "Family Guy - STERN 2007"
.HandleMechanics = 0
.HandleKeyboard = 0
.ShowDMDOnly = 1
.ShowFrame = 0
.ShowTitle = 0
.Hidden = 0
On Error Resume Next
.Run
If Err Then MsgBox Err.Description
On Error Goto 0
End With
'* PINMAME TIMER **************************************
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = 1
'* NUGDE **********************************************
vpmNudge.TiltSwitch=-7
vpmNudge.Sensitivity=5
vpmNudge.TiltObj=Array(bumper1,bumper2,bumper3,LeftSlingshot,RightSlingshot)
'* TROUGH *********************************************
Set bsTrough = New cvpmTrough
With bsTrough
.Size=4
.InitSwitches Array(21, 20, 19, 18)
.InitExit BallRelease, 90, 8
.Balls = 4
End With
'* MINI TROUGH ****************************************
Set MiniPF = New cvpmBallStack
With MiniPF
.InitSaucer sw55,55, 90, 29
.InitExitSnd SoundFX("Popper",DOFContactors), ""
.InitAddSnd "fx_kin"
.CreateEvents "MiniPF", sw55
End With
'* TV SCOOP *******************************************
Set TVScoop = New cvpmTrough
With TVScoop
.Size=3
.InitSwitches Array(13, 0, 0)
.InitExit sw13, 184.5, 20
.InitEntrySounds "VUKEnter", "", ""
.InitExitSounds "",SoundFX("VUKOut",DOFContactors)
.Balls = 0
End With
'* DRUNKEN CLAM ***************************************
Set DrunkenClam = New cvpmSaucer
With DrunkenClam
.InitKicker sw64,64, 183, 4, 0
.InitSounds "Saucer_Enter_2", "", SoundFX("Saucer_Kick",DOFContactors)
.CreateEvents "DrunkenClam", sw64
End With
''* FART TARGETS 4-BANK DROPTARGETS ********************
'
'Set FARTBank = New cvpmDropTarget
'With FARTBank
'.InitDrop Array(sw47,sw44,sw46,sw45), Array(44,47,45,46)
'.Initsnd SoundFX("",DOFContactors), SoundFX("Drop_Target_Reset_2",DOFContactors)
'End With
'
''* DEATH DROPTARGET *******************************
'
'Set DeathTarget = New cvpmDropTarget
'With DeathTarget
'.InitDrop Array(Array(sw9, sw9w)), Array(9)
'.Initsnd SoundFX("",DOFContactors), SoundFX("Drop_Target_Reset_1",DOFContactors)
'End With
'* IMPULSE PLUNGER ************************************
Const IMPowerSetting = 33
Const IMTime = 0.33
Set PlungerIM = New cvpmImpulseP
With plungerIM
.InitImpulseP BIPREG, IMPowerSetting, IMTime
.InitExitSnd "Popper", ""
.CreateEvents "PlungerIM"
End With
'* STARTUP CALLS **************************************
CPC.isdropped=1
kicker1.CreateSizedBallWithMass BallSize/2,Ballmass
kicker1.kick 180, 1
kicker1.enabled = 0
kicker2.CreateSizedBallWithMass BallSize/2,Ballmass
kicker2.kick 180, 1
kicker2.enabled = 0
kicker3.CreateSizedBallWithMass BallSize/2,Ballmass
kicker3.kick 180, 1
kicker3.enabled = 0
kicker4.CreateSizedBallWithMass BallSize/2,Ballmass
kicker4.kick 180, 1
kicker4.enabled = 0
sw55.createsizedball(14.6875) 'minipinball 5/8"
MiniPF.AddBall 0
PinCab_Backglass.blenddisablelighting = 1
InitVpmFFlipsSAM
'******************************************************
'******************************************************
'******************************************************
'* TABLE INIT END *************************************
'******************************************************
'******************************************************
'******************************************************
End Sub
Sub table1_Paused:Controller.Pause = 1:End Sub
Sub table1_unPaused:Controller.Pause = 0:End Sub
'//////////////////////////////////////////////////////////////////////
'// DRAIN HIT
'//////////////////////////////////////////////////////////////////////
Sub Drain_Hit:RandomSoundDrain Drain:bsTrough.AddBall Me:End Sub
'//////////////////////////////////////////////////////////////////////
'// Ball
'//////////////////////////////////////////////////////////////////////
If BallBright Then
table1.BallImage = "old_ass_eyes_ball"
Else
table1.BallImage = "MRBallDark2b"
End If
'//////////////////////////////////////////////////////////////////////
'// LUT
'//////////////////////////////////////////////////////////////////////
'//////////////---- LUT (Colour Look Up Table) ----//////////////
'0 = Fleep Natural Dark 1
'1 = Fleep Natural Dark 2
'2 = Fleep Warm Dark
'3 = Fleep Warm Bright
'4 = Fleep Warm Vivid Soft
'5 = Fleep Warm Vivid Hard
'6 = Skitso Natural and Balanced
'7 = Skitso Natural High Contrast
'8 = 3rdaxis Referenced THX Standard
'9 = CalleV Punchy Brightness and Contrast
'10 = HauntFreaks Desaturated
'11 = Tomate Washed Out
'12 = VPW Original 1 to 1
'13 = Bassgeige
'14 = Blacklight
'15 = B&W Comic Book
Dim LUTset, DisableLUTSelector, LutToggleSound, bLutActive
LutToggleSound = True
LoadLUT
'LUTset = 0 ' Override saved LUT for debug
SetLUT
ShowLUT_Init
DisableLUTSelector = 0 ' Disables the ability to change LUT option with magna saves in game when set to 1
Sub Table1_exit:SaveLUT:Controller.Stop:End Sub
Sub SetLUT 'AXS
Table1.ColorGradeImage = "LUT" & LUTset
VRFlashLUT.imageA = "FlashLUT" & LUTset
end sub
Sub LUTBox_Timer
LUTBox.TimerEnabled = 0
LUTBox.Visible = 0
VRFlashLUT.opacity = 0
End Sub
Sub ShowLUT
LUTBox.visible = 1
VRFlashLUT.opacity = 100
Select Case LUTSet
Case 0: LUTBox.text = "Fleep Natural Dark 1"
Case 1: LUTBox.text = "Fleep Natural Dark 2"
Case 2: LUTBox.text = "Fleep Warm Dark"
Case 3: LUTBox.text = "Fleep Warm Bright"
Case 4: LUTBox.text = "Fleep Warm Vivid Soft"
Case 5: LUTBox.text = "Fleep Warm Vivid Hard"
Case 6: LUTBox.text = "Skitso Natural and Balanced"
Case 7: LUTBox.text = "Skitso Natural High Contrast"
Case 8: LUTBox.text = "3rdaxis Referenced THX Standard"
Case 9: LUTBox.text = "CalleV Punchy Brightness and Contrast"
Case 10: LUTBox.text = "HauntFreaks Desaturated"
Case 11: LUTBox.text = "Tomate washed out"
Case 12: LUTBox.text = "VPW original 1on1"
Case 13: LUTBox.text = "bassgeige"
Case 14: LUTBox.text = "blacklight"
Case 15: LUTBox.text = "B&W Comic Book"
Case 16: LUTBox.text = "Skitso New ColorLut"
End Select
LUTBox.TimerEnabled = 1
End Sub
Sub SaveLUT
Dim FileObj
Dim ScoreFile
Set FileObj=CreateObject("Scripting.FileSystemObject")
If Not FileObj.FolderExists(UserDirectory) then
Exit Sub
End if
if LUTset = "" then LUTset = 0 'failsafe
Set ScoreFile=FileObj.CreateTextFile(UserDirectory & "FamilyGuyLUT.txt",True)
ScoreFile.WriteLine LUTset
Set ScoreFile=Nothing
Set FileObj=Nothing
End Sub
Sub LoadLUT
bLutActive = False
Dim FileObj, ScoreFile, TextStr
dim rLine
Set FileObj=CreateObject("Scripting.FileSystemObject")
If Not FileObj.FolderExists(UserDirectory) then
LUTset=0
Exit Sub
End if
If Not FileObj.FileExists(UserDirectory & "FamilyGuyLUT.txt") then
LUTset=0
Exit Sub
End if
Set ScoreFile=FileObj.GetFile(UserDirectory & "FamilyGuyLUT.txt")
Set TextStr=ScoreFile.OpenAsTextStream(1,0)
If (TextStr.AtEndOfStream=True) then
Exit Sub
End if
rLine = TextStr.ReadLine
If rLine = "" then
LUTset=0
Exit Sub
End if
LUTset = int (rLine)
Set ScoreFile = Nothing
Set FileObj = Nothing
End Sub
Sub ShowLUT_Init
LUTBox.visible = 0
VRFlashLUT.opacity = 0
End Sub
'******************************************************
'* KEYS ***********************************************
'******************************************************
Sub Table1_KeyDown(ByVal keycode)
'LUT controls
If keycode = LeftMagnaSave Then bLutActive = True
If keycode = RightMagnaSave Then
If bLutActive Then
if DisableLUTSelector = 0 then
LUTSet = LUTSet - 1
if LutSet < 0 then LUTSet = 16
SetLUT
ShowLUT
End If
End If
End If
If keycode = LeftTiltKey Then Nudge 90, 1.5:SoundNudgeLeft()
If keycode = RightTiltKey Then Nudge 270, 1.5:SoundNudgeRight()
If keycode = CenterTiltKey Then Nudge 0, 1.5:SoundNudgeCenter()
If keycode = keyInsertCoin1 or keycode = keyInsertCoin2 or keycode = keyInsertCoin3 or keycode = keyInsertCoin4 Then
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 = PlungerKey Then
SoundPlungerPull()
Plunger.PullBack
TimerVRPlunger.Enabled = True
TimerVRPlunger1.Enabled = False
VR_Primary_plunger.Y = -214.1667
End If
If keycode = RightFlipperKey Then
Controller.Switch(90)=1
Controller.Switch(82)=1
VR_Cab_ButtonRight.transx = -8
FlipperActivate RightFlipper, RFPress
If MiniPF.Balls=0 Then
PlaySound SoundFX("Stern_MiniFlipperUp2",DOFContactors)
MiniPF_RightFlipper.RotateToEnd
DOF 101, 1
MiniRight=1
End If
vpmFFlipsSam.FlipR true
Exit Sub
End If
If keycode = LeftFlipperKey Then
Controller.Switch(84)=1
VR_Cab_ButtonLeft.transx = 8
FlipperActivate LeftFlipper, LFPress
If MiniPF.Balls=0 Then
PlaySound SoundFX("Stern_MiniFlipperUp1",DOFContactors)
MiniPF_LeftFlipper.RotateToEnd
DOF 102, 1
MiniLeft=1
End If
vpmFFlipsSam.FlipL true
Exit Sub
End If
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub Table1_KeyUp(ByVal keycode)
'LUT controls
If keycode = LeftMagnaSave Then bLutActive = False
If KeyCode = PlungerKey Then
Plunger.Fire
TimerVRPlunger.Enabled = False
TimerVRPlunger1.Enabled = True
VR_Primary_plunger.Y = -214.1667
If BIP = 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
End If
If keycode = RightFlipperKey Then
Controller.Switch(90)=0
Controller.Switch(82)=0
VR_Cab_ButtonRight.transx = 0
FlipperDeActivate RightFlipper, RFPress
If MiniRight=1 Then
PlaySound SoundFX("Stern_MiniFlipperDown2",DOFContactors)
MiniPF_RightFlipper.RotateToStart
DOF 101, 0
MiniRight=0
End If
vpmFFlipsSam.FlipR false
Exit Sub
End If
If keycode = LeftFlipperKey Then
Controller.Switch(84)=0
VR_Cab_ButtonLeft.transx = 0
FlipperDeActivate LeftFlipper, LFPress
If MiniLeft=1 Then
PlaySound SoundFX("Stern_MiniFlipperDown1",DOFContactors)
MiniPF_LeftFlipper.RotateToStart
DOF 102, 0
MiniLeft=0
End If
vpmFFlipsSam.FlipL false
Exit Sub
End If
If vpmKeyUp(keycode) Then Exit Sub
End Sub
'******************************************************
'* SOLENOID CALLS *************************************
'******************************************************
SolCallback(1) = "solTrough" 'BallExit
SolCallback(2) = "AutoLaunch" 'AutoLaunch
SolCallback(3) = "SolDTDropUp" '4-Bank Drop Tragets reset
SolCallback(4) = "CPDSol" 'Ball Saver Down
SolCallback(5) = "DrunkenClam.SolOut" 'DrunkenClam Exit
SolCallback(6) = "SolDTSweeperUp" 'Single Drop Targte reset
'SolCallback(7) = "LeftSlingHit" 'Left Slingshot
'SolCallback(8) = "RightSlingHit" 'Right Slingshot
'SolCallback(9) = "Bump1Sol" 'Bottom Bumper
'SolCallback(10) = "Bump2Sol" 'Right Bumper
'SolCallback(11) = "Bump3Sol" 'Top Bumper
SolCallback(12) = "CPUSol" 'Ball Saver Up
SolCallback(13) = "TVScoop.SolOut" 'Swamp Eject Scoop
SolCallback(16) = "SolRFlipper"
SolCallback(15) = "SolLFlipper"
SolCallback(17) = "Miniflipper_Left"
SolCallback(18) = "Miniflipper_Right"
SolCallback(19) = "CastleGuardSol"
SolCallBack(20) = "StewieMove" 'Stewie Motor Drive
SolCallBack(21) = "MiniPFSol"
SolCallBack(22) = "MegMove" 'Meg Move Solenoid
SolCallback(23) = "Flash1" 'Flash Lower Left
SolCallBack(24)= "vpmSolSound SoundFX(""fx_knocker"",DOFKnocker)," 'Knocker
SolCallback(25) = "Flash3" 'Flash Backpanel Left
SolCallback(26) = "Flash4" 'Flash Backpanel Center
SolCallback(27) = "Flash5" 'Flash Backpanel Right
SolCallback(28) = "Flash6" 'Flash BeerCan
SolCallback(29) = "Flash29" 'Flash Fiona
SolCallback(30) = "Flash30" 'Flash RIght Orbit (Spinner)
SolCallback(31) = "Flash31" 'Flash Pop Bumpers
SolCallback(32) = "Flash2" 'Flash Lower Right
SolCallback(sLRFlipper) = "RFlipper"
SolCallback(sLLFlipper) = "LFlipper"
'//////////////////////////////////////////////////////////////////////
'********************************************
' Drop Target Controls
'********************************************
Sub SolDTDropUp(Enabled)
If Enabled Then
debug.print "SolDTDropUp"
DTRaise 44
DTRaise 45
DTRaise 46
DTRaise 47
RandomSoundDropTargetReset sw44p
End If
End Sub
Sub SolDTSweeperUp(Enabled)
If Enabled Then
debug.print "SolDTSweeperUp"
DTRaise 9
RandomSoundDropTargetReset sw9p
End If
End Sub
Sub sw9_hit
DTHit 9
End Sub
Sub sw44_hit
DTHit 44
End Sub
Sub sw45_hit
DTHit 45
End Sub
Sub sw46_hit
DTHit 46
End Sub
Sub sw47_hit
DTHit 47
End Sub
Sub CheckDTs
If gilvl=0 and controller.switch(44)= false then
Target4Off.visible=1
Else
Target4Off.visible=0
If gilvl=1 and controller.switch(44)= false then
Target4On.visible=1
Else
Target4On.visible=0
End if
End If
If gilvl=0 and controller.switch(45)= false then
Target3Off.visible=1
Else
Target3Off.visible=0
If gilvl=1 and controller.switch(45)= false then
Target3On.visible=1
Else
Target3On.visible=0
End if
End If
If gilvl=0 and controller.switch(46)= false then
Target2Off.visible=1
Else
Target2Off.visible=0
If gilvl=1 and controller.switch(46)= false then
Target2On.visible=1
Else
Target2On.visible=0
End if
End If
If gilvl=0 and controller.switch(47)= false then
Target1Off.visible=1
Else
Target1Off.visible=0
If gilvl=1 and controller.switch(47)= false then
Target1On.visible=1
Else
Target1On.visible=0
End if
End If
If gilvl=0 and controller.switch(9)= false then
TargetDeathOff.visible=1
else
TargetDeathOff.visible=0
If gilvl=1 and controller.switch(9)= false then
TargetDeathOn.visible=1
else
TargetDeathOn.visible=0
End if
End If
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 :LeftFlipperSmall.RotateToEnd 'leftflipper.rotatetoend
If leftflipper.currentangle < leftflipper.endangle + ReflipAngle Then
RandomSoundReflipUpLeft LeftFlipper
Else
SoundFlipperUpAttackLeft LeftFlipper
RandomSoundFlipperUpLeft LeftFlipper
End If
Else
LeftFlipper.RotateToStart:LeftFlipperSmall.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
FlipperLSh.RotZ = LeftFlipper.CurrentAngle
FlipperLSh1.RotZ = LeftFlipperSmall.CurrentAngle
FlipperRSh.RotZ = RightFlipper.CurrentAngle
End Sub
dim LF : Set LF = New FlipperPolarity
dim RF : Set RF = New FlipperPolarity
InitPolarity
'
''*******************************************
'' Late 70's to early 80's
'
'Sub InitPolarity()
' dim x, a : a = Array(LF, RF)
' for each x in a
' x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
' x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
' x.enabled = True
' x.TimeDelay = 80
' Next
'
' AddPt "Polarity", 0, 0, 0
' AddPt "Polarity", 1, 0.05, -2.7
' AddPt "Polarity", 2, 0.33, -2.7
' AddPt "Polarity", 3, 0.37, -2.7
' AddPt "Polarity", 4, 0.41, -2.7
' AddPt "Polarity", 5, 0.45, -2.7
' AddPt "Polarity", 6, 0.576,-2.7
' AddPt "Polarity", 7, 0.66, -1.8
' AddPt "Polarity", 8, 0.743, -0.5
' AddPt "Polarity", 9, 0.81, -0.5
' AddPt "Polarity", 10, 0.88, 0
'
' addpt "Velocity", 0, 0, 1
' addpt "Velocity", 1, 0.16, 1.06
' addpt "Velocity", 2, 0.41, 1.05
' addpt "Velocity", 3, 0.53, 1'0.982
' addpt "Velocity", 4, 0.702, 0.968
' addpt "Velocity", 5, 0.95, 0.968
' addpt "Velocity", 6, 1.03, 0.945
'
' LF.Object = LeftFlipper
' LF.EndPoint = EndPointLp
' RF.Object = RightFlipper
' RF.EndPoint = EndPointRp
'End Sub
'
'
'
''*******************************************
'' Mid 80's
'
'Sub InitPolarity()
' dim x, a : a = Array(LF, RF)
' for each x in a
' x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
' x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
' x.enabled = True
' x.TimeDelay = 80
' Next
'
' AddPt "Polarity", 0, 0, 0
' AddPt "Polarity", 1, 0.05, -3.7
' AddPt "Polarity", 2, 0.33, -3.7
' AddPt "Polarity", 3, 0.37, -3.7
' AddPt "Polarity", 4, 0.41, -3.7
' AddPt "Polarity", 5, 0.45, -3.7
' AddPt "Polarity", 6, 0.576,-3.7
' AddPt "Polarity", 7, 0.66, -2.3
' AddPt "Polarity", 8, 0.743, -1.5
' AddPt "Polarity", 9, 0.81, -1
' AddPt "Polarity", 10, 0.88, 0
'
' addpt "Velocity", 0, 0, 1
' addpt "Velocity", 1, 0.16, 1.06
' addpt "Velocity", 2, 0.41, 1.05
' addpt "Velocity", 3, 0.53, 1'0.982
' addpt "Velocity", 4, 0.702, 0.968
' addpt "Velocity", 5, 0.95, 0.968
' addpt "Velocity", 6, 1.03, 0.945
'
' LF.Object = LeftFlipper
' LF.EndPoint = EndPointLp
' RF.Object = RightFlipper
' RF.EndPoint = EndPointRp
'End Sub
'
'
'*******************************************
' Late 80's early 90's
'Sub InitPolarity()
' dim x, a : a = Array(LF, RF)
' for each x in a
' x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
' x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
' x.enabled = True
' x.TimeDelay = 60
' Next
'
' AddPt "Polarity", 0, 0, 0
' AddPt "Polarity", 1, 0.05, -5
' AddPt "Polarity", 2, 0.4, -5
' AddPt "Polarity", 3, 0.6, -4.5
' AddPt "Polarity", 4, 0.65, -4.0
' AddPt "Polarity", 5, 0.7, -3.5
' AddPt "Polarity", 6, 0.75, -3.0
' AddPt "Polarity", 7, 0.8, -2.5
' AddPt "Polarity", 8, 0.85, -2.0
' AddPt "Polarity", 9, 0.9,-1.5
' AddPt "Polarity", 10, 0.95, -1.0
' AddPt "Polarity", 11, 1, -0.5
' AddPt "Polarity", 12, 1.1, 0
' AddPt "Polarity", 13, 1.3, 0
'
' addpt "Velocity", 0, 0, 1
' addpt "Velocity", 1, 0.16, 1.06
' addpt "Velocity", 2, 0.41, 1.05
' addpt "Velocity", 3, 0.53, 1'0.982
' addpt "Velocity", 4, 0.702, 0.968
' addpt "Velocity", 5, 0.95, 0.968
' addpt "Velocity", 6, 1.03, 0.945
'
' LF.Object = LeftFlipper
' LF.EndPoint = EndPointLp
' RF.Object = RightFlipper
' RF.EndPoint = EndPointRp
'End Sub
'
''*******************************************
'' Early 90's and after
'
Sub InitPolarity()
dim x, a : a = Array(LF, RF)
for each x in a
x.AddPoint "Ycoef", 0, RightFlipper.Y-65, 1 'disabled
x.AddPoint "Ycoef", 1, RightFlipper.Y-11, 1
x.enabled = True
x.TimeDelay = 60
Next
AddPt "Polarity", 0, 0, 0
AddPt "Polarity", 1, 0.05, -5.5
AddPt "Polarity", 2, 0.4, -5.5
AddPt "Polarity", 3, 0.6, -5.0
AddPt "Polarity", 4, 0.65, -4.5
AddPt "Polarity", 5, 0.7, -4.0
AddPt "Polarity", 6, 0.75, -3.5
AddPt "Polarity", 7, 0.8, -3.0
AddPt "Polarity", 8, 0.85, -2.5
AddPt "Polarity", 9, 0.9,-2.0
AddPt "Polarity", 10, 0.95, -1.5
AddPt "Polarity", 11, 1, -1.0
AddPt "Polarity", 12, 1.05, -0.5
AddPt "Polarity", 13, 1.1, 0
AddPt "Polarity", 14, 1.3, 0
addpt "Velocity", 0, 0, 1
addpt "Velocity", 1, 0.16, 1.06
addpt "Velocity", 2, 0.41, 1.05
addpt "Velocity", 3, 0.53, 1'0.982
addpt "Velocity", 4, 0.702, 0.968
addpt "Velocity", 5, 0.95, 0.968
addpt "Velocity", 6, 1.03, 0.945
LF.Object = LeftFlipper
LF.EndPoint = EndPointLp
RF.Object = RightFlipper
RF.EndPoint = EndPointRp
End Sub
' Flipper trigger hit subs
Sub TriggerLF_Hit() : LF.Addball activeball : End Sub
Sub TriggerLF_UnHit() : LF.PolarityCorrect activeball : End Sub
Sub TriggerRF_Hit() : RF.Addball activeball : End Sub
Sub TriggerRF_UnHit() : RF.PolarityCorrect activeball : End Sub
'******************************************************
' FLIPPER CORRECTION FUNCTIONS
'******************************************************
Sub AddPt(aStr, idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
dim a : a = Array(LF, RF)
dim x : for each x in a
x.addpoint aStr, idx, aX, aY
Next
End Sub
Class FlipperPolarity
Public DebugOn, Enabled
Private FlipAt 'Timer variable (IE 'flip at 723,530ms...)
Public TimeDelay 'delay before trigger turns off and polarity is disabled TODO set time!
private Flipper, FlipperStart,FlipperEnd, FlipperEndY, LR, PartialFlipCoef
Private Balls(20), balldata(20)
dim PolarityIn, PolarityOut
dim VelocityIn, VelocityOut
dim YcoefIn, YcoefOut
Public Sub Class_Initialize
redim PolarityIn(0) : redim PolarityOut(0) : redim VelocityIn(0) : redim VelocityOut(0) : redim YcoefIn(0) : redim YcoefOut(0)
Enabled = True : TimeDelay = 50 : LR = 1: dim x : for x = 0 to uBound(balls) : balls(x) = Empty : set Balldata(x) = new SpoofBall : next
End Sub
Public Property let Object(aInput) : Set Flipper = aInput : StartPoint = Flipper.x : End Property
Public Property Let StartPoint(aInput) : if IsObject(aInput) then FlipperStart = aInput.x else FlipperStart = aInput : end if : End Property
Public Property Get StartPoint : StartPoint = FlipperStart : End Property
Public Property Let EndPoint(aInput) : FlipperEnd = aInput.x: FlipperEndY = aInput.y: End Property
Public Property Get EndPoint : EndPoint = FlipperEnd : End Property
Public Property Get EndPointY: EndPointY = FlipperEndY : End Property
Public Sub AddPoint(aChooseArray, aIDX, aX, aY) 'Index #, X position, (in) y Position (out)
Select Case aChooseArray
case "Polarity" : ShuffleArrays PolarityIn, PolarityOut, 1 : PolarityIn(aIDX) = aX : PolarityOut(aIDX) = aY : ShuffleArrays PolarityIn, PolarityOut, 0
Case "Velocity" : ShuffleArrays VelocityIn, VelocityOut, 1 :VelocityIn(aIDX) = aX : VelocityOut(aIDX) = aY : ShuffleArrays VelocityIn, VelocityOut, 0
Case "Ycoef" : ShuffleArrays YcoefIn, YcoefOut, 1 :YcoefIn(aIDX) = aX : YcoefOut(aIDX) = aY : ShuffleArrays YcoefIn, YcoefOut, 0
End Select
if gametime > 100 then Report aChooseArray
End Sub
Public Sub Report(aChooseArray) 'debug, reports all coords in tbPL.text
if not DebugOn then exit sub
dim a1, a2 : Select Case aChooseArray
case "Polarity" : a1 = PolarityIn : a2 = PolarityOut
Case "Velocity" : a1 = VelocityIn : a2 = VelocityOut
Case "Ycoef" : a1 = YcoefIn : a2 = YcoefOut
case else :tbpl.text = "wrong string" : exit sub
End Select
dim str, x : for x = 0 to uBound(a1) : str = str & aChooseArray & " x: " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
tbpl.text = str
End Sub
Public Sub AddBall(aBall) : dim x : for x = 0 to uBound(balls) : if IsEmpty(balls(x)) then set balls(x) = aBall : exit sub :end if : Next : End Sub
Private Sub RemoveBall(aBall)
dim x : for x = 0 to uBound(balls)
if TypeName(balls(x) ) = "IBall" then
if aBall.ID = Balls(x).ID Then
balls(x) = Empty
Balldata(x).Reset
End If
End If
Next
End Sub
Public Sub Fire()
Flipper.RotateToEnd
processballs
End Sub
Public Property Get Pos 'returns % position a ball. For debug stuff.
dim x : for x = 0 to uBound(balls)
if not IsEmpty(balls(x) ) then
pos = pSlope(Balls(x).x, FlipperStart, 0, FlipperEnd, 1)
End If
Next
End Property
Public Sub ProcessBalls() 'save data of balls in flipper range
FlipAt = GameTime
dim x : for x = 0 to uBound(balls)
if not IsEmpty(balls(x) ) then
balldata(x).Data = balls(x)
End If
Next
PartialFlipCoef = ((Flipper.StartAngle - Flipper.CurrentAngle) / (Flipper.StartAngle - Flipper.EndAngle))
PartialFlipCoef = abs(PartialFlipCoef-1)
End Sub
Private Function FlipperOn() : if gameTime < FlipAt+TimeDelay then FlipperOn = True : End If : End Function 'Timer shutoff for polaritycorrect
Public Sub PolarityCorrect(aBall)
if FlipperOn() then
dim tmp, BallPos, x, IDX, Ycoef : Ycoef = 1
'y safety Exit
if aBall.VelY > -8 then 'ball going down
RemoveBall aBall
exit Sub
end if
'Find balldata. BallPos = % on Flipper
for x = 0 to uBound(Balls)
if aBall.id = BallData(x).id AND not isempty(BallData(x).id) then
idx = x
BallPos = PSlope(BallData(x).x, FlipperStart, 0, FlipperEnd, 1)
if ballpos > 0.65 then Ycoef = LinearEnvelope(BallData(x).Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
end if
Next
If BallPos = 0 Then 'no ball data meaning the ball is entering and exiting pretty close to the same position, use current values.
BallPos = PSlope(aBall.x, FlipperStart, 0, FlipperEnd, 1)
if ballpos > 0.65 then Ycoef = LinearEnvelope(aBall.Y, YcoefIn, YcoefOut) 'find safety coefficient 'ycoef' data
End If