Arngrim

Cyclopes

Aug 4th, 2021
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.78 KB | None | 0 0
  1. Option Explicit
  2. Randomize
  3.  
  4. On Error Resume Next
  5. ExecuteGlobal GetTextFile("controller.vbs")
  6. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  7. On Error Goto 0
  8.  
  9. Const cGameName="cyclopes",UseSolenoids=1,UseLamps=0,UseGI=0,UseSync=1,SCoin="coin"
  10.  
  11. Const soundforbell = "bell"
  12.  
  13. LoadVPM "01120100","GamePlan.vbs",3.1
  14.  
  15. Dim DesktopMode: DesktopMode = Table1.ShowDT
  16.  
  17. If DesktopMode = True Then 'Show Desktop components
  18. Ramp001.visible=1
  19. Ramp002.visible=1
  20. Primitive124.visible=1
  21. Else
  22. Ramp001.visible=0
  23. Ramp002.visible=0
  24. Primitive124.visible=0
  25. End if
  26.  
  27. '*************************************************************
  28. 'Solenoid Call backs
  29. '*************************************************************
  30.  
  31. SolCallback(1)="bsLock.SolOut" 'Sol 3
  32. SolCallback(2)="bsSaucer.SolOut" 'Sol 4
  33. SolCallback(3)="vpmSolSound SoundFX(""Knocker"",DOFKnocker)," 'Sol 11
  34. 'SolCallback(3)="vpmSolSound ""bell""," 'Sol 15
  35. 'SolCallback(4)="vpmSolSound ""bumper""," 'Sol 6
  36. 'SolCallback(5)="vpmSolSound ""bumper""," 'Sol 7
  37. 'SolCallback(6)="vpmSolSound ""bumper""," 'Sol 9
  38. 'SolCallback(7)="vpmSolSound ""sling""," 'Sol 10
  39. SolCallback(8)="dtL.SolDropUp" 'Sol 8
  40. SolCallback(9)="dtR.SolDropUp" 'Sol 5
  41. SolCallback(10)="bsTrough.SolOut" 'Sol 1
  42. SolCallback(11)="SetLamp 142," 'Left Drop Bank Flashers Sol 12
  43. SolCallback(12)="SetLamp 143," 'Right Drop Bank Flashers Sol 13
  44. SolCallback(13)="SetLamp 144,"'other flasher Sol 14
  45. SolCallback(15)="bsTrough.SolIn" 'Sol 2
  46. 'SolCallback(16)="vpmNudge.SolGameOn" 'Sol 16
  47. SolCallback(31)="bellsound" 'for startup bell sound (just a workaround)
  48.  
  49.  
  50. SolCallback(sLRFlipper) = "SolRFlipper"
  51. SolCallback(sLLFlipper) = "SolLFlipper"
  52.  
  53. Sub SolLFlipper(Enabled)
  54. If Enabled Then
  55. PlaySound SoundFX("Flipperup",DOFFlippers):LeftFlipper.RotateToEnd:ULeftFlipper.RotateToEnd
  56. Else
  57. PlaySound SoundFX("Flipperdown",DOFFlippers):LeftFlipper.RotateToStart:ULeftFlipper.RotateToStart
  58. End If
  59. End Sub
  60.  
  61. Sub SolRFlipper(Enabled)
  62. If Enabled Then
  63. PlaySound SoundFX("Flipperup",DOFFlippers):RightFlipper.RotateToEnd
  64. Else
  65. PlaySound SoundFX("Flipperdown",DOFFlippers):RightFlipper.RotateToStart
  66. End If
  67. End Sub
  68.  
  69. '**********************************************************************************************************
  70.  
  71. 'Solenoid Controlled toys
  72. '**********************************************************************************************************
  73.  
  74. '*****GI Lights On
  75. dim xx
  76. For each xx in GI:xx.State = 1: Next
  77.  
  78. '**********************************************************************************************************
  79. 'Initiate Table
  80. '**********************************************************************************************************
  81.  
  82. Dim bsTrough,bsSaucer,dtR,dtL,bsLock,PlungerIm, locktimer
  83.  
  84. Sub Table1_Init
  85. vpmInit Me
  86. On Error Resume Next
  87. With Controller
  88. .GameName = cGameName
  89. If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description : Exit Sub
  90. .SplashInfoLine = ""&chr(13)&"You Suck"
  91. .HandleMechanics=0
  92. .HandleKeyboard=0
  93. .ShowDMDOnly=1
  94. .ShowFrame=0
  95. .ShowTitle=0
  96. .hidden = 1
  97. .Games(cGameName).Settings.Value("sound")=1
  98. '.PuPHide = 1
  99. On Error Resume Next
  100. .Run GetPlayerHWnd
  101. If Err Then MsgBox Err.Description
  102. On Error Goto 0
  103. End With
  104. On Error Goto 0
  105.  
  106. PinMAMETimer.Interval=PinMAMEInterval
  107. PinMAMETimer.Enabled=1
  108.  
  109.  
  110. vpmNudge.TiltSwitch=swTilt
  111. vpmNudge.Sensitivity=7.5
  112. vpmNudge.TiltObj=Array(Bumper1,Bumper2,Bumper3,RightSlingshot)
  113.  
  114.  
  115. captivekick.Enabled=0
  116.  
  117. Set bsTrough=New cvpmBallStack
  118. bsTrough.InitSw 11,10,0,0,0,0,0,0
  119. bsTrough.InitKick BallRelease,90,4
  120. bsTrough.InitExitSnd SoundFX("ballrelease",DOFContactors), SoundFX("Solenoid",DOFContactors)
  121. bsTrough.Balls=1
  122. bsTrough.AddBall 0 'add ball to trough entry switch
  123.  
  124. Set bsSaucer=New cvpmBallStack
  125. bsSaucer.InitSaucer TopHole,29,194,12
  126. bsSaucer.InitExitSnd SoundFX("popper",DOFContactors),SoundFX("solon",DOFContactors)
  127. bsSaucer.KickAngleVar=10
  128. bsSaucer.KickForceVar = 5
  129.  
  130. Set bsLock=New cvpmBallStack
  131. bsLock.InitSaucer BallLock,9,273,9
  132. ' bsLock.KickAngleVar=1
  133. bsLock.InitExitSnd SoundFX("popper",DOFContactors),SoundFX("solon",DOFContactors)
  134.  
  135. 'Set dtL = New cvpmDropTarget
  136. 'dtL.InitDrop Array(DropL1,DropL2,DropL3,DropL4),Array(17,18,19,20)
  137. 'dtL.InitSnd SoundFX("droptarget",DOFContactors),SoundFX("bankreset",DOFContactors)
  138. 'dtL.CreateEvents "dtL"
  139.  
  140. Set dtL = New cvpmDropTarget
  141. dtL.InitDrop Array(Array(DropL1),Array(DropL2),Array(DropL3),Array(DropL4)),Array(17,18,19,20)
  142. dtL.InitSnd SoundFX("droptarget",DOFDropTargets),SoundFX("bankreset",DOFContactors)
  143. dtL.CreateEvents "dtL"
  144.  
  145. Set dtR = New cvpmDropTarget
  146. dtR.InitDrop Array(Array(DropR1),Array(DropR2),Array(DropR3),Array(DropR4)),Array(21,22,23,24)
  147. dtR.InitSnd SoundFX("droptarget",DOFDropTargets),SoundFX("bankreset",DOFContactors)
  148. dtR.CreateEvents "dtR"
  149.  
  150. 'Set dtR = New cvpmDropTarget
  151. 'dtR.InitDrop Array(DropR1,DropR2,DropR3,DropR4),Array(21,22,23,24)
  152. 'dtR.InitSnd SoundFX("droptarget",DOFContactors),SoundFX("bankreset",DOFContactors)
  153. 'dtR.CreateEvents "dtR"
  154.  
  155.  
  156. End Sub
  157.  
  158. 'Captive Ball Init
  159. captivekick.CreateBall:captivekick.Kick 180, 2
  160.  
  161.  
  162.  
  163. '**********************************************************************************************************
  164. 'Plunger code
  165. '**********************************************************************************************************
  166.  
  167. Sub Table1_KeyDown(ByVal KeyCode)
  168. If keycode = LeftMagnaSave Then bLutActive = True
  169. If keycode = RightMagnaSave Then
  170. If bLutActive Then NextLUT: End If
  171. End If
  172. If keycode = PlungerKey Then Plunger.Pullback:playsound"plungerpull"
  173. If KeyDownHandler(keycode) Then Exit Sub
  174. End Sub
  175.  
  176. Sub Table1_KeyUp(ByVal KeyCode)
  177. If keycode = LeftMagnaSave Then bLutActive = False
  178. If keycode = PlungerKey Then Plunger.Fire:PlaySound"plunger"
  179. If KeyUpHandler(keycode) Then Exit Sub
  180. End Sub
  181.  
  182. '**********************************************************************************************************
  183. 'Switches
  184. '**********************************************************************************************************
  185.  
  186.  
  187. Sub bellsound(enabled)
  188. If ballinlock = 1 and locktimer=1 then playsound "longerbellsound"
  189. If ballinlock = 1 and locktimer=0 then playsound "bell"
  190. If ballinlock = 0 and locktimer=0 then playsound "bell"
  191. End Sub
  192.  
  193.  
  194. Dim ballinlock
  195. Sub BallLock_Hit:ballinlock=1:vpmTimer.AddTimer 400, "bsLock.AddBall":End Sub
  196. Sub BallLock_unHit:ballinlock=0:End Sub
  197. Sub Drain_Hit:bsTrough.AddBall Me:playsound "Drain" :End Sub 'Switch 10
  198.  
  199. Sub TopHole_Hit:bsSaucer.AddBall 0:playsound "popper_ball" :End Sub 'Switch 29
  200.  
  201. '*** Wire Triggers
  202.  
  203. Sub LeftOutlane_Hit:Controller.Switch(25)=1:PlaySound "rollover":DOF 101, DOFOn:End Sub
  204. Sub LeftOutlane_unHit:Controller.Switch(25)=0:DOF 101, DOFOff:End Sub
  205.  
  206. Sub RightOutlane_Hit:Controller.Switch(25)=1:PlaySound "rollover":DOF 102, DOFOn:End Sub
  207. Sub RightOutlane_unHit:Controller.Switch(25)=0:DOF 102, DOFOff:End Sub
  208.  
  209. Sub TopLane1_Hit:Controller.Switch(27)=1:PlaySound "rollover":DOF 104, DOFOn:End Sub 'Switch 27
  210. Sub TopLane1_unHit:Controller.Switch(27)=0:DOF 104, DOFOn:End Sub
  211.  
  212. Sub RightInlane_Hit:Controller.Switch(27)=1:PlaySound "rollover":DOF 105, DOFOn:End Sub
  213. Sub RightInlane_unHit:Controller.Switch(27)=0:DOF 105, DOFOff:End Sub
  214.  
  215. Sub TopLane2_Hit:Controller.Switch(28)=1:PlaySound "rollover":End Sub 'Switch 28
  216. Sub TopLane2_unHit:Controller.Switch(28)=0:End Sub
  217.  
  218. '*** Stand Up Targets
  219.  
  220. Sub sw4_Hit:vpmTimer.PulseSw 4:PlaySound SoundFX("Tink",DOFTargets):End Sub
  221. Sub sw25_Hit:vpmTimer.PulseSw 25:PlaySound SoundFXDOF("Tink",103,DOFPulse,DOFTargets):End Sub
  222. Sub sw30_Hit:vpmTimer.PulseSw 30:PlaySound SoundFX("Tink",DOFTargets):End Sub
  223. Sub sw31_Hit:vpmTimer.PulseSw 31:PlaySound SoundFX("Tink",DOFTargets):End Sub
  224. Sub sw33_Hit:vpmTimer.PulseSw 33:PlaySound SoundFX("Tink",DOFTargets):End Sub
  225. Sub sw34_Hit:vpmTimer.PulseSw 34:PlaySound SoundFX("Tink",DOFTargets):End Sub
  226. Sub sw35_Hit:vpmTimer.PulseSw 35:PlaySound SoundFX("Tink",DOFTargets):End Sub
  227. Sub sw36_Hit:vpmTimer.PulseSw 36:PlaySound SoundFX("Tink",DOFTargets):End Sub
  228. Sub sw37_Hit:vpmTimer.PulseSw 37:PlaySound SoundFX("Tink",DOFTargets):End Sub
  229. Sub sw38_Hit:vpmTimer.PulseSw 38:PlaySound SoundFX("Tink",DOFTargets):End Sub
  230. Sub sw39_Hit:vpmTimer.PulseSw 39:PlaySound SoundFX("Tink",DOFTargets):End Sub
  231. Sub sw40_Hit:vpmTimer.PulseSw 40:PlaySound SoundFX("Tink",DOFTargets):End Sub
  232.  
  233. '*** Spinners
  234.  
  235. Sub sw16_Spin:vpmTimer.PulseSw 16:PlaySound "spinner":End Sub
  236. Sub sw32_Spin:vpmTimer.PulseSw 32:PlaySound "spinner":End Sub 'Switch 32
  237.  
  238. '*** Gates
  239.  
  240. Sub Gate2_hit():playsound "gate":end sub
  241. Sub Gate3_hit():playsound "gate":end sub
  242. Sub Gate4_hit():playsound "gate":end sub
  243.  
  244. '------------------------------
  245. '------ Bumpers ------
  246. '------------------------------
  247.  
  248. Sub Bumper1_Hit:vpmTimer.PulseSw 12 : PlayBumperSound : End Sub
  249. Sub Bumper2_Hit:vpmTimer.PulseSw 13 : PlayBumperSound : End Sub
  250. Sub Bumper3_Hit:vpmTimer.PulseSw 14 : PlayBumperSound : End Sub
  251.  
  252. Sub PlayBumperSound()
  253. Select Case Int(Rnd*3)+1
  254. Case 1 : PlaySound SoundFX("fx_bumper1",DOFContactors)
  255. Case 2 : PlaySound SoundFX("fx_bumper2",DOFContactors)
  256. Case 3 : PlaySound SoundFX("fx_bumper3",DOFContactors)
  257. End Select
  258. End Sub
  259.  
  260. '**********Sling Shot Animations
  261. ' Rstep and Lstep are the variables that increment the animation
  262. '****************
  263. Dim RStep
  264.  
  265. Sub RightSlingShot_Slingshot
  266. vpmTimer.PulseSw 15
  267. PlaySound SoundFX("sling",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
  268. RSling.Visible = 0
  269. RSling1.Visible = 1
  270. sling1.rotx = 20
  271. RStep = 0
  272. RightSlingShot.TimerEnabled = 1
  273. End Sub
  274.  
  275. Sub RightSlingShot_Timer
  276. Select Case RStep
  277. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
  278. Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0:
  279. End Select
  280. RStep = RStep + 1
  281. End Sub
  282.  
  283. Dim Digits(60)
  284. Digits(0)=Array(L1,L2,L3,L4,L5,L6,L7)
  285. Digits(1)=Array(L8,L9,L10,L11,L12,L13,L14)
  286. Digits(2)=Array(L15,L16,L17,L18,L19,L20,L21)
  287. Digits(3)=Array(L22,L23,L24,L25,L26,L27,L28)
  288. Digits(4)=Array(L29,L30,L31,L32,L33,L34,L35)
  289. Digits(5)=Array(L36,L37,L38,L39,L40,L41,L42)
  290. Digits(6)=Array(L43,L44,L45,L46,L47,L48,L49)
  291. Digits(7)=Array(L50,L51,L52,L53,L54,L55,L56)
  292. Digits(8)=Array(L57,L58,L59,L60,L61,L62,L63)
  293. Digits(9)=Array(L64,L65,L66,L67,L68,L69,L70)
  294. Digits(10)=Array(L71,L72,L73,L74,L75,L76,L77)
  295. Digits(11)=Array(L78,L79,L80,L81,L82,L83,L84)
  296. Digits(12)=Array(L85,L86,L87,L88,L89,L90,L91)
  297. Digits(13)=Array(L92,L93,L94,L95,L96,L97,L98)
  298. Digits(14)=Array(L99,L100,L101,L102,L103,L104,L105)
  299. Digits(15)=Array(L106,L107,L108,L109,L110,L111,L112)
  300. Digits(16)=Array(L113,L114,L115,L116,L117,L118,L119)
  301. Digits(17)=Array(L120,L121,L122,L123,L124,L125,L126)
  302. Digits(18)=Array(L127,L128,L129,L130,L131,L132,L133)
  303. Digits(19)=Array(L134,L135,L136,L137,L138,L139,L140)
  304. Digits(20)=Array(L141,L001,L002,L144,L145,L146,L147)
  305. Digits(21)=Array(L148,L149,L150,L151,L152,L153,L154)
  306. Digits(22)=Array(L155,L156,L157,L158,L159,L160,L161)
  307. Digits(23)=Array(L162,L163,L164,L165,L166,L167,L168)
  308. Digits(24)=Array(L169,L170,L171,L172,L173,L174,L175)
  309. Digits(25)=Array(L176,L177,L178,L179,L180,L181,L182)
  310. Digits(26)=Array(L183,L184,L185,L186,L187,L188,L189)
  311. Digits(27)=Array(L190,L191,L192,L193,L194,L195,L196)
  312. Digits(28)=Array(L197,L198,L199,L200,L201,L202,L203)
  313. Digits(29)=Array(L204,L205,L206,L207,L208,L209,L210)
  314. Digits(30)=Array(L211,L212,L213,L214,L215,L216,L217)
  315. Digits(31)=Array(L218,L219,L220,L221,L222,L223,L224)
  316.  
  317. Sub DisplayTimer_Timer
  318. Dim ChgLED,ii,num,chg,stat,obj
  319. ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
  320. If Not IsEmpty(ChgLED) Then
  321. If DesktopMode = True Then
  322. For ii = 0 To UBound(chgLED)
  323. num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
  324. if (num < 60) then
  325. For Each obj In Digits(num)
  326. If chg And 1 Then obj.State = stat And 1
  327. chg = chg\2 : stat = stat\2
  328. Next
  329. else
  330.  
  331. end if
  332. next
  333. end if
  334. end if
  335. End Sub
  336.  
  337. '***************************************************
  338. ' JP's VP10 Fading Lamps & Flashers
  339. ' Based on PD's Fading Light System
  340. ' SetLamp 0 is Off
  341. ' SetLamp 1 is On
  342. ' fading for non opacity objects is 4 steps
  343. '***************************************************
  344.  
  345. Dim LampState(200), FadingLevel(200)
  346. Dim FlashSpeedUp(200), FlashSpeedDown(200), FlashMin(200), FlashMax(200), FlashLevel(200)
  347.  
  348. InitLamps() ' turn off the lights and flashers and reset them to the default parameters
  349. LampTimer.Interval = 5 'lamp fading speed
  350. LampTimer.Enabled = 1
  351.  
  352. ' Lamp & Flasher Timers
  353.  
  354. Sub LampTimer_Timer()
  355. Dim chgLamp, num, chg, ii
  356. chgLamp = Controller.ChangedLamps
  357. If Not IsEmpty(chgLamp) Then
  358. For ii = 0 To UBound(chgLamp)
  359. LampState(chgLamp(ii, 0) ) = chgLamp(ii, 1) 'keep the real state in an array
  360. FadingLevel(chgLamp(ii, 0) ) = chgLamp(ii, 1) + 4 'actual fading step
  361. Next
  362. End If
  363. UpdateLamps
  364. End Sub
  365.  
  366. Sub UpdateLamps()
  367.  
  368. NFadeL 1, Light1 'Unused ?
  369. NFadeL 2, Light2
  370. NFadeL 3, Light3
  371. NFadeL 4, Light4
  372. NFadeL 5, Light5
  373. NFadeL 6, Light6
  374. NFadeL 7, Light7
  375. NFadeL 8, Light8
  376. NFadeL 9, Light9
  377. NFadeL 10, Light10
  378.  
  379. NFadeL 11, Light11
  380. NFadeL 12, Light12
  381. NFadeL 13, Light13
  382. NFadeL 14, Light14
  383. NFadeL 15, Light15
  384. NFadeL 16, Light16
  385. NFadeL 17, Light17 'Bumper 3
  386. NFadeL 18, Light18 'Bumper 2
  387. NFadeL 19, Light19 'Bumper 1
  388.  
  389. NFadeL 20, Light20
  390. NFadeL 21, Light21
  391. NFadeL 22, Light22
  392. NFadeL 23, Light23
  393. NFadeL 24, Light24
  394. NFadeL 25, Light25
  395. NFadeL 26, Light26
  396. NFadeL 27, Light27
  397. NFadeL 28, Light28
  398. NFadeL 29, Light29
  399.  
  400. NFadeL 30, Light30
  401. NFadeL 31, Light31
  402. NFadeL 32, Light32
  403. NFadeL 33, Light33
  404. NFadeL 34, Light34
  405. NFadeL 35, Light35
  406. NFadeL 36, Light36
  407. NFadeL 37, Light37
  408. ' NFadeL 38, Light38 'MATCH
  409. NFadeL 39, Light39
  410.  
  411. ' NFadeL 40, Light40 'TILT
  412. ' NFadeL 41, Light41 'HIGHSCORE
  413. NFadeL 42, Light42
  414. NFadeLm 43, Light43A
  415. NFadeL 43, Light43B
  416. ' NFadeL 44, Light44 'GAME OVER
  417. NFadeLm 45, Light45A 'Also BALL IN PLAY
  418. NFadeL 45, Light45B
  419. NFadeL 46, Light46
  420. NFadeL 47, Light47
  421. NFadeL 48, Light48
  422. NFadeLm 49, Light49
  423. NFadeL 49, Light49B
  424.  
  425. NFadeL 50, Light50
  426. NFadeL 51, Light51
  427. NFadeL 52, Light52
  428. NFadeL 53, Light53
  429. NFadeL 54, Light54
  430. NFadeL 55, Light55
  431. NFadeL 56, Light56
  432. NFadeL 57, Light57
  433. NFadeL 58, Light58
  434. NFadeL 59, Light59
  435.  
  436. NFadeL 60, Light60
  437. NFadeL 61, Light61
  438. NFadeL 62, Light62
  439. NFadeL 63, Light63
  440. NFadeL 64, Light64
  441.  
  442.  
  443. 'Solenid Controlled Lamps
  444.  
  445.  
  446. NFadeL 142, L142
  447. NFadeL 143, L143
  448. NFadeLm 144, L144A
  449. NFadeL 144, L144B
  450.  
  451.  
  452. End Sub
  453.  
  454. ' div lamp subs
  455.  
  456. Sub InitLamps()
  457. Dim x
  458. For x = 0 to 200
  459. LampState(x) = 0 ' current light state, independent of the fading level. 0 is off and 1 is on
  460. FadingLevel(x) = 4 ' used to track the fading state
  461. FlashSpeedUp(x) = 0.4 ' faster speed when turning on the flasher
  462. FlashSpeedDown(x) = 0.2 ' slower speed when turning off the flasher
  463. FlashMax(x) = 1 ' the maximum value when on, usually 1
  464. FlashMin(x) = 0 ' the minimum value when off, usually 0
  465. FlashLevel(x) = 0 ' the intensity of the flashers, usually from 0 to 1
  466. Next
  467. End Sub
  468.  
  469. Sub AllLampsOff
  470. Dim x
  471. For x = 0 to 200
  472. SetLamp x, 0
  473. Next
  474. End Sub
  475.  
  476. Sub SetLamp(nr, value)
  477. If value <> LampState(nr) Then
  478. LampState(nr) = abs(value)
  479. FadingLevel(nr) = abs(value) + 4
  480. End If
  481. End Sub
  482.  
  483. ' Lights: used for VP10 standard lights, the fading is handled by VP itself
  484.  
  485. Sub NFadeL(nr, object)
  486. Select Case FadingLevel(nr)
  487. Case 4:object.state = 0:FadingLevel(nr) = 0
  488. Case 5:object.state = 1:FadingLevel(nr) = 1
  489. End Select
  490. End Sub
  491.  
  492. Sub NFadeLm(nr, object) ' used for multiple lights
  493. Select Case FadingLevel(nr)
  494. Case 4:object.state = 0
  495. Case 5:object.state = 1
  496. End Select
  497. End Sub
  498.  
  499. 'Lights, Ramps & Primitives used as 4 step fading lights
  500. 'a,b,c,d are the images used from on to off
  501.  
  502. Sub FadeObj(nr, object, a, b, c, d)
  503. Select Case FadingLevel(nr)
  504. Case 4:object.image = b:FadingLevel(nr) = 6 'fading to off...
  505. Case 5:object.image = a:FadingLevel(nr) = 1 'ON
  506. Case 6, 7, 8:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  507. Case 9:object.image = c:FadingLevel(nr) = FadingLevel(nr) + 1 'fading...
  508. Case 10, 11, 12:FadingLevel(nr) = FadingLevel(nr) + 1 'wait
  509. Case 13:object.image = d:FadingLevel(nr) = 0 'Off
  510. End Select
  511. End Sub
  512.  
  513. Sub FadeObjm(nr, object, a, b, c, d)
  514. Select Case FadingLevel(nr)
  515. Case 4:object.image = b
  516. Case 5:object.image = a
  517. Case 9:object.image = c
  518. Case 13:object.image = d
  519. End Select
  520. End Sub
  521.  
  522. Sub NFadeObj(nr, object, a, b)
  523. Select Case FadingLevel(nr)
  524. Case 4:object.image = b:FadingLevel(nr) = 0 'off
  525. Case 5:object.image = a:FadingLevel(nr) = 1 'on
  526. End Select
  527. End Sub
  528.  
  529. Sub NFadeObjm(nr, object, a, b)
  530. Select Case FadingLevel(nr)
  531. Case 4:object.image = b
  532. Case 5:object.image = a
  533. End Select
  534. End Sub
  535.  
  536. ' Flasher objects
  537.  
  538. Sub Flash(nr, object)
  539. Select Case FadingLevel(nr)
  540. Case 4 'off
  541. FlashLevel(nr) = FlashLevel(nr) - FlashSpeedDown(nr)
  542. If FlashLevel(nr) < FlashMin(nr) Then
  543. FlashLevel(nr) = FlashMin(nr)
  544. FadingLevel(nr) = 0 'completely off
  545. End if
  546. Object.IntensityScale = FlashLevel(nr)
  547. Case 5 ' on
  548. FlashLevel(nr) = FlashLevel(nr) + FlashSpeedUp(nr)
  549. If FlashLevel(nr) > FlashMax(nr) Then
  550. FlashLevel(nr) = FlashMax(nr)
  551. FadingLevel(nr) = 1 'completely on
  552. End if
  553. Object.IntensityScale = FlashLevel(nr)
  554. End Select
  555. End Sub
  556.  
  557. Sub Flashm(nr, object) 'multiple flashers, it just sets the flashlevel
  558. Object.IntensityScale = FlashLevel(nr)
  559. End Sub
  560.  
  561.  
  562.  
  563. 'Gameplan Cyclopes
  564. 'added by Inkochnito
  565. Sub editDips
  566. Dim vpmDips:Set vpmDips=New cvpmDips
  567. With vpmDips
  568. .AddForm 700,400,"Cyclopes - DIP switches"
  569. .AddFrame 2,0,190,"Credits per coin",&H0000001F,Array("1 credit - 2 coins",&H000000031,"1 credit - 1 coin",&H00000002,"2 credits - 1 coin",&H00000004,"5 credits - 1 coin",&H0000000A)'dip 1-5
  570. .AddFrame 2,75,190,"Maximum credits",&H06000000,Array("10 credits",0,"20 credits",&H02000000,"30 credits",&H04000000,"40 credits",&H06000000)'dip 26&27
  571. .AddFrame 2,150,190,"High game to date award",&HC0000000,Array("no award",0,"1 credit",&H40000000,"2 credits",&H80000000,"3 credits",&HC0000000)'dip 31&32
  572. .AddFrame 2,225,190,"Balls per game",&H00C00000,Array("1 ball",0,"2 balls",&H00400000,"3 balls",&H00800000,"5 balls",&H00C00000)'dip 23+24
  573. .AddFrame 2,300,190,"Replay or free ball award",&H18000000,Array("no award",0,"50,000 points",&H08000000,"extra ball",&H10000000,"replay",&H18000000)'dip 28+29
  574. .AddFrame 210,0,190,"Tilt warning option",&H01000000,Array("no warnings",0,"2 warnings before tilt",&H01000000)'dip 25
  575. .AddFrame 210,47,190,"Eyes target value",&H00000020,Array("starts at 10K",0,"starts at 25K",&H00000020)'dip 6
  576. .AddFrame 210,94,190,"Spinner values memory",&H00000040,Array("will be reset",0,"will be kept in memory",&H00000040)'dip 7
  577. .AddFrame 210,141,190,"Regular bonus option",&H00004000,Array("reset bonus after collected",0,"restore bonus after collected",&H00004000)'dip 15
  578. .AddFrame 210,188,190,"Lock will light when",32768,Array("2 target banks are completed",0,"1 target bank is completed",32768)'dip 16
  579. .AddFrame 210,235,190,"Eyes extra ball flashes",&H00200000,Array("at 100K",0,"at 75K",&H00200000)'dip 22
  580. .AddChk 210,285,150,Array("Attract mode",&H00001000)'dip 13
  581. .AddChk 210,305,150,Array("Enable extra ball",&H00002000)'dip 14
  582. .AddChk 210,325,150,Array("Match feature",&H20000000)'dip 30
  583. .AddChk 210,345,150,Array("Free play",&H00000080)'dip 8
  584. .AddLabel 30,380,300,20,"After hitting OK, press F3 to reset game with new settings."
  585. .ViewDips
  586. End With
  587. End Sub
  588. Set vpmShowDips=GetRef("editDips")
  589.  
  590. '*************
  591. ' JP'S LUT
  592. '*************
  593.  
  594. Dim bLutActive, LUTImage
  595. Sub LoadLUT
  596. Dim x
  597. x = LoadValue(cGameName, "LUTImage")
  598. If(x <> "") Then LUTImage = x Else LUTImage = 0
  599. UpdateLUT
  600. End Sub
  601.  
  602. Sub SaveLUT
  603. SaveValue cGameName, "LUTImage", LUTImage
  604. End Sub
  605.  
  606. Sub NextLUT: LUTImage = (LUTImage +1 ) MOD 10: UpdateLUT: SaveLUT: End Sub
  607.  
  608. Sub UpdateLUT
  609. Select Case LutImage
  610. Case 0: table1.ColorGradeImage = "LUT0"
  611. Case 1: table1.ColorGradeImage = "LUT1"
  612. Case 2: table1.ColorGradeImage = "LUT2"
  613. Case 3: table1.ColorGradeImage = "LUT3"
  614. Case 4: table1.ColorGradeImage = "LUT4"
  615. Case 5: table1.ColorGradeImage = "LUT5"
  616. Case 6: table1.ColorGradeImage = "LUT6"
  617. Case 7: table1.ColorGradeImage = "LUT7"
  618. Case 8: table1.ColorGradeImage = "LUT8"
  619. Case 9: table1.ColorGradeImage = "LUT9"
  620.  
  621. End Select
  622. End Sub
  623.  
  624.  
  625. '*********************************************************************
  626. ' Positional Sound Playback Functions
  627. '*********************************************************************
  628.  
  629. ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
  630. ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
  631. ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
  632. Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
  633. PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
  634. End Sub
  635.  
  636. ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
  637. Sub PlaySoundAt(soundname, tableobj)
  638. PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
  639. End Sub
  640.  
  641. Sub PlaySoundAtBall(soundname)
  642. PlaySoundAt soundname, ActiveBall
  643. End Sub
  644.  
  645.  
  646. '*********************************************************************
  647. ' Supporting Ball & Sound Functions
  648. '*********************************************************************
  649.  
  650. Function AudioFade(tableobj) ' Fades between front and back of the table (for surround systems or 2x2 speakers, etc), depending on the Y position on the table. "table1" is the name of the table
  651. Dim tmp
  652. tmp = tableobj.y * 2 / table1.height-1
  653. If tmp > 0 Then
  654. AudioFade = Csng(tmp ^10)
  655. Else
  656. AudioFade = Csng(-((- tmp) ^10) )
  657. End If
  658. End Function
  659.  
  660. Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
  661. Dim tmp
  662. tmp = tableobj.x * 2 / table1.width-1
  663. If tmp > 0 Then
  664. AudioPan = Csng(tmp ^10)
  665. Else
  666. AudioPan = Csng(-((- tmp) ^10) )
  667. End If
  668. End Function
  669.  
  670. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  671. Vol = Csng(BallVel(ball) ^2 / 2000)
  672. End Function
  673.  
  674. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  675. Pitch = BallVel(ball) * 20
  676. End Function
  677.  
  678. Function BallVel(ball) 'Calculates the ball speed
  679. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  680. End Function
  681.  
  682.  
  683. '********************************************************************
  684. ' JP's VP10 Rolling Sounds (+rothbauerw's Dropping Sounds)
  685. '********************************************************************
  686.  
  687. Const tnob = 5 ' total number of balls
  688. ReDim rolling(tnob)
  689. InitRolling
  690.  
  691. Sub InitRolling
  692. Dim i
  693. For i = 0 to tnob
  694. rolling(i) = False
  695. Next
  696. End Sub
  697.  
  698. Sub RollingTimer_Timer()
  699. Dim BOT, b
  700. BOT = GetBalls
  701.  
  702. ' stop the sound of deleted balls
  703. For b = UBound(BOT) + 1 to tnob
  704. rolling(b) = False
  705. StopSound "fx_ballrolling" & b
  706. StopSound "fx_plasticrolling" & b
  707. StopSound "fx_metalrolling" & b
  708. Next
  709.  
  710. ' exit the sub if no balls on the table
  711. If UBound(BOT) = -1 Then Exit Sub
  712.  
  713. ' play the rolling sound for each ball
  714. For b = 0 to UBound(BOT)
  715. If BallVel(BOT(b) ) > 1 Then
  716. rolling(b) = True
  717. If BOT(b).Z > 30 Then
  718. ' ball on plastic ramp
  719. StopSound "fx_ballrolling" & b
  720. StopSound "fx_metalrolling" & b
  721. PlaySound "fx_plasticrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  722. Else
  723. ' ball on playfield
  724. StopSound "fx_plasticrolling" & b
  725. StopSound "fx_metalrolling" & b
  726. PlaySound "fx_ballrolling" & b, -1, Vol(BOT(b)) / 2, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  727. End If
  728. Else
  729. If rolling(b) Then
  730. StopSound "fx_ballrolling" & b
  731. StopSound "fx_plasticrolling" & b
  732. StopSound "fx_metalrolling" & b
  733. rolling(b) = False
  734. End If
  735. End If
  736.  
  737. ' ball drop sounds matching the adjusted height params but not the way down the ramps
  738. If BOT(b).VelZ < -1 And BOT(b).Z < 55 And BOT(b).Z > 27 then 'And Not InRect(BOT(b).X, BOT(b).Y, 610,320, 740,320, 740,550, 610,550) And Not InRect(BOT(b).X, BOT(b).Y, 180,400, 230,400, 230, 550, 180,550) Then
  739. PlaySound "fx_ball_drop" & Int(Rnd()*3), 0, ABS(BOT(b).VelZ)/17*5, AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
  740. End If
  741.  
  742. Next
  743. End Sub
  744.  
  745. '**********************
  746. ' Ball Collision Sound
  747. '**********************
  748.  
  749. Sub OnBallBallCollision(ball1, ball2, velocity)
  750. PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
  751. End Sub
  752.  
  753. '*****************************************
  754. ' ninuzzu's FLIPPER SHADOWS
  755. '*****************************************
  756.  
  757. sub FlipperTimer_Timer()
  758. FlipperLSh.RotZ = LeftFlipper.currentangle
  759. FlipperRSh.RotZ = RightFlipper.currentangle
  760.  
  761.  
  762. End Sub
  763.  
  764. '*****************************************
  765. ' ninuzzu's BALL SHADOW
  766. '*****************************************
  767. Dim BallShadow
  768. BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
  769.  
  770. Sub BallShadowUpdate_timer()
  771. Dim BOT, b
  772. BOT = GetBalls
  773. ' hide shadow of deleted balls
  774. If UBound(BOT)<(tnob-1) Then
  775. For b = (UBound(BOT) + 1) to (tnob-1)
  776. BallShadow(b).visible = 0
  777. Next
  778. End If
  779. ' exit the Sub if no balls on the table
  780. If UBound(BOT) = -1 Then Exit Sub
  781. ' render the shadow for each ball
  782. For b = 0 to UBound(BOT)
  783. If BOT(b).X < Table1.Width/2 Then
  784. BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) + 6
  785. Else
  786. BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/21)) - 6
  787. End If
  788. ballShadow(b).Y = BOT(b).Y + 4
  789. If BOT(b).Z > 20 Then
  790. BallShadow(b).visible = 1
  791. Else
  792. BallShadow(b).visible = 0
  793. End If
  794. Next
  795. End Sub
  796.  
  797. '************************************
  798. ' What you need to add to your table
  799. '************************************
  800.  
  801. ' a timer called RollingTimer. With a fast interval, like 10
  802. ' one collision sound, in this script is called fx_collide
  803. ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
  804. ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
  805.  
  806.  
  807. '******************************************
  808. ' Explanation of the rolling sound routine
  809. '******************************************
  810.  
  811. ' sounds are played based on the ball speed and position
  812.  
  813. ' the routine checks first for deleted balls and stops the rolling sound.
  814.  
  815. ' The For loop goes through all the balls on the table and checks for the ball speed and
  816. ' if the ball is on the table (height lower than 30) then then it plays the sound
  817. ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
  818.  
  819. ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
  820. ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
  821. ' according to the position of the ball on the table.
  822.  
  823.  
  824. '**************************************
  825. ' Explanation of the collision routine
  826. '**************************************
  827.  
  828. ' The collision is built in VP.
  829. ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
  830. ' 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
  831. ' depending of the speed of the collision.
  832.  
  833.  
  834. Sub Pins_Hit (idx)
  835. PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  836. End Sub
  837.  
  838. Sub Targets_Hit (idx)
  839. PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
  840. End Sub
  841.  
  842. Sub Metals_Thin_Hit (idx)
  843. PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  844. End Sub
  845.  
  846. Sub Metals_Medium_Hit (idx)
  847. PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  848. End Sub
  849.  
  850. Sub Metals2_Hit (idx)
  851. PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  852. End Sub
  853.  
  854. Sub Gates_Hit (idx)
  855. PlaySound "Gate5", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  856. End Sub
  857.  
  858. Sub Spinner_Spin
  859. PlaySound "fx_spinner", 0, .25, AudioPan(Spinner), 0.25, 0, 0, 1, AudioFade(Spinner)
  860. End Sub
  861.  
  862. Sub Rubbers_Hit(idx)
  863. dim finalspeed
  864. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  865. If finalspeed > 20 then
  866. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  867. End if
  868. If finalspeed >= 6 AND finalspeed <= 20 then
  869. RandomSoundRubber()
  870. End If
  871. End Sub
  872.  
  873. Sub Posts_Hit(idx)
  874. dim finalspeed
  875. finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
  876. If finalspeed > 16 then
  877. PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  878. End if
  879. If finalspeed >= 6 AND finalspeed <= 16 then
  880. RandomSoundRubber()
  881. End If
  882. End Sub
  883.  
  884. Sub RandomSoundRubber()
  885. Select Case Int(Rnd*3)+1
  886. Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  887. Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  888. Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  889. End Select
  890. End Sub
  891.  
  892. Sub LeftFlipper_Collide(parm)
  893. RandomSoundFlipper()
  894. End Sub
  895.  
  896. Sub RightFlipper_Collide(parm)
  897. RandomSoundFlipper()
  898. End Sub
  899.  
  900. Sub RandomSoundFlipper()
  901. Select Case Int(Rnd*3)+1
  902. Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  903. Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  904. Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
  905. End Select
  906. End Sub
  907.  
  908. Sub Table1_Exit()
  909. If B2SOn Then
  910. Controller.Pause = False
  911. Controller.Stop
  912. End If
  913. End Sub
Advertisement
Add Comment
Please, Sign In to add comment