Advertisement
Arngrim

amazing spiderman fix

Jul 1st, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.33 KB | None | 0 0
  1. 'VPX Amazing Spider-Man
  2. ' BorgDog mod of gtxjoe table
  3. '
  4. ' gtxjoe v1.0
  5. '
  6. ' Thanks to all VP contributors present and past
  7. ' Inspiration from Bob5453 and Gaston for their previous Spider-man versions
  8.  
  9. Option Explicit
  10. Randomize
  11.  
  12. Const cGameName = "spiderm7"
  13.  
  14. On Error Resume Next
  15. ExecuteGlobal GetTextFile("controller.vbs")
  16. If Err Then MsgBox "Can't open controller.vbs"
  17. On Error Goto 0
  18.  
  19. LoadVPM "01000100", "sys80.vbs", 2.31
  20.  
  21. Const UseSolenoids = 1
  22. Const UseLamps = 1
  23. Const UseGI = 0
  24.  
  25. ' Standard Sounds
  26. Const SSolenoidOn = ""
  27. Const SSolenoidOff = ""
  28. Const SCoin = "fx_coin"
  29.  
  30. Dim xx, bsTrough, initContacts, dtRDrop, dtLDrop, bsLSaucer, bsMSaucer, bsRSaucer
  31. Sub AmazingSpiderMan_Init()
  32.  
  33.  
  34. On Error Resume Next
  35. With Controller
  36. .GameName = cGameName
  37. .SplashInfoLine = "Amazing Spider-Man, Gottlieb 1980"
  38. .HandleKeyboard = 0
  39. .ShowTitle = 0
  40. .ShowDMDOnly = 1
  41. .ShowFrame = 0
  42. .ShowTitle = 0
  43. .hidden = 1
  44. .Games(cGameName).Settings.Value("rol") = 0
  45. .Run GetPlayerHWnd
  46. If Err Then MsgBox Err.Description
  47. End With
  48. On Error Goto 0
  49.  
  50. ' basic pinmame timer
  51. PinMAMETimer.Interval = PinMAMEInterval
  52. PinMAMETimer.Enabled = 1
  53.  
  54. ' Nudging
  55. vpmNudge.TiltSwitch = 57
  56. vpmNudge.Sensitivity = 3
  57. vpmNudge.TiltObj = Array(Bumper1,Bumper2,LeftSlingshot,RightSlingShot)
  58.  
  59.  
  60. ' ball stack for trough: Gottlieb System 80
  61. Set bsTrough = New cvpmBallStack
  62. bsTrough.InitSw 0, 67, 0, 0, 0, 0, 0, 0
  63. bsTrough.InitKick Drain, 60,25
  64. bsTrough.InitExitSnd Soundfx("BallRelease",DOFContactors), Soundfx("SolOn",DOFContactors)
  65. bsTrough.Balls = 1
  66.  
  67.  
  68. Set dtLDrop = New cvpmDropTarget
  69. dtLDrop.InitDrop Array(sw1,sw11,sw21),Array(1,11,21)
  70. dtLDrop.InitSnd SoundFX("DropTarget",DOFTargets), Soundfx("DropTargetreset",DOFContactors)
  71.  
  72. Set dtRDrop = New cvpmDropTarget
  73. dtRDrop.InitDrop Array(sw0,sw10,sw20,sw30,sw40),Array(0,10,20,30,40)
  74. dtRDrop.InitSnd SoundFX("DropTarget",DOFTargets),Soundfx("DropTargetreset",DOFContactors)
  75.  
  76. if b2son then: for each xx in backdropstuff: xx.visible=0: next
  77. startGame.enabled=true
  78. NTMBox.visible=0 'turn off number to match box
  79. FindDips 'find if match enabled, if so turn back on number to match box
  80.  
  81. End Sub
  82.  
  83. Sub AmazingSpiderMan_Paused:Controller.Pause = 1:End Sub
  84.  
  85. Sub AmazingSpiderMan_unPaused:Controller.Pause = 0:End Sub
  86.  
  87. Sub AmazingSpiderMan_Exit
  88. If b2son then controller.stop
  89. End Sub
  90.  
  91. sub startGame_timer
  92. dim xx
  93. playsound "poweron"
  94. LampTimer.enabled=1
  95. For each xx in GI:xx.State = 1: Next '*****GI Lights On
  96. me.enabled=false
  97. end sub
  98.  
  99. Sub AmazingSpiderMan_KeyDown(ByVal keycode)
  100.  
  101. If vpmKeyDown(keycode) Then Exit Sub
  102. If keycode = PlungerKey Then
  103. Plunger.PullBack
  104. PlaySound "plungerpull",0,1,0.25,0.25
  105. End If
  106. If keycode=AddCreditKey then playsound "coin": vpmTimer.pulseSW (swCoin1): end if
  107.  
  108.  
  109. End Sub
  110.  
  111. Sub AmazingSpiderMan_KeyUp(ByVal keycode)
  112.  
  113. If keycode = 61 then FindDips
  114.  
  115. If keycode = PlungerKey Then
  116. Plunger.Fire
  117. PlaySound "plunger",0,1,0.25,0.25
  118. End If
  119.  
  120. If vpmKeyUp(keycode) Then Exit Sub
  121.  
  122. End Sub
  123.  
  124. Sub Drain_Hit()
  125. PlaySound "drain",0,1,0,0.25
  126. bsTrough.AddBall Me
  127. End Sub
  128.  
  129.  
  130. '*****************************************
  131. 'Solenoids
  132. '*****************************************
  133. SolCallBack(1) = "SolSaucerMid"
  134. SolCallBack(2) = "SolSaucerOuter"
  135. SolCallback(5) = "Lraised" '"dtLDrop.SolDropUp"
  136. SolCallback(6) = "Rraised" '"dtRDrop.SolDropUp"
  137. SolCallback(8) = "SolKnocker"
  138. SolCallback(9) = "SolTrough"
  139.  
  140. SolCallback(sLRFlipper) = "SolRFlipper"
  141. SolCallback(sLLFlipper) = "SolLFlipper"
  142.  
  143. Sub Rraised(enabled)
  144. if enabled then Rreset.enabled=True
  145. End Sub
  146.  
  147. Sub Rreset_timer
  148. dtRDrop.DropSol_On
  149. For each light in DTRightLights: light.state=0: Next
  150. Rreset.enabled=false
  151. End Sub
  152.  
  153. Sub Lraised(enabled)
  154. if enabled then Lreset.enabled=True
  155. End Sub
  156.  
  157. Sub Lreset_timer
  158. dtLDrop.DropSol_On
  159. For each light in DTLeftLights: light.state=0: Next
  160. Lreset.enabled=false
  161. End Sub
  162.  
  163.  
  164. Sub SolLFlipper(Enabled)
  165. If Enabled Then
  166. PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, 1, -0.1, 0.25
  167. LeftFlipper.RotateToEnd
  168. LeftFlipper1.RotateToEnd
  169. GIlflipper.state=1
  170. Else
  171. PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, -0.1, 0.25
  172. LeftFlipper.RotateToStart
  173. LeftFlipper1.RotateToStart
  174. GIlflipper.state=0
  175. End If
  176. End Sub
  177.  
  178. Sub SolRFlipper(Enabled)
  179. If Enabled Then
  180. PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, 1, 0.1, 0.25
  181. RightFlipper.RotateToEnd
  182. RightFlipper1.RotateToEnd
  183. Else
  184. PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, 0.1, 0.25
  185. RightFlipper.RotateToStart
  186. RightFlipper1.RotateToStart
  187. End If
  188. End Sub
  189.  
  190. Sub SolTrough(Enabled)
  191. If Enabled Then bsTrough.ExitSol_On
  192. End Sub
  193.  
  194. Sub SolKnocker(Enabled)
  195. If Enabled Then PlaySound SoundFX("Knocker",DOFKnocker)
  196. End Sub
  197.  
  198. Sub SolSaucerMid(Enabled)
  199. If Enabled Then
  200. sw12.kick 173,6
  201. Controller.Switch(12) = False
  202. PlaySound SoundFX("popper_ball",DOFContactors)
  203. sw12.uservalue=1
  204. sw12.timerenabled=1
  205. PkickarmSW12.rotz=15
  206. end if
  207. End Sub
  208.  
  209. Sub sw12_timer
  210. select case sw12.uservalue
  211. case 2:
  212. PkickarmSW12.rotz=0
  213. me.timerenabled=0
  214. end Select
  215. sw12.uservalue=sw12.uservalue+1
  216. End Sub
  217.  
  218. Sub SolSaucerOuter(Enabled)
  219. If Enabled Then
  220. Sw2.kick 176,6
  221. Controller.Switch(2) = False
  222. PlaySound SoundFX("popper_ball",DOFContactors)
  223. sw22.kick 170,6
  224. Controller.Switch(22) = False
  225. sw2.uservalue=1
  226. sw2.timerenabled=1
  227. PkickarmSW2.rotz=15
  228. PkickarmSW22.rotz=15
  229. end if
  230. End Sub
  231.  
  232. Sub sw2_timer
  233. select case sw2.uservalue
  234. case 2:
  235. PkickarmSW2.rotz=0
  236. me.timerenabled=0
  237. end Select
  238. sw2.uservalue=sw2.uservalue+1
  239. End Sub
  240.  
  241. '*****************************************
  242. 'Switches
  243. '*****************************************
  244.  
  245. Sub sw0_Hit : dtRDrop.Hit 1 : GIsw0.state=1: End Sub
  246. Sub sw10_Hit : dtRDrop.Hit 2 : GIsw10.state=1: End Sub
  247. Sub sw20_Hit : dtRDrop.Hit 3 : GIsw20.state=1: End Sub
  248. Sub sw30_Hit : dtRDrop.Hit 4 : GIsw30.state=1: End Sub
  249. Sub sw40_Hit : dtRDrop.Hit 5 : GIsw40.state=1: End Sub
  250. Sub sw1_Hit : dtLDrop.Hit 1 : GIsw1.state=1: End Sub
  251. Sub sw11_Hit : dtLDrop.Hit 2 : GIsw11.state=1: End Sub
  252. Sub sw21_Hit : dtLDrop.Hit 3 : GIsw21.state=1: End Sub
  253.  
  254. Sub sw31_Hit : debug.print "31":vpmTimer.PulseSw 31:DOF 111, DOFPulse:End Sub
  255. Sub sw31a_Hit : vpmTimer.PulseSw 31:DOF 112, DOFPulse:End Sub
  256.  
  257. Sub sw32a_Hit : vpmTimer.PulseSw 32: End Sub
  258. Sub sw32b_Hit : vpmTimer.PulseSw 32: End Sub
  259. Sub sw32c_Hit : vpmTimer.PulseSw 32: End Sub
  260. Sub sw32d_Hit : vpmTimer.PulseSw 32: End Sub
  261.  
  262. Sub sw41_Hit : debug.print "41": vpmTimer.PulseSw 41:DOF 112, DOFPulse:End Sub
  263. Sub sw41a_Hit : vpmTimer.PulseSw 41:DOF 109, DOFPulse:End Sub
  264.  
  265. Sub DingwallA_hit()
  266. vpmTimer.PulseSw 42
  267. SlingA.visible=0
  268. SlingA1.visible=1
  269. me.uservalue=1
  270. Me.timerenabled=1
  271. End Sub
  272.  
  273. sub dingwalla_timer
  274. select case dingwalla.uservalue
  275. Case 1: SlingA1.visible=0: SlingA.visible=1
  276. case 2: SlingA.visible=0: SlingA2.visible=1
  277. Case 3: SlingA2.visible=0: SlingA.visible=1: Me.timerenabled=0
  278. end Select
  279. me.uservalue=me.uservalue+1
  280. end sub
  281.  
  282. Sub DingwallB_hit()
  283. vpmTimer.PulseSw 42
  284. SlingB.visible=0
  285. SlingB1.visible=1
  286. me.uservalue=1
  287. Me.timerenabled=1
  288. End Sub
  289.  
  290. sub dingwallb_timer 'default 50 timer
  291. select case DingwallB.uservalue
  292. Case 1: Slingb1.visible=0: SlingB.visible=1
  293. case 2: SlingB.visible=0: Slingb2.visible=1
  294. Case 3: Slingb2.visible=0: SlingB.visible=1: Me.timerenabled=0
  295. end Select
  296. DingwallB.uservalue=DingwallB.uservalue+1
  297. end sub
  298.  
  299. Sub sw42a_Hit : vpmTimer.PulseSw 42: End Sub
  300. Sub sw42b_Hit : vpmTimer.PulseSw 42: End Sub
  301. Sub sw42c_Hit : vpmTimer.PulseSw 42: End Sub
  302. Sub sw42d_Hit : vpmTimer.PulseSw 42: End Sub
  303.  
  304.  
  305. Sub sw50_Hit : vpmTimer.PulseSw 50: End Sub
  306. Sub sw51_Hit : vpmTimer.PulseSw 51:DOF 105, DOFPulse:End Sub
  307. Sub sw51a_Hit : vpmTimer.PulseSw 51:DOF 107, DOFPulse:End Sub
  308. Sub sw61_Hit : vpmTimer.PulseSw 61:DOF 106, DOFPulse:End Sub
  309. Sub sw61a_Hit : vpmTimer.PulseSw 61:DOF 108, DOFPulse:End Sub
  310. Sub sw70_Hit : vpmTimer.PulseSw 70:playsound SoundFX("target",DOFTargets): End Sub
  311. Sub sw71_Hit : vpmTimer.PulseSw 71:playsound SoundFX("target",DOFTargets): End Sub
  312.  
  313. Sub sw60_spin
  314. vpmTimer.PulseSw 60
  315. PlaySound "fx_spinner",0,.25,0,0.25
  316. ' playsound "fx_spinner"
  317. End Sub
  318.  
  319. Sub sw2_Hit
  320. Controller.Switch(2) = True
  321. PlaySound "kicker_enter"
  322. End Sub
  323. Sub sw12_Hit
  324. Controller.Switch(12) = True
  325. PlaySound "kicker_enter"
  326. End Sub
  327. Sub sw22_Hit
  328. Controller.Switch(22) = True
  329. PlaySound "kicker_enter"
  330. End Sub
  331.  
  332.  
  333. Sub Bumper1_Hit
  334. vpmTimer.PulseSw 72
  335. PlaySound SoundFX("fx_bumper2",DOFContactors)
  336. DOF 104,DOFPulse
  337. End Sub
  338.  
  339. Sub Bumper2_Hit
  340. vpmTimer.PulseSw 72
  341. PlaySound SoundFX("fx_bumper2",DOFContactors)
  342. DOF 103,DOFPulse
  343. End Sub
  344.  
  345.  
  346.  
  347. '**********Sling Shot Animations
  348. ' Rstep and Lstep are the variables that increment the animation
  349. '****************
  350. Dim RStep, Lstep
  351.  
  352. Sub RightSlingShot_Slingshot
  353. vpmTimer.PulseSw 42
  354. DOF 102,DOFPulse
  355. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  356. RSling.Visible = 0
  357. RSling1.Visible = 1
  358. sling1.objroty = -15
  359. RStep = 0
  360. RightSlingShot.TimerEnabled = 1
  361. End Sub
  362.  
  363. Sub RightSlingShot_Timer
  364. Select Case RStep
  365. Case 2:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.objroty = -7
  366. Case 3:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.objroty = 0:RightSlingShot.TimerEnabled = 0
  367. End Select
  368. RStep = RStep + 1
  369. End Sub
  370.  
  371. Sub LeftSlingShot_Slingshot
  372. vpmTimer.PulseSw 42
  373. DOF 101,DOFPulse
  374. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  375. LSling.Visible = 0
  376. LSling1.Visible = 1
  377. sling2.objroty = 15
  378. LStep = 0
  379. LeftSlingShot.TimerEnabled = 1
  380. End Sub
  381.  
  382. Sub LeftSlingShot_Timer
  383. Select Case LStep
  384. Case 2:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.objroty = 7
  385. Case 3:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.objroty = 0:LeftSlingShot.TimerEnabled = 0
  386. End Select
  387. LStep = LStep + 1
  388. End Sub
  389.  
  390. Sub FlipperTimer_Timer()
  391.  
  392. End Sub
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399. ' *********************************************************************
  400. ' Supporting Ball & Sound Functions
  401. ' *********************************************************************
  402.  
  403. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  404. Vol = Csng(BallVel(ball) ^2 / 500)
  405. End Function
  406.  
  407. Function Vol2(ball1, ball2) ' Calculates the Volume of the sound based on the speed of two balls
  408. Vol2 = (Vol(ball1) + Vol(ball2) ) / 2
  409. End Function
  410.  
  411. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  412. Dim tmp
  413. tmp = ball.x * 2 / AmazingSpiderMan.width-1
  414. If tmp> 0 Then
  415. Pan = Csng(tmp ^10)
  416. Else
  417. Pan = Csng(-((- tmp) ^10) )
  418. End If
  419. End Function
  420.  
  421. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  422. Pitch = BallVel(ball) * 20
  423. End Function
  424.  
  425. Function BallVel(ball) 'Calculates the ball speed
  426. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  427. End Function
  428.  
  429. '*****************************************
  430. ' JP's VP10 Collision & Rolling Sounds
  431. '*****************************************
  432.  
  433. Const tnob = 16 ' total number of balls
  434. ReDim rolling(tnob)
  435. ReDim collision(tnob)
  436. Initcollision
  437.  
  438. Sub Initcollision
  439. Dim i
  440. For i = 0 to tnob
  441. collision(i) = -1
  442. rolling(i) = False
  443. Next
  444. End Sub
  445.  
  446. Sub CollisionTimer_Timer()
  447.  
  448. 'Added flipper and gate and spinner rotation here
  449. dim PI:PI=3.1415926
  450. LFLogo.RotY = LeftFlipper.CurrentAngle
  451. LFLogo1.RotY = LeftFlipper1.CurrentAngle
  452. RFLogo.RotY = RightFlipper.CurrentAngle
  453. RFLogo1.RotY = RightFlipper1.CurrentAngle
  454. PrimGate3.Rotz = Gate3.CurrentAngle * 70/90
  455. PrimGate1.Rotz = Gate1.CurrentAngle * 70/90
  456. PrimSw60.Rotz = sw60.CurrentAngle
  457. SpinnerRod.TransZ = sin( (sw60.CurrentAngle+180) * (2*PI/360)) * 5
  458. SpinnerRod.TransX = -1*(sin( (sw60.CurrentAngle- 90) * (2*PI/360)) * 5)
  459.  
  460.  
  461. Dim BOT, B, B1, B2, dx, dy, dz, distance, radii
  462. BOT = GetBalls
  463.  
  464. ' rolling
  465.  
  466. For B = UBound(BOT) +1 to tnob
  467. rolling(b) = False
  468. StopSound("fx_ballrolling" & b)
  469. Next
  470.  
  471. If UBound(BOT) = -1 Then Exit Sub
  472.  
  473. For B = 0 to UBound(BOT)
  474. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  475. rolling(b) = True
  476. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  477. Else
  478. If rolling(b) = True Then
  479. StopSound("fx_ballrolling" & b)
  480. rolling(b) = False
  481. End If
  482. End If
  483. Next
  484.  
  485. 'collision
  486.  
  487. If UBound(BOT) < 1 Then Exit Sub
  488.  
  489. For B1 = 0 to UBound(BOT)
  490. For B2 = B1 + 1 to UBound(BOT)
  491. dz = INT(ABS((BOT(b1).z - BOT(b2).z) ) )
  492. radii = BOT(b1).radius + BOT(b2).radius
  493. If dz <= radii Then
  494.  
  495. dx = INT(ABS((BOT(b1).x - BOT(b2).x) ) )
  496. dy = INT(ABS((BOT(b1).y - BOT(b2).y) ) )
  497. distance = INT(SQR(dx ^2 + dy ^2) )
  498.  
  499. If distance <= radii AND (collision(b1) = -1 OR collision(b2) = -1) Then
  500. collision(b1) = b2
  501. collision(b2) = b1
  502. PlaySound("fx_collide"), 0, Vol2(BOT(b1), BOT(b2)), Pan(BOT(b1)), 0, Pitch(BOT(b1)), 0, 0
  503. Else
  504. If distance > (radii + 10) Then
  505. If collision(b1) = b2 Then collision(b1) = -1
  506. If collision(b2) = b1 Then collision(b2) = -1
  507. End If
  508. End If
  509. End If
  510. Next
  511. Next
  512. End Sub
  513.  
  514.  
  515. '************************************
  516. ' What you need to add to your table
  517. '************************************
  518.  
  519. ' a timer called CollisionTimer. With a fast interval, like from 1 to 10
  520. ' one collision sound, in this script is called fx_collide
  521. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  522. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  523.  
  524.  
  525. '******************************************
  526. ' Explanation of the rolling sound routine
  527. '******************************************
  528.  
  529. ' sounds are played based on the ball speed and position
  530.  
  531. ' the routine checks first for deleted balls and stops the rolling sound.
  532.  
  533. ' The For loop goes through all the balls on the table and checks for the ball speed and
  534. ' if the ball is on the table (height lower than 30) then then it plays the sound
  535. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  536.  
  537. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  538. ' will change according to the ball speed, and the PAN function will change the stereo position according
  539. ' to the position of the ball on the table.
  540.  
  541.  
  542. '**************************************
  543. ' Explanation of the collision routine
  544. '**************************************
  545.  
  546. ' The Double For loop: This is a double cycle used to check the collision between a ball and the other ones.
  547. ' If you look at the parameters of both cycles, you’ll notice they are designed to avoid checking
  548. ' collision twice. For example, I will never check collision between ball 2 and ball 1,
  549. ' because I already checked collision between ball 1 and 2. So, if we have 4 balls,
  550. ' the collision checks will be: ball 1 with 2, 1 with 3, 1 with 4, 2 with 3, 2 with 4 and 3 with 4.
  551.  
  552. ' Sum first the radius of both balls, and if the height between them is higher then do not calculate anything more,
  553. ' since the balls are on different heights so they can't collide.
  554.  
  555. ' The next 3 lines calculates distance between xth and yth balls with the Pytagorean theorem,
  556.  
  557. ' The first "If": Checking if the distance between the two balls is less than the sum of the radius of both balls,
  558. ' and both balls are not already colliding.
  559.  
  560. ' Why are we checking if balls are already in collision?
  561. ' Because we do not want the sound repeting when two balls are resting closed to each other.
  562.  
  563. ' Set the collision property of both balls to True, and we assign the number of the ball colliding
  564.  
  565. ' Play the collide sound of your choice using the VOL, PAN and PITCH functions
  566.  
  567. ' Last lines: If the distance between 2 balls is more than the radius of a ball,
  568. ' then there is no collision and then set the collision property of the ball to False (-1).
  569.  
  570. Sub Rollovers_Hit (idx)
  571. 'PlaySound "rollover", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  572. PlaySound "rollover"
  573. End Sub
  574.  
  575. Sub Pins_Hit (idx)
  576. ' PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  577. PlaySound "pinhit_low"
  578. End Sub
  579.  
  580. Sub Targets_Hit (idx)
  581. 'PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  582. PlaySound "target"
  583. End Sub
  584.  
  585. Sub Metals_Thin_Hit (idx)
  586. 'PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  587. PlaySound "metalhit_thin"
  588. End Sub
  589.  
  590. Sub Metals_Medium_Hit (idx)
  591. 'PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  592. PlaySound "metalhit_medium"
  593. End Sub
  594.  
  595. Sub Metals2_Hit (idx)
  596. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  597. End Sub
  598.  
  599. Sub Gates_Hit (idx)
  600. PlaySound "fx_gate", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  601. End Sub
  602.  
  603. Sub Spinner_Spin
  604. PlaySound "fx_spinner",0,.25,0,0.25
  605. End Sub
  606.  
  607. Sub Rubbers_Hit(idx)
  608. dim finalspeed
  609. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  610. If finalspeed > 20 then
  611. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  612. End if
  613. If finalspeed >= 6 AND finalspeed <= 20 then
  614. RandomSoundRubber()
  615. End If
  616. End Sub
  617.  
  618. Sub Posts_Hit(idx)
  619. dim finalspeed
  620. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  621. If finalspeed > 16 then
  622. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  623. End if
  624. If finalspeed >= 6 AND finalspeed <= 16 then
  625. RandomSoundRubber()
  626. End If
  627. End Sub
  628.  
  629. Sub RandomSoundRubber()
  630. Select Case Int(Rnd*3)+1
  631. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  632. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  633. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  634. End Select
  635. End Sub
  636.  
  637. Sub LeftFlipper_Collide(parm)
  638. RandomSoundFlipper()
  639. End Sub
  640. Sub LeftFlipper1_Collide(parm)
  641. RandomSoundFlipper()
  642. End Sub
  643.  
  644. Sub RightFlipper_Collide(parm)
  645. RandomSoundFlipper()
  646. End Sub
  647. Sub RightFlipper1_Collide(parm)
  648. RandomSoundFlipper()
  649. End Sub
  650.  
  651. Sub RandomSoundFlipper()
  652. Select Case Int(Rnd*3)+1
  653. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  654. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  655. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  656. End Select
  657. End sub
  658.  
  659. 'Finding an individual dip state based on scapino's Strikes and spares dip code - from unclewillys pinball pool, added another section to get high score award to set replay cards
  660. Dim TheDips(32)
  661. Sub FindDips
  662. Dim DipsNumber
  663. DipsNumber = Controller.Dip(1)
  664. TheDips(16) = Int(DipsNumber/128)
  665. If TheDips(16) = 1 then DipsNumber = DipsNumber - 128 end if
  666. TheDips(15) = Int(DipsNumber/64)
  667. If TheDips(15) = 1 then DipsNumber = DipsNumber - 64 end if
  668. TheDips(14) = Int(DipsNumber/32)
  669. If TheDips(14) = 1 then DipsNumber = DipsNumber - 32 end if
  670. TheDips(13) = Int(DipsNumber/16)
  671. If TheDips(13) = 1 then DipsNumber = DipsNumber - 16 end if
  672. TheDips(12) = Int(DipsNumber/8)
  673. If TheDips(12) = 1 then DipsNumber = DipsNumber - 8 end if
  674. TheDips(11) = Int(DipsNumber/4)
  675. If TheDips(11) = 1 then DipsNumber = DipsNumber - 4 end if
  676. TheDips(10) = Int(DipsNumber/2)
  677. If TheDips(10) = 1 then DipsNumber = DipsNumber - 2 end if
  678. TheDips(9) = Int(DipsNumber)
  679. DipsNumber = Controller.Dip(2)
  680. TheDips(24) = Int(DipsNumber/128)
  681. If TheDips(24) = 1 then DipsNumber = DipsNumber - 128 end if
  682. TheDips(23) = Int(DipsNumber/64)
  683. If TheDips(23) = 1 then DipsNumber = DipsNumber - 64 end if
  684. TheDips(22) = Int(DipsNumber/32)
  685. If TheDips(22) = 1 then DipsNumber = DipsNumber - 32 end if
  686. TheDips(21) = Int(DipsNumber/16)
  687. If TheDips(21) = 1 then DipsNumber = DipsNumber - 16 end if
  688. TheDips(20) = Int(DipsNumber/8)
  689. If TheDips(20) = 1 then DipsNumber = DipsNumber - 8 end if
  690. TheDips(19) = Int(DipsNumber/4)
  691. If TheDips(19) = 1 then DipsNumber = DipsNumber - 4 end if
  692. TheDips(18) = Int(DipsNumber/2)
  693. If TheDips(18) = 1 then DipsNumber = DipsNumber - 2 end if
  694. TheDips(17) = Int(DipsNumber)
  695. DipsTimer.Enabled=1
  696. End Sub
  697.  
  698. Sub DipsTimer_Timer()
  699. dim match
  700. match = TheDips(18)
  701. if match = 1 and NOT b2son then
  702. NTMBox.visible=1
  703. else
  704. NTMBox.visible=0
  705. end if
  706. ' hsaward = TheDips(22)
  707. ' BPG = TheDips(17)
  708. ' If BPG = 1 then
  709. ' instcard.image="InstCard3Balls"
  710. ' Else
  711. ' instcard.image="InstCard5Balls"
  712. ' End if
  713. ' replaycard.image="replaycard"&hsaward
  714. DipsTimer.enabled=0
  715. End Sub
  716.  
  717. Sub editDips
  718. Dim vpmDips : Set vpmDips = New cvpmDips
  719. With vpmDips
  720. .AddForm 700,400,"Spiderman - DIP switches"
  721. .AddFrame 2,0,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"25 credits",49152)'dip 15&16
  722. .AddFrame 2,76,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
  723. .AddFrame 2,122,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
  724. .AddFrame 2,168,190,"Game mode",&H00100000,Array("replay",0,"extra ball",&H00100000)'dip 21
  725. .AddFrame 2,214,190,"3rd coin chute credits control",&H00001000,Array("no effect",0,"add 9",&H00001000)'dip 13
  726. .AddFrame 2,260,190,"Tilt penalty",&H10000000,Array("game over",0,"ball in play",&H10000000)'dip 29
  727. .AddChk 2,310,140,Array("Sound when scoring?",&H01000000)'dip 25
  728. .AddChk 2,325,140,Array("Replay button tune?",&H02000000)'dip 26
  729. .AddChk 2,340,140,Array("Coin switch tune?",&H04000000)'dip 27
  730. .AddFrame 205,0,190,"High game to date awards",&H00C00000,Array("not displayed and no award",0,"displayed and no award",&H00800000,"displayed and 2 replays",&H00400000,"displayed and 3 replays",&H00C00000)'dip 23&24
  731. .AddFrameExtra 205,76,190,"Attract tune",&H0200,Array("no attract tune",0,"attract tune played every 6 minutes",&H0200)'S-board dip 2
  732. .AddFrame 205,122,190,"Balls per game",&H00010000,Array("5 balls",0,"3 balls",&H00010000)'dip 17
  733. .AddFrame 205,168,190,"Replay limit",&H00040000,Array("no limit",0,"one per game",&H00040000)'dip 19
  734. .AddFrame 205,214,190,"Novelty",&H00080000,Array("normal game mode",0,"50K for special/extra ball",&H0080000)'dip 20
  735. .AddFrameExtra 205,260,190,"Sound option",&H0100,Array("sound mode",0,"tone mode",&H0100)'S-board dip 1
  736. .AddChk 205,310,140,Array("Credits displayed?",&H08000000)'dip 28
  737. .AddChk 205,325,140,Array("Match feature",&H00020000)'dip 18
  738. .AddChk 205,340,140,Array("Attract features",&H20000000)'dip 30
  739. .AddLabel 50,360,300,20,"After hitting OK, press F3 to reset game with new settings."
  740. End With
  741. Dim extra
  742. extra = Controller.Dip(4) + Controller.Dip(5)*256
  743. extra = vpmDips.ViewDipsExtra(extra)
  744. Controller.Dip(4) = extra And 255
  745. Controller.Dip(5) = (extra And 65280)\256 And 255
  746. End Sub
  747. Set vpmShowDips = GetRef("editDips")
  748.  
  749.  
  750. Dim N1,O1, Light
  751. N1=0:O1=0:
  752. Set LampCallback=GetRef("UpdateMultipleLamps")
  753.  
  754. Sub UpdateMultipleLamps
  755. if startGame.enabled=0 then
  756. N1=Controller.Lamp(0) 'Game Over triggers match and BIP
  757. If N1 Then
  758. BIPBox.text="BALL IN PLAY"
  759. NTMBox.text=""
  760. GOBox.text=""
  761. Else
  762. BIPBox.text=""
  763. NTMBox.text="NUMBER TO MATCH"
  764. GOBox.text="GAME OVER"
  765. End If
  766.  
  767. N1=Controller.Lamp(1) 'Tilt
  768. If N1 Then
  769. TILTBox.text="TILT"
  770. Else
  771. TILTBox.text=""
  772. End If
  773.  
  774. N1=Controller.Lamp(3) 'Shoot Again
  775. If N1 Then
  776. ShootAgainBox.text="SHOOT AGAIN"
  777. Else
  778. ShootAgainBox.text=""
  779. End If
  780.  
  781. N1=Controller.Lamp(10) 'HIGH SCORE TO DATE
  782. If N1 Then
  783. HStoDateBox.text="HIGH SCORE TO DATE"
  784. Else
  785. HStoDateBox.text=""
  786. End If
  787. end if
  788. End Sub
  789.  
  790. '**********************************************************************************************************
  791.  
  792. 'Map lights to an array
  793. '**********************************************************************************************************
  794. 'Set Lights(0) = l0 ' Game Over Relay
  795. 'Set Lights(1) = l1 ' Tilt relay
  796. 'Set Lights(2) = l2 ' Coin Lockout Relay
  797. Set Lights(3) = l3 ' Shoot Again Playfield and backglass
  798. Set Lights(4) = l4 ' first player
  799. Set Lights(5) = l5 ' second player
  800. Set Lights(6) = l6 'third player
  801. Set Lights(7) = l7 ' fourth player
  802.  
  803. 'Set Lights(10) = l10 ' high game to date - backbox
  804. 'Set Lights(11) = l11 ' game over - backbox
  805. Set Lights(12) = l12
  806. Set Lights(13) = l13
  807. Set Lights(14) = l14
  808. Set Lights(15) = l15
  809. Set Lights(16) = l16
  810. Set Lights(17) = l17
  811. Set Lights(18) = l18
  812. Set Lights(19) = l19
  813. Set Lights(20) = l20
  814. Set Lights(21) = l21
  815. Set Lights(22) = l22
  816. Set Lights(23) = l23
  817. Set Lights(24) = l24
  818. Set Lights(25) = l25
  819. Set Lights(26) = l26
  820. Set Lights(27) = l27
  821. Set Lights(28) = l28
  822. Set Lights(29) = l29
  823. Set Lights(30) = l30
  824. Set Lights(31) = l31
  825. Set Lights(32) = l32
  826. Set Lights(33) = l33
  827. Set Lights(34) = l34
  828. Set Lights(35) = L35
  829. Set Lights(36) = l36
  830. Set Lights(37) = l37
  831. Set Lights(38) = l38
  832. Set Lights(39) = l39
  833. Set Lights(40) = l40
  834. Set Lights(41) = l41
  835. Set Lights(42) = l42
  836. Set Lights(43) = l43
  837. Set Lights(44) = l44
  838. Lights(45) = array(l45,l45b)
  839. Lights(46) = array(l46,l46b)
  840. Lights(47) = array(l47,l47b)
  841.  
  842. Lights(49) = array(l49,l49b)
  843. Lights(50) = array(l50,l50b)
  844. Set Lights(51) = l51
  845.  
  846.  
  847.  
  848. Dim Digits(32)
  849.  
  850. 'Score displays
  851.  
  852. Digits(0)=Array(a1,a2,a3,a4,a5,a6,a7,n,a8)
  853. Digits(1)=Array(a9,a10,a11,a12,a13,a14,a15,n,a16)
  854. Digits(2)=Array(a17,a18,a19,a20,a21,a22,a23,n,a24)
  855. Digits(3)=Array(a25,a26,a27,a28,a29,a30,a31,n,a32)
  856. Digits(4)=Array(a33,a34,a35,a36,a37,a38,a39,n,a40)
  857. Digits(5)=Array(a41,a42,a43,a44,a45,a46,a47,n,a48)
  858. Digits(6)=Array(a49,a50,a51,a52,a53,a54,a55,n,a56)
  859. Digits(7)=Array(a57,a58,a59,a60,a61,a62,a63,n,a64)
  860. Digits(8)=Array(a65,a66,a67,a68,a69,a70,a71,n,a72)
  861. Digits(9)=Array(a73,a74,a75,a76,a77,a78,a79,n,a80)
  862. Digits(10)=Array(a81,a82,a83,a84,a85,a86,a87,n,a88)
  863. Digits(11)=Array(a89,a90,a91,a92,a93,a94,a95,n,a96)
  864. Digits(12)=Array(a97,a98,a99,a100,a101,a102,a103,n,a104)
  865. Digits(13)=Array(a105,a106,a107,a108,a109,a110,a111,n,a112)
  866. Digits(14)=Array(a113,a114,a115,a116,a117,a118,a119,n,a120)
  867. Digits(15)=Array(a121,a122,a123,a124,a125,a126,a127,n,a128)
  868. Digits(16)=Array(a129,a130,a131,a132,a133,a134,a135,n,a136)
  869. Digits(17)=Array(a137,a138,a139,a140,a141,a142,a143,n,a144)
  870. Digits(18)=Array(a145,a146,a147,a148,a149,a150,a151,n,a152)
  871. Digits(19)=Array(a153,a154,a155,a156,a157,a158,a159,n,a160)
  872. Digits(20)=Array(a161,a162,a163,a164,a165,a166,a167,n,a168)
  873. Digits(21)=Array(a169,a170,a171,a172,a173,a174,a175,n,a176)
  874. Digits(22)=Array(a177,a178,a179,a180,a181,a182,a183,n,a184)
  875. Digits(23)=Array(a185,a186,a187,a188,a189,a190,a191,n,a192)
  876.  
  877. 'Ball in Play and Credit displays
  878.  
  879. Digits(26)=Array(e00,e01,e02,e03,e04,e05,e06,n)
  880. Digits(27)=Array(e10,e11,e12,e13,e14,e15,e16,n)
  881. Digits(24)=Array(f00,f01,f02,f03,f04,f05,f06,n)
  882. Digits(25)=Array(f10,f11,f12,f13,f14,f15,f16,n)
  883.  
  884.  
  885. Sub DisplayTimer_Timer
  886. Dim ChgLED,ii,num,chg,stat, obj
  887. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  888. If Not IsEmpty(ChgLED) Then
  889. If not b2son Then
  890. For ii = 0 To UBound(chgLED)
  891. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  892. if (num < 28 ) then
  893. For Each obj In Digits(num)
  894. If chg And 1 Then obj.State = stat And 1
  895. chg = chg\2 : stat = stat\2
  896. Next
  897. else
  898.  
  899. end if
  900. next
  901. end if
  902. end if
  903. End Sub
  904.  
  905.  
  906.  
  907. Sub B2SCommand(nr, state)
  908. If cController = 3 Then
  909. Controller.B2SSetData nr, state
  910. End If
  911. End Sub
  912.  
  913. Sub DOF(dofevent, dofstate)
  914. '*******Use DOF 1**, 1 to activate a ledwiz output*******************
  915. '*******Use DOF 1**, 0 to deactivate a ledwiz output*****************
  916. '*******Use DOF 1**, 2 to pulse a ledwiz output**********************
  917. If cController > 2 Then
  918. If dofstate = 2 Then
  919. Controller.B2SSetData dofevent, 1
  920. Controller.B2SSetData dofevent, 0
  921. Else
  922. Controller.B2SSetData dofevent, dofstate
  923. End If
  924. End If
  925. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement