Guest User

Untitled

a guest
Sep 10th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.42 KB | None | 0 0
  1. '############################################################################################
  2. '############################################################################################
  3. '####### ########
  4. '####### Quijote ########
  5. '####### (Juegos Populares 1987) ########
  6. '####### ########
  7. '############################################################################################
  8. '############################################################################################
  9. ' Version 1.0 FS mfuegemann 2016
  10. '
  11. ' Thanks to:
  12. ' Akiles for the playfield and plastics images
  13. ' Zany for the flipper and clear tube models and textures
  14. ' Fuzzel for providing the images for the playfield lights
  15.  
  16.  
  17.  
  18. option Explicit
  19.  
  20. On Error Resume Next
  21. ExecuteGlobal GetTextFile("controller.vbs")
  22. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  23. On Error Goto 0
  24.  
  25. '-----------------------------------
  26. '------ Global Cofigurations ------
  27. '-----------------------------------
  28. Const cGameName="pimbal" 'name of ROM file to be used, Quijote was re-release under the name Pimball or Pinball3000
  29.  
  30. Const DimGI=20 'set between -100 and 105 to dim or brighten GI lights (minus is darker)
  31. Const OutlanePostsHard = True 'switch between the Hard and Easy Outlane Post setting
  32. Const ApronMatch = True 'show Match animation on Apron
  33. Const FreePlay = True 'add a coin on StartGame
  34.  
  35. P_Apron.image = "Apron_Quijote_ESP" 'enable the apron version, You want
  36. 'P_Apron.image = "Apron_Quijote_EN"
  37. 'P_Apron.image = "Apron_Pimball_ESP"
  38. 'P_Apron.image = "Apron_Pimball_EN"
  39.  
  40.  
  41.  
  42.  
  43. Const UseSolenoids=1,UseLamps=1,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SCoin="coin3",SFlipperOn="",SFlipperOff=""
  44.  
  45. LoadVPM "01560000","juegos.vbs",3.2
  46.  
  47.  
  48. '-----------------------------------
  49. '------ Solenoid Assignment ------
  50. '-----------------------------------
  51.  
  52. SolCallback(7) ="Sol7"
  53. SolCallback(8) ="Sol8"
  54. 'SolCallback(10)="Sol10" 'Drop Target Bank2 - some of the solenoids are not working as intended
  55. 'SolCallback(13)="Sol13" 'Drop Target Bank
  56. 'SolCallback(14)="Sol14" 'Left Hole VUK
  57. SolCallback(15)="vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  58. 'SolCallback(16)="bsTrough.SolOut"
  59.  
  60. 'SolCallback(sLLFlipper)="vpmSolFlipper LeftFlipper,Nothing,"
  61. 'SolCallback(sLRFlipper)="vpmSolFlipper RightFlipper,Nothing,"
  62.  
  63. SolCallback(sLRFlipper) = "SolRFlipper"
  64. SolCallback(sLLFlipper) = "SolLFlipper"
  65.  
  66.  
  67. Sub SolLFlipper(Enabled)
  68. If Enabled Then
  69. PlaySound SoundFXDOF("FlipperUp",101,DOFOn,DOFFlippers):LeftFlipper.RotateToEnd
  70. Else
  71. PlaySound SoundFXDOF("FlipperDown",101,DOFOff,DOFFlippers):LeftFlipper.RotateToStart
  72. End If
  73. End Sub
  74.  
  75. Sub SolRFlipper(Enabled)
  76. If Enabled Then
  77. PlaySound SoundFXDOF("FlipperUp",102,DOFOn,DOFFlippers):RightFlipper.RotateToEnd
  78. Else
  79. PlaySound SoundFXDOF("FlipperDown",102,DOFOff,DOFFlippers):RightFlipper.RotateToStart
  80. End If
  81. End Sub
  82.  
  83. Sub Sol7(enabled)
  84. FlipperActive = Enabled
  85. End Sub
  86.  
  87.  
  88. Sub Sol8(enabled)
  89. LampSol8.state = abs(enabled)
  90. LampSol8a.state = abs(enabled)
  91. End Sub
  92.  
  93. 'Handled via correponding lights
  94. '
  95. 'Sub Sol10(enabled)
  96. ' if enabled then
  97. ' DTBank2Timer.enabled = False
  98. ' DropTargetBank2.DropSol_On
  99. ' end if
  100. 'End Sub
  101.  
  102. 'Sub Sol13(enabled)
  103. ' if enabled then
  104. ' DTBank1Timer.enabled = False
  105. ' DropTargetBank.DropSol_On
  106. ' end if
  107. 'End Sub
  108.  
  109. 'Sub Sol14(enabled)
  110. ' if enabled then
  111. ' LHole.destroyball
  112. ' Controller.Switch(23)=0
  113. ' LHoleUp.createball
  114. ' LHoleUp.kick 180,10
  115. ' end if
  116. 'End Sub
  117.  
  118.  
  119. '--------------------------
  120. '------ Table Init ------
  121. '--------------------------
  122. Dim bsTrough,obj,bsRightHole,bsLeftHole,DropTargetBank,DropTargetBank2,Flipperactive,cCaptive,MultiBall
  123.  
  124. Sub Quijote_Init
  125. if not ApronMatch then
  126. For each obj in MatchObjects
  127. obj.TransZ = -10
  128. Next
  129. end if
  130.  
  131. if OutlanePostsHard then
  132. RightPost_Hard.isdropped = False
  133. RightPost_Easy.isdropped = True
  134. P_RightPost.TransY = -30
  135. LeftPost_Hard.isdropped = False
  136. LeftPost_Easy.isdropped = True
  137. P_LeftPost.TransY = -27
  138. else
  139. RightPost_Hard.isdropped = True
  140. RightPost_Easy.isdropped = False
  141. P_RightPost.TransY = 0
  142. LeftPost_Hard.isdropped = True
  143. LeftPost_Easy.isdropped = False
  144. P_LeftPost.TransY = 0
  145. end if
  146.  
  147. LSling_1.WidthTop = 0
  148. LSling_1.WidthBottom = 0
  149. LSling_2.WidthTop = 0
  150. LSling_2.WidthBottom = 0
  151. LSling_3.WidthTop = 0
  152. LSling_3.WidthBottom = 0
  153. Sling1.isdropped = True
  154. Sling2.isdropped = True
  155. Sling3.isdropped = True
  156.  
  157. RSling_1.WidthTop = 0
  158. RSling_1.WidthBottom = 0
  159. RSling_2.WidthTop = 0
  160. RSling_2.WidthBottom = 0
  161. RSling_3.WidthTop = 0
  162. RSling_3.WidthBottom = 0
  163.  
  164. RSling1.isdropped = True
  165. RSling2.isdropped = True
  166. RSling3.isdropped = True
  167. Sling1.isdropped = True
  168. Sling2.isdropped = True
  169. Sling3.isdropped = True
  170.  
  171. vpminit me
  172.  
  173. Controller.GameName=cGameName
  174. Controller.SplashInfoLine="Quijote" & vbNewLine & "created by mfuegemann"
  175. Controller.HandleKeyboard=False
  176. Controller.ShowTitle=0
  177. Controller.ShowFrame=0
  178. Controller.ShowDMDOnly=1
  179. 'Controller.Hidden = 1 'enable to hide DMD if You use a B2S backglass
  180.  
  181. ' 'DMD position for 3 Monitor Setup
  182. ' 'Controller.Games(cGameName).Settings.Value("dmd_pos_x")=3850 'set this to 0 if You cannot find the DMD
  183. ' 'Controller.Games(cGameName).Settings.Value("dmd_pos_y")=300 'set this to 0 if You cannot find the DMD
  184. ' 'Controller.Games(cGameName).Settings.Value("dmd_width")=505
  185. ' 'Controller.Games(cGameName).Settings.Value("dmd_height")=155
  186. ' 'Controller.Games(cGameName).Settings.Value("rol")=0
  187. '
  188. ' 'Controller.Games(cGameName).Settings.Value("ddraw") = 0 'set to 0 if You have problems with DMD showing or table stutter
  189.  
  190. Controller.HandleMechanics=0
  191.  
  192. Controller.Run
  193. If Err Then MsgBox Err.Description
  194. On Error Goto 0
  195.  
  196. PinMAMETimer.Interval=PinMAMEInterval
  197. PinMAMETimer.Enabled = true
  198.  
  199. Multiball = False
  200.  
  201. vpmNudge.TiltSwitch=30
  202. vpmNudge.Sensitivity=5
  203. vpmNudge.TiltObj = Array(LeftFlipper,RightFlipper)
  204.  
  205. vpmMapLights AllLights
  206.  
  207. Set bsTrough=New cvpmBallStack
  208. bsTrough.InitSw 0,24,0,0,0,0,0,0 '0.1 = Switch 0
  209. bsTrough.InitKick BallRelease,90,5
  210. bsTrough.InitExitSnd SoundFX("BallRel",DOFContactors),SoundFX("Solenoid",DOFContactors)
  211. bsTrough.Balls=1
  212.  
  213. 'add 2nd Ball
  214. Kicker1.createball
  215. Kicker1.kick 120,1
  216.  
  217. set DropTargetBank = new cvpmDropTarget
  218. DropTargetBank.InitDrop Array(DT1,DT2,DT3), Array(6,7,8)
  219. DropTargetBank.InitSnd SoundFX("Targetdrop1",DOFContactors),SoundFX("TargetBankreset1",DOFContactors)
  220. DropTargetBank.CreateEvents "DropTargetBank"
  221.  
  222. set DropTargetBank2 = new cvpmDropTarget
  223. DropTargetBank2.InitDrop Array(DT4,DT5,DT6), Array(3,4,5)
  224. DropTargetBank2.InitSnd SoundFX("Targetdrop1",DOFContactors),SoundFX("TargetBankreset1",DOFContactors)
  225. DropTargetBank2.CreateEvents "DropTargetBank2"
  226.  
  227. Set cCaptive=New cvpmCaptiveBall
  228. cCaptive.InitCaptive CaptiveTrigger,CaptiveWall,CaptiveKicker,2
  229. cCaptive.Start
  230. cCaptive.ForceTrans = 1
  231. cCaptive.MinForce = 3
  232. cCaptive.CreateEvents "cCaptive"
  233.  
  234. For each obj in GIFlashers
  235. obj.Alpha = obj.Alpha + DimGI
  236. Next
  237.  
  238. GIStartTimer.enabled = True
  239. End Sub
  240.  
  241. Sub Quijote_Exit()
  242. Controller.Pause = False
  243. Controller.Stop
  244. End Sub
  245.  
  246.  
  247. '------------------------------
  248. '------ Trough Handler ------
  249. '------------------------------
  250. Sub DrainEnter_Hit
  251. Controller.Switch(25)=1
  252. End Sub
  253.  
  254. Sub DrainEnter_UnHit
  255. Controller.Switch(25)=0
  256. End Sub
  257.  
  258. Sub Drain_Hit()
  259. SoundTimer.enabled = False
  260. StopAllSounds
  261. Multiball = False
  262. Wall.isdropped = False
  263. bsTrough.AddBall Me
  264. playsound "Drain5"
  265. End Sub
  266.  
  267.  
  268. '-------------------------------
  269. '------ Keybord Handler ------
  270. '-------------------------------
  271.  
  272. Sub Quijote_KeyDown(ByVal keycode)
  273. If keycode = PlungerKey Then
  274. Plunger.PullBack
  275. End If
  276. if FlipperActive then
  277. If keycode = LeftFlipperKey Then
  278. controller.switch(84) = 1
  279. PlaySound SoundFX("FlipperUp_Akiles",DOFContactors),0,0.7,-0.1,0.25
  280. End If
  281. If keycode = RightFlipperKey Then
  282. controller.switch(82) = 1
  283. PlaySound SoundFX("FlipperUp_Akiles",DOFContactors),0,0.7,0.1,0.25
  284. End If
  285. end if
  286. if FreePlay and keycode = Startgamekey then
  287. vpmtimer.pulsesw 28
  288. end if
  289. If vpmKeyDown(KeyCode) Then Exit Sub
  290. End Sub
  291.  
  292. Sub Quijote_KeyUp(ByVal keycode)
  293. If keycode = PlungerKey Then
  294. Plunger.Fire
  295. End If
  296. If keycode = LeftFlipperKey Then
  297. controller.switch(84) = 0
  298. if FlipperActive then
  299. PlaySound SoundFX("FlipperDown_Akiles",DOFContactors),0,0.7,-0.1,0.25
  300. end if
  301. End If
  302. If keycode = RightFlipperKey Then
  303. controller.switch(82) = 0
  304. if FlipperActive then
  305. PlaySound SoundFX("FlipperDown_Akiles",DOFContactors),0,0.7,0.1,0.25
  306. end if
  307. End If
  308. If vpmKeyUp(KeyCode) Then Exit Sub
  309. End Sub
  310.  
  311.  
  312. '------------------------------
  313. '------ Switch Handler ------
  314. '------------------------------
  315.  
  316. Sub RHole_Hit:Controller.Switch(22)=1:SoundTimer.enabled = False:StopAllSounds:Playsound "soloff",0,1,0,0.1:End Sub
  317. Sub LHole_Hit:Controller.Switch(23)=1:SoundTimer.enabled = False:StopAllSounds:Playsound "soloff",0,1,-0.15,0.1:End Sub
  318.  
  319. Sub LeftSlingshot_Slingshot:LeftSlingshot.timerenabled = True:vpmTimer.PulseSw 12:PlaySound SoundFX("Slingshot_Akiles",DOFContactors),0,0.7,-0.3,0.1:End Sub
  320. Sub RightSlingshot_Slingshot:RightSlingshot.timerenabled = True:vpmTimer.PulseSw 13:PlaySound SoundFX("Slingshot_Akiles",DOFContactors),0,0.7,0.3,0.1:End Sub
  321.  
  322. Dim Bumper1_Dir,Bumper2_Dir,Bumper3_Dir
  323. Sub Bumper1_Hit
  324. vpmTimer.PulseSw 14
  325. Playsound SoundFX("Bumper",DOFContactors),0,1,0,0.25
  326. Bumper1_Dir = -1
  327. Bumper1.Timerenabled = False
  328. Bumper1.Timerenabled = True
  329. End Sub
  330. Sub Bumper2_Hit
  331. vpmTimer.PulseSw 15
  332. Playsound SoundFX("Bumper",DOFContactors),0,1,0.03,0.25
  333. Bumper2_Dir = -1
  334. Bumper2.Timerenabled = False
  335. Bumper2.Timerenabled = True
  336. End Sub
  337. Sub Bumper3_Hit
  338. vpmTimer.PulseSw 16
  339. Playsound SoundFX("Bumper",DOFContactors),0,1,0.03,0.25
  340. Bumper3_Dir = -1
  341. Bumper3.Timerenabled = False
  342. Bumper3.Timerenabled = True
  343. End Sub
  344.  
  345. Sub Spinner_Spin:vpmTimer.PulseSw 17:Playsound "soloff",0,0.2,-0.08,0.1:End Sub
  346.  
  347. sub LOutlane_hit:Controller.Switch(1)=1:P_LOutlane.TransZ=-8:End Sub
  348. sub LOutlane_unhit:Controller.Switch(1)=0:LOutlane.timerenabled=True:End Sub
  349. sub LInlane_hit:Controller.Switch(1)=1:P_LInlane.TransZ=-8:End Sub
  350. sub LInlane_unhit:Controller.Switch(1)=0:LInlane.timerenabled=True:End Sub
  351.  
  352. sub ROutlane_hit:Controller.Switch(2)=1:P_ROutlane.TransZ=-8:End Sub
  353. sub ROutlane_unhit:Controller.Switch(2)=0:ROutlane.timerenabled=True:End Sub
  354. sub RInlane_hit:Controller.Switch(2)=1:P_RInlane.TransZ=-8:End Sub
  355. sub RInlane_unhit:Controller.Switch(2)=0:RInlane.timerenabled=True:End Sub
  356. sub RInlane_unhit:Controller.Switch(2)=0:RInlane.timerenabled=True:End Sub
  357.  
  358. Sub RightTarget_hit:vpmTimer.PulseSw 20:MoveRightTarget:Playsound SoundFX("Target1",DOFTargets),0,1,0.15,0.1:End Sub
  359. Sub CenterTarget_hit:vpmTimer.PulseSw 19:MoveCenterTarget:Playsound SoundFX("Target1",DOFTargets),0,1,0,0.1:End Sub
  360. Sub LeftTarget_hit:vpmTimer.PulseSw 21:MoveLeftTarget:Playsound SoundFX("Target1",DOFTargets),0,1,-0.18,0.1:End Sub
  361.  
  362. Sub CaptiveTarget_hit:vpmTimer.PulseSw 33:MoveCaptiveTarget:Playsound SoundFX("Target1",DOFTargets),0,1,0.15,0.1:End Sub
  363.  
  364. 'Top Rollover
  365. sub TopRollover_Left_hit:Controller.Switch(11)=1:P_T1.TransZ=-8:End Sub
  366. sub TopRollover_Left_unhit:Controller.Switch(11)=0:TopRollover_Left.timerenabled=True:End Sub
  367. sub TopRollover_Center_hit:Controller.Switch(10)=1:P_T2.TransZ=-8:End Sub
  368. sub TopRollover_Center_unhit:Controller.Switch(10)=0:TopRollover_Center.timerenabled=True:End Sub
  369. sub TopRollover_Right_hit:Controller.Switch(9)=1:P_T3.TransZ=-8:End Sub
  370. sub TopRollover_Right_unhit:Controller.Switch(9)=0:TopRollover_Right.timerenabled=True:End Sub
  371.  
  372.  
  373. Sub Rubber1_hit:vpmTimer.PulseSw 18:playsound "bump",0,0.5,-0.18,0.25:End Sub
  374. Sub Rubber2_hit:vpmTimer.PulseSw 18:playsound "bump",0,0.5,-0.1,0.25:End Sub
  375. Sub Rubber3_hit:vpmTimer.PulseSw 18:playsound "bump",0,0.5,0.15,0.25:End Sub
  376.  
  377.  
  378. '--------------------------------
  379. '------ Helper Functions ------
  380. '--------------------------------
  381.  
  382. Sub RampTrigger_Hit
  383. if MultiBall and (RHole.BallCntOver>0) then
  384. Controller.Switch(22)=0
  385. RHole.Timerenabled = True
  386. RHole.kick 280,15
  387. End If
  388. End Sub
  389.  
  390. 'Bumper Rings
  391. Sub Bumper1_Timer
  392. P_BumperRing1.TransZ = P_BumperRing1.TransZ + Bumper1_Dir * 2.5
  393. if P_BumperRing1.TransZ <= -30 then Bumper1_Dir = 1
  394. if P_BumperRing1.TransZ >= 0 then
  395. Bumper1.Timerenabled = False
  396. Bumper1_Dir = 0
  397. end if
  398. End Sub
  399.  
  400. Sub Bumper2_Timer
  401. P_BumperRing2.TransZ = P_BumperRing2.TransZ + Bumper2_Dir * 2.5
  402. if P_BumperRing2.TransZ <= -30 then Bumper2_Dir = 1
  403. if P_BumperRing2.TransZ >= 0 then
  404. Bumper2.Timerenabled = False
  405. Bumper2_Dir = 0
  406. end if
  407. End Sub
  408.  
  409. Sub Bumper3_Timer
  410. P_BumperRing3.TransZ = P_BumperRing3.TransZ + Bumper3_Dir * 2.5
  411. if P_BumperRing3.TransZ <= -30 then Bumper3_Dir = 1
  412. if P_BumperRing3.TransZ >= 0 then
  413. Bumper3.Timerenabled = False
  414. Bumper3_Dir = 0
  415. end if
  416. End Sub
  417.  
  418. 'Slingshot animation
  419. Dim LCount,RCount
  420.  
  421. Sub LeftSlingshot_Timer
  422. LCount = Lcount + 1
  423. select case LCount
  424. case 1:
  425. LSling_1.WidthTop = 0
  426. LSling_1.WidthBottom = 0
  427. LSling_2.WidthTop = 0
  428. LSling_2.WidthBottom = 0
  429. LSling_3.WidthTop = 9
  430. LSling_3.WidthBottom = 9
  431. case 2:
  432. LSling_1.WidthTop = 0
  433. LSling_1.WidthBottom = 0
  434. LSling_2.WidthTop = 9
  435. LSling_2.WidthBottom = 9
  436. LSling_3.WidthTop = 0
  437. LSling_3.WidthBottom = 0
  438. case 3:
  439. LSling_1.WidthTop = 9
  440. LSling_1.WidthBottom = 9
  441. LSling_2.WidthTop = 0
  442. LSling_2.WidthBottom = 0
  443. LSling_3.WidthTop = 0
  444. LSling_3.WidthBottom = 0
  445. case 4:
  446. LeftSlingshot.timerenabled = False
  447. LCount = 0
  448. LSling_1.WidthTop = 0
  449. LSling_1.WidthBottom = 0
  450. LSling_2.WidthTop = 0
  451. LSling_2.WidthBottom = 0
  452. LSling_3.WidthTop = 0
  453. LSling_3.WidthBottom = 0
  454. end select
  455. Sling0.isdropped = (LCount <> 0)
  456. Sling1.isdropped = (LCount <> 3)
  457. Sling2.isdropped = (LCount <> 2)
  458. Sling3.isdropped = (LCount <> 1)
  459. End Sub
  460.  
  461. Sub RightSlingshot_Timer
  462. RCount = RCount + 1
  463. select case RCount
  464. case 1:
  465. RSling_1.WidthTop = 0
  466. RSling_1.WidthBottom = 0
  467. RSling_2.WidthTop = 0
  468. RSling_2.WidthBottom = 0
  469. RSling_3.WidthTop = 9
  470. RSling_3.WidthBottom = 9
  471. case 2:
  472. RSling_1.WidthTop = 0
  473. RSling_1.WidthBottom = 0
  474. RSling_2.WidthTop = 9
  475. RSling_2.WidthBottom = 9
  476. RSling_3.WidthTop = 0
  477. RSling_3.WidthBottom = 0
  478. case 3:
  479. RSling_1.WidthTop = 9
  480. RSling_1.WidthBottom = 9
  481. RSling_2.WidthTop = 0
  482. RSling_2.WidthBottom = 0
  483. RSling_3.WidthTop = 0
  484. RSling_3.WidthBottom = 0
  485. case 4:
  486. RightSlingshot.timerenabled = False
  487. RCount = 0
  488. RSling_1.WidthTop = 0
  489. RSling_1.WidthBottom = 0
  490. RSling_2.WidthTop = 0
  491. RSling_2.WidthBottom = 0
  492. RSling_3.WidthTop = 0
  493. RSling_3.WidthBottom = 0
  494. end select
  495. RSling0.isdropped = (RCount <> 0)
  496. RSling1.isdropped = (RCount <> 3)
  497. RSling2.isdropped = (RCount <> 2)
  498. RSling3.isdropped = (RCount <> 1)
  499. End Sub
  500.  
  501. ' Gates
  502. Sub Gate_Hit:PlaySound "Gate5",0,1,0.1,0.1:End Sub
  503. Sub Gate8_Hit:PlaySound "Gate5",0,1,-0.05,0.1:End Sub
  504. Sub RGate_Hit:PlaySound "Gate1",0,0.2,0.15,0.1:MoveRGate:End Sub
  505. Sub LGate_Hit:PlaySound "Gate1",0,0.2,-0.15,0.1:MoveLGate:End Sub
  506. Sub CGate_Hit:PlaySound "Gate1",0,0.2,0,0.1:MoveCGate:End Sub
  507.  
  508. Sub MoveRGate
  509. P_RGate.Rotx = -90
  510. RGate.timerenabled = True
  511. End Sub
  512. Sub RGate_Timer
  513. P_RGate.Rotx = P_RGate.Rotx + 5
  514. if P_RGate.Rotx > -5 then
  515. P_RGate.Rotx = 0
  516. RGate.timerenabled = False
  517. end if
  518. end Sub
  519.  
  520. Sub MoveLGate
  521. P_LGate.Rotx = -90
  522. LGate.timerenabled = True
  523. End Sub
  524. Sub LGate_Timer
  525. P_LGate.Rotx = P_LGate.Rotx + 5
  526. if P_LGate.Rotx > -5 then
  527. P_LGate.Rotx = 0
  528. LGate.timerenabled = False
  529. end if
  530. end Sub
  531.  
  532. Sub MoveCGate
  533. P_CGate.Rotx = -90
  534. CGate.timerenabled = True
  535. End Sub
  536. Sub CGate_Timer
  537. P_CGate.Rotx = P_CGate.Rotx + 5
  538. if P_CGate.Rotx > -5 then
  539. P_CGate.Rotx = 0
  540. CGate.timerenabled = False
  541. end if
  542. end Sub
  543.  
  544.  
  545. 'additional Lamp Callback
  546. Sub LampTimer_Timer
  547.  
  548. MLight.state = abs(Multiball)
  549.  
  550. 'DT1 Reset FallBack
  551. if Controller.lamp(2) then
  552. if not DTBank2GraceTimer.enabled then
  553. DTBank2Timer.enabled = True
  554. end if
  555. end if
  556.  
  557. 'DT2 Reset FallBack
  558. if Controller.lamp(18) then
  559. if not DTBank1GraceTimer.enabled then
  560. DTBank1Timer.enabled = True
  561. End If
  562. end if
  563.  
  564. if Controller.lamp(38) and not controller.lamp(25) then
  565. Lamp38.state = Lightstateon
  566. Lamp38a.state = Lightstateon
  567. else
  568. Lamp38.state = Lightstateoff
  569. Lamp38a.state = Lightstateoff
  570. end if
  571.  
  572. if Controller.lamp(89) or Multiball then
  573. Lamp89.state = Lightstateon
  574. else
  575. Lamp89.state = Lightstateoff
  576. end if
  577.  
  578. 'Right Hole
  579. if Controller.lamp(97) and (RHole.BallCntOver>0) then
  580. if not RHole.Timerenabled then
  581. Controller.Switch(22)=0
  582. RHole.Timerenabled = True
  583. RHole.kick 280,15
  584. Playsound SoundFX("Popper",DOFContactors),0,1,0,0.2
  585. end if
  586. end if
  587.  
  588. 'Left Hole VUK
  589. if Controller.lamp(19) and (LHole.BallCntOver>0) then
  590. if not LHole.Timerenabled then
  591. Controller.Switch(23)=0
  592. LHole.Timerenabled = True
  593. LHole.destroyball
  594. Playsound SoundFX("Popper",DOFContactors),0,1,-0.15,0.2
  595. LHoleUp.createball
  596. LHoleUp.kick 180,7
  597. end if
  598. end if
  599.  
  600. 'Ball Release
  601. if Controller.lamp(50) then
  602. if not BallRelease.Timerenabled then
  603. Wall.Timerenabled = False
  604. Wall.isdropped = True
  605. BallRelease.Timerenabled = True
  606.  
  607. if RHole.BallCntOver>0 then
  608. if not Multiball then
  609. Multiball = True
  610. Wall.Timerenabled = False
  611. Wall.isdropped = True
  612. end if
  613. end if
  614.  
  615. bsTrough.ExitSol_On
  616. DOF 105, DOFPulse
  617. end if
  618. end if
  619.  
  620. 'Multiball
  621. if Controller.lamp(89) and (RHole.BallCntOver>0) then
  622. if not Multiball then
  623. Multiball = True
  624. Wall.Timerenabled = False
  625. Wall.isdropped = True
  626. bsTrough.ExitSol_On
  627. end if
  628. end if
  629.  
  630. if controller.lamp(44) then
  631. L44Flasher.isvisible = True
  632. L44bFlasher.isvisible = True
  633. else
  634. L44Flasher.isvisible = False
  635. L44bFlasher.isvisible = False
  636. end if
  637.  
  638.  
  639. 'Match Lights
  640. if controller.lamp(113) then
  641. P_L113.image = "JP_Bulb_lit"
  642. else
  643. P_L113.image = "JP_Bulb"
  644. end if
  645. if controller.lamp(114) then
  646. P_L114.image = "JP_Bulb_lit"
  647. else
  648. P_L114.image = "JP_Bulb"
  649. end if
  650. if controller.lamp(115) then
  651. P_L115.image = "JP_Bulb_lit"
  652. else
  653. P_L115.image = "JP_Bulb"
  654. end if
  655. if controller.lamp(116) then
  656. P_L116.image = "JP_Bulb_lit"
  657. else
  658. P_L116.image = "JP_Bulb"
  659. end if
  660. if controller.lamp(117) then
  661. P_L117.image = "JP_Bulb_lit"
  662. else
  663. P_L117.image = "JP_Bulb"
  664. end if
  665. if controller.lamp(118) then
  666. P_L118.image = "JP_Bulb_lit"
  667. else
  668. P_L118.image = "JP_Bulb"
  669. end if
  670. if controller.lamp(119) then
  671. P_L119.image = "JP_Bulb_lit"
  672. else
  673. P_L119.image = "JP_Bulb"
  674. end if
  675. if controller.lamp(120) then
  676. P_L120.image = "JP_Bulb_lit"
  677. else
  678. P_L120.image = "JP_Bulb"
  679. end if
  680. if controller.lamp(121) then '00
  681. P_L121.image = "JP_Bulb_lit"
  682. else
  683. P_L121.image = "JP_Bulb"
  684. end if
  685. if controller.lamp(122) then
  686. P_L122.image = "JP_Bulb_lit"
  687. else
  688. P_L122.image = "JP_Bulb"
  689. end if
  690.  
  691. 'GI Lights
  692. if controller.lamp(65) then
  693. P_L65.image = "JP_Bulb_lit"
  694. L65Flasher.isvisible = True
  695. else
  696. P_L65.image = "JP_Bulb"
  697. L65Flasher.isvisible = False
  698. end if
  699. if controller.lamp(66) then
  700. P_L66.image = "JP_Bulb_lit"
  701. L66Flasher.isvisible = True
  702. else
  703. P_L66.image = "JP_Bulb"
  704. L66Flasher.isvisible = False
  705. end if
  706. if controller.lamp(67) then
  707. P_L67.image = "JP_Bulb_lit"
  708. L67Flasher.isvisible = True
  709. else
  710. P_L67.image = "JP_Bulb"
  711. L67Flasher.isvisible = False
  712. end if
  713. if controller.lamp(68) then
  714. P_L68.image = "JP_Bulb_lit"
  715. L68Flasher.isvisible = True
  716. else
  717. P_L68.image = "JP_Bulb"
  718. L68Flasher.isvisible = False
  719. end if
  720. if controller.lamp(69) then
  721. P_L69.image = "JP_Bulb_lit"
  722. L69Flasher.isvisible = True
  723. else
  724. P_L69.image = "JP_Bulb"
  725. L69Flasher.isvisible = False
  726. end if
  727. if controller.lamp(70) then
  728. P_L70.image = "JP_Bulb_lit"
  729. L70Flasher.isvisible = True
  730. else
  731. P_L70.image = "JP_Bulb"
  732. L70Flasher.isvisible = False
  733. end if
  734. if controller.lamp(71) then
  735. P_L71.image = "JP_Bulb_lit"
  736. L71Flasher.isvisible = True
  737. else
  738. P_L71.image = "JP_Bulb"
  739. L71Flasher.isvisible = False
  740. end if
  741. if controller.lamp(72) then
  742. P_L72.image = "JP_Bulb_lit"
  743. L72Flasher.isvisible = True
  744. else
  745. P_L72.image = "JP_Bulb"
  746. L72Flasher.isvisible = False
  747. end if
  748.  
  749. if Controller.lamp(74) or FlipperActive then
  750. P_Bumpercap1.image = "JP_Bumper_lit"
  751. P_Bumper1.image = "Bumper_Yellow"
  752. BumperFlasher1.isvisible = True
  753. BumperFlasher1b.isvisible = True
  754. else
  755. P_Bumpercap1.image = "JP_Bumper"
  756. P_Bumper1.image = "Bumper_Yellow_dark"
  757. BumperFlasher1.isvisible = False
  758. BumperFlasher1b.isvisible = False
  759. end if
  760. if Controller.lamp(75) or FlipperActive then
  761. P_Bumpercap2.image = "JP_Bumper_lit"
  762. P_Bumper2.image = "Bumper_Yellow"
  763. BumperFlasher2.isvisible = True
  764. BumperFlasher2b.isvisible = True
  765. else
  766. P_Bumpercap2.image = "JP_Bumper"
  767. P_Bumper2.image = "Bumper_Yellow_dark"
  768. BumperFlasher2.isvisible = False
  769. BumperFlasher2b.isvisible = False
  770. end if
  771. if Controller.lamp(76) or FlipperActive then
  772. P_Bumpercap3.image = "JP_Bumper_lit"
  773. P_Bumper3.image = "Bumper_Yellow"
  774. BumperFlasher3.isvisible = True
  775. BumperFlasher3b.isvisible = True
  776. else
  777. P_Bumpercap3.image = "JP_Bumper"
  778. P_Bumper3.image = "Bumper_Yellow_dark"
  779. BumperFlasher3.isvisible = False
  780. BumperFlasher3b.isvisible = False
  781. end if
  782.  
  783. if Controller.lamp(78) or FlipperActive then
  784. LeftSlingFlasher1.isvisible = True
  785. LeftSlingFlasher2.isvisible = True
  786. LeftSlingFlasher3.isvisible = True
  787. else
  788. LeftSlingFlasher1.isvisible = False
  789. LeftSlingFlasher2.isvisible = False
  790. LeftSlingFlasher3.isvisible = False
  791. end if
  792.  
  793. if Controller.lamp(79) or FlipperActive then
  794. RightSlingFlasher1.isvisible = True
  795. RightSlingFlasher2.isvisible = True
  796. RightSlingFlasher3.isvisible = True
  797. else
  798. RightSlingFlasher1.isvisible = False
  799. RightSlingFlasher2.isvisible = False
  800. RightSlingFlasher3.isvisible = False
  801. end if
  802. End sub
  803.  
  804. Sub DTBank1Timer_Timer
  805. DTBank1Timer.enabled = False
  806. DTBank1GraceTimer.enabled = True
  807. DropTargetBank.DropSol_On
  808. DOF 104, DOFPulse
  809. End Sub
  810. Sub DTBank1GraceTimer_Timer
  811. DTBank1GraceTimer.enabled = False
  812. End Sub
  813.  
  814. Sub DTBank2Timer_Timer
  815. DTBank2Timer.enabled = False
  816. DTBank2GraceTimer.enabled = True
  817. DropTargetBank2.DropSol_On
  818. DOF 103, DOFPulse
  819. End Sub
  820. Sub DTBank2GraceTimer_Timer
  821. DTBank2GraceTimer.enabled = False
  822. End Sub
  823.  
  824. Sub BallRelease_Timer
  825. BallRelease.Timerenabled = False
  826. End Sub
  827.  
  828. Sub LHole_Timer
  829. LHole.Timerenabled = False
  830. End Sub
  831.  
  832. Sub RHole_Timer
  833. RHole.Timerenabled = False
  834. End Sub
  835.  
  836. Sub Wall_Timer
  837. Wall.Timerenabled = False
  838. Wall.isdropped = False
  839. End Sub
  840.  
  841. 'Rollover Switches
  842. sub TopRollover_Left_Timer
  843. TopRollover_Left.timerenabled = False
  844. P_T1.TransZ = 0
  845. End Sub
  846.  
  847. sub TopRollover_Center_Timer
  848. TopRollover_Center.timerenabled = False
  849. P_T2.TransZ = 0
  850. End Sub
  851.  
  852. sub TopRollover_Right_Timer
  853. TopRollover_Right.timerenabled = False
  854. P_T3.TransZ = 0
  855. End Sub
  856.  
  857. sub LOutlane_Timer
  858. LOutlane.timerenabled = False
  859. P_LOutlane.TransZ = 0
  860. End Sub
  861.  
  862. sub LInlane_Timer
  863. LInlane.timerenabled = False
  864. P_LInlane.TransZ = 0
  865. End Sub
  866.  
  867. sub ROutlane_Timer
  868. ROutlane.timerenabled = False
  869. P_ROutlane.TransZ = 0
  870. End Sub
  871.  
  872. sub RInlane_Timer
  873. RInlane.timerenabled = False
  874. P_RInlane.TransZ = 0
  875. End Sub
  876.  
  877. 'Targets
  878. Sub MoveLeftTarget
  879. P_LeftTarget.Transy = 5
  880. LeftTarget.Timerenabled = False
  881. LeftTarget.Timerenabled = True
  882. End Sub
  883. Sub LeftTarget_Timer
  884. LeftTarget.Timerenabled = False
  885. P_LeftTarget.Transy = 0
  886. End Sub
  887.  
  888. Sub MoveCenterTarget
  889. P_CenterTarget.Transy = 5
  890. CenterTarget.Timerenabled = False
  891. CenterTarget.Timerenabled = True
  892. End Sub
  893. Sub CenterTarget_Timer
  894. CenterTarget.Timerenabled = False
  895. P_CenterTarget.Transy = 0
  896. End Sub
  897.  
  898. Sub MoveRightTarget
  899. P_RightTarget.Transy = 5
  900. RightTarget.Timerenabled = False
  901. RightTarget.Timerenabled = True
  902. End Sub
  903. Sub RightTarget_Timer
  904. RightTarget.Timerenabled = False
  905. P_RightTarget.Transy = 0
  906. End Sub
  907.  
  908. Sub MoveCaptiveTarget
  909. P_CaptiveTarget.Transy = 5
  910. CaptiveTarget.Timerenabled = False
  911. CaptiveTarget.Timerenabled = True
  912. End Sub
  913. Sub CaptiveTarget_Timer
  914. CaptiveTarget.Timerenabled = False
  915. P_CaptiveTarget.Transy = 0
  916. End Sub
  917.  
  918. 'Start GI
  919. Sub GIStartTimer_Timer
  920. GIStartTimer.enabled = False
  921. For each obj in GIFlashers
  922. obj.isvisible = True
  923. Next
  924. End Sub
  925.  
  926.  
  927. 'Flipper Primitives and Drop Targets
  928. sub FlipperTimer_Timer()
  929. pleftFlipper.objrotz=leftFlipper.CurrentAngle
  930. prightFlipper.objrotz=rightFlipper.CurrentAngle
  931.  
  932. if DT1.isdropped then
  933. P_DT1.TransY = -60
  934. else
  935. P_DT1.TransY = 0
  936. end if
  937. if DT2.isdropped then
  938. P_DT2.TransY = -60
  939. else
  940. P_DT2.TransY = 0
  941. end if
  942. if DT3.isdropped then
  943. P_DT3.TransY = -60
  944. else
  945. P_DT3.TransY = 0
  946. end if
  947.  
  948. if DT4.isdropped then
  949. P_DT4.TransY = -60
  950. else
  951. P_DT4.TransY = 0
  952. end if
  953. if DT5.isdropped then
  954. P_DT5.TransY = -60
  955. else
  956. P_DT5.TransY = 0
  957. end if
  958. if DT6.isdropped then
  959. P_DT6.TransY = -60
  960. else
  961. P_DT6.TransY = 0
  962. end if
  963.  
  964. end sub
  965.  
  966. ' DIP switch menu
  967. Sub editDips
  968. Dim vpmDips:Set vpmDips=New cvpmDips
  969. With vpmDips
  970. .AddForm 200,280,"Quijote DIP switches"
  971. .AddFrame 0, 0,270,"Balls per game",&H00000400,Array("3 balls",0,"5 balls",&H00000400)
  972. .AddChk 5,50,270,Array("Match feature",32768)
  973. .AddFrame 0,75,270,"Replay threshold (Credit/extra ball/credit)",&H00000300,Array("2.0M/5.6M/7.0M points",&H00000300,"2.0M/3.2M/4.8M points",&H00000200,"2.0M/2.8M/3.6M points",0,"2.0M/2.6M/3.8M points",&H00000100)
  974. .AddChk 5,155,270,Array("Enable replay extra ball",&H00000008)
  975.  
  976. .AddLabel 0,180,280,20,"After hitting OK, press F3 to reset game with new settings."
  977. .ViewDips
  978. End With
  979. End Sub
  980. Set vpmShowDips=GetRef("editDips")
  981.  
  982.  
  983.  
  984. '-----------------------------
  985. '------ Sound Handler ------
  986. '-----------------------------
  987.  
  988. Dim SoundActive,BallVel,Flying,SoundBall,OnRamp,WireRamp,Panning,BallXPos
  989.  
  990. Const TableWidth = 965 'used for sound panning, enter the value specified in table options "Table Width"
  991. Const PanningFactor = 0.7 'panning factor 0..1, 1 = left speaker off, if ball is rightmost and vice versa, 0 = no panning
  992.  
  993. Const SoundVel = 10 'sound is played if ball velocity is above this threshold
  994.  
  995. Sub SoundTimer_Timer
  996. BallXPos = SoundBall.X
  997. if BallXPos < 0 then BallXPos = 0 'boundary check
  998. if BallXPos > TableWidth then BallXPos = Tablewidth
  999. Panning = ((2 * BallXPos / TableWidth) - 1) * PanningFactor 'scale the X position of the ball to the interval [-1,1]
  1000.  
  1001. BallVel = SQR((SoundBall.velx^2) + (SoundBall.vely^2)) 'calculating the speed vector within the X/Y plane only once per timer call
  1002.  
  1003. if SoundActive = 0 then 'play new sounds only after the current sound has ended
  1004. if BallVel > SoundVel then 'if velocity exceeds the threshold a sound will be played
  1005. SoundActive = 1
  1006. if OnRamp = 1 then
  1007. if WireRamp = 1 then 'Ball is on a wire ramp
  1008. PlaySound "WireRamp1",1,1,Panning,0.25
  1009. else 'Ball is on a normal ramp
  1010. PlaySound "Ballroll3",1,1,Panning,0.25
  1011. end if
  1012. else 'Ball is on the playfield, sound will be played as a loop
  1013. PlaySound "roll1",-1,1,Panning,0.35
  1014. end if
  1015. end if
  1016. Exit Sub
  1017. else
  1018. if BallVel < SoundVel then 'Sound is active and ball velocity drops below the threshold --> stop any sound active
  1019. StopAllSounds 'sound stopped so a new sound can be started
  1020. end if
  1021. end if
  1022. End Sub
  1023.  
  1024. Sub LeaveTubeVUK_Hit
  1025. StopAllSounds
  1026. WireRamp = True
  1027. OnRamp = True
  1028. Set SoundBall = Activeball 'Ball-assignment
  1029. SoundTimer.enabled = True
  1030. Playsound "WireRamp1",0,1,0,0.2
  1031. End Sub
  1032.  
  1033. Sub RampEnter_Hit
  1034. StopAllSounds
  1035. WireRamp = True
  1036. OnRamp = True
  1037. End Sub
  1038.  
  1039. Sub LeaveCenterHole_Hit
  1040. StopAllSounds
  1041. Set SoundBall = Activeball 'Ball-assignment
  1042. SoundTimer.enabled = True
  1043. End Sub
  1044.  
  1045. Sub RampEnd_Hit
  1046. StopAllSounds
  1047. End Sub
  1048.  
  1049. Sub RampEnd2_Hit
  1050. StopAllSounds
  1051. End Sub
  1052.  
  1053. Sub StopAllSounds()
  1054. WireRamp = False
  1055. OnRamp = False
  1056. SoundActive = 0
  1057. StopSound "roll1"
  1058. StopSound "WireRamp1"
  1059. StopSound "Ballroll3"
  1060. StopSound "Ballroll2"
  1061. End Sub
  1062.  
  1063. Sub ShooterLaneLaunch_Hit
  1064. if ActiveBall.vely < -6 then playsound SoundFX("Launch",DOFContactors),0,1,0.25,0.25
  1065. Set SoundBall = Activeball 'Ball-assignment
  1066. SoundTimer.enabled = True
  1067. End Sub
  1068.  
  1069.  
  1070. ' *********************************************************************
  1071. ' Supporting Ball & Sound Functions
  1072. ' *********************************************************************
  1073. Sub Rubber_Walls_hit (idx)
  1074. if soundtimer.enabled then
  1075. playsound "bump",0,Vol(SoundBall),Pan(SoundBall),0.25
  1076. end if
  1077. End Sub
  1078.  
  1079. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1080. Vol = Csng(BallVel ^2 / 500)
  1081. if Vol > 1 then
  1082. Vol = 1
  1083. end if
  1084. if Vol < 0.2 then
  1085. Vol = 0.2
  1086. end if
  1087. End Function
  1088.  
  1089. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "JunkYard" is the name of the table
  1090. Dim tmp
  1091. tmp = (ball.x * 2 / Quijote.width)-1
  1092. If tmp> 0 Then
  1093. Pan = Csng(tmp ^10)
  1094. Else
  1095. Pan = Csng(-((- tmp) ^10) )
  1096. End If
  1097. End Function
Advertisement
Add Comment
Please, Sign In to add comment