Advertisement
Guest User

Untitled

a guest
Sep 4th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.49 KB | None | 0 0
  1. 'Q*bert's Quest 1.0 by bord
  2.  
  3. Option Explicit
  4. Randomize
  5.  
  6. On Error Resume Next
  7. ExecuteGlobal GetTextFile("controller.vbs")
  8. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  9. On Error Goto 0
  10.  
  11. LoadVPM "01500000", "sys80.vbs", 3.10
  12.  
  13. Dim DesktopMode: DesktopMode = Table1.ShowDT
  14. dim hiddenvalue
  15. If DesktopMode = True Then 'Show Desktop components
  16. siderailleft.visible=1
  17. siderailright.visible=1
  18. lockdown.visible=1
  19. hiddenvalue=0
  20. Else
  21. siderailleft.visible=0
  22. siderailright.visible=0
  23. lockdown.visible=0
  24. hiddenvalue = 1
  25. End if
  26.  
  27. SolCallback(1) = "SolLeftDropUp"
  28. SolCallback(2) = "bsRSaucer.SolOut"
  29. SolCallback(5) = "bsLSaucer.SolOut"
  30. SolCallback(6) = "SolRightDropUp"
  31. SolCallback(8) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  32. SolCallback(9) = "bsTrough.SolOut"
  33.  
  34. SolCallback(sLRFlipper) = "SolRFlipper"
  35. SolCallback(sLLFlipper) = "SolLFlipper"
  36.  
  37. Sub SolLFlipper(Enabled)
  38. If Enabled Then
  39. PlaySound SoundFX("fx_Flipperup",DOFFlippers):LeftFlipper.RotateToEnd:RightFlipper2.RotateToEnd
  40. Else
  41. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):LeftFlipper.RotateToStart:RightFlipper2.RotateToStart
  42. End If
  43. End Sub
  44.  
  45. Sub SolRFlipper(Enabled)
  46. If Enabled Then
  47. PlaySound SoundFX("fx_Flipperup",DOFFlippers):RightFlipper.RotateToEnd:LeftFlipper2.RotateToEnd
  48. Else
  49. PlaySound SoundFX("fx_Flipperdown",DOFFlippers):RightFlipper.RotateToStart:LeftFlipper2.RotateToStart
  50. End If
  51. End Sub
  52.  
  53. '*****GI Lights On
  54. dim xx
  55. For each xx in GI:xx.State = 1: Next
  56.  
  57. DisplayTimer.Enabled = true
  58.  
  59. 'Primitive Flipper
  60. Sub FlipperTimer_Timer
  61. leftflipper_prim.rotz = LeftFlipper.currentangle '+ 90
  62. rightflipper_prim.rotz = RightFlipper.currentangle '+ 45
  63. LeftFlipper2_prim.rotz = LeftFlipper2.currentangle '+ 45
  64. RightFlipper2_prim.rotz = RightFlipper2.currentangle '+ 45
  65. FlipperLSh.rotz = LeftFlipper.currentangle '+ 45
  66. FlipperRSh.rotz = RightFlipper.currentangle '+ 45
  67. FlipperLSh1.rotz = LeftFlipper2.currentangle '+ 45
  68. FlipperRSh1.rotz = RightFlipper2.currentangle '+ 45
  69. BallShadowUpdate
  70. rightgate1_prim.RotX = Gate7.CurrentAngle + 90
  71. rightgate2_prim.RotX = Gate1.CurrentAngle + 90
  72. rightgate3_prim.RotX = Gate2.CurrentAngle + 90
  73. leftgate1_prim.RotX = Gate5.CurrentAngle + 90
  74. leftgate2_prim.RotX = Gate3.CurrentAngle + 90
  75. End Sub
  76.  
  77. Dim bsTrough, dtLBank, dtRBank, bsLSaucer, bsRSaucer, bump1, bump2
  78.  
  79. Const cGameName = "qbquest"
  80. Const UseSolenoids = 1
  81. Const UseLamps = 0
  82. Const UseGI = 0
  83. Const SSolenoidOn="SolOn"
  84. Const SSolenoidOff="SolOff"
  85. Const SCoin="coin"
  86.  
  87. Sub Table1_Init
  88. vpmInit Me
  89. On Error Resume Next
  90. With Controller
  91. .GameName = cGameName
  92. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  93. .SplashInfoLine = "Q*Bert's Quest (Gottlieb 1983)" & vbNewLine & "bord"
  94. .HandleMechanics=0
  95. .HandleKeyboard=0
  96. .ShowDMDOnly=1
  97. .ShowFrame=0
  98. .ShowTitle=0
  99. .hidden = hiddenvalue
  100. If Err Then MsgBox Err.Description
  101. End With
  102. On Error Goto 0
  103. Controller.SolMask(0)=0
  104. vpmTimer.AddTimer 2000,"Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the timer to renable all the solenoids after 2 seconds
  105. Controller.Run
  106. If Err Then MsgBox Err.Description
  107. On Error Goto 0
  108.  
  109. PinMAMETimer.Interval=PinMAMEInterval
  110. PinMAMETimer.Enabled=1
  111.  
  112. vpmNudge.TiltSwitch=57
  113. vpmNudge.Sensitivity=5
  114. vpmNudge.TiltObj = Array(Bumper1,Bumper2,LeftslingShot,RightslingShot, leftflipper, rightflipper, leftflipper2, rightflipper2)
  115.  
  116. Kicker3.CreateBall
  117. Kicker3.Kick 180, 1
  118.  
  119. ' Trough
  120. Set bsTrough = New cvpmBallStack
  121. With bsTrough
  122. .InitSw 0, 67, 0, 0, 0, 0, 0, 0
  123. .InitKick BallRelease, 90, 5
  124. .InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  125. .Balls=1
  126. End With
  127.  
  128. ' Drop targets left
  129. set dtLBank = new cvpmdroptarget
  130. With dtLBank
  131. .initdrop array(sw00, sw10), array(0, 10)
  132. .initSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  133. End With
  134.  
  135. ' Drop targets right
  136. set dtRBank = new cvpmdroptarget
  137. With dtRBank
  138. .initdrop array(sw50, sw60), array(50, 60)
  139. .initSnd SoundFX("DTDrop",DOFDropTargets),SoundFX("DTReset",DOFContactors)
  140. End With
  141.  
  142. ' Left Saucer
  143. Set bsLSaucer = New cvpmBallStack
  144. With bsLSaucer
  145. .InitSaucer sw54, 54, 0, 24
  146. .InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  147. .KickAngleVar = 2
  148. End With
  149.  
  150. ' Right Saucer
  151. Set bsRSaucer = New cvpmBallStack
  152. With bsRSaucer
  153. .InitSaucer sw4, 4, 0, 24
  154. .InitExitSnd SoundFX("Popper",DOFContactors), SoundFX("Solenoid",DOFContactors)
  155. .KickAngleVar = 2
  156. End With
  157.  
  158. End Sub
  159.  
  160. '**********************************************************************************************************
  161. 'Plunger code
  162. '**********************************************************************************************************
  163.  
  164. Sub Table1_KeyDown(ByVal KeyCode)
  165. If KeyDownHandler(keycode) Then Exit Sub
  166. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  167. End Sub
  168.  
  169. Sub Table1_KeyUp(ByVal KeyCode)
  170. If KeyUpHandler(keycode) Then Exit Sub
  171. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  172. End Sub
  173.  
  174. 'Drop Targets
  175. Sub Sw00_Dropped:dtLBank.Hit 1 : Ldrop1.state=1
  176. End Sub
  177. Sub Sw10_Dropped:dtLBank.Hit 2 : Ldrop2.state=1
  178. End Sub
  179. Sub Sw50_Dropped:dtRBank.Hit 1 : Rdrop1.state=1
  180. End Sub
  181. Sub Sw60_Dropped:dtRBank.Hit 2 : Rdrop2.state=1
  182. End Sub
  183.  
  184.  
  185. Sub SolRightDropUp(enabled)
  186. dim xx
  187. if enabled then
  188. dtRBank.SolDropUp enabled
  189. For each xx in DTRight: xx.state=0:Next
  190. end if
  191. End Sub
  192.  
  193. Sub SolLeftDropUp(enabled)
  194. dim xx
  195. if enabled then
  196. dtLBank.SolDropUp enabled
  197. For each xx in DTLeft: xx.state=0:Next
  198. end if
  199. End Sub
  200.  
  201. 'Bumpers
  202. Sub Bumper1_Hit : vpmTimer.PulseSw(6) : playsound SoundFXDOF("fx_bumper1",101,DOFPulse,,DOFContactors): End Sub
  203. Sub Bumper2_Hit : vpmTimer.PulseSw(6) : playsound SoundFXDOF("fx_bumper1",102,DOFPulse,,DOFContactors): End Sub
  204.  
  205. ' Rollovers
  206. Sub sw15_Hit:Controller.Switch(15)=1 : playsound"rollover":End Sub
  207. Sub sw15_unHit:Controller.Switch(15)=0:End Sub
  208.  
  209. Sub sw65_Hit:Controller.Switch(65)=1 : playsound"rollover":End Sub
  210. Sub sw65_unHit:Controller.Switch(65)=0:End Sub
  211.  
  212. Sub sw55_Hit:Controller.Switch(55)=1 : playsound"rollover":End Sub
  213. Sub sw55_unHit:Controller.Switch(55)=0:End Sub
  214.  
  215. Sub sw13_Hit:Controller.Switch(13)=1 : playsound"rollover":End Sub
  216. Sub sw13_unHit:Controller.Switch(13)=0:End Sub
  217.  
  218. Sub sw14_Hit:Controller.Switch(14)=1 :: playsound"rollover":End Sub
  219. Sub sw14_unHit:Controller.Switch(14)=0:End Sub
  220.  
  221. Sub sw3_Hit:Controller.Switch(3)=1 : playsound"rollover":End Sub
  222. Sub sw3_unHit:Controller.Switch(3)=0:End Sub
  223.  
  224. 'gates rollovers
  225. Sub sw61_Hit : Controller.Switch(61)=1 : End Sub
  226. Sub sw61_unHit : Controller.Switch(61)=0 : End Sub
  227. Sub sw62_Hit : Controller.Switch(62)=1 : End Sub
  228. Sub sw62_unHit : Controller.Switch(62)=0 : End Sub
  229. Sub sw63_Hit : Controller.Switch(63)=1 : End Sub
  230. Sub sw63_unHit : Controller.Switch(63)=0 : End Sub
  231. Sub sw64_Hit : Controller.Switch(64)=1 : End Sub
  232. Sub sw64_unHit : Controller.Switch(64)=0 : End Sub
  233. Sub sw53_Hit : Controller.Switch(53)=1 : End Sub
  234. Sub sw53_unHit : Controller.Switch(53)=0 : End Sub
  235.  
  236. 'Standup target
  237. Sub sw1_Hit : vpmTimer.PulseSw(1):playsound SoundFX("target",DOFTargets):End Sub
  238. Sub sw2_Hit : vpmTimer.PulseSw(2):playsound SoundFX("target",DOFTargets):End Sub
  239. Sub sw5_Hit : vpmTimer.PulseSw(5):playsound SoundFX("target",DOFTargets):End Sub
  240. Sub sw11_Hit : vpmTimer.PulseSw(11):playsound SoundFX("target",DOFTargets):End Sub
  241. Sub sw12_Hit : vpmTimer.PulseSw(12):playsound SoundFX("target",DOFTargets):End Sub
  242. Sub sw51_Hit : vpmTimer.PulseSw(51):playsound SoundFX("target",DOFTargets):End Sub
  243. Sub sw52_Hit : vpmTimer.PulseSw(52):playsound SoundFX("target",DOFTargets):End Sub
  244.  
  245. Sub sw16a_Hit : vpmTimer.PulseSw(16) : End Sub
  246.  
  247. ' Drain & Holes
  248. Sub Drain_Hit:playsound"drain":bsTrough.addball me:End Sub
  249.  
  250. '**********Sling Shot Animations
  251. ' Rstep and Lstep are the variables that increment the animation
  252. '****************
  253. Dim RStep, Lstep, LRubberstep, RRubberstep
  254.  
  255. Sub RightSlingShot_Slingshot
  256. vpmTimer.PulseSw 16
  257. PlaySound SoundFXDOF("right_slingshot",104,DOFPulse,DOFContactors), 0, 1, 0.05, 0.05
  258. RSling.Visible = 0
  259. RSling1.Visible = 1
  260. sling1.TransZ = -30
  261. RStep = 0
  262. RightSlingShot.TimerEnabled = 1
  263. End Sub
  264.  
  265. Sub RightSlingShot_Timer
  266. Select Case RStep
  267. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -15
  268. Case 4:RSLing2.Visible = 0:RSLing3.Visible = 1:sling1.TransZ = 0
  269. Case 5:RSLing3.Visible = 0:RSLing.Visible = 1:sling1.TransZ = 0:RightSlingShot.TimerEnabled = 0:
  270. End Select
  271. RStep = RStep + 1
  272. End Sub
  273.  
  274. Sub LeftSlingShot_Slingshot
  275. vpmTimer.PulseSw 16
  276. PlaySound SoundFXDOF("left_slingshot",103,DOFPulse,DOFContactors),0,1,-0.05,0.05
  277. LSling.Visible = 0
  278. LSling1.Visible = 1
  279. sling2.TransZ = -30
  280. LStep = 0
  281. LeftSlingShot.TimerEnabled = 1
  282. End Sub
  283.  
  284. Sub LeftSlingShot_Timer
  285. Select Case LStep
  286. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -15
  287. Case 4:LSLing2.Visible = 0:LSLing3.Visible = 1:sling2.TransZ = 0
  288. Case 5:LSLing3.Visible = 0:LSLing.Visible = 1:sling2.TransZ = 0:LeftSlingShot.TimerEnabled = 0:
  289. End Select
  290. LStep = LStep + 1
  291. End Sub
  292.  
  293. Sub LRubberWall_hit
  294. LRubber.Visible = 0
  295. LRubber1.Visible = 1
  296. LRubberStep = 0
  297. LRubberWall.TimerEnabled = 1
  298. End Sub
  299.  
  300. Sub LRubberWall_Timer
  301. Select Case LRubberStep
  302. Case 3:LRubber1.Visible = 0:LRubber2.Visible = 1
  303. Case 4:LRubber2.Visible = 0:LRubber.Visible = 1:LRubberWall.TimerEnabled = 0:
  304. End Select
  305. LRubberStep = LRubberStep + 1
  306. End Sub
  307.  
  308. Sub RRubberWall_hit
  309. RRubber.Visible = 0
  310. RRubber1.Visible = 1
  311. RRubberStep = 0
  312. RRubberWall.TimerEnabled = 1
  313. End Sub
  314.  
  315. Sub RRubberWall_Timer
  316. Select Case RRubberStep
  317. Case 3:RRubber1.Visible = 0:RRubber2.Visible = 1
  318. Case 4:RRubber2.Visible = 0:RRubber.Visible = 1:RRubberWall.TimerEnabled = 0:
  319. End Select
  320. RRubberStep = RRubberStep + 1
  321. End Sub
  322.  
  323. ''Kicker Animations
  324. 'Dim RkickStep, LkickStep
  325. '
  326. Sub sw4_Hit
  327. PlaySound "kicker_enter"
  328. bsRSaucer.AddBall 0
  329. ' Remk1.RotX = 26 Too busy rigtht now. I'll add these later (maybe)
  330. ' RkickStep = 0
  331. ' sw4.TimerEnabled = 1
  332. End Sub
  333. '
  334. 'Sub sw4_Timer
  335. ' Select Case RkickStep
  336. ' Case 1:Remk1.Rotx = 14
  337. ' Case 2:Remk1.Rotx = 2
  338. ' Case 3:Remk1.Rotx = -20:sw4.TimerEnabled = 0
  339. ' End Select
  340. '
  341. ' RkickStep = RkickStep + 1
  342. 'End Sub
  343.  
  344. Sub sw54_Hit
  345. PlaySound "kicker_enter"
  346. bsLSaucer.AddBall 0
  347. ' Remk2.RotX = 26
  348. ' LkickStep = 0
  349. ' sw54.TimerEnabled = 1
  350. End Sub
  351. '
  352. 'Sub sw54_Timer
  353. ' Select Case LkickStep
  354. ' Case 1:Remk2.Rotx = 14
  355. ' Case 2:Remk2.Rotx = 2
  356. ' Case 2:Remk2.Rotx = -20:sw54.TimerEnabled = 0
  357. ' End Select
  358. '
  359. ' LkickStep = LkickStep + 1
  360. 'End Sub
  361.  
  362. ' *********************************************************************
  363. ' Supporting Ball & Sound Functions
  364. ' *********************************************************************
  365.  
  366. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  367. Vol = Csng(BallVel(ball) ^2 / 1500)
  368. End Function
  369.  
  370. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  371. Dim tmp
  372. tmp = ball.x * 2 / table1.width-1
  373. If tmp > 0 Then
  374. Pan = Csng(tmp ^10)
  375. Else
  376. Pan = Csng(-((- tmp) ^10) )
  377. End If
  378. End Function
  379.  
  380. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  381. Pitch = BallVel(ball) * 20
  382. End Function
  383.  
  384. Function BallVel(ball) 'Calculates the ball speed
  385. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  386. End Function
  387.  
  388. '*****************************************
  389. ' JP's VP10 Rolling Sounds
  390. '*****************************************
  391.  
  392. Const tnob = 3 ' total number of balls
  393. ReDim rolling(tnob)
  394. InitRolling
  395.  
  396. Sub InitRolling
  397. Dim i
  398. For i = 0 to tnob
  399. rolling(i) = False
  400. Next
  401. End Sub
  402.  
  403. Sub RollingTimer_Timer()
  404. Dim BOT, b
  405. BOT = GetBalls
  406.  
  407. ' stop the sound of deleted balls
  408. For b = UBound(BOT) + 1 to tnob
  409. rolling(b) = False
  410. StopSound("fx_ballrolling" & b)
  411. Next
  412.  
  413. ' exit the sub if no balls on the table
  414. If UBound(BOT) = -1 Then Exit Sub
  415.  
  416. ' play the rolling sound for each ball
  417. For b = 0 to UBound(BOT)
  418. If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
  419. rolling(b) = True
  420. PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  421. Else
  422. If rolling(b) = True Then
  423. StopSound("fx_ballrolling" & b)
  424. rolling(b) = False
  425. End If
  426. End If
  427. Next
  428. End Sub
  429.  
  430. '**********************
  431. ' Ball Collision Sound
  432. '**********************
  433.  
  434. Sub OnBallBallCollision(ball1, ball2, velocity)
  435. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0
  436. End Sub
  437.  
  438. '******************************
  439. ' Diverse Collection Hit Sounds
  440. '******************************
  441.  
  442. Sub Pins_Hit (idx)
  443. PlaySound "pinhit_low", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  444. End Sub
  445.  
  446. Sub Targets_Hit (idx)
  447. PlaySound "target", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0
  448. End Sub
  449.  
  450. Sub Metals_Thin_Hit (idx)
  451. PlaySound "metalhit_thin", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  452. End Sub
  453.  
  454. Sub Metals_Medium_Hit (idx)
  455. PlaySound "metalhit_medium", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  456. End Sub
  457.  
  458. Sub Metals2_Hit (idx)
  459. PlaySound "metalhit2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  460. End Sub
  461.  
  462. Sub Gates_Hit (idx)
  463. PlaySound "gate4", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  464. End Sub
  465.  
  466. Sub Rollovers_Hit (idx)
  467. PlaySound "fx_sensor", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  468. End Sub
  469.  
  470. Sub Spinner_Spin
  471. PlaySound "fx_spinner",0,.25,0,0.25
  472. End Sub
  473.  
  474. Sub Rubbers_Hit(idx)
  475. dim finalspeed
  476. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  477. If finalspeed > 16 then
  478. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  479. End if
  480. If finalspeed >= 6 AND finalspeed <= 16 then
  481. RandomSoundRubber()
  482. End If
  483. End Sub
  484.  
  485. Sub Posts_Hit(idx)
  486. dim finalspeed
  487. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  488. If finalspeed > 12 then
  489. PlaySound "fx_rubber2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  490. End if
  491. If finalspeed >= 6 AND finalspeed <= 12 then
  492. RandomSoundRubber()
  493. End If
  494. End Sub
  495.  
  496. Sub RandomSoundRubber()
  497. Select Case Int(Rnd*3)+1
  498. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  499. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  500. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  501. End Select
  502. End Sub
  503.  
  504. Sub LeftFlipper_Collide(parm)
  505. RandomSoundFlipper()
  506. End Sub
  507.  
  508. Sub RightFlipper_Collide(parm)
  509. RandomSoundFlipper()
  510. End Sub
  511.  
  512. Sub RandomSoundFlipper()
  513. Select Case Int(Rnd*3)+1
  514. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  515. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  516. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), Pan(ActiveBall), 0, Pitch(ActiveBall), 1, 0
  517. End Select
  518. End Sub
  519.  
  520. '***************************************************
  521. ' JP's VP10 Fading Lamps & Flashers
  522. ' Based on PD's Fading Light System
  523. ' SetLamp 0 is Off
  524. ' SetLamp 1 is On
  525. ' fading for non opacity objects is 4 steps
  526. '***************************************************
  527.  
  528. Dim LampState(200), FadingLevel(200)
  529. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  530.  
  531. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  532. LampTimer.Interval = 5 'lamp fading speed
  533. LampTimer.Enabled = 1
  534.  
  535. ' Lamp & Flasher Timers
  536.  
  537. Sub LampTimer_Timer()
  538. Dim chgLamp, num, chg, ii
  539. chgLamp = Controller.ChangedLamps
  540. If Not IsEmpty(chgLamp) Then
  541. For ii = 0 To UBound(chgLamp)
  542. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  543. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  544. Next
  545. End If
  546. UpdateLamps
  547. End Sub
  548.  
  549.  
  550. Sub UpdateLamps
  551.  
  552. NFadeLm 3, l3
  553. NFadeLm 3, l3a
  554. NFadeLm 4, l4
  555. NFadeLm 4, l4a
  556. NFadeLm 5, l5
  557. NFadeLm 5, l5a
  558. NFadeLm 6, l6
  559. NFadeLm 6, l6a
  560. NFadeObjm 6, LeftFlipper_prim, "flipper_topleftON", "flipper_topleft"
  561. NFadeObjm 6, RightFlipper_prim, "flipper_toprightON", "flipper_topright"
  562. NFadeLm 7, l7
  563. NFadeLm 7, l7a
  564. NFadeLm 8, l8
  565. NFadeLm 8, l8a
  566. NFadeLm 12, l12
  567. NFadeLm 12, l12a
  568. NFadeLm 13, l13
  569. NFadeLm 13, l13a
  570. NFadeLm 14, l14
  571. NFadeLm 14, l14a
  572. NFadeLm 15, l15
  573. NFadeLm 15, l15a
  574. NFadeLm 16, l16
  575. NFadeLm 16, l16a
  576. NFadeLm 17, l17
  577. NFadeLm 17, l17a
  578. NFadeLm 18, l18
  579. NFadeLm 18, l18a
  580. NFadeLm 19, l19
  581. NFadeLm 19, l19a
  582. NFadeLm 20, l20
  583. NFadeLm 20, l20a
  584. NFadeLm 21, l21
  585. NFadeLm 21, l21a
  586. NFadeLm 22, l22
  587. NFadeLm 22, l22a
  588. NFadeLm 23, l23
  589. NFadeLm 23, l23a
  590. NFadeLm 24, l24
  591. NFadeLm 24, l24a
  592. NFadeLm 25, l25
  593. NFadeLm 25, l25a
  594. NFadeLm 26, l26
  595. NFadeLm 26, l26a
  596. NFadeLm 27, l27
  597. NFadeLm 27, l27a
  598. NFadeLm 28, l28
  599. NFadeLm 28, l28a
  600. NFadeLm 29, l29
  601. NFadeLm 29, l29a
  602. NFadeLm 30, l30
  603. NFadeLm 30, l30a
  604. NFadeLm 31, l31
  605. NFadeLm 31, l31a
  606. NFadeLm 32, l32
  607. NFadeLm 32, l32a
  608. NFadeLm 33, l33
  609. NFadeLm 33, l33a
  610. NFadeLm 34, l34
  611. NFadeLm 34, l34a
  612. NFadeLm 35, l35
  613. NFadeLm 35, l35a
  614. NFadeLm 36, l36
  615. NFadeLm 36, l36a
  616. NFadeLm 37, l37
  617. NFadeLm 37, l37a
  618. NFadeLm 38, l38
  619. NFadeLm 38, l38a
  620. NFadeLm 39, l39
  621. NFadeLm 39, l39a
  622. NFadeLm 40, l40
  623. NFadeLm 40, l40a
  624. NFadeLm 41, l41
  625. NFadeLm 41, l41a
  626. NFadeLm 43, l43
  627. NFadeLm 43, l43a
  628. NFadeLm 44, l44
  629. NFadeLm 44, l44a
  630. NFadeLm 45, l45
  631. NFadeLm 45, l45a
  632. NFadeLm 46, l46
  633. NFadeLm 46, l46a
  634. NFadeLm 47, l47
  635. NFadeLm 47, l47a
  636. NFadeLm 51, l51
  637. NFadeLm 51, l51a
  638. End Sub
  639.  
  640.  
  641. ' div lamp subs
  642.  
  643. Sub InitLamps()
  644. Dim x
  645. For x = 0 to 200
  646. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  647. FadingLevel(x) = 4 ' used to track the fading state
  648. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  649. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  650. FlashMax(x) = 1 ' the maximum value when on, usually 1
  651. FlashMin(x) = 0 ' the minimum value when off, usually 0
  652. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  653. Next
  654. End Sub
  655.  
  656. Sub AllLampsOff
  657. Dim x
  658. For x = 0 to 200
  659. SetLamp x, 0
  660. Next
  661. End Sub
  662.  
  663. Sub SetLamp(nr, value)
  664. If value <> LampState(nr) Then
  665. LampState(nr) = abs(value)
  666. FadingLevel(nr) = abs(value) + 4
  667. End If
  668. End Sub
  669.  
  670. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  671.  
  672. Sub NFadeL(nr, object)
  673. Select Case FadingLevel(nr)
  674. Case 4:object.state = 0:FadingLevel(nr) = 0
  675. Case 5:object.state = 1:FadingLevel(nr) = 1
  676. End Select
  677. End Sub
  678.  
  679. Sub NFadeLm(nr, object) ' used for multiple lights
  680. Select Case FadingLevel(nr)
  681. Case 4:object.state = 0
  682. Case 5:object.state = 1
  683. End Select
  684. End Sub
  685.  
  686. 'Lights, Ramps & Primitives used as 4 step fading lights
  687. 'a,b,c,d are the images used from on to off
  688.  
  689. Sub FadeObj(nr, object, a, b, c, d)
  690. Select Case FadingLevel(nr)
  691. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  692. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  693. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  694. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  695. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  696. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  697. End Select
  698. End Sub
  699.  
  700. Sub FadeObjm(nr, object, a, b, c, d)
  701. Select Case FadingLevel(nr)
  702. Case 4:object.image = b
  703. Case 5:object.image = a
  704. Case 9:object.image = c
  705. Case 13:object.image = d
  706. End Select
  707. End Sub
  708.  
  709. Sub NFadeObj(nr, object, a, b)
  710. Select Case FadingLevel(nr)
  711. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  712. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  713. End Select
  714. End Sub
  715.  
  716. Sub NFadeObjm(nr, object, a, b)
  717. Select Case FadingLevel(nr)
  718. Case 4:object.image = b
  719. Case 5:object.image = a
  720. End Select
  721. End Sub
  722.  
  723. ' Flasher objects
  724.  
  725. Sub Flash(nr, object)
  726. Select Case FadingLevel(nr)
  727. Case 4 'off
  728. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  729. If FlashLevel(nr) < FlashMin(nr) Then
  730. FlashLevel(nr) = FlashMin(nr)
  731. FadingLevel(nr) = 0 'completely off
  732. End if
  733. Object.IntensityScale = FlashLevel(nr)
  734. Case 5 ' on
  735. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  736. If FlashLevel(nr) > FlashMax(nr) Then
  737. FlashLevel(nr) = FlashMax(nr)
  738. FadingLevel(nr) = 1 'completely on
  739. End if
  740. Object.IntensityScale = FlashLevel(nr)
  741. End Select
  742. End Sub
  743.  
  744. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  745. Object.IntensityScale = FlashLevel(nr)
  746. End Sub
  747.  
  748. 'Reels
  749. Sub FadeReel(nr, reel)
  750. Select Case FadingLevel(nr)
  751. Case 2:FadingLevel(nr) = 0
  752. Case 3:FadingLevel(nr) = 2
  753. Case 4:reel.Visible = 0:FadingLevel(nr) = 3
  754. Case 5:reel.Visible = 1:FadingLevel(nr) = 1
  755. End Select
  756. End Sub
  757.  
  758. 'Inverted Reels
  759. Sub FadeIReel(nr, reel)
  760. Select Case FadingLevel(nr)
  761. Case 2:FadingLevel(nr) = 0
  762. Case 3:FadingLevel(nr) = 2
  763. Case 4:reel.Visible = 1:FadingLevel(nr) = 3
  764. Case 5:reel.Visible = 0:FadingLevel(nr) = 1
  765. End Select
  766. End Sub
  767.  
  768. '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  769. ' LL EEEEEE DDDD ,, SSSSS
  770. ' LL EE DD DD ,, SS
  771. ' LL EE DD DD , SS
  772. ' LL EEEE DD DD SS
  773. ' LL EE DD DD SS
  774. ' LLLLLL EEEEEE DDDD SSSSS
  775. '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  776.  
  777. '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  778. ' 7 Digit Array
  779. '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  780.  
  781. Dim LED7(37)
  782. LED7(0)=Array()
  783. LED7(1)=Array()
  784. LED7(2)=Array()
  785. LED7(3)=Array()
  786. LED7(4)=Array()
  787. LED7(5)=Array()
  788. LED7(6)=Array()
  789. LED7(7)=Array()
  790. LED7(8)=Array()
  791. LED7(9)=Array()
  792. LED7(10)=Array()
  793. LED7(11)=Array()
  794. LED7(12)=Array()
  795. LED7(13)=Array()
  796. LED7(14)=Array()
  797. LED7(15)=Array()
  798. LED7(16)=Array()
  799. LED7(17)=Array()
  800. LED7(18)=Array()
  801. LED7(19)=Array()
  802. LED7(20)=Array()
  803. LED7(21)=Array()
  804. LED7(22)=Array()
  805. LED7(23)=Array()
  806. LED7(24)=Array()
  807. LED7(25)=Array()
  808. LED7(26)=Array()
  809. LED7(27)=Array()
  810.  
  811. LED7(28)=Array(d261,d262,d263,d264,d265,d266,d267,LXM,d268)
  812. LED7(29)=Array(d271,d272,d273,d274,d275,d276,d277,LXM,d278)
  813. LED7(30)=Array(d241,d242,d243,d244,d245,d246,d247,LXM,d248)
  814. LED7(31)=Array(d251,d252,d253,d254,d255,d256,d257,LXM,d258)
  815.  
  816. LED7(32)=Array()
  817. LED7(33)=Array()
  818. LED7(34)=Array()
  819. LED7(35)=Array()
  820. LED7(36)=Array()
  821. LED7(37)=Array()
  822.  
  823. Sub DisplayTimer_Timer
  824. Dim ChgLED, II, Num, Chg, Stat, Obj
  825. ChgLED = Controller.ChangedLEDs(0, &Hffffffff)
  826. If Not IsEmpty(ChgLED) Then
  827. For II = 0 To UBound(ChgLED)
  828. Num = ChgLED(II, 0):Chg = ChgLED(II, 1):Stat = ChgLED(II, 2)
  829. If Num > 27 Then
  830. For Each Obj In LED7(Num)
  831. If Chg And 1 Then Obj.State = Stat And 1
  832.  
  833. Chg = Chg \ 2:Stat = Stat \ 2
  834. Next
  835. End If
  836. Next
  837. End If
  838. End Sub
  839.  
  840. '*****************************************
  841. ' Ball Shadow
  842. '*****************************************
  843.  
  844. Dim BallShadow
  845. BallShadow = Array (BallShadow1, BallShadow2, BallShadow3)
  846.  
  847.  
  848. Sub BallShadowUpdate()
  849. Dim BOT, b, shadowZ
  850. BOT = GetBalls
  851.  
  852. ' render the shadow for each ball
  853. For b = 0 to UBound(BOT)
  854. If BOT(b).X < Table1.Width/2 Then
  855. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 10
  856. Else
  857. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 10
  858. End If
  859.  
  860. If BOT(b).X > 875 AND BOT(b).Y > 935 Then shadowZ = BOT(b).Z : BallShadow(b).X = BOT(b).X Else shadowZ = 1
  861.  
  862. BallShadow(b).Y = BOT(b).Y + 20
  863. BallShadow(b).Z = shadowZ
  864. If BOT(b).Z > 20 Then
  865. BallShadow(b).visible = 1
  866. Else
  867. BallShadow(b).visible = 0
  868. End If
  869. Next
  870. End Sub
  871.  
  872. 'Gottlieb Q-Bert's Quest
  873. 'added by Inkochnito
  874. Sub editDips
  875. Dim vpmDips:Set vpmDips = New cvpmDips
  876. With vpmDips
  877. .AddForm 700, 400, "Q-Bert's Quest - DIP switches"
  878. .AddFrame 2, 4, 190, "Maximum credits", 49152, Array("8 credits", 0, "10 credits", 32768, "15 credits", &H00004000, "20 credits", 49152) 'dip 15&16
  879. .AddFrameExtra 2, 80, 190, "Attract Sound", &H000C, Array("off", 0, "every 10 seconds", &H0004, "every 2 minutes", &H0008, "every 4 minutes", &H000C) 'sounddip 3&4
  880. .AddFrame 2, 156, 190, "Coin chute 1 and 2 control", &H00002000, Array("seperate", 0, "same", &H00002000) 'dip 14
  881. .AddFrame 2, 202, 190, "Playfield special", &H00200000, Array("replay", 0, "extra ball", &H00200000) 'dip 22
  882. .AddFrame 2, 248, 190, "Figure 8 shot awards villain lamp", &H00000080, Array("when villain in 1st position only", 0, "when villain in any position", &H00000080) 'dip 8
  883. .AddFrame 2, 294, 190, "3rd coin chute credits control", &H20000000, Array("no effect", 0, "add 9", &H20000000) 'dip 30
  884. .AddChkExtra 2, 345, 120, Array("Speech", &H0020) 'SS-board dip 6
  885. .AddChkExtra 2, 360, 120, Array("Background sound", &H0010) 'SS-board dip 5
  886. .AddFrame 205, 4, 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
  887. .AddFrame 205, 80, 190, "Pyramids needed for special", &HC0000000, Array("5 (3 ball) or 6 (5 ball)", 0, "6 or 7", &H80000000, "7 or 8", &H40000000, "8 or 9", &HC0000000) 'dip 31&32
  888. .AddFrame 205, 156, 190, "Balls per game", &H01000000, Array("5 balls", 0, "3 balls", &H01000000) 'dip 25
  889. .AddFrame 205, 202, 190, "Replay limit", &H04000000, Array("no limit", 0, "one per game", &H04000000) 'dip 27
  890. .AddFrame 205, 248, 190, "Novelty", &H08000000, Array("normal", 0, "extra ball and replay scores points", &H08000000) 'dip 28
  891. .AddFrame 205, 294, 190, "Game mode", &H10000000, Array("replay", 0, "extra ball", &H10000000) 'dip 29
  892. .AddChk 205, 345, 120, Array("Match feature", &H02000000) 'dip 26
  893. .AddChk 205, 360, 190, Array("Attract mode control (is aways on)", &H00000040) 'dip 7
  894. .AddLabel 50, 380, 300, 20, "After hitting OK, press F3 to reset game with new settings."
  895. End With
  896. Dim extra
  897. extra = Controller.Dip(4) + Controller.Dip(5) * 256
  898. extra = vpmDips.ViewDipsExtra(extra)
  899. Controller.Dip(4) = extra And 255
  900. Controller.Dip(5) = (extra And 65280) \ 256 And 255
  901. End Sub
  902. Set vpmShowDips = GetRef("editDips")
  903.  
  904. Sub Table1_Exit()
  905. Controller.Pause = False
  906. Controller.Stop
  907. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement