Arngrim

250cc

Dec 8th, 2019
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.20 KB | None | 0 0
  1. ' 250 cc / IPD No. 4089 / Inder 1992 / 4 Players
  2. ' VPX table by JPSalas version 1.0.0
  3.  
  4. Option Explicit
  5. Randomize
  6.  
  7. On Error Resume Next
  8. ExecuteGlobal GetTextFile("controller.vbs")
  9. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  10. On Error Goto 0
  11.  
  12. LoadVPM "01550000", "inder.vbs", 3.26
  13.  
  14. Dim bsTrough, dtBankL, dtBankR, dtBankT, TopBall, x
  15.  
  16. Const cGameName = "ind250cc"
  17.  
  18. Const UseSolenoids = 2
  19. Const UseLamps = 0
  20. Const UseGI = 0
  21. Const UseSync = 0 'set it to 1 if the table runs too fast
  22. Const HandleMech = 0
  23.  
  24. Dim VarHidden
  25. If Table1.ShowDT = true then
  26. VarHidden = 1
  27. For each x in aReels
  28. x.Visible = 1
  29. Next
  30. lrail.Visible = 1
  31. rrail.Visible = 1
  32. else
  33. VarHidden = 0
  34. For each x in aReels
  35. x.Visible = 0
  36. Next
  37. lrail.Visible = 0
  38. rrail.Visible = 0
  39. end if
  40.  
  41. if B2SOn = true then VarHidden = 1
  42.  
  43. ' Standard Sounds
  44. Const SSolenoidOn = "fx_SolenoidOn"
  45. Const SSolenoidOff = "fx_SolenoidOff"
  46. Const SFlipperOn = ""
  47. Const SFlipperOff = ""
  48. Const SCoin = "fx_Coin"
  49.  
  50. '************
  51. ' Table init.
  52. '************
  53.  
  54. Sub table1_Init
  55. vpmInit me
  56. With Controller
  57. .GameName = cGameName
  58. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description:Exit Sub
  59. .SplashInfoLine = "250cc - Inder 1992" & vbNewLine & "VPX table by JPSalas 1.0.0"
  60. .HandleKeyboard = 0
  61. .ShowTitle = 0
  62. .ShowDMDOnly = 1
  63. .ShowFrame = 0
  64. .HandleMechanics = 0
  65. .Hidden = 1
  66. .Games(cGameName).Settings.Value("rol") = 0
  67. '.SetDisplayPosition 0,0,GetPlayerHWnd 'uncomment if you can't see the dmd
  68. On Error Resume Next
  69. Controller.SolMask(0) = 0
  70. vpmTimer.AddTimer 2000, "Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the Timer to renable all the solenoids after 2 seconds
  71. Controller.Run GetPlayerHWnd
  72. On Error Goto 0
  73. End With
  74.  
  75. ' Nudging
  76. vpmNudge.TiltSwitch = 53
  77. vpmNudge.Sensitivity = 5
  78. vpmNudge.TiltObj = Array(Bumper1, Bumper2)
  79.  
  80. ' Trough
  81. Set bsTrough = New cvpmBallStack
  82. With bsTrough
  83. .InitSw 0, 91, 0, 0, 0, 0, 0, 0
  84. .InitKick BallRelease, 80, 6
  85. .InitExitSnd SoundFX("fx_ballrel", DOFContactors), SoundFX("fx_Solenoid", DOFContactors)
  86. .Balls = 1
  87. End With
  88.  
  89. ' Drop targets
  90. Set dtBankL = New cvpmDropTarget
  91. With dtBankL
  92. .InitDrop array(sw54, sw64, sw74), array(74, 84, 94)
  93. .InitSnd SoundFX("", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  94. .CreateEvents "dtBankL"
  95. End With
  96.  
  97. Set dtBankR = New cvpmDropTarget
  98. With dtBankR
  99. .InitDrop array(sw55, sw65, sw75), array(75, 85, 95)
  100. .InitSnd SoundFX("", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  101. .CreateEvents "dtBankR"
  102. End With
  103.  
  104. Set dtBankT = New cvpmDropTarget
  105. With dtBankT
  106. .InitDrop array(sw47, sw46, sw45), array(67, 66, 65)
  107. .InitSnd SoundFX("", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  108. .CreateEvents "dtBankT"
  109. End With
  110.  
  111. ' Main Timer init
  112. PinMAMETimer.Interval = PinMAMEInterval
  113. PinMAMETimer.Enabled = 1
  114.  
  115. ' Turn on Gi
  116. vpmtimer.addtimer 1500, "GiOn '"
  117.  
  118. Set TopBall = TopBallC.CreateBall:TopBallC.Kick 180, 1
  119. End Sub
  120.  
  121. Sub table1_Paused:Controller.Pause = 1:End Sub
  122. Sub table1_unPaused:Controller.Pause = 0:End Sub
  123. Sub table1_exit:Controller.stop:End Sub
  124.  
  125. '**********
  126. ' Keys
  127. '**********
  128.  
  129. Sub table1_KeyDown(ByVal Keycode)
  130. If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25
  131. If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25
  132. If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25
  133. If vpmKeyDown(keycode)Then Exit Sub
  134. If keycode = PlungerKey Then PlaySoundat "fx_PlungerPull", Plunger:Plunger.Pullback
  135. If keycode = KeyRules Then Rules
  136. End Sub
  137.  
  138. Sub table1_KeyUp(ByVal Keycode)
  139. If vpmKeyUp(keycode)Then Exit Sub
  140. If keycode = PlungerKey Then PlaySoundAt "fx_plunger", Plunger:Plunger.Fire
  141. End Sub
  142.  
  143. '*********
  144. ' Switches
  145. '*********
  146.  
  147. ' Scoring rubbers
  148. Sub RubberBand9_Hit:vpmTimer.PulseSw 92:End Sub
  149. Sub RubberBand7_Hit:vpmTimer.PulseSw 92:End Sub
  150. Sub RubberBand6_Hit:vpmTimer.PulseSw 92:End Sub
  151. Sub RubberBand2_Hit:vpmTimer.PulseSw 92:End Sub
  152. Sub RubberBand3_Hit:vpmTimer.PulseSw 92:End Sub
  153.  
  154. ' Bumpers
  155. Sub Bumper1_Hit:vpmTimer.PulseSw 96:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper1:End Sub
  156. Sub Bumper2_Hit:vpmTimer.PulseSw 86:PlaySoundAt SoundFX("fx_bumper", DOFContactors), Bumper2:End Sub
  157.  
  158. ' Drain & holes
  159. Sub Drain_Hit:PlaysoundAt "fx_drain", Drain:bsTrough.AddBall Me:End Sub
  160. Sub sw43_Hit():vpmTimer.PulseSw 63:PlaySoundAt "fx_balldrop", sw43:End Sub
  161. Sub sw42_Hit():vpmTimer.PulseSw 62:PlaySoundAt "fx_balldrop", sw42:End Sub
  162. Sub sw41_Hit():vpmTimer.PulseSw 61:PlaySoundAt "fx_balldrop", sw41:End Sub
  163. Sub sw40_Hit():vpmTimer.PulseSw 60:PlaySoundAt "fx_balldrop", sw40:End Sub
  164. Sub Vuk1_Hit():x = ActiveBall.VelX:Vuk1.destroyball:Vuk2.CreateBall:Vuk2.Kick 90, x:End Sub
  165.  
  166. ' Rollovers
  167. Sub sw44_Hit:Controller.Switch(64) = 1:PlaySoundAt "fx_sensor", sw44:End Sub
  168. Sub sw44_UnHit:Controller.Switch(64) = 0:End Sub
  169.  
  170. Sub sw73a_Hit:Controller.Switch(93) = 1:PlaySoundAt "fx_sensor", sw73a:End Sub
  171. Sub sw73a_UnHit:Controller.Switch(93) = 0:End Sub
  172.  
  173. Sub sw73b_Hit:Controller.Switch(93) = 1:PlaySoundAt "fx_sensor", sw73b:End Sub
  174. Sub sw73b_UnHit:Controller.Switch(93) = 0:End Sub
  175.  
  176. Sub sw70a_Hit:Controller.Switch(90) = 1:PlaySoundAt "fx_sensor", sw70a:DOF 104, DOFOn:End Sub
  177. Sub sw70a_UnHit:Controller.Switch(90) = 0:DOF 104, DOFOff:End Sub
  178.  
  179. Sub sw70b_Hit:Controller.Switch(90) = 1:PlaySoundAt "fx_sensor", sw70b:DOF 103, DOFOn:End Sub
  180. Sub sw70b_UnHit:Controller.Switch(90) = 0:DOF 103, DOFOff:End Sub
  181.  
  182. Sub sw70c_Hit:Controller.Switch(90) = 1:PlaySoundAt "fx_sensor", sw70c:End Sub
  183. Sub sw70c_UnHit:Controller.Switch(90) = 0:End Sub
  184.  
  185. Sub sw32_Hit:Controller.Switch(52) = 1:PlaySoundAt "fx_sensor", sw32:End Sub
  186. Sub sw32_UnHit:Controller.Switch(52) = 0:End Sub
  187.  
  188. Sub sw50_Hit:Controller.Switch(70) = 1:PlaySoundAt "fx_sensor", sw50:End Sub
  189. Sub sw50_UnHit:Controller.Switch(70) = 0:End Sub
  190.  
  191. Sub sw51_Hit:Controller.Switch(71) = 1:PlaySoundAt "fx_sensor", sw51:End Sub
  192. Sub sw51_UnHit:Controller.Switch(71) = 0:End Sub
  193.  
  194. Sub sw52_Hit:Controller.Switch(72) = 1:PlaySoundAt "fx_sensor", sw52:End Sub
  195. Sub sw52_UnHit:Controller.Switch(72) = 0:End Sub
  196.  
  197. Sub sw60_Hit:Controller.Switch(80) = 1:PlaySoundAt "fx_sensor", sw60:End Sub
  198. Sub sw60_UnHit:Controller.Switch(80) = 0:End Sub
  199.  
  200. Sub sw61_Hit:Controller.Switch(81) = 1:PlaySoundAt "fx_sensor", sw61:End Sub
  201. Sub sw61_UnHit:Controller.Switch(81) = 0:End Sub
  202.  
  203. Sub sw62_Hit:Controller.Switch(82) = 1:PlaySoundAt "fx_sensor", sw62:End Sub
  204. Sub sw62_UnHit:Controller.Switch(82) = 0:End Sub
  205.  
  206. ' Droptargets hit sound
  207. Sub sw54_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw54:End Sub
  208. Sub sw64_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw64:End Sub
  209. Sub sw74_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw74:End Sub
  210. Sub sw55_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw55:End Sub
  211. Sub sw65_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw65:End Sub
  212. Sub sw75_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw75:End Sub
  213. Sub sw47_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw47:End Sub
  214. Sub sw46_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw46:End Sub
  215. Sub sw45_Hit:PlaySoundAt SoundFX("fx_droptarget", DOFDropTargets), sw45:End Sub
  216.  
  217. 'Targets
  218. Sub sw53a_Hit:vpmTimer.PulseSw 73:PlaySoundAtBall SoundFXDOF("fx_target", 102, DOFPulse, DOFDropTargets):End Sub
  219. Sub sw53b_Hit:vpmTimer.PulseSw 73:PlaySoundAtBall SoundFXDOF("fx_target", 101, DOFPulse, DOFDropTargets):End Sub
  220. Sub sw63_Hit:vpmTimer.PulseSw 83:PlaySoundAtBall SoundFX("fx_target", DOFDropTargets):End Sub
  221. Sub sw63a_Hit:vpmTimer.PulseSw 83:PlaySoundAtBall SoundFX("fx_target", DOFDropTargets):End Sub
  222. Sub sw67_Hit:vpmTimer.PulseSw 87:PlaySoundAtBall SoundFX("fx_target", DOFDropTargets):End Sub
  223. Sub sw77_Hit:vpmTimer.PulseSw 97:PlaySoundAtBall SoundFX("fx_target", DOFDropTargets):End Sub
  224. Sub sw57_Hit:vpmTimer.PulseSw 77:PlaySoundAtBall SoundFX("fx_target", DOFDropTargets):End Sub
  225. Sub sw56_Hit:vpmTimer.PulseSw 76:PlaySoundAtBall SoundFX("fx_target", DOFDropTargets):End Sub
  226.  
  227. 'Top Ball
  228. Dim TempBall
  229. Sub Post_Hit:Set TempBall = ActiveBall:TopBall.VelX = - TempBall.VelX:TopBall.VelY = TempBall.VelY * 5:End Sub
  230.  
  231. '*********
  232. 'Solenoids
  233. '*********
  234. SolCallback(3) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  235. SolCallback(4) = "bsTrough.SolOut"
  236. SolCallback(5) = "vpmNudge.SolGameOn"
  237. SolCallback(8) = "dtBankT.SolDropUp"
  238.  
  239. '**************
  240. ' Flipper Subs
  241. '**************
  242.  
  243. SolCallback(sLRFlipper) = "SolRFlipper"
  244. SolCallback(sLLFlipper) = "SolLFlipper"
  245.  
  246. Sub SolLFlipper(Enabled)
  247. If Enabled Then
  248. PlaySoundAt SoundFX("fx_flipperup", DOFFlippers), LeftFlipper
  249. LeftFlipper.RotateToEnd
  250. Else
  251. PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers), LeftFlipper
  252. LeftFlipper.RotateToStart
  253. End If
  254. End Sub
  255.  
  256. Sub SolRFlipper(Enabled)
  257. If Enabled Then
  258. PlaySoundAt SoundFX("fx_flipperup", DOFFlippers), RightFlipper
  259. RightFlipper.RotateToEnd
  260. Else
  261. PlaySoundAt SoundFX("fx_flipperdown", DOFFlippers), RightFlipper
  262. RightFlipper.RotateToStart
  263. End If
  264. End Sub
  265.  
  266. Sub LeftFlipper_Collide(parm)
  267. PlaySound "fx_rubber_flipper", 0, parm / 10, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  268. End Sub
  269.  
  270. Sub RightFlipper_Collide(parm)
  271. PlaySound "fx_rubber_flipper", 0, parm / 10, pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  272. End Sub
  273.  
  274. '*****************
  275. ' Gi Effects
  276. '*****************
  277.  
  278. Dim OldGiState
  279. OldGiState = -1 'start witht he Gi off
  280.  
  281. Sub SolGi(enabled)
  282. If enabled Then
  283. GiOff
  284. Else
  285. GiOn
  286. End If
  287. End Sub
  288.  
  289. Sub GiON
  290. For each x in aGiLights
  291. x.State = 1
  292. Next
  293. End Sub
  294.  
  295. Sub GiOFF
  296. For each x in aGiLights
  297. x.State = 0
  298. Next
  299. End Sub
  300.  
  301. Sub GiEffect(enabled)
  302. If enabled Then
  303. For each x in aGiLights
  304. x.Duration 2, 1000, 1
  305. Next
  306. End If
  307. End Sub
  308.  
  309. Sub GIUpdate
  310. Dim tmp, obj
  311. tmp = Getballs
  312. If UBound(tmp) <> OldGiState Then
  313. OldGiState = Ubound(tmp)
  314. If UBound(tmp) = -1 Then
  315. GiOff
  316. Else
  317. GiOn
  318. End If
  319. End If
  320. End Sub
  321.  
  322. '************************************
  323. ' Game timer for real time updates
  324. '(some tables may use it's own timer)
  325. '************************************
  326.  
  327. Set MotorCallback = GetRef("RealTimeUpdates")
  328.  
  329. Sub RealTimeUpdates
  330. RollingUpdate
  331. LeftFlipperP.RotZ = LeftFlipper.CurrentAngle
  332. RightFlipperP.RotZ = RightFlipper.CurrentAngle
  333. gatep.roty = gatef.CurrentAngle
  334. End Sub
  335.  
  336. '**********************************************************
  337. ' JP's Flasher Fading for VPX and Vpinmame
  338. ' (Based on Pacdude's Fading Light System)
  339. ' This is a fast fading for the Flashers in vpinmame tables
  340. ' just 4 steps, like in Pacdude's original script.
  341. ' Included the new Modulated flashers & Lights for WPC
  342. '**********************************************************
  343.  
  344. Dim LampState(200), FadingState(200), FlashLevel(200)
  345.  
  346. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  347.  
  348. ' vpinmame Lamp & Flasher Timers
  349.  
  350. Sub LampTimer_Timer()
  351. Dim chgLamp, num, chg, ii
  352. chgLamp = Controller.ChangedLamps
  353. If Not IsEmpty(chgLamp)Then
  354. For ii = 0 To UBound(chgLamp)
  355. LampState(chgLamp(ii, 0)) = chgLamp(ii, 1) 'keep the real state in an array
  356. FadingState(chgLamp(ii, 0)) = chgLamp(ii, 1) + 3 'fading step
  357. Next
  358. End If
  359. UpdateLeds
  360. UpdateLamps
  361. End Sub
  362.  
  363. Sub UpdateLamps()
  364. Lamp 1, li1
  365. Lamp 2, li2
  366. Lamp 3, li3
  367. Lamp 6, li6 ' "Match"
  368. Lamp 7, li7 ' "Game Over"
  369. Flash 9, li9
  370. Flash 10, li10
  371. Flash 11, li11
  372. Flash 12, li12
  373. Lamp 17, li17
  374. Lamp 18, li18
  375. Lamp 19, li19
  376. Lamp 20, li20
  377. Lamp 21, li21
  378. Lamp 25, li25
  379. Lamp 26, li26
  380. Lamp 27, li27
  381. Lamp 28, li28
  382. Lamp 31, li31 ' "Ball in Play"
  383. Lamp 32, li32 ' "Handicap"
  384. Lamp 33, li33
  385. Lamp 43, li43
  386. Lamp 44, li44
  387. Lamp 45, li45
  388. Lamp 46, li46
  389. Lamp 47, li47
  390. Lamp 48, li48
  391. Lamp 49, li49
  392. Lamp 50, li50
  393. Lamp 51, li51
  394. Lamp 52, li52
  395. Lamp 53, li53
  396. Lamp 54, li54
  397. Lamp 55, li55
  398. Lamp 56, li56
  399.  
  400. ' 1 is on, 0 is off
  401. If LampState(14) = 1 Then
  402. GateF.RotateToStart
  403. Else
  404. GateF.RotateToEnd
  405. End If
  406. If LampState(15) = 0 Then dtBankL.DropSol_On: LampState(15) = 1
  407. If LampState(16) = 0 Then dtBankR.DropSol_On: LampState(16) = 1
  408. 'DisplayExtraBall
  409. If LampState(36) = 1 And LampState(37) = 1 Then Extra.SetValue 0
  410. If LampState(36) = 0 And LampState(37) = 1 Then Extra.SetValue 1
  411. If LampState(36) = 1 And LampState(37) = 0 Then Extra.SetValue 2
  412. If LampState(36) = 0 And LampState(37) = 0 Then Extra.SetValue 3
  413. End Sub
  414.  
  415. ' div lamp subs
  416.  
  417. ' Normal Lamp & Flasher subs
  418.  
  419. Sub InitLamps()
  420. Dim x
  421. LampTimer.Interval = 25 ' flasher fading speed
  422. LampTimer.Enabled = 1
  423. For x = 0 to 200
  424. LampState(x) = 0
  425. FadingState(x) = 3 ' used to track the fading state
  426. FlashLevel(x) = 0
  427. Next
  428. End Sub
  429.  
  430. Sub SetLamp(nr, value) ' 0 is off, 1 is on
  431. FadingState(nr) = abs(value) + 3
  432. End Sub
  433.  
  434. ' Lights: used for VPX standard lights, the fading is handled by VPX itself, they are here to be able to make them work together with the flashers
  435.  
  436. Sub Lamp(nr, object)
  437. Select Case FadingState(nr)
  438. Case 4:object.state = 1:FadingState(nr) = 0
  439. Case 3:object.state = 0:FadingState(nr) = 0
  440. End Select
  441. End Sub
  442.  
  443. Sub Lampm(nr, object) ' used for multiple lights, it doesn't change the fading state
  444. Select Case FadingState(nr)
  445. Case 4:object.state = 1
  446. Case 3:object.state = 0
  447. End Select
  448. End Sub
  449.  
  450. ' Flashers: 4 is on,3,2,1 fade steps. 0 is off
  451.  
  452. Sub Flash(nr, object)
  453. Select Case FadingState(nr)
  454. Case 4:Object.IntensityScale = 1:FadingState(nr) = 0
  455. Case 3:Object.IntensityScale = 0.66:FadingState(nr) = 2
  456. Case 2:Object.IntensityScale = 0.33:FadingState(nr) = 1
  457. Case 1:Object.IntensityScale = 0:FadingState(nr) = 0
  458. End Select
  459. End Sub
  460.  
  461. Sub Flashm(nr, object) 'multiple flashers, it doesn't change the fading state
  462. Select Case FadingState(nr)
  463. Case 4:Object.IntensityScale = 1
  464. Case 3:Object.IntensityScale = 0.66
  465. Case 2:Object.IntensityScale = 0.33
  466. Case 1:Object.IntensityScale = 0
  467. End Select
  468. End Sub
  469.  
  470. ' Desktop Objects: Reels & texts (you may also use lights on the desktop)
  471.  
  472. ' Reels
  473.  
  474. Sub Reel(nr, object)
  475. Select Case FadingState(nr)
  476. Case 4:object.SetValue 1:FadingState(nr) = 0
  477. Case 3:object.SetValue 2:FadingState(nr) = 2
  478. Case 2:object.SetValue 3:FadingState(nr) = 1
  479. Case 1:object.SetValue 0:FadingState(nr) = 0
  480. End Select
  481. End Sub
  482.  
  483. Sub Reelm(nr, object)
  484. Select Case FadingState(nr)
  485. Case 4:object.SetValue 1
  486. Case 3:object.SetValue 2
  487. Case 2:object.SetValue 3
  488. Case 1:object.SetValue 0
  489. End Select
  490. End Sub
  491.  
  492. 'Texts
  493.  
  494. Sub Text(nr, object, message)
  495. Select Case FadingState(nr)
  496. Case 4:object.Text = message:FadingState(nr) = 0
  497. Case 3:object.Text = "":FadingState(nr) = 0
  498. End Select
  499. End Sub
  500.  
  501. Sub Textm(nr, object, message)
  502. Select Case FadingState(nr)
  503. Case 4:object.Text = message
  504. Case 3:object.Text = ""
  505. End Select
  506. End Sub
  507.  
  508. ' Modulated Subs for the WPC tables
  509.  
  510. Sub SetModLamp(nr, level)
  511. FlashLevel(nr) = level / 150 'lights & flashers
  512. End Sub
  513.  
  514. Sub LampMod(nr, object) ' modulated lights used as flashers
  515. Object.IntensityScale = FlashLevel(nr)
  516. Object.State = 1 'in case it was off
  517. End Sub
  518.  
  519. Sub FlashMod(nr, object) 'sets the flashlevel from the SolModCallback
  520. Object.IntensityScale = FlashLevel(nr)
  521. End Sub
  522.  
  523. 'Walls and mostly Primitives used as 4 step fading lights
  524. 'a,b,c,d are the images used from on to off
  525.  
  526. Sub FadeObj(nr, object, a, b, c, d)
  527. Select Case FadingState(nr)
  528. Case 4:object.image = a:FadingState(nr) = 0 'fading to off...
  529. Case 3:object.image = b:FadingState(nr) = 2
  530. Case 2:object.image = c:FadingState(nr) = 1
  531. Case 1:object.image = d:FadingState(nr) = 0
  532. End Select
  533. End Sub
  534.  
  535. Sub FadeObjm(nr, object, a, b, c, d)
  536. Select Case FadingState(nr)
  537. Case 4:object.image = a
  538. Case 3:object.image = b
  539. Case 2:object.image = c
  540. Case 1:object.image = d
  541. End Select
  542. End Sub
  543.  
  544. Sub NFadeObj(nr, object, a, b)
  545. Select Case FadingState(nr)
  546. Case 4:object.image = a:FadingState(nr) = 0 'off
  547. Case 3:object.image = b:FadingState(nr) = 0 'on
  548. End Select
  549. End Sub
  550.  
  551. Sub NFadeObjm(nr, object, a, b)
  552. Select Case FadingState(nr)
  553. Case 4:object.image = a
  554. Case 3:object.image = b
  555. End Select
  556. End Sub
  557.  
  558. 'Modulated lights & Flashers
  559.  
  560. Sub SetModLamp(nr, level)
  561. FlashLevel(nr) = level / 150 'lights & flashers
  562. End Sub
  563.  
  564. Sub LightMod(nr, object) ' modulated lights used as flashers
  565. Object.IntensityScale = FlashLevel(nr)
  566. Object.State = 1
  567. End Sub
  568.  
  569. Sub FlashMod(nr, object) 'sets the flashlevel from the SolModCallback
  570. Object.IntensityScale = FlashLevel(nr)
  571. End Sub
  572.  
  573. '*********************
  574. 'LED's based on Eala's
  575. '*********************
  576. Dim Digits(32)
  577. Digits(0) = Array(a00, a02, a05, a06, a04, a01, a03, a07)
  578. Digits(1) = Array(a10, a12, a15, a16, a14, a11, a13)
  579. Digits(2) = Array(a20, a22, a25, a26, a24, a21, a23)
  580. Digits(3) = Array(a30, a32, a35, a36, a34, a31, a33, a37)
  581. Digits(4) = Array(a40, a42, a45, a46, a44, a41, a43)
  582. Digits(5) = Array(a50, a52, a55, a56, a54, a51, a53)
  583. Digits(6) = Array(a60, a62, a65, a66, a64, a61, a63)
  584.  
  585. Digits(7) = Array(e00, e02, e05, e06, e04, e01, e03, e07)
  586. Digits(8) = Array(e10, e12, e15, e16, e14, e11, e13)
  587. Digits(9) = Array(e20, e22, e25, e26, e24, e21, e23)
  588. Digits(10) = Array(e30, e32, e35, e36, e34, e31, e33, e37)
  589. Digits(11) = Array(e40, e42, e45, e46, e44, e41, e43)
  590. Digits(12) = Array(e50, e52, e55, e56, e54, e51, e53)
  591. Digits(13) = Array(e60, e62, e65, e66, e64, e61, e63)
  592.  
  593. Digits(14) = Array(b00, b02, b05, b06, b04, b01, b03, b07)
  594. Digits(15) = Array(b10, b12, b15, b16, b14, b11, b13)
  595. Digits(16) = Array(b20, b22, b25, b26, b24, b21, b23)
  596. Digits(17) = Array(b30, b32, b35, b36, b34, b31, b33, b37)
  597. Digits(18) = Array(b40, b42, b45, b46, b44, b41, b43)
  598. Digits(19) = Array(b50, b52, b55, b56, b54, b51, b53)
  599. Digits(20) = Array(b60, b62, b65, b66, b64, b61, b63)
  600.  
  601. Digits(21) = Array(f00, f02, f05, f06, f04, f01, f03, f07)
  602. Digits(22) = Array(f10, f12, f15, f16, f14, f11, f13)
  603. Digits(23) = Array(f20, f22, f25, f26, f24, f21, f23)
  604. Digits(24) = Array(f30, f32, f35, f36, f34, f31, f33, f37)
  605. Digits(25) = Array(f40, f42, f45, f46, f44, f41, f43)
  606. Digits(26) = Array(f50, f52, f55, f56, f54, f51, f53)
  607. Digits(27) = Array(f60, f62, f65, f66, f64, f61, f63)
  608.  
  609. Digits(28) = Array(d00, d02, d05, d06, d04, d01, d03)
  610. Digits(29) = Array(d10, d12, d15, d16, d14, d11, d13)
  611.  
  612. Digits(30) = Array(c00, c02, c05, c06, c04, c01, c03)
  613. Digits(31) = Array(c10, c12, c15, c16, c14, c11, c13)
  614.  
  615. '********************
  616. 'Update LED's display
  617. '********************
  618.  
  619. Sub UpdateLeds()
  620. Dim ChgLED, ii, num, chg, stat, obj
  621. ChgLED = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  622. If Not IsEmpty(ChgLED)Then
  623. For ii = 0 To UBound(chgLED)
  624. num = chgLED(ii, 0):chg = chgLED(ii, 1):stat = chgLED(ii, 2)
  625. For Each obj In Digits(num)
  626. If chg And 1 Then obj.State = stat And 1
  627. chg = chg \ 2:stat = stat \ 2
  628. Next
  629. Next
  630. End If
  631. End Sub
  632.  
  633. '******************************
  634. ' Diverse Collection Hit Sounds
  635. '******************************
  636.  
  637. Sub aMetals_Hit(idx):PlaySoundAtBall "fx_MetalHit":End Sub
  638. Sub aRubber_Bands_Hit(idx):PlaySoundAtBall "fx_rubber_band":End Sub
  639. Sub aRubber_Posts_Hit(idx):PlaySoundAtBall "fx_rubber_post":End Sub
  640. Sub aRubber_Pins_Hit(idx):PlaySoundAtBall "fx_rubber_pin":End Sub
  641. Sub aPlastics_Hit(idx):PlaySoundAtBall "fx_PlasticHit":End Sub
  642. Sub aGates_Hit(idx):PlaySoundAtBall "fx_Gate":End Sub
  643. Sub aWoods_Hit(idx):PlaySoundAtBall "fx_Woodhit":End Sub
  644.  
  645. ' *********************************************************************
  646. ' Supporting Ball & Sound Functions
  647. ' *********************************************************************
  648.  
  649. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  650. Vol = Csng(BallVel(ball) ^2 / 2000)
  651. End Function
  652.  
  653. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  654. Dim tmp
  655. tmp = ball.x * 2 / table1.width-1
  656. If tmp > 0 Then
  657. Pan = Csng(tmp ^10)
  658. Else
  659. Pan = Csng(-((- tmp) ^10))
  660. End If
  661. End Function
  662.  
  663. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  664. Pitch = BallVel(ball) * 20
  665. End Function
  666.  
  667. Function BallVel(ball) 'Calculates the ball speed
  668. BallVel = (SQR((ball.VelX ^2) + (ball.VelY ^2)))
  669. End Function
  670.  
  671. Function AudioFade(ball) 'only on VPX 10.4 and newer
  672. Dim tmp
  673. tmp = ball.y * 2 / Table1.height-1
  674. If tmp > 0 Then
  675. AudioFade = Csng(tmp ^10)
  676. Else
  677. AudioFade = Csng(-((- tmp) ^10))
  678. End If
  679. End Function
  680.  
  681. Sub PlaySoundAt(soundname, tableobj) 'play sound at X and Y position of an object, mostly bumpers, flippers and other fast objects
  682. PlaySound soundname, 0, 1, Pan(tableobj), 0, 0, 0, 0, AudioFade(tableobj)
  683. End Sub
  684.  
  685. Sub PlaySoundAtBall(soundname) ' play a sound at the ball position, like rubbers, targets
  686. PlaySound soundname, 0, Vol(ActiveBall), pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  687. End Sub
  688.  
  689. '*****************************************
  690. ' JP's VP10 Rolling Sounds
  691. '*****************************************
  692.  
  693. Const tnob = 8 ' total number of balls
  694. Const lob = 0 'number of locked balls
  695. ReDim rolling(tnob)
  696. InitRolling
  697.  
  698. Sub InitRolling
  699. Dim i
  700. For i = 0 to tnob
  701. rolling(i) = False
  702. Next
  703. End Sub
  704.  
  705. Sub RollingUpdate()
  706. Dim BOT, b, ballpitch, ballvol
  707. BOT = GetBalls
  708.  
  709. ' stop the sound of deleted balls
  710. For b = UBound(BOT) + 1 to tnob
  711. rolling(b) = False
  712. StopSound("fx_ballrolling" & b)
  713. Next
  714.  
  715. ' exit the sub if no balls on the table
  716. If UBound(BOT) = lob - 1 Then Exit Sub 'there no extra balls on this table
  717.  
  718. ' play the rolling sound for each ball
  719. For b = lob to UBound(BOT)
  720. If BallVel(BOT(b)) > 1 Then
  721. If BOT(b).z < 30 Then
  722. ballpitch = Pitch(BOT(b))
  723. ballvol = Vol(BOT(b))
  724. Else
  725. ballpitch = Pitch(BOT(b)) + 20000 'increase the pitch on a ramp
  726. ballvol = Vol(BOT(b)) * 4
  727. End If
  728. rolling(b) = True
  729. PlaySound("fx_ballrolling" & b), -1, ballvol, Pan(BOT(b)), 0, ballpitch, 1, 0, AudioFade(BOT(b))
  730. Else
  731. If rolling(b) = True Then
  732. StopSound("fx_ballrolling" & b)
  733. rolling(b) = False
  734. End If
  735. End If
  736. Next
  737. End Sub
  738.  
  739. '**********************
  740. ' Ball Collision Sound
  741. '**********************
  742.  
  743. Sub OnBallBallCollision(ball1, ball2, velocity)
  744. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  745. End Sub
  746.  
  747. '***************
  748. ' Rules
  749. '***************
  750. Dim Msg(20)
  751. Sub Rules()
  752. Msg(0) = "250 cc - Inder 1992" &Chr(10)&Chr(10)
  753. Msg(1) = ""
  754. Msg(2) = "Side Droptargets: "
  755. Msg(3) = " Reds: Lites Extra Ball on the upper right floor"
  756. Msg(4) = " Yellows: Lites Extra Ball on captive ball"
  757. Msg(5) = " Greens: Lites Special on the upper right floor"
  758. Msg(6) = " Left side: Lites Extra Ball on the Outlane"
  759. Msg(7) = " Right side: Open right outlane gate"
  760. Msg(8) = " Both sides: Lites Special alternate on lower side targets"
  761. Msg(9) = ""
  762. Msg(10) = "Upper Droptargets"
  763. Msg(11) = " 1st target: Lites X5 on the left upper lane"
  764. Msg(12) = " 2nd target: Lites Extra ball on the left upper lane"
  765. Msg(13) = " 3rd target: Lites Special on the left upper lane"
  766. Msg(14) = ""
  767. Msg(15) = "Lanes 1-2-3"
  768. Msg(16) = " Turning off the three 1-2-3 lights lites 500.000 points"
  769. Msg(17) = " on the upper right floor and extra ball"
  770. Msg(18) = ""
  771. Msg(19) = ""
  772. Msg(20) = ""
  773. For X = 1 To 20
  774. Msg(0) = Msg(0) + Msg(X)&Chr(13)
  775. Next
  776. MsgBox Msg(0), , " Instructions and Rule Card"
  777. End Sub
  778.  
  779. 'Inder 250CC
  780. 'added by Inkochnito
  781. Sub editDips
  782. Dim vpmDips:Set vpmDips = New cvpmDips
  783. With vpmDips
  784. .AddForm 700, 400, "250CC - DIP switches"
  785. .AddFrame 2, 0, 392, "Credits per coin", &H00000003, Array("1 coin - 1 credit && 1 coin - 4 credits", 0, "2 coins - 1 credit (4 coins - 3 credits) && 1 coin - 3 credits", &H00000003) 'SL1-3&4 (dip 1&2)
  786. .AddFrame 2, 92, 190, "Handicap value", &H00000300, Array("5,000,000 points", 0, "5,200,000 points", &H00000100, "5,400,000 points", &H00000200, "5,600,000 points", &H00000300) 'SL2-4&3(dip 9&10)
  787. .AddFrame 205, 46, 190, "Balls per game", &H00000008, Array("3 balls", 0, "5 balls", &H00000008) 'SL1-1 (dip 4)
  788. .AddFrame 205, 92, 190, "Replay threshold", &H000000C0, Array("3,000,000 points", 0, "3,300,000 points", &H00000080, "3,500,000 points", &H00000040, "3,800,000 points", &H000000C0) 'SL1-6&5 (dip 7&8)
  789. .AddFrame 2, 46, 190, "Allow extra ball", &H00400000, Array("yes", 0, "no", &H00400000) 'SL3-6 (dip 23)
  790. .AddLabel 50, 180, 300, 20, "After hitting OK, press F3 to reset game with new settings."
  791. .ViewDips
  792. End With
  793. End Sub
  794.  
  795. Set vpmShowDips = GetRef("editDips")
Advertisement
Add Comment
Please, Sign In to add comment