forked from LegendsUnchained/vpx-standalone-alp4k
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTales from the Crypt (Data East 1993) VPW.vbs
7009 lines (5906 loc) · 259 KB
/
Tales from the Crypt (Data East 1993) VPW.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
' Tales from the Crypt - IPDB No. 2493
' © Data East 1993
' https://www.ipdb.org/machine.cgi?gid=2493
'
' Please use VPX 10.6, there may be issues with 10.7
'
'*** V-Pin Workshop TFTC Monsters ***
'- Project Manager: Tomate
'- Models and textures with Blender & Octane: Tomate
'- Ramps: Tomate
'- Primitive fading code for GI and flashers: iaakki
'- "Three layer" 3D Inserts: iaakki
'- Tombstone Code: Sixtoe, DJRobX
'- PF edits and insert texts: iaakki
'- Additional lighting: iaakki, Sixtoe, Skitso, G5k, Tomate
'- Wylte RTX ball shadows: Wylte, apophis, iaakki
'- VR Stuff: Sixtoe, Rawd-Leojreimroc-Hauntfreaks (Backglass), Gear323 (Plunger)
'- nFozzy physics: iaakki, Benji
'- Rubberizer and TargetBouncer: iaakki
'- Fleep Sounds: iaakki, Benji
'- Miscellaneous fixes and tweaks: Sixtoe, CyberPez, apophis, kingdids, baldgeek, fluffhead35, HauntFreaks
'- Testing: Rik, VPW team
Option Explicit
Randomize
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
'///////////////////////-----General Sound Options-----///////////////////////
'// VolumeDial is the actual global volume multiplier for the mechanical sounds.
'// Values smaller than 1 will decrease mechanical sounds volume.
'// Recommended values should be no greater than 1.
Const VolumeDial = 0.8
'//////////////////////-----VR Room-----///////////////////////
Const VRRoom = 0 '0 - VR Room off, 1 - Minimal Room without RTX Ball shadows, 2 - Minimal Room, 3 - Ultra Minimal without RTX Ball shadows
Const VRFlashingBackglass = 1 '0 - VR Backglass Flashers off, 1- VR Backglass Flashers on, 2- VR Backglass Flasher on with extra blinking light
Const PlungerEyeMod = 1 '0 - Regular Plunger, 1 - Lighted Eyes Mod
'///////////////////////////////////////////////////////////////
Const ImageSwapsForFlashers = 1 ' 0 - regular flashers (for old and slow cabinets), 1 - Image swaps and fades for flashers.
'///////////////////////-----Cabinet Mode-----////////////////////
Const CabinetMode = 0 'Cabinet mode - will skew sideblades and help correct the aspect ratio to match your screen.
DisableLUTSelector = 1 ' Disables the ability to change LUT option with magna saves in game when set to 1
'///////////////////////-----Ball Shadows-----////////////////////
Const DynamicBallShadowsOn = 1 '0 = no dynamic ball shadow ("triangles" near slings and such), 1 = enable dynamic ball shadow
Const AmbientBallShadowOn = 1 '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
'///////////////////////-----3D Insert NormalMaps---------////////////////////
dim NormalsForInserts
NormalsForInserts = 0 'May look odd with certain POV's in cabinetmode, gets enabled for VR
const bSlingSpin = false 'experimental Sling corner spin feature. This is a random thing that happens with pinball. Disabled by default
'*********** Set the default LUT set *********************************
'LUTset Types:
'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 = LUT1on1
'13 = LUTbassgeige1
'14 = LUTblacklight
'You can change LUT option within game with left and right CTRL keys
Dim LUTset, DisableLUTSelector, LutToggleSound
LutToggleSound = True
LoadLUT
'LUTset = 11 'override saved LUT for debug
SetLUT
'if VRRoom = 1 Or VRRoom = 3 Then 'RTX shadow disable for some VRRoom styles
' RTXBallShadows = 0
'end if
if VRRoom <> 0 Then 'disabling cabinet mode for VRroom, they wont work together
CabinetMode = 0
NormalsForInserts = 1
end if
dim insrt
If NormalsForInserts = 0 Then
for each insrt in OffInserts:insrt.NormalMap = "":Next
end if
Const PFGIOFFOpacity = 100
If CabinetMode = 1 Then
angleSides.size_y = 1000
angleSidesOFF.size_y = 1000
sidewalls.size_y = 0.01
sidewallsOFF.size_y = 0.01
angleSides.size_x = 1000
angleSidesOFF.size_x = 1000
sidewalls.size_x = 0.01
sidewallsOFF.size_x = 0.01
' sidewalls.size_y = 1300
' sidewallsOFF.size_y = 1300
PinCab_Rails.visible = 0
flasherbloomLF.height = 395
flasherbloomLF.rotx = -8.5
flasherbloomRF.height = 394.5
flasherbloomRF.rotx = -8.5
Else
angleSides.size_y = 0.01
angleSidesOFF.size_y = 0.01
sidewalls.size_y = 1000
sidewallsOFF.size_y = 1000
angleSides.size_x = 0.01
angleSidesOFF.size_x = 0.01
sidewalls.size_x = 1000
sidewallsOFF.size_x = 1000
PinCab_Rails.visible = 1
flasherbloomLF.height = 295
flasherbloomLF.rotx = -6.5
flasherbloomRF.height = 294.5
flasherbloomRF.rotx = -6.5
End If
Const BallSize = 25
Const Ballmass = 1
Const cGameName="tftc_400",UseSolenoids=2,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff"
Dim DesktopMode:DesktopMode = Table1.ShowDT
Dim UseVPMDMD
If VRRoom <> 0 Then UseVPMDMD = True Else UseVPMDMD = DesktopMode
LoadVPM "01120100", "de.vbs", 3.02
'clearPlastic.blenddisablelighting = 2
'plasticsOFF.blenddisablelighting=5
' using table width and height in script slows down the performance
dim tablewidth: tablewidth = Table1.width
dim tableheight: tableheight = Table1.height
'*************************************************************
'Solenoid Call backs
'**********************************************************************************************************
SolCallback(1) = "kisort"
SolCallback(2) = "KickBallToLane"
SolCallback(3) = "Auto_Plunger"
SolCallback(4) = "ResetDrops"
SolCallback(5) = "ScoopKick"
SolCallback(6) = "KickBallUp38"
SolCallback(7) = "KickBallUp52"
SolCallback(9) = "SolDiv"
SolCallback(8) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
SolCallback(11) = "SetGI"
SolCallback(16) = "SolShake"
SolCallback(22) = "Solkickback"
SolCallback(25) = "Sol1R" '"SetLamp 65," '1R
SolCallBack(26) = "Sol2R" '"SetLamp 66," '2R
SolCallBack(27) = "Sol3R" '"SetLamp 67," '3R
SolCallBack(28) = "Sol4R" '"SetLamp 68," '4R
SolCallBack(29) = "Sol5R" '"SetLamp 69," '5R
SolCallBack(30) = "Sol6R" '"SetLamp 70," '6R
SolCallBack(31) = "Sol7R" '"SetLamp 71," '7R
SolCallback(32) = "Sol8R" '"SetLamp 72," '8R
SolCallback(sLRFlipper) = "SolRFlipper"
SolCallback(sLLFlipper) = "SolLFlipper"
dim Sol4RGIsync : Sol4RGIsync = -1
dim Sol2RGIsync : Sol2RGIsync = -1
Dim ObjLevel(20), objbase(20), objlit(20), objflasher(20), objlight(20), ObjTargetLevel(20)
dim VrObj
ObjLevel(1) = 0
ObjLevel(2) = 0
sub Sol1R(flstate)
If Flstate Then
Sol1Rlevel = 1
Sol1Rflash_Timer
else
Sol1Rlevel = Sol1Rlevel * 0.6 'minor tweak to force faster fade
End If
end sub
'1R init
dim Sol1Rlevel, sol1Rfactor, sol1RTmrInterval
sol1Rfactor = 10
sol1RTmrInterval = 20
Sol1Rflash.interval = sol1RTmrInterval
S65.IntensityScale = 0:S65a.IntensityScale = 0:S65b.IntensityScale = 0:S65c.IntensityScale = 0
Fsol1R001.visible = 0
sub Sol1Rflash_timer()
dim vrobj
' debug.print "1Rflash level: " & Sol1Rlevel
'If not Sol1Rflash.Enabled Then Sol1Rflash.Enabled = True : Fsol1R001.visible = 1 : End If
If not Sol1Rflash.Enabled Then
Sol1Rflash.Enabled = True
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL25: vrobj.visible = 1: VRBBTOPLEFT.visible = true: Next
Fsol1R001.visible = 1
End If
S65.IntensityScale = sol1Rfactor * Sol1Rlevel^1.2
S65a.IntensityScale = sol1Rfactor * Sol1Rlevel^2
S65b.IntensityScale = sol1Rfactor * Sol1Rlevel^1.2
S65c.IntensityScale = sol1Rfactor * Sol1Rlevel^2
If VRRoom > 0 and VRFlashingBackglass > 0 Then
for each vrobj in VRBGFL25: vrobj.opacity = 100 * Sol1Rlevel^2: next
VRBBTOPLEFT.opacity = 20 * Sol1Rlevel^2
If Sol1Rlevel > 0.4 then PinCab_Backbox.Image = "PincabTopLeft2" Else PinCab_Backbox.Image = "PinCab_Backbox"
End If
Fsol1R001.opacity = 100 * Sol1Rlevel
Sol1Rlevel = Sol1Rlevel * 0.7 - 0.01
'If Sol1Rlevel < 0 Then Sol1Rflash.Enabled = False : Fsol1R001.visible = 0 : End If
If Sol1Rlevel < 0 Then
Sol1Rflash.Enabled = False
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL25: vrobj.visible = 0: VRBBTOPLEFT.visible = false: Next
Fsol1R001.visible = 0
End If
end sub
sub Sol2R(flstate)
'debug.print gametime & " Sol2R: " & flstate & " GI state: " & giprevalvl
If Flstate Then
' PlaySoundAtLevelStatic ("fx_relay_on"), 0.2 * RelaySoundLevel, p70off
Sound_Flash_Relay 1, Flasher_Relay_pos
if Sol2RGIsync = -1 then 'previous fading has ended
if giprevalvl > 0.1 then 'gi on
Sol2RGIsync = 1
else 'gi off
Sol2RGIsync = 0
end if
Else
'debug.print "***sol4r while fading"
end if
'Objlevel(1) = 1
ObjTargetLevel(1) = 1
else
Sound_Flash_Relay 1, Flasher_Relay_pos
'Objlevel(1) = Objlevel(1) * 0.6 'minor tweak to force faster fade
ObjTargetLevel(1) = 0
End If
FlasherFlash1_Timer
'debug.print "Sol4RGIsync: " & Sol4RGIsync
'SetLamp 66,flstate
end sub
sub Sol3R(flstate)
If Flstate Then
Sol3Rlevel = 1
Sol3Rflash_Timer
else
Sol3Rlevel = Sol3Rlevel * 0.6 'minor tweak to force faster fade
End If
end sub
'3R init
dim Sol3Rlevel, sol3Rfactor, sol3RTmrInterval
sol3Rfactor = 10
sol3RTmrInterval = 20
Sol3Rflash.interval = sol3RTmrInterval
S67.IntensityScale = 0:S67a.IntensityScale = 0
f67TOP.opacity = 0 : f67aTOP.opacity = 0
sub Sol3Rflash_timer()
' debug.print "3Rflash level: " & Sol3Rlevel
If not Sol3Rflash.Enabled Then
Sol3Rflash.Enabled = True
f67TOP.visible = 1
f67aTOP.visible = 1
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL27: vrobj.visible = 1: VRBBMIDDLERIGHT.visible = 1: Next
End If
'inserts
S67.IntensityScale = 5*Sol3Rlevel^1.2
S67a.IntensityScale = 5*Sol3Rlevel^1.2
f67TOP.opacity = 100 * Sol3Rlevel 'center insert top
f67aTOP.opacity = 100 * Sol3Rlevel 'center insert top
DisableLightingFlash p67, 10, Sol3Rlevel
DisableLightingFlash p67bulb, 30, Sol3Rlevel
DisableLightingFlash p67a, 10, Sol3Rlevel
DisableLightingFlash p67abulb, 30, Sol3Rlevel
If VRRoom > 0 and VRFlashingBackglass > 0 Then
for each vrobj in VRBGFL27: vrobj.opacity = 100 * Sol3Rlevel^2: next
VRBBMIDDLERIGHT.height = 1400
VRBBMIDDLERIGHT.opacity = 15 * Sol3Rlevel^2
End If
Sol3Rlevel = Sol3Rlevel * 0.7 - 0.01
If Sol3Rlevel < 0 Then
Sol3Rflash.Enabled = False
f67TOP.visible = 0
f67aTOP.visible = 0
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL27: vrobj.visible = 0: VRBBMIDDLERIGHT.visible = 0: Next
End If
end sub
sub Sol4R(flstate)
'debug.print gametime & " Sol4R: " & flstate & " GI state: " & giprevalvl
If Flstate Then
' Sound_Flash_Relay 1, Flasher_Relay_pos
if Sol4RGIsync = -1 then 'previous fading has ended
'if giprevalvl > 0 then 'gi on or fading
if giprevalvl > 0.1 then 'gi on or fading
Sol4RGIsync = 1
else 'gi off
Sol4RGIsync = 0
end if
Else
'debug.print "***sol4r while fading"
end if
'Objlevel(2) = 1
ObjTargetLevel(2) = 1
else
' Sound_Flash_Relay 0, Flasher_Relay_pos
' Objlevel(2) = Objlevel(2) * 0.6 'minor tweak to force faster fade
ObjTargetLevel(2) = 0
End If
FlasherFlash2_Timer
'debug.print "Sol4RGIsync: " & Sol4RGIsync
end sub
sub Sol5R(flstate)
If Flstate Then
Sol5Rlevel = 1
Sol5Rflash_Timer
else
Sol5Rlevel = Sol5Rlevel * 0.6 'minor tweak to force faster fade
End If
'debug.print "Sol4RGIsync: " & Sol4RGIsync
end sub
'5R init
dim Sol5Rlevel, sol5Rfactor, sol5RTmrInterval
sol5Rfactor = 10
sol5RTmrInterval = 20
Sol5Rflash.interval = sol5RTmrInterval
S69.IntensityScale = 0:S69a.IntensityScale = 0:S69b.IntensityScale = 0:S69c.IntensityScale = 0 :S69d.IntensityScale = 0 ':S69e.IntensityScale = 0
sub Sol5Rflash_timer()
' debug.print "5Rflash level: " & Sol5Rlevel
If not Sol5Rflash.Enabled Then
Sol5Rflash.Enabled = True
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL29: vrobj.visible = 1: VRBBTOPRIGHT.visible = 1: Next
End If
S69.IntensityScale = sol5Rfactor * Sol5Rlevel^1.2
S69a.IntensityScale = sol5Rfactor * Sol5Rlevel^1.2
S69c.IntensityScale = sol5Rfactor * Sol5Rlevel^2
S69d.IntensityScale = sol5Rfactor * Sol5Rlevel^2
'inserts
S69b.IntensityScale = Sol5Rlevel * 10
DisableLightingFlash p69b, 20, Sol7Rlevel
DisableLightingFlash p69bbulb, 40, Sol7Rlevel
If VRRoom > 0 and VRFlashingBackglass > 0 Then
for each vrobj in VRBGFL29: vrobj.opacity = 100 * Sol5Rlevel^2: next
VRBBTOPRIGHT.opacity = 10 * Sol5Rlevel^2
If Sol5Rlevel > 0.5 then PinCab_Backbox.Image = "PincabTopRight2" Else PinCab_Backbox.Image = "PinCab_Backbox"
End If
Sol5Rlevel = Sol5Rlevel * 0.7 - 0.01
If Sol5Rlevel < 0 Then
Sol5Rflash.Enabled = False
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL29: vrobj.visible = 0: VRBBTOPRIGHT.visible = 0: Next
End If
end sub
sub Sol6R(flstate)
If Flstate Then
Sol6Rlevel = 1
Sol6Rflash_Timer
else
Sol6Rlevel = Sol6Rlevel * 0.6 'minor tweak to force faster fade
End If
end sub
'6R init
dim Sol6Rlevel, sol6Rfactor, sol6RTmrInterval
sol6Rfactor = 10
sol6RTmrInterval = 20
Sol6Rflash.interval = sol6RTmrInterval
S70.IntensityScale = 0:S70a.IntensityScale = 0:S70b.IntensityScale = 0:S70c.IntensityScale = 0
Fsol6R001.visible = 0
sub Sol6Rflash_timer()
' debug.print "6Rflash level: " & Sol6Rlevel
If not Sol6Rflash.Enabled Then
Sol6Rflash.Enabled = True
Fsol6R001.visible = 1
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL30: vrobj.visible = 1: VRBBBOTTOMRIGHT.visible = 1: Next
End If
Fsol6R001.opacity = 100 * Sol6Rlevel
S70b.IntensityScale = 5*Sol6Rlevel
S70c.IntensityScale = 10*Sol6Rlevel
'inserts
S70.IntensityScale = 5*Sol6Rlevel^1.2
S70a.IntensityScale = 5*Sol6Rlevel^1.2
DisableLightingFlash p70, 50, Sol6Rlevel
DisableLightingFlash p70bulb, 70, Sol6Rlevel
DisableLightingFlash p70a, 20, Sol6Rlevel
DisableLightingFlash p70abulb, 40, Sol6Rlevel
If VRRoom > 0 and VRFlashingBackglass > 0 Then
for each vrobj in VRBGFL30: vrobj.opacity = 100 * Sol6Rlevel^2: next
VRBBBOTTOMRIGHT.opacity = 10 * Sol6Rlevel^2
End If
Sol6Rlevel = Sol6Rlevel * 0.65 - 0.01
If Sol6Rlevel < 0 Then
Sol6Rflash.Enabled = False
Fsol6R001.visible = 0
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL30: vrobj.visible = 0: VRBBBOTTOMRIGHT.visible = 0: Next
End If
end sub
sub Sol7R(flstate)
If Flstate Then
Sol7Rlevel = 1
Sol7Rflash_Timer
else
Sol7Rlevel = Sol7Rlevel * 0.6 'minor tweak to force faster fade
End If
end sub
dim Sol7Rlevel, sol7Rfactor, sol7RTmrInterval
sol7Rfactor = 10
sol7RTmrInterval = 20
Sol7Rflash.interval = sol7RTmrInterval
S71.IntensityScale = 0:S71a.IntensityScale = 0:S71b.IntensityScale = 0:S71c.IntensityScale = 0
f71TOP.opacity = 0
sub Sol7Rflash_timer()
'debug.print "7Rflash level: " & Sol7Rlevel
If not Sol7Rflash.Enabled Then
Sol7Rflash.Enabled = True
f71TOP.visible = 1
End If
'under ramp
S71.IntensityScale = 5 * sol7Rfactor * Sol7Rlevel^1.2
S71c.IntensityScale = sol7Rfactor * Sol7Rlevel^2 'probably not visible
'inserts
S71a.IntensityScale = 10 * Sol7Rlevel^1.2
S71b.IntensityScale = 10 * Sol7Rlevel^1.2
f71TOP.opacity = 100 * Sol7Rlevel 'center insert top
DisableLightingFlash p71, 10, Sol7Rlevel * 10
DisableLightingFlash p71bulb, 40, Sol7Rlevel * 50
DisableLightingFlash p60, 10, Sol7Rlevel * 15 'crash???
DisableLightingFlash p60bulb, 40, Sol7Rlevel * 50
Sol7Rlevel = Sol7Rlevel * 0.7 - 0.01
If Sol7Rlevel < 0 Then
Sol7Rflash.Enabled = False
f71TOP.visible = 0
End If
end sub
sub Sol8R(flstate)
If Flstate Then
Sol8Rlevel = 1
Sol8Rflash_Timer
else
Sol8Rlevel = Sol8Rlevel * 0.6 'minor tweak to force faster fade
End If
end sub
dim Sol8Rlevel, sol8Rfactor, sol8RTmrInterval
sol8Rfactor = 10
sol8RTmrInterval = 20
Sol8Rflash.interval = sol8RTmrInterval
S72a.IntensityScale = 0:S72b.IntensityScale = 0
f72TOP.opacity = 0
sub Sol8Rflash_timer()
'debug.print "8Rflash level: " & Sol8Rlevel
If not Sol8Rflash.Enabled Then
Sol8Rflash.Enabled = True
f72TOP.visible = 1
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL32: vrobj.visible = 1: VRBBTOPRIGHT.visible = 1: Next
End If
'inserts
S72a.IntensityScale = Sol8Rlevel^1.2
S72b.IntensityScale = Sol8Rlevel^1.2
f72TOP.opacity = 100 * Sol8Rlevel 'center insert top
DisableLighting p72, 10, Sol8Rlevel * 10
DisableLighting p72bulb, 40, Sol8Rlevel * 50
DisableLightingFlash p52, 10, Sol8Rlevel * 15
DisableLightingFlash p52bulb, 40, Sol8Rlevel * 60
If VRRoom > 0 and VRFlashingBackglass > 0 Then
for each vrobj in VRBGFL32: vrobj.opacity = 100 * Sol8Rlevel^2: next
VRBBTOPRIGHT.opacity = 20 * Sol8Rlevel^2
If Sol8Rlevel > 0.4 then PinCab_Backbox.Image = "PincabTopRight2" Else PinCab_Backbox.Image = "PinCab_Backbox"
End If
Sol8Rlevel = Sol8Rlevel * 0.7 - 0.01
If Sol8Rlevel < 0 Then
Sol8Rflash.Enabled = False
f72TOP.visible = 0
If VRRoom > 0 and VRFlashingBackglass > 0 Then for each vrobj in VRBGFL32: vrobj.visible = 0: VRBBTOPRIGHT.visible = 0: Next
End If
end sub
'******************************************************
' SLINGSHOT CORNER SPIN
'******************************************************
if bSlingSpin Then
LSlingSpin.enabled = true
RSlingSpin.enabled = true
end if
const MaxSlingSpin = 250
const MinCollVelX = 7
const MinCorVelocity = 10
dim lspinball
sub LSlingSpin_hit
'debug.print "lhit: " & activeball.angmomz & " velx: " & activeball.velx & " vely: " & activeball.vely & " corvel: " & cor.ballvel(activeball.id)
if activeball.velx < -MinCollVelX And cor.ballvel(activeball.id) > MinCorVelocity then
' debug.print "lspinball set, vel: " & cor.ballvel(activeball.id)
lspinball = activeball.id
end if
end sub
sub LSlingSpin_unhit
if lspinball <> -1 then
activeball.angmomz = (cor.ballvel(activeball.id)/2) * activeball.angmomz
if activeball.angmomz > MaxSlingSpin then activeball.angmomz = MaxSlingSpin
if activeball.angmomz < -MaxSlingSpin then activeball.angmomz = -MaxSlingSpin
'debug.print "lunhit: " & activeball.angmomz & " velx: " & activeball.velx & " vely: " & activeball.vely & ", vel: " & cor.ballvel(activeball.id)
lspinball = -1
end if
end sub
dim rspinball
sub RSlingSpin_hit
'debug.print "rhit: " & activeball.angmomz & " velx: " & activeball.velx & " vely: " & activeball.vely & " corvel: " & cor.ballvel(activeball.id)
if activeball.velx > MinCollVelX And cor.ballvel(activeball.id) > MinCorVelocity then
' debug.print "rspinball set, vel: " & cor.ballvel(activeball.id)
rspinball = activeball.id
end if
end sub
sub RSlingSpin_unhit
if rspinball <> -1 then
activeball.angmomz = (cor.ballvel(activeball.id)/2) * activeball.angmomz
if activeball.angmomz > MaxSlingSpin then activeball.angmomz = MaxSlingSpin
if activeball.angmomz < -MaxSlingSpin then activeball.angmomz = -MaxSlingSpin
'debug.print "runhit: " & activeball.angmomz & " velx: " & activeball.velx & " vely: " & activeball.vely & ", vel: " & cor.ballvel(activeball.id)
rspinball = -1
end if
end sub
'******************************************************
' SLINGSHOT CORRECTION FUNCTIONS
'******************************************************
dim LS : Set LS = New SlingshotCorrection
dim RS : Set RS = New SlingshotCorrection
InitSlingCorrection
Sub InitSlingCorrection
LS.Object = LeftSlingshot
LS.EndPoint1 = EndPoint1LS
LS.EndPoint2 = EndPoint2LS
RS.Object = RightSlingshot
RS.EndPoint1 = EndPoint1RS
RS.EndPoint2 = EndPoint2RS
'Slingshot angle corrections (pt, BallPos in %, Angle in deg)
AddSlingsPt 0, 0.00, -7
AddSlingsPt 1, 0.45, -7
AddSlingsPt 2, 0.48, 0
AddSlingsPt 3, 0.52, 0
AddSlingsPt 4, 0.55, 7
AddSlingsPt 5, 1.00, 7
End Sub
Sub AddSlingsPt(idx, aX, aY) 'debugger wrapper for adjusting flipper script in-game
dim a : a = Array(LS, RS)
dim x : for each x in a
x.addpoint idx, aX, aY
Next
End Sub
'******************************************************
' SLINGSHOT CORRECTION FUNCTIONS
'******************************************************
Class SlingshotCorrection
Public DebugOn, Enabled
private Slingshot, SlingX1, SlingX2, SlingY1, SlingY2
Public ModIn, ModOut
Private Sub Class_Initialize : redim ModIn(0) : redim Modout(0): Enabled = True : End Sub
Public Property let Object(aInput) : Set Slingshot = aInput : End Property
Public Property Let EndPoint1(aInput) : SlingX1 = aInput.x: SlingY1 = aInput.y: End Property
Public Property Let EndPoint2(aInput) : SlingX2 = aInput.x: SlingY2 = aInput.y: End Property
Public Sub AddPoint(aIdx, aX, aY)
ShuffleArrays ModIn, ModOut, 1 : ModIn(aIDX) = aX : ModOut(aIDX) = aY : ShuffleArrays ModIn, ModOut, 0
If gametime > 100 then Report
End Sub
Public Sub Report() 'debug, reports all coords in tbPL.text
If not debugOn then exit sub
dim a1, a2 : a1 = ModIn : a2 = ModOut
dim str, x : for x = 0 to uBound(a1) : str = str & x & ": " & round(a1(x),4) & ", " & round(a2(x),4) & vbnewline : next
TBPout.text = str
End Sub
Public Sub VelocityCorrect(aBall)
dim BallPos, XL, XR, YL, YR
'Assign right and left end points
If SlingX1 < SlingX2 Then
XL = SlingX1 : YL = SlingY1 : XR = SlingX2 : YR = SlingY2
Else
XL = SlingX2 : YL = SlingY2 : XR = SlingX1 : YR = SlingY1
End If
'Find BallPos = % on Slingshot
If Not IsEmpty(aBall.id) Then
If ABS(XR-XL) > ABS(YR-YL) Then
BallPos = PSlope(aBall.x, XL, 0, XR, 1)
Else
BallPos = PSlope(aBall.y, YL, 0, YR, 1)
End If
If BallPos < 0 Then BallPos = 0
If BallPos > 1 Then BallPos = 1
End If
'Velocity angle correction
If not IsEmpty(ModIn(0) ) then
Dim Angle, RotVxVy
' debug.print " BallPos=" & BallPos &" Angle=" & Angle
' debug.print " BEFORE: aBall.Velx=" & aBall.Velx &" aBall.Vely" & aBall.Vely
Angle = LinearEnvelope(BallPos, ModIn, ModOut)
RotVxVy = RotPoint(aBall.Velx,aBall.Vely,Angle)
If Enabled then aBall.Velx = RotVxVy(0)
If Enabled then aBall.Vely = RotVxVy(1)
' debug.print " AFTER: aBall.Velx=" & aBall.Velx &" aBall.Vely" & aBall.Vely
' debug.print " "
End If
End Sub
End Class
'******************************************************
' FLIPPERS
'******************************************************
Const ReflipAngle = 20
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
RightFlipper1.RotateToEnd
If rightflipper.currentangle > rightflipper.endangle - ReflipAngle Then
RandomSoundReflipUpRight RightFlipper
RandomSoundReflipUpRight RightFlipper1
Else
SoundFlipperUpAttackRight RightFlipper
RandomSoundFlipperUpRight RightFlipper
SoundFlipperUpAttackRight RightFlipper1
RandomSoundFlipperUpRight RightFlipper1
End If
Else
RightFlipper.RotateToStart
RightFlipper1.RotateToStart
If RightFlipper.currentangle > RightFlipper.startAngle + 5 Then
RandomSoundFlipperDownRight RightFlipper
RandomSoundFlipperDownRight RightFlipper1
End If
FlipperRightHitParm = FlipperUpSoundLevel
End If
End Sub
Sub LeftFlipper_Collide(parm)
LeftFlipperCollide parm
End Sub
Sub RightFlipper_Collide(parm)
RightFlipperCollide parm
End Sub
'******************************************************
' FLIPPER CORRECTION INITIALIZATION
'******************************************************
'******************************************************
' FLIPPER AND RUBBER CORRECTION
'******************************************************
dim LF : Set LF = New FlipperPolarity
dim RF : Set RF = New FlipperPolarity
InitPolarity
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
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
'Velocity correction
if not IsEmpty(VelocityIn(0) ) then
Dim VelCoef
: VelCoef = LinearEnvelope(BallPos, VelocityIn, VelocityOut)
if partialflipcoef < 1 then VelCoef = PSlope(partialflipcoef, 0, 1, 1, VelCoef)
if Enabled then aBall.Velx = aBall.Velx*VelCoef
if Enabled then aBall.Vely = aBall.Vely*VelCoef
End If
'Polarity Correction (optional now)
if not IsEmpty(PolarityIn(0) ) then
If StartPoint > EndPoint then LR = -1 'Reverse polarity if left flipper
dim AddX : AddX = LinearEnvelope(BallPos, PolarityIn, PolarityOut) * LR
if Enabled then aBall.VelX = aBall.VelX + 1 * (AddX*ycoef*PartialFlipcoef)
'playsound "fx_knocker"
End If