Arngrim

Diner fix

Mar 13th, 2017
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.85 KB | None | 0 0
  1. '*****************************************************************************************
  2. '*****************************************************************************************
  3. '****************************** Diner, Williams 1990 *************************************
  4. '*****************************************************************************************
  5.  
  6. ' Diner by Flupper
  7. ' Based on VP9 version by Tamoore which was based on Pac-Dude's version
  8. ' Playfield redraw by Bodydump
  9. ' Plastics redraws by Ben Logan
  10. ' Several plastics photos from George
  11. ' standup target by Dark
  12. ' many sounds from Knorr's sound package
  13. ' testing by Clark Kent and Ben Logan
  14. ' Shadow ball code by Ninuzzu
  15.  
  16. Option Explicit
  17. Randomize
  18.  
  19. Dim GlowAmountDay, InsertBrightnessDay, GlowAmountCutoutDay, InsertBrightnessCutoutDay
  20. Dim GlowAmountNight, InsertBrightnessNight, GlowAmountCutoutNight, InsertBrightnessCutoutNight
  21. Dim GlowBall, ChooseBall, CustomBulbIntensity(10), red(10), green(10), Blue(10)
  22. Dim CustomBallImage(10), CustomBallLogoMode(10), CustomBallDecal(10), CustomBallGlow(10)
  23. Dim ForceSiderailsFS, ChooseBats, LightsDemo, ShowClock, ContrastSetting, BallShadow
  24. Dim GlobalSoundLevel, AlternateDroptargets
  25.  
  26. '******************************************************************************************
  27. '* TABLE OPTIONS **************************************************************************
  28. '******************************************************************************************
  29.  
  30. ' *** 0=default flipper, 1=primitive flipper, 2=glow green, 3=glow blue, 4=glow orange ****
  31. ChooseBats = 1
  32.  
  33. ' *** Show siderails in fullscreen mode: True = show siderails, False = do not show *******
  34. ForceSiderailsFS = False
  35.  
  36. ' *** Show clock on back wall *************************************************************
  37. ShowClock = False
  38.  
  39. ' *** Contrast level, possible values are 0 - 7, can be done in game with magnasave keys **
  40. ' *** 0: bright, good for desktop view, daytime settings in insert lighting below *********
  41. ' *** 1: same as 0, but with nighttime settings in insert lighting below ******************
  42. ' *** 2: darker, better contrast, daytime settings in insert lighting below ***************
  43. ' *** 3: same as 2, but with nighttime settings in insert lighting below ******************
  44. ' *** etc for 4-7; default is 3 ***********************************************************
  45. ContrastSetting = 3
  46.  
  47. ' *** BallShadow : Ninnuzu's ball shadow addon ********************************************
  48. BallShadow = True
  49.  
  50. ' *** relative sound level for all mechanical sounds **************************************
  51. ' *** 1: if you have separate sound system for mech sounds, 2/3/etc when you do not *******
  52. GlobalSoundLevel = 3
  53.  
  54. ' *** Other decals for the droptargets ****************************************************
  55. AlternateDroptargets = False
  56.  
  57. ' *** Insert Lighting settings ************************************************************
  58. ' *** The settings below together with ContrastSetting determines how the lighting looks **
  59. ' *** for all values: 1.0 = default, useful range 0.1 - 5 *********************************
  60. GlowAmountDay = 0.05
  61. InsertBrightnessDay = 0.8
  62. GlowAmountCutoutDay = 0
  63. InsertBrightnessCutoutDay = 0.6
  64. GlowAmountNight = 0.5
  65. InsertBrightnessNight = 0.6
  66. GlowAmountCutoutNight = 0.25
  67. InsertBrightnessCutoutNight = 0.75
  68.  
  69. ' *** Ball settings ***********************************************************************
  70. ' *** 0 = normal ball
  71. ' *** 1 = white GlowBall
  72. ' *** 2 = magma GlowBall
  73. ' *** 3 = blue GlowBall
  74. ' *** 4 = HDR ball
  75. ' *** 5 = earth
  76. ' *** 6 = green glowball (matching green GlowBat)
  77. ' *** 7 = blue glowball (matching blue GlowBat)
  78. ' *** 8 = orange glowball (matching orange GlowBat)
  79. ' *** 9 = shiny Ball
  80.  
  81. ChooseBall = 4
  82.  
  83. ' default Ball
  84. CustomBallGlow(0) = False
  85. CustomBallImage(0) = "TTMMball"
  86. CustomBallLogoMode(0) = False
  87. CustomBallDecal(0) = "scratches"
  88. CustomBulbIntensity(0) = 0.01
  89. Red(0) = 0 : Green(0) = 0 : Blue(0) = 0
  90.  
  91. ' white GlowBall
  92. CustomBallGlow(1) = True
  93. CustomBallImage(1) = "white"
  94. CustomBallLogoMode(1) = True
  95. CustomBallDecal(1) = ""
  96. CustomBulbIntensity(1) = 0
  97. Red(1) = 255 : Green(1) = 255 : Blue(1) = 255
  98.  
  99. ' Magma GlowBall
  100. CustomBallGlow(2) = True
  101. CustomBallImage(2) = "ballblack"
  102. CustomBallLogoMode(2) = True
  103. CustomBallDecal(2) = "ballmagma"
  104. CustomBulbIntensity(2) = 0
  105. Red(2) = 255 : Green(2) = 180 : Blue(2) = 100
  106.  
  107. ' Blue ball
  108. CustomBallGlow(3) = True
  109. CustomBallImage(3) = "blueball2"
  110. CustomBallLogoMode(3) = False
  111. CustomBallDecal(3) = ""
  112. CustomBulbIntensity(3) = 0
  113. Red(3) = 30 : Green(3) = 40 : Blue(3) = 200
  114.  
  115. ' HDR ball
  116. CustomBallGlow(4) = False
  117. CustomBallImage(4) = "ball_HDR"
  118. CustomBallLogoMode(4) = False
  119. CustomBallDecal(4) = "JPBall-Scratches"
  120. CustomBulbIntensity(4) = 0.01
  121. Red(4) = 0 : Green(4) = 0 : Blue(4) = 0
  122.  
  123. ' Earth
  124. CustomBallGlow(5) = True
  125. CustomBallImage(5) = "ballblack"
  126. CustomBallLogoMode(5) = True
  127. CustomBallDecal(5) = "earth"
  128. CustomBulbIntensity(5) = 0
  129. Red(5) = 100 : Green(5) = 100 : Blue(5) = 100
  130.  
  131. ' green GlowBall
  132. CustomBallGlow(6) = True
  133. CustomBallImage(6) = "glowball green"
  134. CustomBallLogoMode(6) = True
  135. CustomBallDecal(6) = ""
  136. CustomBulbIntensity(6) = 0
  137. Red(6) = 100 : Green(6) = 255 : Blue(6) = 100
  138.  
  139. ' blue GlowBall
  140. CustomBallGlow(7) = True
  141. CustomBallImage(7) = "glowball blue"
  142. CustomBallLogoMode(7) = True
  143. CustomBallDecal(7) = ""
  144. CustomBulbIntensity(7) = 0
  145. Red(7) = 100 : Green(7) = 100 : Blue(7) = 255
  146.  
  147. ' orange GlowBall
  148. CustomBallGlow(8) = True
  149. CustomBallImage(8) = "glowball orange"
  150. CustomBallLogoMode(8) = True
  151. CustomBallDecal(8) = ""
  152. CustomBulbIntensity(8) = 0
  153. Red(8) = 255 : Green(8) = 255 : Blue(8) = 100
  154.  
  155. ' shiny Ball
  156. CustomBallGlow(9) = False
  157. CustomBallImage(9) = "pinball3"
  158. CustomBallLogoMode(9) = False
  159. CustomBallDecal(9) = "JPBall-Scratches"
  160. CustomBulbIntensity(9) = 0.01
  161. Red(9) = 0 : Green(9) = 0 : Blue(9) = 0
  162.  
  163. ' *** Developer switch: Show all lights, no gameplay **************************************
  164. LightsDemo = False
  165.  
  166. '******************************************************************************************
  167. '* END OF TABLE OPTIONS *******************************************************************
  168. '******************************************************************************************
  169.  
  170. ' release notes
  171.  
  172. ' version 1.0 : initial version
  173. '
  174. '
  175.  
  176. ' explanation of standard constants (info by Jpsalas and others on VpForums):
  177. ' These constants are for the vpinmame emulation, and they tell vpinmame what it is supposed
  178. ' to emulate.
  179. ' UseSolenoids=1 means the vpinmame will use the solenoids, so in the script there are calls
  180. ' for a solenoid to do different things (like reset droptargets, kick a ball, etc)
  181. ' UseLamps=0 means the vpinmame won't bother updating the lights, but done in script
  182. ' UseSync=0 (unclear) but probably is to enable or disable the sync in the vpinmame window
  183. ' (or dmd). So it syncs with the screen or not.
  184. ' HandleMech=0 means vpinmame won't handle special animations, they will have to be done
  185. ' manually in Scripts
  186. ' UseGI=1 If 1 and used together with "Set GiCallback2 = GetRef("UpdateGI")" where
  187. ' UpdateGI is the sub routine that sets the Global Illumination lights
  188. ' only the Williams wpc tables have Gi circuitry support (so you can use GICallback)
  189. ' for other tables a solenoid has to be used
  190. ' SFlipperOn - Flipper activate sound
  191. ' SFlipperOff - Flipper deactivate sound
  192. ' SSolenoidOn - Solenoid activate sound
  193. ' SSolenoidOff - Solenoid deactivate sound
  194. ' SCoin - Coin Sound
  195.  
  196. ' *** Global constants ***
  197. Const UseSolenoids = 1
  198. Const UseLamps = 0
  199. Const UseSync = 0
  200. Const HandleMech = 0
  201. Const UseGI=0
  202. Const cGameName="diner_l4"
  203. Const sCoin = "fx_coin"
  204. Const cCredits="Diner, Williams 1990"
  205.  
  206. ' *** Global variables ***
  207. Dim FlippersEnabled ' Used to enable/disable flippers based on tilt status
  208. Dim Leftflash, Rightflash ' Used to detect which flasher is flashing
  209. Dim CupCounter 'Used for influencing speed in the cup
  210. Dim LRAindex, LRA(10) ' angle of lockramp
  211. Dim DVindex, DV(10), DVdir ' angle of diverter
  212. Dim OptionOpacity 'opacity of the option primive
  213. OptionOpacity = 8
  214. Dim relaylevel ' Sound level op relay clicking
  215. relaylevel = 0.5 * GlobalSoundLevel
  216. LRA(0) = -9 : LRA(1) = -6: LRA(2) = -1: LRA(3) = 3: LRA(4) = 5: LRA(5) = 2: LRA(6) = 0
  217. DV(0) = 179 : DV(1) = 180 : DV(2) = 181 : DV(3) = 182 : DV(4) = 184 : DV(5) = 186 : DV(6) = 201
  218. LRAindex = 0 : DVindex = 0 : DVdir = 0
  219.  
  220. ' *** game specific constants ***
  221. Const swOuthole=9,swUpDownRamp=10,swTrough1=11,swTrough2=12,swTrough3=13,swShooterLane=14,swSubPlfdShooter1=15
  222. Const swSubPlfdShooter2=16,swCup=17,swGrillBonus=18,swE=19,swA=20,swT=21,swHotdog=22,swBurger=23,swChili=24
  223. Const swRightRampEntry=27,swRightRampExit=28,swCupEntry=29,swRootBeer=30,swFries=31,swIcedTea=32
  224. Const swLeftRampExit=36,swLeftOutlane=37,swLeftReturnLane=38,swRightReturnLane=39,swRightOutlane=40
  225. Const swUpperLeftEject=49,swLowerLeftEject=50,swLeftJetBumper=51
  226. Const swRightJetBumper=52,swLowerJetBumper=53,swBRKicker=54,swBLKicker=55,swSpinner=56,swFlipR=57,swFlipL=58,swClockWheel=59
  227. Const sOuthole=1,sRampDown=2,sC3BDTReset=3,sRampUp=4,sUpperLeftEject=5,sSubPlfdShooter=6,sKnocker=7,sLowerLeftEject=8
  228. Const sRightRampFlasher=9,sBackBoxRelay=10,sLeftRampFlasher=11,sL3BDTReset=13,sClockWheel=15
  229. Const sACselectrelay=12, sLeftJetBumper=17,sRightJetBumper=19,sLowerJetBumper=21,sShooterLaneFeeder=22,sDineTF=32
  230. Const sLSling=18,sRSling=20,swLSling=18,swRSling=20
  231.  
  232. ' *** mechanic handlers ***
  233. Dim dtright, dtleft, bsTrough, bsLowKicker, bsUpperEject, bsSubShooter, WheelMech, bsSubWay
  234.  
  235. ' *** creating lights arrays for playfield inserts ***
  236.  
  237. ' *** LightType 0 = normal insert lighting with two lights
  238. ' *** LightType 1 = one object only for visible on/off
  239. ' *** LightType 2 = EAT multiple Lights
  240. ' *** LightType 3 = cutout flashers (pepe, babs, boris, haji, buck)
  241. ' *** LightType 4 = not connected
  242.  
  243. Dim LightType(65), LightObjectFirst(65), LightObjectSecond(65), LightObjectThird(65), Glowing(10), LightState(65)
  244.  
  245. LightType(1) = 1 : Set LightObjectFirst(1) = register20k ' 20k register
  246. LightType(2) = 1 : Set LightObjectFirst(2) = register40k ' 40k register
  247. LightType(3) = 1 : Set LightObjectFirst(3) = register60k ' 60k register
  248. LightType(4) = 1 : Set LightObjectFirst(4) = register80k ' 80k register
  249. LightType(5) = 1 : Set LightObjectFirst(5) = register100k ' 100k register
  250. LightType(6) = 0 : Set LightObjectFirst(6) = Light6b : Set LightObjectSecond(6) = Light6 ' left adv dine time
  251. LightType(7) = 0 : Set LightObjectFirst(7) = Light7b : Set LightObjectSecond(7) = Light7 ' right adv dine time
  252. LightType(8) = 0 : Set LightObjectFirst(8) = Light8b : Set LightObjectSecond(8) = Light8 ' extra ball right
  253. LightType(9) = 0 : Set LightObjectFirst(9) = Light9b : Set LightObjectSecond(9) = Light9 ' serve again
  254. LightType(10) = 0 : Set LightObjectFirst(10) = Light10b : Set LightObjectSecond(10) = Light10 ' left ramp scores
  255. LightType(11) = 0 : Set LightObjectFirst(11) = Light11b : Set LightObjectSecond(11) = Light11 ' right ramp scores
  256. LightType(12) = 0 : Set LightObjectFirst(12) = Light12b : Set LightObjectSecond(12) = Light12 ' Lock
  257. LightType(13) = 0 : Set LightObjectFirst(13) = Light13b : Set LightObjectSecond(13) = Light13 ' Release
  258. LightType(14) = 0 : Set LightObjectFirst(14) = Light14b : Set LightObjectSecond(14) = Light14 ' Rush1
  259. LightType(15) = 0 : Set LightObjectFirst(15) = Light15b : Set LightObjectSecond(15) = Light15 ' Rush2
  260. LightType(16) = 0 : Set LightObjectFirst(16) = Light16b : Set LightObjectSecond(16) = Light16 ' Spinner
  261. LightType(17) = 0 : Set LightObjectFirst(17) = Light17b : Set LightObjectSecond(17) = Light17 ' D
  262. LightType(18) = 0 : Set LightObjectFirst(18) = Light18b : Set LightObjectSecond(18) = Light18 ' I
  263. LightType(19) = 0 : Set LightObjectFirst(19) = Light19b : Set LightObjectSecond(19) = Light19 ' N
  264. LightType(20) = 0 : Set LightObjectFirst(20) = Light20b : Set LightObjectSecond(20) = Light20 ' E
  265. LightType(21) = 0 : Set LightObjectFirst(21) = Light21b : Set LightObjectSecond(21) = Light21 ' R
  266. LightType(22) = 2 : Set LightObjectFirst(22) = Light22b : Set LightObjectSecond(22) = Light22 : Set LightObjectThird(22) = circleE ' E
  267. LightType(23) = 2 : Set LightObjectFirst(23) = Light23b : Set LightObjectSecond(23) = Light23 : Set LightObjectThird(23) = circleA ' A
  268. LightType(24) = 2 : Set LightObjectFirst(24) = Light24b : Set LightObjectSecond(24) = Light24 : Set LightObjectThird(24) = circleT ' T
  269. LightType(25) = 1 : Set LightObjectFirst(25) = juke150k ' 150k jukebox
  270. LightType(26) = 1 : Set LightObjectFirst(26) = juke100k ' 100k jukebox
  271. LightType(27) = 1 : Set LightObjectFirst(27) = juke75k ' 75k jukebox
  272. LightType(28) = 1 : Set LightObjectFirst(28) = juke50k ' 50k jukebox
  273. LightType(29) = 1 : Set LightObjectFirst(29) = juke25k ' 25k jukebox
  274. LightType(30) = 0 : Set LightObjectFirst(30) = Light30b : Set LightObjectSecond(30) = Light30 ' hotdog
  275. LightType(31) = 0 : Set LightObjectFirst(31) = Light31b : Set LightObjectSecond(31) = Light31 ' Burger
  276. LightType(32) = 0 : Set LightObjectFirst(32) = Light32b : Set LightObjectSecond(32) = Light32 ' soup
  277. LightType(33) = 3 : Set LightObjectFirst(33) = Light33b : Set LightObjectSecond(33) = Light33 ' Haji
  278. LightType(34) = 3 : Set LightObjectFirst(34) = Light34b : Set LightObjectSecond(34) = Light34 ' Babs
  279. LightType(35) = 3 : Set LightObjectFirst(35) = Light35b : Set LightObjectSecond(35) = Light35 ' Boris
  280. LightType(36) = 3 : Set LightObjectFirst(36) = Light36b : Set LightObjectSecond(36) = Light36 ' Pepe
  281. LightType(37) = 3 : Set LightObjectFirst(37) = Light37b : Set LightObjectSecond(37) = Light37 ' Buck
  282. LightType(38) = 0 : Set LightObjectFirst(38) = Light38b : Set LightObjectSecond(38) = Light38 ' Beer
  283. LightType(39) = 0 : Set LightObjectFirst(39) = Light39b : Set LightObjectSecond(39) = Light39 ' Fries
  284. LightType(40) = 0 : Set LightObjectFirst(40) = Light40b : Set LightObjectSecond(40) = Light40 ' Lemonade
  285. LightType(41) = 0 : Set LightObjectFirst(41) = Light41b : Set LightObjectSecond(41) = Light41 ' 100k
  286. LightType(42) = 0 : Set LightObjectFirst(42) = Light42b : Set LightObjectSecond(42) = Light42 ' 150k
  287. LightType(43) = 0 : Set LightObjectFirst(43) = Light43b : Set LightObjectSecond(43) = Light43 ' 250k
  288. LightType(44) = 0 : Set LightObjectFirst(44) = Light44b : Set LightObjectSecond(44) = Light44 ' 1M
  289. LightType(45) = 0 : Set LightObjectFirst(45) = Light45b : Set LightObjectSecond(45) = Light45 ' extra ball
  290. LightType(46) = 0 : Set LightObjectFirst(46) = Light46b : Set LightObjectSecond(46) = Light46 ' food
  291. LightType(47) = 0 : Set LightObjectFirst(47) = Light47b : Set LightObjectSecond(47) = Light47 ' cup scores
  292. LightType(48) = 0 : Set LightObjectFirst(48) = Light48b : Set LightObjectSecond(48) = Light48 ' extra ball left
  293. LightType(49) = 4 : ' 49 - 60 are 1-12 on clock lights
  294. LightType(50) = 4 :
  295. LightType(51) = 4 :
  296. LightType(52) = 4 :
  297. LightType(53) = 4 :
  298. LightType(54) = 4 :
  299. LightType(55) = 4 :
  300. LightType(56) = 4 :
  301. LightType(57) = 4 :
  302. LightType(58) = 4 :
  303. LightType(59) = 4 :
  304. LightType(60) = 4 :
  305. LightType(61) = 0 : Set LightObjectFirst(61) = Light61b : Set LightObjectSecond(61) = Light61 ' TOP 5
  306. LightType(62) = 0 : Set LightObjectFirst(62) = Light62b : Set LightObjectSecond(62) = Light62 ' special
  307. LightType(63) = 0 : Set LightObjectFirst(63) = Light63b : Set LightObjectSecond(63) = Light63 ' dinetime
  308. LightType(64) = 0 : Set LightObjectFirst(64) = Light64b : Set LightObjectSecond(64) = Light64 ' food
  309. LightType(65) = 4 :
  310.  
  311. ' *** prepare the variable with references to three lights for glow ball ***
  312.  
  313. Set Glowing(0) = Glowball1 : Set Glowing(1) = Glowball2 : Set Glowing(2) = Glowball3
  314.  
  315. ' *** Start VPM ***
  316.  
  317. On Error Resume Next
  318. ExecuteGlobal GetTextFile("controller.vbs")
  319. If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
  320. On Error Goto 0
  321. LoadVPM "01560000", "S11.VBS", 3.26
  322.  
  323. ' MotorCallback Function called after every update of solenoids and lamps (i.e. as often as
  324. ' possible). Main purpose is to update table based on playfield motors. It can also
  325. ' be used to override the standard solenoid callback handler
  326. Set MotorCallback = GetRef("RollingUpdate") 'realtime updates for rolling sound
  327.  
  328. '*** solenoid definitions ***
  329.  
  330. SolCallback(23)="TiltSol"
  331. SolCallback(sOuthole)="bsTrough.SolIn"
  332. SolCallback(sShooterLaneFeeder)="bsTrough.SolOut"
  333. SolCallback(sKnocker) = "vpmSolSound SoundFX(""Knocker"",DOFKnocker),"
  334. SolCallback(sLeftJetBumper)="vpmSolSound SoundFX(""bumperleft"",DOFContactors),"
  335. SolCallback(sRightJetBumper)="vpmSolSound SoundFX(""bumperright"",DOFContactors),"
  336. SolCallback(sLowerJetBumper)="vpmSolSound SoundFX(""bumpermiddle"",DOFContactors),"
  337. SolCallback(sLowerLeftEject) = "SolLowKicker"
  338. SolCallback(sUpperLeftEject) = "SolUpperEject"
  339. SolCallback(sRightRampFlasher) = "SolFlash9"
  340. SolCallback(sLeftRampFlasher) = "SolFlash11"
  341. SolCallback(sSubPlfdShooter) = "SolSubPlfdShooter"
  342. SolCallback(25) = "SolHajiF"
  343. SolCallback(26) = "SolBabsF"
  344. SolCallback(27) = "SolBorisF"
  345. SolCallback(28) = "SolPepeF"
  346. SolCallback(29) = "SolBuckF"
  347. SolCallback(30) = "SolCupF"
  348. SolCallback(sBackBoxRelay) = "SolGIRelay"
  349. SolCallback(sACselectrelay) = "SolACSelect"
  350. SolCallback(sC3BDTReset) = "dtright.SolDropUp"
  351. SolCallback(sL3BDTReset) = "dtleft.SolDropUp"
  352. SolCallback(sRampUp)="SolRampUp"
  353. SolCallback(sRampDown)="SolRampDown"
  354. SolCallback(14)="Sol14Diverter"
  355.  
  356. '*** flipper solenoids disabled for faster response in KeyDown ***
  357. 'SolCallback(sLRFlipper) = "SolRFlipper"
  358. 'SolCallback(sLLFlipper) = "SolLFlipper"
  359.  
  360. ' *** table init ***
  361.  
  362. Sub Diner_Init
  363. Dim Light, Prim
  364. vpmInit Me
  365. If LightsDemo Then
  366. For Each Light in GlowLights : Light.state = 1 : Next
  367. For Each Light in InsertLights : Light.state = 1 : Next
  368. For Each Light in glowlightscutout : Light.state = 1 : Next
  369. For Each Light in insertlightscutout : Light.state = 1 : Next
  370. For Each Light in LightsGI : Light.State = LightStateOn : Next
  371. For Each Prim in primitivesGI : Prim.DisableLighting = 1 : Next
  372. For Each Prim in primitivesGIpegs : Prim.image = "peglight" : Prim.material = "peg3light": Next
  373. 'SolFlash11(True)
  374. 'SolFlash9(true)
  375. 'solCupF(True)
  376. Else
  377. With Controller
  378. ' *** explanation of controller properties
  379. ' .HandleKeyboard if set to 1, VPinMAME will process the keyboard. Standard MAME
  380. ' keys can be used in VPinMAME output window. Also the internal
  381. ' ball simulator is enabled. If set to 0, the scripting language
  382. ' will process the keyboard.
  383. ' ShowTitle if set to 1, Show title bar on VPinMAME output window (to move
  384. ' it around)
  385. ' ShowDMDOnly if set to 1, does not show VPinMAME status matrices.
  386. ' ShowFrame if set to 1, Enables the window border, only works if ShowTitle
  387. ' is set to 0
  388. ' SplashInfoLine Game credits to display in startup splash screen.
  389. ' Hidden If set to 1, hides the vpinmame display. This is useful for
  390. ' applications that want to do the display drawing on their own.
  391. ' HandleMechanics If the game has a PinMAME simulator it can be used to simulate
  392. ' hardware "toys".
  393. .GameName = cGameName
  394. If Err Then MsgBox "Can't start Game " & cGameName & vbNewLine & Err.Description:Exit Sub
  395. .SplashInfoLine = "Diner - Williams 1990" & vbNewLine & "VPX by Flupper"
  396. .Games(cGameName).Settings.Value("rol") = 0 'set it to 1 to rotate the DMD to the left
  397. .Games(cGameName).Settings.Value("ror") = 0
  398. .HandleKeyboard = 0
  399. .ShowTitle = 0
  400. .ShowDMDOnly = 1
  401. .ShowFrame = 0
  402. .HandleMechanics = 0
  403. .Hidden = 0
  404. On Error Resume Next
  405. .Run GetPlayerHWnd
  406. If Err Then MsgBox Err.Description
  407. On Error Goto 0
  408. End With
  409. End if
  410.  
  411. '*** Nudging ***
  412. vpmNudge.TiltSwitch = 1
  413. vpmNudge.Sensitivity = 1
  414. vpmNudge.TiltObj = Array(LeftJetBumper,RightJetBumper,LowerJetBumper,LSling,RSling)
  415.  
  416. ' *** Main Timer init ***
  417. PinMAMETimer.Interval = PinMAMEInterval
  418. PinMAMETimer.Enabled = 1
  419.  
  420. '*** option settings ***
  421. If ContrastSetting=0 or ContrastSetting=2 or ContrastSetting=4 or ContrastSetting=6 Then ChangeGlow(True) Else ChangeGlow(False) End If
  422. ChangeBats(ChooseBats)
  423. ChangeBall(ChooseBall)
  424. If Diner.ShowDT or ForceSiderailsFS then sidewallFS.visible = 0 : sidewallDT.visible = 1 Else lockbar.Visible = 0 : sidewallDT.visible = 0 : sidewallFS.visible = 1 : End If
  425. If ShowClock Then clock.visible = 1 : clockwijzer.visible = 1 : end If
  426. If GlowBall or BallShadow Then GraphicsTimer.enabled = True End If
  427. IF not AlternateDroptargets Then
  428. hotdog.image = "DropTargetyellow" : burger.image = "DropTargetyellow" : chili.image = "DropTargetyellow"
  429. icedtea.image = "DropTargetred" : rootbeer.image = "DropTargetred" : fries.image = "DropTargetred"
  430. End If
  431.  
  432. ' *** Desktop specific changes for better 3D view ***
  433. If Diner.ShowDT then
  434. Flasher4light.BulbHaloHeight = 250
  435. rampsDT.visible = 1
  436. rampsFS.visible = 0
  437. Else
  438. rampsDT.visible = 0
  439. rampsFS.visible = 1
  440. end If
  441.  
  442. ' *** mechanic for clock hand ***
  443. Set WheelMech = New cvpmMech
  444. With WheelMech :
  445. .MType = vpmMechStepSol + vpmMechCircle + vpmMechLinear + vpmMechFast
  446. .Sol1 = 15 : .Sol2 = 16 : .Length = 200 : .Steps = 60
  447. .CallBack = GetRef("UpdateClockHand")
  448. .AddSw 59, 0, 0
  449. .Start
  450. End With
  451.  
  452. ' *** Trough ***
  453. Set bsTrough = New cvpmTrough
  454. With bsTrough
  455. .size = 3
  456. .initSwitches Array(swTrough1,swTrough2,swTrough3)
  457. .Initexit BallRelease, 90, 4
  458. .InitEntrySounds "drain", "", ""
  459. .InitExitSounds SoundFX("fx_Solenoid",DOFContactors), SoundFX("fx_Ballrel",DOFContactors)
  460. .Balls = 3
  461. .EntrySw = 10
  462. End With
  463.  
  464. ' *** Left droptargets Bank ***
  465. Set dtleft = New cvpmDropTarget
  466. With dtleft
  467. .InitDrop Array(rootbeer, fries, icedtea), Array(30, 31, 32)
  468. .initsnd SoundFX("fx_droptarget", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  469. .CreateEvents "dtleft"
  470. End With
  471.  
  472. ' *** Right droptargets Bank ***
  473. Set dtright = New cvpmDropTarget
  474. With dtright
  475. .InitDrop Array(hotdog, burger, chili), Array(22, 23, 24)
  476. .initsnd SoundFX("fx_droptarget", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
  477. .CreateEvents "dtright"
  478. End With
  479.  
  480. ' *** lock ramp saucer ***
  481. Set bsLowKicker = New cvpmSaucer
  482. With bsLowKicker
  483. .InitKicker LowKicker, swLowerLeftEject, 45, 6, 0
  484. .InitSounds "kicker_enter", SoundFX("popper_ball",DOFContactors), SoundFX("popper_ball",DOFContactors)
  485. End With
  486.  
  487. ' *** upper left saucer ***
  488. Set bsUpperEject = New cvpmSaucer
  489. With bsUpperEject
  490. .InitKicker UpperEject, swUpperLeftEject, 90, 6 , 0
  491. .InitExitVariance 0,2
  492. .InitSounds "kicker_enter", SoundFX("popper_ball",DOFContactors), SoundFX("popper_ball",DOFContactors)
  493. End With
  494.  
  495. ' *** subway kicker ***
  496. Set bsSubWay = New cvpmTrough
  497. With bsSubWay
  498. .size = 2
  499. .initSwitches Array(swSubPlfdShooter1,swSubPlfdShooter2)
  500. .Initexit SubWaypopper, 0, 100
  501. .InitEntrySounds "WireRamp_Hit", "", ""
  502. .InitExitSounds SoundFX("fx_Solenoid",DOFContactors), SoundFX("BallRelease",DOFContactors)
  503. .Balls = 0
  504. .EntrySw = 0
  505. .CreateEvents "bsSubWay", SubWaypopper
  506. End With
  507. End Sub
  508.  
  509. '*** change insert glow appearance ***
  510.  
  511. Sub ChangeGlow(day)
  512. Dim Light
  513. If day Then
  514. For Each Light in GlowLights : Light.IntensityScale = GlowAmountDay: Light.FadeSpeedUp = Light.Intensity * GlowAmountDay / 2: Light.FadeSpeedDown = Light.FadeSpeedUp / 25: Next
  515. For Each Light in InsertLights : Light.IntensityScale = InsertBrightnessDay : Light.FadeSpeedUp = Light.Intensity * InsertBrightnessDay / 2 : Light.FadeSpeedDown = Light.FadeSpeedUp / 25 : Next
  516. For Each Light in glowlightscutout : Light.IntensityScale = GlowAmountCutoutDay : Light.FadeSpeedUp = Light.Intensity / 2 : Light.FadeSpeedDown = Light.FadeSpeedUp / 25 : Next
  517. For Each Light in insertlightscutout : Light.IntensityScale = InsertBrightnessCutoutDay : Light.FadeSpeedUp = Light.Intensity / 2 : Light.FadeSpeedDown = Light.FadeSpeedUp / 25: Next
  518. For Each Light in eaters: Light.FadeSpeedUp = 5000 : Light.FadeSpeedDown = 5000 : Next
  519. Else
  520. For Each Light in GlowLights : Light.IntensityScale = GlowAmountNight: Light.FadeSpeedUp = Light.Intensity * GlowAmountNight / 2: Light.FadeSpeedDown = Light.FadeSpeedUp / 25: Next
  521. For Each Light in InsertLights : Light.IntensityScale = InsertBrightnessNight : Light.FadeSpeedUp = Light.Intensity * InsertBrightnessNight / 2 : Light.FadeSpeedDown = Light.FadeSpeedUp / 25 : Next
  522. For Each Light in glowlightscutout : Light.IntensityScale = GlowAmountCutoutNight : Light.FadeSpeedUp = Light.Intensity / 2 : Light.FadeSpeedDown = Light.FadeSpeedUp / 25 : Next
  523. For Each Light in insertlightscutout : Light.IntensityScale = InsertBrightnessCutoutNight : Light.FadeSpeedUp = Light.Intensity / 2 : Light.FadeSpeedDown = Light.FadeSpeedUp / 25: Next
  524. For Each Light in eaters: Light.FadeSpeedUp = 5000 : Light.FadeSpeedDown = 5000 : Next
  525. End If
  526. End Sub
  527.  
  528. '*** change bat appearance ***
  529.  
  530. Sub ChangeBats(Bats)
  531. Select Case Bats
  532. Case 0
  533. glowbatleft.visible = 0 : glowbatright.visible = 0 : GlowBatLightLeft.visible = 0 : GlowBatLightRight.visible = 0
  534. batleft.visible = 0 : batright.visible = 0 : LeftFlipper.visible = 1 : RightFlipper.visible = 1
  535. GraphicsTimer.enabled = False
  536. Case 1
  537. glowbatleft.visible = 0 : glowbatright.visible = 0 : GlowBatLightLeft.visible = 0 : GlowBatLightRight.visible = 0
  538. batleft.visible = 1 : batright.visible = 1 : LeftFlipper.visible = 0 : RightFlipper.visible = 0
  539. GraphicsTimer.enabled = True
  540. Case 2
  541. glowbatleft.visible = 1 : glowbatright.visible = 1 : GlowBatLightLeft.visible = 1 : GlowBatLightRight.visible = 1
  542. batleft.visible = 0 : batright.visible = 0 : LeftFlipper.visible = 0 : RightFlipper.visible = 0
  543. glowbatleft.image = "glowbat green" : glowbatright.image = "glowbat green"
  544. GlowBatLightLeft.color = RGB(0,255,0) : GlowBatLightRight.color = RGB(0,255,0)
  545. GraphicsTimer.enabled = True
  546. Case 3
  547. glowbatleft.visible = 1 : glowbatright.visible = 1 : GlowBatLightLeft.visible = 1 : GlowBatLightRight.visible = 1
  548. batleft.visible = 0 : batright.visible = 0 : LeftFlipper.visible = 0 : RightFlipper.visible = 0
  549. glowbatleft.image = "glowbat blue" : glowbatright.image = "glowbat blue"
  550. GlowBatLightLeft.color = RGB(0,0,255) : GlowBatLightRight.color = RGB(0,0,255)
  551. GraphicsTimer.enabled = True
  552. Case 4
  553. glowbatleft.visible = 1 : glowbatright.visible = 1 : GlowBatLightLeft.visible = 1 : GlowBatLightRight.visible = 1
  554. batleft.visible = 0 : batright.visible = 0 : LeftFlipper.visible = 0 : RightFlipper.visible = 0
  555. glowbatleft.image = "glowbat orange" : glowbatright.image = "glowbat orange"
  556. GlowBatLightLeft.color = RGB(255,0,0) : GlowBatLightRight.color = RGB(255,0,0)
  557. GraphicsTimer.enabled = True
  558. End Select
  559. End Sub
  560.  
  561. '*** change ball appearance ***
  562.  
  563. Sub ChangeBall(ballnr)
  564. Dim BOT, ii, col
  565. Diner.BallDecalMode = CustomBallLogoMode(ballnr)
  566. Diner.BallFrontDecal = CustomBallDecal(ballnr)
  567. Diner.DefaultBulbIntensityScale = CustomBulbIntensity(ballnr)
  568. Diner.BallImage = CustomBallImage(ballnr)
  569. GlowBall = CustomBallGlow(ballnr)
  570. For ii = 0 to 2
  571. col = RGB(red(ballnr), green(ballnr), Blue(ballnr))
  572. Glowing(ii).color = col : Glowing(ii).colorfull = col
  573. Next
  574. End Sub
  575.  
  576. ' *** various hit event handling ***
  577.  
  578. Sub ShooterLane_Hit():Controller.Switch(swShooterLane)=1:End Sub
  579. Sub ShooterLane_UnHit():Controller.Switch(swShooterLane)=0:End Sub
  580. Sub LeftJetBumper_Hit(): vpmTimer.PulseSwitch (swLeftJetBumper), 0, "" : PlaySound SoundFX("Jet1",DOFContactors) : End Sub
  581. Sub RightJetBumper_Hit(): vpmTimer.PulseSwitch (swRightJetBumper), 0, "" : PlaySound SoundFX("Jet2",DOFContactors) : End Sub
  582. Sub LowerJetBumper_Hit(): vpmTimer.PulseSwitch (swLowerJetBumper), 0, "" : PlaySound SoundFX("Jet1",DOFContactors) : End Sub
  583. Sub LeftReturnLane_Hit():Controller.Switch(swLeftReturnLane)=1:End Sub
  584. Sub LeftReturnLane_UnHit():Controller.Switch(swLeftReturnLane)=0:End Sub
  585. Sub RightReturnLane_Hit():Controller.Switch(swRightReturnLane)=1:End Sub
  586. Sub RightReturnLane_UnHit():Controller.Switch(swRightReturnLane)=0:End Sub
  587. Sub LeftOutlane_Hit():Controller.Switch(swLeftOutLane)=1:End Sub
  588. Sub LeftOutlane_UnHit():Controller.Switch(swLeftOutLane)=0:End Sub
  589. Sub RightOutlane_Hit():Controller.Switch(swRightOutlane)=1:End Sub
  590. Sub RightOutlane_UnHit():Controller.Switch(swRightOutlane)=0:End Sub
  591. Sub E_Hit():Controller.Switch(swE)=1:End Sub
  592. Sub E_UnHit():Controller.Switch(swE)=0:End Sub
  593. Sub A_Hit():Controller.Switch(swA)=1:End Sub
  594. Sub A_UnHit():Controller.Switch(swA)=0:End Sub
  595. Sub T_Hit():Controller.Switch(swT)=1:End Sub
  596. Sub T_UnHit():Controller.Switch(swT)=0:End Sub
  597. Sub grillbonus_Hit():VpmTimer.PulseSw swGrillBonus:PlaySound "target":End Sub
  598. Sub Spinner_Spin():vpmTimer.PulseSwitch(swSpinner),0,"":End Sub
  599. Sub RightRampEntry_Hit() : Controller.Switch(swRightRampEntry)=1:End Sub
  600. Sub RightRampEntry_UnHit():Controller.Switch(swRightRampEntry)=0:End Sub
  601. Sub LeftRampExit_Hit():Controller.Switch(swLeftRampExit)=1:End Sub
  602. Sub LeftRampExit_UnHit():Controller.Switch(swLeftRampExit)=0:End Sub
  603. Sub RightRampExit_Hit():Controller.Switch(swRightRampExit)=1:End Sub
  604. Sub RightRampExit_UnHit():Controller.Switch(swRightRampExit)=0:End Sub
  605. Sub UpperEject_Hit() : bsUpperEject.AddBall Me : End Sub
  606. Sub LowKicker_Hit() : bsLowKicker.AddBall Me : End Sub
  607. Sub subwayenter_Hit() : PlaySound "NeutralZone2" : End Sub
  608. Sub Outhole_Hit() : vpmTimer.PulseSwitch(swOutHole), 100, "HandleOutHole" : End Sub
  609. Sub HandleOutHole(swNo) : bsTrough.AddBall Outhole : End Sub
  610. Sub TiltSol(Enabled) : FlippersEnabled = Enabled : SolLFlipper(False) : SolRFlipper(False) : End Sub
  611. Sub CupExit_Hit() : Playsound "fx_ball_drop" : CupExit.Enabled = 0 : End Sub
  612. Sub RightRampDrop_Hit:StopSound "metalrolling": Playsound "fx_ball_drop":End Sub
  613. Sub LeftRampDrop_Hit:Stopsound "plasticrolling": Playsound "fx_ball_drop": ActiveBall.VelY = 0 : End Sub
  614. Sub UpdateClockHand(aNewPos, aSpeed, aLastPos) : clockwijzer.ObjrotY = anewpos * 6 : DOF 101, DOFPulse : end Sub
  615. Sub SolUpperEject(enabled) : if enabled then bsUpperEject.SolOut Enabled : end if : end sub 'Solout: Fire the exit kicker and ejects ball if one is present.
  616. Sub SolLowKicker(enabled) : if enabled then bsLowKicker.SolOut Enabled : end if : end sub 'Solout: Fire the exit kicker and ejects ball if one is present.
  617.  
  618. '*** Cup handling ***
  619.  
  620. dim CupEntrySpeed
  621.  
  622. Sub CupEntry_Hit()
  623. vpmTimer.PulseSw swCupEntry
  624. Stopsound "plasticrolling"
  625. CupExit.Enabled = 1 : CupCounter = 30 : cupblocker.collidable = False
  626. ActiveBall.VelZ = 0
  627. CupEntrySpeed = sqr(ActiveBall.VelX ^2 + ActiveBall.VelY ^2) * 1.25
  628.  
  629. End Sub
  630.  
  631. Sub Cup_Hit() : Cupspeeder : vpmTimer.PulseSw swCup : cupblocker.collidable = True : End Sub
  632. Sub Cup2_Hit() : Cupspeeder : end sub
  633. Sub Cup_UnHit() : Cupspeeder : end sub
  634. Sub Cup2_UnHit() : Cupspeeder : end sub
  635.  
  636. Sub Cupspeeder()
  637. If abs(ActiveBall.VelY) > 5 And abs(ActiveBall.VelX) > 5 Then
  638. Dim BallSpeed, BallSpeedReduction
  639. BallSpeed = sqr(ActiveBall.VelX ^2 + ActiveBall.VelY ^2)
  640. BallSpeedReduction = (CupEntrySpeed / BallSpeed) * 30 / ( sqr(2) * CupCounter )
  641. ActiveBall.VelY = ActiveBall.VelY * BallSpeedReduction
  642. ActiveBall.VelX = ActiveBall.VelX * BallSpeedReduction
  643. cupcounter = cupcounter + 1
  644. End If
  645. End Sub
  646.  
  647. '*** Lockramp handling ***
  648.  
  649. Sub SolRampDown(Enabled)
  650. If ramp1.collidable Then
  651. Controller.Switch(swUpDownRamp)=1
  652. Else
  653. ramp1.collidable = True : LRAindex = 6 : lockramptimer.enabled = True
  654. End If
  655. End Sub
  656.  
  657. Sub SolRampUp(Enabled)
  658. If Ramp1.collidable Then
  659. ramp1.collidable = False : lockramptimer.enabled = True : LRAindex = 0
  660. Else
  661. Controller.Switch(swUpDownRamp)=0
  662. End If
  663. End Sub
  664.  
  665. Sub lockramptimer_timer
  666. If ramp1.collidable Then
  667. lockramp.ObjRotX = LRA(LRAindex) : LRAindex = LRAindex - 1
  668. If LRAindex < 0 then LRAindex = 0 : lockramptimer.enabled = False : Controller.Switch(swUpDownRamp)=1 : playsound"TrapDoorLow" : end If
  669. Else
  670. lockramp.ObjRotX = LRA(LRAindex) : LRAindex = LRAindex + 1
  671. If LRAindex > 6 then LRAindex = 6 : lockramptimer.enabled = False : Controller.Switch(swUpDownRamp)=0 : playsound"TrapDoorHigh" : end If
  672. End If
  673. end Sub
  674.  
  675. '*** diverter handling ***
  676.  
  677. Sub Sol14Diverter(Enabled)
  678. if Enabled then
  679. Sol14Closed.collidable = False : DVdir = 1 : divertertimer.enabled = True : playsound SoundFX("TopDiverterOn",DOFContactors)
  680. else
  681. Sol14Closed.collidable = True : Dvdir = -1 : divertertimer.enabled = True : playsound SoundFX("TopDiverterOff",DOFContactors)
  682. end if
  683. End Sub
  684.  
  685. Sub divertertimer_timer
  686. If DVdir = 0 Then
  687. divertertimer.enabled = False
  688. Else
  689. DVindex = DVindex + DVdir
  690. If DVindex < 0 Then DVindex = 0 : DVdir = 0 : end If
  691. IF DVindex > 6 Then Dvindex = 6: DVdir = 0 : end If
  692. divider179to201.RotY = DV(DVindex)
  693. End If
  694. end Sub
  695.  
  696. ' *** drophole sub playfield shooter ***
  697.  
  698. Sub SolSubPlfdShooter(enabled)
  699. If enabled and bsSubWay.balls > 0 Then
  700. bsSubWay.ExitSol_On : rightflap.RotX = 80 : rightflaptimer.enabled = True
  701. End If
  702. End Sub
  703.  
  704. Sub rightflaptimer_timer : rightflap.RotX = 90 : rightflaptimer.enabled = False : end Sub
  705.  
  706. ' *** character flasher handling ***
  707.  
  708. Sub solHajiF(enabled) : FlashCutout 33,enabled : End Sub
  709. Sub solBabsF(enabled) : FlashCutout 34,enabled : End Sub
  710. Sub solBorisF(enabled) : FlashCutout 35,enabled : End Sub
  711. Sub solPepeF(enabled) : FlashCutout 36,enabled : End Sub
  712. Sub solBuckF(enabled) : FlashCutout 37,enabled : End Sub
  713.  
  714. Sub FlashCutout(nr,enabled)
  715. Dim GlowCutout, InsertCutout
  716. If ContrastSetting=0 or ContrastSetting=2 or ContrastSetting=4 or ContrastSetting=6 Then
  717. GlowCutout = GlowAmountCutoutDay : InsertCutout = InsertBrightnessCutoutDay
  718. Else
  719. GlowCutout = GlowAmountCutoutNight : InsertCutout = InsertBrightnessCutoutNight
  720. End If
  721. if enabled then
  722. LightObjectFirst(nr).IntensityScale = GlowCutout * 4 : LightObjectFirst(nr).state = LightStateOn
  723. LightObjectSecond(nr).IntensityScale = InsertCutout * 12 : LightObjectSecond(nr).state = LightStateOn
  724. Else
  725. LightObjectFirst(nr).IntensityScale = GlowCutout : LightObjectFirst(nr).state = LightState(nr)
  726. LightObjectSecond(nr).IntensityScale = InsertCutout : LightObjectSecond(nr).state = LightState(nr)
  727. End If
  728. End Sub
  729.  
  730. ' *** cup Flasher ***
  731.  
  732. Sub solCupF(enabled)
  733. if enabled then
  734. PlaySound "fx_relay_on",0,relaylevel : StopSound "fx_relay_off"
  735. Flasher5light.state = LightStateOn : Flasher5lightsec.state = LightStateOn
  736. Else
  737. PlaySound "fx_relay_off",0,relaylevel : StopSound "fx_relay_on"
  738. Flasher5light.state = LightStateOff : Flasher5lightsec.state = LightStateOff
  739. End If
  740. End Sub
  741.  
  742. ' *** Rightrampflasher ***
  743.  
  744. Sub SolFlash9(Enabled)
  745. Rightflash = enabled
  746. if enabled then
  747. PlaySound "fx_relay_on",0,relaylevel : StopSound "fx_relay_off": Flasher1.disablelighting = True : Flasher2.disablelighting = True
  748. Flasher1light.IntensityScale = 1 : Flasher2light.IntensityScale = 1 : Flasher1lightsec.IntensityScale = 1 : Flasher2lightsec.IntensityScale = 1
  749. Flasher1light.state = LightStateOn : Flasher2light.state = LightStateOn : Flasher1lightsec.state = LightStateOn : Flasher2lightsec.state = LightStateOn
  750. Flasher1.material = "flasherlit" : Flasher1.image = "domelighton" :Flasher2.material = "flasherlit" : Flasher2.image = "domelighton"
  751. If Leftflash Then
  752. sidewallFS.image = "sidewallsFSbothflash" : backwall.image = "backwallbothflash" : sidewallDT.image = "sidewallsFSbothflash"
  753. sidewallFS.material = "sidewallsbothflash" : sidewallDT.material = "sidewallsbothflash"
  754. ColorGradeFlash()
  755. Else
  756. sidewallFS.image = "sidewallsFSrightflash" : backwall.image = "backwallrightflash" : sidewallDT.image = "sidewallsFSrightflash"
  757. sidewallFS.material = "sidewallsrightflash" : sidewallDT.material = "sidewallsrightflash"
  758. ColorGradeFlash()
  759. End If
  760.  
  761. Else
  762. PlaySound "fx_relay_off",0,relaylevel : StopSound "fx_relay_on": Flasher1.disablelighting = False : Flasher2.disablelighting = False
  763. Flasher1light.IntensityScale = 0.5 : Flasher2light.IntensityScale = 0.5 : Flasher1lightsec.IntensityScale = 0.5 : Flasher2lightsec.IntensityScale = 0.5
  764. Flasher1light.state = LightStateOff : Flasher2light.state = LightStateOff : Flasher1lightsec.state = LightStateOff : Flasher2lightsec.state = LightStateOff
  765. Flasher1.material = "flasherunlit" : Flasher1.image = "domelightoff" : Flasher2.material = "flasherunlit" : Flasher2.image = "domelightoff"
  766. If Leftflash Then
  767. sidewallFS.image = "sidewallsFSleftflash" : backwall.image = "backwallleftflash" : sidewallDT.image = "sidewallsFSleftflash"
  768. sidewallFS.material = "sidewallsleftflash" : sidewallDT.material = "sidewallsleftflash"
  769. ColorGradeFlash()
  770. Else
  771. sidewallFS.image = "sidewallsFS" : backwall.image = "backwallnoflash" : sidewallDT.image = "sidewallsFS"
  772. sidewallFS.material = "sidewallsnoflash" : sidewallDT.material = "sidewallsnoflash"
  773. ColorGradeFlash()
  774. End If
  775.  
  776. End If
  777. End sub
  778.  
  779. ' *** Leftrampflasher ***
  780.  
  781. Sub SolFlash11(Enabled)
  782. Leftflash = enabled
  783. if enabled then
  784. PlaySound "fx_relay_on",0,relaylevel : StopSound "fx_relay_off": Flasher3.disablelighting = True : Flasher4.disablelighting = True
  785. Flasher3light.IntensityScale = 1 : Flasher4light.IntensityScale = 1 : Flasher3lightsec.IntensityScale = 1 : Flasher4lightsec.IntensityScale = 1
  786. Flasher3light.state = LightStateOn : Flasher4light.state = LightStateOn : Flasher3lightsec.state = LightStateOn : Flasher4lightsec.state = LightStateOn
  787. Flasher3.material = "flasherlit" : Flasher3.image = "domelighton" :Flasher4.material = "flasherlit" : Flasher4.image = "domelighton"
  788. If Rightflash Then
  789. sidewallFS.image = "sidewallsFSbothflash" : backwall.image = "backwallbothflash" : sidewallDT.image = "sidewallsFSbothflash"
  790. sidewallFS.material = "sidewallsbothflash" : sidewallDT.material = "sidewallsbothflash"
  791. ColorGradeFlash()
  792. Else
  793. sidewallFS.image = "sidewallsFSleftflash" : backwall.image = "backwallleftflash" : sidewallDT.image = "sidewallsFSleftflash"
  794. sidewallFS.material = "sidewallsleftflash" : sidewallDT.material = "sidewallsleftflash"
  795. ColorGradeFlash()
  796. End If
  797. Else
  798. PlaySound "fx_relay_off",0,relaylevel : StopSound "fx_relay_on": Flasher3.disablelighting = False : Flasher4.disablelighting = False
  799. Flasher3light.IntensityScale = 0.5 : Flasher4light.IntensityScale = 0.5 : Flasher3lightsec.IntensityScale = 0.5 : Flasher4lightsec.IntensityScale = 0.5
  800. Flasher3light.state = LightStateOff : Flasher4light.state = LightStateOff : Flasher3lightsec.state = LightStateOff : Flasher4lightsec.state = LightStateOff
  801. Flasher3.material = "flasherunlit" : Flasher3.image = "domelightoff" : Flasher4.material = "flasherunlit" : Flasher4.image = "domeshadowoff"
  802. If Rightflash Then
  803. sidewallFS.image = "sidewallsFSrightflash" : backwall.image = "backwallrightflash" : sidewallDT.image = "sidewallsFSrightflash"
  804. sidewallFS.material = "sidewallsrightflash" : sidewallDT.material = "sidewallsrightflash"
  805. ColorGradeFlash()
  806. Else
  807. sidewallFS.image = "sidewallsFS" : backwall.image = "backwallnoflash" : sidewallDT.image = "sidewallsFS"
  808. sidewallFS.material = "sidewallsnoflash" : sidewallDT.material = "sidewallsnoflash"
  809. ColorGradeFlash()
  810. End If
  811. End If
  812. End sub
  813.  
  814. ' *** flashes the whole screen by changing colorgrade LUT ***
  815.  
  816. Sub ColorGradeFlash()
  817. Dim lutlevel, ContrastLut
  818. Lutlevel = 0
  819. If Leftflash Then Lutlevel = lutlevel + 1 End If
  820. If Rightflash Then Lutlevel = lutlevel + 1 End If
  821. If ContrastSetting=0 or ContrastSetting=2 or ContrastSetting=4 or ContrastSetting=6 Then
  822. ContrastLut = ContrastSetting / 2
  823. Else
  824. ContrastLut = ContrastSetting / 2 - 0.5
  825. End If
  826. diner.ColorGradeImage = "LUT" & ContrastLut & "_" & lutlevel
  827. End Sub
  828.  
  829. ' *** keyboard handlers ***
  830.  
  831. Sub Diner_KeyDown(ByVal keycode)
  832. if keycode = LeftFlipperKey and FlippersEnabled Then SolLFlipper(True)
  833. if keycode = RightFlipperKey and FlippersEnabled Then SolRflipper(True)
  834. If keycode = LeftTiltKey Then Nudge 90, 3 : PlaySound SoundFX("fx_nudge",0)
  835. If keycode = RightTiltKey Then Nudge 270, 3 : PlaySound SoundFX("fx_nudge",0)
  836. If keycode = CenterTiltKey Then Nudge 0, 3 : PlaySound SoundFX("fx_nudge",0)
  837. If keycode = RightMagnaSave Then
  838. ContrastSetting = ContrastSetting + 1
  839. If ContrastSetting > 7 Then ContrastSetting = 7 End If
  840. If ContrastSetting=0 or ContrastSetting=2 or ContrastSetting=4 or ContrastSetting=6 Then ChangeGlow(True) Else ChangeGlow(False) End If
  841. ColorGradeFlash()
  842. OptionPrim.image = "contrastsetting" & ContrastSetting : OptionPrim.visible = 1 : OptionOpacity = 0 : OptionTimer.enabled = True
  843. End If
  844. If keycode = LeftMagnaSave Then
  845. ContrastSetting = ContrastSetting - 1
  846. If ContrastSetting < 0 Then ContrastSetting = 0 End If
  847. If ContrastSetting=0 or ContrastSetting=2 or ContrastSetting=4 or ContrastSetting=6 Then ChangeGlow(True) Else ChangeGlow(False) End If
  848. ColorGradeFlash()
  849. OptionPrim.image = "contrastsetting" & ContrastSetting : OptionPrim.visible = 1 : OptionOpacity = 0 : OptionTimer.enabled = True
  850. End If
  851. If keycode = PlungerKey Then PlaySound "fx_PlungerPull", 0, 1, 0.1, 0.25:Plunger.Pullback
  852. If vpmKeyDown(keycode) Then Exit Sub
  853. End Sub
  854.  
  855. Sub Diner_KeyUp(ByVal keycode)
  856. if keycode = LeftFlipperKey and FlippersEnabled Then SolLFlipper(False)
  857. if keycode = RightFlipperKey and FlippersEnabled Then SolRflipper(False)
  858. If keycode = PlungerKey Then PLaySound "fx_plunger", 0, 1, 0.1, 0.25:Plunger.Fire
  859. If vpmKeyUp(keycode) Then Exit Sub
  860. End Sub
  861.  
  862. Sub Diner_Paused: Controller.Pause = 1:End Sub
  863. Sub Diner_UnPaused: Controller.Pause = 0:End Sub
  864. Sub Diner_Exit(): Controller.Stop:End Sub
  865.  
  866.  
  867.  
  868. Sub OptionTimer_timer()
  869. If OptionOpacity = 8 Then
  870. OptionPrim.visible = 0
  871. OptionTimer.enabled = False
  872. Else
  873. OptionPrim.material = "PrimOption" & OptionOpacity
  874. OptionOpacity = OptionOpacity + 1
  875. End If
  876. End Sub
  877.  
  878.  
  879. '*** Flippers ***
  880. ' PlaySound "name",loopcount,volume,pan,randompitch,pitch,useexisting,restart
  881. ' pitch can be positive or negative and directly adds onto the standard sample frequency
  882.  
  883. Sub SolLFlipper(Enabled)
  884. If Enabled Then
  885. LeftFlipper.RotateToEnd : PlaySound SoundFX("FlipperL",DOFFlippers), 0, 1, -0.1, 0.05
  886. Else
  887. LeftFlipper.RotateToStart : PlaySound SoundFX("FlipperDown",DOFFlippers), 0, 1, -0.1, 0.05
  888. End If
  889. End Sub
  890.  
  891. Sub SolRFlipper(Enabled)
  892. If Enabled Then
  893. RightFlipper.RotateToEnd : PlaySound SoundFX("FlipperR",DOFFlippers), 0, 1, 0.1, 0.05
  894. Else
  895. RightFlipper.RotateToStart : PlaySound SoundFX("FlipperDown",DOFFlippers), 0, 1, 0.1, 0.05
  896. End If
  897. End Sub
  898.  
  899. '******************************************************************************************
  900. ' Sling Shot Animations: Rstep and Lstep are the variables that increment the animation
  901. '******************************************************************************************
  902.  
  903. Dim RStep, Lstep
  904.  
  905. Sub RSling_Slingshot
  906. vpmTimer.PulseSwitch (swRSling), 0, "" : PlaySound SoundFx("SlingshotRight",DOFContactors), 0, 1, 0.05, 0.05
  907. RSling3.Visible = 0 : RSling1.Visible = 1 : sling1.TransZ = -20 : RStep = 0 : RSling.TimerEnabled = 1
  908. End Sub
  909.  
  910. Sub RSling_Timer
  911. Select Case RStep
  912. Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.TransZ = -10
  913. Case 4:RSLing2.Visible = 0:RSling3.Visible = 1:sling1.TransZ = 0:RSling.TimerEnabled = 0
  914. End Select
  915. RStep = RStep + 1
  916. End Sub
  917.  
  918. Sub LSling_Slingshot
  919. vpmTimer.PulseSwitch (swLSling), 0, "" : PlaySound SoundFx("SlingshotLeft",DOFContactors), 0, 1, -0.05, 0.05
  920. LSling3.Visible = 0 : LSling1.Visible = 1 : sling2.TransZ = -20 : LStep = 0 : LSling.TimerEnabled = 1
  921. End Sub
  922.  
  923. Sub LSling_Timer
  924. Select Case LStep
  925. Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.TransZ = -10
  926. Case 4:LSLing2.Visible = 0:LSling3.Visible = 1:sling2.TransZ = 0:LSling.TimerEnabled = 0
  927. End Select
  928. LStep = LStep + 1
  929. End Sub
  930.  
  931. Sub SolBallRelease(enabled)
  932. if enabled then
  933. if bsTrough.Balls then vpmTimer.PulseSwitch(swTroughEject),0,""
  934. bsTrough.ExitSol_On
  935. End if
  936. End Sub
  937.  
  938. ' *** General Illumination ***
  939.  
  940. Sub SolGIRelay(enabled)
  941. Dim Prim, Light
  942. If enabled Then
  943. PlaySound "fx_relay_off",0,relaylevel : StopSound "fx_relay_on"
  944. For Each Light in LightsGI: Light.State = LightStateOff : Next
  945. For Each Prim in primitivesGI : Prim.DisableLighting = 0 : Next
  946. For Each Prim in primitivesGIpegs : Prim.image = "peg" : Prim.material = "peg3": Next
  947. If Diner.ShowDT then rampsDT.image = "rampsoffDT" Else rampsFS.image = "rampsoffFS" End If
  948. cupprim.image = "cupoff"
  949. Else
  950. PlaySound "fx_relay_on",0,relaylevel : StopSound "fx_relay_off"
  951. For Each Light in LightsGI : Light.State = LightStateOn : Next
  952. For Each Prim in primitivesGI : Prim.DisableLighting = 1 : Next
  953. For Each Prim in primitivesGIpegs : Prim.image = "peglight" : Prim.material = "peg3light": Next
  954. If Diner.ShowDT then rampsDT.image = "rampsDT" Else rampsFS.image = "rampsFS" End If
  955. cupprim.image = "cup"
  956. End If
  957. End Sub
  958.  
  959. '*** Lighting system (mainly inserts) ***
  960.  
  961. Sub LampTimer_Timer()
  962. Dim chgLamp, ii
  963. chgLamp = Controller.ChangedLamps
  964. If Not IsEmpty(chgLamp) Then
  965. For ii = 0 To UBound(chgLamp)
  966. Select Case LightType(chgLamp(ii, 0))
  967. Case 0
  968. ' *** LightType 0 = normal insert lighting with two lights
  969. If LightObjectFirst(chgLamp(ii, 0)).state <> chgLamp(ii, 1) Then
  970. LightObjectFirst(chgLamp(ii, 0)).state = chgLamp(ii, 1) : LightObjectSecond(chgLamp(ii, 0)).state = chgLamp(ii, 1)
  971. End If
  972. Case 1
  973. ' *** LightType 1 = one object only for visible on/off
  974. If LightObjectFirst(chgLamp(ii, 0)).visible <> chgLamp(ii, 1) Then
  975. LightObjectFirst(chgLamp(ii, 0)).visible = chgLamp(ii, 1)
  976. End If
  977. Case 2
  978. ' *** LightType 2 = EAT multiple Lights
  979. If LightObjectFirst(chgLamp(ii, 0)).state <> chgLamp(ii, 1) Then
  980. LightObjectFirst(chgLamp(ii, 0)).state = chgLamp(ii, 1) : LightObjectSecond(chgLamp(ii, 0)).state = chgLamp(ii, 1)
  981. LightObjectThird(chgLamp(ii, 0)).visible = chgLamp(ii, 1)
  982. End If
  983. Case 3
  984. ' *** LightType 3 = cutout flashers (pepe, babs, boris, haji, buck)
  985. If LightObjectFirst(chgLamp(ii, 0)).state <> chgLamp(ii, 1) Then
  986. LightObjectFirst(chgLamp(ii, 0)).state = chgLamp(ii, 1) : LightObjectSecond(chgLamp(ii, 0)).state = chgLamp(ii, 1)
  987. End If
  988. LightState(chgLamp(ii, 0)) = chgLamp(ii, 1)
  989. End Select
  990. Next
  991. End If
  992. End Sub
  993.  
  994. ' *** Collection Hit Sounds ***
  995.  
  996. Sub Rubbers_Hit(idx):PlaySound "rubber11", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  997. Sub Posts_Hit(idx):PlaySound "post5", 0, Vol(ActiveBall)*10*GlobalSoundLevel , pan(ActiveBall), 0, Pitch(ActiveBall), 0, 0:End Sub
  998. Sub Wood_Hit(idx) : PlaySound "WoodHit" : End Sub
  999. Sub Metal_Hit(idx) : PlaySound "MetalHit2" : End Sub
  1000. Sub BalldropSound: PlaySound "fx_ball_drop" : End Sub
  1001. Sub Gates_hit(idx) : Playsound "gate4",0,3*GlobalSoundLevel : End Sub
  1002. Sub OnBallBallCollision(ball1, ball2, velocity) : PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, Pan(ball1), 0, Pitch(ball1), 0, 0 : End Sub
  1003. Sub Trigger1_Hit() : Stopsound "plasticrolling" : PlaySound "metalrolling", -1,GlobalSoundLevel * 0.3, 0, 0, 1, 0, 0 : End Sub
  1004. Sub LeftFlipper_Collide(parm) : PlaySound "flip_hit_1", 0, GlobalSoundLevel * parm / 50, -0.1, 0.25 : End Sub
  1005. Sub RightFlipper_Collide(parm) : PlaySound "flip_hit_1", 0, GlobalSoundLevel * parm / 50, 0.1, 0.25 : End Sub
  1006. Sub SolACSelect(enabled) : If Enabled Then PlaySound "fx_relay_on",0,GlobalSoundLevel * relaylevel : StopSound "fx_relay_off" Else PlaySound "fx_relay_off",0, GlobalSoundLevel * relaylevel : StopSound "fx_relay_on": End If : End Sub
  1007. Sub RRentrysound_hit() : If Activeball.VelY < 0 Then Playsound "plasticrolling",-1, GlobalSoundLevel * 0.05 Else Stopsound "plasticrolling" : End If : End Sub
  1008. Sub RRentrysound_UnHit() : If Activeball.VelY > 0 Then Stopsound "plasticrolling" : End If : End Sub
  1009. Sub LRentrysound_hit() : If Activeball.VelY < 0 and Ramp1.collidable Then Playsound "plasticrolling",-1, GlobalSoundLevel * 0.05 Else Stopsound "plasticrolling" : End If : End Sub
  1010. Sub LRentrysound_UnHit() : If Activeball.VelY > 0 Then Stopsound "plasticrolling" : End If : End Sub
  1011.  
  1012. ' *********************************************************************
  1013. ' Supporting Ball & Sound Functions
  1014. ' *********************************************************************
  1015.  
  1016. Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
  1017. Vol = Csng(BallVel(ball) ^2 / 10000)
  1018. End Function
  1019.  
  1020. Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
  1021. Dim tmp
  1022. tmp = ball.x * 2 / Diner.width-1
  1023. If tmp > 0 Then
  1024. Pan = Csng(tmp ^10)
  1025. Else
  1026. Pan = Csng(-((- tmp) ^10) )
  1027. End If
  1028. End Function
  1029.  
  1030. Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
  1031. Pitch = BallVel(ball) * 200
  1032. End Function
  1033.  
  1034. Function BallVel(ball) 'Calculates the ball speed
  1035. BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
  1036. End Function
  1037.  
  1038. ' *************************************************************
  1039. ' JP's VP10 Rolling Sounds
  1040. ' *************************************************************
  1041.  
  1042. Const tnob = 10 ' total number of balls
  1043. ReDim rolling(tnob)
  1044. InitRolling
  1045.  
  1046. Sub InitRolling
  1047. Dim i
  1048. For i = 0 to tnob
  1049. rolling(i) = False
  1050. Next
  1051. End Sub
  1052.  
  1053. Sub RollingUpdate()
  1054. Dim BOT, b
  1055. BOT = GetBalls
  1056.  
  1057. ' stop the sound of deleted balls
  1058. For b = UBound(BOT) + 1 to tnob
  1059. rolling(b) = False
  1060. StopSound("fx_ballrolling" & b)
  1061. If GlowBall and b <3 Then Glowing(b).state = 0 End If
  1062. Next
  1063.  
  1064. ' exit the sub if no balls on the table
  1065. If UBound(BOT) = -1 Then Exit Sub
  1066.  
  1067. ' play the rolling sound for each ball
  1068. For b = 0 to UBound(BOT)
  1069. If BallVel(BOT(b) ) > 1 and (BOT(b).z < 60 or CupExit.Enabled) Then
  1070. rolling(b) = True : PlaySound("fx_ballrolling" & b), -1, GlobalSoundLevel * Vol(BOT(b) ), Pan(BOT(b) ), 0, Pitch(BOT(b) ), 1, 0
  1071. Else
  1072. If rolling(b) = True Then StopSound("fx_ballrolling" & b) : rolling(b) = False : End If
  1073. End If
  1074. Next
  1075. End Sub
  1076.  
  1077. ' *** Ball Shadow code / Glow Ball code / Primitive Flipper Update ***
  1078.  
  1079. Dim BallShadowArray
  1080. BallShadowArray = Array (BallShadow1, BallShadow2, BallShadow3)
  1081. Const anglecompensate = 15
  1082.  
  1083. Sub GraphicsTimer_Timer()
  1084. Dim BOT, b
  1085. BOT = GetBalls
  1086.  
  1087. ' switch off glowlight for removed Balls
  1088. IF GlowBall Then
  1089. For b = UBound(BOT) + 1 to 2
  1090. If GlowBall and Glowing(b).state = 1 Then Glowing(b).state = 0 End If
  1091. Next
  1092. End If
  1093.  
  1094. For b = 0 to UBound(BOT)
  1095. ' *** move ball shadow for max 3 balls ***
  1096. If BallShadow and b < 3 Then
  1097. If BOT(b).X < Diner.Width/2 Then
  1098. BallShadowArray(b).X = ((BOT(b).X) - (50/6) + ((BOT(b).X - (Diner.Width/2))/7)) + 10
  1099. Else
  1100. BallShadowArray(b).X = ((BOT(b).X) + (50/6) + ((BOT(b).X - (Diner.Width/2))/7)) - 10
  1101. End If
  1102. BallShadowArray(b).Y = BOT(b).Y + 20 : BallShadowArray(b).Z = 1
  1103. If BOT(b).Z > 20 Then BallShadowArray(b).visible = 1 Else BallShadowArray(b).visible = 0 End If
  1104. End If
  1105. ' *** move glowball light for max 3 balls ***
  1106. If GlowBall and b < 3 Then
  1107. If Glowing(b).state = 0 Then Glowing(b).state = 1 end if
  1108. Glowing(b).BulbHaloHeight = BOT(b).z + 51
  1109. Glowing(b).x = BOT(b).x : Glowing(b).y = BOT(b).y + anglecompensate
  1110. End If
  1111. Next
  1112. If ChooseBats = 1 Then
  1113. ' *** move primitive bats ***
  1114. batleft.objrotz = LeftFlipper.CurrentAngle + 1
  1115. batright.objrotz = RightFlipper.CurrentAngle - 1
  1116. Else
  1117. If ChooseBats > 1 Then
  1118. ' *** move glowbats ***
  1119. GlowBatLightLeft.y = 1720 - 121 + LeftFlipper.CurrentAngle
  1120. glowbatleft.objrotz = LeftFlipper.CurrentAngle
  1121. GlowBatLightRight.y =1720 - 121 - RightFlipper.CurrentAngle
  1122. glowbatright.objrotz = RightFlipper.CurrentAngle
  1123. End If
  1124. End If
  1125. End Sub
Advertisement
Add Comment
Please, Sign In to add comment