Arngrim

Elektra with DOF script

Jul 25th, 2021
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.14 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="elektra",UseSolenoids=1,UseLamps=1,UseGI=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SCoin="coin"
  10. Const SFlipperOn="fx_Flipperup",SFlipperOff="fx_Flipperdown"
  11.  
  12. LoadVPM "00990400", "Bally.VBS", 1.2
  13. Dim DesktopMode: DesktopMode = Table1.ShowDT
  14. '*************************************************************
  15.  
  16. 'Solenoid Call backs
  17. '**********************************************************************************************************
  18. SolCallback(6) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  19. SolCallback(7) = "bsTrough.SolOut"
  20. SolCallBack(10) = "bsTSaucer.SolOut"
  21. SolCallBack(11) = "bsRSaucer.SolOut"
  22. SolCallback(12) = "dtDrop.SolDropUp"
  23. SolCallBack(13) = "bsLSaucer.SolOut"
  24. SolCallback(17) = "vpmSolDiverter OutGate, ""Gate"", Not"
  25. SolCallback(19) = "vpmNudge.SolGameOn"
  26. 'SolCallback(sLLFlipper) = "leftFlipperSol"
  27. 'SolCallback(sLRFlipper) = "rightFlipperSol"
  28.  
  29. 'Solenoid Controlled toys
  30. '**********************************************************************************************************
  31. 'Sub leftFlipperSol(enabled)
  32. 'vpmSolFlipper LeftFlipperLower, nothing, (Not Controller.Switch(8)) And enabled
  33. 'vpmSolFlipper LeftFlipper, LeftFlipperUpper, Controller.Switch(8) And enabled
  34. 'End Sub
  35.  
  36. 'Sub rightFlipperSol(enabled)
  37. 'vpmSolFlipper RightFlipperLower, nothing, (Not Controller.Switch(8)) And enabled
  38. 'vpmSolFlipper RightFlipper, RightFlipperUpper, Controller.Switch(8) And enabled
  39. 'End Sub
  40.  
  41. SolCallback(sLRFlipper) = "SolRFlipper"
  42. SolCallback(sLLFlipper) = "SolLFlipper"
  43.  
  44. Sub SolLFlipper(Enabled)
  45. If Enabled Then
  46. If Controller.Switch(8) Then
  47. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd:LeftFlipperUpper.RotateToEnd
  48. Else
  49. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipperLower.RotateToEnd
  50. End If
  51. Else
  52. If Controller.Switch(8) Then
  53. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart:LeftFlipperUpper.RotateToStart
  54. Else
  55. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipperLower.RotateToStart
  56. End If
  57. End If
  58. End Sub
  59.  
  60. Sub SolRFlipper(Enabled)
  61. If Enabled Then
  62. If Controller.Switch(8) Then
  63. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd:RightFlipperUpper.RotateToEnd
  64. Else
  65. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipperLower.RotateToEnd
  66. End If
  67. Else
  68. If Controller.Switch(8) Then
  69. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart:RightFlipperUpper.RotateToStart
  70. Else
  71. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipperLower.RotateToStart
  72. End If
  73. End If
  74. End Sub
  75.  
  76.  
  77.  
  78. Sub FlipperTimer_Timer()
  79. Primitiveflipper.RotY = OutGate.Currentangle
  80. End Sub
  81.  
  82.  
  83. '**********************************************************************************************************
  84.  
  85. 'Initiate Table
  86. '**********************************************************************************************************
  87.  
  88. Dim bsTrough, bsTSaucer, bsRSaucer, bsLSaucer, dtDrop
  89.  
  90. Sub Table1_Init
  91. vpmInit Me
  92. On Error Resume Next
  93. With Controller
  94. .GameName = cGameName
  95. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  96. .SplashInfoLine = "Elecktra (Bally 1981)"&chr(13)&"You Suck"
  97. .HandleMechanics=0
  98. .HandleKeyboard=0
  99. .ShowDMDOnly=1
  100. .ShowFrame=0
  101. .ShowTitle=0
  102. .hidden = 1
  103. If Err Then MsgBox Err.Description
  104. End With
  105. On Error Goto 0
  106. Controller.SolMask(0)=0
  107. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  108. Controller.Run
  109. If Err Then MsgBox Err.Description
  110. On Error Goto 0
  111.  
  112.  
  113. PinMAMETimer.Interval=PinMAMEInterval
  114. PinMAMETimer.Enabled=1
  115.  
  116. vpmNudge.TiltSwitch = 15
  117. vpmNudge.Sensitivity = 1
  118. vpmNudge.TiltObj = Array(LeftSlingshot,RightSlingshot)
  119.  
  120. Set bsTrough = New cvpmBallStack
  121. bsTrough.InitSw 0,1,2,0,0,0,0,0
  122. bsTrough.InitKick BallRelease, 55, 4
  123. bsTrough.InitExitSnd SoundFX("BallRelease",DOFContactors),SoundFX("solenoid",DOFContactors)
  124. bsTrough.Balls = 2
  125.  
  126.  
  127. Set bsTSaucer = New cvpmBallStack
  128. bsTSaucer.InitSaucer SW04,4,90,8
  129. bsTSaucer.KickForceVar = 2
  130. bsTSaucer.InitExitSnd SoundFX("Popper",DOFContactors),SoundFX("solon",DOFContactors)
  131.  
  132.  
  133. Set bsRSaucer = New cvpmBallStack
  134. bsRSaucer.InitSaucer SW03,3,230,10
  135. bsRSaucer.KickForceVar = 2
  136. bsRSaucer.InitExitSnd SoundFX("Popper",DOFContactors),SoundFX("solon",DOFContactors)
  137.  
  138.  
  139. Set bsLSaucer = New cvpmBallStack
  140. bsLSaucer.InitSaucer SW08,8,5,20
  141. bsLSaucer.InitExitSnd SoundFX("Popper",DOFContactors),SoundFX("solon",DOFContactors)
  142. bsLSaucer.AddBall 0
  143.  
  144. SW08.CreateBall
  145. SW06.CreateBall
  146. SW06.Kick 270,1
  147.  
  148.  
  149. Set dtDrop = New cvpmDropTarget
  150. dtDrop.InitDrop Array(SW18,SW19),Array(18,19)
  151. dtDrop.InitSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  152.  
  153. 'Noreturn.isdropped = true
  154. End Sub
  155.  
  156. '**********************************************************************************************************
  157. 'Plunger code
  158. '**********************************************************************************************************
  159.  
  160. Sub Table1_KeyDown(ByVal KeyCode)
  161. if keycode = LeftFlipperKey then Controller.Switch(5) = true
  162. If KeyDownHandler(keycode) Then Exit Sub
  163. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  164. End Sub
  165.  
  166. Sub Table1_KeyUp(ByVal KeyCode)
  167. if keycode = LeftFlipperKey then Controller.Switch(5) = false
  168. If KeyUpHandler(keycode) Then Exit Sub
  169. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  170. End Sub
  171.  
  172. '**********************************************************************************************************
  173. ' SWITCH HANDLING
  174.  
  175.  
  176. 'Kickers
  177. Sub Drain_Hit : bsTrough.AddBall Me : bsTrough.entrysol_on : End Sub
  178. Sub SW03_Hit : bsRSaucer.AddBall 0 : bsRSaucer.entrysol_on : End Sub
  179. Sub SW04_Hit : bsTSaucer.AddBall 0 : bsTSaucer.entrysol_on : End Sub
  180. Sub SW08_Hit : bsLSaucer.AddBall 0 : bsLSaucer.entrysol_on : End Sub
  181.  
  182.  
  183.  
  184. 'Main Playfield
  185. 'Wire triggers
  186. Sub SW12_Hit : Controller.Switch(12) =1 : playsound"rollover" : End Sub
  187. Sub SW12_Unhit : Controller.Switch(12) =0:End Sub
  188. Sub SW13_Hit : Controller.Switch(13) =1 : playsound"rollover" : End Sub
  189. Sub SW13_Unhit : Controller.Switch(13) =0:End Sub
  190. Sub SW14_Hit : Controller.Switch(14) =1 : playsound"rollover" : End Sub
  191. Sub SW14_Unhit : Controller.Switch(14) =0:End Sub
  192.  
  193. 'Spinners
  194. Sub Spinner2_Spin : vpmTimer.PulseSwitch 25, 0, 0 : playsound"fx_spinner" : DOF 106, DOFPulse : End Sub
  195. Sub Spinner1_Spin : vpmTimer.PulseSwitch 26, 0, 0 : playsound"fx_spinner" : DOF 105, DOFPulse : End Sub
  196.  
  197.  
  198. 'Stand Up Targets
  199. Sub SW29_Hit : vpmTimer.PulseSwitch 29, 0, 0 : DOF 104, DOFPulse : End Sub
  200. Sub SW30_Hit : vpmTimer.PulseSwitch 30, 0, 0 : DOF 104, DOFPulse : End Sub
  201. Sub SW31_Hit : vpmTimer.PulseSwitch 31, 0, 0 : DOF 104, DOFPulse : End Sub
  202. Sub SW33_Hit : vpmTimer.PulseSwitch 33, 0, 0 : End Sub
  203. Sub SW34_Hit : vpmTimer.PulseSwitch 34, 0, 0 : End Sub
  204. Sub SW35_Hit : vpmTimer.PulseSwitch 35, 0, 0 : End Sub
  205. Sub SW36_Hit : vpmTimer.PulseSwitch 36, 0, 0 : End Sub
  206. Sub SW37_Hit : vpmTimer.PulseSwitch 37, 0, 0 : End Sub
  207.  
  208.  
  209.  
  210.  
  211. 'Upper Playfield
  212. 'Drop Targets
  213. Sub SW18_Hit : dtDrop.Hit 1 : End Sub
  214. Sub SW19_Hit : dtDrop.Hit 2 : End Sub
  215. 'Stand up Targets
  216. Sub SW20_Hit : vpmTimer.PulseSwitch 20, 0, 0 : End Sub
  217. Sub SW21U_Hit : vpmTimer.PulseSwitch 21, 0, 0 : DOF 102, DOFPulse : End Sub
  218. Sub SW22U_Hit : vpmTimer.PulseSwitch 22, 0, 0 : DOF 102, DOFPulse : End Sub
  219. Sub SW23U_Hit : vpmTimer.PulseSwitch 23, 0, 0 : DOF 102, DOFPulse : End Sub
  220. 'Star Triggers
  221. Sub SW24_Hit : Controller.Switch(24) =1 : playsound"rollover" : End Sub
  222. Sub SW24_Unhit : Controller.Switch(24) =0:End Sub
  223. Sub SW27A_Hit : Controller.Switch(27) =1 : playsound"rollover" : End Sub
  224. Sub SW27A_Unhit: Controller.Switch(27) =0:End Sub
  225. Sub SW27B_Hit : Controller.Switch(27) =1 : playsound"rollover" : End Sub
  226. Sub SW27B_Unhit: Controller.Switch(27) =0:End Sub
  227. Sub SW27C_Hit : Controller.Switch(27) =1 : playsound"rollover" : End Sub
  228. Sub SW27C_Unhit: Controller.Switch(27) =0:End Sub
  229. Sub SW28A_Hit : Controller.Switch(28) =1 : playsound"rollover" : End Sub
  230. Sub SW28A_Unhit: Controller.Switch(28) =0:End Sub
  231. Sub SW28B_Hit : Controller.Switch(28) =1 : playsound"rollover" : End Sub
  232. Sub SW28B_Unhit: Controller.Switch(28) =0:End Sub
  233. Sub SW28C_Hit : Controller.Switch(28) =1 : playsound"rollover" : End Sub
  234. Sub SW28C_Unhit: Controller.Switch(28) =0:End Sub
  235. Sub SW38A_Hit : Controller.Switch(38) =1 : playsound"rollover" : End Sub
  236. Sub SW38A_Unhit: Controller.Switch(38) =0:End Sub
  237. Sub SW38B_Hit : Controller.Switch(38) =1 : playsound"rollover" : End Sub
  238. Sub SW38B_Unhit: Controller.Switch(38) =0:End Sub
  239. 'Sling Shot
  240. Sub SW32_Slingshot : vpmTimer.PulseSwitch 32, 0, 0 : playsound SoundFX("slingshot",DOFContactors) : End Sub
  241.  
  242.  
  243. 'Mini Playfield
  244. 'Stand Up Targets
  245. Sub SW07_Hit : vpmTimer.PulseSwitch 7, 0, 0 : End Sub
  246. Sub SW21L_Hit : vpmTimer.PulseSwitch 21, 0, 0 : DOF 121, DOFPulse : End Sub
  247. Sub SW22L_Hit : vpmTimer.PulseSwitch 22, 0, 0 : DOF 121, DOFPulse : End Sub
  248. Sub SW23L_Hit : vpmTimer.PulseSwitch 23, 0, 0 : DOF 121, DOFPulse : End Sub
  249. Sub SW29L_Hit : vpmTimer.PulseSwitch 29, 0, 0 : DOF 103, DOFPulse : End Sub
  250. Sub SW30L_Hit : vpmTimer.PulseSwitch 30, 0, 0 : DOF 103, DOFPulse : End Sub
  251. Sub SW31L_Hit : vpmTimer.PulseSwitch 31, 0, 0 : DOF 103, DOFPulse : End Sub
  252. 'Star Triggers
  253. Sub SW25L_Hit : Controller.Switch(25) =1 : playsound"rollover" : DOF 108, DOFOn : End Sub
  254. Sub SW25L_Unhit: Controller.Switch(25) =0: DOF 108, DOFOff : End Sub
  255. Sub SW26L_Hit : Controller.Switch(26) =1 : playsound"rollover" : DOF 107, DOFOn : End Sub
  256. Sub SW26L_Unhit: Controller.Switch(26) =0: DOF 107, DOFOff : End Sub
  257.  
  258.  
  259. 'GI Lights
  260. Dim N1,O1
  261. N1=0:O1=0:
  262. Set LampCallback=GetRef("UpdateMultipleLamps")
  263. Sub UpdateMultipleLamps
  264. N1=Controller.Lamp(63)
  265. If N1<>O1 Then
  266. If N1 Then
  267. dim mm
  268. For each mm in GI2:mm.State = 0: Next 'GI Mini PF
  269. dim xx
  270. For each xx in GI:xx.State = 1: Next 'GI Main/Upper PF
  271. Else
  272. For each mm in GI2:mm.State = 1: Next
  273. For each xx in GI:xx.State = 0: Next
  274. End If
  275. O1=N1
  276. End If
  277. End Sub
  278.  
  279.  
  280.  
  281.  
  282. 'Map lights to an array
  283. '**********************************************************************************************************
  284.  
  285. 'Playfield
  286. Set Lights(1) = L1
  287. Set Lights(2) = L2
  288. Set Lights(3) = L3
  289. set lights(6) = L6
  290. set lights(7) = L7
  291. set lights(8) = L8
  292. set lights(10) = L10
  293. set lights(12) = L12
  294. Set Lights(17) = L17
  295. Set Lights(18) = L18
  296. Set Lights(19) = L19
  297. set lights(22) = L22
  298. set lights(23) = l23
  299. set lights(24) = L24
  300. set lights(26) = L26
  301. set lights(28) = L28
  302. Set Lights(33) = L33
  303. Set Lights(34) = L34
  304. Set Lights(35) = L35
  305. set lights(38) = L38
  306. set lights(39) = L39
  307. set lights(40) = L40
  308. set lights(42) = L42
  309. Set Lights(43) = L43 'Shoot Again PF and Backglass
  310. set lights(44) = L44
  311. Set Lights(49) = L49
  312. Set Lights(50) = L50
  313. set lights(54) = L54
  314. set lights(55) = L55
  315. set lights(59) = L59
  316. set lights(60) = L60
  317.  
  318. 'Upper Playfield
  319. set lights(4) = L4
  320. set lights(5) = L5
  321. set lights(9) = L9
  322. set lights(14) = L14
  323. set lights(15) = L15
  324. set lights(20) = l20
  325. set lights(21) = L21
  326. set lights(25) = L25
  327. set lights(30) = L30
  328. set lights(31) = L31
  329. set lights(36) = L36
  330. set lights(37) = L37
  331. set lights(46) = L46
  332. set lights(52) = L52
  333. lights(53) = array(L53,L53a)
  334. set lights(56) = L56
  335. set lights(62) = L62
  336.  
  337. 'Mini playfield
  338. set lights(65) = L65
  339. set lights(66) = L66
  340. set lights(67) = L67
  341. set lights(68) = L68
  342. set lights(69) = L69
  343. set lights(70) = L70
  344. set lights(81) = L81
  345. set lights(82) = L82
  346. set lights(83) = L83
  347. set lights(84) = L84
  348. set lights(85) = L85
  349. set lights(86) = L86
  350. set lights(97) = L97
  351. set lights(98) = L98
  352. set lights(99) = L99
  353. set lights(100) = L100
  354. set lights(101) = L101
  355. set lights(102) = L102
  356. set lights(113) = L113
  357. set lights(114) = L114
  358. set lights(115) = L115
  359. set lights(118) = L118
  360.  
  361. 'Hide All Backglass Lights when desktop Mode
  362. If DesktopMode = True Then
  363. dim xxx
  364. For each xxx in GL:xxx.visible = 1: Next
  365. else
  366. For each xxx in GL:xxx.visible = 0: Next
  367. end if
  368.  
  369. 'Set Lights(13) = 'Ball In Play
  370. 'Set Lights(61) = 'Tilt
  371. 'Set Lights(27) = 'Match
  372. 'Set Lights(29) = 'High Score
  373. 'Set Lights(45) = 'Game Over
  374.  
  375. '**********************************************************************************************************
  376. ' Backglass Light Displays (7 digit 7 segment displays)
  377. Dim Digits(34)
  378.  
  379. ' 1st Player
  380. Digits(0) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16)
  381. Digits(1) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26)
  382. Digits(2) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36)
  383. Digits(3) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46)
  384. Digits(4) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56)
  385. Digits(5) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66)
  386. Digits(6) = Array(LED70,LED71,LED72,LED73,LED74,LED75,LED76)
  387.  
  388. ' 2nd Player
  389. Digits(7) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86)
  390. Digits(8) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96)
  391. Digits(9) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106)
  392. Digits(10) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116)
  393. Digits(11) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126)
  394. Digits(12) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136)
  395. Digits(13) = Array(LED140,LED141,LED142,LED143,LED144,LED145,LED146)
  396.  
  397. ' 3rd Player
  398. Digits(14) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156)
  399. Digits(15) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166)
  400. Digits(16) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176)
  401. Digits(17) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186)
  402. Digits(18) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196)
  403. Digits(19) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206)
  404. Digits(20) = Array(LED210,LED211,LED212,LED213,LED214,LED215,LED216)
  405.  
  406. ' 4th Player
  407. Digits(21) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226)
  408. Digits(22) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236)
  409. Digits(23) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246)
  410. Digits(24) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256)
  411. Digits(25) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266)
  412. Digits(26) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276)
  413. Digits(27) = Array(LED280,LED281,LED282,LED283,LED284,LED285,LED286)
  414.  
  415. ' Credits
  416. Digits(28) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3)
  417. Digits(29) = Array(LED18,LED9,LED27,LED28,LED19,LED8,LED17)
  418. ' Balls
  419. Digits(30) = Array(LED39,LED37,LED48,LED49,LED47,LED29,LED38)
  420. Digits(31) = Array(LED67,LED58,LED69,LED77,LED68,LED57,LED59)
  421.  
  422. 'Elektra Units
  423. Digits(32) = Array(LED88,LED79,LED97,LED98,LED89,LED78,LED87)
  424. Digits(33) = Array(LED109,LED107,LED118,LED119,LED117,LED99,LED108)
  425.  
  426. Sub DisplayTimer_Timer
  427. Dim ChgLED,ii,num,chg,stat,obj
  428. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  429. If Not IsEmpty(ChgLED) Then
  430. If DesktopMode = True Then
  431. For ii = 0 To UBound(chgLED)
  432. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  433. if (num < 34) then
  434. For Each obj In Digits(num)
  435. If chg And 1 Then obj.State = stat And 1
  436. chg = chg\2 : stat = stat\2
  437. Next
  438. else
  439. end if
  440. next
  441. end if
  442. end if
  443. End Sub
  444.  
  445. '**********************************************************************************************************
  446. '**********************************************************************************************************
  447. 'Bally Elektra
  448. 'added by Inkochnito
  449. Sub editDips
  450. Dim vpmDips : Set vpmDips = New cvpmDips
  451. With vpmDips
  452. .AddForm 700,400,"Elektra - DIP switches"
  453. .AddChk 7,10,180,Array("Match feature", &H08000000)'dip 28
  454. .AddChk 205,10,115,Array("Credits display", &H04000000)'dip 27
  455. .AddFrame 2,30,190,"Maximum credits",&H03000000,Array("10 credits",0,"15 credits", &H01000000,"25 credits", &H02000000,"40 credits", &H03000000)'dip 25&26
  456. .AddFrame 2,106,190,"4-5-6 arrow",&H00000020,Array("not in memory",0,"in memory",&H00000020)'dip 6
  457. .AddFrame 2,152,190,"Left blue targets",&H00000040,Array("not in memory",0,"in memory",&H00000040)'dip 7
  458. .AddFrame 2,198,190,"Blue lights feature",&H00000080,Array("conservative 1-2-3-4-5",0,"liberal 1-3-5",&H00000080)'dip 8
  459. .AddFrame 2,248,190,"Minimum time needed",&H00002000,Array("10 Elektra-units",0,"6 Elektra-units",&H00002000)'dip 14
  460. .AddFrame 2,298,190,"Kicker during timeplay",&H00004000,Array("ball stays in kicker",0,"ball kicked out",&H00004000)'dip 15
  461. .AddFrame 2,348,190,"No more Elektra-units",32768,Array("game ends",0,"game goes on",32768)'dip 16
  462. .AddFrame 205,30,190,"Balls per game",&HC0000000,Array ("2 balls",&HC0000000,"3 balls",0,"4 balls",&H80000000,"5 balls",&H40000000)'dip 31&32
  463. .AddFrame 205,106,190,"Frequenty",&H00100000,Array("50Hz",0,"60Hz",&H00100000)'dip 21
  464. .AddFrame 205,152,190,"Centre red targets",&H00200000,Array("not in memory",0,"in memory",&H00200000)'dip 22
  465. .AddFrame 205,198,190,"Top special feature",&H00400000,Array("conservative",0,"liberal",&H00400000)'dip 23
  466. .AddFrame 205,248,190,"Special memory",&H00800000,Array("Off",0,"On",&H00800000)'dip 24
  467. .AddFrame 205,298,190,"Replay limit",&H10000000,Array("no limit",0,"1 replay per game",&H10000000)'dip 29
  468. .AddFrame 205,348,190,"Attract sound",&H20000000,Array("off",0,"on",&H20000000)'dip 30
  469. .AddLabel 50,400,300,20,"Set selftest position 18 and 19 to 03 for the best gameplay."
  470. .AddLabel 50,420,300,20,"After hitting OK, press F3 to reset game with new settings."
  471. .ViewDips
  472. End With
  473. End Sub
  474. Set vpmShowDips = GetRef("editDips")
  475.  
  476. '***************************************************************************************************
  477. 'VPX Function CODE
  478. '***************************************************************************************************
  479.  
  480. '**********Sling Shot Animations
  481. ' Rstep and Lstep are the variables that increment the animation
  482. '****************
  483. Dim RStep, Lstep
  484.  
  485. Sub RightSlingShot_Slingshot
  486. vpmTimer.PulseSwitch 39, 0, 0
  487. PlaySound SoundFX("left_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  488. RSling.Visible = 0
  489. RSling1.Visible = 1
  490. sling1.TransZ = -20
  491. RStep = 0
  492. RightSlingShot.TimerEnabled = 1
  493. End Sub
  494.  
  495. Sub RightSlingShot_Timer
  496. Select Case RStep
  497. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  498. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  499. End Select
  500. RStep = RStep + 1
  501. End Sub
  502.  
  503. Sub LeftSlingShot_Slingshot
  504. vpmTimer.PulseSwitch 40, 0, 0
  505. PlaySound SoundFX("right_slingshot",DOFContactors),0,1,-0.05,0.05
  506. LSling.Visible = 0
  507. LSling1.Visible = 1
  508. sling2.TransZ = -20
  509. LStep = 0
  510. LeftSlingShot.TimerEnabled = 1
  511. End Sub
  512.  
  513. Sub LeftSlingShot_Timer
  514. Select Case LStep
  515. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  516. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  517. End Select
  518. LStep = LStep + 1
  519. End Sub
  520.  
  521.  
  522.  
  523. ' *********************************************************************
  524. ' Supporting Ball & Sound Functions
  525. ' *********************************************************************
  526.  
  527. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  528. Vol = Csng(BallVel(ball) ^2 / 2000)
  529. End Function
  530.  
  531. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  532. Dim tmp
  533. tmp = ball.x * 2 / table1.width-1
  534. If tmp > 0 Then
  535. Pan = Csng(tmp ^10)
  536. Else
  537. Pan = Csng(-((- tmp) ^10) )
  538. End If
  539. End Function
  540.  
  541. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  542. Pitch = BallVel(ball) * 20
  543. End Function
  544.  
  545. Function BallVel(ball) 'Calculates the ball speed
  546. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  547. End Function
  548.  
  549. '*****************************************
  550. ' JP's VP10 Rolling Sounds
  551. '*****************************************
  552.  
  553. Const tnob = 5 ' total number of balls
  554. ReDim rolling(tnob)
  555. InitRolling
  556.  
  557. Sub InitRolling
  558. Dim i
  559. For i = 0 to tnob
  560. rolling(i) = False
  561. Next
  562. End Sub
  563.  
  564. Sub RollingTimer_Timer()
  565. Dim BOT, b
  566. BOT = GetBalls
  567.  
  568. ' stop the sound of deleted balls
  569. For b = UBound(BOT) + 1 to tnob
  570. rolling(b) = False
  571. StopSound("fx_ballrolling" & b)
  572. Next
  573.  
  574. ' exit the sub if no balls on the table
  575. If UBound(BOT) = -1 Then Exit Sub
  576.  
  577. ' play the rolling sound for each ball
  578. For b = 0 to UBound(BOT)
  579. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  580. rolling(b) = True
  581. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  582. Else
  583. If rolling(b) = True Then
  584. StopSound("fx_ballrolling" & b)
  585. rolling(b) = False
  586. End If
  587. End If
  588. Next
  589. End Sub
  590.  
  591. '**********************
  592. ' Ball Collision Sound
  593. '**********************
  594.  
  595. Sub OnBallBallCollision(ball1, ball2, velocity)
  596. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  597. End Sub
  598.  
  599.  
  600.  
  601. '************************************
  602. ' What you need to add to your table
  603. '************************************
  604.  
  605. ' a timer called RollingTimer. With a fast interval, like 10
  606. ' one collision sound, in this script is called fx_collide
  607. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  608. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  609.  
  610.  
  611. '******************************************
  612. ' Explanation of the rolling sound routine
  613. '******************************************
  614.  
  615. ' sounds are played based on the ball speed and position
  616.  
  617. ' the routine checks first for deleted balls and stops the rolling sound.
  618.  
  619. ' The For loop goes through all the balls on the table and checks for the ball speed and
  620. ' if the ball is on the table (height lower than 30) then then it plays the sound
  621. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  622.  
  623. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  624. ' will change according to the ball speed, and the PAN function will change the stereo position according
  625. ' to the position of the ball on the table.
  626.  
  627.  
  628. '**************************************
  629. ' Explanation of the collision routine
  630. '**************************************
  631.  
  632. ' The collision is built in VP.
  633. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  634. ' 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
  635. ' depending of the speed of the collision.
  636.  
  637.  
  638. Sub Pins_Hit (idx)
  639. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  640. End Sub
  641.  
  642. Sub Targets_Hit (idx)
  643. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  644. End Sub
  645.  
  646. Sub Metals_Thin_Hit (idx)
  647. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  648. End Sub
  649.  
  650. Sub Metals_Medium_Hit (idx)
  651. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  652. End Sub
  653.  
  654. Sub Metals2_Hit (idx)
  655. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  656. End Sub
  657.  
  658. Sub Gates_Hit (idx)
  659. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  660. End Sub
  661.  
  662. Sub Spinner_Spin
  663. PlaySound "fx_spinner",0,.25,0,0.25
  664. End Sub
  665.  
  666. Sub Rubbers_Hit(idx)
  667. dim finalspeed
  668. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  669. If finalspeed > 20 then
  670. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  671. End if
  672. If finalspeed >= 6 AND finalspeed <= 20 then
  673. RandomSoundRubber()
  674. End If
  675. End Sub
  676.  
  677. Sub Posts_Hit(idx)
  678. dim finalspeed
  679. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  680. If finalspeed > 16 then
  681. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  682. End if
  683. If finalspeed >= 6 AND finalspeed <= 16 then
  684. RandomSoundRubber()
  685. End If
  686. End Sub
  687.  
  688. Sub RandomSoundRubber()
  689. Select Case Int(Rnd*3)+1
  690. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  691. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  692. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  693. End Select
  694. End Sub
  695.  
  696. Sub LeftFlipper_Collide(parm)
  697. RandomSoundFlipper()
  698. End Sub
  699.  
  700. Sub RightFlipper_Collide(parm)
  701. RandomSoundFlipper()
  702. End Sub
  703.  
  704. Sub RandomSoundFlipper()
  705. Select Case Int(Rnd*3)+1
  706. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  707. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  708. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  709. End Select
  710. End Sub
  711.  
Advertisement
Add Comment
Please, Sign In to add comment