Guest User

Untitled

a guest
Aug 5th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.43 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="hoops",UseSolenoids=1,UseLamps=1,UseGI=0,UseSync=1,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SCoin="coin"
  10. Const swStartButton=3 'remap start button to 1 key
  11.  
  12. LoadVPM "01120100","gts3.vbs",3.02
  13.  
  14. Dim FlipperShadows
  15. Dim DesktopMode: DesktopMode = Table1.ShowDT
  16. If DesktopMode = True Then 'Show Desktop components
  17. Ramp16.visible=1
  18. Ramp15.visible=1
  19. Ramp17.visible=1
  20. Else
  21. Ramp16.visible=0
  22. Ramp15.visible=0
  23. Ramp17.visible=0
  24. End if
  25.  
  26. '**********************************************************************************************************
  27. 'Solenoid Call backs
  28. '**********************************************************************************************************
  29.  
  30. SolCallback(5)="bsL.SolOut"
  31. SolCallback(6)="bsT.SolOut"
  32. SolCallback(7)="bsR.SolOut"
  33. 'SolCallback(8)=Not Used
  34. SolCallback(9)="vpmFlasher array(Flasher1,Flasher1a)," 'Bottom Left Flasher
  35. SolCallback(10)="vpmFlasher array(Flasher2,Flasher2a),"'Left Side Flasher
  36. SolCallback(11)="vpmFlasher array(Flasher3,Flasher3a),"'Top Left Flasher
  37. SolCallback(12)="vpmFlasher array(Flasher4,Flasher4a),"'Top Right Flasher
  38. SolCallback(13)="vpmFlasher array(Flasher5,Flasher5a),"'Right Side Flasher
  39. SolCallback(14)="vpmFlasher array(Flasher6,Flasher6a),"'Bottom Right Flasher
  40. 'SolCallback(15)=Not Used
  41. 'SolCallback(16)=Not Used
  42. SolCallback(17)="vpmFlasher array(Flasher7,Flasher7a),"'#1 FlashSet (2 Lamps)
  43. SolCallback(18)="vpmFlasher array(Flasher8,Flasher8a),"'#2 FlashSet (2 Lamps)
  44. SolCallback(19)="vpmFlasher array(Flasher9,Flasher9a),"'#3 FlashSet (2 Lamps)
  45. SolCallback(20)="vpmFlasher array(Flasher10,Flasher10a),"'#4 FlashSet (2 Lamps)
  46. SolCallback(21)="vpmFlasher array(Flasher11,Flasher11a),"'#5 FlashSet (2 Lamps)
  47. SolCallback(22)="vpmFlasher array(Flasher12,Flasher12a),"'#6 FlashSet (2 Lamps)
  48. 'SolCallback(23)=Not Used
  49. 'SolCallback(24)=Not Used
  50. 'SolCallback(25)=Not Used
  51. 'SolCallback(26)='SolLight Box Relay
  52. 'SolCallback(27)='Ticket Dispenser
  53. SolCallback(28)="bsTrough.SolOut"
  54. SolCallback(29)="bsTrough.SolIn"
  55. SolCallback(30)="vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  56. 'SolCallback(31)='Tilt Relay
  57. SolCallback(32)="vpmNudge.SolGameOn"'Game Over Relay
  58.  
  59. SolCallback(sLRFlipper) = "SolRFlipper"
  60. SolCallback(sLLFlipper) = "SolLFlipper"
  61.  
  62. Sub SolLFlipper(Enabled)
  63. If Enabled Then
  64. PlaySound SoundFX("fx_Flipperup",DOFContactors):LeftFlipper.RotateToEnd
  65. Else
  66. PlaySound SoundFX("fx_Flipperdown",DOFContactors):LeftFlipper.RotateToStart
  67. End If
  68. End Sub
  69.  
  70. Sub SolRFlipper(Enabled)
  71. If Enabled Then
  72. PlaySound SoundFX("fx_Flipperup",DOFContactors):RightFlipper.RotateToEnd
  73. Else
  74. PlaySound SoundFX("fx_Flipperdown",DOFContactors):RightFlipper.RotateToStart
  75. End If
  76. End Sub
  77.  
  78. '**********************************************************************************************************
  79. 'GI Lights On
  80. '**********************************************************************************************************
  81.  
  82. sub Encendido_timer
  83. dim xx
  84. playsound "encendido"
  85. For each xx in Ambiente:xx.State = 1: Next
  86. me.enabled=false
  87. End Sub
  88.  
  89. '**********************************************************************************************************
  90. 'Initiate Table
  91. '**********************************************************************************************************
  92.  
  93. Dim bsTrough, bsL, bsR, bsT
  94.  
  95. Sub Table1_Init
  96. vpmInit Me
  97. On Error Resume Next
  98. With Controller
  99. .GameName=cGameName
  100. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  101. .SplashInfoLine = "Hoops - Gottlieb 1991"&chr(13)&"By Kalavera"
  102. .HandleKeyboard=0
  103. .ShowTitle=0
  104. .ShowDMDOnly=1
  105. .HandleMechanics=0
  106. .ShowFrame=0
  107. .Hidden=1
  108. On Error Resume Next
  109. .Run GetPlayerHwnd
  110. If Err Then MsgBox Err.Description
  111. On Error Goto 0
  112. End With
  113. On Error Goto 0
  114.  
  115. PinMAMETimer.Interval=PinMAMEInterval
  116. PinMAMETimer.Enabled=1
  117. vpmNudge.TiltSwitch=151
  118. vpmNudge.Sensitivity=2
  119. vpmNudge.TiltObj=Array(Bumper1,Bumper2,LeftSlingShot,RightSlingShot)
  120.  
  121. Set bsTrough=New cvpmBallStack
  122. bsTrough.InitSw 47,0,0,37,0,0,0,0
  123. bsTrough.InitKick BallRelease,62,8
  124. bsTrough.InitExitSnd SoundFX("Ballrelease",DOFContactors),SoundFX("SolOn",DOFContactors)
  125. bsTrough.Balls=3
  126.  
  127. Set bsL=New cvpmBallStack
  128. bsL.InitSaucer S14,14,146,8
  129. bsL.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("SolOn",DOFContactors)
  130. bsL.KickForceVar=3
  131.  
  132. Set bsR=New cvpmBallStack
  133. bsR.InitSaucer S16,16,247,8
  134. bsR.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("SolOn",DOFContactors)
  135. bsR.KickForceVar=2
  136. bsR.KickAngleVar=3
  137.  
  138. Set bsT=New cvpmBallStack
  139. bsT.InitSaucer S15,15,270,8
  140. bsT.InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("SolOn",DOFContactors)
  141.  
  142. Cautiva.CreateBall
  143. Cautiva.Kick 180,1
  144.  
  145. End Sub
  146.  
  147. '**********************************************************************************************************
  148. 'Plunger code
  149. '**********************************************************************************************************
  150. Sub Table1_KeyDown(ByVal keycode)
  151. If keycode=LeftFlipperKey Then Controller.Switch(6)=1
  152. If keycode=RightFlipperkey Then Controller.Switch(7)=1
  153. iF KEYCODE = StartGameKey THEN CONTROLLER.SWITCH(3)=1
  154. If keycode = KeySlamDoorHit Then Controller.Switch(152) = 1
  155. If keycode = KeyUpperLeft Then controller.switch(4)=1
  156. If keycode = KeyUpperRight Then controller.switch(5)=1
  157. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  158. If KeyDownHandler(keycode) Then Exit Sub
  159. End Sub
  160.  
  161. Sub Table1_KeyUp(ByVal keycode)
  162. If keycode=LeftFlipperKey Then Controller.Switch(6)=0
  163. If keycode=RightFlipperkey Then Controller.Switch(7)=0
  164. iF KEYCODE =StartGameKey THEN CONTROLLER.SWITCH(3)=0
  165. If keycode = KeySlamDoorHit Then Controller.Switch(152) = 0
  166. If keycode = KeyUpperLeft Then controller.switch(4)=0
  167. If keycode = KeyUpperRight Then controller.switch(5)=0
  168. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  169. If KeyUpHandler(keycode) Then Exit Sub
  170. End Sub
  171.  
  172. '**********************************************************************************************************
  173.  
  174. ' Drain hole
  175. Sub Drain_Hit:bsTrough.addball me:playsound"drain":End Sub
  176. Sub S14_Hit:bsL.AddBall 0 : playsound "popper_ball": End Sub
  177. Sub S15_Hit:bsT.AddBall 0 : playsound "popper_ball": End Sub
  178. Sub S16_Hit:bsR.AddBall 0 : playsound "popper_ball": End Sub
  179.  
  180. 'spinners
  181. Sub S24_Spin:vpmTimer.PulseSw 24 : playsound"fx_spinner" : End Sub
  182.  
  183. 'StandUp Targets
  184. Sub S17_Hit:vpmTimer.PulseSw 17:End Sub
  185. Sub S25_Hit:vpmTimer.PulseSw 25:End Sub
  186. Sub S26_Hit:vpmTimer.PulseSw 26:End Sub
  187. Sub S27_Hit:vpmTimer.PulseSw 27:End Sub
  188. Sub S31_Hit:vpmTimer.PulseSw 31:End Sub
  189. Sub S35_Hit:vpmTimer.PulseSw 35:End Sub
  190. Sub S36_Hit:vpmTimer.PulseSw 36:End Sub
  191. Sub S41_Hit:vpmTimer.PulseSw 41:End Sub
  192. Sub S42_Hit:vpmTimer.PulseSw 42:End Sub
  193. Sub S43_Hit:vpmTimer.PulseSw 43:End Sub
  194. Sub S45_Hit:vpmTimer.PulseSw 45:End Sub
  195. Sub S46_Hit:vpmTimer.PulseSw 46:End Sub
  196.  
  197. 'Wire Triggers
  198. Sub s20_Hit : Controller.Switch(20) = 1 : playsound"rollover" : End Sub
  199. Sub s20_UnHit : Controller.Switch(20) = 0 : End Sub
  200. Sub s21_Hit : Controller.Switch(21) = 1 : playsound"rollover" : End Sub
  201. Sub s21_UnHit : Controller.Switch(21) = 0 : End Sub
  202. Sub s22_Hit : Controller.Switch(22) = 1 : playsound"rollover" : End Sub
  203. Sub s22_UnHit : Controller.Switch(22) = 0 : End Sub
  204. Sub s23_Hit : Controller.Switch(23) = 1 : playsound"rollover" : End Sub
  205. Sub s23_UnHit : Controller.Switch(23) = 0 : End Sub
  206. Sub s30_Hit : Controller.Switch(30) = 1 : playsound"rollover" : End Sub
  207. Sub s30_UnHit : Controller.Switch(30) = 0 : End Sub
  208. Sub s32_Hit : Controller.Switch(32) = 1 : playsound"rollover" : End Sub
  209. Sub s32_UnHit : Controller.Switch(32) = 0 : End Sub
  210. Sub s33_Hit : Controller.Switch(33) = 1 : playsound"rollover" : End Sub
  211. Sub s33_UnHit : Controller.Switch(33) = 0 : End Sub
  212. Sub s34_Hit : Controller.Switch(34) = 1 : playsound"rollover" : End Sub
  213. Sub s34_UnHit : Controller.Switch(34) = 0 : End Sub
  214.  
  215. 'Bumpers
  216. Sub Bumper1_Hit : vpmTimer.PulseSw(10) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  217. Sub Bumper2_Hit : vpmTimer.PulseSw(11) : playsound SoundFX("fx_bumper1",DOFContactors): End Sub
  218.  
  219. '**********************************************************************************************************
  220. ' Lights
  221. '**********************************************************************************************************
  222.  
  223. Set Lights(0)=L0
  224. Set Lights(1)=L1
  225. Set Lights(2)=L2
  226. Set Lights(3)=L3
  227. Set Lights(4)=L4
  228. Set Lights(5)=L5
  229. Set Lights(6)=L6
  230. Set Lights(7)=L7
  231. Set Lights(8)=L8
  232. Set Lights(9)=L9
  233. Set Lights(10)=L10
  234. Set Lights(11)=L11
  235. Set Lights(12)=L12
  236. Set Lights(13)=L13
  237. Set Lights(14)=L14
  238. Set Lights(15)=L15
  239. Set Lights(16)=L16
  240. Set Lights(17)=L17
  241. Set Lights(18)=L18
  242. Set Lights(19)=L19
  243. Set Lights(20)=L20
  244. Set Lights(21)=L21
  245. Set Lights(22)=L22
  246. Set Lights(23)=L23
  247. Set Lights(24)=L24
  248. Set Lights(25)=L25
  249. Set Lights(26)=L26
  250. Set Lights(27)=L27
  251. Set Lights(28)=L28
  252. Set Lights(29)=L29
  253. Set Lights(30)=L30
  254. Set Lights(31)=L31
  255. Set Lights(32)=L32
  256. Set Lights(33)=L33
  257. Set Lights(34)=L34
  258. Set Lights(35)=L35
  259. Set Lights(36)=L36
  260. Set Lights(37)=L37
  261. Set Lights(38)=L38
  262. Set Lights(39)=L39
  263. Set Lights(40)=L40
  264. Set Lights(41)=L41
  265. Set Lights(42)=L42
  266. Set Lights(43)=L43
  267. Set Lights(44)=L44
  268. Set Lights(45)=L45
  269. Set Lights(46)=L46
  270. Set Lights(47)=L47
  271. Set Lights(48)=L48
  272. Set Lights(49)=L49
  273. Set Lights(50)=L50
  274. Set Lights(51)=L51
  275. Lights(52)=Array(L52,L52a,L52a1) 'bumper
  276. Lights(53)=Array(L53,L53a,L53a1) 'bumper
  277. Set Lights(54)=L54
  278. Set Lights(55)=L55
  279. Set Lights(56)=L56
  280. Set Lights(57)=L57
  281. Set Lights(58)=L58
  282. Set Lights(59)=L59
  283. Set Lights(60)=L60
  284. Set Lights(61)=L61
  285. Set Lights(62)=L62
  286. Set Lights(63)=L63
  287. Set Lights(64)=L64
  288. Set Lights(65)=L65
  289. Set Lights(66)=L66
  290. Set Lights(67)=L67
  291. Set Lights(68)=L68
  292. Set Lights(69)=L69
  293. Set Lights(70)=L70
  294. Set Lights(71)=L71
  295. Set Lights(72)=L72
  296. Set Lights(73)=L73
  297. Set Lights(74)=L74
  298. Set Lights(75)=L75
  299. Set Lights(76)=L76
  300. Set Lights(77)=L77
  301. Set Lights(78)=L78
  302. Set Lights(79)=L79
  303. Set Lights(80)=L80
  304. Set Lights(81)=L81
  305. Set Lights(82)=L82
  306. Set Lights(83)=L83
  307. Set Lights(84)=L84
  308. Set Lights(85)=L85
  309. Set Lights(86)=L86
  310. Set Lights(87)=L87
  311. Set Lights(88)=L88
  312. Set Lights(89)=L89
  313. Set Lights(90)=L90
  314. Set Lights(91)=L91
  315. Set Lights(92)=L92
  316. Set Lights(93)=L93
  317. Set Lights(94)=L94
  318. Set Lights(95)=L95
  319. Set Lights(96)=L96
  320. Set Lights(97)=L97
  321. Set Lights(98)=L98
  322. Set Lights(99)=L99
  323. Set Lights(100)=L100
  324. Set Lights(101)=L101
  325. Set Lights(102)=L102
  326. Set Lights(103)=L103
  327. Set Lights(104)=L104
  328. Set Lights(105)=L105
  329.  
  330.  
  331. '**********************************************************************************************************
  332. ' Display
  333. '**********************************************************************************************************
  334.  
  335. Dim Digits(51)
  336. Digits(0)=Array(Q1,Q2,Q3,Q4,Q5,Q6,Q7,Q8,Q9,Q10,Q11,Q12,Q13,Q14,Q15,Q16)
  337. Digits(1)=Array(Q17,Q18,Q19,Q20,Q21,Q22,Q23,Q24,Q25,Q26,Q27,Q28,Q29,Q30,Q31,Q32)
  338. Digits(2)=Array(Q33,Q34,Q35,Q36,Q37,Q38,Q39,Q40,Q41,Q42,Q43,Q44,Q45,Q46,Q47,Q48)
  339. Digits(3)=Array(Q49,Q50,Q51,Q52,Q53,Q54,Q55,Q56,Q57,Q58,Q59,Q60,Q61,Q62,Q63,Q64)
  340. Digits(4)=Array(Q65,Q66,Q67,Q68,Q69,Q70,Q71,Q72,Q73,Q74,Q75,Q76,Q77,Q78,Q79,Q80)
  341. Digits(5)=Array(Q81,Q82,Q83,Q84,Q85,Q86,Q87,Q88,Q89,Q90,Q91,Q92,Q93,Q94,Q95,Q96)
  342. Digits(6)=Array(Q97,Q98,Q99,Q100,Q101,Q102,Q103,Q104,Q105,Q106,Q107,Q108,Q109,Q110,Q111,Q112)
  343. Digits(7)=Array(Q113,Q114,Q115,Q116,Q117,Q118,Q119,Q120,Q121,Q122,Q123,Q124,Q125,Q126,Q127,Q128)
  344. Digits(8)=Array(Q129,Q130,Q131,Q132,Q133,Q134,Q135,Q136,Q137,Q138,Q139,Q140,Q141,Q142,Q143,Q144)
  345. Digits(9)=Array(Q145,Q146,Q147,Q148,Q149,Q150,Q151,Q152,Q153,Q154,Q155,Q156,Q157,Q158,Q159,Q160)
  346. Digits(10)=Array(Q161,Q162,Q163,Q164,Q165,Q166,Q167,Q168,Q169,Q170,Q171,Q172,Q173,Q174,Q175,Q176)
  347. Digits(11)=Array(Q177,Q178,Q179,Q180,Q181,Q182,Q183,Q184,Q185,Q186,Q187,Q188,Q189,Q190,Q191,Q192)
  348. Digits(12)=Array(Q193,Q194,Q195,Q196,Q197,Q198,Q199,Q200,Q201,Q202,Q203,Q204,Q205,Q206,Q207,Q208)
  349. Digits(13)=Array(Q209,Q210,Q211,Q212,Q213,Q214,Q215,Q216,Q217,Q218,Q219,Q220,Q221,Q222,Q223,Q224)
  350. Digits(14)=Array(Q225,Q226,Q227,Q228,Q229,Q230,Q231,Q232,Q233,Q234,Q235,Q236,Q237,Q238,Q239,Q240)
  351. Digits(15)=Array(Q241,Q242,Q243,Q244,Q245,Q246,Q247,Q248,Q249,Q250,Q251,Q252,Q253,Q254,Q255,Q256)
  352. Digits(16)=Array(Q257,Q258,Q259,Q260,Q261,Q262,Q263,Q264,Q265,Q266,Q267,Q268,Q269,Q270,Q271,Q272)
  353. Digits(17)=Array(Q273,Q274,Q275,Q276,Q277,Q278,Q279,Q280,Q281,Q282,Q283,Q284,Q285,Q286,Q287,Q288)
  354. Digits(18)=Array(Q289,Q290,Q291,Q292,Q293,Q294,Q295,Q296,Q297,Q298,Q299,Q300,Q301,Q302,Q303,Q304)
  355. Digits(19)=Array(Q305,Q306,Q307,Q308,Q309,Q310,Q311,Q312,Q313,Q314,Q315,Q316,Q317,Q318,Q319,Q320)
  356. Digits(20)=Array(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15,P16)
  357. Digits(21)=Array(P17,P18,P19,P20,P21,P22,P23,P24,P25,P26,P27,P28,P29,P30,P31,P32)
  358. Digits(22)=Array(P33,P34,P35,P36,P37,P38,P39,P40,P41,P42,P43,P44,P45,P46,P47,P48)
  359. Digits(23)=Array(P49,P50,P51,P52,P53,P54,P55,P56,P57,P58,P59,P60,P61,P62,P63,P64)
  360. Digits(24)=Array(P65,P66,P67,P68,P69,P70,P71,P72,P73,P74,P75,P76,P77,P78,P79,P80)
  361. Digits(25)=Array(P81,P82,P83,P84,P85,P86,P87,P88,P89,P90,P91,P92,P93,P94,P95,P96)
  362. Digits(26)=Array(P97,P98,P99,P100,P101,P102,P103,P104,P105,P106,P107,P108,P109,P110,P111,P112)
  363. Digits(27)=Array(P113,P114,P115,P116,P117,P118,P119,P120,P121,P122,P123,P124,P125,P126,P127,P128)
  364. Digits(28)=Array(P129,P130,P131,P132,P133,P134,P135,P136,P137,P138,P139,P140,P141,P142,P143,P144)
  365. Digits(29)=Array(P145,P146,P147,P148,P149,P150,P151,P152,P153,P154,P155,P156,P157,P158,P159,P160)
  366. Digits(30)=Array(P161,P162,P163,P164,P165,P166,P167,P168,P169,P170,P171,P172,P173,P174,P175,P176)
  367. Digits(31)=Array(P177,P178,P179,P180,P181,P182,P183,P184,P185,P186,P187,P188,P189,P190,P191,P192)
  368. Digits(32)=Array(P193,P194,P195,P196,P197,P198,P199,P200,P201,P202,P203,P204,P205,P206,P207,P208)
  369. Digits(33)=Array(P209,P210,P211,P212,P213,P214,P215,P216,P217,P218,P219,P220,P221,P222,P223,P224)
  370. Digits(34)=Array(P225,P226,P227,P228,P229,P230,P231,P232,P233,P234,P235,P236,P237,P238,P239,P240)
  371. Digits(35)=Array(P241,P242,P243,P244,P245,P246,P247,P248,P249,P250,P251,P252,P253,P254,P255,P256)
  372. Digits(36)=Array(P257,P258,P259,P260,P261,P262,P263,P264,P265,P266,P267,P268,P269,P270,P271,P272)
  373. Digits(37)=Array(P273,P274,P275,P276,P277,P278,P279,P280,P281,P282,P283,P284,P285,P286,P287,P288)
  374. Digits(38)=Array(P289,P290,P291,P292,P293,P294,P295,P296,P297,P298,P299,P300,P301,P302,P303,P304)
  375. Digits(39)=Array(P305,P306,P307,P308,P309,P310,P311,P312,P313,P314,P315,P316,P317,P318,P319,P320)
  376. Digits(40)=Array(Z1,Z2,Z3,Z4,Z5,Z6,Z7)
  377. Digits(41)=Array(Z8,Z9,Z10,Z11,Z12,Z13,Z14)
  378. Digits(42)=Array(Z15,Z16,Z17,Z18,Z19,Z20,Z21)
  379. Digits(43)=Array(Z22,Z23,Z24,Z25,Z26,Z27,Z28)
  380. Digits(44)=Array(Z29,Z30,Z31,Z32,Z33,Z34,Z35)
  381. Digits(45)=Array(Z36,Z37,Z38,Z39,Z40,Z41,Z42)
  382. Digits(46)=Array(Z43,Z44,Z45,Z46,Z47,Z48,Z49)
  383. Digits(47)=Array(Z50,Z51,Z52,Z53,Z54,Z55,Z56)
  384. Digits(48)=Array(Z57,Z58,Z59,Z60,Z61,Z62,Z63)
  385. Digits(49)=Array(Z64,Z65,Z66,Z67,Z68,Z69,Z70)
  386. Digits(50)=Array(Z71,Z72,Z73,Z74,Z75,Z76,Z77)
  387. Digits(51)=Array(Z78,Z79,Z80,Z81,Z82,Z83,Z84)
  388.  
  389. Sub DisplayTimer_Timer
  390. Dim ChgLED,ii,num,chg,stat,obj
  391. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  392. If Not IsEmpty(ChgLED) Then
  393. If DesktopMode = True Then
  394. For ii = 0 To UBound(chgLED)
  395. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  396. if (num < 52) then
  397. For Each obj In Digits(num)
  398. If chg And 1 Then obj.State = stat And 1
  399. chg = chg\2 : stat = stat\2
  400. Next
  401. else
  402. end if
  403. next
  404. end if
  405. end if
  406. End Sub
  407.  
  408. '**********Sling Shot Animations
  409. ' Rstep and Lstep are the variables that increment the animation
  410. '****************
  411. Dim RStep, Lstep
  412.  
  413. Sub RightSlingShot_Slingshot
  414. vpmTimer.PulseSw 13
  415. PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
  416. RSling.Visible = 0
  417. RSling1.Visible = 1
  418. sling1.rotx = 20
  419. RStep = 0
  420. RightSlingShot.TimerEnabled = 1
  421. End Sub
  422.  
  423. Sub RightSlingShot_Timer
  424. Select Case RStep
  425. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
  426. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0
  427. End Select
  428. RStep = RStep + 1
  429. End Sub
  430.  
  431. Sub LeftSlingShot_Slingshot
  432. vpmTimer.PulseSw 12
  433. PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
  434. LSling.Visible = 0
  435. LSling1.Visible = 1
  436. sling2.rotx = 20
  437. LStep = 0
  438. LeftSlingShot.TimerEnabled = 1
  439. End Sub
  440.  
  441. Sub LeftSlingShot_Timer
  442. Select Case LStep
  443. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
  444. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0
  445. End Select
  446. LStep = LStep + 1
  447. End Sub
  448.  
  449.  
  450. '*********************************************************************
  451. ' Positional Sound Playback Functions
  452. '*********************************************************************
  453.  
  454. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  455. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  456. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  457. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  458. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  459. End Sub
  460.  
  461. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  462. Sub PlaySoundAt(soundname, tableobj)
  463. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  464. End Sub
  465.  
  466. Sub PlaySoundAtBall(soundname)
  467. PlaySoundAt soundname, ActiveBall
  468. End Sub
  469.  
  470.  
  471. '*********************************************************************
  472. ' Supporting Ball & Sound Functions
  473. '*********************************************************************
  474.  
  475. 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
  476. Dim tmp
  477. tmp = tableobj.y * 2 / table1.height-1
  478. If tmp > 0 Then
  479. AudioFade = Csng(tmp ^10)
  480. Else
  481. AudioFade = Csng(-((- tmp) ^10) )
  482. End If
  483. End Function
  484.  
  485. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  486. Dim tmp
  487. tmp = tableobj.x * 2 / table1.width-1
  488. If tmp > 0 Then
  489. AudioPan = Csng(tmp ^10)
  490. Else
  491. AudioPan = Csng(-((- tmp) ^10) )
  492. End If
  493. End Function
  494.  
  495. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  496. Vol = Csng(BallVel(ball) ^2 / 2000)
  497. End Function
  498.  
  499. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  500. Pitch = BallVel(ball) * 20
  501. End Function
  502.  
  503. Function BallVel(ball) 'Calculates the ball speed
  504. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  505. End Function
  506.  
  507.  
  508. '*****************************************
  509. ' JP's VP10 Rolling Sounds
  510. '*****************************************
  511.  
  512. Const tnob = 2 ' total number of balls
  513. ReDim rolling(tnob)
  514. InitRolling
  515.  
  516. Sub InitRolling
  517. Dim i
  518. For i = 0 to tnob
  519. rolling(i) = False
  520. Next
  521. End Sub
  522.  
  523. Sub RollingTimer_Timer()
  524. Dim BOT, b
  525. BOT = GetBalls
  526.  
  527. ' stop the sound of deleted balls
  528. For b = UBound(BOT) + 1 to tnob
  529. rolling(b) = False
  530. StopSound("fx_ballrolling" & b)
  531. Next
  532.  
  533. ' exit the sub if no balls on the table
  534. If UBound(BOT) = -1 Then Exit Sub
  535.  
  536. ' play the rolling sound for each ball
  537. For b = 0 to UBound(BOT)
  538. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  539. rolling(b) = True
  540. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  541. Else
  542. If rolling(b) = True Then
  543. StopSound("fx_ballrolling" & b)
  544. rolling(b) = False
  545. End If
  546. End If
  547. Next
  548. End Sub
  549.  
  550. '**********************
  551. ' Ball Collision Sound
  552. '**********************
  553.  
  554. Sub OnBallBallCollision(ball1, ball2, velocity)
  555. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  556. End Sub
  557.  
  558.  
  559. '*****************************************
  560. ' ninuzzu's FLIPPER SHADOWS
  561. '*****************************************
  562.  
  563. sub FlipperTimer_Timer()
  564. FlipperLSh.RotZ = LeftFlipper.currentangle
  565. FlipperRSh.RotZ = RightFlipper.currentangle
  566.  
  567. Flipperizq.roty=leftFlipper.CurrentAngle +270
  568. Flipperder.roty=rightFlipper.CurrentAngle +270
  569.  
  570. End Sub
  571.  
  572. '*****************************************
  573. ' ninuzzu's BALL SHADOW
  574. '*****************************************
  575. Dim BallShadow
  576. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  577.  
  578. Sub BallShadowUpdate_timer()
  579. Dim BOT, b
  580. BOT = GetBalls
  581. ' hide shadow of deleted balls
  582. If UBound(BOT)<(tnob-1) Then
  583. For b = (UBound(BOT) + 1) to (tnob-1)
  584. BallShadow(b).visible = 0
  585. Next
  586. End If
  587. ' exit the Sub if no balls on the table
  588. If UBound(BOT) = -1 Then Exit Sub
  589. ' render the shadow for each ball
  590. For b = 0 to UBound(BOT)
  591. If BOT(b).X < Table1.Width/2 Then
  592. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
  593. Else
  594. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
  595. End If
  596. ballShadow(b).Y = BOT(b).Y + 12
  597. If BOT(b).Z > 20 Then
  598. BallShadow(b).visible = 1
  599. Else
  600. BallShadow(b).visible = 0
  601. End If
  602. Next
  603. End Sub
  604.  
  605.  
  606.  
  607. '************************************
  608. ' What you need to add to your table
  609. '************************************
  610.  
  611. ' a timer called RollingTimer. With a fast interval, like 10
  612. ' one collision sound, in this script is called fx_collide
  613. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  614. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  615.  
  616.  
  617. '******************************************
  618. ' Explanation of the rolling sound routine
  619. '******************************************
  620.  
  621. ' sounds are played based on the ball speed and position
  622.  
  623. ' the routine checks first for deleted balls and stops the rolling sound.
  624.  
  625. ' The For loop goes through all the balls on the table and checks for the ball speed and
  626. ' if the ball is on the table (height lower than 30) then then it plays the sound
  627. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  628.  
  629. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  630. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  631. ' according to the position of the ball on the table.
  632.  
  633.  
  634. '**************************************
  635. ' Explanation of the collision routine
  636. '**************************************
  637.  
  638. ' The collision is built in VP.
  639. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  640. ' 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
  641. ' depending of the speed of the collision.
  642.  
  643.  
  644. Sub Pins_Hit (idx)
  645. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  646. End Sub
  647.  
  648. Sub Targets_Hit (idx)
  649. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  650. End Sub
  651.  
  652. Sub Metals_Thin_Hit (idx)
  653. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  654. End Sub
  655.  
  656. Sub Metals_Medium_Hit (idx)
  657. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  658. End Sub
  659.  
  660. Sub Metals2_Hit (idx)
  661. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  662. End Sub
  663.  
  664. Sub Gates_Hit (idx)
  665. PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  666. End Sub
  667.  
  668. Sub Spinner_Spin
  669. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  670. End Sub
  671.  
  672. Sub Rubbers_Hit(idx)
  673. dim finalspeed
  674. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  675. If finalspeed > 20 then
  676. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  677. End if
  678. If finalspeed >= 6 AND finalspeed <= 20 then
  679. RandomSoundRubber()
  680. End If
  681. End Sub
  682.  
  683. Sub Posts_Hit(idx)
  684. dim finalspeed
  685. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  686. If finalspeed > 16 then
  687. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  688. End if
  689. If finalspeed >= 6 AND finalspeed <= 16 then
  690. RandomSoundRubber()
  691. End If
  692. End Sub
  693.  
  694. Sub RandomSoundRubber()
  695. Select Case Int(Rnd*3)+1
  696. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  697. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  698. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  699. End Select
  700. End Sub
  701.  
  702. Sub LeftFlipper_Collide(parm)
  703. RandomSoundFlipper()
  704. End Sub
  705.  
  706. Sub RightFlipper_Collide(parm)
  707. RandomSoundFlipper()
  708. End Sub
  709.  
  710. Sub RandomSoundFlipper()
  711. Select Case Int(Rnd*3)+1
  712. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  713. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  714. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  715. End Select
  716. End Sub
Advertisement
Add Comment
Please, Sign In to add comment