Arngrim

Untitled

Feb 11th, 2018
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.15 KB | None | 0 0
  1.  
  2. '************************************************************
  3. '************************************************************
  4. '
  5. ' Creature from the Black Lagoon (Bally 1992) / IPD No. 588 / 4 Players
  6. '
  7. ' Credits:
  8. '
  9. ' VPX by fuzzel, flupper1
  10. ' Script by flupper, rothbauerw
  11. ' Primitives by fuzzel, flupper1
  12. ' Supported by randr, clarkkent, hauntfreaks
  13. '
  14. '************************************************************
  15. '************************************************************
  16.  
  17. Option Explicit
  18. Randomize
  19.  
  20. '******************************************************
  21. ' OPTIONS
  22. '******************************************************
  23.  
  24. Const EnableBallControl = true 'set to false to disable the C key from taking manual control
  25. Const VolumeDial = 5 'Change bolume of hit events
  26. Const RollingSoundFactor = 3 'set sound level factor here for Ball Rolling Sound, 1=default level
  27.  
  28. dim chaselightson, chaselightsintensity, chaselightsbloom, indirectlightsintensity, shadowopacity, bumperslit, fslutfading, dtlutfading
  29.  
  30. chaselightsintensity = 0.5 ' usable range is 0.5 - 1
  31. chaselightsbloom = 1 ' 0 or 1 (0 for less bloom, 1 for more bloom)
  32. indirectlightsintensity = 1 ' usable range is 0.5 - 1
  33. shadowopacity = 90 ' usable range is 0 - 100 (90 default)
  34. bumperslit = 0 ' 0 or 1 (0 bumpers without lights (original), 1 bumpers with lights
  35. fslutfading = 1 ' 1 enables GI lut fading for full screen, 0 to disable
  36. dtlutfading = 0 ' 1 enables GI lut fading for desk top, 0 to disable
  37.  
  38. '******************************************************
  39. ' STANDARD DEFINITIONS
  40. '******************************************************
  41.  
  42. Dim Ballsize,BallMass
  43. Ballsize = 50
  44. Ballmass = 1.7
  45.  
  46. Const UseSolenoids = 1
  47. Const UseLamps = 0
  48. Const UseSync = 0
  49. Const UseGI = 1
  50. Const UseVPMModSol = 1
  51.  
  52. '******************************************************
  53. ' TABLE INIT
  54. '******************************************************
  55.  
  56. if Version < 10400 then msgbox "This table requires Visual Pinball 10.4 beta or newer!" & vbnewline & "Your version: " & Version/1000
  57.  
  58. On Error Resume Next
  59. ExecuteGlobal GetTextFile("controller.vbs")
  60. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  61. On Error Goto 0
  62.  
  63. LoadVPM "01560000", "WPC.VBS", 3.50
  64. Const cGameName="cftbl_l4"
  65.  
  66. dim bsSubway
  67. Sub Table1_Init
  68. vpmInit Me
  69. With Controller
  70. .GameName = cGameName
  71. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  72. .SplashInfoLine = "Creature from the Black Lagoon (Bally 1992)"
  73. .HandleMechanics=0
  74. .HandleKeyboard=0
  75. .ShowDMDOnly=1
  76. .ShowFrame=0
  77. .ShowTitle=0
  78. '.hidden = not table1.showdt
  79. On Error Resume Next
  80. .Run GetPlayerHWnd
  81. If Err Then MsgBox Err.Description
  82. On Error Goto 0
  83. End With
  84.  
  85. dim light
  86. If chaselightsbloom = 0 Then
  87. chaselightsintensity = chaselightsintensity * 8
  88. For Each Light in chaselights: Light.Falloff=20:Light.Falloffpower=8:Light.IntensityScale = chaselightsintensity : Light.FadeSpeedUp = Light.IntensityScale * Light.Intensity / 20 : Light.FadeSpeedDown = Light.FadeSpeedUp / 3: Next
  89. Else
  90. For Each Light in chaselights: Light.IntensityScale = chaselightsintensity : Light.FadeSpeedUp = Light.IntensityScale * Light.Intensity / 20 : Light.FadeSpeedDown = Light.FadeSpeedUp / 3: Next
  91. End If
  92.  
  93. For Each Light in indirectlights: Light.IntensityScale = indirectlightsintensity : Light.FadeSpeedUp = Light.IntensityScale * Light.Intensity / 60 : Light.FadeSpeedDown = Light.FadeSpeedUp : Next
  94.  
  95. Flasher21.opacity = shadowopacity
  96.  
  97. '************ Main Timer init ********************
  98.  
  99. PinMAMETimer.Interval = PinMAMEInterval
  100. PinMAMETimer.Enabled = 1
  101.  
  102. '************ Nudging **************************
  103.  
  104. vpmNudge.TiltSwitch = 14
  105. vpmNudge.Sensitivity = 5
  106. 'Add Slings - WJR
  107. vpmNudge.TiltObj = Array(Bumper1, Bumper2, Bumper3, LeftSlingShot, RightSlingShot)
  108.  
  109. '************ Trough **************************
  110. sw58.CreateSizedballWithMass Ballsize/2,Ballmass
  111. sw57.CreateSizedballWithMass Ballsize/2,Ballmass
  112. sw56.CreateSizedballWithMass Ballsize/2,Ballmass
  113.  
  114. Controller.Switch(58) = 1
  115. Controller.Switch(57) = 1
  116. Controller.Switch(56) = 1
  117.  
  118. Controller.Switch(15) = 1
  119.  
  120. end sub
  121.  
  122.  
  123. '******************************************************
  124. ' KEYS
  125. '******************************************************
  126.  
  127. Sub Table1_KeyDown(ByVal keycode)
  128. If keycode = PlungerKey Then
  129. Plunger.PullBack
  130. PlaySound "plungerpull",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
  131. End If
  132.  
  133. If keycode = LeftTiltKey Then
  134. Nudge 90, 2
  135. End If
  136.  
  137. If keycode = RightTiltKey Then
  138. Nudge 270, 2
  139. End If
  140.  
  141. If keycode = CenterTiltKey Then
  142. Nudge 0, 2
  143. End If
  144.  
  145. '************************ Start Ball Control 1/3
  146. if keycode = 46 then ' C Key
  147. If contball = 1 Then
  148. contball = 0
  149. Else
  150. contball = 1
  151. End If
  152. End If
  153. if keycode = 48 then 'B Key
  154. If bcboost = 1 Then
  155. bcboost = bcboostmulti
  156. Else
  157. bcboost = 1
  158. End If
  159. End If
  160. if keycode = 203 then bcleft = 1 ' Left Arrow
  161. if keycode = 200 then bcup = 1 ' Up Arrow
  162. if keycode = 208 then bcdown = 1 ' Down Arrow
  163. if keycode = 205 then bcright = 1 ' Right Arrow
  164. '************************ End Ball Control 1/3
  165.  
  166. If vpmKeyDown(keycode) Then Exit Sub
  167. End Sub
  168.  
  169. Sub Table1_KeyUp(ByVal keycode)
  170. If keycode = PlungerKey Then
  171. Plunger.Fire
  172. PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
  173. End If
  174.  
  175. If keycode=203 Then 'left array key
  176. ' sw37.createball
  177. ' sw37.kickz 190,10,1,50
  178. 'sw34.createball
  179. 'sw34.kickz 0,25,1,120
  180. 'sw34Saucer.AddBall sw34
  181. 'sw34Saucer.ExitSol_On
  182. If creature.visible=0 Then
  183. creature.visible=1
  184. Else
  185. creature.visible=0
  186. end if
  187. end if
  188.  
  189. '************************ Start Ball Control 2/3
  190. 'if keycode = 203 then bcleft = 0 ' Left Arrow
  191. 'if keycode = 200 then bcup = 0 ' Up Arrow
  192. 'if keycode = 208 then bcdown = 0 ' Down Arrow
  193. 'if keycode = 205 then bcright = 0 ' Right Arrow
  194. '************************ End Ball Control 2/3
  195.  
  196. If vpmKeyUp(keycode) Then Exit Sub
  197.  
  198. End Sub
  199.  
  200. '******************************************************
  201. ' SOLENOIDS
  202. '******************************************************
  203.  
  204. SolCallback(1) = "RightUpperKicker"
  205. SolCallback(3) = "RightLowerKicker"
  206. SolCallback(4) = "ReleaseBall"
  207. SolCallback(12) = "SolOuthole"
  208.  
  209.  
  210. '********Solenoids********
  211.  
  212. ' SolCallBack(1) = "TopRightPopper"
  213. ' SolCallBack(2) = "SetLamp 103,"
  214. ' SolCallBack(3) = "bsSubway.SolOut"
  215. ' SolCallBack(4) = "bsTrough.SolOut"
  216. SolCallBack(7) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  217. ' SolCallBack(8) = "SetLamp 106,"
  218. ' SolCallBack(9) = "BackFlash"
  219. ' SolCallBack(10) = "SetLamp 100,"
  220. ' SolCallBack(11) = "CreatureFlash"
  221. ' SolCallBack(12) = "bsTrough.SolIn"
  222. ' SolCallBack(16) = "SetLamp 109,"
  223. ' SolCallBack(17) = "SetLamp 110,"
  224. ' SolCallBack(18) = "SetLamp 101,"
  225. ' SolCallBack(19) = "SetLamp 102,"
  226. ' ' SolCallBack(20) = "SeqGI1"
  227. ' ' SolCallBack(21) = "HologramPushMotor"
  228. ' SolCallBack(22) = "SetLamp 111,"
  229. ' SolCallBack(23) = "DropRUp"
  230. ' ' SolCallBack(24) = "SeqGI2"
  231. ' SolCallBack(25) = "StartMov"
  232. ' SolCallBack(26) = "DropRDown"
  233. ' SolCallBack(27) = "CreatureMotorMirror"
  234. ' SolCallBack(28) = "HoloLamp"
  235. '
  236. ' '******Flipper Subs
  237. '
  238. SolCallback(sLRFlipper) = "SolRFlipper"
  239. SolCallback(sLLFlipper) = "SolLFlipper"
  240.  
  241. 'does not work properly with rom !!! so I did not use this, but for reference
  242.  
  243. 'dim val1, val2,
  244. '
  245. 'SolCallBack(20) = "SeqGI1"
  246. 'SolCallBack(24) = "SeqGI2"
  247. '
  248. 'Sub SeqGI1(Enabled)
  249. ' If Enabled Then val1 = 1 Else val1 = 0 end if
  250. ' chaseval = val1 + val2
  251. 'End Sub
  252. '
  253. 'Sub SeqGI2(Enabled)
  254. ' If Enabled Then val2 = 2 Else val2 = 0 end if
  255. ' chaseval = val1 + val2
  256. 'End Sub
  257.  
  258. dim chaseval
  259.  
  260. Sub swirlramplight1_Timer()
  261. dim chase1, chase2, chase3, chase4
  262. chaseval = chaseval + 1
  263. If chaseval > 3 then chaseval = 0 end if
  264. If chaselightson Then
  265. Select Case chaseval
  266. Case 0 : chase1 = 0 : chase2 = 1 : chase3 = 1 : chase4 = 1
  267. Case 1 : chase1 = 1 : chase2 = 0 : chase3 = 1 : chase4 = 1
  268. Case 2 : chase1 = 1 : chase2 = 1 : chase3 = 0 : chase4 = 1
  269. Case 3 : chase1 = 1 : chase2 = 1 : chase3 = 1 : chase4 = 0
  270. End Select
  271. Else
  272. chase1 = 0 : chase2 = 0 : chase3 = 0 : chase4 = 0
  273. End if
  274. swirlramplight1.state = chase1 : swirlramplight5.state = chase1 : swirlramplight9.state = chase1 : swirlramplight13.state = chase1 : swirlramplight17.state = chase1 : swirlramplight21.state = chase1 : swirlramplight25.state = chase1 : swirlramplight29.state = chase1
  275. swirlramplight2.state = chase2 : swirlramplight6.state = chase2 : swirlramplight10.state = chase2 : swirlramplight14.state = chase2 : swirlramplight18.state = chase2 : swirlramplight22.state = chase2 : swirlramplight26.state = chase2 : swirlramplight30.state = chase2
  276. swirlramplight3.state = chase3 : swirlramplight7.state = chase3 : swirlramplight11.state = chase3 : swirlramplight15.state = chase3 : swirlramplight19.state = chase3 : swirlramplight23.state = chase3 : swirlramplight27.state = chase3 : swirlramplight31.state = chase3
  277. swirlramplight4.state = chase4 : swirlramplight8.state = chase4 : swirlramplight12.state = chase4 : swirlramplight16.state = chase4 : swirlramplight20.state = chase4 : swirlramplight24.state = chase4 : swirlramplight28.state = chase4 : swirlramplight32.state = chase4
  278. if chase2=0 or swirlramplight2.intensityscale < 0.01 Then
  279. wflash6.intensityScale=0
  280. Else
  281. wflash6.intensityscale=1
  282. end if
  283. if chase3=0 or swirlramplight3.intensityscale < 0.01 Then
  284. wflash7.intensityScale=0
  285. Else
  286. wflash7.intensityscale=1
  287. end if
  288. End Sub
  289.  
  290. '******************************************************
  291. ' TROUGH
  292. '******************************************************
  293.  
  294. Sub sw58_Hit():Controller.Switch(58) = 1:UpdateTrough:End Sub
  295. Sub sw58_UnHit():Controller.Switch(58) = 0:UpdateTrough:End Sub
  296. Sub sw57_Hit():Controller.Switch(57) = 1:UpdateTrough:End Sub
  297. Sub sw57_UnHit():Controller.Switch(57) = 0:UpdateTrough:End Sub
  298. Sub sw56_Hit():Controller.Switch(56) = 1:UpdateTrough:End Sub
  299. Sub sw56_UnHit():Controller.Switch(56) = 0:UpdateTrough:End Sub
  300.  
  301. sub reflectionTrigger_Hit
  302. if holoState=1 then
  303. ActiveBall.ReflectionEnabled=0
  304. end if
  305. end sub
  306.  
  307. sub reflectionTrigger_UnHit
  308. ActiveBall.ReflectionEnabled=1
  309. end sub
  310.  
  311. Sub UpdateTrough()
  312. UpdateTroughTimer.Interval = 300
  313. UpdateTroughTimer.Enabled = 1
  314. End Sub
  315.  
  316. Sub UpdateTroughTimer_Timer()
  317. If sw56.BallCntOver = 0 Then sw57.kick 60, 9
  318. If sw57.BallCntOver = 0 Then sw58.kick 60, 9
  319. Me.Enabled = 0
  320. End Sub
  321.  
  322. '******************************************************
  323. ' DRAIN & RELEASE
  324. '******************************************************
  325.  
  326. Sub sw55_Hit() 'Drain
  327. UpdateTrough
  328. Controller.Switch(55) = 1
  329. PlaySoundAT "drain", sw55
  330. End Sub
  331.  
  332. Sub sw55_UnHit() 'Drain
  333. Controller.Switch(55) = 0
  334. End Sub
  335.  
  336. Sub SolOuthole(enabled)
  337. If enabled Then
  338. sw55.kick 60,20
  339. PlaySoundAt SoundFX("solenoid",DOFContactors), sw55
  340. End If
  341. End Sub
  342.  
  343. Sub ReleaseBall(enabled)
  344. If enabled Then
  345. PlaySoundAt SoundFX("ballrelease",DOFContactors), sw56
  346. sw56.kick 60, 12
  347. UpdateTrough
  348. End If
  349. End Sub
  350.  
  351.  
  352. '******************************************************
  353. ' RIGHT UPPER KICKER (sw34)
  354. '******************************************************
  355.  
  356. Sub RightUpperKicker(enabled)
  357. If enabled Then
  358. sw34.kickz 0,45,1.56,0
  359. PlaysoundAt SoundFX("solenoid",DOFContactors), sw34
  360. If Controller.Switch(34) = True Then
  361. PlaysoundAt SoundFX("vuk_exit",DOFContactors), sw34
  362. End If
  363. Controller.Switch(34) = 0
  364. End If
  365. End Sub
  366.  
  367. sub sw34_hit
  368. PlaySoundAt "kicker_enter_center", sw34
  369. Controller.Switch(34) = 1
  370. End sub
  371.  
  372.  
  373. '******************************************************
  374. ' RIGHT LOWER KICKER (sw37)
  375. '******************************************************
  376.  
  377. Sub RightLowerKicker(enabled)
  378. If enabled Then
  379. sw37.kickz 180,20,1.56, 150
  380. PlaysoundAt SoundFX("solenoid",DOFContactors), sw37
  381. If Controller.Switch(37) = True Then
  382. PlaysoundAt SoundFX("vuk_exit",DOFContactors), sw37
  383. End If
  384. Controller.Switch(37) = 0
  385. End If
  386. End Sub
  387.  
  388. sub sw37_hit
  389. PlaySoundAt "kicker_enter_center", sw37
  390. Controller.Switch(37) = 1
  391. Stopsound "SubWay"
  392. End sub
  393.  
  394. Sub sw17scoop_hit()
  395. PlaySoundAt "scoopenter", sw17scoop
  396. End Sub
  397.  
  398. Sub sw17_Hit()
  399. PlaysoundAt "SubWay", sw17
  400. vpmTimer.PulseSw 17
  401. End Sub
  402.  
  403. Sub sw16scoop_hit()
  404. PlaySoundAt "scoop_enter", sw17scoop
  405. End Sub
  406.  
  407. Sub sw16_Hit()
  408. PlaysoundAt "SubWay", sw16
  409. vpmTimer.PulseSw 16
  410. End Sub
  411.  
  412.  
  413. '******************************************************
  414. ' FLIPPERS
  415. '******************************************************
  416.  
  417. Sub SolLFlipper(Enabled)
  418. If Enabled Then
  419. PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, .67, AudioPan(LeftFlipper), 0.05,0,0,1,AudioFade(LeftFlipper)
  420. LeftFlipper.RotateToEnd
  421. Else
  422. PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, AudioPan(LeftFlipper), 0.05,0,0,1,AudioFade(LeftFlipper)
  423. LeftFlipper.RotateToStart
  424. End If
  425. End Sub
  426. '
  427. Sub SolRFlipper(Enabled)
  428. If Enabled Then
  429. PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, .67, AudioPan(RightFlipper), 0.05,0,0,1,AudioFade(RightFlipper)
  430. RightFlipper.RotateToEnd
  431. Else
  432. PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, AudioPan(RightFlipper), 0.05,0,0,1,AudioFade(RightFlipper)
  433. RightFlipper.RotateToStart
  434. End If
  435. End Sub
  436.  
  437. '******************************************************
  438. ' SWITCHES
  439. '******************************************************
  440.  
  441. Sub sw51_Hit():VPMTimer.PulseSw 51:PlaySoundAt "Sensor", sw51: End Sub
  442. Sub sw52_Hit():VPMTimer.PulseSw 52:PlaySoundAt "Sensor", sw52: End Sub
  443. Sub sw53_Hit():VPMTimer.PulseSw 53:PlaySoundAt "Sensor", sw53: End Sub
  444. Sub sw54_Hit():VPMTimer.PulseSw 54:PlaySoundAt "Sensor", sw54: End Sub
  445.  
  446. Sub sw15_Hit():controller.switch(15) = 0 :PlaySoundAt "Sensor", sw15: End Sub
  447. Sub sw15_Unhit():controller.switch(15) = 1 End Sub
  448.  
  449.  
  450. Sub sw25_Hit():VPMTimer.PulseSw 25:PlaySoundAt "Sensor", sw25: End Sub
  451. Sub sw26_Hit():VPMTimer.PulseSw 26:PlaySoundAt "Sensor", sw26: End Sub
  452. Sub sw27_Hit():VPMTimer.PulseSw 27:PlaySoundAt "Sensor", sw27: End Sub
  453. Sub sw28_Hit():VPMTimer.PulseSw 28:PlaySoundAt "Sensor", sw28: End Sub
  454.  
  455. Sub sw41_Hit():VPMTimer.PulseSw 41:PlaySoundAt SoundFX("Target",DOFTargets), sw41: End Sub
  456. Sub sw42_Hit():VPMTimer.PulseSw 42:PlaySoundAt SoundFX("Target",DOFTargets), sw42: End Sub
  457. Sub sw43_Hit():VPMTimer.PulseSw 43:PlaySoundAt SoundFX("Target",DOFTargets), sw43: End Sub
  458. Sub sw44_Hit():VPMTimer.PulseSw 44:PlaySoundAt SoundFX("Target",DOFTargets), sw44: End Sub
  459.  
  460. Sub sw63_Hit():VPMTimer.PulseSw 63:PlaySoundAt "Gate", sw63: End Sub
  461.  
  462. Sub sw35_Hit() 'Right Ramp Enter
  463. VPMTimer.PulseSw 35
  464. PlaySoundAt "Gate", sw35
  465. If ActiveBall.vely < 0 then
  466. PlaySound "RampEntrywGate", 0, Vol(ActiveBall)*0.5, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  467. Else
  468. StopSound "RampEntryGate"
  469. End If
  470. End Sub 'Right Ramp Enter
  471.  
  472. Sub sw36_Hit()
  473. VPMTimer.PulseSw 36
  474. PlaySoundAt "Gate", sw36
  475. PlaySoundAt "Gate", sw36
  476. If ActiveBall.vely < 0 then
  477. PlaySound "RampEntrywGate", 0, Vol(ActiveBall)*0.5, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  478. Else
  479. StopSound "RampEntryGate"
  480. End If
  481. End Sub 'Left Ramp Enter
  482.  
  483.  
  484. Sub sw61_Hit():VPMTimer.PulseSw 61:End Sub 'Right Ramp Exit
  485. Sub sw62_Hit():VPMTimer.PulseSw 62:End Sub 'Left Ramp Exit
  486. Sub sw64_Hit():VPMTimer.PulseSw 64:End Sub 'Upper Ramp Enter
  487. Sub sw18_Hit():VPMTimer.PulseSw 18:PlaySoundAt "Gate", sw18: End Sub 'Center Shot
  488.  
  489. Sub sw65_Hit():VPMTimer.PulseSw 65:End Sub 'Pool switch
  490.  
  491. Sub sw66_Hit() : controller.switch(66) = 1 :PlaySoundAt "Sensor", sw66: End Sub 'Ball Shooter Lane
  492. Sub sw66_UnHit() : controller.switch(66) = 0 : End Sub
  493.  
  494.  
  495. '******************************************************
  496. ' BUMPERS
  497. '******************************************************
  498.  
  499. Sub Bumper1_Hit()
  500. PlaySoundAt SoundFX("fx_bumper1",DOFContactors), bumper1
  501. vpmTimer.PulseSw 45
  502. End Sub
  503.  
  504. Sub Bumper2_Hit()
  505. PlaySoundAt SoundFX("fx_bumper1",DOFContactors), bumper2
  506. vpmTimer.PulseSw 46
  507. End Sub
  508.  
  509. Sub Bumper3_Hit()
  510. PlaySoundAt SoundFX("fx_bumper1",DOFContactors), bumper3
  511. vpmTimer.PulseSw 33
  512. End Sub
  513. '**************************************************************
  514. ' Moving Ramp
  515. '**************************************************************
  516.  
  517. Dim RampAngle, RampDir
  518. RampAngle= 0
  519. RampDir = -1 '1 is up -1 is down dir
  520.  
  521. SolCallback(23) = "SolRampUp"
  522. SolCallback(26) = "SolRampDown"
  523.  
  524.  
  525. Sub SolRampUp(Enabled)
  526. If Enabled Then
  527. RampDir = 1
  528. Controller.Switch(38) = False
  529. UpdateRamp.Enabled = True
  530. playsound SoundFX("diverter",DOFContactors)
  531. End If
  532. End Sub
  533.  
  534. Sub SolRampDown(Enabled)
  535. If Enabled Then
  536. RampDir = -1
  537. Controller.Switch(38) = true
  538. UpdateRamp.Enabled = True
  539. playsound SoundFX("diverter",DOFContactors)
  540. End If
  541. End sub
  542.  
  543. Sub UpdateRamp_Timer
  544. RampAngle = RampAngle + RampDir
  545.  
  546. If RampAngle> 0 Then '110
  547. RampAngle = 0
  548. RampDir=-1
  549. UpdateRamp.Enabled = 0
  550. collRamp.collidable=false
  551. End If
  552. If RampAngle < -25 Then
  553. RampAngle = -25
  554. RampDir=1
  555. UpdateRamp.Enabled = 0
  556. collRamp.collidable=true
  557. End If
  558. moveRamp.rotx=RampAngle
  559. End Sub
  560.  
  561. Dim RStep, Lstep
  562. Sub RightSlingShot_Slingshot
  563. vpmTimer.pulsesw 48
  564. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
  565. RSling.Visible = 0
  566. RSling1.Visible = 1
  567. sling1.TransZ = -20
  568. RStep = 0
  569. RightSlingShot.TimerEnabled = 1
  570. End Sub
  571.  
  572. Sub RightSlingShot_Timer
  573. Select Case RStep
  574. Case 2:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  575. Case 3:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  576. End Select
  577. RStep = RStep + 1
  578. End Sub
  579.  
  580. Sub LeftSlingShot_Slingshot
  581. vpmTimer.pulsesw 47
  582. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
  583. LSling.Visible = 0
  584. LSling1.Visible = 1
  585. sling2.TransZ = -20
  586. LStep = 0
  587. LeftSlingShot.TimerEnabled = 1
  588. End Sub
  589.  
  590. Sub LeftSlingShot_Timer
  591. Select Case LStep
  592. Case 2:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  593. Case 3:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  594. End Select
  595. LStep = LStep + 1
  596. End Sub
  597.  
  598.  
  599. '******************************************************
  600. ' CREATURE ANIMATION
  601. '******************************************************
  602.  
  603. SolCallBack(27) = "CreatureMotorMirror"
  604. SolCallBack(28) = "HoloLamp"
  605. 'SolCallBack(11) = "CreatureFlash"
  606.  
  607.  
  608. dim holoState:holoState=0
  609. dim holoIdx:holoIdx=18
  610. dim posinc:posinc=1
  611. Sub HoloLamp(enabled)
  612. If enabled then
  613. holoState=1
  614. creature.visible=1
  615. else
  616. holoState=0
  617. creature.visible=0
  618. end if
  619. End Sub
  620.  
  621. Sub CreatureFlash(enabled)
  622. If enabled then
  623. holoState=1
  624. creature.visible=1
  625. else
  626. holoState=0
  627. creature.visible=0
  628. end if
  629. End Sub
  630.  
  631. Sub CreatureMotorMirror(enabled)
  632. if enabled then
  633. Playsound SoundFX("Motor",DOFShaker),-1
  634. holoIdx=18
  635. posinc = 1
  636. creatureTimer.enabled=1
  637. else
  638. Stopsound "Motor"
  639. holoIdx=18
  640. posinc = 1
  641. creatureTimer.enabled=0
  642. end if
  643. End Sub
  644.  
  645. Sub creatureTimer_timer()
  646. holoIdx=holoIdx+posinc
  647. creature.visible=holoState
  648. If holoIdx<1 then holoIdx=1:posinc=1
  649. If holoIdx>46 then holoIdx=46:posinc=-1
  650. creature.image = holoIdx
  651. end Sub
  652.  
  653.  
  654.  
  655. sub startUpperLeftWireRamp_Hit
  656. PlaySoundAtBall "WireRamp"
  657. end Sub
  658.  
  659. sub endUpperLeftWireRamp_Hit():
  660. StopSound "WireRamp":
  661. vpmTimer.AddTimer 150, "PlayBallDrop endUpperLeftWireRamp, 0.1'"
  662. end sub
  663.  
  664. Sub leftrampdrop_hit()
  665. vpmTimer.AddTimer 150, "PlayBallDrop leftrampdrop, 0.1'"
  666. End Sub
  667.  
  668.  
  669. Sub rightrampdrop_hit()
  670. vpmTimer.AddTimer 150, "PlayBallDrop rightrampdrop, 0.1'"
  671. End Sub
  672.  
  673. Sub startCenterWireRamp_Hit
  674. PlaySoundAtBall "CenterWireRamp"
  675. End Sub
  676.  
  677. Sub stopCenterWireRamp_Hit
  678. StopSound "CenterWireRamp"
  679. End Sub
  680.  
  681.  
  682. Sub swirlrampdrop_hit()
  683. vpmTimer.AddTimer 150, "PlayBallDrop swirlrampdrop, 0.1'"
  684. End Sub
  685.  
  686. Sub PlayBallDrop(obj,volume)
  687. Playsound "BallDrop", 1, volume, AudioPan(obj), 0,0,0, 1, AudioFade(obj)'"
  688. End Sub
  689.  
  690. '*********************************************************************
  691. ' Positional Sound Playback Functions
  692. '*********************************************************************
  693.  
  694. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  695. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  696. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  697. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  698. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  699. End Sub
  700.  
  701. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  702. Sub PlaySoundAt(soundname, tableobj)
  703. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  704. End Sub
  705.  
  706. Sub PlaySoundAtBall(soundname)
  707. PlaySoundAt soundname, ActiveBall
  708. End Sub
  709.  
  710. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  711. Dim tmp
  712. tmp = ball.x * 2 / table1.width-1
  713. If tmp> 0 Then
  714. Pan = Csng(tmp ^10)
  715. Else
  716. Pan = Csng(-((- tmp) ^10) )
  717. End If
  718. End Function
  719.  
  720. '*********************************************************************
  721. ' Supporting Ball & Sound Functions
  722. '*********************************************************************
  723.  
  724. Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
  725. Dim tmp
  726. tmp = tableobj.y * 2 / table1.height-1
  727. If tmp > 0 Then
  728. AudioFade = Csng(tmp ^10)
  729. Else
  730. AudioFade = Csng(-((- tmp) ^10) )
  731. End If
  732. End Function
  733.  
  734. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  735. Dim tmp
  736. tmp = tableobj.x * 2 / table1.width-1
  737. If tmp > 0 Then
  738. AudioPan = Csng(tmp ^10)
  739. Else
  740. AudioPan = Csng(-((- tmp) ^10) )
  741. End If
  742. End Function
  743.  
  744. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  745. Vol = Csng(BallVel(ball) ^2 / 2000)
  746. End Function
  747.  
  748. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  749. Pitch = BallVel(ball) * 20
  750. End Function
  751.  
  752. Function BallVel(ball) 'Calculates the ball speed
  753. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  754. End Function
  755.  
  756.  
  757. '*****************************************
  758. ' rothbauerw's Manual Ball Control
  759. '*****************************************
  760.  
  761. '************************ Start Ball Control 3/3
  762. Sub StartBallControl_Hit()
  763. Set ControlBall = ActiveBall
  764. contballinplay = true
  765. End Sub
  766.  
  767. Sub StopBallControl_Hit()
  768. contballinplay = false
  769. End Sub
  770.  
  771. Dim bcup, bcdown, bcleft, bcright
  772. Dim contball, contballinplay, ControlBall
  773. Dim bcvel, bcyveloffset, bcboostmulti, bcboost
  774.  
  775. bcboost = 1 'Do Not Change - default setting
  776. bcvel = 4 'Controls the speed of the ball movement
  777. bcyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  778. bcboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  779.  
  780. Sub BallControlTimer_Timer()
  781. If Contball and ContBallInPlay and EnableBallControl then
  782. If bcright = 1 Then
  783. ControlBall.velx = bcvel*bcboost
  784. ElseIf bcleft = 1 Then
  785. ControlBall.velx = - bcvel*bcboost
  786. Else
  787. ControlBall.velx=0
  788. End If
  789.  
  790. If bcup = 1 Then
  791. ControlBall.vely = -bcvel*bcboost
  792. ElseIf bcdown = 1 Then
  793. ControlBall.vely = bcvel*bcboost
  794. Else
  795. ControlBall.vely= bcyveloffset
  796. End If
  797. End If
  798. End Sub
  799. '************************ End Ball Control 3/3
  800.  
  801. '*****************************************
  802. ' JP's VP10 Rolling Sounds
  803. '*****************************************
  804.  
  805. Const tnob = 5 ' total number of balls
  806. ReDim rolling(tnob)
  807. InitRolling
  808.  
  809. Sub InitRolling
  810. Dim i
  811. For i = 0 to tnob
  812. rolling(i) = False
  813. Next
  814. End Sub
  815.  
  816. Sub BallRollingUpdate_Timer()
  817. Dim BOT, b
  818. BOT = GetBalls
  819.  
  820. ' stop the sound of deleted balls
  821. For b = UBound(BOT) + 1 to tnob
  822. rolling(b) = False
  823. StopSound("fx_ballrolling" & b)
  824. Next
  825.  
  826. ' exit the sub if no balls on the table
  827. If UBound(BOT) = -1 Then Exit Sub
  828.  
  829. ' play the rolling sound for each ball
  830. For b = 0 to UBound(BOT)
  831. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  832. StopSound("plasticroll" & b)
  833. rolling(b) = True
  834. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b))*RollingSoundFactor, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  835. ElseIf BallVel(BOT(b) ) > 1 AND BOT(b).z > 30 Then
  836. StopSound("fx_ballrolling" & b)
  837. rolling(b) = True
  838. PlaySound("plasticroll" & b), -1, Vol(BOT(b))*RollingSoundFactor*2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  839. Else
  840. If rolling(b) = True Then
  841. StopSound("fx_ballrolling" & b)
  842. StopSound("plasticroll" & b)
  843. rolling(b) = False
  844. End If
  845. End If
  846. Next
  847. End Sub
  848.  
  849. '**********************
  850. ' Ball Collision Sound
  851. '**********************
  852.  
  853. Sub OnBallBallCollision(ball1, ball2, velocity)
  854. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  855. End Sub
  856.  
  857.  
  858. '*****************************************
  859. ' ninuzzu's FLIPPER SHADOWS
  860. '*****************************************
  861.  
  862. sub FlipperTimer_Timer()
  863. batleftshadow.objRotZ = LeftFlipper.currentangle
  864. batrightshadow.objRotZ = RightFlipper.currentangle
  865. batleft.objrotz = LeftFlipper.currentangle
  866. batright.objrotz=RightFlipper.currentangle
  867. End Sub
  868.  
  869. '*****************************************
  870. ' ninuzzu's BALL SHADOW
  871. '*****************************************
  872. Dim BallShadow
  873. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  874.  
  875. Sub BallShadowUpdate_timer()
  876. Dim BOT, b
  877. BOT = GetBalls
  878. ' hide shadow of deleted balls
  879. If UBound(BOT)<(tnob-1) Then
  880. For b = (UBound(BOT) + 1) to (tnob-1)
  881. BallShadow(b).visible = 0
  882. Next
  883. End If
  884. ' exit the Sub if no balls on the table
  885. If UBound(BOT) = -1 Then Exit Sub
  886. ' render the shadow for each ball
  887. For b = 0 to UBound(BOT)
  888. If BOT(b).X < Table1.Width/2 Then
  889. BallShadow(b).X = ((BOT(b).X) + ((BOT(b).X - (Table1.Width/2))/40))
  890. Else
  891. BallShadow(b).X = ((BOT(b).X) + ((BOT(b).X - (Table1.Width/2))/40))
  892. End If
  893. ballShadow(b).Y = BOT(b).Y + 10
  894. If BOT(b).Z > 20 Then
  895. BallShadow(b).visible = 1
  896. Else
  897. BallShadow(b).visible = 0
  898. End If
  899. Next
  900. End Sub
  901.  
  902.  
  903.  
  904. '************************************
  905. ' What you need to add to your table
  906. '************************************
  907.  
  908. ' a timer called RollingTimer. With a fast interval, like 10
  909. ' one collision sound, in this script is called fx_collide
  910. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  911. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  912.  
  913.  
  914. '******************************************
  915. ' Explanation of the rolling sound routine
  916. '******************************************
  917.  
  918. ' sounds are played based on the ball speed and position
  919.  
  920. ' the routine checks first for deleted balls and stops the rolling sound.
  921.  
  922. ' The For loop goes through all the balls on the table and checks for the ball speed and
  923. ' if the ball is on the table (height lower than 30) then then it plays the sound
  924. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  925.  
  926. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  927. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  928. ' according to the position of the ball on the table.
  929.  
  930.  
  931. '**************************************
  932. ' Explanation of the collision routine
  933. '**************************************
  934.  
  935. ' The collision is built in VP.
  936. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  937. ' will call this routine. What you add in the sub is up to you. As an example is a simple Playsound with volume and paning
  938. ' depending of the speed of the collision.
  939.  
  940. Sub Pins_Hit (idx)
  941. PlaySound "pinhit_low", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  942. End Sub
  943.  
  944. Sub Woods_Hit (idx)
  945. PlaySound "woodhit", 0, Vol(ActiveBall)*VolumeDial*2, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  946. End Sub
  947.  
  948. Sub Targets_Hit (idx)
  949. PlaySound "target", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  950. End Sub
  951.  
  952. Sub Metals_Thin_Hit (idx)
  953. PlaySound "metalhit_thin", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  954. End Sub
  955.  
  956. Sub Metals_Medium_Hit (idx)
  957. PlaySound "metalhit_medium", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  958. End Sub
  959.  
  960. Sub Metals2_Hit (idx)
  961. PlaySound "metalhit2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  962. End Sub
  963.  
  964. Sub Gates_Hit (idx)
  965. PlaySound "gate4", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  966. End Sub
  967.  
  968. Sub Spinner_Spin
  969. PlaySound "fx_spinner", 0, .25*VolumeDial, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  970. End Sub
  971.  
  972. Sub Rubbers_Hit(idx)
  973. dim finalspeed
  974. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  975. If finalspeed > 20 then
  976. PlaySound "fx_rubber2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  977. End if
  978. If finalspeed >= 6 AND finalspeed <= 20 then
  979. RandomSoundRubber()
  980. End If
  981. End Sub
  982.  
  983. Sub Posts_Hit(idx)
  984. dim finalspeed
  985. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  986. If finalspeed > 16 then
  987. PlaySound "fx_rubber2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  988. End if
  989. If finalspeed >= 6 AND finalspeed <= 16 then
  990. RandomSoundRubber()
  991. End If
  992. End Sub
  993.  
  994. Sub RandomSoundRubber()
  995. Select Case Int(Rnd*3)+1
  996. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  997. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  998. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  999. End Select
  1000. End Sub
  1001.  
  1002. Sub LeftFlipper_Collide(parm)
  1003. RandomSoundFlipper()
  1004. End Sub
  1005.  
  1006. Sub RightFlipper_Collide(parm)
  1007. RandomSoundFlipper()
  1008. End Sub
  1009.  
  1010. Sub DiverterFlipper_Collide(parm)
  1011. PlaySound "metalhit2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1012. End Sub
  1013.  
  1014. Sub RandomSoundFlipper()
  1015. Select Case Int(Rnd*3)+1
  1016. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1017. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1018. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall)*VolumeDial, AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1019. End Select
  1020. End Sub
  1021.  
  1022.  
  1023. '================Light Handling==================
  1024. ' GI, Flashers, and Lamp handling
  1025. 'Based on JP's VP10 fading Lamp routine, based on PD's Fading Lights
  1026. ' Mod FrameTime and GI handling by nFozzy
  1027. '================================================
  1028. 'Short installation
  1029. 'Keep all non-GI lamps/Flashers in a big collection called aLampsAll
  1030. 'Initialize SolModCallbacks: Const UseVPMModSol = 1 at the top of the script, before LoadVPM. vpmInit me in table1_Init()
  1031. 'LUT images (optional)
  1032. 'Make modifications based on era of game (setlamp / flashc for games without solmodcallback, use bonus GI subs for games with only one GI control)
  1033.  
  1034. Dim LampState(340), FadingLevel(340), CollapseMe
  1035. Dim FlashSpeedUp(340), FlashSpeedDown(340), FlashMin(340), FlashMax(340), FlashLevel(340)
  1036. Dim SolModValue(340) 'holds 0-255 modulated solenoid values
  1037.  
  1038. 'These are used for fading lights and flashers brighter when the GI is darker
  1039. Dim LampsOpacity(340, 2) 'Columns: 0 = intensity / opacity, 1 = fadeup, 2 = FadeDown
  1040. Dim GIscale(4) '5 gi strings
  1041.  
  1042. InitLamps
  1043.  
  1044. reDim CollapseMe(1) 'Setlamps and SolModCallBacks (Click Me to Collapse)
  1045. Sub SetLamp(nr, value)
  1046. If value <> LampState(nr) Then
  1047. LampState(nr) = abs(value)
  1048. FadingLevel(nr) = abs(value) + 4
  1049. End If
  1050. End Sub
  1051.  
  1052. Sub SetLampm(nr, nr2, value) 'set 2 lamps
  1053. If value <> LampState(nr) Then
  1054. LampState(nr) = abs(value)
  1055. FadingLevel(nr) = abs(value) + 4
  1056. End If
  1057. If value <> LampState(nr2) Then
  1058. LampState(nr2) = abs(value)
  1059. FadingLevel(nr2) = abs(value) + 4
  1060. End If
  1061. End Sub
  1062.  
  1063. Sub SetModLamp(nr, value)
  1064. If value <> SolModValue(nr) Then
  1065. SolModValue(nr) = value
  1066. if value > 0 then LampState(nr) = 1 else LampState(nr) = 0
  1067. FadingLevel(nr) = LampState(nr) + 4
  1068. End If
  1069. End Sub
  1070.  
  1071. Sub SetModLampM(nr, nr2, value) 'set 2 modulated lamps
  1072. If value <> SolModValue(nr) Then
  1073. SolModValue(nr) = value
  1074. if value > 0 then LampState(nr) = 1 else LampState(nr) = 0
  1075. FadingLevel(nr) = LampState(nr) + 4
  1076. End If
  1077. If value <> SolModValue(nr2) Then
  1078. SolModValue(nr2) = value
  1079. if value > 0 then LampState(nr2) = 1 else LampState(nr2) = 0
  1080. FadingLevel(nr2) = LampState(nr2) + 4
  1081. End If
  1082. End Sub
  1083. 'Flashers via SolModCallBacks
  1084. SolModCallBack(2) = "SetModLamp 102," 'Flasher2
  1085. SolModCallBack(8) = "SetModLamp 108," 'Flasher8
  1086. SolModCallBack(9) = "SetModLamp 109," 'Flasher9
  1087. SolModCallBack(10) = "SetModLamp 110," 'Flasher10
  1088. SolModCallBack(16) = "SetModLamp 116," 'Flasher16
  1089. SolModCallBack(17) = "SetModLamp 117," 'Flasher17
  1090. SolModCallBack(18) = "SetModLamp 118," 'Flasher18
  1091. SolModCallBack(19) = "SetModLamp 119," 'Flasher19
  1092. SolModCallBack(22) = "SetModLamp 122," 'Flasher22
  1093. SolModCallBack(25) = "SetModLamp 125," 'MovieFlasher
  1094.  
  1095. '#end section
  1096. reDim CollapseMe(2) 'InitLamps (Click Me to Collapse)
  1097. Sub InitLamps() 'set fading speeds and other stuff here
  1098. GetOpacity aLampsAll 'All non-GI lamps and flashers go in this object array for compensation script!
  1099. Dim x
  1100. for x = 0 to uBound(LampState)
  1101. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  1102. FadingLevel(x) = 4 ' used to track the fading state
  1103. FlashSpeedUp(x) = 0.1 'Fading speeds in opacity per MS I think (Not used with nFadeL or nFadeLM subs!)
  1104. FlashSpeedDown(x) = 0.1
  1105.  
  1106. FlashMin(x) = 0.001 ' the minimum value when off, usually 0
  1107. FlashMax(x) = 1 ' the minimum value when off, usually 1
  1108. FlashLevel(x) = 0.001 ' Raw Flasher opacity value. Start this >0 to avoid initial flasher stuttering.
  1109.  
  1110. SolModValue(x) = 0 ' Holds SolModCallback values
  1111.  
  1112. Next
  1113.  
  1114. for x = 0 to uBound(giscale)
  1115. Giscale(x) = 1.625 ' lamp GI compensation multiplier, eg opacity x 1.625 when gi is fully off
  1116. next
  1117.  
  1118. for x = 11 to 100 'insert fading levels (only applicable for lamps that use FlashC sub)
  1119. FlashSpeedUp(x) = 0.015
  1120. FlashSpeedDown(x) = 0.009
  1121. Next
  1122.  
  1123. for x = 101 to 186 'Flasher fading speeds 'intensityscale(%) per 10MS
  1124. FlashSpeedUp(x) = 1.1 * 4
  1125. FlashSpeedDown(x) = 0.9 * 4
  1126. next
  1127.  
  1128. for x = 200 to 204 'GI relay on / off fading speeds
  1129. FlashSpeedUp(x) = 0.01
  1130. FlashSpeedDown(x) = 0.008
  1131. FlashMin(x) = 0
  1132. Next
  1133. for x = 300 to 304 'GI 8 step modulation fading speeds
  1134. FlashSpeedUp(x) = 0.01
  1135. FlashSpeedDown(x) = 0.008
  1136. FlashMin(x) = 0
  1137. Next
  1138.  
  1139. UpdateGIon 0, 1:UpdateGIon 1, 1: UpdateGIon 2, 1 : UpdateGIon 3, 1:UpdateGIon 4, 1
  1140. UpdateGI 0, 7:UpdateGI 1, 7:UpdateGI 2, 7 : UpdateGI 3, 7:UpdateGI 4, 7
  1141. End Sub
  1142.  
  1143. Sub GetOpacity(a) 'Keep lamp/flasher data in an array
  1144. Dim x
  1145. for x = 0 to (a.Count - 1)
  1146. On Error Resume Next
  1147. if a(x).Opacity > 0 then a(x).Uservalue = a(x).Opacity
  1148. if a(x).Intensity > 0 then a(x).Uservalue = a(x).Intensity
  1149. If a(x).FadeSpeedUp > 0 then LampsOpacity(x, 1) = a(x).FadeSpeedUp : LampsOpacity(x, 2) = a(x).FadeSpeedDown
  1150. Next
  1151. for x = 0 to (a.Count - 1) : LampsOpacity(x, 0) = a(x).UserValue : Next
  1152. End Sub
  1153.  
  1154. sub DebugLampsOn(input):Dim x: for x = 10 to 100 : setlamp x, input : next : end sub
  1155.  
  1156. '#end section
  1157.  
  1158. reDim CollapseMe(3) 'LampTimer (Click Me to Collapse)
  1159. LampTimer.Interval = -1 '-1 is ideal, but it will technically work with any timer interval
  1160. LampTimer.Enabled = 1
  1161. Dim FrameTime, InitFadeTime : FrameTime = 10 'Count Frametime
  1162. Sub LampTimer_Timer()
  1163. FrameTime = gametime - InitFadeTime
  1164. Dim chgLamp, num, chg, ii
  1165. chgLamp = Controller.ChangedLamps
  1166. If Not IsEmpty(chgLamp) Then
  1167. For ii = 0 To UBound(chgLamp)
  1168. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  1169. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  1170. Next
  1171. End If
  1172.  
  1173. UpdateGIstuff
  1174. UpdateLamps
  1175. UpdateFlashers
  1176.  
  1177. InitFadeTime = gametime
  1178. End Sub
  1179. '#end section
  1180. reDim CollapseMe(4) 'ASSIGNMENTS: Lamps, GI, and Flashers (Click Me to Collapse)
  1181. Sub UpdateGIstuff()
  1182. FadeGI 200 'Chaselights #1
  1183. ModGI 300
  1184. FadeGI 201 'Middle GI
  1185. ModGI 301
  1186. FadeGI 202 'Upper GI
  1187. ModGI 302
  1188. FadeGI 203 'Chaselights #2
  1189. ModGI 303
  1190. FadeGI 204 'Lower GI
  1191. ModGI 304
  1192. UpdateGIObjects 200, 300, Chaselights, 1 'nr, nr2, array 'Updates GI objects
  1193. UpdateGIObjects 201, 301, GI_Middle, 0 'nr, nr2, array 'Updates GI objects
  1194. UpdateGIObjects 202, 302, GI_Upper, 0 'nr, nr2, array 'Updates GI objects
  1195. UpdateGIObjects 204, 304, GI_Lower, 0 'nr, nr2, array 'Updates GI objects
  1196. If lutfading = 1 Then
  1197. GiCompensationAvgM 201, 301, 202, 302, 204, 304, aLampsAll, GiScale(2) 'Averages two lamp strings. Ideal match the avg. Lut fading.
  1198. FadeLUTavgM 201, 301, 202, 302, 204, 304, "LutCont_", 27 'Lut averages three fading strings
  1199. End If
  1200. End Sub
  1201.  
  1202. Dim LutFading
  1203.  
  1204. If Table1.ShowDT = True Then
  1205. lutfading = dtlutfading
  1206. Else
  1207. lutFading = fslutfading
  1208. End If
  1209.  
  1210. Sub UpdateFlashers()
  1211. nModFlash 102, fl2, 0, 0 'NR, Object, LowPass(see function ScaleByte) OffScale (multiply fading when callback 0)
  1212. nModFlash 108, fl8, 0, 0 'Last two arguments will carry through to objects controlled by nModFlashM.
  1213. nModFlashm 109, fl9b
  1214. nModFlash 109, fl9a, 0, 0 'For more control, use multiple fading numbers via SetModLampM / SetModLampMM
  1215. nModFlashm 110, fl10a
  1216. nModFlash 110, fl10, 0, 0
  1217. nModFlash 116, fl16, 0, 0
  1218. nModFlash 117, fl17, 0, 0
  1219. nModFlash 118, fl18, 0, 0
  1220. nModFlash 119, fl19, 0, 0
  1221. nModFlash 122, fl22, 0, 0
  1222. nModFlashm 125, fl37b
  1223. nModFlashm 125, fl37a
  1224. nModFlashm 125, l44b
  1225. nModFlash 125, l37b, 0, 0
  1226. End Sub
  1227.  
  1228. Sub UpdateLamps
  1229. NFadeLm 11, l11
  1230. NFadeLm 11, light51
  1231. FlashC 11, wFlash11
  1232. NFadeLm 12, l12
  1233. NFadeLm 12, light52
  1234. FlashC 12, wFlash12
  1235. NFadeLm 13, l13
  1236. NFadeLm 13, light53
  1237. FlashC 13, wFlash13
  1238. NFadeLm 14, l14
  1239. NFadeLm 14, light54
  1240. FlashC 14, wFlash14
  1241.  
  1242. 'flupper
  1243. If bumperslit = 0 then
  1244. NFadeLm 15, l15
  1245. NFadeLm 15, light2
  1246. NFadeLm 16, l16
  1247. NFadeLm 16, light1
  1248. NFadeLm 17, l17
  1249. NFadeLm 17, light4
  1250. Else
  1251. NFadeLm 15, bumper2Light1
  1252. NFadeLm 15, bumper2Light2
  1253. NFadeLm 16, bumper1Light1
  1254. NFadeLm 16, bumper1Light2
  1255. NFadeLm 17, bumper3Light1
  1256. NFadeLm 17, bumper3Light2
  1257. end if
  1258.  
  1259. 'flupper
  1260. FlashC 18, f18
  1261. NFadeL 21, l21
  1262. NFadeL 22, l22
  1263. NFadeL 23, l23
  1264. NFadeL 24, l24
  1265. NFadeLm 25, l25
  1266. NFadeL 25, light34
  1267. NFadeLm 26, l26
  1268. NFadeL 26, light35
  1269. NFadeL 27, l27
  1270. NFadeLm 28, l28
  1271. NFadeLm 28, l288
  1272. NFadeL 28, light38
  1273. NFadeLm 31, l31
  1274. NFadeL 31, light50
  1275. NFadeL 32, l32
  1276. NFadeL 33, l33
  1277. NFadeLm 34, l34
  1278. NFadeL 34, light45
  1279. NFadeLm 35, l35
  1280. NFadeLm 35, light44
  1281. FlashC 35, wflash44
  1282. NFadeLm 36, l36
  1283. NFadeLm 36, light42
  1284. NFadeLm 36, light47
  1285. flashC 36, wflash42
  1286. NFadeLm 37, l37a
  1287. ' NFadeLm 37, l37b
  1288. NFadeLm 37, l37c
  1289. NFadeLm 37, light39
  1290. NFadeLm 37, light40
  1291. FlashC 40, wflash40
  1292. NFadeLm 37, light41
  1293. NFadeLm 37, light46
  1294. FlashC 37, wflash41
  1295. NFadeLm 38, l38
  1296. NFadeL 38, light27
  1297. NFadeLm 41, l41
  1298. NFadeL 41, light33
  1299. NFadeLm 42, l42
  1300. NFadeLm 42, light32
  1301. FlashC 42, wflash32
  1302. NFadeLm 43, l43
  1303. NFadeL 43, light31
  1304. NFadeLm 44, l44a
  1305. ' NFadeLm 44, l44b
  1306. NFadeLm 44, l44c
  1307. NFadeLm 44, light28
  1308. NFadeLm 44, light29
  1309. NFadeLm 44, light30
  1310. NFadeLm 44, light55
  1311. FlashC 44, wflash30
  1312. NFadeL 45, l45
  1313. NFadeLm 46, l46
  1314. NFadeL 46, light43
  1315. NFadeLm 47, l47
  1316. NFadeL 47, light22
  1317. NFadeLm 48, l48
  1318. NFadeL 48, light21
  1319. NFadeLm 54, l54
  1320. NFadeL 54, light23
  1321. NFadeLm 53, l53
  1322. NFadeL 53, light24
  1323. NFadeL 52, l52
  1324. FlashC 51, f51
  1325.  
  1326. FlashC 55, fl55
  1327. FlashC 56, fl56
  1328. FlashC 57, fl57
  1329. FlashC 58, fl58
  1330.  
  1331. NFadeL 61, l61
  1332. NFadeLm 62, l62
  1333. NFadeL 62, light36
  1334. Flashm 63, wFlash63
  1335. FlashC 63, fl63
  1336. Flashm 64, wFlash64
  1337. FlashC 64, fl64
  1338. Flashm 65, wFlash65
  1339. FlashC 65, fl65
  1340. FlashC 66, fl66
  1341. FlashC 67, fl67
  1342. FlashC 68, fl68
  1343.  
  1344. NFadeL 81, l81
  1345. NFadeL 82, l82
  1346. NFadeL 83, l83
  1347. NFadeL 84, l84
  1348. NFadeLm 85, l85
  1349. NFadeLm 85, light37
  1350. flashC 85, wflash37
  1351. NFadeLm 86, l86
  1352. NFadeLm 86, light26
  1353. NFadeL 86, light49
  1354. NFadeLm 87, l87
  1355. NFadeLm 87, light25
  1356. NFadeL 87, light48
  1357. end sub
  1358.  
  1359. '#end section
  1360.  
  1361. reDim CollapseMe(5) 'Combined GI subs / functions (Click Me to Collapse)
  1362. Set GICallback = GetRef("UpdateGIon") 'On/Off GI to NRs 200-203
  1363. Sub UpdateGIOn(no, Enabled) : Setlamp no+200, cInt(enabled) : End Sub
  1364.  
  1365.  
  1366. Set GICallback2 = GetRef("UpdateGI")
  1367. Sub UpdateGI(no, step) '8 step Modulated GI to NRs 300-303
  1368. Dim ii, x', i
  1369. If step = 0 then exit sub 'only values from 1 to 8 are visible and reliable. 0 is not reliable and 7 & 8 are the same so...
  1370.  
  1371. If no = 0 Then
  1372. If step > 0 then chaselightson = true else chaselightson = false : end if
  1373. end if
  1374.  
  1375. SetModLamp no+300, ScaleGI(step, 0)
  1376. LampState((no+300)) = 0
  1377. End Sub
  1378.  
  1379. Function ScaleGI(value, scaletype) 'returns an intensityscale-friendly 0->100% value out of 1>8 'it does go to 8
  1380. Dim i
  1381. Select Case scaletype 'select case because bad at maths
  1382. case 0 : i = value * (1/8) '0 to 1
  1383. case 25 : i = (1/28)*(3*value + 4)
  1384. case 50 : i = (value+5)/12
  1385. case else : i = value * (1/8) '0 to 1
  1386. ' x = (4*value)/3 - 85 '63.75 to 255
  1387. End Select
  1388. ScaleGI = i
  1389. End Function
  1390.  
  1391. ' Dim LSstate : LSstate = False 'fading sub handles SFX 'Uncomment to enable
  1392. Sub FadeGI(nr) 'in On/off 'Updates nothing but flashlevel
  1393. Select Case FadingLevel(nr)
  1394. Case 3 : FadingLevel(nr) = 0
  1395. Case 4 'off
  1396. DOF 101, DOFOff
  1397. ' If Not LSstate then Playsound "FX_Relay_Off",0,LVL(0.1) : LSstate = True 'handle SFX
  1398. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * FrameTime)
  1399. If FlashLevel(nr) < FlashMin(nr) Then
  1400. FlashLevel(nr) = FlashMin(nr)
  1401. FadingLevel(nr) = 3 'completely off
  1402. ' LSstate = False
  1403. End if
  1404. Case 5 ' on
  1405. DOF 101, DOFOn
  1406. ' If Not LSstate then Playsound "FX_Relay_On",0,LVL(0.1) : LSstate = True 'handle SFX
  1407. FlashLevel(nr) = FlashLevel(nr) + (FlashSpeedUp(nr) * FrameTime)
  1408. If FlashLevel(nr) > FlashMax(nr) Then
  1409. FlashLevel(nr) = FlashMax(nr)
  1410. FadingLevel(nr) = 6 'completely on
  1411. ' LSstate = False
  1412. End if
  1413. Case 6 : FadingLevel(nr) = 1
  1414. End Select
  1415. End Sub
  1416. Sub ModGI(nr2) 'in 0->1 'Updates nothing but flashlevel 'never off
  1417. Dim DesiredFading
  1418. Select Case FadingLevel(nr2)
  1419. case 3 : FadingLevel(nr2) = 0 'workaround - wait a frame to let M sub finish fading
  1420. ' Case 4 : FadingLevel(nr2) = 3 'off -disabled off, only gicallback1 can turn off GI(?) 'experimental
  1421. Case 5, 4 ' Fade (Dynamic)
  1422. DesiredFading = SolModValue(nr2)
  1423. if FlashLevel(nr2) < DesiredFading Then '+
  1424. FlashLevel(nr2) = FlashLevel(nr2) + (FlashSpeedUp(nr2) * FrameTime )
  1425. If FlashLevel(nr2) >= DesiredFading Then FlashLevel(nr2) = DesiredFading : FadingLevel(nr2) = 1
  1426. elseif FlashLevel(nr2) > DesiredFading Then '-
  1427. FlashLevel(nr2) = FlashLevel(nr2) - (FlashSpeedDown(nr2) * FrameTime )
  1428. If FlashLevel(nr2) <= DesiredFading Then FlashLevel(nr2) = DesiredFading : FadingLevel(nr2) = 6
  1429. End If
  1430. Case 6
  1431. FadingLevel(nr2) = 1
  1432. End Select
  1433. End Sub
  1434.  
  1435. Sub UpdateGIobjects(nr, nr2, a, var) 'Just Update GI
  1436. If FadingLevel(nr) > 1 or FadingLevel(nr2) > 1 Then
  1437. Dim x, Output : Output = FlashLevel(nr2) * FlashLevel(nr)
  1438. If var = 1 then Output = Output*chaselightsintensity
  1439. for each x in a : x.IntensityScale = Output : next
  1440. End If
  1441. end Sub
  1442.  
  1443. Sub GiCompensation(nr, nr2, a, GIscaleOff) 'One NR pairing only fading
  1444. ' tbgi.text = "GI: " & SolModValue(nr) & " " & FlashLevel(nr) & " " & FadingLevel(nr) & vbnewline & _
  1445. ' "ModGI: " & SolModValue(nr2) & " " & FlashLevel(nr2) & " " & FadingLevel(nr2) & vbnewline & _
  1446. ' "Solmodvalue, Flashlevel, Fading step"
  1447. if FadingLevel(nr) > 1 or FadingLevel(nr2) > 1 Then
  1448. Dim x, Giscaler, Output : Output = FlashLevel(nr2) * FlashLevel(nr)
  1449. Giscaler = ((Giscaleoff-1) * (ABS(Output-1) ) ) + 1 'fade GIscale the opposite direction
  1450.  
  1451. for x = 0 to (a.Count - 1) 'Handle Compensate Flashers
  1452. On Error Resume Next
  1453. a(x).Opacity = LampsOpacity(x, 0) * Giscaler
  1454. a(x).Intensity = LampsOpacity(x, 0) * Giscaler
  1455. a(x).FadeSpeedUp = LampsOpacity(x, 1) * Giscaler
  1456. a(x).FadeSpeedDown = LampsOpacity(x, 2) * Giscaler
  1457. Next
  1458. ' tbbb.text = giscaler & " on:" & FadingLevel(nr) & vbnewline & "flash: " & output & " onmod:" & FadingLevel(nr2) & vbnewline & l37.intensity
  1459. ' tbbb1.text = FadingLevel(nr) & vbnewline & FadingLevel(nr2)
  1460. ' tbgi1.text = Output & " giscale:" & giscaler 'debug
  1461. End If
  1462. ' tbbb1.text = FLashLevel(nr) & vbnewline & FlashLevel(nr2)
  1463. End Sub
  1464.  
  1465. Sub GiCompensationAvg(nr, nr2, nr3, nr4, a, GIscaleOff) 'Two pairs of NRs averaged together
  1466. ' tbgi.text = "GI: " & SolModValue(nr) & " " & FlashLevel(nr) & " " & FadingLevel(nr) & vbnewline & _
  1467. ' "ModGI: " & SolModValue(nr2) & " " & FlashLevel(nr2) & " " & FadingLevel(nr2) & vbnewline & _
  1468. ' "Solmodvalue, Flashlevel, Fading step"
  1469. if FadingLevel(nr) > 1 or FadingLevel(nr2) > 1 or FadingLevel(nr3) > 1 or FadingLevel(nr4) > 1 Then
  1470. Dim x, Giscaler, Output : Output = (((FlashLevel(nr)*FlashLevel(nr2)) + (FlashLevel(nr3)*Flashlevel(nr4))) /2)
  1471. Giscaler = ((Giscaleoff-1) * (ABS(Output-1) ) ) + 1 'fade GIscale the opposite direction
  1472.  
  1473. for x = 0 to (a.Count - 1) 'Handle Compensate Flashers
  1474. On Error Resume Next
  1475. a(x).Opacity = LampsOpacity(x, 0) * Giscaler
  1476. a(x).Intensity = LampsOpacity(x, 0) * Giscaler
  1477. a(x).FadeSpeedUp = LampsOpacity(x, 1) * Giscaler
  1478. a(x).FadeSpeedDown = LampsOpacity(x, 2) * Giscaler
  1479. Next
  1480.  
  1481.  
  1482. REM tbgi1.text = "Output:" & output & vbnewline & _
  1483. REM "GIscaler" & giscaler & vbnewline & _
  1484. REM "..."
  1485. End If
  1486. REM tbgi.text = "GI0 " & flashlevel(200) & " " & flashlevel(300) & vbnewline & _
  1487. REM "GI1 " & flashlevel(201) & " " & flashlevel(301) & vbnewline & _
  1488. REM "GI2 " & flashlevel(202) & " " & flashlevel(302) & vbnewline & _
  1489. REM "GI3 " & flashlevel(203) & " " & flashlevel(303) & vbnewline & _
  1490. REM "GI4 " & flashlevel(204) & " " & flashlevel(304) & vbnewline & _
  1491. REM "..."
  1492. End Sub
  1493.  
  1494. Sub GiCompensationAvgM(nr, nr2, nr3, nr4, nr5, nr6, a, GIscaleOff) 'Three pairs of NRs averaged together
  1495. ' tbgi.text = "GI: " & SolModValue(nr) & " " & FlashLevel(nr) & " " & FadingLevel(nr) & vbnewline & _
  1496. ' "ModGI: " & SolModValue(nr2) & " " & FlashLevel(nr2) & " " & FadingLevel(nr2) & vbnewline & _
  1497. ' "Solmodvalue, Flashlevel, Fading step"
  1498. if FadingLevel(nr) > 1 or FadingLevel(nr2) > 1 Then
  1499. Dim x, Giscaler, Output
  1500. Output = (((FlashLevel(nr)*FlashLevel(nr2)) + (FlashLevel(nr3)*Flashlevel(nr4)) + (FlashLevel(nr5)*FlashLevel(nr6)))/3)
  1501.  
  1502. Giscaler = ((Giscaleoff-1) * (ABS(Output-1) ) ) + 1 'fade GIscale the opposite direction
  1503.  
  1504. for x = 0 to (a.Count - 1) 'Handle Compensate Flashers
  1505. On Error Resume Next
  1506. a(x).Opacity = LampsOpacity(x, 0) * Giscaler
  1507. a(x).Intensity = LampsOpacity(x, 0) * Giscaler
  1508. a(x).FadeSpeedUp = LampsOpacity(x, 1) * Giscaler
  1509. a(x).FadeSpeedDown = LampsOpacity(x, 2) * Giscaler
  1510. Next
  1511. ' tbbb.text = giscaler & " on:" & FadingLevel(nr) & vbnewline & "flash: " & output & " onmod:" & FadingLevel(nr2) & vbnewline & l37.intensity
  1512. ' tbbb1.text = FadingLevel(nr) & vbnewline & FadingLevel(nr2)
  1513. ' tbgi1.text = Output & " giscale:" & giscaler 'debug
  1514. End If
  1515. ' tbbb1.text = FLashLevel(nr) & vbnewline & FlashLevel(nr2)
  1516. End Sub
  1517.  
  1518. Sub FadeLUT(nr, nr2, LutName, LutCount) 'fade lookuptable NOTE- this is a bad idea for darkening your table as
  1519. If FadingLevel(nr) >2 or FadingLevel(nr2) > 2 Then '-it will strip the whites out of your image
  1520. Dim GoLut
  1521. GoLut = cInt(LutCount * (FlashLevel(nr)*FlashLevel(nr2) ) )
  1522. Table1.ColorGradeImage = LutName & GoLut
  1523. ' tbgi2.text = Table1.ColorGradeImage & vbnewline & golut 'debug
  1524. End If
  1525. End Sub
  1526.  
  1527. Sub FadeLUTavg(nr, nr2, nr3, nr4, LutName, LutCount) 'FadeLut for two GI strings (WPC)
  1528. If FadingLevel(nr) >2 or FadingLevel(nr2) > 2 or FadingLevel(nr3) >2 or FadingLevel(nr4) > 2 Then
  1529. Dim GoLut
  1530. GoLut = cInt(LutCount * (((FlashLevel(nr)*FlashLevel(nr2)) + (FlashLevel(nr3)*Flashlevel(nr4))) /2) )
  1531. Table1.ColorGradeImage = LutName & GoLut
  1532. REM tbgi2.text = Table1.ColorGradeImage & vbnewline & golut 'debug
  1533. End If
  1534. End Sub
  1535.  
  1536. Sub FadeLUTavgM(nr, nr2, nr3, nr4, nr5, nr6, LutName, LutCount) 'FadeLut for three GI strings (WPC)
  1537. If FadingLevel(nr) >2 or FadingLevel(nr2) > 2 or FadingLevel(nr3) >2 or FadingLevel(nr4) > 2 or _
  1538. FadingLevel(nr5) >2 or FadingLevel(nr6) > 2 Then
  1539. Dim GoLut
  1540. GoLut = cInt(LutCount * (((FlashLevel(nr)*FlashLevel(nr2)) + (FlashLevel(nr3)*Flashlevel(nr4)) + (FlashLevel(nr5)*FlashLevel(nr6)))/3) ) 'what a mess
  1541. Table1.ColorGradeImage = LutName & GoLut
  1542. ' tbgi2.text = Table1.ColorGradeImage & vbnewline & golut 'debug
  1543. End If
  1544. End Sub
  1545.  
  1546. '#end section
  1547.  
  1548. reDim CollapseMe(6) 'Fading subs (Click Me to Collapse)
  1549. Sub nModFlash(nr, object, scaletype, offscale) 'Fading with modulated callbacks
  1550. Dim DesiredFading
  1551. Select Case FadingLevel(nr)
  1552. case 3 : FadingLevel(nr) = 0 'workaround - wait a frame to let M sub finish fading
  1553. Case 4 'off
  1554. If Offscale = 0 then Offscale = 1
  1555. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * FrameTime ) * offscale
  1556. If FlashLevel(nr) < 0 then FlashLevel(nr) = 0 : FadingLevel(nr) = 3
  1557. Object.IntensityScale = ScaleLights(FlashLevel(nr),0 )
  1558. Case 5 ' Fade (Dynamic)
  1559. DesiredFading = ScaleByte(SolModValue(nr), scaletype)
  1560. if FlashLevel(nr) < DesiredFading Then '+
  1561. FlashLevel(nr) = FlashLevel(nr) + (FlashSpeedUp(nr) * FrameTime )
  1562. If FlashLevel(nr) >= DesiredFading Then FlashLevel(nr) = DesiredFading : FadingLevel(nr) = 1
  1563. elseif FlashLevel(nr) > DesiredFading Then '-
  1564. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * FrameTime )
  1565. If FlashLevel(nr) <= DesiredFading Then FlashLevel(nr) = DesiredFading : FadingLevel(nr) = 6
  1566. End If
  1567. Object.Intensityscale = ScaleLights(FlashLevel(nr),0 )
  1568. Case 6 : FadingLevel(nr) = 1
  1569. End Select
  1570. End Sub
  1571.  
  1572. Sub nModFlashM(nr, Object)
  1573. Select Case FadingLevel(nr)
  1574. Case 3, 4, 5, 6 : Object.Intensityscale = ScaleLights(FlashLevel(nr),0 )
  1575. End Select
  1576. End Sub
  1577.  
  1578. Sub Flashc(nr, object) 'FrameTime Compensated. Can work with Light Objects (make sure state is 1 though)
  1579. Select Case FadingLevel(nr)
  1580. Case 3 : FadingLevel(nr) = 0
  1581. Case 4 'off
  1582. FlashLevel(nr) = FlashLevel(nr) - (FlashSpeedDown(nr) * FrameTime)
  1583. If FlashLevel(nr) < FlashMin(nr) Then
  1584. FlashLevel(nr) = FlashMin(nr)
  1585. FadingLevel(nr) = 3 'completely off
  1586. End if
  1587. Object.IntensityScale = FlashLevel(nr)
  1588. Case 5 ' on
  1589. FlashLevel(nr) = FlashLevel(nr) + (FlashSpeedUp(nr) * FrameTime)
  1590. If FlashLevel(nr) > FlashMax(nr) Then
  1591. FlashLevel(nr) = FlashMax(nr)
  1592. FadingLevel(nr) = 6 'completely on
  1593. End if
  1594. Object.IntensityScale = FlashLevel(nr)
  1595. Case 6 : FadingLevel(nr) = 1
  1596. End Select
  1597. End Sub
  1598.  
  1599. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  1600. select case FadingLevel(nr)
  1601. case 3, 4, 5, 6 : Object.IntensityScale = FlashLevel(nr)
  1602. end select
  1603. End Sub
  1604.  
  1605. Sub NFadeL(nr, object) 'Simple VPX light fading using State
  1606. Select Case FadingLevel(nr)
  1607. Case 3:object.state = 0:FadingLevel(nr) = 0
  1608. Case 4:object.state = 0:FadingLevel(nr) = 3
  1609. Case 5:object.state = 1:FadingLevel(nr) = 6
  1610. Case 6:object.state = 1:FadingLevel(nr) = 1
  1611. End Select
  1612. End Sub
  1613.  
  1614. Sub NFadeLm(nr, object) ' used for multiple lights
  1615. Select Case FadingLevel(nr)
  1616. Case 3:object.state = 0
  1617. Case 4:object.state = 0
  1618. Case 5:object.state = 1
  1619. Case 6:object.state = 1
  1620. End Select
  1621. End Sub
  1622.  
  1623. '#End Section
  1624.  
  1625. reDim CollapseMe(7) 'Fading Functions (Click Me to Collapse)
  1626. Function ScaleLights(value, scaletype) 'returns an intensityscale-friendly 0->100% value out of 255
  1627. Dim i
  1628. Select Case scaletype 'select case because bad at maths 'TODO: Simplify these functions. B/c this is absurdly bad.
  1629. case 0 : i = value * (1 / 255) '0 to 1
  1630. case 6 : i = (value + 17)/272 '0.0625 to 1
  1631. case 9 : i = (value + 25)/280 '0.089 to 1
  1632. case 15 : i = (value / 300) + 0.15
  1633. case 20 : i = (4 * value)/1275 + (1/5)
  1634. case 25 : i = (value + 85) / 340
  1635. case 37 : i = (value+153) / 408 '0.375 to 1
  1636. case 40 : i = (value + 170) / 425
  1637. case 50 : i = (value + 255) / 510 '0.5 to 1
  1638. case 75 : i = (value + 765) / 1020 '0.75 to 1
  1639. case Else : i = 10
  1640. End Select
  1641. ScaleLights = i
  1642. End Function
  1643.  
  1644. Function ScaleByte(value, scaletype) 'returns a number between 1 and 255
  1645. Dim i
  1646. Select Case scaletype
  1647. case 0 : i = value * 1 '0 to 1
  1648. case 9 : i = (5*(200*value + 1887))/1037 'ugh
  1649. case 15 : i = (16*value)/17 + 15
  1650. Case 63 : i = (3*(value + 85))/4
  1651. case else : i = value * 1 '0 to 1
  1652. End Select
  1653. ScaleByte = i
  1654. End Function
  1655.  
  1656. Sub theend() : End Sub
  1657.  
  1658.  
  1659.  
  1660. REM Troubleshooting :
  1661. REM Flashers/gi are intermittent or aren't showing up
  1662. REM Ensure flashers start visible, light objects start with state = 1
  1663.  
  1664. REM No lamps or no GI
  1665. REM Make sure these constants are set up this way
  1666. REM Const UseSolenoids = 1
  1667. REM Const UseLamps = 0
  1668. REM Const UseGI = 1
  1669.  
  1670. REM SolModCallback error
  1671. REM Ensure you have the latest scripts. Clear out any loose scripts in your tables that might be causing conflicts.
  1672.  
  1673. REM Table1 Error
  1674. REM Rename the table to Table1 or find/Replace table1 with whatever the table's name is
  1675.  
  1676. REM SolModCallbacks aren't sending anything
  1677. REM Two important things to get SolModCallbacks to initialize properly:
  1678. REM Put this at the top of the script, before LoadVPM
  1679. REM Const UseVPMModSol = 1
  1680. REM Put this in the table1_Init() section
  1681. REM vpmInit me
  1682.  
  1683. sub trigger1_hit()
  1684. if activeball.vely < -18 then
  1685. set shooterball = activeball
  1686. trigger1.timerenabled = true
  1687. end if
  1688. End Sub
  1689.  
  1690. Dim counter, shooterball
  1691.  
  1692. Sub Trigger1_timer()
  1693. counter = counter + 1
  1694. if counter > 10 and shooterball.velx < -15 and shooterball.x > 400 and shooterball.x < 740 then
  1695. shooterball.y = 69
  1696. end if
  1697.  
  1698. if counter = 20 Then
  1699. counter = 0
  1700. trigger1.timerenabled = False
  1701. end If
  1702. End Sub
Add Comment
Please, Sign In to add comment