Arngrim

Lortium DOF

Aug 5th, 2021
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.78 KB | None | 0 0
  1. '############################################################################################
  2. '############################################################################################
  3. '####### ########
  4. '####### Lortium ########
  5. '####### (Juegos Populares 1987) ########
  6. '####### ########
  7. '############################################################################################
  8. '############################################################################################
  9. '
  10. ' Version 1.0
  11. '
  12. ' - Playfield provided by Akiles50000
  13.  
  14.  
  15. Option Explicit
  16.  
  17. On Error Resume Next
  18. ExecuteGlobal GetTextFile("controller.vbs")
  19. If Err Then MsgBox "You need the Controller.vbs file in order to run this table (installed with the VPX package in the scripts folder)"
  20. On Error Goto 0
  21. Randomize
  22.  
  23.  
  24. '-----------------------------------
  25. '------ Global Configurations ------
  26. '-----------------------------------
  27.  
  28. Const FreePlay = True
  29. Const DimGI=5 'set GI lights intensity (base value is 10)
  30. Const VolumeMultiplier = 3 'adjusts table sound volume
  31.  
  32. Const cGameName = "lortium"
  33. Const UseSolenoids=1,UseLamps=1,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="",SFlipperOff="",SCoin="coin3"
  34. LoadVPM "01560000","juegos.vbs",3.2
  35.  
  36.  
  37. '-------------------------------
  38. '------ Keybord Handler ------
  39. '-------------------------------
  40. Sub Lortium_KeyDown(ByVal keycode)
  41. If keycode = PlungerKey Then
  42. Plunger.PullBack
  43. PlaySound "plungerpull",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
  44. End If
  45.  
  46. if Flipperactive then
  47. If keycode = LeftFlipperKey Then
  48. LeftFlipper.RotateToEnd
  49. PlaySound SoundFXDOF("fx_flipperup",105,DOFOn,DOFFlippers), 0, .67, AudioPan(LeftFlipper), 0.05,0,0,1,AudioFade(LeftFlipper)
  50. End If
  51.  
  52. If keycode = RightFlipperKey Then
  53. RightFlipper.RotateToEnd
  54. URightFlipper.RotateToEnd
  55. PlaySound SoundFXDOF("fx_flipperup",106,DOFOn,DOFFlippers), 0, .67, AudioPan(RightFlipper), 0.05,0,0,1,AudioFade(RightFlipper)
  56. End If
  57. end If
  58.  
  59. if FreePlay and keycode = Startgamekey then
  60. vpmtimer.pulsesw 27
  61. end if
  62.  
  63. If vpmKeyDown(KeyCode) Then Exit Sub
  64. End Sub
  65.  
  66. Sub Lortium_KeyUp(ByVal keycode)
  67. If keycode = PlungerKey Then
  68. Plunger.Fire
  69. PlaySound "plunger",0,1,AudioPan(Plunger),0.25,0,0,1,AudioFade(Plunger)
  70. End If
  71.  
  72. if Flipperactive then
  73. If keycode = LeftFlipperKey Then
  74. LeftFlipper.RotateToStart
  75. PlaySound SoundFXDOF("fx_flipperdown",105,DOFOff,DOFFlippers), 0, 1, AudioPan(LeftFlipper), 0.05,0,0,1,AudioFade(LeftFlipper)
  76. End If
  77.  
  78. If keycode = RightFlipperKey Then
  79. RightFlipper.RotateToStart
  80. URightFlipper.RotateToStart
  81. PlaySound SoundFXDOF("fx_flipperdown",106,DOFOff,DOFFlippers), 0, 1, AudioPan(RightFlipper), 0.05,0,0,1,AudioFade(RightFlipper)
  82. End If
  83. end if
  84.  
  85. If vpmKeyUp(KeyCode) Then Exit Sub
  86. End Sub
  87.  
  88.  
  89. '-----------------------------------
  90. '------ Solenoid Assignment ------
  91. '-----------------------------------
  92. 'SolCallback(1)="Sol1" 'Coin
  93. 'SolCallback(2)="Sol2" 'Coin
  94. 'SolCallback(3)="Sol3" 'Coin
  95. 'SolCallback(4)="Sol4" 'always on
  96. 'SolCallback(5)="Sol5" 'always on
  97. 'SolCallback(6)="Sol6" 'always on
  98. SolCallback(7)="Sol7" 'SolGameOn
  99. SolCallback(8)="Sol8" '"O" insert light of LORTIUM
  100. SolCallback(10)="Sol10" 'Right Drop Target Bank
  101. SolCallback(16)="bsTrough.SolOut"
  102. SolCallback(13)="Sol13" 'Left Drop Target Bank
  103. SolCallback(14)="Sol14" 'Gates
  104. SolCallback(15)="vpmSolSound ""knocker"","
  105.  
  106. 'SolCallback(sLLFlipper)="vpmSolFlipper LeftFlipper,Nothing,"
  107. 'SolCallback(sLRFlipper)="vpmSolFlipper RightFlipper,URightFlipper,"
  108.  
  109.  
  110. ' Sol7 is not working all the times, so GameOn functionality has been moved to Flipper timer
  111. Sub Sol7(enabled)
  112. ' VpmNudge.SolGameOn enabled
  113. ' Flipperactive = enabled
  114. '
  115. ' if not enabled Then
  116. ' LeftFlipper.rotatetostart
  117. ' URightFlipper.rotatetostart
  118. ' RightFlipper.rotatetostart
  119. ' end If
  120. '
  121. ' for each obj in GI
  122. ' obj.state = abs(Enabled)
  123. ' next
  124. ' for each obj in GIBulbs
  125. ' obj.state = abs(Enabled)
  126. ' next
  127. '
  128. ' if enabled Then
  129. ' P_Bumpercap1.image = "JP_Bumper_lit_red"
  130. ' P_Bumpercap2.image = "JP_Bumper_lit_red"
  131. ' Else
  132. ' P_Bumpercap1.image = "JP_Bumper_red"
  133. ' P_Bumpercap2.image = "JP_Bumper_red"
  134. ' end if
  135. end sub
  136.  
  137. Sub Sol8(enabled)
  138. OLamp.state = abs(Enabled)
  139. End Sub
  140.  
  141. Sub Sol13(enabled)
  142. if enabled then
  143. LeftDropTargetBank.DropSol_On
  144. end if
  145. End Sub
  146.  
  147. Sub Sol10(enabled)
  148. if enabled then
  149. RightDropTargetBank.DropSol_On
  150. end if
  151. End Sub
  152.  
  153. Sub Sol14(enabled)
  154. if enabled Then
  155. RightGatex.collidable = False
  156. RightGatex.visible = False
  157. RightGate.visible = True
  158. rightGate.Open = True
  159.  
  160. LeftGatex.collidable = False
  161. LeftGatex.visible = False
  162. LeftGate.visible = True
  163. LeftGate.Open = True
  164.  
  165. P_RGate.rotx = 10
  166. P_LGate.rotx = 10
  167. Else
  168. RightGatex.collidable = True
  169. RightGatex.visible = true
  170. RightGate.visible = False
  171. rightGate.Open = False
  172.  
  173. LeftGatex.collidable = True
  174. LeftGatex.visible = True
  175. LeftGate.visible = false
  176. LeftGate.Open = false
  177.  
  178. P_RGate.rotx = 20
  179. P_LGate.rotx = 20
  180. end If
  181. End Sub
  182.  
  183. '--------------------------
  184. '------ Table Init ------
  185. '--------------------------
  186. Dim DesktopMode: DesktopMode = Lortium.ShowDT
  187. If DesktopMode = True Then 'Show Desktop components
  188. Ramp17.visible=1
  189. Ramp16.visible=1
  190. Ramp15.visible=1
  191. SideWood.visible=1
  192. Else
  193. Ramp17.visible=0
  194. Ramp16.visible=0
  195. Ramp15.visible=0
  196. SideWood.visible=0
  197. End if
  198.  
  199. for each obj in GI
  200. obj.intensity = DimGI
  201. next
  202.  
  203. Dim bsTrough,obj,LeftDropTargetBank,RightDropTargetBank,cUpperCaptive,cLowerCaptive,Flipperactive
  204. Sub Lortium_init
  205. vpminit me
  206.  
  207. Controller.GameName=cGameName
  208. Controller.SplashInfoLine="Lortium" & vbNewLine & "created by mfuegemann"
  209. Controller.HandleKeyboard=False
  210. Controller.ShowTitle=0
  211. Controller.ShowFrame=0
  212. Controller.ShowDMDOnly=1
  213. 'Controller.Hidden = 1 'enable to hide DMD if You use a B2S backglass
  214.  
  215. ' DMD position for 3 Monitor Setup
  216. ' Controller.Games(cGameName).Settings.Value("dmd_pos_x")=3850 'set this to 0 if You cannot find the DMD
  217. ' Controller.Games(cGameName).Settings.Value("dmd_pos_y")=300 'set this to 0 if You cannot find the DMD
  218. ' Controller.Games(cGameName).Settings.Value("dmd_width")=505
  219. ' Controller.Games(cGameName).Settings.Value("dmd_height")=155
  220. ' Controller.Games(cGameName).Settings.Value("rol")=0
  221. ' Controller.Games(cGameName).Settings.Value("ddraw") = 0 'set to 0 if You have problems with DMD showing or table stutter
  222.  
  223. Controller.HandleMechanics=0
  224. Controller.Run
  225. If Err Then MsgBox Err.Description
  226. On Error Goto 0
  227.  
  228. PinMAMETimer.Interval=PinMAMEInterval
  229. PinMAMETimer.Enabled = true
  230.  
  231. vpmNudge.TiltSwitch=31
  232. vpmNudge.Sensitivity=5
  233. vpmNudge.TiltObj = Array(RightSlingshot,URightFlipper,RightFlipper,LeftFlipper)
  234.  
  235. vpmMapLights AllLights
  236.  
  237. Set bsTrough=New cvpmBallStack
  238. bsTrough.InitSw 0,25,0,0,0,0,0,0 '0.1 = Switch 0
  239. bsTrough.InitKick BallRelease,90,5
  240. bsTrough.InitExitSnd SoundFX("BallRelease",DOFContactors),SoundFX("Solenoid",DOFContactors)
  241. bsTrough.Balls=1
  242.  
  243. set LeftDropTargetBank = new cvpmDropTarget
  244. LeftDropTargetBank.InitDrop Array(LeftTarget1,LeftTarget2,LeftTarget3), Array(8,7,6)
  245. LeftDropTargetBank.InitSnd SoundFX("Targetdrop1",DOFContactors),SoundFX("TargetBankreset1",DOFContactors)
  246. LeftDropTargetBank.CreateEvents "LeftDropTargetBank"
  247.  
  248. set RightDropTargetBank = new cvpmDropTarget
  249. RightDropTargetBank.InitDrop Array(RightTarget1,RightTarget2,RightTarget3), Array(5,4,3)
  250. RightDropTargetBank.InitSnd SoundFX("Targetdrop1",DOFContactors),SoundFX("TargetBankreset1",DOFContactors)
  251. RightDropTargetBank.CreateEvents "RightDropTargetBank"
  252.  
  253. Set cUpperCaptive=New cvpmCaptiveBall
  254. cUpperCaptive.InitCaptive UpperCaptiveTrigger,UpperCaptiveWall,UpperCaptiveKicker,-28
  255. cUpperCaptive.Start
  256. cUpperCaptive.ForceTrans = 0.75
  257. cUpperCaptive.MinForce = 2 '3.5
  258. cUpperCaptive.CreateEvents "cUpperCaptive"
  259.  
  260. Set cLowerCaptive=New cvpmCaptiveBall
  261. cLowerCaptive.InitCaptive LowerCaptiveTrigger,LowerCaptiveWall,LowerCaptiveKicker,12
  262. cLowerCaptive.Start
  263. cLowerCaptive.ForceTrans = 0.75
  264. cLowerCaptive.MinForce = 2 '3.5
  265. cLowerCaptive.CreateEvents "cLowerCaptive"
  266. End Sub
  267.  
  268. Sub Lortium_Exit()
  269. Controller.Pause = False
  270. Controller.Stop
  271. End Sub
  272.  
  273. '------------------------------
  274. '------ Trough Handler ------
  275. '------------------------------
  276. Sub Drain_Hit()
  277. PlaySound "drain",0,1,AudioPan(Drain),0.25,0,0,1,AudioFade(Drain)
  278. bsTrough.AddBall Me
  279. End Sub
  280.  
  281.  
  282.  
  283. '------------------------------
  284. '------ Switch Handler ------
  285. '------------------------------
  286.  
  287. Sub SW12_Hit:Controller.Switch(12) = 1:End Sub
  288. Sub SW12_unhit:Controller.Switch(12) = 0:End Sub
  289. Sub SW11_Hit:Controller.Switch(11) = 1:End Sub
  290. Sub SW11_Unhit:Controller.Switch(11) = 0:End Sub
  291. Sub SW10_Hit:Controller.Switch(10) = 1:End Sub
  292. Sub SW10_Unhit:Controller.Switch(10) = 0:End Sub
  293. Sub SW9_Hit:Controller.Switch(9) = 1:End Sub
  294. Sub SW9_Unhit:Controller.Switch(9) = 0:End Sub
  295.  
  296. Sub Bumper1_Hit:vpmtimer.pulsesw(16):PlaySound SoundFX("Jet2",DOFContactors),0,1,0,0.05:End Sub
  297. Sub Bumper2_Hit:vpmtimer.pulsesw(15):PlaySound SoundFX("Jet1",DOFContactors),0,1,0.2,0.05:End Sub
  298.  
  299. Sub Spinner1_Spin:vpmtimer.pulsesw(17):End Sub
  300. Sub Spinner2_Spin:vpmtimer.pulsesw(17):End Sub
  301.  
  302. Sub TopRTarget1_Hit:vpmtimer.pulsesw(20):End Sub
  303. Sub TopRTarget2_Hit:vpmtimer.pulsesw(21):End Sub
  304.  
  305. Sub RightRTarget1_Hit:vpmtimer.pulsesw(19):End Sub
  306. Sub RightRTarget2_Hit:vpmtimer.pulsesw(19):End Sub
  307.  
  308. Sub UpperCaptiveTarget_Hit:vpmtimer.pulsesw(13):End Sub
  309. Sub LowerCaptiveTarget_Hit:vpmtimer.pulsesw(22):End Sub
  310.  
  311. Sub RampTrigger_Hit:vpmtimer.pulsesw(24):End Sub
  312.  
  313. Sub Rubber1_Hit:vpmtimer.pulsesw(18):End Sub
  314. Sub Rubber2_Hit:vpmtimer.pulsesw(18):End Sub
  315. Sub Rubber3_Hit:vpmtimer.pulsesw(18):End Sub
  316. Sub Rubber4_Hit:vpmtimer.pulsesw(18):End Sub
  317. Sub Rubber5_Hit:vpmtimer.pulsesw(18):End Sub
  318. Sub Rubber6_Hit:vpmtimer.pulsesw(18):End Sub
  319. Sub Rubber7_Hit:vpmtimer.pulsesw(18):End Sub
  320.  
  321. Sub LeftOutlane_Hit:Controller.Switch(23) = 1:DOF 101, DOFOn:End Sub
  322. Sub LeftOutlane_Unhit:Controller.Switch(23) = 0:DOF 101, DOFOff:End Sub
  323. Sub RightOutlane_Hit:Controller.Switch(23) = 1:DOF 102, DOFOn:End Sub
  324. Sub RightOutlane_Unhit:Controller.Switch(23) = 0:DOF 102, DOFOff:End Sub
  325.  
  326. Sub RightInlane_Hit:vpmtimer.pulsesw(2):DOF 104, DOFPulse:End Sub
  327. Sub LeftInlane_Hit:vpmtimer.pulsesw(2):DOF 103, DOFPulse:End Sub
  328. Sub LeftInlane1_Hit:vpmtimer.pulsesw(1):End Sub
  329.  
  330. Sub LeftCorridor_Hit:vpmtimer.pulsesw(33):End Sub
  331.  
  332.  
  333. '--------------------------------
  334. '------ Helper Functions ------
  335. '--------------------------------
  336. 'Launch
  337. Sub LaunchTrigger_Hit
  338. if activeball.vely < 6 Then
  339. Playsound "Launch",0,0.6,0.8
  340. end if
  341. End Sub
  342.  
  343. 'Diverter
  344. if Rnd < 0.5 Then
  345. DiverterRight.isdropped = True
  346. DiverterLeft.isdropped = False
  347. P_Diverter.RotZ = 27 '27=LeftOpen, -36=RightOpen
  348. Else
  349. DiverterRight.isdropped = False
  350. DiverterLeft.isdropped = True
  351. P_Diverter.RotZ = -36 '27=LeftOpen, -36=RightOpen
  352. end If
  353.  
  354.  
  355. Dim DivDir
  356. Sub DiverterTrigger_Hit
  357. Activeball.Vely = Activeball.Vely * 0.25
  358. if DiverterLeft.isdropped then
  359. DiverterRight.isdropped = True
  360. DiverterLeft.isdropped = False
  361. DivDir = 1
  362. else
  363. DiverterRight.isdropped = False
  364. DiverterLeft.isdropped = True
  365. DivDir = -1
  366. end if
  367. DiverterTrigger.timerenabled = True
  368. End Sub
  369.  
  370. Sub DiverterTrigger_Timer
  371. P_Diverter.RotZ = P_Diverter.RotZ + DivDir
  372. if P_Diverter.RotZ >= 27 then
  373. ' DOF 117, 2
  374. DiverterTrigger.timerenabled = False
  375. P_Diverter.RotZ = 27
  376.  
  377. end if
  378. if P_Diverter.RotZ <= -36 then
  379. ' DOF 117, 2
  380. DiverterTrigger.timerenabled = False
  381. P_Diverter.RotZ = -36
  382. end if
  383. End Sub
  384.  
  385.  
  386. 'Metal Gates
  387. Dim RightGateDir
  388. Sub RightGateTrigger_Hit
  389. if not RightGateTrigger.Timerenabled Then
  390. RightGateDir = -1.2
  391. RightGateTrigger.Timerenabled = True
  392. End If
  393. End Sub
  394.  
  395. Sub RightGateTrigger_Timer
  396. P_RightGate.objrotz = P_RightGate.objrotz + RightGateDir
  397. if P_RightGate.objrotz <= -14 Then
  398. RightGateDir = 1
  399. End If
  400. if P_RightGate.objrotz >= 0 Then
  401. P_RightGate.objrotz = 0
  402. RightGateTrigger.Timerenabled = False
  403. End If
  404. End Sub
  405.  
  406. Dim LeftGateDir
  407. Sub LeftGateTrigger_Hit
  408. if not LeftGateTrigger.Timerenabled Then
  409. LeftGateDir = 1.2
  410. LeftGateTrigger.Timerenabled = True
  411. End If
  412. End Sub
  413.  
  414. Sub LeftGateTrigger_Timer
  415. P_LeftGate.objrotz = P_LeftGate.objrotz + LeftGateDir
  416. if P_LeftGate.objrotz >= 22 Then
  417. LeftGateDir = -1
  418. End If
  419. if P_LeftGate.objrotz <= 0 Then
  420. P_LeftGate.objrotz = 0
  421. LeftGateTrigger.Timerenabled = False
  422. End If
  423. End Sub
  424.  
  425.  
  426. '**********Sling Shot Animations
  427. ' Rstep and Lstep are the variables that increment the animation
  428. '****************
  429. Dim RStep, Lstep
  430.  
  431. Sub RightSlingShot_Slingshot
  432. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05
  433. vpmtimer.pulsesw(14)
  434. RSling.Visible = 0
  435. RSling1.Visible = 1
  436. sling1.TransZ = -20
  437. RStep = 0
  438. RightSlingShot.TimerEnabled = 1
  439. End Sub
  440.  
  441. Sub RightSlingShot_Timer
  442. Select Case RStep
  443. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  444. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  445. End Select
  446. RStep = RStep + 1
  447. End Sub
  448.  
  449.  
  450.  
  451. '*********************************************************************
  452. ' Positional Sound Playback Functions
  453. '*********************************************************************
  454.  
  455. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  456. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  457. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  458. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  459. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  460. End Sub
  461.  
  462. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  463. Sub PlaySoundAt(soundname, tableobj)
  464. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  465. End Sub
  466.  
  467. Sub PlaySoundAtBall(soundname)
  468. PlaySoundAt soundname, ActiveBall
  469. End Sub
  470.  
  471.  
  472. '*********************************************************************
  473. ' Supporting Ball & Sound Functions
  474. '*********************************************************************
  475.  
  476. 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
  477. Dim tmp
  478. tmp = tableobj.y * 2 / Lortium.height-1
  479. If tmp > 0 Then
  480. AudioFade = Csng(tmp ^10)
  481. Else
  482. AudioFade = Csng(-((- tmp) ^10) )
  483. End If
  484. End Function
  485.  
  486. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  487. Dim tmp
  488. tmp = tableobj.x * 2 / Lortium.width-1
  489. If tmp > 0 Then
  490. AudioPan = Csng(tmp ^10)
  491. Else
  492. AudioPan = Csng(-((- tmp) ^10) )
  493. End If
  494. End Function
  495.  
  496. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  497. Vol = Csng(BallVel(ball) ^2 / 300) * VolumeMultiplier
  498. End Function
  499.  
  500. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  501. Pitch = BallVel(ball) * 20
  502. End Function
  503.  
  504. Function BallVel(ball) 'Calculates the ball speed
  505. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  506. End Function
  507.  
  508.  
  509.  
  510. '*****************************************
  511. ' JP's VP10 Rolling Sounds
  512. '*****************************************
  513.  
  514. Const tnob = 5 ' total number of balls
  515. ReDim rolling(tnob)
  516. InitRolling
  517.  
  518. Sub InitRolling
  519. Dim i
  520. For i = 0 to tnob
  521. rolling(i) = False
  522. Next
  523. End Sub
  524.  
  525. Sub RollingTimer_Timer()
  526. Dim BOT, b
  527. BOT = GetBalls
  528.  
  529. ' stop the sound of deleted balls
  530. For b = UBound(BOT) + 1 to tnob
  531. rolling(b) = False
  532. StopSound("fx_ballrolling" & b)
  533. Next
  534.  
  535. ' exit the sub if no balls on the table
  536. If UBound(BOT) = -1 Then Exit Sub
  537.  
  538. ' play the rolling sound for each ball
  539. For b = 0 to UBound(BOT)
  540. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  541. rolling(b) = True
  542. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  543. Else
  544. If rolling(b) = True Then
  545. StopSound("fx_ballrolling" & b)
  546. rolling(b) = False
  547. End If
  548. End If
  549. Next
  550. End Sub
  551.  
  552. '**********************
  553. ' Ball Collision Sound
  554. '**********************
  555.  
  556. Sub OnBallBallCollision(ball1, ball2, velocity)
  557. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  558. End Sub
  559.  
  560.  
  561. '*****************************************
  562. ' ninuzzu's FLIPPER SHADOWS
  563. '*****************************************
  564. Dim GameOnVar
  565. sub FlipperTimer_Timer()
  566. FlipperLSh.RotZ = LeftFlipper.currentangle
  567. FlipperRSh.RotZ = RightFlipper.currentangle
  568. FlipperURSh.RotZ = URightFlipper.currentangle
  569.  
  570.  
  571. 'use lamp 32 (GameOber) and 40 (Tilt) instead of Sol7
  572. GameOnVar = (not controller.Lamp(32)) and (not controller.Lamp(40))
  573.  
  574. VpmNudge.SolGameOn GameOnVar
  575. Bumper1Wall.isdropped = GameOnVar
  576. Bumper2Wall.isdropped = GameOnVar
  577. Flipperactive = GameOnVar
  578.  
  579. if not GameOnVar Then
  580. LeftFlipper.rotatetostart
  581. URightFlipper.rotatetostart
  582. RightFlipper.rotatetostart
  583.  
  584. RightGatex.collidable = True
  585. RightGatex.visible = true
  586. RightGate.visible = False
  587. rightGate.Open = False
  588.  
  589. LeftGatex.collidable = True
  590. LeftGatex.visible = True
  591. LeftGate.visible = false
  592. LeftGate.Open = false
  593.  
  594. P_RGate.rotx = 20
  595. P_LGate.rotx = 20
  596. end If
  597.  
  598. for each obj in GI
  599. obj.state = abs(GameOnVar)
  600. next
  601. for each obj in GIBulbs
  602. obj.state = abs(GameOnVar)
  603. next
  604.  
  605. if GameOnVar Then
  606. P_Bumpercap1.image = "JP_Bumper_lit_red"
  607. P_Bumpercap2.image = "JP_Bumper_lit_red"
  608. Else
  609. P_Bumpercap1.image = "JP_Bumper_red"
  610. P_Bumpercap2.image = "JP_Bumper_red"
  611. end if
  612.  
  613. End Sub
  614.  
  615. '*****************************************
  616. ' ninuzzu's BALL SHADOW
  617. '*****************************************
  618. Dim BallShadow
  619. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  620.  
  621. Sub BallShadowUpdate_timer()
  622. Dim BOT, b
  623. BOT = GetBalls
  624. ' hide shadow of deleted balls
  625. If UBound(BOT)<(tnob-1) Then
  626. For b = (UBound(BOT) + 1) to (tnob-1)
  627. BallShadow(b).visible = 0
  628. Next
  629. End If
  630. ' exit the Sub if no balls on the table
  631. If UBound(BOT) = -1 Then Exit Sub
  632. ' render the shadow for each ball
  633. For b = 0 to UBound(BOT)
  634. If BOT(b).X < Lortium.Width/2 Then
  635. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Lortium.Width/2))/7)) + 6
  636. Else
  637. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Lortium.Width/2))/7)) - 6
  638. End If
  639. ballShadow(b).Y = BOT(b).Y + 12
  640. If BOT(b).Z > 20 Then
  641. BallShadow(b).visible = 1
  642. Else
  643. BallShadow(b).visible = 0
  644. End If
  645. Next
  646. End Sub
  647.  
  648.  
  649.  
  650. '************************************
  651. ' What you need to add to your table
  652. '************************************
  653.  
  654. ' a timer called RollingTimer. With a fast interval, like 10
  655. ' one collision sound, in this script is called fx_collide
  656. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  657. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  658.  
  659.  
  660. '******************************************
  661. ' Explanation of the rolling sound routine
  662. '******************************************
  663.  
  664. ' sounds are played based on the ball speed and position
  665.  
  666. ' the routine checks first for deleted balls and stops the rolling sound.
  667.  
  668. ' The For loop goes through all the balls on the table and checks for the ball speed and
  669. ' if the ball is on the table (height lower than 30) then then it plays the sound
  670. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  671.  
  672. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  673. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  674. ' according to the position of the ball on the table.
  675.  
  676.  
  677. '**************************************
  678. ' Explanation of the collision routine
  679. '**************************************
  680.  
  681. ' The collision is built in VP.
  682. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  683. ' 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
  684. ' depending of the speed of the collision.
  685.  
  686.  
  687. Sub Pins_Hit (idx)
  688. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  689. End Sub
  690.  
  691. Sub Targets_Hit (idx)
  692. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  693. End Sub
  694.  
  695. Sub Metals_Thin_Hit (idx)
  696. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  697. End Sub
  698.  
  699. Sub Metals_Medium_Hit (idx)
  700. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  701. End Sub
  702.  
  703. Sub Metals2_Hit (idx)
  704. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  705. End Sub
  706.  
  707. Sub Gates_Hit (idx)
  708. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  709. End Sub
  710.  
  711. Sub Spinner_Spin
  712. PlaySound "fx_spinner", 0, 0.5, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  713. End Sub
  714.  
  715. Sub Rubbers_Hit(idx)
  716. dim finalspeed
  717. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  718. If finalspeed > 20 then
  719. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  720. End if
  721. If finalspeed >= 2 AND finalspeed <= 20 then
  722. RandomSoundRubber()
  723. End If
  724. End Sub
  725.  
  726. Sub Posts_Hit(idx)
  727. dim finalspeed
  728. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  729. If finalspeed > 16 then
  730. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  731. End if
  732. If finalspeed >= 3 AND finalspeed <= 16 then
  733. RandomSoundRubber()
  734. End If
  735. End Sub
  736.  
  737. Sub RandomSoundRubber()
  738. Select Case Int(Rnd*3)+1
  739. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  740. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  741. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  742. End Select
  743. End Sub
  744.  
  745. Sub LeftFlipper_Collide(parm)
  746. RandomSoundFlipper()
  747. End Sub
  748.  
  749. Sub RightFlipper_Collide(parm)
  750. RandomSoundFlipper()
  751. End Sub
  752.  
  753. Sub URightFlipper_Collide(parm)
  754. RandomSoundFlipper()
  755. End Sub
  756.  
  757. Sub RandomSoundFlipper()
  758. Select Case Int(Rnd*3)+1
  759. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  760. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  761. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  762. End Select
  763. End Sub
  764.  
  765.  
  766. '-------------------------------
  767. '------ DIP Switch Menu ------
  768. '-------------------------------
  769.  
  770. Sub editDips
  771. Dim vpmDips:Set vpmDips=New cvpmDips
  772. With vpmDips
  773. .AddForm 200,280,"Lortium DIP switches"
  774. .AddFrame 0, 0,270,"Balls per game",&H00000400,Array("3 balls",0,"5 balls",&H00000400)
  775. .AddChk 5,50,270,Array("Match feature",32768)
  776. .AddFrame 0,75,270,"Replay threshold (Extra ball/credit/credit)",&H00000300,Array("4.0M/4.7M/5.5M points",&H00000300,"3.0M/3.7M/4.5M points",&H00000100,"2.5M/3.2M/4.0M points",&H00000200,"2.0M/2.7M/3.2M points",0)
  777. .AddChk 5,155,270,Array("Enable replay extra ball",&H00000008)
  778.  
  779. .AddLabel 0,180,280,20,"After hitting OK, press F3 to reset game with new settings."
  780. .ViewDips
  781. End With
  782. End Sub
  783. Set vpmShowDips=GetRef("editDips")
Advertisement
Add Comment
Please, Sign In to add comment