Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'cFastFlips by nFozzy
- 'Bypasses pinmame callback for faster and more responsive flippers
- 'Version 1.0
- 'Flipper / game-on Solenoid # reference (incomplete):
- 'Williams System 11: Sol23 or 24
- 'Gottlieb System 3: Sol32
- 'Data East (pre-whitestar): Sol23 or 24
- 'WPC 90', 92', WPC Security: Sol31
- '********************Setup*******************:
- '....somewhere outside of any subs....
- 'dim FastFlips
- '....table init....
- 'Set FastFlips = new cFastFlips
- 'with FastFlips
- ' .CallBackL = "SolLflipper" 'Point these to flipper subs
- ' .CallBackR = "SolRflipper" '...
- '' .CallBackUL = "SolULflipper"'...(upper flippers, if needed)
- '' .CallBackUR = "SolURflipper"'...
- '' .TiltObjects = True 'Optional, if True calls vpmnudge.solgameon automatically. IF YOU GET A LINE 1 ERROR, DISABLE THIS! (or setup vpmNudge.TiltObj!)
- '' .InitDelay "FastFlips", 100 'Optional, if > 0 adds some compensation for solenoid jitter (occasional problem on Bram Stoker's Dracula)
- '' .DebugOn = False 'Debug, always-on flippers. Call FastFlips.DebugOn True or False in debugger to enable/disable.
- 'end with
- '...keydown section... (comment out the upper flippers as needed)
- 'If KeyCode = LeftFlipperKey then FastFlips.FlipL True : FastFlips.FlipUL True
- 'If KeyCode = RightFlipperKey then FastFlips.FlipR True : FastFlips.FlipUR True
- '(Do not use Exit Sub, this script does not handle switch handling at all!)
- '...keyUp section...
- 'If KeyCode = LeftFlipperKey then FastFlips.FlipL False : FastFlips.FlipUL False
- 'If KeyCode = RightFlipperKey then FastFlips.FlipR False : FastFlips.FlipUR False
- '...Flipper Callbacks....
- 'if pinmame flipper callbacks are in use, comment them out. For example 'SolCallback(sLRFlipper)
- 'But use these subs (they should be the same ones defined in CallBackL / CallBackR) to handle flipper rotation and sounds!
- '...Solenoid...
- 'SolCallBack(31) = "FastFlips.TiltSol"
- '//////for a reference of solenoid numbers, see top /////
- 'One last note - Because this script is super simple it will call flipper return a lot.
- 'It might be a good idea to add extra conditional logic to your flipper return sounds so they don't play every time the game on solenoid turns off
- 'Example:
- 'Instead of
- 'LeftFlipper.RotateToStart
- 'playsound SoundFX("FlipperDown",DOFFlippers), 0, 1, 0.01 'return
- 'Add Extra conditional logic:
- 'LeftFlipper.RotateToStart
- 'if LeftFlipper.CurrentAngle = LeftFlipper.StartAngle then
- ' playsound SoundFX("FlipperDown",DOFFlippers), 0, 1, 0.01 'return
- 'end if
- 'That's it]
- '*************************************************
- Class cFastFlips
- Public TiltObjects, DebugOn
- Private SubL, SubUL, SubR, SubUR, FlippersEnabled, Delay, LagCompensation, Name
- Private Sub Class_Initialize()
- Delay = 0 : FlippersEnabled = False : DebugOn = False : LagCompensation = False
- End Sub
- 'set callbacks
- Public Property Let CallBackL(aInput) : Set SubL = GetRef(aInput) : End Property
- Public Property Let CallBackUL(aInput) : Set SubUL = GetRef(aInput) : End Property
- Public Property Let CallBackR(aInput) : Set SubR = GetRef(aInput) : End Property
- Public Property Let CallBackUR(aInput) : Set SubUR = GetRef(aInput) : End Property
- Public Sub InitDelay(aName, aDelay) : Name = aName : delay = aDelay : End Sub 'Create Delay
- 'call callbacks
- Public Sub FlipL(aEnabled)
- if not FlippersEnabled and not DebugOn then Exit Sub
- subL aEnabled
- End Sub
- Public Sub FlipR(aEnabled)
- if not FlippersEnabled and not DebugOn then Exit Sub
- subR aEnabled
- End Sub
- Public Sub FlipUL(aEnabled)
- if not FlippersEnabled and not DebugOn then Exit Sub
- subUL aEnabled
- End Sub
- Public Sub FlipUR(aEnabled)
- if not FlippersEnabled and not DebugOn then Exit Sub
- subUR aEnabled
- End Sub
- Public Sub TiltSol(aEnabled) 'Handle solenoid / Delay (if delayinit)
- if delay > 0 and not aEnabled then 'handle delay
- vpmtimer.addtimer Delay, Name & ".FireDelay" & "'"
- LagCompensation = True
- else
- if Delay > 0 then LagCompensation = False
- EnableFlippers(aEnabled)
- end if
- End Sub
- Sub FireDelay() : if LagCompensation then EnableFlippers False End If : End Sub
- Private Sub EnableFlippers(aEnabled)
- FlippersEnabled = aEnabled
- if TiltObjects then vpmnudge.solgameon aEnabled
- If Not aEnabled then
- subL False
- subR False
- if not IsEmpty(subUL) then subUL False
- if not IsEmpty(subUR) then subUR False
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment