-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathFrankenstein - BW.vbs
2399 lines (2156 loc) · 86.7 KB
/
Frankenstein - BW.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
'
' FFFFFFFFF RRRRRRRR AAAAA NN NN KK KK EEEEEEEE NN NN SSSSSSS TTTTTTTT EEEEEEEE II NN NN
' FF RR RR AA AA NNN NN KK KK EE NNN NN SS SS TT EE II NNN NN
' FF RR RR AA AA NNNN NN KK KK EE NNNN NN SS TT EE II NNNN NN
' FF RR RR AA AA NN NN NN KK KK EE NN NN NN SS TT EE II NN NN NN
' FFFFF RRRRRRRR AAAAAAAAA NN NN NN KK KK EEEEEEE NN NN NN SSSSSSS TT EEEEEEE II NN NN NN
' FF RR RR AA AA NN NNNN KKKK EE NN NNNN SS TT EE II NN NNNN
' FF RR RR AA AA NN NNN KK KK EE NN NNN SS TT EE II NN NNN
' FF RR RR AA AA NN NN KK KK EE NN NN SS SS TT EE II NN NN
' FF RR RR AA AA NN NN KK KK EEEEEEEEE NN NN SSSSSSS TT EEEEEEEEE II NN NN
'
'
' VPX MOD by BALUTITO
'
' Version 1.0: Initial release
' Version 1.0.1: Correct LUT initialization
' Added a wall for Frank
' Added a playfield wall left to the Geneva scoop
' Version 1.1: Some physical improvements to match the real table, i.e. at the Sarcophagus scoop, the kickback and the plastic ramp
' Less reflection on the transparent plastic over the bumper area
' Correct GI-Off initialisation at table startup
'
' Schreibi34:
' Visuals and gameplay
' "It's simply amazing what you do in Blender. So thrilling, so inspiring, so extraordinary. I'm overwhelmed every time when I see what you have created.
' You are the man. And a very relaxed, cool guy too. And for sure an awesome drummer ;-).
' Once again it was a pleasure and an honor to work with you" (this was written by Herweh)
'
' Herweh:
' Scripting, VP development and gameplay
' "Everything you see below in this script! Without him Mr. Basic v2.0 Schreibi34 would have been totally lost! What he has done on this table goes beyond
' my imagination. From animating Frank to implementing RothbauerW's physics to the texture swaps to all sorts of extras. Please check out all the stuff
' that the script Voodoo Master has provided for you below!
' Thanks for being such a cool guy! It was a pleasure!" (this was written by Schreibi34)
'
' --------------------------------------------------------------------------------------------------------------------------------------------------------
'
' Special thanks to:
'
' - Dark: We all know what he did! Frank is just jawdropping!!
' - Dids666: For starting all of this and his awesome meshes. Thanks for letting us finish this!!
' - Sheltemke: For stitching together the PF image and playtesting
' - Mlager8: For PS help on the sling plastics
' - RothbauerW: For his awesome physics' guide at vpinball.com and some more help on the physics
' - Mark70, Bord, Thalamus: For beta testing and some good hints
' - Batch: For the DT background image (Sorry for making it a bit darker! Batch's original is in the image manager for those who like more pop)
' - Schotty VH: For gameplay hints
Option Explicit
Randomize
Dim EnableGI, EnableFlasher, EnableReflectionsAtBall, EnableLUTChangeWithRightMagnaSave, SelectSidewalls, ShowBallShadow, LetTheBallJump, AnimateFranksHead, RailsVisible
' ****************************************************
' OPTIONS
' ****************************************************
' ENABLE/DISABLE GI (general illumination)
' 0 = GI is off
' 1 = GI is on
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 (value can be between 0 and 1 and controls the reflections' intensity)
EnableReflectionsAtBall = 0
' ENABLED/DISABLE THE ABILITY TO CHANGE THE LUT FILE WITH THE RIGHT MAGNASAVE BUTTON
' 0 = disabled
' 1 = enabled (default)
EnableLUTChangeWithRightMagnaSave = 1
' SELECT YOUR PREFERRED SIDEWALLS
' 0 = autoselect (default)
' 1 = use sidewalls rendered for fullscreen view
' 2 = use sidewalls rendered for a medium view
' 3 = use sidewalls rendered for desktop view
' 4 = use sidewalls rendered for general illumination is off
SelectSidewalls = 0
' ANIMATE FRANK'S HEAD MOVING AROUND
' 0 = animation is off or motor is broken
' 1 = Frank's head is randonly moving around
' 2 = Frank's head is following the nearest ball
' 3 = Frank is watching the action (looking to switches or firing solenoids of the table)
' 4 = Frank's head is moving around like in some youtube videos
AnimateFranksHead = 4
' SHOW BALL SHADOWS
' 0 = no ball shadows
' 1 = ball shadows are visible
ShowBallShadow = 1
' LET THE BALL JUMP A BIT
' 0 = off
' 1 to 6 = ball jump intensity (3 = default)
LetTheBallJump = 3
' SIDE RAILS AND LOCKBAR VISIBILITY
' 0 = hide side rails
' 1 = show side rails
' 2 = side rails visible just in desktop mode
RailsVisible = 2
' volume for rolling sound and head motor sound
Const RollingSoundFactor = 0.15
Const HeadMotorSoundFactor = 0.6
' LUT names and inital LUT
Dim luts, lutpos
luts = Array("ColorGradeLUT256x16_1to1", "LUT_MSF_1", "LUT_MSF_2", "LUT_MSF_3", "LUT_MSF_4", "LUT_MSF_5", "LUT_MSF_6")
lutpos = 0
'***************************************************************************************************************************************************************
'***************************************************************************************************************************************************************
' ****************************************************
' standard definitions
' ****************************************************
Const UseSolenoids = 2
Const UseLamps = 0
Const UseSync = 0
Const HandleMech = 0
Const UseGI = 1
'Standard Sounds
Const SSolenoidOn = "fx_Solenoid"
Const SSolenoidOff = ""
Const SFlipperOn = ""
Const SFlipperOff = ""
Const SCoin = "fx_coin"
'***************************************************************************************************************************************************************
'***************************************************************************************************************************************************************
Const cDMDRotation = -1 '-1 for No change, 0 - DMD rotation of 0?, 1 - DMD rotation of 90?
Const cGameName = "frankst" 'ROM name
Const ballsize = 50
Const ballmass = 1
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
Dim DesktopMode: DesktopMode = Frankenstein.ShowDT
Dim i, bsTrough
If LetTheBallJump > 6 Then LetTheBallJump = 6 : If LetTheBallJump < 0 Then LetTheBallJump = 0
If EnableReflectionsAtBall < 0 Or EnableReflectionsAtBall > 1 Then EnableReflectionsAtBall = 0
LUTBox.Visible = False
' ****************************************************
' table init
' ****************************************************
Sub Frankenstein_Init()
vpmInit Me
With Controller
.GameName = cGameName
.SplashInfoLine = "Frankenstein (Sega 1995)"
.HandleMechanics = False
.HandleKeyboard = False
.ShowDMDOnly = True
.ShowFrame = False
.ShowTitle = False
.Hidden = False
.Games("frankst").Settings.Value("sound") = 0
.Games("frankst").Settings.Value("samples") = 0
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
' initialize some table settings
InitTable
End Sub
Sub Frankenstein_Paused() : Controller.Pause = True : End Sub
Sub Frankenstein_UnPaused() : Controller.Pause = False : End Sub
Sub Frankenstein_Exit() : Controller.Stop : End Sub
Sub InitTable()
' tilt
vpmNudge.TiltSwitch = 1
vpmNudge.Sensitivity = 1
vpmNudge.TiltObj = Array(Bumper13, Bumper14, Bumper15, Bumper16, LeftSlingshot, RightSlingshot)
' ball trough
Set bsTrough = New cvpmBallStack
With bsTrough
.InitSw 0, 14, 13, 12, 11, 10, 9, 0
.InitKick BallLockout, 80, 10
.Balls = 6
End With
' init lights, flippers, bumpers, ...
InitLights InsertLights
' init timers
PinMAMETimer.Interval = PinMAMEInterval
PinMAMETimer.Enabled = True
LampTimer.Enabled = True
GraphicsTimer.Interval = 10
GraphicsTimer.Enabled = True
RollingSoundTimer.Interval = 10
RollingSoundTimer.Enabled = True
GITimer.Interval = 15
FrankHeadTimer.Interval = 17
FrankHeadTimer.Enabled = (AnimateFranksHead = 1 Or AnimateFranksHead = 2 Or AnimateFranksHead = 3)
pSiderailsLockbar.Visible = RailsVisible = 1 Or (RailsVisible = 2 And DesktopMode)
pSiderailsLockbarGIOff.Visible = pSiderailsLockbar.Visible
Frankenstein.ColorGradeImage = luts(lutpos)
End Sub
' ****************************************************
' keys
' ****************************************************
Sub Frankenstein_KeyDown(ByVal keycode)
If keycode = PlungerKey Then Controller.Switch(62) = True
If keycode = LeftFlipperKey Then LFPress = 1 ' : Controller.Switch(63) = True
If keycode = RightFlipperKey Then RFPress = 1 : RUFPress = 1 ' : Controller.Switch(64) = True
If keycode = LeftTiltKey Then Nudge 90,2: Playsound SoundFX("fx_nudge",0)
If keycode = RightTiltKey Then Nudge 270,2: Playsound SoundFX("fx_nudge",0)
If keycode = CenterTiltKey Then Nudge 0,3: Playsound SoundFX("fx_nudge",0)
If keycode = RightMagnaSave And EnableLUTChangeWithRightMagnaSave = 1 Then
LUTBox.Visible = True
lutpos = lutpos + 1 : If lutpos > UBound(luts) Then lutpos = 0 : End If
Frankenstein.ColorGradeImage = luts(lutpos)
Dim tekst : tekst = "LUT id: " & lutpos & " " & luts(lutpos)
LUTBox.Text = tekst
vpmTimer.AddTimer 3000, "If LUTBox.Text =" + chr(34) + tekst + chr(34) + " Then LUTBox.Visible = False'"
End If
If vpmKeyDown(keycode) Then Exit Sub
End Sub
Sub Frankenstein_KeyUp(ByVal keycode)
If keycode = PlungerKey Then Controller.Switch(62) = False
If keycode = LeftFlipperKey Then
LFPress = 0
LeftFlipper.EOSTorqueAngle = EOSA
LeftFlipper.EOSTorque = EOST
' Controller.Switch(63) = False
End If
If keycode = RightFlipperKey Then
RFPress = 0
RightFlipper.EOSTorqueAngle = EOSA
RightFlipper.EOSTorque = EOST
RUFPress = 0
RightUpperFlipper.EOSTorqueAngle = EOSA
RightUpperFlipper.EOSTorque = EOST
' Controller.Switch(64) = False
End If
If vpmKeyUp(keycode) Then Exit Sub
End Sub
'Start the music
DIM music
music = "frank.mp3"
PlayMusic "frank.mp3"
Sub Frankenstein_MusicDone()
PlayMusic "frank.mp3"
End Sub
' ****************************************************
' *** solenoids
' ****************************************************
' tools
SolCallback(1) = "SolLockout"
SolCallback(2) = "SolBallRelease"
SolCallback(3) = "SolAutoLaunch"
SolCallback(4) = "SolLowerScoopEject"
SolCallback(5) = "SolTopScoopEject"
SolCallback(6) = "SolIceCaveEject"
SolCallback(7) = "SolVUKEject"
SolCallback(8) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
SolCallback(9) = "SolTrapLeftHand"
SolCallback(11) = "SolGI"
SolCallback(12) = "SolTrapRightHand"
SolCallback(13) = "SolFranksArms"
SolCallback(14) = "SolOrbitDiverter"
SolCallback(16) = "SolKickback"
' flasher
SolCallback(15) = "SolFlasher 0, " ' around VUK
SolCallback(25) = "SolFlasher 1, " ' above ANK
SolCallback(26) = "SolFlasher 2, " ' above FR
SolCallback(27) = "SolFlasher 3, " ' above IN
SolCallback(28) = "SolFlasher 4, " ' at pop bumpers
SolCallback(29) = "SolFlasher 5, " ' at spinner
SolCallback(30) = "SolFlasher 6, " ' upper left corner
SolCallback(31) = "SolFlasher 7, " ' around VUK
' flipper
SolCallback(sLLFlipper) = "SolLFlipper"
SolCallback(sLRFlipper) = "SolRFlipper"
' ******************************************************
' outhole, drain and ball release
' ******************************************************
Sub Drain_Hit()
BallSearch
PlaySoundAtVol "drain", Drain, 0.01
FrankIsWatching ActiveBall
bsTrough.AddBall Me
If bsTrough.Balls = 6 Then StopFranksHeadMode4
End Sub
Sub SolLockout(Enabled)
If Enabled Then
PlaySoundAt SoundFX(SSolenoidOn, DOFContactors), BallLockout
If bsTrough.Balls = 6 Then StartFranksHeadMode4
If bsTrough.Balls > 0 Then bsTrough.SolOut True
End If
End Sub
Sub BallRelease_Hit() : Controller.Switch(15) = True : End Sub
Sub BallRelease_Unhit() : Controller.Switch(15) = False : End Sub
Sub SolBallRelease(Enabled)
If Enabled Then
If Controller.Switch(15) Then
PlaySoundAt SoundFX("fx_ballrel", DOFContactors), BallRelease
BallRelease.Kick 85, 7
End If
End If
End Sub
' find balls that have fallen off the table
Sub BallSearch()
Dim b
For Each b In GetBalls
If b.Y > 2200 Then
b.X = 155 : b.Y = 550 : b.VelX = 0 : b.VelY = 0
End If
Next
End Sub
' ****************************************************
' flipper subs
' ****************************************************
Sub SolLFlipper(Enabled)
If Enabled Then
PlaySoundAtVol SoundFX("fx_flipperup",DOFContactors), LeftFlipper, 2
LF.Fire 'LeftFlipper.RotateToEnd
Else
PlaySoundAt SoundFX("fx_flipperdown",DOFContactors), LeftFlipper
LeftFlipper.RotateToStart
End If
End Sub
Sub SolRFlipper(Enabled)
If Enabled Then
PlaySoundAtVol SoundFX("fx_flipperup",DOFContactors),RightFlipper, 2
RF.Fire 'RightFlipper.RotateToEnd
RightUpperFlipper.RotateToEnd
Else
PlaySoundAt SoundFX("fx_flipperdown",DOFContactors),RightFlipper
RightFlipper.RotateToStart
RightUpperFlipper.RotateToStart
End If
End Sub
' flipper hit sounds
Sub LeftFlipper_Collide(parm)
PlaySoundAtBallVol "fx_flip_hit_" & Int(Rnd*3), 1
End Sub
Sub RightFlipper_Collide(parm)
PlaySoundAtBallVol "fx_flip_hit_" & Int(Rnd*3), 1
End Sub
Sub RightUpperFlipper_Collide(parm)
PlaySoundAtBallVol "fx_flip_hit_" & Int(Rnd*3), 1
End Sub
' ****************************************************
' sling shots and animations
' ****************************************************
Dim LeftStep, RightStep
Sub LeftSlingShot_Slingshot()
vpmTimer.PulseSw 47
PlaySoundAt SoundFX("fx_left_slingshot", DOFContactors), pLeftSlingHammer
FrankIsWatching pLeftSlingHammer
LeftStep = 0
LeftSlingShot.TimerInterval = 5
LeftSlingShot_Timer
End Sub
Sub LeftSlingShot_Timer()
Select Case LeftStep
Case 0: pRubberLeftSling1.Visible = False : pRubberLeftSling2.Visible = True : pLeftSlingHammer.TransZ = -12 : LeftSlingShot.TimerEnabled = True
Case 1: pRubberLeftSling2.Visible = False : pRubberLeftSling3.Visible = True : pLeftSlingHammer.TransZ = -24 : LeftSlingShot.TimerInterval = 50
Case 2: pRubberLeftSling3.Visible = False : pRubberLeftSling2.Visible = True : pLeftSlingHammer.TransZ = -12
Case 3: pRubberLeftSling2.Visible = False : pRubberLeftSling1.Visible = True : pLeftSlingHammer.TransZ = 0 : LeftSlingShot.TimerEnabled = False
End Select
LeftStep = LeftStep + 1
End Sub
Sub RightSlingShot_Slingshot()
vpmTimer.PulseSw 48
PlaySoundAt SoundFX("fx_right_slingshot", DOFContactors), pRightSlingHammer
FrankIsWatching pRightSlingHammer
RightStep = 0
RightSlingShot.TimerInterval = 5
RightSlingShot_Timer
End Sub
Sub RightSlingShot_Timer()
Select Case RightStep
Case 0: pRubberRightSling1.Visible = False : pRubberRightSling2.Visible = True : pRightSlingHammer.TransZ = -12 : RightSlingShot.TimerEnabled = True
Case 1: pRubberRightSling2.Visible = False : pRubberRightSling3.Visible = True : pRightSlingHammer.TransZ = -24 : RightSlingShot.TimerInterval = 50
Case 2: pRubberRightSling3.Visible = False : pRubberRightSling2.Visible = True : pRightSlingHammer.TransZ = -12
Case 3: pRubberRightSling2.Visible = False : pRubberRightSling1.Visible = True : pRightSlingHammer.TransZ = 0 : RightSlingShot.TimerEnabled = False
End Select
RightStep = RightStep + 1
End Sub
' ****************************************************
' bumpers
' ****************************************************
Sub Bumper13_Hit() : vpmTimer.PulseSw 41 : PlaySoundAt SoundFX("fx_bumper" & Int(Rnd*3),DOFContactors), Bumper13 : FrankIsWatching ActiveBall : End Sub
Sub Bumper14_Hit() : vpmTimer.PulseSw 42 : PlaySoundAt SoundFX("fx_bumper" & Int(Rnd*3),DOFContactors), Bumper14 : FrankIsWatching ActiveBall : End Sub
Sub Bumper15_Hit() : vpmTimer.PulseSw 43 : PlaySoundAt SoundFX("fx_bumper" & Int(Rnd*3),DOFContactors), Bumper15 : FrankIsWatching ActiveBall : End Sub
Sub Bumper16_Hit() : vpmTimer.PulseSw 44 : PlaySoundAt SoundFX("fx_bumper" & Int(Rnd*3),DOFContactors), Bumper16 : FrankIsWatching ActiveBall : End Sub
' ****************************************************
' switches
' ****************************************************
' orbit
Sub sw33_Hit() : Controller.Switch(33) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw33_Unhit() : Controller.Switch(33) = False : End Sub
Sub sw34_Hit() : Controller.Switch(34) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw34_Unhit() : Controller.Switch(34) = False : End Sub
Sub sw35_Hit() : Controller.Switch(35) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw35_Unhit() : Controller.Switch(35) = False : End Sub
Sub sw36_Hit() : Controller.Switch(36) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw36_Unhit() : Controller.Switch(36) = False : End Sub
Sub sw56_Hit() : Controller.Switch(56) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw56_Unhit() : Controller.Switch(56) = False : End Sub
' kickback at left outlane
Sub sw37_Hit() : Controller.Switch(37) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw37_Unhit() : Controller.Switch(37) = False : End Sub
' inlanes and outlanes
Sub sw38_Hit() : Controller.Switch(38) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw38_Unhit() : Controller.Switch(38) = False : End Sub
Sub sw39_Hit() : Controller.Switch(39) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw39_Unhit() : Controller.Switch(39) = False : End Sub
Sub sw40_Hit() : Controller.Switch(40) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw40_Unhit() : Controller.Switch(40) = False : End Sub
' shooter lane
Sub sw16_Hit() : Controller.Switch(16) = True : RollOverSound : FrankIsWatching ActiveBall : End Sub
Sub sw16_UnHit() : Controller.Switch(16) = False : End Sub
' ramp trigger
Sub sw45_Hit() : Controller.Switch(45) = True : FrankIsWatching ActiveBall : End Sub
Sub sw45_Unhit() : Controller.Switch(45) = False : End Sub
Sub sw46_Hit() : Controller.Switch(46) = True : FrankIsWatching ActiveBall : End Sub
Sub sw46_Unhit() : Controller.Switch(46) = False : End Sub
' spinner
Sub sw54_Spin() : vpmTimer.PulseSw 54 : PlaySoundAt "fx_spinner", sw54 : End Sub
' ****************************************************
' stand-up targets
' ****************************************************
Dim sw17Dir, sw18Dir, sw19Dir, sw20Dir, sw21Dir, sw22Dir, sw23Dir, sw24Dir, sw25Dir, sw26Dir, sw27Dir, sw28Dir, sw29Dir
Sub sw17_Hit() : MoveStandUpTarget 17, sw17, sw17P, sw17PGIOff, sw17Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw17_Timer() : MoveStandUpTarget 17, sw17, sw17P, sw17PGIOff, sw17Dir, False : End Sub
Sub sw18_Hit() : MoveStandUpTarget 18, sw18, sw18P, sw18PGIOff, sw18Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw18_Timer() : MoveStandUpTarget 18, sw18, sw18P, sw18PGIOff, sw18Dir, False : End Sub
Sub sw19_Hit() : MoveStandUpTarget 19, sw19, sw19P, sw19PGIOff, sw19Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw19_Timer() : MoveStandUpTarget 19, sw19, sw19P, sw19PGIOff, sw19Dir, False : End Sub
Sub sw20_Hit() : MoveStandUpTarget 20, sw20, sw20P, sw20PGIOff, sw20Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw20_Timer() : MoveStandUpTarget 20, sw20, sw20P, sw20PGIOff, sw20Dir, False : End Sub
Sub sw21_Hit() : MoveStandUpTarget 21, sw21, sw21P, sw21PGIOff, sw21Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw21_Timer() : MoveStandUpTarget 21, sw21, sw21P, sw21PGIOff, sw21Dir, False : End Sub
Sub sw22_Hit() : MoveStandUpTarget 22, sw22, sw22P, sw22PGIOff, sw22Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw22_Timer() : MoveStandUpTarget 22, sw22, sw22P, sw22PGIOff, sw22Dir, False : End Sub
Sub sw23_Hit() : MoveStandUpTarget 23, sw23, sw23P, sw23PGIOff, sw23Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw23_Timer() : MoveStandUpTarget 23, sw23, sw23P, sw23PGIOff, sw23Dir, False : End Sub
Sub sw24_Hit() : MoveStandUpTarget 24, sw24, sw24P, sw24PGIOff, sw24Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw24_Timer() : MoveStandUpTarget 24, sw24, sw24P, sw24PGIOff, sw24Dir, False : End Sub
Sub sw25_Hit() : MoveStandUpTarget 25, sw25, sw25P, sw25PGIOff, sw25Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw25_Timer() : MoveStandUpTarget 25, sw25, sw25P, sw25PGIOff, sw25Dir, False : End Sub
Sub sw26_Hit() : MoveStandUpTarget 26, sw26, sw26P, sw26PGIOff, sw26Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw26_Timer() : MoveStandUpTarget 26, sw26, sw26P, sw26PGIOff, sw26Dir, False : End Sub
Sub sw27_Hit() : MoveStandUpTarget 27, sw27, sw27P, sw27PGIOff, sw27Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw27_Timer() : MoveStandUpTarget 27, sw27, sw27P, sw27PGIOff, sw27Dir, False : End Sub
Sub sw28_Hit() : MoveStandUpTarget 28, sw28, sw28P, sw28PGIOff, sw28Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw28_Timer() : MoveStandUpTarget 28, sw28, sw28P, sw28PGIOff, sw28Dir, False : End Sub
Sub sw29_Hit() : MoveStandUpTarget 29, sw29, sw29P, sw29PGIOff, sw29Dir, True : FrankIsWatching ActiveBall : End Sub
Sub sw29_Timer() : MoveStandUpTarget 29, sw29, sw29P, sw29PGIOff, sw29Dir, False : End Sub
Sub MoveStandUpTarget(id, sw, prim, primGIOff, counter, init)
If init And prim.RotX < 10 Then
OnStandupTargetHit
vpmTimer.PulseSw id
sw.TimerInterval = 5
sw.TimerEnabled = True
counter = 5
End If
prim.TransY = prim.TransY - counter / 4
prim.RotX = prim.RotX + counter
primGIOff.TransY = prim.TransY
primGIOff.RotX = prim.RotX
If prim.RotX >= 10 Then counter = -0.5
If prim.RotX = 0 Then sw.TimerEnabled = False
End Sub
' ****************************************************
' rotating spinner
' ****************************************************
Sub SpinnerTimer_Timer()
pSpinner54.RotX = 360 - sw54.CurrentAngle
pSpinner54GIOff.RotX = pSpinner54.RotX
pSpinner54Rod.TransZ = -Sin(sw54.CurrentAngle * 2 * 3.14 / 360) * 5
pSpinner54Rod.TransX = Sin((sw54.CurrentAngle - 90) * 2 * 3.14 / 360) * -5
End Sub
' ****************************************************
' saucer
' ****************************************************
Dim sw53Step : sw53Step = 0
Dim sw55Step : sw55Step = 0
Dim sw31Step : sw31Step = 0
Dim sw32Step : sw32Step = 0
Dim sw53Ball : Set sw53Ball = Nothing
Dim sw55Ball : Set sw55Ball = Nothing
Dim sw31Ball : Set sw31Ball = Nothing
Dim sw32Ball : Set sw32Ball = Nothing
Sub sw53_Hit() : PlaySoundAt "fx_saucer_enter", sw53 : End Sub
Sub sw53_Unhit() : Controller.Switch(53) = False : End Sub
Sub sw55_Hit() : PlaySoundAt "fx_saucer_enter", sw55 : End Sub
Sub sw55_Unhit() : Controller.Switch(55) = False : End Sub
Sub sw31s_Hit() : PlaySoundAt "fx_balldrop" & Int(Rnd*3), sw31s : End Sub
Sub sw31_Hit() : PlaySoundAt "fx_loosemetalplate", sw31 : End Sub
Sub sw31_Unhit() : Controller.Switch(31) = False : sw31e.Enabled = True : End Sub
Sub sw31e_Hit() : KickScoop ActiveBall, 107, 25 : sw31e.Enabled = False : End Sub
Sub sw32s_Hit() : PlaySoundAt "fx_balldrop" & Int(Rnd*3), sw32s : End Sub
Sub sw32_Hit() : PlaySoundAt "fx_loosemetalplate", sw32 : End Sub
Sub sw32_Unhit() : Controller.Switch(32) = False : sw32e.Enabled = True : End Sub
Sub sw32e_Hit() : KickScoop ActiveBall, 165, 20 : sw32e.Enabled = False : End Sub
Sub SolIceCaveEject(Enabled)
If Enabled Then
MoveHammer pSaucer55Hammer, 0
sw55Step = 0
sw55.TimerInterval = 11
sw55.TimerEnabled = True
End If
End Sub
Sub SolVUKEject(Enabled)
If Enabled Then
sw53Step = 0
sw53.TimerInterval = 11
sw53.TimerEnabled = True
End If
End Sub
Sub SolTopScoopEject(Enabled)
If Enabled Then
sw31Step = 0
sw31.TimerInterval = 11
sw31.TimerEnabled = True
End If
End Sub
Sub SolLowerScoopEject(Enabled)
If Enabled Then
sw32Step = 0
sw32.TimerInterval = 11
sw32.TimerEnabled = True
End If
End Sub
Sub sw55_Timer()
' ice cave
SaucerAction sw55Step, pSaucer55Hammer, sw55Ball, 55, sw55, 200, 10
sw55Step = sw55Step + 1
End Sub
Sub sw53_Timer()
' VUK
SaucerAction sw53Step, Nothing, sw53Ball, 53, sw53, -1, 50+Rnd()*10
sw53Step = sw53Step + 1
End Sub
Sub sw31_Timer()
' top scoop
SaucerAction sw31Step, Nothing, sw31Ball, 31, sw31, 290, 150+Rnd()*20
sw31Step = sw31Step + 1
End Sub
Sub sw32_Timer()
' bottom scoop
SaucerAction sw32Step, Nothing, sw32Ball, 32, sw32, 345, 110+Rnd()*15
sw32Step = sw32Step + 1
End Sub
Sub SaucerAction(step, pHammer, kBall, id, switch, kickangle, kickpower)
Select Case step
Case 0 : MoveHammer pHammer, -1 : PlaySoundAt SoundFX("fx_vuk_exit", DOFContactors), switch
Case 1 : MoveHammer pHammer, 25 : If Controller.Switch(id) And Not (kBall Is Nothing) Then KickBall kBall, kickangle, IIF(kickpower>=100,1,10), kickpower, IIF(kickpower>=100,0,5), IIF(kickpower>=100,0,30)
Case 13 : Controller.Switch(id) = False
Case 23,24,25,26,27,28,29 : MoveHammer pHammer, -3
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)
If kBall Is Nothing Then Exit Sub
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
If kAngle >= 0 Then
.VelZ = kVelZ
.VelX = cos(rAngle) * kVel
.VelY = sin(rAngle) * kVel
Else
.VelZ = kVel
If kAngle = -2 Then
.VelX = Rnd() * 2
.VelY = Rnd() * 2
End If
End If
End With
Set kBall = Nothing
End Sub
Sub MoveHammer(pHammer, rotZ)
If Not (pHammer Is Nothing) Then
If rotZ = 0 Then
pHammer.RotZ = 0
Else
pHammer.RotZ = pHammer.RotZ + rotZ
End If
End If
End Sub
Sub KickScoop(actBall, angle, power)
With actBall
.VelX = 0 : .VelY = 0 : .VelZ = 0
KickBall actBall, angle, 5, power, 1, 20
End With
End Sub
' ****************************************************
' upper ramp traps
' ****************************************************
rUpperRampTrap1.Collidable = False
rUpperRampTrap2.Collidable = False
rUpperRamp002.Collidable = True
Sub SolTrapLeftHand(Enabled)
If Enabled Then
OpenTrapDoor trUpperRampTrap1
End If
End Sub
Sub SolTrapRightHand(Enabled)
If Enabled Then
OpenTrapDoor trUpperRampTrap2
End If
End Sub
Sub trUpperRampTrap1_Hit()
Set ballFrankLeftHand = ActiveBall
isBallOnWireRamp = False
rUpperRampTrap1.Collidable = True
rUpperRamp002.Collidable = False
PlaySoundAt "ferris_ball_drop", trUpperRampTrap1
End Sub
Sub kFrankLeftHand_Hit()
rUpperRampTrap1.Collidable = False
rUpperRamp002.Collidable = True
PlaySoundAt "ferris_hit" & Int(Rnd()*2+1), kFrankLeftHand
' vpmTimer.AddTimer 15000, "SolFranksArms True'"
End Sub
Sub trUpperRampTrap2_Hit()
Set ballFrankRightHand = ActiveBall
isBallOnWireRamp = False
rUpperRampTrap2.Collidable = True
rUpperRamp002.Collidable = False
PlaySoundAt "ferris_ball_drop", trUpperRampTrap2
End Sub
Sub kFrankRightHand_Hit()
rUpperRampTrap2.Collidable = False
rUpperRamp002.Collidable = True
PlaySoundAt "ferris_hit" & Int(Rnd()*2+1), kFrankRightHand
' vpmTimer.AddTimer 15000, "SolFranksArms True'"
End Sub
Sub OpenTrapDoor(sw)
rUpperRamp002.Collidable = True
sw.Enabled = True
PlaySoundAt SoundFX(SSolenoidOn, DOFContactors), sw
sw.TimerInterval = 9 : sw.TimerEnabled = True
End Sub
Sub CloseTrapDoor(sw)
rUpperRamp002.Collidable = True
sw.Enabled = False
PlaySoundAt SoundFX(SSolenoidOn, DOFContactors), sw
sw.TimerInterval = 11 : sw.TimerEnabled = True
End Sub
Sub trUpperRampTrap1_Timer()
If trUpperRampTrap1.TimerInterval = 9 Then
If pTrap1.ObjRotY <= -30 Then
trUpperRampTrap1.TimerEnabled = False : PlaySoundAt "fx_metalhit0", trUpperRampTrap1
Else
pTrap1.ObjRotY = pTrap1.ObjRotY - 10
End If
Else
If pTrap1.ObjRotY >= 0 Then
trUpperRampTrap1.TimerEnabled = False : PlaySoundAt "fx_sensor", trUpperRampTrap1
Else
pTrap1.ObjRotY = pTrap1.ObjRotY + 2
End If
End If
End Sub
Sub trUpperRampTrap2_Timer()
If trUpperRampTrap2.TimerInterval = 9 Then
If pTrap2.ObjRotY <= -30 Then
trUpperRampTrap2.TimerEnabled = False : PlaySoundAt "fx_metalhit0", trUpperRampTrap2
Else
pTrap2.ObjRotY = pTrap2.ObjRotY - 10
End If
Else
If pTrap2.ObjRotY >= 0 Then
trUpperRampTrap2.TimerEnabled = False : PlaySoundAt "fx_sensor", trUpperRampTrap2
Else
pTrap2.ObjRotY = pTrap2.ObjRotY + 2
End If
End If
End Sub
' ****************************************************
' Frank
' ****************************************************
Dim ballFrankLeftHand : Set ballFrankLeftHand = Nothing
Dim ballFrankRightHand : Set ballFrankRightHand = Nothing
Sub SolFranksArms(Enabled)
If Enabled Then
MoveArms
rUpperRamp002.Collidable = True
rUpperRampTrap1.Collidable = False
rUpperRampTrap2.Collidable = False
End If
End Sub
Sub MoveArms()
FrankArmsTimer.Interval = 3
FrankArmsTimer.Enabled = True
PlaySoundAt SoundFX("ferris_exit", DOFContactors), pFrankHead
End Sub
Sub FrankArmsTimer_Timer()
If FrankArmsTimer.Interval = 7 Then
' move the arms back
pFrankLeftArm.ObjRotX = pFrankLeftArm.ObjRotX + 0.5
pFrankLeftArmGIOff.ObjRotX = pFrankLeftArm.ObjRotX
pFrankLeftArmFOnGIOff.ObjRotX = pFrankLeftArm.ObjRotX
pFrankRightArm.ObjRotX = pFrankRightArm.ObjRotX + 0.5
pFrankRightArmGIOff.ObjRotX = pFrankRightArm.ObjRotX
pFrankRightArmFOnGIOff.ObjRotX = pFrankRightArm.ObjRotX
If pFrankLeftArm.ObjRotX >= 0 Then FrankArmsTimer.Enabled = False
ElseIf FrankArmsTimer.Interval = 5 Then
' throw the ball(s)
ThrowBall ballFrankLeftHand, kFrankLeftHand, trUpperRampTrap1
ThrowBall ballFrankRightHand, kFrankRightHand, trUpperRampTrap2
FrankArmsTimer.Interval = 7
Else
' move the arms to the front
pFrankLeftArm.ObjRotX = pFrankLeftArm.ObjRotX - 5
pFrankLeftArmGIOff.ObjRotX = pFrankLeftArm.ObjRotX
pFrankLeftArmFOnGIOff.ObjRotX = pFrankLeftArm.ObjRotX
MoveBall ballFrankLeftHand
pFrankRightArm.ObjRotX = pFrankRightArm.ObjRotX - 5
pFrankRightArmGIOff.ObjRotX = pFrankRightArm.ObjRotX
pFrankRightArmFOnGIOff.ObjRotX = pFrankRightArm.ObjRotX
MoveBall ballFrankRightHand
If pFrankLeftArm.ObjRotX <= -25 Then FrankArmsTimer.Interval = 5
End If
End Sub
Sub MoveBall(ballInFranksHand)
If Not (ballInFranksHand Is Nothing) Then
With ballInFranksHand
.Y = .Y + 8 : .Z = .Z + 9
End With
End If
End Sub
Sub ThrowBall(ballInFranksHand, ballKicker, trigger)
ballKicker.Kick 180, 20
CloseTrapDoor trigger
If Not (ballInFranksHand Is Nothing) Then
isBallOnWireRamp = False
Set ballInFranksHand = Nothing
End If
End Sub
Dim newAngleF, directionF, speedF, breakF, headStateF, headStateTimerF
newAngleF = 0
directionF = 0
Sub FrankHeadTimer_Timer()
If AnimateFranksHead = 1 Then
FrankHeadTimer.Interval = 55
Const maxAngle1 = 45
If directionF = 0 Or (directionF = -1 And newAngleF >= pFrankHead.ObjRotZ) Or (directionF = 1 And newAngleF <= pFrankHead.ObjRotZ) Then
If breakF > 0 Then
breakF = breakF - 1
Else
speedF = Rnd()*2.5 + 0.5
breakF = Int(Rnd()*25)
newAngleF = Int(Rnd()*(2*maxAngle1+1)) - maxAngle1
If newAngleF < pFrankHead.ObjRotZ Then
directionF = -1
Else
directionF = 1
End If
End If
StopMotorSound
Else
' move Frank's head one step
pFrankHead.ObjRotZ = pFrankHead.ObjRotZ + speedF * directionF
StartMotorSound
End If
ElseIf AnimateFranksHead = 2 Then
Const maxAngle2 = 45 ' 75
Const rotStep = 3
' identify the nearest ball
Dim balls, b, distance, nearestBall, nearestDistance
nearestBall = -1
nearestDistance = 0
balls = GetBalls
For b = 0 to UBound(balls)
distance = SQR((pFrankHead.X - balls(b).X) ^ 2 + (pFrankHead.Y - balls(b).Y) ^ 2)
If nearestBall = -1 Or distance < nearestDistance Then
nearestBall = b
nearestDistance = distance
End If
Next
' follow that ball with Frank's head
If nearestBall > -1 Then
Dim angle, newAngle
angle = GetFranksHeadAngle(balls(nearestBall))
newAngle = pFrankHead.ObjRotZ
If pFrankHead.ObjRotZ < angle Then
newAngle = pFrankHead.ObjRotZ + rotStep
If newAngle > angle Then newAngle = angle
If newAngle > maxAngle2 Then newAngle = maxAngle2
ElseIf pFrankHead.ObjRotZ > angle Then
newAngle = pFrankHead.ObjRotZ - rotStep
If newAngle < angle Then newAngle = angle
If newAngle < -maxAngle2 Then newAngle = -maxAngle2
End If
pFrankHead.ObjRotZ = newAngle : StartMotorSound
Else
pFrankHead.ObjRotZ = 0 : StopMotorSound
End If
ElseIf AnimateFranksHead = 3 Then
FrankHeadTimer.Interval = 25
Const maxAngle3 = 45
If Abs(newAngleF) > maxAngle3 Then
If newAngleF < 0 Then newAngleF = -maxAngle3 Else newAngleF = maxAngle3
End If
If (directionF = -1 And newAngleF >= pFrankHead.ObjRotZ) Or (directionF = 1 And newAngleF <= pFrankHead.ObjRotZ) Then
directionF = 0
newAngleF = pFrankHead.ObjRotZ
End If
If directionF = 0 Then
If newAngleF <> pFrankHead.ObjRotZ Then
speedF = Rnd()*3.5 + 2.5
directionF = 99 ' any value but not 1 or -1
End If
StopMotorSound
Else
If newAngleF < pFrankHead.ObjRotZ Then
directionF = -1
Else
directionF = 1
End If
' move Frank's head one step
pFrankHead.ObjRotZ = pFrankHead.ObjRotZ + speedF * directionF
StartMotorSound
End If
ElseIf AnimateFranksHead = 4 Then
FrankHeadTimer.Interval = 11
speedF = 1
Select Case headStateF
Case -1
If pFrankHead.ObjRotZ > 0 Then pFrankHead.ObjRotZ = pFrankHead.ObjRotZ - 1 : StartMotorSound
If pFrankHead.ObjRotZ < 0 Then pFrankHead.ObjRotZ = pFrankHead.ObjRotZ + 1 : StartMotorSound
If pFrankHead.ObjRotZ = 0 Then FrankHeadTimer.Enabled = False : StopMotorSound
Case 1
If pFrankHead.ObjRotz > -17 Then
pFrankHead.ObjRotz = pFrankHead.ObjRotz - speedF : StartMotorSound
Else
StopMotorSound
End If
headStateTimerF = headStateTimerF + 1
If headStateTimerF >= 200 Then headStateF = 2
Case 2
If pFrankHead.ObjRotz > -35 Then
pFrankHead.ObjRotz = pFrankHead.ObjRotz - speedF : StartMotorSound
Else
StopMotorSound
End If
If pFrankHead.ObjRotz = -35 Then headStateF = 3
Case 3
If pFrankHead.ObjRotz < 0 Then
pFrankHead.ObjRotz = pFrankHead.ObjRotz + speedF : StartMotorSound
Else
StopMotorSound
End If
headStateTimerF = headStateTimerF + 1
If headStateTimerF >= 300 Then headStateF = 4
Case 4
If pFrankHead.ObjRotz > -35 Then
pFrankHead.ObjRotz = pFrankHead.ObjRotz - speedF : StartMotorSound
Else
StopMotorSound
End If
headStateTimerF = headStateTimerF + 1
If headStateTimerF >= 700 Then headStateF = 5
Case 5
If pFrankHead.ObjRotz < 0 Then
pFrankHead.ObjRotz = pFrankHead.ObjRotz + speedF : StartMotorSound
Else
StopMotorSound
End If
headStateTimerF = headStateTimerF + 1
If headStateTimerF >= 800 Then headStateF = 6
Case 6
If pFrankHead.ObjRotz < 17 Then
pFrankHead.ObjRotz = pFrankHead.ObjRotz + speedF : StartMotorSound
Else
StopMotorSound
End If
headStateTimerF = headStateTimerF + 1
If headStateTimerF >= 850 Then headStateF = 7
Case 7
If pFrankHead.ObjRotz < 35 Then
pFrankHead.ObjRotz = pFrankHead.ObjRotz + speedF : StartMotorSound
Else
StopMotorSound
End If
headStateTimerF = headStateTimerF + 1
If headStateTimerF >= 900 Then headStateF = 8
Case 8
If pFrankHead.ObjRotz > 0 Then
pFrankHead.ObjRotz = pFrankHead.ObjRotz - speedF : StartMotorSound
Else
StopMotorSound
End If
headStateTimerF = headStateTimerF + 1
If headStateTimerF >= 1100 Then headStateF = 1 : headStateTimerF = 1
End Select
End If
pFrankHeadGIOff.ObjRotZ = pFrankHead.ObjRotZ
pFrankHeadFOnGIOff.ObjRotZ = pFrankHead.ObjRotZ
End Sub