Arngrim

Joust 0035d DOF

Mar 1st, 2017
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.21 KB | None | 0 0
  1. Option Explicit
  2.  
  3. On Error Resume Next
  4. ExecuteGlobal GetTextFile("controller.vbs")
  5. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  6. On Error Goto 0
  7.  
  8. 'Const Ballmass = 1.1
  9. Const cGameName="Jst_L2",cCredits="",UseSolenoids=1,UseLamps=0,UseGI=0,UseSync=1
  10. Const SSolenoidOn="solon",SSolenoidOff="soloff",SFlipperOn="FlipperUp",SFlipperOff="FlipperDown",SCoin="Quarter"
  11. dim sGameOn
  12.  
  13. LoadVPM "01500000","S7.VBS",3.02
  14.  
  15. SolCallback(1)="bsTroughP1.SolIn"
  16. SolCallback(2)="bsTroughP2.SolIn"
  17. SolCallback(3)="SolP1Trough"
  18. SolCallback(4)="SolP2Trough"
  19. SolCallback(5)="bsP1.SolOut"
  20. SolCallback(6)="bsP2.SolOut"
  21. SolCallback(7)="bsEjectP1.SolOut"
  22. SolCallback(8)="bsEjectP2.SolOut"
  23. SolCallback(9)="dtA.SolDropUp"
  24. SolCallback(10)="dtB.SolDropUp"
  25. SolCallback(11)="dtC.SolDropUp"
  26. SolCallback(12)="dtD.SolDropUp"
  27. SolCallback(13)="dtR.SolDropUp"
  28. SolCallback(14)="dtL.SolDropUp"
  29. SolCallback(15)="UpDateGI"
  30. Const sGI=15
  31. Const sCLO=16
  32. Const sFlipperRelay=17'does not work - scripted around below
  33. SolCallback(19)="vpmSolSound SoundFX(""sling"",DOFContactors),"
  34. SolCallback(20)="vpmSolSound SoundFX(""sling"",DOFContactors),"
  35. SolCallback(21)="vpmSolSound SoundFX(""sling"",DOFContactors),"
  36. SolCallback(22)="vpmSolSound SoundFX(""sling"",DOFContactors),"
  37.  
  38.  
  39. Sub SolP1Trough(Enabled)
  40. If Enabled Then
  41. If bsTroughP1.Balls Then bsTroughP1.ExitSol_On
  42. End If
  43. End Sub
  44.  
  45. Sub SolP2Trough(Enabled)
  46. If Enabled Then
  47. If bsTroughP2.Balls Then bsTroughP2.ExitSol_On
  48. End If
  49. End Sub
  50. '********GI
  51. Sub UpDateGI(enabled)
  52. Dim xx
  53. If Enabled Then
  54. For Each xx in GI:xx.State = 1:Next
  55. Else
  56. For Each xx in GI:xx.State = 0:Next
  57. End If
  58. End Sub
  59.  
  60. Sub LoadVPM(VPMver, VBSfile, VBSver)
  61. On Error Resume Next
  62. If ScriptEngineMajorVersion < 5 Then MsgBox "VB Script Engine 5.0 or higher required"
  63. ExecuteGlobal GetTextFile(VBSfile)
  64. If Err Then MsgBox "Unable to open " & VBSfile & ". Ensure that it is in the same folder as this table. " & vbNewLine & Err.Description : Err.Clear
  65. Set Controller = CreateObject("VPinMAME.Controller")
  66. If Err Then MsgBox "Can't Load VPinMAME." & vbNewLine & Err.Description
  67. If VPMver>"" Then If Controller.Version < VPMver Or Err Then MsgBox "VPinMAME ver " & VPMver & " required." : Err.Clear
  68. If VPinMAMEDriverVer < VBSver Or Err Then MsgBox VBSFile & " ver " & VBSver & " or higher required."
  69. On Error Goto 0
  70. End Sub
  71.  
  72. Dim Flips
  73.  
  74. Set LampCallback=GetRef("UpdateMultipleLamps")
  75. Dim bsTroughP1,bsTroughP2,bsEjectP1,bsEjectP2,dtA,dtB,dtC,dtD,dtL,dtR,bsP1,bsP2
  76.  
  77. Sub Table1_Init
  78. On Error Resume Next
  79. With Controller
  80. .GameName=cGameName
  81. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  82. .SplashInfoLine=cCredits
  83. .ShowDMDOnly=1
  84. .ShowFrame=1
  85. .ShowTitle=0
  86. .Hidden=1
  87. .Run
  88. If Err Then MsgBox Err.Description
  89. End With
  90. On Error Goto 0
  91. PinMAMETimer.Interval=PinMAMEInterval
  92. PinMAMETimer.Enabled=1
  93. vpmNudge.TiltSwitch=1
  94. vpmNudge.Sensitivity=5
  95. vpmNudge.TiltObj=Array(LeftSlingshot,RightSlingshot)
  96.  
  97. Set bsTroughP1=New cvpmBallStack
  98. bsTroughP1.InitSw 9,10,11,12,13,0,0,0
  99. bsTroughP1.InitKick BallRelease,60,5
  100. bsTroughP1.InitExitSnd SoundFX("BallRel",DOFContactors),SoundFX("Solon",DOFContactors)
  101. bsTroughP1.Balls=2
  102.  
  103. Set bsTroughP2=New cvpmBallStack
  104. bsTroughP2.InitSw 33,34,35,36,37,0,0,0
  105. bsTroughP2.InitKick Kicker3,120,120
  106. bsTroughP2.InitExitSnd SoundFX("Popper",DOFContactors),SoundFX("Solon",DOFContactors)
  107. bsTroughP2.Balls=2
  108.  
  109. Set bsEjectP1=New cvpmBallStack
  110. bsEjectP1.InitSaucer Switch15,15,220,8
  111. bsEjectP1.InitExitSnd SoundFX("Popper",DOFContactors),SoundFX("Solon",DOFContactors)
  112.  
  113. Set bsEjectP2=New cvpmBallStack
  114. bsEjectP2.InitSaucer Switch39,39,220,8
  115. bsEjectP2.InitExitSnd SoundFX("Popper",DOFContactors),SoundFX("Solon",DOFContactors)
  116.  
  117. Set dtA=New cvpmDropTarget
  118. dtA.InitDrop Sw17,17
  119. dtA.InitSnd SoundFX("FlapClos",DOFDropTargets),SoundFX("FlapOpen",DOFDropTargets)
  120.  
  121. Set dtB=New cvpmDropTarget
  122. dtB.InitDrop Sw41,41
  123. dtB.InitSnd SoundFX("FlapClos",DOFDropTargets),SoundFX("FlapOpen",DOFDropTargets)
  124.  
  125. Set dtC=New cvpmDropTarget
  126. dtC.InitDrop Sw18,18
  127. dtC.InitSnd SoundFX("FlapClos",DOFDropTargets),SoundFX("FlapOpen",DOFDropTargets)
  128.  
  129. Set dtD=New cvpmDropTarget
  130. dtD.InitDrop Sw42,42
  131. dtD.InitSnd SoundFX("FlapClos",DOFDropTargets),SoundFX("FlapOpen",DOFDropTargets)
  132.  
  133. Set dtL=New cvpmDropTarget
  134. dtL.InitDrop Array(Sw26,Sw27,Sw28,Sw50,Sw51,Sw52),Array(26,27,28,50,51,52)
  135. dtL.InitSnd SoundFX("FlapClos",DOFDropTargets),SoundFX("FlapOpen",DOFDropTargets)
  136.  
  137. Set dtR=New cvpmDropTarget
  138. dtR.InitDrop Array(Sw23,Sw24,Sw25,Sw47,Sw48,Sw49),Array(23,24,25,47,48,49)
  139. dtR.InitSnd SoundFX("FlapClos",DOFDropTargets),SoundFX("FlapOpen",DOFDropTargets)
  140.  
  141. Set bsP1=New cvpmBallStack
  142. bsP1.InitSaucer P1K,14,0,25
  143. bsP1.InitExitSnd "Plunger","Solon"
  144.  
  145. Set bsP2=New cvpmBallStack
  146. bsP2.InitSaucer P2K,38,180,25
  147. bsP2.InitExitSnd "Plunger","Solon"
  148.  
  149. 'vpmMapLights AllLights
  150. 'Lamps 8 and 38 are backwards in manual
  151. operatormenu=0
  152. Flips=0
  153. LoadOptions
  154.  
  155.  
  156. UpdateGI 1
  157. p2wall1.isdropped = True
  158. p2wall.isdropped = True
  159. hard
  160. End Sub
  161.  
  162. Dim sw23up, sw24up, sw25up, sw26up, sw27up, sw28up, sw41up, sw42up, sw47up, sw48up, sw49up, sw50up, sw17up, sw18up, sw51up, sw52up
  163. Dim PrimT
  164.  
  165.  
  166. Sub PrimT_Timer
  167. if sw23.IsDropped = True then sw23up = False:Ramp108.Image = "off" else sw23up = True:Ramp108.Image = "pf2"
  168. if sw24.IsDropped = True then sw24up = False:Ramp107.Image = "off":Ramp110.Image = "off" else sw24up = True:Ramp107.Image = "pf1":Ramp110.Image = "pf1"
  169. if sw25.IsDropped = True then sw25up = False:Ramp106.Image = "off" else sw25up = True:Ramp106.Image = "pf2"
  170. if sw26.IsDropped = True then sw26up = False:Ramp100.Image = "off" else sw26up = True:Ramp100.Image = "pf2"
  171. if sw27.IsDropped = True then sw27up = False:Ramp102.Image = "off":Ramp101.Image = "off" else sw27up = True:Ramp102.Image = "pf1":Ramp101.Image = "pf1"
  172. if sw28.IsDropped = True then sw28up = False:Ramp103.Image = "off" else sw28up = True:Ramp103.Image = "pf2"
  173. if sw41.IsDropped = True then sw41up = False else sw41up = True
  174. if sw42.IsDropped = True then sw42up = False else sw42up = True
  175. if sw47.IsDropped = True then sw47up = False:Ramp103p2.Image = "off" else sw47up = True:Ramp103p2.Image = "pf2"
  176. if sw48.IsDropped = True then sw48up = False:Ramp102p2.Image = "off":Ramp101p2.Image = "off" else sw48up = True:Ramp102p2.Image = "pf1":Ramp101p2.Image = "pf1"
  177. if sw49.IsDropped = True then sw49up = False:Ramp100p2.Image = "off" else sw49up = True:Ramp100p2.Image = "pf2"
  178. if sw50.IsDropped = True then sw50up = False:Ramp106p2.Image = "off" else sw50up = True:Ramp106p2.Image = "pf2"
  179. if sw17.IsDropped = True then sw17up = False else sw17up = True
  180. if sw18.IsDropped = True then sw18up = False else sw18up = True
  181. if sw51.IsDropped = True then sw51up = False:Ramp107p2.Image = "off":Ramp110p2.Image = "off" else sw51up = True:Ramp107p2.Image = "pf1":Ramp110p2.Image = "pf1"
  182. if sw52.IsDropped = True then sw52up = False :Ramp108p2.Image = "off" else sw52up = True:Ramp108p2.Image = "pf2"
  183. 'End Sub
  184.  
  185.  
  186. if GIB29.State = 0 then
  187. Ramp108.Visible = false
  188. Ramp108p2.Visible = false
  189. Ramp107.Visible = false
  190. Ramp107p2.Visible = false
  191. Ramp110.Visible = false
  192. Ramp110p2.Visible = false
  193. Ramp106.Visible = false
  194. Ramp106p2.Visible = false
  195. Ramp103.Visible = false
  196. Ramp103p2.Visible = false
  197. Ramp102.Visible = false
  198. Ramp102p2.Visible = false
  199. Ramp101.Visible = false
  200. Ramp101p2.Visible = false
  201. Ramp100.Visible = false
  202. Ramp100p2.Visible = false
  203.  
  204. Else
  205. Ramp108.Visible = true
  206. Ramp108p2.Visible = true
  207. Ramp107.Visible = true
  208. Ramp107p2.Visible = true
  209. Ramp110.Visible = true
  210. Ramp110p2.Visible = true
  211. Ramp106.Visible = true
  212. Ramp106p2.Visible = true
  213. Ramp103.Visible = true
  214. Ramp103p2.Visible = true
  215. Ramp102.Visible = true
  216. Ramp102p2.Visible = true
  217. Ramp101.Visible = true
  218. Ramp101p2.Visible = true
  219. Ramp100.Visible = true
  220. Ramp100p2.Visible = true
  221.  
  222. End If
  223.  
  224. End Sub
  225.  
  226.  
  227. Sub DT_Timer()
  228. If sw23up = True and sw23p.z < -.5 then sw23p.z = sw23p.z + 3
  229. If sw24up = True and sw24p.z < -.1 then sw24p.z = sw24p.z + 3
  230. If sw25up = True and sw25p.z < -1 then sw25p.z = sw25p.z + 3
  231. If sw26up = True and sw26p.z < -1 then sw26p.z = sw26p.z + 3
  232. If sw27up = True and sw27p.z < -.1 then sw27p.z = sw27p.z + 3
  233. If sw28up = True and sw28p.z < -1 then sw28p.z = sw28p.z + 3
  234. If sw41up = True and sw41p.z < 1 then sw41p.z = sw41p.z + 3
  235. If sw42up = True and sw42p.z < -.5 then sw42p.z = sw42p.z + 3
  236. If sw47up = True and sw47p.z < -.5 then sw47p.z = sw47p.z + 3
  237. If sw48up = True and sw48p.z < .1 then sw48p.z = sw48p.z + 3
  238. If sw49up = True and sw49p.z < 1 then sw49p.z = sw49p.z + 3
  239. If sw50up = True and sw50p.z < 1 then sw50p.z = sw50p.z + 3
  240. If sw17up = True and sw17p.z < -1 then sw17p.z = sw17p.z + 3
  241. If sw18up = True and sw18p.z < -1 then sw18p.z = sw18p.z + 3
  242. If sw51up = True and sw51p.z < .1 then sw51p.z = sw51p.z + 3
  243. If sw52up = True and sw52p.z < -.5 then sw52p.z = sw52p.z + 3
  244. If sw23up = False and sw23p.z > -41 then sw23p.z = sw23p.z - 3
  245. If sw24up = False and sw24p.z > -40.5 then sw24p.z = sw24p.z - 3
  246. If sw25up = False and sw25p.z > -40 then sw25p.z = sw25p.z - 3
  247. If sw26up = False and sw26p.z > -40 then sw26p.z = sw26p.z - 3
  248. If sw27up = False and sw27p.z > -40.5 then sw27p.z = sw27p.z - 3
  249. If sw28up = False and sw28p.z > -42 then sw28p.z = sw28p.z - 3
  250. If sw41up = False and sw41p.z > -20 then sw41p.z = sw41p.z - 3
  251. If sw42up = False and sw42p.z > -20 then sw42p.z = sw42p.z - 3
  252. If sw47up = False and sw47p.z > -20 then sw47p.z = sw47p.z - 3
  253. If sw48up = False and sw48p.z > -20 then sw48p.z = sw48p.z - 3
  254. If sw49up = False and sw49p.z > -20 then sw49p.z = sw49p.z - 3
  255. If sw50up = False and sw50p.z > -20 then sw50p.z = sw50p.z - 3
  256. If sw17up = False and sw17p.z > -40 then sw17p.z = sw17p.z - 3
  257. If sw18up = False and sw18p.z > -40 then sw18p.z = sw18p.z - 3
  258. If sw51up = False and sw51p.z > -20 then sw51p.z = sw51p.z - 3
  259. If sw52up = False and sw52p.z > -20 then sw52p.z = sw52p.z - 3
  260. If sw23p.z >= 20 then sw23up = False
  261. If sw24p.z >= 20 then sw24up = False
  262. If sw25p.z >= 20 then sw25up = False
  263. If sw26p.z >= -20 then sw26up = False
  264. If sw27p.z >= -20 then sw27up = False
  265. If sw28p.z >= -20 then sw28up = False
  266. If sw41p.z >= -20 then sw41up = False
  267. If sw42p.z >= -20 then sw42up = False
  268. If sw47p.z >= -20 then sw47up = False
  269. If sw48p.z >= -20 then sw48up = False
  270. If sw49p.z >= -20 then sw49up = False
  271. If sw50p.z >= -20 then sw50up = False
  272. If sw17p.z >= -20 then sw17up = False
  273. If sw18p.z >= -20 then sw18up = False
  274. If sw51p.z >= -20 then sw51up = False
  275. If sw52p.z >= -20 then sw52up = False
  276. End Sub
  277.  
  278.  
  279. Dim operatormenu, options
  280.  
  281. Sub Table1_KeyDown(ByVal KeyCode)
  282. if operatormenu=0 then
  283. If KeyCode=StartGameKey Then
  284. If flips > 0 then
  285. Controller.Switch(57)=1
  286. else
  287. Controller.Switch(3)=1
  288. end if
  289. exit sub
  290. End If
  291. If KeyCode=LeftFlipperKey Then
  292. FlipL
  293. if RightSlingShot.SlingshotThreshold=100 then OperatorMenuTimer.Enabled = true
  294. end if
  295. If KeyCode=RightFlipperKey Then FlipR
  296. If KeyCode=LEFTMagnaSave Then Flip2L
  297. If KeyCode=RightMagnaSave Then Flip2R
  298. If vpmKeyDown(KeyCode) Then Exit Sub
  299. ' if keycode=leftflipperkey Then:ScrewHead2.z = ScrewHead2.z -1: debug.print ScrewHead2.z
  300. else
  301. If keycode=LeftFlipperKey then
  302. Options=Options+1
  303. If Options=3 then Options=1
  304. playsound "target"
  305. Select Case (Options)
  306. Case 1:
  307. Option1.visible=true
  308. Option2.visible=False
  309. Case 2:
  310. Option2.visible=true
  311. Option1.visible=False
  312. End Select
  313. end if
  314. If keycode=RightFlipperKey then
  315. PlaySound "metalhit2"
  316. Select Case (Options)
  317. Case 1:
  318. Flips=Flips+1
  319. If Flips>3 then Flips=0
  320. OptionPlayers.image = "OptionPlayers"&Flips
  321. Case 2:
  322. OperatorMenu=0
  323. SaveOptions
  324. HideOptions
  325. Hard
  326. End Select
  327. end if
  328. end if
  329.  
  330. End Sub
  331.  
  332. Sub OperatorMenuTimer_Timer
  333. OperatorMenu=1
  334. Displayoptions
  335. Options=1
  336. End Sub
  337.  
  338. Sub DisplayOptions
  339. OptionsBack.visible = true
  340. Option1.visible = True
  341. OptionPlayers.image = "OptionPlayers"&Flips
  342. OptionPlayers.visible = True
  343. End Sub
  344.  
  345. Sub HideOptions
  346. dim objekt
  347. for each objekt In OptionMenu
  348. objekt.visible = false
  349. next
  350. End Sub
  351.  
  352. Sub SaveOptions
  353. savevalue "Joust", "Flips", Flips
  354. end Sub
  355.  
  356. Sub LoadOptions
  357. dim temp
  358. temp = LoadValue("Joust", "Flips")
  359. If (temp <> "") then Flips = CDbl(temp)
  360. end sub
  361.  
  362. Sub FlipL
  363. If Tilted=0 Then
  364. If Flips>0 Then
  365. LeftFlipper.RotateToEnd
  366. PlaySound SoundFX("FlipperUp",DOFFlippers)
  367. Controller.Switch(58)=1
  368. Else
  369. LeftFlipper.RotateToEnd
  370. Flipper1.RotateToEnd
  371. PlaySound SoundFX("FlipperUp",DOFFlippers)
  372. Controller.Switch(58)=1
  373. Controller.Switch(60)=1
  374. End If
  375. End If
  376. End Sub
  377.  
  378. Sub FlipR
  379. If Tilted=0 Then
  380. If Flips>0 Then
  381. RightFlipper.RotateToEnd
  382. PlaySound SoundFX("FlipperUp",DOFFlippers)
  383. Controller.Switch(59)=1
  384. Else
  385. RightFlipper.RotateToEnd
  386. Flipper2.RotateToEnd
  387. PlaySound SoundFX("FlipperUp",DOFFlippers)
  388. Controller.Switch(59)=1
  389. Controller.Switch(61)=1
  390. End If
  391. End If
  392. End Sub
  393.  
  394. Sub Flip2L
  395. If Tilted=0 Then
  396. Flipper1.RotateToEnd
  397. PlaySound SoundFX("FlipperUp",DOFFlippers)
  398. Controller.Switch(60)=1
  399. End If
  400. End Sub
  401.  
  402. Sub Flip2R
  403. If Tilted=0 Then
  404. Flipper2.RotateToEnd
  405. PlaySound SoundFX("FlipperUp",DOFFlippers)
  406. Controller.Switch(61)=1
  407. End If
  408. End Sub
  409.  
  410. Sub FlipLA
  411. If Tilted=0 Then
  412. If Flips>0 Then
  413. LeftFlipper.RotateToStart
  414. PlaySound SoundFX("FlipperDown",DOFFlippers)
  415. Controller.Switch(58)=0
  416. Else
  417. LeftFlipper.RotateToStart
  418. Flipper1.RotateToStart
  419. PlaySound SoundFX("FlipperDown",DOFFlippers)
  420. Controller.Switch(58)=0
  421. Controller.Switch(60)=0
  422. End If
  423. End If
  424. End Sub
  425.  
  426. Sub FlipRA
  427. If Tilted=0 Then
  428. If Flips>0 Then
  429. RightFlipper.RotateToStart
  430. PlaySound SoundFX("FlipperDown",DOFFlippers)
  431. Controller.Switch(59)=0
  432. Else
  433. RightFlipper.RotateToStart
  434. Flipper2.RotateToStart
  435. PlaySound SoundFX("FlipperDown",DOFFlippers)
  436. Controller.Switch(59)=0
  437. Controller.Switch(61)=0
  438. End If
  439. End If
  440. End Sub
  441.  
  442. Sub Flip2LA
  443. If Tilted=0 Then
  444. Flipper1.RotateToStart
  445. PlaySound SoundFX("FlipperDown",DOFFlippers)
  446. Controller.Switch(60)=0
  447. End If
  448. End Sub
  449.  
  450. Sub Flip2RA
  451. If Tilted=0 Then
  452. Flipper2.RotateToStart
  453. PlaySound SoundFX("FlipperDown",DOFFlippers)
  454. Controller.Switch(61)=0
  455. End If
  456. End Sub
  457.  
  458. Sub Table1_KeyUp(ByVal KeyCode)
  459. If KeyCode=KeyFront Then
  460. Controller.Switch(57)=0
  461. Exit Sub
  462. End If
  463. If KeyCode=LeftFlipperKey Then FlipLA: OperatorMenuTimer.Enabled = false
  464. If KeyCode=RightFlipperKey Then FlipRA
  465. If KeyCode=LEFTMagnaSave Then Flip2LA
  466. If KeyCode=RIGHTMagnaSave Then Flip2RA
  467. If vpmKeyUp(KeyCode) Then Exit Sub
  468. End Sub
  469. '-----------------------------------
  470. ' Flipper Primitives
  471. '-----------------------------------
  472. sub FlipperTimer_Timer()
  473. pleftFlipper.rotz=leftFlipper.CurrentAngle
  474. prightFlipper.rotz=rightFlipper.CurrentAngle
  475. end sub
  476.  
  477. '******************************************
  478. '**********P2 auto flipper control Easy*********
  479. '******************************************
  480. Sub p2right_Hit
  481. if flips>1 then flip2r
  482.  
  483. End Sub
  484.  
  485. Sub p2left_Hit
  486. if flips>1 then Flip2L
  487.  
  488. End Sub
  489.  
  490. Sub p2center_Hit
  491. if flips>1 then
  492. flip2r
  493. flip2L
  494.  
  495. end If
  496. End Sub
  497.  
  498. Sub p2right_unHit
  499. if flips>1 then Flip2RA
  500.  
  501. End Sub
  502.  
  503. Sub p2left_unHit
  504. if flips>1 then Flip2LA
  505. End Sub
  506.  
  507. Sub p2center_unHit
  508. if flips>1 then
  509. Flip2RA
  510. Flip2LA
  511. end if
  512. End Sub
  513.  
  514.  
  515. '******************************************
  516. '**********PP2 auto flipper control Hard*********
  517. '******************************************
  518.  
  519. Sub Hard
  520. if flips>2 Then
  521. p2wall1.IsDropped = 1
  522. p2wall.isdropped = 0
  523. Else
  524. p2wall1.IsDropped = 1
  525. p2wall.isdropped = 1
  526. end if
  527. End Sub
  528.  
  529.  
  530.  
  531. Sub Outholep1_Hit:PlaySound "drain":bsTroughP1.AddBall Me:End Sub '9-13
  532. Sub P1K_Hit:bsP1.AddBall 0:End Sub '14
  533. Sub Switch15_Hit:bsEjectP1.AddBall Me:End Sub '15
  534. Sub Switch16_Spin:vpmTimer.PulseSw 16:End Sub '16
  535. Sub Sw17_Hit:dtA.Hit 1:End Sub '17
  536. Sub Sw18_Hit:dtC.Hit 1:End Sub '18
  537. Sub Switch19_Hit:Controller.Switch(19)=1:End Sub '19
  538. Sub Switch19_unHit:Controller.Switch(19)=0:End Sub
  539. Sub Switch20_Hit:Controller.Switch(20)=1:End Sub '20
  540. Sub Switch20_unHit:Controller.Switch(20)=0:End Sub
  541. Sub Switch21_Hit:vpmTimer.PulseSw 21:End Sub '21
  542. Sub Switch22_Hit:vpmTimer.PulseSw 22:End Sub '22
  543. Sub Sw23_Hit:dtR.Hit 1:End Sub '23
  544. Sub Sw24_Hit:dtR.Hit 2:End Sub '24
  545. Sub Sw25_Hit:dtR.Hit 3:End Sub '25
  546. Sub Sw26_Hit:dtL.Hit 1:End Sub '26
  547. Sub Sw27_Hit:dtL.Hit 2:End Sub '27
  548. Sub Sw28_Hit:dtL.Hit 3:End Sub '28
  549. Sub Switch31_Hit:Controller.Switch(31)=1:End Sub '31
  550. Sub Switch31_unHit:Controller.Switch(31)=0:End Sub
  551. Sub Outholep2_Hit:PlaySound "drain":bsTroughP2.AddBall Me:End Sub '33-37
  552. Sub P2K_Hit:bsP2.AddBall 0:End Sub '38
  553. Sub Switch39_Hit:bsEjectP2.AddBall Me:End Sub '39
  554. Sub Switch40_Spin:vpmTimer.PulseSw 40:End Sub '40
  555. Sub Switch41_Hit:dtB.Hit 1:End Sub '41
  556. Sub Switch42_Hit:dtD.Hit 1:End Sub '42
  557. Sub Switch43_Hit:Controller.Switch(43)=1:End Sub '43
  558. Sub Switch43_unHit:Controller.Switch(43)=0:End Sub
  559. Sub Switch44_Hit:Controller.Switch(44)=1:End Sub '44
  560. Sub Switch44_unHit:Controller.Switch(44)=0:End Sub
  561. Sub Switch45_Hit:vpmTimer.PulseSw 45:End Sub '45
  562. Sub Switch46_Hit:vpmTimer.PulseSw 46:End Sub '46
  563. Sub Sw47_Hit:dtR.Hit 4:End Sub '47
  564. Sub Sw48_Hit:dtR.Hit 5:End Sub '48
  565. Sub Sw49_Hit:dtR.Hit 6:End Sub '49
  566. Sub Sw50_Hit:dtL.Hit 4:End Sub '50
  567. Sub Sw51_Hit:dtL.Hit 5:End Sub '51
  568. Sub Swi52_Hit:dtL.Hit 6:End Sub '52
  569. Sub Switch55_Hit:Controller.Switch(55)=1:End Sub '55
  570. Sub Switch55_unHit:Controller.Switch(55)=0:End Sub
  571.  
  572.  
  573.  
  574.  
  575. '******GATES******
  576.  
  577. Sub timergate_Timer
  578. primitive54.rotz=gate3.CurrentAngle
  579. End Sub
  580.  
  581. Sub Gate3_hit
  582. PlaySound "Gate"
  583. End Sub
  584.  
  585.  
  586. Sub timergate1_Timer
  587. primitive56.rotz=gate4.CurrentAngle
  588. End Sub
  589.  
  590. Sub Gate4_hit
  591. PlaySound "Gate"
  592. End Sub
  593.  
  594.  
  595. Sub timergate2_Timer
  596. primitive58.rotz=gate5.CurrentAngle
  597. End Sub
  598.  
  599. Sub Gate5_hit
  600. PlaySound "Gate"
  601. End Sub
  602.  
  603.  
  604. Sub timergate3_Timer
  605. primitive61.rotz=gate6.CurrentAngle
  606. End Sub
  607.  
  608. Sub Gate6_hit
  609. PlaySound "Gate"
  610. End Sub
  611.  
  612.  
  613.  
  614. 'Sub timergate_Timer
  615. 'primitive56.rotz=gate4.CurrentAngle
  616. 'End Sub
  617.  
  618. 'Sub Gate4_hit : PlaySound "Gate" : End Sub
  619.  
  620.  
  621.  
  622.  
  623. '**********Sling Shot Animations
  624. ' Rstep and Lstep are the variables that increment the animation
  625. '****************
  626. Dim RStep, Lstep
  627.  
  628. Sub RightSlingShot_Slingshot
  629. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  630. vpmTimer.PulseSw 30
  631. RSling.Visible = 0
  632. RSling1.Visible = 1
  633. sling1.TransZ = -20
  634. RStep = 0
  635. RightSlingShot.TimerEnabled = 1
  636.  
  637. End Sub
  638.  
  639. Sub RightSlingShot_Timer
  640. Select Case RStep
  641. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  642. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0
  643. End Select
  644. RStep = RStep + 1
  645. End Sub
  646.  
  647. Sub RightSlingShot1_Slingshot
  648. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  649. vpmTimer.PulseSw 54
  650. RSling3.Visible = 0
  651. RSling4.Visible = 1
  652. sling4.TransZ = -20
  653. RStep = 0
  654. RightSlingShot1.TimerEnabled = 1
  655.  
  656. End Sub
  657.  
  658. Sub RightSlingShot1_Timer
  659. Select Case RStep
  660. Case 3:RSLing4.Visible = 0:RSLing5.Visible = 1:sling4.TransZ = -10
  661. Case 4:RSLing5.Visible = 0:RSLing3.Visible = 1:sling4.TransZ = 0:RightSlingShot1.TimerEnabled = 0
  662. End Select
  663. RStep = RStep + 1
  664. End Sub
  665.  
  666. Sub LeftSlingShot_Slingshot
  667. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  668. vpmTimer.PulseSw 29
  669. LSling.Visible = 0
  670. LSling1.Visible = 1
  671. sling2.TransZ = -20
  672. LStep = 0
  673. LeftSlingShot.TimerEnabled = 1
  674. End Sub
  675.  
  676. Sub LeftSlingShot_Timer
  677. Select Case LStep
  678. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  679. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  680. End Select
  681. LStep = LStep + 1
  682. End Sub
  683.  
  684. Sub LeftSlingShot1_Slingshot
  685. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  686. vpmTimer.PulseSw 53
  687. LSling5.Visible = 0
  688. LSling3.Visible = 1
  689. sling3.TransZ = -20
  690. LStep = 0
  691. LeftSlingShot1.TimerEnabled = 1
  692. End Sub
  693.  
  694. Sub LeftSlingShot1_Timer
  695. Select Case LStep
  696. Case 3:LSLing3.Visible = 0:LSLing4.Visible = 1:sling3.TransZ = -10
  697. Case 4:LSLing4.Visible = 0:LSLing5.Visible = 1:sling3.TransZ = 0:LeftSlingShot1.TimerEnabled = 0
  698. End Select
  699. LStep = LStep + 1
  700. End Sub
  701.  
  702.  
  703. Dim Tilted
  704. Tilted=0
  705.  
  706. Sub UpdateMultipleLamps
  707. If Controller.Lamp(1) Then
  708. Timer1.Enabled=0
  709. Timer1.Enabled=1
  710. End If
  711. If Not Timer1.Enabled And Not Controller.Lamp(3) Then
  712. Tilted=0
  713. Else
  714. Tilted=1
  715. Flipper1.RotateToStart
  716. Flipper2.RotateToStart
  717. LeftFlipper.RotateToStart
  718. RightFlipper.RotateToStart
  719. Controller.Switch(58)=0
  720. Controller.Switch(59)=0
  721. Controller.Switch(60)=0
  722. Controller.Switch(61)=0
  723. vpmNudge.SolGameOn False
  724. End If
  725. 'Wall54.IsDropped=Not Controller.Lamp(1)
  726. 'Wall56.IsDropped=Not Controller.Lamp(2)
  727. 'Wall55.IsDropped=Not Controller.Lamp(3)
  728. 'Wall57.IsDropped=Not Controller.Lamp(4)
  729. 'Wall58.IsDropped=Not Controller.Lamp(1)
  730. 'Wall60.IsDropped=Not Controller.Lamp(2)
  731. 'Wall59.IsDropped=Not Controller.Lamp(3)
  732. 'Wall61.IsDropped=Not Controller.Lamp(4)
  733. End Sub
  734.  
  735. Sub Timer1_Timer:Timer1.Enabled=0:Tilted=0:vpmNudge.SolGameOn True:End Sub
  736.  
  737. 'VpinMame Broken Display
  738. Dim Digits(31)
  739. Digits(8)=Array(L131,L132,L133,L134,L135,L136,L137)
  740. Digits(9)=Array(L138,L139,L140,L141,L142,L143,L144)
  741. Digits(12)=Array(L145,L146,L147,L148,L149,L150,L151)
  742. Digits(13)=Array(L152,L153,L154,L155,L156,L157,L158)
  743. Digits(14)=Array(L1,L2,L3,L4,L5,L6,L7,L8)
  744. Digits(15)=Array(L9,L10,L11,L12,L13,L14,L15)
  745. Digits(16)=Array(L16,L17,L18,L19,L20,L21,L22)
  746. Digits(17)=Array(L23,L24,L25,L26,L27,L28,L29,L30)
  747. Digits(18)=Array(L31,L32,L33,L34,L35,L36,L37)
  748. Digits(19)=Array(L38,L39,L40,L41,L42,L43,L44)
  749. Digits(20)=Array(L45,L46,L47,L48,L49,L50,L51)
  750. Digits(21)=Array(L52,L53,L54,L55,L56,L57,L58,L59)
  751. Digits(22)=Array(L60,L61,L62,L63,L64,L65,L66)
  752. Digits(23)=Array(L67,L68,L69,L70,L71,L72,L73)
  753. Digits(24)=Array(L74,L75,L76,L77,L78,L79,L80,L81)
  754. Digits(25)=Array(L82,L83,L84,L85,L86,L87,L88)
  755. Digits(26)=Array(L89,L90,L91,L92,L93,L94,L95)
  756. Digits(27)=Array(L96,L97,L98,L99,L100,L101,L102)
  757. Digits(28)=Array(L117,L118,L119,L120,L121,L122,L123)
  758. Digits(29)=Array(L124,L125,L126,L127,L128,L129,L130)
  759. Digits(30)=Array(L103,L104,L105,L106,L107,L108,L109)
  760. Digits(31)=Array(L110,L111,L112,L113,L114,L115,L116)
  761.  
  762.  
  763. Sub DisplayTimer_Timer
  764. Dim ChgLED,ii,num,chg,stat,obj
  765. ChgLED = Controller.ChangedLEDs(&HFFFFFFFF, &HFFFFFFFF) 'hex of binary (display 111111, or first 6 digits)
  766. If Not IsEmpty(ChgLED) Then
  767. For ii = 0 To UBound(chgLED)
  768. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  769. If Not IsEmpty(Digits(Num)) Then
  770. For Each obj In Digits(num)
  771. If chg And 1 Then obj.State = stat And 1
  772. chg = chg\2 : stat = stat\2
  773. Next
  774. End If
  775. Next
  776. End If
  777. End Sub
  778.  
  779.  
  780. '***********************************************
  781. '***********************************************
  782. ' Lamps
  783. '***********************************************
  784. '***********************************************
  785.  
  786.  
  787.  
  788. Dim LampState(200), FadingLevel(200), FadingState(200)
  789. Dim FlashState(200), FlashLevel(200)
  790. Dim FlashSpeedUp, FlashSpeedDown
  791. Dim x
  792.  
  793. AllLampsOff()
  794. LampTimer.Interval = 40 'lamp fading speed
  795. LampTimer.Enabled = 1
  796. '
  797. FlashInit()
  798. FlasherTimer.Interval = 10 'flash fading speed
  799. FlasherTimer.Enabled = 1
  800.  
  801. Sub LampTimer_Timer()
  802. Dim chgLamp, num, chg, ii
  803. chgLamp = Controller.ChangedLamps
  804. If Not IsEmpty(chgLamp) Then
  805. For ii = 0 To UBound(chgLamp)
  806. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
  807. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4
  808. FlashState(chgLamp(ii, 0) ) = chgLamp(ii, 1)
  809.  
  810. 'GI_CheckWalkerLights chgLamp(ii, 0), chgLamp(ii, 1)
  811. Next
  812. End If
  813.  
  814. UpdateLamps
  815. End Sub
  816.  
  817. Sub FlashInit
  818. Dim i
  819. For i = 0 to 200
  820. FlashState(i) = 0
  821. FlashLevel(i) = 0
  822. Next
  823.  
  824. FlashSpeedUp = 500 ' fast speed when turning on the flasher
  825. FlashSpeedDown = 250 ' slow speed when turning off the flasher, gives a smooth fading
  826. AllFlashOff()
  827. End Sub
  828.  
  829. Sub AllFlashOff
  830. Dim i
  831. For i = 0 to 200
  832. FlashState(i) = 0
  833. Next
  834. End Sub
  835.  
  836. Sub UpdateLamps()
  837.  
  838. 'NFadeLm 1, Light1a
  839. 'NFadeL 1, Light1
  840. 'NFadeLm 2, Light2a
  841. 'NFadeL 2, Light2
  842. 'NFadeLm 3, Light3a
  843. 'NFadeL 3, Light3
  844. 'NFadeLm 4, Light4a
  845. 'NFadeL 4, Light4
  846. NFadePm 5, p5, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  847. Flash 5, f5
  848. NFadePm 6, p6, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  849. Flash 6, f6
  850. NFadePm 7, p7, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  851. Flash 7, F7
  852. NFadePm 8, p8, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  853. Flash 8, F8
  854. NFadePm 9, p9, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  855. Flash 9, F9
  856. NFadePm 10, p10, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  857. Flash 10, F10
  858. NFadePm 11, p11, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  859. Flash 11, F11
  860. NFadePm 12, p12, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  861. Flash 12, F12
  862. NFadePm 13, p13, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  863. Flash 13, F13
  864. NFadePm 14, p14, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  865. Flash 14, F14
  866. NFadePm 15, p15, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  867. Flash 15, F15
  868. NFadePm 16, p16, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  869. Flash 16, F16
  870. NFadePm 17, p17, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  871. Flash 17, F17
  872. NFadePm 18, p18, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  873. Flash 18, F18
  874. NFadePm 19, p19, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  875. Flash 19, F19
  876. NFadePm 20, p20, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  877. Flash 20, F20
  878. NFadePm 21, p21, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  879. Flash 21, F21
  880. NFadePm 22, p22, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  881. Flash 22, F22
  882. NFadePm 23, p23, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  883. Flash 23, F23
  884. NFadePm 24, p24, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  885. Flash 24, F24
  886. NFadePm 25, p25, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  887. Flash 25, F25
  888. NFadePm 26, p26, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  889. Flash 26, F26
  890. NFadePm 27, p27, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  891. Flash 27, F27
  892. NFadePm 28, p28, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  893. Flash 28, F28
  894. NFadePm 29, p29, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  895. Flash 29, F29
  896. NFadePm 30, p30, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  897. Flash 30, F30
  898. NFadePm 31, p31, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  899. Flash 31, F31
  900. NFadePm 32, p32, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  901. Flash 32, F32
  902. NFadePm 33, p33, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  903. Flash 33, F33
  904. NFadePm 34, p34, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  905. Flash 34, F34
  906. NFadePm 35, p35, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  907. Flash 35, F35
  908. NFadePm 36, p36, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  909. Flash 36, F36
  910. NFadePm 37, p37, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  911. Flash 37, F37
  912. NFadePm 38, p38, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  913. Flash 38, F38
  914. NFadePm 39, p39, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  915. Flash 39, F39
  916. NFadePm 40, p40, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  917. Flash 40, F40
  918. NFadePm 41, p41, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  919. Flash 41, F41
  920. NFadePm 42, p42, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  921. Flash 42, F42
  922. NFadePm 43, p43, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  923. Flash 43, F43
  924. NFadePm 44, p44, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  925. Flash 44, F44
  926. NFadePm 45, p45, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  927. Flash 45, F45
  928. NFadePm 46, p46, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  929. Flash 46, F46
  930. NFadePm 47, p47, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  931. Flash 47, F47
  932. NFadePm 48, p48, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  933. Flash 48, F48
  934. NFadePm 49, p49, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  935. Flash 49, F49
  936. NFadePm 50, p50, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  937. Flash 50, F50
  938. NFadePm 51, p51, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  939. Flash 51, F51
  940. NFadePm 52, p52, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  941. Flash 52, F52
  942. NFadePm 53, p53, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  943. Flash 53, F53
  944. NFadePm 54, p54, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  945. Flash 54, F54
  946. NFadePm 55, p55, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  947. Flash 55, F55
  948. NFadePm 56, p56, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  949. Flash 56, F56
  950. NFadePm 57, p57, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  951. Flash 57, F57
  952. NFadePm 58, p58, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  953. Flash 58, F58
  954. NFadePm 59, p59, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  955. Flash 59, F59
  956. NFadePm 60, p60, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  957. Flash 60, F60
  958. NFadePm 61, p61, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  959. Flash 61, F61
  960. NFadePm 62, p62, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  961. Flash 62, F62
  962. NFadePm 63, p63, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  963. Flash 63, F63
  964. NFadePm 64, p64, "JoustPlayfield-ON", "JoustPlayfield-OFF"
  965. Flash 64, F64
  966.  
  967. End Sub
  968.  
  969. Sub FadePrim(nr, pri, a, b, c, d)
  970. Select Case FadingLevel(nr)
  971. Case 2:pri.image = d:FadingLevel(nr) = 0
  972. Case 3:pri.image = c:FadingLevel(nr) = 1
  973. Case 4:pri.image = b:FadingLevel(nr) = 2
  974. Case 5:pri.image = a:FadingLevel(nr) = 3
  975. End Select
  976. End Sub
  977.  
  978. ''Lights
  979.  
  980. Sub NFadeL(nr, a)
  981. Select Case FadingLevel(nr)
  982. Case 4:a.state = 0:FadingLevel(nr) = 0
  983. Case 5:a.State = 1:FadingLevel(nr) = 1
  984. End Select
  985. End Sub
  986.  
  987. Sub NFadeLm(nr, a)
  988. Select Case FadingLevel(nr)
  989. Case 4:a.state = 0
  990. Case 5:a.State = 1
  991. End Select
  992. End Sub
  993.  
  994. Sub NFadeP(nr, a, b, c)
  995. Select Case FadingLevel(nr)
  996. Case 4:a.image = c:FadingLevel(nr) = 0
  997. Case 5:a.image = b:FadingLevel(nr) = 1
  998. End Select
  999. End Sub
  1000.  
  1001. Sub NFadePm(nr, a, b, c)
  1002. Select Case FadingLevel(nr)
  1003. Case 4:a.image = c
  1004. Case 5:a.image = b
  1005. End Select
  1006. End Sub
  1007.  
  1008. Sub Flash(nr, object)
  1009. Select Case FlashState(nr)
  1010. Case 0 'off
  1011. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown
  1012. If FlashLevel(nr) < 0 Then
  1013. FlashLevel(nr) = 0
  1014. FlashState(nr) = -1 'completely off
  1015. End if
  1016. Object.opacity = FlashLevel(nr)
  1017. Case 1 ' on
  1018. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp
  1019. If FlashLevel(nr) > 1000 Then
  1020. FlashLevel(nr) = 1000
  1021. FlashState(nr) = -2 'completely on
  1022. End if
  1023. Object.opacity = FlashLevel(nr)
  1024. End Select
  1025. End Sub
  1026.  
  1027. Sub Flashm(nr, object) 'multiple flashers, it doesn't change the flashstate
  1028. Select Case FlashState(nr)
  1029. Case 0 'off
  1030. Object.opacity = FlashLevel(nr)
  1031. Case 1 ' on
  1032. Object.opacity = FlashLevel(nr)
  1033. End Select
  1034. End Sub
  1035.  
  1036. Sub AllLampsOff():For x = 1 to 200:LampState(x) = 4:FadingLevel(x) = 4:Next:UpdateLamps:UpdateLamps:Updatelamps:End Sub
  1037.  
  1038.  
  1039. Sub SetLamp(nr, value)
  1040. If value = 0 AND LampState(nr) = 0 Then Exit Sub
  1041. If value = 1 AND LampState(nr) = 1 Then Exit Sub
  1042. LampState(nr) = abs(value) + 4
  1043. FadingLevel(nr ) = abs(value) + 4: FadingState(nr ) = abs(value) + 4
  1044. End Sub
  1045.  
  1046. Sub SetFlash(nr, stat)
  1047. FlashState(nr) = ABS(stat)
  1048. End Sub
  1049.  
  1050.  
  1051.  
  1052. '********FLASHERS*********
  1053.  
  1054.  
  1055. Sub FlasherTimer_Timer()
  1056. '
  1057. 'Flash 1, 1
  1058. Flashm 1, f1a
  1059. Flash 1, f1
  1060. Flashm 2, f2a
  1061. Flash 2, f2
  1062. Flashm 3, f3a
  1063. Flash 3, f3
  1064. Flashm 4, f4a
  1065. Flash 4, f4
  1066. 'Flash 5, f5
  1067. 'Flash 6, f6
  1068. 'Flash 7, f7
  1069. 'Flash 8, f8
  1070. 'Flash 9, f9
  1071. 'Flash 10, f10
  1072. 'Flash 11, f11
  1073. 'Flash 12, f12
  1074. 'Flash 13, f13
  1075. 'Flash 14, f14
  1076. 'Flash 15, f15
  1077. 'Flash 16, f16
  1078. 'Flash 17, f17
  1079. 'Flash 18, f18
  1080. 'Flash 19, f19
  1081. 'Flash 20, f20
  1082. 'Flash 21, f21
  1083. 'Flash 22, f22
  1084. 'Flash 23, f23
  1085. 'Flash 24, f24
  1086. 'Flash 25, f25
  1087. 'Flash 26, f26
  1088. 'Flash 27, f27
  1089. 'Flash 28, f28
  1090. 'Flash 29, f29
  1091. 'Flash 30, f30
  1092. 'Flash 31, f31
  1093. 'Flash 32, f32
  1094. 'Flash 33, f33
  1095. 'Flash 34, f34
  1096. 'Flash 35, f35
  1097. 'Flash 36, f36
  1098. 'Flash 37, f37
  1099. 'Flash 38, f38
  1100. 'Flash 39, f39
  1101. 'Flash 40, f40
  1102. 'Flash 41, f41
  1103. 'Flash 42, f42
  1104. 'Flash 43, f43
  1105. 'Flash 44, f44
  1106. 'Flash 45, f45
  1107. 'Flash 46, f46
  1108. 'Flash 47, f47
  1109. 'Flash 48, f48
  1110. 'Flash 49, f49
  1111. 'Flash 50, f50
  1112. 'Flash 51, f51
  1113. 'Flash 52, f52
  1114. 'Flash 53, f53
  1115. 'Flash 54, f54
  1116. 'Flash 55, f55
  1117. 'Flash 56, f56
  1118. 'Flash 57, f57
  1119. 'Flash 58, f58
  1120. 'Flash 59, f59
  1121. 'Flash 60, f60
  1122. 'Flash 61, f61
  1123. 'Flash 62, f62
  1124. 'Flash 63, f63
  1125. 'Flash 64, f64
  1126.  
  1127. End Sub
  1128.  
  1129.  
  1130.  
  1131. ' *********************************************************************
  1132. ' Supporting Ball & Sound Functions
  1133. ' *********************************************************************
  1134.  
  1135. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1136. Vol = Csng(BallVel(ball) ^20 / 2000)
  1137. End Function
  1138.  
  1139. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  1140. Dim tmp
  1141. tmp = ball.x * 2 / table1.width-1
  1142. If tmp > 0 Then
  1143. Pan = Csng(tmp ^10)
  1144. Else
  1145. Pan = Csng(-((- tmp) ^10) )
  1146. End If
  1147. End Function
  1148.  
  1149. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1150. Pitch = BallVel(ball) * 20
  1151. End Function
  1152.  
  1153. Function BallVel(ball) 'Calculates the ball speed
  1154. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1155. End Function
  1156.  
  1157. '*****************************************
  1158. ' JP's VP10 Rolling Sounds
  1159. '*****************************************
  1160.  
  1161. Const tnob = 5 ' total number of balls
  1162. ReDim rolling(tnob)
  1163. InitRolling
  1164.  
  1165. Sub InitRolling
  1166. Dim i
  1167. For i = 0 to tnob
  1168. rolling(i) = False
  1169. Next
  1170. End Sub
  1171.  
  1172. Sub RollingTimer_Timer()
  1173.  
  1174. Dim BOT, b
  1175. BOT = GetBalls
  1176.  
  1177. ' stop the sound of deleted balls
  1178. For b = UBound(BOT) + 1 to tnob
  1179. rolling(b) = False
  1180. StopSound("fx_ballrolling" & b)
  1181. Next
  1182.  
  1183. ' exit the sub if no balls on the table
  1184. If UBound(BOT) = -1 Then Exit Sub
  1185.  
  1186. ' play the rolling sound for each ball
  1187. For b = 0 to UBound(BOT)
  1188. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 100 Then
  1189. rolling(b) = True
  1190. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1191. Else
  1192. If rolling(b) = True Then
  1193. StopSound("fx_ballrolling" & b)
  1194. rolling(b) = False
  1195. End If
  1196. End If
  1197. Next
  1198. End Sub
  1199.  
  1200. '**********************
  1201. ' Ball Collision Sound
  1202. '**********************
  1203.  
  1204. Sub OnBallBallCollision(ball1, ball2, velocity)
  1205. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  1206. End Sub
  1207.  
  1208.  
  1209.  
  1210. '************************************
  1211. ' What you need to add to your table
  1212. '************************************
  1213.  
  1214. ' a timer called RollingTimer. With a fast interval, like 10
  1215. ' one collision sound, in this script is called fx_collide
  1216. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  1217. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  1218.  
  1219.  
  1220. '******************************************
  1221. ' Explanation of the rolling sound routine
  1222. '******************************************
  1223.  
  1224. ' sounds are played based on the ball speed and position
  1225.  
  1226. ' the routine checks first for deleted balls and stops the rolling sound.
  1227.  
  1228. ' The For loop goes through all the balls on the table and checks for the ball speed and
  1229. ' if the ball is on the table (height lower than 30) then then it plays the sound
  1230. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  1231.  
  1232. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  1233. ' will change according to the ball speed, and the PAN function will change the stereo position according
  1234. ' to the position of the ball on the table.
  1235.  
  1236.  
  1237. '**************************************
  1238. ' Explanation of the collision routine
  1239. '**************************************
  1240.  
  1241. ' The collision is built in VP.
  1242. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  1243. ' 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
  1244. ' depending of the speed of the collision.
  1245.  
  1246.  
  1247. Sub Pins_Hit (idx)
  1248. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  1249. End Sub
  1250.  
  1251. Sub Targets_Hit (idx)
  1252. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  1253. End Sub
  1254.  
  1255. Sub Metals_Thin_Hit (idx)
  1256. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1257. End Sub
  1258.  
  1259. Sub Metals_Medium_Hit (idx)
  1260. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1261. End Sub
  1262.  
  1263. Sub Metals2_Hit (idx)
  1264. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1265. End Sub
  1266.  
  1267. Sub Gates_Hit (idx)
  1268. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1269. End Sub
  1270.  
  1271. Sub Spinner_Spin
  1272. PlaySound "fx_spinner",0,.25,0,0.25
  1273. End Sub
  1274.  
  1275. Sub Rubbers_Hit(idx)
  1276. dim finalspeed
  1277. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1278. If finalspeed > 20 then
  1279. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1280. End if
  1281. If finalspeed >= 6 AND finalspeed <= 20 then
  1282. RandomSoundRubber()
  1283. End If
  1284. End Sub
  1285.  
  1286. Sub Posts_Hit(idx)
  1287. dim finalspeed
  1288. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1289. If finalspeed > 16 then
  1290. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1291. End if
  1292. If finalspeed >= 6 AND finalspeed <= 16 then
  1293. RandomSoundRubber()
  1294. End If
  1295. End Sub
  1296.  
  1297. Sub RandomSoundRubber()
  1298. Select Case Int(Rnd*3)+1
  1299. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1300. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1301. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1302. End Select
  1303. End Sub
  1304.  
  1305. Sub LeftFlipper_Collide(parm)
  1306. RandomSoundFlipper()
  1307. End Sub
  1308.  
  1309. Sub RightFlipper_Collide(parm)
  1310. RandomSoundFlipper()
  1311. End Sub
  1312.  
  1313. Sub RandomSoundFlipper()
  1314. Select Case Int(Rnd*3)+1
  1315. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1316. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1317. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  1318. End Select
  1319. End Sub
  1320.  
  1321.  
  1322. Sub Table1_Exit
  1323. Controller.Stop
  1324. End Sub
Advertisement
Add Comment
Please, Sign In to add comment