Advertisement
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.1 beta2 (More proper behaviour, extra safety against script errors)
- 'Flipper / game-on Solenoid # reference
- 'Atari: Sol16
- 'Astro: ?
- 'Bally Early 80's: Sol19
- 'Bally late 80's (Blackwater 100, etc): Sol19
- 'Game Plan: Sol16
- 'Gottlieb System 1: Sol17
- 'Gottlieb System 80: No dedicated flipper solenoid? GI circuit Sol10?
- 'Gottlieb System 3: Sol32
- 'Playmatic: Sol8
- 'Spinball: Sol25
- 'Stern (80's): Sol19
- 'Taito: ?
- 'Williams System 3, 4, 6: Sol23
- 'Williams System 7: Sol25
- 'Williams System 9: Sol23
- 'Williams System 11: Sol23
- 'Bally / Williams WPC 90', 92', WPC Security: Sol31
- 'Data East (and Sega pre-whitestar): Sol23
- 'Zaccaria: ???
- '********************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... commenting out upper flippers is not necessary as of 1.1
- '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
- '...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]
- '*************************************************
- Function NullFunction(aEnabled):End Function '1 argument null function placeholder
- Class cFastFlips
- Public TiltObjects, DebugOn, hi
- Private SubL, SubUL, SubR, SubUR, FlippersEnabled, Delay, LagCompensation, Name, FlipState(3)
- Private Sub Class_Initialize()
- Delay = 0 : FlippersEnabled = False : DebugOn = False : LagCompensation = False
- Set SubL = GetRef("NullFunction"): Set SubR = GetRef("NullFunction") : Set SubUL = GetRef("NullFunction"): Set SubUR = GetRef("NullFunction")
- End Sub
- 'set callbacks
- Public Property Let CallBackL(aInput) : Set SubL = GetRef(aInput) : Decouple sLLFlipper, aInput: End Property
- Public Property Let CallBackUL(aInput) : Set SubUL = GetRef(aInput) : End Property
- Public Property Let CallBackR(aInput) : Set SubR = GetRef(aInput) : Decouple sLRFlipper, 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
- 'Automatically decouple flipper solcallback script lines (only if both are pointing to the same sub) thanks gtxjoe
- Private Sub Decouple(aSolType, aInput) : If StrComp(SolCallback(aSolType),aInput,1) = 0 then SolCallback(aSolType) = Empty End If : End Sub
- 'call callbacks
- Public Sub FlipL(aEnabled)
- FlipState(0) = aEnabled 'track flipper button states: the game-on sol flips immediately if the button is held down (1.1)
- If not FlippersEnabled and not DebugOn then Exit Sub
- subL aEnabled
- End Sub
- Public Sub FlipR(aEnabled)
- FlipState(1) = aEnabled
- If not FlippersEnabled and not DebugOn then Exit Sub
- subR aEnabled
- End Sub
- Public Sub FlipUL(aEnabled)
- FlipState(2) = aEnabled
- If not FlippersEnabled and not DebugOn then Exit Sub
- subUL aEnabled
- End Sub
- Public Sub FlipUR(aEnabled)
- FlipState(3) = 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)
- If aEnabled then SubL FlipState(0) : SubR FlipState(1) : subUL FlipState(2) : subUR FlipState(3)
- 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
Advertisement