Arngrim

Untitled

Jul 17th, 2017
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.12 KB | None | 0 0
  1. Option Explicit
  2.  
  3. On Error Resume Next
  4. ExecuteGlobal GetTextFile("controller.vbs")
  5. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  6. On Error Goto 0
  7.  
  8. 'Place the rom name in the constant below, will be used for VPM to load the rom
  9. 'and for DOF to load the right DOF Config from the Configtool, whether is a VPM or an Original table
  10.  
  11. 'Const cGameName = ""
  12.  
  13. If Table1.ShowDT = false then
  14. Scoretext.Visible = false
  15. End If
  16.  
  17. Sub Table1_KeyDown(ByVal keycode)
  18.  
  19. If keycode = PlungerKey Then
  20. Plunger.PullBack
  21. PlaySound "plungerpull",0,1,0.25,0.25
  22. End If
  23.  
  24. If keycode = LeftFlipperKey Then
  25. LeftFlipper.RotateToEnd
  26. PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, .67, -0.05, 0.05
  27. End If
  28.  
  29. If keycode = RightFlipperKey Then
  30. RightFlipper.RotateToEnd
  31. PlaySound SoundFX("fx_flipperup",DOFFlippers), 0, .67, 0.05, 0.05
  32. End If
  33.  
  34. If keycode = LeftTiltKey Then
  35. Nudge 90, 2
  36. End If
  37.  
  38. If keycode = RightTiltKey Then
  39. Nudge 270, 2
  40. End If
  41.  
  42. If keycode = CenterTiltKey Then
  43. Nudge 0, 2
  44. End If
  45.  
  46. End Sub
  47.  
  48. Sub Table1_KeyUp(ByVal keycode)
  49.  
  50. If keycode = PlungerKey Then
  51. Plunger.Fire
  52. PlaySound "plunger",0,1,0.25,0.25
  53. End If
  54.  
  55. If keycode = LeftFlipperKey Then
  56. LeftFlipper.RotateToStart
  57. PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, -0.05, 0.05
  58. End If
  59.  
  60. If keycode = RightFlipperKey Then
  61. RightFlipper.RotateToStart
  62. PlaySound SoundFX("fx_flipperdown",DOFFlippers), 0, 1, 0.05, 0.05
  63. End If
  64.  
  65. End Sub
  66.  
  67. Sub Drain_Hit()
  68. PlaySound "drain",0,1,0,0.25
  69. Drain.DestroyBall
  70. BIP = BIP - 1
  71. If BIP = 0 then
  72. 'Plunger.CreateBall
  73. BallRelease.CreateBall
  74. BallRelease.Kick 90, 7
  75. PlaySound SoundFX("ballrelease",DOFContactors),0,1,0,0.25
  76. BIP = BIP + 1
  77. End If
  78. End Sub
  79.  
  80. Dim BIP
  81. BIP = 0
  82.  
  83. Sub Plunger_Init()
  84. PlaySound SoundFX("ballrelease",DOFContactors),0,1,0,0.25
  85. 'Plunger.CreateBall
  86. BallRelease.CreateBall
  87. BallRelease.Kick 90, 7
  88. BIP = BIP +1
  89. End Sub
  90.  
  91. Sub Gate_Hit
  92. Kicker1.Kick 190, 10
  93. End Sub
  94.  
  95. Sub Bumper1_Hit
  96. PlaySound SoundFX("fx_bumper4",DOFContactors)
  97. B1L1.State = 1:B1L2. State = 1
  98. Me.TimerEnabled = 1
  99. End Sub
  100.  
  101. Sub Bumper1_Timer
  102. B1L1.State = 0:B1L2. State = 0
  103. Me.Timerenabled = 0
  104. End Sub
  105.  
  106. Sub Bumper2_Hit
  107. PlaySound SoundFX("fx_bumper4",DOFContactors)
  108. B2L1.State = 1:B2L2. State = 1
  109. Me.TimerEnabled = 1
  110. End Sub
  111.  
  112. Sub Bumper2_Timer
  113. B2L1.State = 0:B2L2. State = 0
  114. Me.Timerenabled = 0
  115. End Sub
  116.  
  117. Sub Bumper3_Hit
  118. PlaySound SoundFX("fx_bumper4",DOFContactors)
  119. B3L1.State = 1:B3L2. State = 1
  120. Me.TimerEnabled = 1
  121. End Sub
  122.  
  123. Sub Bumper3_Timer
  124. B3L1.State = 0:B3L2. State = 0
  125. Me.Timerenabled = 0
  126. End Sub
  127.  
  128. Sub Bumper4_Hit
  129. PlaySound SoundFX("fx_bumper4",DOFContactors)
  130. B4L1.State = 1:B4L2. State = 1
  131. Me.TimerEnabled = 1
  132. End Sub
  133.  
  134. Sub Bumper4_Timer
  135. B4L1.State = 0:B4L2. State = 0
  136. Me.Timerenabled = 0
  137. End Sub
  138.  
  139. Sub Bumper5_Hit
  140. PlaySound SoundFX("fx_bumper4",DOFContactors)
  141. B5L1.State = 1:B5L2. State = 1
  142. Me.TimerEnabled = 1
  143. End Sub
  144.  
  145. Sub Bumper5_Timer
  146. B5L1.State = 0:B5L2. State = 0
  147. Me.Timerenabled = 0
  148. End Sub
  149.  
  150. Sub sw9_Hit
  151. If L9.State = 1 then
  152. L9.State = 0
  153. else
  154. L9.State = 1
  155. end if
  156. End Sub
  157.  
  158. Sub sw8_Hit
  159. If L8.State = 1 then
  160. L8.State = 0
  161. else
  162. L8.State = 1
  163. end if
  164. End Sub
  165.  
  166. Sub sw7_Hit
  167. If L7.State = 1 then
  168. L7.State = 0
  169. else
  170. L7.State = 1
  171. end if
  172. End Sub
  173.  
  174. Sub sw6_Hit
  175. If L6.State = 1 then
  176. L6.State = 0
  177. else
  178. L6.State = 1
  179. end if
  180. End Sub
  181.  
  182.  
  183. '****Targets
  184. Sub sw1_Hit
  185. If L1.State = 1 then
  186. L1.State = 0
  187. else
  188. L1.State = 1
  189. end if
  190. Me.TimerEnabled = 1
  191. End Sub
  192.  
  193. Sub sw1_Timer
  194. sw1.isDropped=0
  195. Me.TimerEnabled = 0
  196. End Sub
  197.  
  198. Sub sw2_Hit
  199. If L2.State = 1 then
  200. L2.State = 0
  201. else
  202. L2.State = 1
  203. end if
  204. Me.TimerEnabled = 1
  205. End Sub
  206.  
  207. Sub sw2_Timer
  208. sw2.isDropped=0
  209. Me.TimerEnabled = 0
  210. End Sub
  211.  
  212. Sub sw3_Hit
  213. If L3.State = 1 then
  214. L3.State = 0
  215. else
  216. L3.State = 1
  217. end if
  218. ME.TimerEnabled = 1
  219. End Sub
  220.  
  221. Sub sw3_Timer
  222. sw3.isDropped = 0
  223. Me.TimerEnabled = 0
  224. End Sub
  225.  
  226. Sub sw11_Hit
  227. If L11.State = 1 then
  228. L11.State = 0
  229. else
  230. L11.State = 1
  231. end if
  232. End Sub
  233.  
  234.  
  235. Sub sw12_Hit
  236. If L12.State = 1 then
  237. L12.State = 0
  238. else
  239. L12.State = 1
  240. end if
  241. End Sub
  242.  
  243.  
  244. Sub sw13_Hit
  245. If L13.State = 1 then
  246. L13.State = 0
  247. else
  248. L13.State = 1
  249. end if
  250. End Sub
  251.  
  252. Sub Kicker1_Hit
  253. PlaySound "kicker_enter_center", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  254. 'Plunger.CreateBall
  255. PlaySound SoundFX("ballrelease",DOFContactors),0,0.5,0.5,0.25
  256. BallRelease.CreateBall
  257. BallRelease.Kick 90, 8
  258. BIP = BIP +1
  259. End Sub
  260.  
  261. Sub Kicker1_UnHit
  262. PlaySound "popper_ball",0,.75,0,0.25
  263. End Sub
  264.  
  265. '*****GI Lights On
  266. dim xx
  267.  
  268. For each xx in GI:xx.State = 1: Next
  269.  
  270. '**********Sling Shot Animations
  271. ' Rstep and Lstep are the variables that increment the animation
  272. '****************
  273. Dim LStep, Rstep
  274.  
  275. Sub LeftSlingShot_Slingshot
  276. PlaySound SoundFX("left_slingshot",DOFContactors),0,1,-0.05,0.05
  277. LSling.Visible = 0
  278. LSling1.Visible = 1
  279. sling2.TransZ = -20
  280. LStep = 0
  281. LeftSlingShot.TimerEnabled = 1
  282. gi3.State = 0:Gi4.State = 0
  283. End Sub
  284.  
  285. Sub LeftSlingShot_Timer
  286. Select Case LStep
  287. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  288. Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:gi3.State = 1:Gi4.State = 1
  289. End Select
  290. LStep = LStep + 1
  291. End Sub
  292.  
  293. Sub RightSlingShot_Slingshot
  294. PlaySound SoundFX("right_slingshot",DOFContactors), 0, 1, 0.05, 0.05
  295. RSling.Visible = 0
  296. RSling1.Visible = 1
  297. sling1.TransZ = -20
  298. RStep = 0
  299. RightSlingShot.TimerEnabled = 1
  300. gi1.State = 0:Gi2.State = 0
  301. End Sub
  302.  
  303. Sub RightSlingShot_Timer
  304. Select Case RStep
  305. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  306. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:gi1.State = 1:Gi2.State = 1
  307. End Select
  308. RStep = RStep + 1
  309. End Sub
  310.  
  311. ' *********************************************************************
  312. ' Supporting Ball & Sound Functions
  313. ' *********************************************************************
  314.  
  315. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  316. Vol = Csng(BallVel(ball) ^2 / 2000)
  317. End Function
  318.  
  319. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  320. Dim tmp
  321. tmp = ball.x * 2 / table1.width-1
  322. If tmp > 0 Then
  323. Pan = Csng(tmp ^10)
  324. Else
  325. Pan = Csng(-((- tmp) ^10) )
  326. End If
  327. End Function
  328.  
  329. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  330. Pitch = BallVel(ball) * 20
  331. End Function
  332.  
  333. Function BallVel(ball) 'Calculates the ball speed
  334. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  335. End Function
  336.  
  337. '*****************************************
  338. ' JP's VP10 Rolling Sounds
  339. '*****************************************
  340.  
  341. Const tnob = 5 ' total number of balls
  342. ReDim rolling(tnob)
  343. InitRolling
  344.  
  345. Sub InitRolling
  346. Dim i
  347. For i = 0 to tnob
  348. rolling(i) = False
  349. Next
  350. End Sub
  351.  
  352. Sub RollingTimer_Timer()
  353. Dim BOT, b
  354. BOT = GetBalls
  355.  
  356. ' stop the sound of deleted balls
  357. For b = UBound(BOT) + 1 to tnob
  358. rolling(b) = False
  359. StopSound("fx_ballrolling" & b)
  360. Next
  361.  
  362. ' exit the sub if no balls on the table
  363. If UBound(BOT) = -1 Then Exit Sub
  364.  
  365. ' play the rolling sound for each ball
  366. For b = 0 to UBound(BOT)
  367. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  368. rolling(b) = True
  369. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  370. Else
  371. If rolling(b) = True Then
  372. StopSound("fx_ballrolling" & b)
  373. rolling(b) = False
  374. End If
  375. End If
  376. Next
  377. End Sub
  378.  
  379. '**********************
  380. ' Ball Collision Sound
  381. '**********************
  382.  
  383. Sub OnBallBallCollision(ball1, ball2, velocity)
  384. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  385. End Sub
  386.  
  387. '************************************
  388. ' What you need to add to your table
  389. '************************************
  390.  
  391. ' a timer called RollingTimer. With a fast interval, like 10
  392. ' one collision sound, in this script is called fx_collide
  393. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  394. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  395.  
  396.  
  397. '******************************************
  398. ' Explanation of the rolling sound routine
  399. '******************************************
  400.  
  401. ' sounds are played based on the ball speed and position
  402.  
  403. ' the routine checks first for deleted balls and stops the rolling sound.
  404.  
  405. ' The For loop goes through all the balls on the table and checks for the ball speed and
  406. ' if the ball is on the table (height lower than 30) then then it plays the sound
  407. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  408.  
  409. ' The sound is played using the VOL, PAN and PITCH functions, so the volume and pitch of the sound
  410. ' will change according to the ball speed, and the PAN function will change the stereo position according
  411. ' to the position of the ball on the table.
  412.  
  413.  
  414. '**************************************
  415. ' Explanation of the collision routine
  416. '**************************************
  417.  
  418. ' The collision is built in VP.
  419. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  420. ' 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
  421. ' depending of the speed of the collision.
  422.  
  423.  
  424. Sub Pins_Hit (idx)
  425. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  426. End Sub
  427.  
  428. Sub Targets_Hit (idx)
  429. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  430. End Sub
  431.  
  432. Sub Metals_Thin_Hit (idx)
  433. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  434. End Sub
  435.  
  436. Sub Metals_Medium_Hit (idx)
  437. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  438. End Sub
  439.  
  440. Sub Metals2_Hit (idx)
  441. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  442. End Sub
  443.  
  444. Sub Gates_Hit (idx)
  445. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  446. End Sub
  447.  
  448. Sub Spinner_Spin
  449. PlaySound "fx_spinner",0,.25,0,0.25
  450. End Sub
  451.  
  452. Sub Rubbers_Hit(idx)
  453. dim finalspeed
  454. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  455. If finalspeed > 20 then
  456. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  457. End if
  458. If finalspeed >= 6 AND finalspeed <= 20 then
  459. RandomSoundRubber()
  460. End If
  461. End Sub
  462.  
  463. Sub Posts_Hit(idx)
  464. dim finalspeed
  465. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  466. If finalspeed > 16 then
  467. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  468. End if
  469. If finalspeed >= 6 AND finalspeed <= 16 then
  470. RandomSoundRubber()
  471. End If
  472. End Sub
  473.  
  474. Sub RandomSoundRubber()
  475. Select Case Int(Rnd*3)+1
  476. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  477. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  478. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  479. End Select
  480. End Sub
  481.  
  482. Sub LeftFlipper_Collide(parm)
  483. RandomSoundFlipper()
  484. End Sub
  485.  
  486. Sub RightFlipper_Collide(parm)
  487. RandomSoundFlipper()
  488. End Sub
  489.  
  490. Sub RandomSoundFlipper()
  491. Select Case Int(Rnd*3)+1
  492. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  493. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  494. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  495. End Select
  496. End Sub
Advertisement
Add Comment
Please, Sign In to add comment