Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.98 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. Dim Ballsize,BallMass
  5. Ballsize = 50
  6. BallMass = 1.2
  7.  
  8. On Error Resume Next
  9. ExecuteGlobal GetTextFile("controller.vbs")
  10. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  11. On Error Goto 0
  12.  
  13. Const cGameName="sopranos",UseSolenoids=1,UseLamps=0,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff", SCoin="coin"
  14.  
  15. LoadVPM "01560000", "sega.VBS", 3.10
  16.  
  17. Dim DesktopMode: DesktopMode = Table1.ShowDT
  18. If DesktopMode = True Then 'Show Desktop components
  19. Ramp16.visible=1
  20. Ramp15.visible=1
  21. Primitive13.visible=1
  22. Else
  23. Ramp16.visible=0
  24. Ramp15.visible=0
  25. Primitive13.visible=0
  26. End if
  27.  
  28. Const RomSounds = 1 '1 - use the sounds from the rom, 0 - use sampled sounds (if the rom sounds like shit) (it probably does)
  29.  
  30. '*************************************************************
  31. 'Solenoid Call backs
  32. '**********************************************************************************************************
  33.  
  34. SolCallback(1) = "solTrough"
  35. SolCallback(2) = "solAutofire"
  36. SolCallback(3) = "bsTEject.SolOut"
  37. SolCallback(4) = "SolCenterLock"
  38. SolCallBack(5) = "SolGateL"
  39. SolCallBack(6) = "SolGateR"
  40. SolCallback(7) = "dtSingle.SolHit 1,"
  41. SolCallback(8) = "SolSafe"
  42. SolCallback(14) = "dtSingle.SolDropUp"
  43. SolCallback(17) = "SolFish"
  44. SolCallback(18) = "Strippers"
  45. SolCallBack(21) = "bsRScoop.SolOut"
  46. SolCallback(22) = "SolBoatLock"
  47. SolCallback(23) = "SolBingLock"
  48. SolCallback(30) = "SolSafeLatch"
  49.  
  50. SolCallback(19) = "SetLamp 119," 'PF light
  51. SolCallback(20) = "SetLamp 120," 'PF light
  52. SolCallback(25) = "SetLamp 125," 'Fish eyes
  53. SolCallback(26) = "SetLamp 126," 'stage Yellow Dome
  54. SolCallback(27) = "SetLamp 127," 'left sling Yellow Dome
  55. SolCallback(28) = "SetLamp 128," 'right sling Yellow Dome
  56. SolCallback(29) = "SetLamp 129," 'pop bumper Red Dome X2
  57. SolCallback(31) = "SetLamp 131," 'right spotlight
  58. SolCallback(32) = "SetLamp 132,"
  59.  
  60. SolCallback(sLRFlipper) = "SolRFlipper"
  61. SolCallback(sLLFlipper) = "SolLFlipper"
  62.  
  63. Sub SolLFlipper(Enabled)
  64. If Enabled Then
  65. PlaySound SoundFX("fx_Flipperup",DOFContactors):LeftFlipper.RotateToEnd
  66. Else
  67. PlaySound SoundFX("fx_Flipperdown",DOFContactors):LeftFlipper.RotateToStart
  68. End If
  69. End Sub
  70.  
  71. Sub SolRFlipper(Enabled)
  72. If Enabled Then
  73. PlaySound SoundFX("fx_Flipperup",DOFContactors):RightFlipper.RotateToEnd
  74. Else
  75. PlaySound SoundFX("fx_Flipperdown",DOFContactors):RightFlipper.RotateToStart
  76. End If
  77. End Sub
  78. '**********************************************************************************************************
  79.  
  80. 'Solenoid Controlled toys
  81. '**********************************************************************************************************
  82.  
  83. Sub solTrough(Enabled)
  84. If Enabled Then
  85. bsTrough.ExitSol_On
  86. vpmTimer.PulseSw 22
  87. End If
  88. End Sub
  89.  
  90. Sub solAutofire(Enabled)
  91. If Enabled Then
  92. PlungerIM.AutoFire
  93. End If
  94. End Sub
  95.  
  96. Sub SolCenterLock(Enabled)
  97. If Enabled Then
  98. CenterPost.IsDropped = 1
  99. CenterPin.transy =-40
  100. playsound SoundFX("Popper",DOFContactors)
  101. Else
  102. CenterPost.IsDropped = 0
  103. CenterPin.transy = 0
  104. End If
  105. End Sub
  106.  
  107. Sub SolGateL(Enabled)
  108. If Enabled then
  109. sol5.Open=1
  110. playsound"Diverter"
  111. Else
  112. sol5.Open=0
  113. End If
  114. End Sub
  115.  
  116. Sub SolGateR(Enabled)
  117. If Enabled then
  118. sol6.Open=1
  119. playsound"Diverter"
  120. Else
  121. sol6.Open=0
  122. End If
  123. End Sub
  124.  
  125. Sub SolFish(Enabled)
  126. If Enabled then
  127. fishf.RotateToEnd
  128. playsound"Diverter"
  129. Else
  130. fishf.RotateToStart
  131. End If
  132. End Sub
  133.  
  134. Sub SolBoatLock(Enabled)
  135. If Enabled Then
  136. BoatPost.IsDropped = 1 'Drop the post
  137. BoatPin.transy =-80
  138. playsound SoundFX("Popper",DOFContactors)
  139. Else
  140. BoatPost.IsDropped = 0
  141. BoatPin.transy = 0
  142. End If
  143. End Sub
  144.  
  145. Sub SolBingLock(Enabled)
  146. If Enabled Then
  147. BingPost.IsDropped = 1 'Drop the post
  148. playsound SoundFX("Popper",DOFContactors)
  149. Else
  150. BingPost.IsDropped = 0
  151. End If
  152. End Sub
  153.  
  154. 'Stripper animation
  155. '**********************************************************************************************************
  156. Sub Strippers(Enabled)
  157. If Enabled Then
  158. strippert.Enabled = 1
  159. Else
  160. strippert.Enabled = 0
  161. End If
  162. End Sub
  163.  
  164. Sub strippert_Timer
  165. stripper2.objrotz = stripper2.objrotz + .5
  166. stripper1.objrotz = stripper1.objrotz - .5
  167. stripper1s.objrotz = stripper1.objrotz
  168. stripper2s.objrotz = stripper2.objrotz
  169. End Sub
  170.  
  171. '**********************************************************************************************************
  172.  
  173. 'Safe animation
  174. '**********************************************************************************************************
  175. Sub SolSafe(Enabled)
  176. If Latch = 1 Then
  177. prisonstate = false
  178. Exit Sub
  179. End If
  180. If Enabled Then
  181. prisonstate = false
  182. Else 'this means if the solenoid is NOT enabled
  183. prisonstate = true
  184. End If
  185. PrisonT.Enabled=true
  186. End Sub
  187.  
  188. Dim Latch
  189.  
  190. Sub SolSafeLatch(Enabled)
  191. If Enabled Then
  192. Latch = 1
  193. Else
  194. Latch = 0
  195. End If
  196. End Sub
  197.  
  198. Dim SafePos2
  199. SafePos2 = 0
  200.  
  201. Dim prisonstate
  202. prisonstate = False
  203. Sub PrisonT_Timer()
  204. If prisonstate = True then 'Opening
  205. If sw21p.RotX <= 22 then
  206. sw21p.RotX = sw21p.RotX + 2
  207. sw24p.RotX = sw24p.RotX - 2
  208. sw21p.Z = sw21p.Z + 6
  209. sw24p.Z = sw24p.Z + 6
  210. Else
  211. PrisonT.Enabled = False
  212. Controller.Switch(10) = 1
  213. End If
  214. sw21.isdropped = true
  215. sw24.isdropped = true
  216. Wall25.isdropped = false
  217. Else 'Closing
  218. If sw21p.RotX => 2 then
  219. sw21p.RotX = sw21p.RotX - 2
  220. sw24p.RotX = sw24p.RotX + 2
  221. sw21p.Z = sw21p.Z - 6
  222. sw24p.Z = sw24p.Z - 6
  223. Else
  224. PrisonT.Enabled = False
  225. Controller.Switch(10) = 0
  226. End If
  227. sw21.isdropped = false
  228. sw24.isdropped = false
  229. Wall25.isdropped = true
  230. End If
  231. End Sub
  232. '**********************************************************************************************************
  233.  
  234. 'Stern-Sega GI
  235. set GICallback = GetRef("UpdateGI")
  236.  
  237. Sub UpdateGI(no, Enabled)
  238. If Enabled Then
  239. dim xx
  240. For each xx in GI:xx.State = 1: Next
  241. PlaySound "fx_relay"
  242. Else
  243. For each xx in GI:xx.State = 0: Next
  244. PlaySound "fx_relay"
  245. End If
  246. End Sub
  247.  
  248. '**********************************************************************************************************
  249. 'Initiate Table
  250. '**********************************************************************************************************
  251.  
  252. Dim bsTrough, bsTEject, bsRScoop, dtSingle
  253.  
  254. Sub Table1_Init
  255. vpmInit Me
  256. On Error Resume Next
  257. With Controller
  258. .GameName = cGameName
  259. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  260. .SplashInfoLine = "The Sopranos (Stern 2005)"&chr(13)&"You Suck"
  261. .HandleMechanics=0
  262. .HandleKeyboard=0
  263. .ShowDMDOnly=1
  264. .ShowFrame=0
  265. .ShowTitle=0
  266. .hidden = 0
  267. .Games(cGameName).Settings.Value("sound") = RomSounds
  268. On Error Resume Next
  269. .Run GetPlayerHWnd
  270. If Err Then MsgBox Err.Description
  271. On Error Goto 0
  272. End With
  273. On Error Goto 0
  274.  
  275. PinMAMETimer.Interval = PinMAMEInterval
  276. PinMAMETimer.Enabled = 1
  277. vpmNudge.TiltSwitch = -7
  278. vpmNudge.Sensitivity = 3
  279. vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
  280.  
  281. Set bsTrough = New cvpmBallStack
  282. bsTrough.InitSw 0, 14, 13, 12, 11, 0, 0, 0
  283. bsTrough.InitKick BallRelease, 90, 7.5
  284. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  285. bsTrough.Balls = 4
  286.  
  287. Set bsTEject = new cvpmBallStack
  288. bsTEject.InitSaucer sw28, 28, 20, 24
  289. bsTEject.KickZ = 1
  290. bsTEject.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  291.  
  292. Set bsRScoop=New cvpmBallStack
  293. bsRScoop.InitSaucer sw17, 17, 180, 10
  294. 'bsRScoop.KickZ = 1
  295. bsRScoop.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  296.  
  297. set dtSingle=new cvpmDropTarget
  298. dtSingle.InitDrop sw26,26
  299. dtSingle.InitSnd SoundFX("DTDrop",DOFContactors),SoundFX("DTReset",DOFContactors)
  300.  
  301. End Sub
  302.  
  303. '**********************************************************************************************************
  304. 'Plunger code
  305. '**********************************************************************************************************
  306.  
  307. Sub Table1_KeyDown(ByVal KeyCode)
  308. If KeyDownHandler(keycode) Then Exit Sub
  309. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  310. If Keycode = StartGameKey Then Controller.Switch(16) = 1
  311. End Sub
  312.  
  313. Sub Table1_KeyUp(ByVal KeyCode)
  314. If KeyUpHandler(keycode) Then Exit Sub
  315. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  316. If Keycode = StartGameKey Then Controller.Switch(16) = 0
  317. End Sub
  318.  
  319. Dim PlungerIM
  320. Const IMPowerSetting = 50
  321. Const IMTime = 0.6
  322. Set plungerIM = New cvpmImpulseP
  323. With plungerIM
  324. .InitImpulseP swplunger, IMPowerSetting, IMTime
  325. .Random 0.3
  326. .Switch 16
  327. .InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  328. .CreateEvents "plungerIM"
  329. End With
  330.  
  331. '**********************************************************************************************************
  332.  
  333. ' Drain hole and kickers
  334. Sub Drain_Hit:bsTrough.addball me : playsound"drain" : End Sub
  335. Sub sw17_Hit:bsRScoop.AddBall Me : playsound "popper_ball": End Sub
  336. Sub sw28_Hit:bsTEject.AddBall 0 : playsound "popper_ball": End Sub
  337.  
  338. 'Drop Targets
  339. Sub sw26_Dropped:dtSingle.Hit 1:End Sub
  340.  
  341. 'Bing Ramp Triggers
  342. Sub sw19_Hit : Controller.Switch(19) = 1 : playsound"rollover" : End Sub
  343. Sub sw19_UnHit: Controller.Switch(19) = 0: End Sub
  344. Sub sw20_Hit : Controller.Switch(20) = 1 : playsound"rollover" : End Sub
  345. Sub sw20_UnHit: Controller.Switch(20) = 0: End Sub
  346.  
  347. 'Boat Hidden Triggers
  348. Sub sw31_Hit : Controller.Switch(31) = 1: End Sub
  349. Sub sw31_UnHit: Controller.Switch(31) = 0: End Sub
  350. Sub sw32_Hit : Controller.Switch(32) = 1: End Sub
  351. Sub sw32_UnHit: Controller.Switch(32) = 0: End Sub
  352.  
  353. 'SafeHouse Primitive
  354. Sub sw21_Hit : vpmTimer.PulseSw 21:sw21.TimerEnabled = 1:sw21p.TransX = -4: playsound"Target": End Sub
  355. Sub sw21_Timer:Me.TimerEnabled = 0:sw21p.TransX = 0:End Sub
  356. Sub sw24_Hit : vpmTimer.PulseSw 24:sw24.TimerEnabled = 1:sw24p.TransX = -4: playsound"Target": End Sub
  357. Sub sw24_Timer:Me.TimerEnabled = 0:sw24p.TransX = 0:End Sub
  358.  
  359. 'Center Pin Lock
  360. Sub sw22_Hit:Controller.Switch(22) = 1:End Sub
  361. Sub sw22_UnHit:Controller.Switch(22) = 0:End Sub
  362. Sub sw23_Hit:Controller.Switch(23) = 1:End Sub
  363. Sub sw23_UnHit:Controller.Switch(23) = 0:End Sub
  364.  
  365. 'Gate Triggers
  366. Sub sw9_Hit: vpmTimer.PulseSw 9: End Sub
  367. Sub sw18_Hit: vpmTimer.PulseSw 18: End Sub
  368. Sub sw29_Hit: vpmTimer.PulseSw 29: End Sub
  369. Sub sw33_Hit: vpmTimer.PulseSw 33: End Sub
  370.  
  371. 'Spinners
  372. Sub sw25_Spin:vpmTimer.PulseSw 25 : playsound"fx_spinner" : End Sub
  373. Sub sw27_Spin:vpmTimer.PulseSw 27 : playsound"fx_spinner" : End Sub
  374.  
  375. 'Wire Triggers
  376. Sub sw38_Hit : Controller.Switch(38) = 1 : playsound"rollover" : End Sub
  377. Sub sw38_UnHit: Controller.Switch(38) = 0: End Sub
  378. Sub sw39_Hit : Controller.Switch(39) = 1 : playsound"rollover" : End Sub
  379. Sub sw39_UnHit: Controller.Switch(39) = 0: End Sub
  380. Sub sw40_Hit : Controller.Switch(40) = 1 : playsound"rollover" : End Sub
  381. Sub sw40_UnHit: Controller.Switch(40) = 0: End Sub
  382. Sub sw57_Hit : Controller.Switch(57) = 1 : playsound"rollover" : End Sub
  383. Sub sw57_UnHit: Controller.Switch(57) = 0: End Sub
  384. Sub sw58_Hit : Controller.Switch(58) = 1 : playsound"rollover" : End Sub
  385. Sub sw58_UnHit: Controller.Switch(58) = 0: End Sub
  386. Sub sw60_Hit : Controller.Switch(60) = 1 : playsound"rollover" : End Sub
  387. Sub sw60_UnHit: Controller.Switch(60) = 0: End Sub
  388. Sub sw61_Hit : Controller.Switch(61) = 1 : playsound"rollover" : End Sub
  389. Sub sw61_UnHit: Controller.Switch(61) = 0: End Sub
  390.  
  391. 'StandUp Targets
  392. Sub sw34_Hit : vpmTimer.PulseSw 34: End Sub
  393. Sub sw35_Hit : vpmTimer.PulseSw 35: End Sub
  394. Sub sw36_Hit : vpmTimer.PulseSw 36: End Sub
  395. Sub sw37_Hit : vpmTimer.PulseSw 37: End Sub
  396.  
  397. 'Bumpers
  398. Sub Bumper1_Hit : vpmTimer.PulseSw(49) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  399. Sub Bumper2_Hit : vpmTimer.PulseSw(50) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  400. Sub Bumper3_Hit : vpmTimer.PulseSw(51) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  401.  
  402. 'Generic Sounds
  403. Sub Trigger1_Hit : playsound"fx_ballrampdrop" : End Sub
  404. Sub Trigger2_Hit : playsound"fx_ballrampdrop" : End Sub
  405. Sub Trigger3_Hit : playsound"fx_ballrampdrop" : End Sub
  406.  
  407. Sub Trigger4_Hit : playsound"Wire Ramp" : End Sub
  408. Sub Trigger5_Hit : playsound"Wire Ramp" : End Sub
  409.  
  410. '***************************************************
  411. ' JP's VP10 Fading Lamps & Flashers
  412. ' Based on PD's Fading Light System
  413. ' SetLamp 0 is Off
  414. ' SetLamp 1 is On
  415. ' fading for non opacity objects is 4 steps
  416. '***************************************************
  417.  
  418. Dim LampState(200), FadingLevel(200)
  419. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  420.  
  421. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  422. LampTimer.Interval = 5 'lamp fading speed
  423. LampTimer.Enabled = 1
  424.  
  425. ' Lamp & Flasher Timers
  426.  
  427. Sub LampTimer_Timer()
  428. Dim chgLamp, num, chg, ii
  429. chgLamp = Controller.ChangedLamps
  430. If Not IsEmpty(chgLamp) Then
  431. For ii = 0 To UBound(chgLamp)
  432. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  433. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  434. Next
  435. End If
  436. UpdateLamps
  437. End Sub
  438.  
  439. Sub UpdateLamps()
  440. NFadeL 1, l1
  441. NFadeL 2, l2
  442. NFadeL 3, l3
  443. NFadeL 4, l4
  444. NFadeL 5, l5
  445. NFadeL 6, l6
  446. NFadeL 7, l7
  447. NFadeL 8, l8
  448. NFadeL 9, l9
  449. NFadeL 10, l10
  450. NFadeL 11, l11
  451. NFadeL 12, l12
  452. NFadeL 13, l13
  453. NFadeL 14, l14
  454. NFadeL 15, l15
  455. NFadeL 16, l16
  456. NFadeL 17, l17
  457. NFadeL 18, l18
  458. NFadeL 19, l19
  459. NFadeL 20, l20
  460. NFadeL 21, l21
  461. NFadeL 22, l22
  462. NFadeL 23, l23
  463. NFadeL 24, l24
  464. NFadeL 25, l25
  465. NFadeL 26, l26
  466. NFadeL 27, l27
  467. NFadeL 28, l28
  468. NFadeL 29, l29
  469. NFadeL 30, l30
  470. NFadeL 31, l31
  471. NFadeL 32, l32
  472. NFadeL 33, l33
  473. NFadeL 34, l34
  474. NFadeL 35, l35
  475. NFadeL 36, l36
  476. NFadeL 37, l37
  477. NFadeL 38, l38
  478. NFadeL 39, l39
  479. NFadeL 40, l40
  480. NFadeL 41, l41
  481. NFadeL 42, l42
  482. NFadeL 43, l43
  483. NFadeL 44, l44
  484. NFadeL 45, l45
  485. NFadeL 46, l46
  486. NFadeL 47, l47
  487. NFadeL 48, l48
  488. NFadeL 49, l49
  489. NFadeL 50, l50
  490. NFadeL 51, l51
  491. NFadeL 52, l52
  492. NFadeL 53, l53
  493. NFadeL 54, l54
  494. NFadeL 55, l55
  495. NFadeL 56, l56
  496. NFadeL 57, l57
  497. NFadeL 58, l58
  498. NFadeL 59, l59
  499. NFadeL 60, l60
  500. NFadeL 61, l61
  501. ' NFadeL 62, l62
  502. ' NFadeL 63, l63
  503. ' NFadeL 64, l64
  504.  
  505. 'BackWall Lights
  506. Flash 65, l65
  507. Flash 66, l66
  508. Flash 67, l67
  509. Flash 68, l68
  510. Flash 69, l69
  511. Flash 70, l70
  512. Flash 71, l71
  513. Flash 72, l72
  514.  
  515. 'Stand Up Board
  516. NFadeObjm 73, l73, "bulbcover1_yellowOn", "bulbcover1_yellow"
  517. Flash 73, F73
  518. NFadeObjm 74, l74, "bulbcover1_yellowOn", "bulbcover1_yellow"
  519. Flash 74, F74
  520. NFadeObjm 75, l75, "bulbcover1_yellowOn", "bulbcover1_yellow"
  521. Flash 75, F75
  522. NFadeObjm 76, l76, "bulbcover1_yellowOn", "bulbcover1_yellow"
  523. Flash 76, F76
  524. NFadeObjm 77, l77, "bulbcover1_yellowOn", "bulbcover1_yellow"
  525. Flash 77, F77
  526.  
  527.  
  528. NFadeL 78, l78
  529. ' NFadeL 79, l79
  530. ' NFadeL 80, l80
  531.  
  532. 'Solenoid Controlled
  533.  
  534. NFadeL 119, L119
  535.  
  536. NFadeL 120, L120
  537.  
  538. Flashm 125, f125a
  539. Flash 125, f125b
  540.  
  541. NFadeObjm 126, P126, "dome2_0_yellowOn", "dome2_0_yellow"
  542. NFadeL 126, L126
  543.  
  544. NFadeObjm 127, P127, "dome2_0_yellowOn", "dome2_0_yellow"
  545. NFadeL 127, f127
  546.  
  547. NFadeObjm 128, P128, "dome2_0_yellowOn", "dome2_0_yellow"
  548. NFadeL 128, f128
  549.  
  550. NFadeObjm 129, P129a, "dome2_0_redOn", "dome2_0_red"
  551. NFadeObjm 129, P129b, "dome2_0_redOn", "dome2_0_red"
  552. NFadeLm 129, L29a
  553. NFadeL 129, L29b
  554.  
  555. NFadeL 131, L131
  556.  
  557. NFadeLm 132, L32a
  558. NFadeL 132, L32b
  559.  
  560. End Sub
  561.  
  562. ' div lamp subs
  563.  
  564. Sub InitLamps()
  565. Dim x
  566. For x = 0 to 200
  567. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  568. FadingLevel(x) = 4 ' used to track the fading state
  569. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  570. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  571. FlashMax(x) = 1 ' the maximum value when on, usually 1
  572. FlashMin(x) = 0 ' the minimum value when off, usually 0
  573. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  574. Next
  575. End Sub
  576.  
  577. Sub AllLampsOff
  578. Dim x
  579. For x = 0 to 200
  580. SetLamp x, 0
  581. Next
  582. End Sub
  583.  
  584. Sub SetLamp(nr, value)
  585. If value <> LampState(nr) Then
  586. LampState(nr) = abs(value)
  587. FadingLevel(nr) = abs(value) + 4
  588. End If
  589. End Sub
  590.  
  591. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  592.  
  593. Sub NFadeL(nr, object)
  594. Select Case FadingLevel(nr)
  595. Case 4:object.state = 0:FadingLevel(nr) = 0
  596. Case 5:object.state = 1:FadingLevel(nr) = 1
  597. End Select
  598. End Sub
  599.  
  600. Sub NFadeLm(nr, object) ' used for multiple lights
  601. Select Case FadingLevel(nr)
  602. Case 4:object.state = 0
  603. Case 5:object.state = 1
  604. End Select
  605. End Sub
  606.  
  607. 'Lights, Ramps & Primitives used as 4 step fading lights
  608. 'a,b,c,d are the images used from on to off
  609.  
  610. Sub FadeObj(nr, object, a, b, c, d)
  611. Select Case FadingLevel(nr)
  612. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  613. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  614. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  615. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  616. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  617. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  618. End Select
  619. End Sub
  620.  
  621. Sub FadeObjm(nr, object, a, b, c, d)
  622. Select Case FadingLevel(nr)
  623. Case 4:object.image = b
  624. Case 5:object.image = a
  625. Case 9:object.image = c
  626. Case 13:object.image = d
  627. End Select
  628. End Sub
  629.  
  630. Sub NFadeObj(nr, object, a, b)
  631. Select Case FadingLevel(nr)
  632. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  633. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  634. End Select
  635. End Sub
  636.  
  637. Sub NFadeObjm(nr, object, a, b)
  638. Select Case FadingLevel(nr)
  639. Case 4:object.image = b
  640. Case 5:object.image = a
  641. End Select
  642. End Sub
  643.  
  644. ' Flasher objects
  645.  
  646. Sub Flash(nr, object)
  647. Select Case FadingLevel(nr)
  648. Case 4 'off
  649. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  650. If FlashLevel(nr) < FlashMin(nr) Then
  651. FlashLevel(nr) = FlashMin(nr)
  652. FadingLevel(nr) = 0 'completely off
  653. End if
  654. Object.IntensityScale = FlashLevel(nr)
  655. Case 5 ' on
  656. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  657. If FlashLevel(nr) > FlashMax(nr) Then
  658. FlashLevel(nr) = FlashMax(nr)
  659. FadingLevel(nr) = 1 'completely on
  660. End if
  661. Object.IntensityScale = FlashLevel(nr)
  662. End Select
  663. End Sub
  664.  
  665. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  666. Object.IntensityScale = FlashLevel(nr)
  667. End Sub
  668.  
  669.  
  670. ' Modulated Flasher and Lights objects
  671. Sub SetLampMod(nr, value)
  672. If value > 0 Then
  673. LampState(nr) = 1
  674. Else
  675. LampState(nr) = 0
  676. End If
  677. FadingLevel(nr) = value
  678. End Sub
  679.  
  680. Sub LampMod(nr, object)
  681. If TypeName(object) = "Light" Then
  682. Object.IntensityScale = FadingLevel(nr)/128
  683. Object.State = LampState(nr)
  684. End If
  685. If TypeName(object) = "Flasher" Then
  686. Object.IntensityScale = FadingLevel(nr)/128
  687. Object.visible = LampState(nr)
  688. End If
  689. If TypeName(object) = "Primitive" Then
  690. Object.DisableLighting = LampState(nr)
  691. End If
  692. End Sub
  693.  
  694.  
  695. 'Reels
  696. Sub FadeReel(nr, reel)
  697. Select Case FadingLevel(nr)
  698. Case 2:FadingLevel(nr) = 0
  699. Case 3:FadingLevel(nr) = 2
  700. Case 4:reel.Visible = 0:FadingLevel(nr) = 3
  701. Case 5:reel.Visible = 1:FadingLevel(nr) = 1
  702. End Select
  703. End Sub
  704.  
  705. 'Inverted Reels
  706. Sub FadeIReel(nr, reel)
  707. Select Case FadingLevel(nr)
  708. Case 2:FadingLevel(nr) = 0
  709. Case 3:FadingLevel(nr) = 2
  710. Case 4:reel.Visible = 1:FadingLevel(nr) = 3
  711. Case 5:reel.Visible = 0:FadingLevel(nr) = 1
  712. End Select
  713. End Sub
  714.  
  715.  
  716. '**********************************************************************************************************
  717. '**********************************************************************************************************
  718. ' Start of VPX functions
  719. '**********************************************************************************************************
  720. '**********************************************************************************************************
  721.  
  722. '**********Sling Shot Animations
  723. ' Rstep and Lstep are the variables that increment the animation
  724. '****************
  725. Dim RStep, Lstep
  726.  
  727. Sub RightSlingShot_Slingshot
  728. vpmTimer.PulseSw 62
  729. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
  730. RSling.Visible = 0
  731. RSling1.Visible = 1
  732. sling1.TransZ = -20
  733. RStep = 0
  734. RightSlingShot.TimerEnabled = 1
  735. End Sub
  736.  
  737. Sub RightSlingShot_Timer
  738. Select Case RStep
  739. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  740. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  741. End Select
  742. RStep = RStep + 1
  743. End Sub
  744.  
  745. Sub LeftSlingShot_Slingshot
  746. vpmTimer.PulseSw 59
  747. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
  748. LSling.Visible = 0
  749. LSling1.Visible = 1
  750. sling2.TransZ = -20
  751. LStep = 0
  752. LeftSlingShot.TimerEnabled = 1
  753. End Sub
  754.  
  755. Sub LeftSlingShot_Timer
  756. Select Case LStep
  757. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  758. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0
  759. End Select
  760. LStep = LStep + 1
  761. End Sub
  762.  
  763.  
  764. '*********************************************************************
  765. ' Positional Sound Playback Functions
  766. '*********************************************************************
  767.  
  768. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  769. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  770. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  771. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  772. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  773. End Sub
  774.  
  775. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  776. Sub PlaySoundAt(soundname, tableobj)
  777. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  778. End Sub
  779.  
  780. Sub PlaySoundAtBall(soundname)
  781. PlaySoundAt soundname, ActiveBall
  782. End Sub
  783.  
  784.  
  785. '*********************************************************************
  786. ' Supporting Ball & Sound Functions
  787. '*********************************************************************
  788.  
  789. 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
  790. Dim tmp
  791. tmp = tableobj.y * 2 / table1.height-1
  792. If tmp > 0 Then
  793. AudioFade = Csng(tmp ^10)
  794. Else
  795. AudioFade = Csng(-((- tmp) ^10) )
  796. End If
  797. End Function
  798.  
  799. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  800. Dim tmp
  801. tmp = tableobj.x * 2 / table1.width-1
  802. If tmp > 0 Then
  803. AudioPan = Csng(tmp ^10)
  804. Else
  805. AudioPan = Csng(-((- tmp) ^10) )
  806. End If
  807. End Function
  808.  
  809. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  810. Vol = Csng(BallVel(ball) ^2 / 2000)
  811. End Function
  812.  
  813. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  814. Pitch = BallVel(ball) * 20
  815. End Function
  816.  
  817. Function BallVel(ball) 'Calculates the ball speed
  818. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  819. End Function
  820.  
  821.  
  822. '*****************************************
  823. ' JP's VP10 Rolling Sounds
  824. '*****************************************
  825.  
  826. Const tnob = 5 ' total number of balls
  827. ReDim rolling(tnob)
  828. InitRolling
  829.  
  830. Sub InitRolling
  831. Dim i
  832. For i = 0 to tnob
  833. rolling(i) = False
  834. Next
  835. End Sub
  836.  
  837. Sub RollingTimer_Timer()
  838. Dim BOT, b
  839. BOT = GetBalls
  840.  
  841. ' stop the sound of deleted balls
  842. For b = UBound(BOT) + 1 to tnob
  843. rolling(b) = False
  844. StopSound("fx_ballrolling" & b)
  845. Next
  846.  
  847. ' exit the sub if no balls on the table
  848. If UBound(BOT) = -1 Then Exit Sub
  849.  
  850. ' play the rolling sound for each ball
  851. For b = 0 to UBound(BOT)
  852. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  853. rolling(b) = True
  854. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  855. Else
  856. If rolling(b) = True Then
  857. StopSound("fx_ballrolling" & b)
  858. rolling(b) = False
  859. End If
  860. End If
  861. Next
  862. End Sub
  863.  
  864. '**********************
  865. ' Ball Collision Sound
  866. '**********************
  867.  
  868. Sub OnBallBallCollision(ball1, ball2, velocity)
  869. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  870. End Sub
  871.  
  872.  
  873. '*****************************************
  874. ' ninuzzu's FLIPPER SHADOWS
  875. '*****************************************
  876.  
  877. sub FlipperTimer_Timer()
  878. FlipperLSh.RotZ = LeftFlipper.currentangle
  879. FlipperRSh.RotZ = RightFlipper.currentangle
  880. LFLogo.RotY = LeftFlipper.CurrentAngle
  881. RFlogo.RotY = RightFlipper.CurrentAngle
  882. sw9p.RotX = -(sw9.currentangle) +90
  883. sw29p.RotX = -(sw29.currentangle) +90
  884. fishmouth.ObjRotX = fishf.CurrentAngle
  885. End Sub
  886.  
  887. '*****************************************
  888. ' ninuzzu's BALL SHADOW
  889. '*****************************************
  890. Dim BallShadow
  891. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  892.  
  893. Sub BallShadowUpdate_timer()
  894. Dim BOT, b
  895. BOT = GetBalls
  896. ' hide shadow of deleted balls
  897. If UBound(BOT)<(tnob-1) Then
  898. For b = (UBound(BOT) + 1) to (tnob-1)
  899. BallShadow(b).visible = 0
  900. Next
  901. End If
  902. ' exit the Sub if no balls on the table
  903. If UBound(BOT) = -1 Then Exit Sub
  904. ' render the shadow for each ball
  905. For b = 0 to UBound(BOT)
  906. If BOT(b).X < Table1.Width/2 Then
  907. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) '+ 6
  908. Else
  909. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) '- 6
  910. End If
  911. ballShadow(b).Y = BOT(b).Y + 10
  912. If BOT(b).Z > 20 Then
  913. BallShadow(b).visible = 1
  914. Else
  915. BallShadow(b).visible = 0
  916. End If
  917. Next
  918. End Sub
  919.  
  920.  
  921.  
  922. '************************************
  923. ' What you need to add to your table
  924. '************************************
  925.  
  926. ' a timer called RollingTimer. With a fast interval, like 10
  927. ' one collision sound, in this script is called fx_collide
  928. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  929. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  930.  
  931.  
  932. '******************************************
  933. ' Explanation of the rolling sound routine
  934. '******************************************
  935.  
  936. ' sounds are played based on the ball speed and position
  937.  
  938. ' the routine checks first for deleted balls and stops the rolling sound.
  939.  
  940. ' The For loop goes through all the balls on the table and checks for the ball speed and
  941. ' if the ball is on the table (height lower than 30) then then it plays the sound
  942. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  943.  
  944. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  945. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  946. ' according to the position of the ball on the table.
  947.  
  948.  
  949. '**************************************
  950. ' Explanation of the collision routine
  951. '**************************************
  952.  
  953. ' The collision is built in VP.
  954. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  955. ' 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
  956. ' depending of the speed of the collision.
  957.  
  958.  
  959. Sub Pins_Hit (idx)
  960. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  961. End Sub
  962.  
  963. Sub Targets_Hit (idx)
  964. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  965. End Sub
  966.  
  967. Sub Metals_Thin_Hit (idx)
  968. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  969. End Sub
  970.  
  971. Sub Metals_Medium_Hit (idx)
  972. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  973. End Sub
  974.  
  975. Sub Metals2_Hit (idx)
  976. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  977. End Sub
  978.  
  979. Sub Gates_Hit (idx)
  980. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  981. End Sub
  982.  
  983. Sub Spinner_Spin
  984. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  985. End Sub
  986.  
  987. Sub Rubbers_Hit(idx)
  988. dim finalspeed
  989. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  990. If finalspeed > 20 then
  991. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  992. End if
  993. If finalspeed >= 6 AND finalspeed <= 20 then
  994. RandomSoundRubber()
  995. End If
  996. End Sub
  997.  
  998. Sub Posts_Hit(idx)
  999. dim finalspeed
  1000. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  1001. If finalspeed > 16 then
  1002. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1003. End if
  1004. If finalspeed >= 6 AND finalspeed <= 16 then
  1005. RandomSoundRubber()
  1006. End If
  1007. End Sub
  1008.  
  1009. Sub RandomSoundRubber()
  1010. Select Case Int(Rnd*3)+1
  1011. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1012. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1013. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1014. End Select
  1015. End Sub
  1016.  
  1017. Sub LeftFlipper_Collide(parm)
  1018. RandomSoundFlipper()
  1019. End Sub
  1020.  
  1021. Sub RightFlipper_Collide(parm)
  1022. RandomSoundFlipper()
  1023. End Sub
  1024.  
  1025. Sub RandomSoundFlipper()
  1026. Select Case Int(Rnd*3)+1
  1027. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1028. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1029. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  1030. End Select
  1031. End Sub
  1032.  
  1033.  
  1034.  
  1035. '******************************
  1036. ' ROM SOUNDS played as samples
  1037. ' code by destruk/Gaston ?
  1038. '******************************
  1039.  
  1040. Dim Playing
  1041. Playing = 0
  1042.  
  1043. If RomSounds = 0 Then
  1044. Set MotorCallback=GetRef("TrackSounds")
  1045. End If
  1046.  
  1047. 'Music & Sound Stuff
  1048. Sub TrackSounds
  1049. Dim NewSounds, ii, Snd
  1050. NewSounds = Controller.NewSoundCommands
  1051. If Not IsEmpty(NewSounds) Then
  1052. For ii = 0 To UBound(NewSounds)
  1053. Snd = NewSounds(ii, 0)
  1054. If Snd = 252 Then Playing = 1 'FC
  1055. If Snd = 253 Then Playing = 2 'FD
  1056. If Snd = 254 Then Playing = 3 'FE
  1057. If Snd <> 255 And Snd <> 1 And Snd <> 0 And Snd <> 16 Then
  1058. SoundCommand(Snd)
  1059. End If
  1060. Next
  1061. End If
  1062. End Sub
  1063.  
  1064. Dim HexRed
  1065. HexRed = "0"
  1066.  
  1067. Sub SoundCommand(Cmd)
  1068. Dim SndName
  1069. If Playing = 1 Then SndName = "FC"
  1070. If Playing = 2 Then SndName = "FD"
  1071. If Playing = 3 Then SndName = "FE"
  1072. If Cmd < 40 And Playing = 2 Then
  1073. If Timer1.Enabled Then Timer1.Enabled = 0
  1074. Select Case Cmd
  1075. Case 3:Timer1.Interval = 20991:Timer1.Enabled = 1:MStore = Cmd:HexRed = "0"
  1076. Case 4:Timer1.Interval = 3816:Timer1.Enabled = 1:MStore = Cmd:HexRed = "0"
  1077. Case 8:Timer1.Interval = 4997:Timer1.Enabled = 1:MStore = Cmd:HexRed = "0"
  1078. Case 10:Timer1.Interval = 613:Timer1.Enabled = 1:MStore = Cmd:HexRed = "0"
  1079. Case 11:Timer1.Interval = 1977:Timer1.Enabled = 1:MStore = Cmd:HexRed = "0"
  1080. Case 12:Timer1.Interval = 6214:Timer1.Enabled = 1:MStore = Cmd:HexRed = "0"
  1081. Case 13:Timer1.Interval = 4260:Timer1.Enabled = 1:MStore = Cmd:HexRed = "0"
  1082. Case 14:Timer1.Interval = 41872:Timer1.Enabled = 1:MStore = Cmd:HexRed = "0"
  1083. Case 18:Timer1.Interval = 3827:Timer1.Enabled = 1:MStore = Cmd
  1084. Case 19:Timer1.Interval = 1278:Timer1.Enabled = 1:MStore = Cmd
  1085. Case 20:Timer1.Interval = 8851:Timer1.Enabled = 1:MStore = Cmd
  1086. Case 25:Timer1.Interval = 3243:Timer1.Enabled = 1:MStore = Cmd
  1087. Case 36:Timer1.Interval = 59780:Timer1.Enabled = 1:MStore = Cmd
  1088. Case 37:Timer1.Interval = 19995:Timer1.Enabled = 1:MStore = Cmd
  1089. Case 38:Timer1.Interval = 59780:Timer1.Enabled = 1:MStore = Cmd
  1090. Case 39:Timer1.Interval = 19995:Timer1.Enabled = 1:MStore = Cmd
  1091. End Select
  1092.  
  1093. MusicCommand(Cmd)
  1094. Else
  1095. Dim FinalSnd
  1096. FinalSnd = HEX(Cmd)
  1097. SndName = SndName & FinalSnd
  1098. PlaySound SndName
  1099. End If
  1100. End Sub
  1101.  
  1102. Dim LastMus
  1103. LastMus = " "
  1104. Dim MStore
  1105. MStore = 0
  1106.  
  1107. Sub MusicCommand(Cmd)
  1108. If Len(LastMus) > 0 Or Cmd = 0 Then
  1109. StopSound LastMus
  1110. End If
  1111. Dim FinalMus
  1112. FinalMus = Hex(Cmd)
  1113. Select Case Cmd
  1114. Case 3:LastMus = "FD" & "0" & FinalMus & "A":PlaySound LastMus
  1115. Case 4:LastMus = "FD" & "0" & FinalMus & "A":PlaySound LastMus
  1116. Case 8:LastMus = "FD" & "0" & FinalMus & "A":PlaySound LastMus
  1117. Case 10:LastMus = "FD" & "0" & FinalMus & "A":PlaySound LastMus
  1118. Case 11:LastMus = "FD" & "0" & FinalMus & "A":PlaySound LastMus
  1119. Case 12:LastMus = "FD" & "0" & FinalMus & "A":PlaySound LastMus
  1120. Case 13:LastMus = "FD" & "0" & FinalMus & "A":PlaySound LastMus
  1121. Case 14:LastMus = "FD" & "0" & FinalMus & "A":PlaySound LastMus
  1122. Case 18:LastMus = "FD" & FinalMus & "A":PlaySound LastMus
  1123. Case 19:LastMus = "FD" & FinalMus & "A":PlaySound LastMus
  1124. Case 20:LastMus = "FD" & FinalMus & "A":PlaySound LastMus
  1125. Case 25:LastMus = "FD" & FinalMus & "A":PlaySound LastMus
  1126. Case 36:LastMus = "FD" & FinalMus & "A":PlaySound LastMus
  1127. Case 37:LastMus = "FD" & FinalMus & "A":PlaySound LastMus
  1128. Case 38:LastMus = "FD" & FinalMus & "A":PlaySound LastMus
  1129. Case 39:LastMus = "FD" & FinalMus & "A":PlaySound LastMus
  1130. Case Else:LastMus = "FD" & FinalMus:PlaySound LastMus, -1
  1131. End Select
  1132. End Sub
  1133.  
  1134. Sub Timer1_Timer
  1135. Timer1.Enabled = 0
  1136. StopSound LastMus
  1137. Dim FinalMus
  1138. FinalMus = Hex(MStore)
  1139. If CInt(MStore) < 16 Then
  1140. LastMus = "FD" & "0" & FinalMus & "B"
  1141. Else
  1142. LastMus = "FD" & FinalMus & "B"
  1143. End If
  1144. PlaySound LastMus, -1
  1145. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement