Arngrim

Untitled

Feb 11th, 2019
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.29 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. On Error Resume Next
  5. ExecuteGlobal GetTextFile("controller.vbs")
  6. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  7. On Error Goto 0
  8.  
  9. Const cGameName="totem",UseSolenoids=2,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SCoin="coin"
  10.  
  11. LoadVPM "01001100", "gts1.vbs", 3.02
  12.  
  13. Dim DesktopMode: DesktopMode = Table1.ShowDT
  14. If DesktopMode = True Then 'Show Desktop components
  15. Ramp16.visible=1
  16. Ramp15.visible=1
  17. Primitive13.visible=1
  18. Else
  19. Ramp16.visible=0
  20. Ramp15.visible=0
  21. Primitive13.visible=0
  22. End if
  23.  
  24. '*************************************************************
  25.  
  26. 'Solenoid Call backs
  27. '**********************************************************************************************************
  28. SolCallback(1)= "bsTrough.SolOut"
  29. SolCallback(2)= "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  30. SolCallback(6)= "bsSaucer.SolOut"
  31. 'SolCallBack(7)= "SolVReset"
  32. SolCallback(8)= "dtDropL.SolDropUp"
  33.  
  34. SolCallback(sLRFlipper) = "SolRFlipper"
  35. SolCallback(sLLFlipper) = "SolLFlipper"
  36.  
  37. Sub SolLFlipper(Enabled)
  38. If Enabled Then
  39. PlaySound SoundFX("fx_Flipperup",DOFContactors):LeftFlipper.RotateToEnd
  40. Else
  41. PlaySound SoundFX("fx_Flipperdown",DOFContactors):LeftFlipper.RotateToStart
  42. End If
  43. End Sub
  44.  
  45. Sub SolRFlipper(Enabled)
  46. If Enabled Then
  47. PlaySound SoundFX("fx_Flipperup",DOFContactors):RightFlipper.RotateToEnd
  48. Else
  49. PlaySound SoundFX("fx_Flipperdown",DOFContactors):RightFlipper.RotateToStart
  50. End If
  51. End Sub
  52. '**********************************************************************************************************
  53.  
  54. 'Solenoid Controlled toys
  55. '**********************************************************************************************************
  56.  
  57. '*****GI Lights On
  58. dim xx
  59. For each xx in GI:xx.State = 1: Next
  60.  
  61. '**********************************************************************************************************
  62.  
  63. 'Initiate Table
  64. '**********************************************************************************************************
  65. Dim bsTrough, bsSaucer, dtDropL
  66.  
  67. Sub Table1_Init
  68. vpmInit Me
  69. On Error Resume Next
  70. With Controller
  71. .GameName = cGameName
  72. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  73. .SplashInfoLine = "Totem (Gotlieb)"&chr(13)&"You Suck"
  74. .HandleMechanics=0
  75. .HandleKeyboard=0
  76. .ShowDMDOnly=1
  77. .ShowFrame=0
  78. .ShowTitle=0
  79. .hidden = 1
  80. If Err Then MsgBox Err.Description
  81. End With
  82. On Error Goto 0
  83. Controller.SolMask(0)=0
  84. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  85. Controller.Run
  86. If Err Then MsgBox Err.Description
  87. On Error Goto 0
  88.  
  89. PinMAMETimer.Interval=PinMAMEInterval
  90. PinMAMETimer.Enabled=1
  91.  
  92. vpmNudge.TiltSwitch = 4
  93. vpmNudge.Sensitivity = 2
  94. vpmNudge.TiltObj = Array(Bumper1,Bumper2,LeftSlingshot,RightSlingshot)
  95.  
  96. Set bsTrough = New cvpmBallStack
  97. bsTrough.initnotrough ballrelease, 66, 55, 6
  98. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  99.  
  100. Set dtDropL=New cvpmDropTarget'
  101. dtDropL.InitDrop Array(sw20,sw21,sw24,sw30,sw31,sw34),Array(20,21,24,30,31,34)
  102. dtDropL.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
  103.  
  104. Set bsSaucer=New cvpmBallstack
  105. bsSaucer.InitSaucer sw41,41,235,6
  106. bsSaucer.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  107.  
  108. End Sub
  109.  
  110. '**********************************************************************************************************
  111. 'Plunger code
  112. '**********************************************************************************************************
  113.  
  114. Sub Table1_KeyDown(ByVal KeyCode)
  115. If KeyDownHandler(keycode) Then Exit Sub
  116. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  117. if keycode = 46 then ' C Key
  118. If contball = 1 Then
  119. contball = 0
  120. Else
  121. contball = 1
  122. End If
  123. End If
  124. if keycode = 48 then 'B Key
  125. If bcboost = 1 Then
  126. bcboost = bcboostmulti
  127. Else
  128. bcboost = 1
  129. End If
  130. End If
  131. if keycode = 203 then bcleft = 1 ' Left Arrow
  132. if keycode = 200 then bcup = 1 ' Up Arrow
  133. if keycode = 208 then bcdown = 1 ' Down Arrow
  134. if keycode = 205 then bcright = 1 ' Right Arrow
  135. End Sub
  136.  
  137. Sub Table1_KeyUp(ByVal KeyCode)
  138. If KeyUpHandler(keycode) Then Exit Sub
  139. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  140. if keycode = 203 then bcleft = 0 ' Left Arrow
  141. if keycode = 200 then bcup = 0 ' Up Arrow
  142. if keycode = 208 then bcdown = 0 ' Down Arrow
  143. if keycode = 205 then bcright = 0 ' Right Arrow
  144. End Sub
  145.  
  146. Sub StartControl_Hit()
  147. Set ControlBall = ActiveBall
  148. contballinplay = true
  149. End Sub
  150.  
  151. Sub StopControl_Hit()
  152. contballinplay = false
  153. End Sub
  154.  
  155. Dim bcup, bcdown, bcleft, bcright, contball, contballinplay, ControlBall, bcboost
  156. Dim bcvel, bcyveloffset, bcboostmulti
  157.  
  158. bcboost = 1 'Do Not Change - default setting
  159. bcvel = 4 'Controls the speed of the ball movement
  160. bcyveloffset = -0.01 'Offsets the force of gravity to keep the ball from drifting vertically on the table, should be negative
  161. bcboostmulti = 3 'Boost multiplier to ball veloctiy (toggled with the B key)
  162.  
  163. Sub BallControl_Timer()
  164. If Contball and ContBallInPlay then
  165. If bcright = 1 Then
  166. ControlBall.velx = bcvel*bcboost
  167. ElseIf bcleft = 1 Then
  168. ControlBall.velx = - bcvel*bcboost
  169. Else
  170. ControlBall.velx=0
  171. End If
  172.  
  173. If bcup = 1 Then
  174. ControlBall.vely = -bcvel*bcboost
  175. ElseIf bcdown = 1 Then
  176. ControlBall.vely = bcvel*bcboost
  177. Else
  178. ControlBall.vely= bcyveloffset
  179. End If
  180. End If
  181. End Sub
  182.  
  183. '**********************************************************************************************************
  184.  
  185. 'Switches
  186. '**********************************************************************************************************
  187. '**********************************************************************************************************
  188. 'Drain hole and kicker
  189. Sub Drain_Hit:playsound"drain":bsTrough.addball me: DOF 115, DOFPulse:End Sub
  190. Sub sw41_Hit():bsSaucer.Addball 0 : playsound "popper_ball": End Sub
  191.  
  192. 'Bumpers
  193. Sub Bumper1_Hit : vpmTimer.PulseSw(14) : playsound SoundFX("fx_bumper1",DOFContactors): DOF 107, DOFPulse : End Sub
  194. Sub Bumper2_Hit : vpmTimer.PulseSw(14) : playsound SoundFX("fx_bumper1",DOFContactors): DOF 108, DOFPulse : End Sub
  195.  
  196. 'Stand Up Targets
  197. Sub sw62a_Hit():vpmtimer.pulsesw 62:DOF 111, DOFPulse:End Sub
  198. Sub sw62b_Hit():vpmtimer.pulsesw 62:DOF 112, DOFPulse:End Sub
  199. Sub sw62c_Hit():vpmtimer.pulsesw 62:DOF 113, DOFPulse:End Sub
  200. Sub sw64_Hit():vpmtimer.pulsesw 64:End Sub
  201.  
  202. 'Drop Targets
  203. Sub sw20_Dropped:dtDropL.Hit 1:DOF 123, 2:End Sub
  204. Sub sw21_Dropped:dtDropL.Hit 2:DOF 124, 2:End Sub
  205. Sub sw24_Dropped:dtDropL.Hit 3:DOF 122, 2:End Sub
  206. Sub sw30_Dropped:dtDropL.Hit 4:DOF 125, 2:End Sub
  207. Sub sw31_Dropped:dtDropL.Hit 5:DOF 126, 2:End Sub
  208. Sub sw34_Dropped:dtDropL.Hit 6:DOF 127, 2:End Sub
  209.  
  210. 'Star Triggers
  211. Sub sw40_Hit():Controller.Switch(40)=1 : playsound"rollover" : DOF 116, DOFPulse:End Sub
  212. Sub sw40_UnHit:Controller.Switch(40)=0:End Sub
  213. Sub sw50_Hit():Controller.Switch(50)=1 : playsound"rollover" : End Sub
  214. Sub sw50_UnHit:Controller.Switch(50)=0:End Sub
  215. Sub sw40a_Hit():Controller.Switch(40)=1 : playsound"rollover": DOF 117, DOFPulse:End Sub
  216. Sub sw40a_UnHit:Controller.Switch(40)=0:End Sub
  217.  
  218. 'Scoring Gate
  219. Sub Gate1_Hit:vpmtimer.pulsesw 61:End Sub
  220.  
  221.  
  222. 'Scoring Rubbers
  223. Sub sw60a_Slingshot():vpmtimer.pulsesw 60: playsound"slingshot" : End Sub
  224. Sub sw60b_Slingshot():vpmtimer.pulsesw 60: playsound"slingshot" : End Sub
  225. Sub sw60c_Slingshot():vpmtimer.pulsesw 60: playsound"slingshot" : End Sub
  226. Sub sw60d_Slingshot():vpmtimer.pulsesw 60: playsound"slingshot" : End Sub
  227. Sub sw60e_Slingshot():vpmtimer.pulsesw 60: playsound"slingshot" : End Sub
  228.  
  229.  
  230.  
  231. 'Wire Triggers
  232. Sub sw10_Hit():Controller.Switch(10)=1 : playsound"rollover" : End Sub
  233. Sub sw10_UnHit:Controller.Switch(10)=0:End Sub
  234. Sub sw11_Hit():Controller.Switch(11)=1 : playsound"rollover" : End Sub
  235. Sub sw11_UnHit:Controller.Switch(11)=0:End Sub
  236. Sub sw51_Hit():Controller.Switch(51)=1 : playsound"rollover":DOF 101, DOFOn:End Sub
  237. Sub sw51_UnHit:Controller.Switch(51)=0:DOF 101, DOFOff:End Sub
  238. Sub sw51a_Hit():Controller.Switch(51)=1 : playsound"rollover":DOF 102, DOFOn:End Sub
  239. Sub sw51a_UnHit:Controller.Switch(51)=0:DOF 102, DOFOff:End Sub
  240. Sub sw70_Hit():Controller.Switch(70)=1 : playsound"rollover" : End Sub
  241. Sub sw70_UnHit:Controller.Switch(70)=0:End Sub
  242. Sub sw71_Hit():Controller.Switch(71)=1 : playsound"rollover" : End Sub
  243. Sub sw71_UnHit:Controller.Switch(71)=0:End Sub
  244. Sub sw72_Hit():Controller.Switch(72)=1 : playsound"rollover" : End Sub
  245. Sub sw72_UnHit:Controller.Switch(72)=0:End Sub
  246. Sub sw74_Hit():Controller.Switch(74)=1 : playsound"rollover" : End Sub
  247. Sub sw74_UnHit:Controller.Switch(74)=0:End Sub
  248.  
  249. 'Moving Target
  250. Sub sw42_Hit:vpmTimer.PulseSw 42:PlaySound SoundFX("target",DOFTargets)
  251. PrimTarget1.visible = 0:PrimTarget2.visible = 1:PrimTarget3.visible = 0:PrimTarget4.visible = 0:
  252. End Sub
  253.  
  254. Sub sw52_Hit:vpmTimer.PulseSw 52
  255. PrimTarget1.visible = 0:PrimTarget2.visible = 0:PrimTarget3.visible = 1:PrimTarget4.visible = 0:
  256. End Sub
  257.  
  258. Sub sw51b_Hit:vpmTimer.PulseSw 51
  259. DOF 114, DOFPulse
  260. PrimTarget1.visible = 0:PrimTarget2.visible = 0:PrimTarget3.visible = 0:PrimTarget4.visible = 1:
  261. End Sub
  262.  
  263. '***************************************************
  264. ' JP's VP10 Fading Lamps & Flashers
  265. ' Based on PD's Fading Light System
  266. ' SetLamp 0 is Off
  267. ' SetLamp 1 is On
  268. ' fading for non opacity objects is 4 steps
  269. '***************************************************
  270.  
  271. Dim LampState(200), FadingLevel(200)
  272. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  273.  
  274. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  275. LampTimer.Interval = 5 'lamp fading speed
  276. LampTimer.Enabled = 1
  277.  
  278. ' Lamp & Flasher Timers
  279.  
  280. Sub LampTimer_Timer()
  281. Dim chgLamp, num, chg, ii
  282. chgLamp = Controller.ChangedLamps
  283. If Not IsEmpty(chgLamp) Then
  284. For ii = 0 To UBound(chgLamp)
  285. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  286. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  287. Next
  288. End If
  289. UpdateLamps
  290. End Sub
  291.  
  292.  
  293. Sub UpdateLamps
  294. If DesktopMode = True Then
  295. FadeIReel 1, EMReelGO
  296. end if
  297. If DesktopMode = True Then
  298. FadeReel 2, EMReelTilt
  299. end if
  300. If DesktopMode = True Then
  301. FadeReel 3, EMReelHTD
  302. end if
  303. NFadeLm 4, l4
  304. If DesktopMode = True Then
  305. FadeReel 4, EMReelSPSA
  306. end if
  307. NFadeL 5, l5
  308. NFadeL 6, l6
  309. NFadeL 7, l7
  310. NFadeL 8, l8
  311. NFadeL 9, l9
  312. NFadeL 10, l10
  313. NFadeL 11, l11
  314. NFadeL 12, l12
  315. NFadeL 13, l13
  316. NFadeL 14, l14
  317. NFadeL 15, l15
  318. NFadeL 16, l16
  319. NFadeL 17, l17
  320. NFadeL 18, l18
  321. 'NFadeL 19, l19
  322. 'NFadeL 20, l20
  323. NFadeL 21, l21
  324. NFadeL 22, l22
  325. NFadeL 23, l23
  326. NFadeL 24, l24
  327. NFadeL 25, l25
  328. NFadeL 26, l26
  329. NFadeL 27, l27
  330. NFadeL 28, l28
  331. NFadeL 29, l29
  332. NFadeL 30, l30
  333. NFadeL 31, l31
  334. NFadeL 32, l32
  335. NFadeL 33, l33
  336. NFadeL 34, l34
  337. NFadeL 35, l35
  338. NFadeL 36, l36
  339.  
  340.  
  341. 'FadeReel lBallInPlay, EMReelBIP
  342. 'FadeReel lNumberToMatch, EMReelNTM
  343. End Sub
  344.  
  345. ' div lamp subs
  346.  
  347. Sub InitLamps()
  348. Dim x
  349. For x = 0 to 200
  350. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  351. FadingLevel(x) = 4 ' used to track the fading state
  352. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  353. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  354. FlashMax(x) = 1 ' the maximum value when on, usually 1
  355. FlashMin(x) = 0 ' the minimum value when off, usually 0
  356. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  357. Next
  358. End Sub
  359.  
  360. Sub AllLampsOff
  361. Dim x
  362. For x = 0 to 200
  363. SetLamp x, 0
  364. Next
  365. End Sub
  366.  
  367. Sub SetLamp(nr, value)
  368. If value <> LampState(nr) Then
  369. LampState(nr) = abs(value)
  370. FadingLevel(nr) = abs(value) + 4
  371. End If
  372. End Sub
  373.  
  374. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  375.  
  376. Sub NFadeL(nr, object)
  377. Select Case FadingLevel(nr)
  378. Case 4:object.state = 0:FadingLevel(nr) = 0
  379. Case 5:object.state = 1:FadingLevel(nr) = 1
  380. End Select
  381. End Sub
  382.  
  383. Sub NFadeLm(nr, object) ' used for multiple lights
  384. Select Case FadingLevel(nr)
  385. Case 4:object.state = 0
  386. Case 5:object.state = 1
  387. End Select
  388. End Sub
  389.  
  390. 'Reels
  391. Sub FadeReel(nr, reel)
  392. Select Case FadingLevel(nr)
  393. Case 2:FadingLevel(nr) = 0
  394. Case 3:FadingLevel(nr) = 2
  395. Case 4:reel.Visible = 0:FadingLevel(nr) = 3
  396. Case 5:reel.Visible = 1:FadingLevel(nr) = 1
  397. End Select
  398. End Sub
  399.  
  400. 'Inverted Reels
  401. Sub FadeIReel(nr, reel)
  402. Select Case FadingLevel(nr)
  403. Case 2:FadingLevel(nr) = 0
  404. Case 3:FadingLevel(nr) = 2
  405. Case 4:reel.Visible = 1:FadingLevel(nr) = 3
  406. Case 5:reel.Visible = 0:FadingLevel(nr) = 1
  407. End Select
  408. End Sub
  409.  
  410. '**********************************************************************************************************
  411. '**********************************************************************************************************
  412. ' Backglass Light Displays (7 digit 7 segment displays)
  413. Dim Digits(28)
  414. Digits(0)=Array(a00,a01,a02,a03,a04,a05,a06,n,a08)
  415. Digits(1)=Array(a10,a11,a12,a13,a14,a15,a16,n,a18)
  416. Digits(2)=Array(a20,a21,a22,a23,a24,a25,a26,n,a28)
  417. Digits(3)=Array(a30,a31,a32,a33,a34,a35,a36,n,a38)
  418. Digits(4)=Array(a40,a41,a42,a43,a44,a45,a46,n,a48)
  419. Digits(5)=Array(a50,a51,a52,a53,a54,a55,a56,n,a58)
  420.  
  421.  
  422. Digits(6)=Array(b20,b21,b22,b23,b24,b25,b26,n,b28)
  423. Digits(7)=Array(b30,b31,b32,b33,b34,b35,b36,n,b38)
  424. Digits(8)=Array(b40,b41,b42,b43,b44,b45,b46,n,b48)
  425. Digits(9)=Array(b50,b51,b52,b53,b54,b55,b56,n,b58)
  426. Digits(10)=Array(c00,c01,c02,c03,c04,c05,c06,n,c08)
  427. Digits(11)=Array(c10,c11,c12,c13,c14,c15,c16,n,c18)
  428.  
  429. Digits(12)=Array(c20,c21,c22,c23,c24,c25,c26,n,c28)
  430. Digits(13)=Array(c30,c31,c32,c33,c34,c35,c36,n,c38)
  431. Digits(14)=Array(c40,c41,c42,c43,c44,c45,c46,n,c48)
  432. Digits(15)=Array(c50,c51,c52,c53,c54,c55,c56,n,c58)
  433. Digits(16)=Array(d00,d01,d02,d03,d04,d05,d06,n,d08)
  434. Digits(17)=Array(d10,d11,d12,d13,d14,d15,d16,n,d18)
  435.  
  436. Digits(18)=Array(d40,d41,d42,d43,d44,d45,d46,n,d48)
  437. Digits(19)=Array(d50,d51,d52,d53,d54,d55,d56,n,d58)
  438. Digits(20)=Array(e00,e01,e02,e03,e04,e05,e06,n,e08)
  439. Digits(21)=Array(e10,e11,e12,e13,e14,e15,e16,n,e18)
  440. Digits(22)=Array(f00,f01,f02,f03,f04,f05,f06,n,f08)
  441. Digits(23)=Array(f10,f11,f12,f13,f14,f15,f16,n,f18)
  442.  
  443. 'credit -- Ball In Play
  444. Digits(24) = Array(e2,e3,e7,e4,e5,e1,e6,n,e23)
  445. Digits(25) = Array(e9,e17,e22,e19,e20,e8,e21,n,e24)
  446. Digits(26) = Array(f2,f3,f7,f4,f5,f1,f6,n,f23)
  447. Digits(27) = Array(f9,f17,f22,f19,f20,f8,f21,n,f24)
  448.  
  449.  
  450. Sub DisplayTimer_Timer
  451. Dim ChgLED,ii,num,chg,stat,obj
  452. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  453. If Not IsEmpty(ChgLED) Then
  454. If DesktopMode = True Then
  455. For ii = 0 To UBound(chgLED)
  456. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  457. if (num < 28) then
  458. For Each obj In Digits(num)
  459. If chg And 1 Then obj.State = stat And 1
  460. chg = chg\2 : stat = stat\2
  461. Next
  462. else
  463. end if
  464. next
  465. end if
  466. end if
  467. End Sub
  468.  
  469. '**********************************************************************************************************
  470. '**********************************************************************************************************
  471. Sub editDips
  472. Dim vpmDips : Set vpmDips = New cvpmDips
  473. With vpmDips
  474. .AddForm 700,400,"System 1 - DIP switches"
  475. .AddFrame 0,0,190,"Coin chutecontrol",&H00040000,Array("seperate",0,"same",&H00040000)'dip 19
  476. .AddFrame 0,46,190,"Game mode",&H00000400,Array("extraball",0,"replay",&H00000400)'dip 11
  477. .AddFrame 0,92,190,"High game to date awards",&H00200000,Array("noaward",0,"3 replays",&H00200000)'dip 22
  478. .AddFrame 0,138,190,"Balls per game",&H00000100,Array("5 balls",0,"3balls",&H00000100)'dip 9
  479. .AddFrame 0,184,190,"Tilt effect",&H00000800,Array("game over",0,"ball in play only",&H00000800)'dip 12
  480. .AddFrame 205,0,190,"Maximum credits",&H00030000,Array("5 credits",0,"8 credits",&H00020000,"10 credits",&H00010000,"15 credits",&H00030000)'dip 17&18
  481. .AddFrame 205,76,190,"Soundsettings",&H80000000,Array("sounds",0,"tones",&H80000000)'dip 32
  482. .AddFrame 205,122,190,"Attract tune",&H10000000,Array("no attract tune",0,"attract tune played every 6 minutes",&H10000000)'dip 29
  483. .AddChk 205,175,190,Array("Match feature",&H00000200)'dip 10
  484. .AddChk 205,190,190,Array("Credits displayed",&H00001000)'dip 13
  485. .AddChk 205,205,190,Array("Play credit button tune",&H00002000)'dip 14
  486. .AddChk 205,220,190,Array("Play tones when scoring",&H00080000)'dip 20
  487. .AddChk 205,235,190,Array("Play coin switch tune",&H00400000)'dip 23
  488. .AddChk 205,250,190,Array("High game to date displayed",&H00100000)'dip 21
  489. .AddLabel 50,280,300,20,"After hitting OK, press F3 to reset game with new settings."
  490. .ViewDips
  491. End With
  492. End Sub
  493. Set vpmShowDips = GetRef("editDips")
  494.  
  495.  
  496. '*********************************************************************
  497. ' Start of VPX Functions
  498. '*********************************************************************\
  499.  
  500.  
  501. '**********Sling Shot Animations
  502. ' Rstep and Lstep are the variables that increment the animation
  503. '****************
  504. Dim RStep, Lstep
  505.  
  506. Sub RightSlingShot_Slingshot
  507. vpmTimer.PulseSw 60
  508. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  509. DOF 104, DOFPulse
  510. RSling1.Visible = 1
  511. sling1.TransZ = -20
  512. RStep = 0
  513. RightSlingShot.TimerEnabled = 1
  514. DOF 104, 2
  515. End Sub
  516.  
  517. Sub RightSlingShot_Timer
  518. Select Case RStep
  519. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  520. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  521. End Select
  522. RStep = RStep + 1
  523. End Sub
  524.  
  525. Sub LeftSlingShot_Slingshot
  526. vpmTimer.PulseSw 60
  527. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  528. DOF 103, DOFPulse
  529. LSling.Visible = 0
  530. LSling1.Visible = 1
  531. sling2.TransZ = -20
  532. LStep = 0
  533. LeftSlingShot.TimerEnabled = 1
  534. End Sub
  535.  
  536. Sub LeftSlingShot_Timer
  537. Select Case LStep
  538. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  539. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  540. End Select
  541. LStep = LStep + 1
  542. End Sub
  543.  
  544.  
  545. '*********************************************************************
  546. ' Positional Sound Playback Functions
  547. '*********************************************************************
  548.  
  549. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  550. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  551. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  552. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  553. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  554. End Sub
  555.  
  556. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  557. Sub PlaySoundAt(soundname, tableobj)
  558. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  559. End Sub
  560.  
  561. Sub PlaySoundAtBall(soundname)
  562. PlaySoundAt soundname, ActiveBall
  563. End Sub
  564.  
  565.  
  566. '*********************************************************************
  567. ' Supporting Ball & Sound Functions
  568. '*********************************************************************
  569.  
  570. 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
  571. Dim tmp
  572. tmp = tableobj.y * 2 / table1.height-1
  573. If tmp > 0 Then
  574. AudioFade = Csng(tmp ^10)
  575. Else
  576. AudioFade = Csng(-((- tmp) ^10) )
  577. End If
  578. End Function
  579.  
  580. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  581. Dim tmp
  582. tmp = tableobj.x * 2 / table1.width-1
  583. If tmp > 0 Then
  584. AudioPan = Csng(tmp ^10)
  585. Else
  586. AudioPan = Csng(-((- tmp) ^10) )
  587. End If
  588. End Function
  589.  
  590. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  591. Vol = Csng(BallVel(ball) ^2 / 2000)
  592. End Function
  593.  
  594. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  595. Pitch = BallVel(ball) * 20
  596. End Function
  597.  
  598. Function BallVel(ball) 'Calculates the ball speed
  599. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  600. End Function
  601.  
  602. '*****************************************
  603. ' JP's VP10 Rolling Sounds
  604. '*****************************************
  605.  
  606. Const tnob = 5 ' total number of balls
  607. ReDim rolling(tnob)
  608. InitRolling
  609.  
  610. Sub InitRolling
  611. Dim i
  612. For i = 0 to tnob
  613. rolling(i) = False
  614. Next
  615. End Sub
  616.  
  617. Sub RollingTimer_Timer()
  618. Dim BOT, b
  619. BOT = GetBalls
  620.  
  621. ' stop the sound of deleted balls
  622. For b = UBound(BOT) + 1 to tnob
  623. rolling(b) = False
  624. StopSound("fx_ballrolling" & b)
  625. Next
  626.  
  627. ' exit the sub if no balls on the table
  628. If UBound(BOT) = -1 Then Exit Sub
  629.  
  630. ' play the rolling sound for each ball
  631. For b = 0 to UBound(BOT)
  632. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  633. rolling(b) = True
  634. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  635. Else
  636. If rolling(b) = True Then
  637. StopSound("fx_ballrolling" & b)
  638. rolling(b) = False
  639. End If
  640. End If
  641. Next
  642. End Sub
  643.  
  644. '**********************
  645. ' Ball Collision Sound
  646. '**********************
  647.  
  648. Sub OnBallBallCollision(ball1, ball2, velocity)
  649. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  650. End Sub
  651.  
  652.  
  653. '*****************************************
  654. ' ninuzzu's FLIPPER SHADOWS
  655. '*****************************************
  656.  
  657. sub FlipperTimer_Timer()
  658. FlipperLSh.RotZ = LeftFlipper.currentangle
  659. FlipperRSh.RotZ = RightFlipper.currentangle
  660. rflipb.rotz = RightFlipper.currentangle
  661. rflipr.rotz = RightFlipper.currentangle
  662. lflipb.rotz = LeftFlipper.currentangle
  663. lflipr.rotz = LeftFlipper.currentangle
  664. End Sub
  665.  
  666. '*****************************************
  667. ' ninuzzu's BALL SHADOW
  668. '*****************************************
  669. Dim BallShadow
  670. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  671.  
  672. Sub BallShadowUpdate_timer()
  673. Dim BOT, b
  674. BOT = GetBalls
  675. ' hide shadow of deleted balls
  676. If UBound(BOT)<(tnob-1) Then
  677. For b = (UBound(BOT) + 1) to (tnob-1)
  678. BallShadow(b).visible = 0
  679. Next
  680. End If
  681. ' exit the Sub if no balls on the table
  682. If UBound(BOT) = -1 Then Exit Sub
  683. ' render the shadow for each ball
  684. For b = 0 to UBound(BOT)
  685. If BOT(b).X < Table1.Width/2 Then
  686. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  687. Else
  688. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  689. End If
  690. ballShadow(b).Y = BOT(b).Y + 12
  691. If BOT(b).Z > 20 Then
  692. BallShadow(b).visible = 1
  693. Else
  694. BallShadow(b).visible = 0
  695. End If
  696. Next
  697. End Sub
  698.  
  699.  
  700.  
  701. '************************************
  702. ' What you need to add to your table
  703. '************************************
  704.  
  705. ' a timer called RollingTimer. With a fast interval, like 10
  706. ' one collision sound, in this script is called fx_collide
  707. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  708. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  709.  
  710.  
  711. '******************************************
  712. ' Explanation of the rolling sound routine
  713. '******************************************
  714.  
  715. ' sounds are played based on the ball speed and position
  716.  
  717. ' the routine checks first for deleted balls and stops the rolling sound.
  718.  
  719. ' The For loop goes through all the balls on the table and checks for the ball speed and
  720. ' if the ball is on the table (height lower than 30) then then it plays the sound
  721. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  722.  
  723. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  724. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  725. ' according to the position of the ball on the table.
  726.  
  727.  
  728. '**************************************
  729. ' Explanation of the collision routine
  730. '**************************************
  731.  
  732. ' The collision is built in VP.
  733. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  734. ' 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
  735. ' depending of the speed of the collision.
  736.  
  737.  
  738. Sub Pins_Hit (idx)
  739. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  740. End Sub
  741.  
  742. Sub Targets_Hit (idx)
  743. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  744. End Sub
  745.  
  746. Sub Metals_Thin_Hit (idx)
  747. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  748. End Sub
  749.  
  750. Sub Metals_Medium_Hit (idx)
  751. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  752. End Sub
  753.  
  754. Sub Metals2_Hit (idx)
  755. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  756. End Sub
  757.  
  758. Sub Gates_Hit (idx)
  759. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  760. End Sub
  761.  
  762. Sub Spinner_Spin
  763. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  764. End Sub
  765.  
  766. Sub Rubbers_Hit(idx)
  767. dim finalspeed
  768. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  769. If finalspeed > 20 then
  770. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  771. End if
  772. If finalspeed >= 6 AND finalspeed <= 20 then
  773. RandomSoundRubber()
  774. End If
  775. End Sub
  776.  
  777. Sub Posts_Hit(idx)
  778. dim finalspeed
  779. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  780. If finalspeed > 16 then
  781. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  782. End if
  783. If finalspeed >= 6 AND finalspeed <= 16 then
  784. RandomSoundRubber()
  785. End If
  786. End Sub
  787.  
  788. Sub RandomSoundRubber()
  789. Select Case Int(Rnd*3)+1
  790. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  791. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  792. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  793. End Select
  794. End Sub
  795.  
  796. Sub LeftFlipper_Collide(parm)
  797. RandomSoundFlipper()
  798. End Sub
  799.  
  800. Sub RightFlipper_Collide(parm)
  801. RandomSoundFlipper()
  802. End Sub
  803.  
  804. Sub RandomSoundFlipper()
  805. Select Case Int(Rnd*3)+1
  806. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  807. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  808. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  809. End Select
  810. End Sub
Advertisement
Add Comment
Please, Sign In to add comment