Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Randomize
- On Error Resume Next
- ExecuteGlobal GetTextFile("controller.vbs")
- If Err Then MsgBox "You need the Controller.vbs file in order to run this table (installed with the VPX package in the scripts folder)"
- On Error Goto 0
- LoadVPM "01120100","sys80.vbs",3.36
- Dim bsTrough,gsTrough,FlipperShadows,dtYellow,dtBlue,bsSaucer,xx
- FlipperShadows = 1 ' 1 turns on, 0 turns off flipper shadows.
- Const UseSolenoids=2,UseLamps=1,UseSync=0,UseGI=0,HandleMech=0,SSolenoidOn="SolOn",SSolenoidOff="SolOff",SFlipperOn="FlipperUp",SFlipperOff="FlipperDown"
- Const cGameName="rackemup"
- Const SCoin="fx_coin"
- Const shooter=2'ok
- Const sdtBlue=5'ok 3 bank targets
- Const sdtYellow=6'ok 4 bank targets
- Const sCoin1=3'ok
- Const sCoin2=4'ok
- Const sCoin3=7'ok
- Const sknocker=8
- Const sOutHole=9'ok
- Const swCaptiveBack=64
- SolCallback(shooter)="bssaucer.solout"
- SolCallback(sdtYellow)="dtYellow.SolDropUp"
- SolCallback(sdtBlue)="dtBlue.SolDropUp"
- SolCallback(sKnocker)="VpmSolSound SoundFX(""knocker"",DOFKnocker),"
- SolCallback(sOutHole)="bsTrough.SolOut"
- SolCallback(sLLFlipper)="SolLFlipper"
- SolCallback(sLRFlipper)="SolRFlipper"
- Sub SolLFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("flipperup2", DOFFlippers), 0, 1, -0.1, 0.05
- LeftFlipper.RotateToEnd
- Else
- PlaySound SoundFX("flipperdown2", DOFFlippers), 0, 1, -0.1, 0.05
- LeftFlipper.RotateToStart
- End If
- End Sub
- Sub SolRFlipper(Enabled)
- If Enabled Then
- PlaySound SoundFX("flipperup2", DOFFlippers), 0, 1, 0.1, 0.05
- RightFlipper.RotateToEnd
- Else
- PlaySound SoundFX("flipperdown2", DOFFlippers), 0, 1, 0.1, 0.05
- RightFlipper.RotateToStart
- End If
- End Sub
- '***********************************************************************
- 'Hidden elements
- '***********************************************************************
- Dim DesktopMode: DesktopMode = Table1.ShowDT
- If DesktopMode = True Then 'Show Desktop components
- Ramp16.visible=1
- Ramp15.visible=1
- Ramp17.visible=1
- Primitive52.visible=1
- Tornillo24.visible=1
- Tornillo25.visible=1
- Tornillo26.visible=1
- Tornillo27.visible=1
- L3b.visible=1
- L10.visible=1
- L11.visible=1
- Else
- Ramp16.visible=0
- Ramp15.visible=0
- Ramp17.visible=0
- Primitive52.visible=0
- Tornillo24.visible=0
- Tornillo25.visible=0
- Tornillo26.visible=0
- Tornillo27.visible=0
- L3b.visible=0
- L10.visible=0
- L11.visible=0
- End if
- '********************************************************************
- 'Table Init
- '********************************************************************
- Sub Table1_Init
- vpmInit me
- With Controller
- .GameName = cGameName
- If Err Then MsgBox "Can't start Game" & cGameName & vbNewLine & Err.Description:Exit Sub
- .SplashInfoLine = "Rack Em Up (Gottlieb 1983)" & vbNewLine & "VPX Table By Kalavera"
- .HandleKeyboard = 0
- .ShowTitle = 0
- .ShowDMDOnly = 1
- .ShowFrame = 0
- .HandleMechanics = 0
- .Hidden = 0
- .Games(cGameName).Settings.Value("rol") = 0 '1= rotated display, 0= normal
- '.SetDisplayPosition 0,0, GetPlayerHWnd 'restore dmd window position
- On Error Resume Next
- Controller.SolMask(0) = 0
- vpmTimer.AddTimer 2000, "Controller.SolMask(0)=&Hffffffff'" 'ignore all solenoids - then add the Timer to renable all the solenoids after 2 seconds
- Controller.Run GetPlayerHWnd
- On Error Goto 0
- End With
- 'Nudging
- vpmNudge.TiltSwitch = 57
- vpmNudge.Sensitivity = 3
- vpmNudge.TiltObj = Array(Bumper1,Bumper2,Bumper3,LeftSlingshot,RightSlingshot)
- 'Main Timer init
- PinMAMETimer.Interval = PinMAMEInterval
- PinMAMETimer.Enabled = 1
- 'Add a Ball
- Set bsTrough=New cvpmBallStack
- bsTrough.InitSw 0,67,0,0,0,0,0,0
- bsTrough.InitKick BallRelease,62,8
- bsTrough.InitExitSnd SoundFX("Ballrelease",DOFContactors),SoundFX("SolOn",DOFContactors)
- bsTrough.Balls=1
- 'drop targets
- Set dtBlue=New cvpmDropTarget
- dtBlue.InitDrop Array(SW41,SW51,SW61),Array(41,51,61)
- dtBlue.InitSnd SoundFX("", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
- dtBlue.CreateEvents "dtBlue"
- Set dtYellow=New cvpmDropTarget
- dtYellow.InitDrop Array(SW40,SW50,SW60,SW70),Array(40,50,60,70)
- dtYellow.InitSnd SoundFX("", DOFDropTargets), SoundFX("fx_resetdrop", DOFContactors)
- dtYellow.CreateEvents "dtYellow"
- 'Kicker
- Set bsSaucer=New cvpmBallStack
- bsSaucer.InitSaucer SW65,65,0,42
- bsSaucer.InitExitSnd SoundFX("fx_popper",DOFContactors), SoundFX("fx_Solenoid",DOFContactors)
- bsSaucer.KickForceVar=7
- End Sub
- Sub Table1_KeyDown(ByVal keycode)
- If keycode=RightFlipperKey then Controller.Switch(71)=1
- If keycode = LeftTiltKey Then Nudge 90, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, -0.1, 0.25
- If keycode = RightTiltKey Then Nudge 270, 5:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0.1, 0.25
- If keycode = CenterTiltKey Then Nudge 0, 6:PlaySound SoundFX("fx_nudge", 0), 0, 1, 0, 0.25
- If keycode = PlungerKey Then Plunger.PullBack: PlaySound "fx_plungerpull",0,1,0.25,0.25
- If vpmKeyDown(keycode)Then Exit Sub
- End Sub
- Sub Table1_KeyUp(ByVal keycode)
- If keycode=RightFlipperKey then Controller.Switch(71)=0
- If keycode = PlungerKey Then Plunger.Fire: PlaySound "fx_plunger",0,1,0.25,0.25
- If vpmKeyUp(keycode)Then Exit Sub
- End Sub
- '***********************************************************************
- 'Switchs
- '***********************************************************************
- Dim Kick1
- ' Drain hole
- Sub Drain_Hit:Playsound "drain":bsTrough.AddBall Me:End Sub
- 'Rubbers
- Sub SW16_Hit:vpmTimer.PulseSw(16):End Sub'rebound
- Sub SW16B_Hit:vpmTimer.PulseSw(16):End Sub'rebound
- 'StandUp Targets
- Sub SW55_Hit:vpmTimer.PulseSw(55):End Sub'single target
- ' Saucers
- Sub SW65_Hit:bsSaucer.AddBall 0 : playsound "fx_kicker4": End Sub
- 'spinners
- Sub Spinner_Spin:vpmTimer.PulseSw(64):PlaySound "fx_spinner", 0, 1, 0.05:End Sub
- ' Droptargets (only sound effect)
- Sub sw40_Hit:PlaySound SoundFX("drop", DOFDropTargets), 0, 1, pan(ActiveBall):End Sub
- Sub sw41_Hit:PlaySound SoundFX("drop", DOFDropTargets), 0, 1, pan(ActiveBall):End Sub
- Sub sw50_Hit:PlaySound SoundFX("drop", DOFDropTargets), 0, 1, pan(ActiveBall):End Sub
- Sub sw51_Hit:PlaySound SoundFX("drop", DOFDropTargets), 0, 1, pan(ActiveBall):End Sub
- Sub sw60_Hit:PlaySound SoundFX("drop", DOFDropTargets), 0, 1, pan(ActiveBall):End Sub
- Sub sw61_Hit:PlaySound SoundFX("drop", DOFDropTargets), 0, 1, pan(ActiveBall):End Sub
- Sub sw70_Hit:PlaySound SoundFX("drop", DOFDropTargets), 0, 1, pan(ActiveBall):End Sub
- 'Wire Triggers
- Sub sw42_Hit:Controller.Switch(42)=1:End Sub '#1 top rollover
- Sub sw42_UnHit:Controller.Switch(42)=0:End Sub '
- Sub sw43_Hit:Controller.Switch(43)=1:End Sub 'Left Side rollover
- Sub sw43_UnHit:Controller.Switch(43)=0:End Sub '
- Sub sw44_Hit:Controller.Switch(44)=1:End Sub 'Right return rollover
- Sub sw44_UnHit:Controller.Switch(44)=0:End Sub '
- Sub sw45_Hit:Controller.Switch(45)=1:End Sub 'Left outside rollover
- Sub sw45_unHit:Controller.Switch(45)=0:End Sub '
- Sub sw52_Hit:Controller.Switch(52)=1:DOF 104, DOFOn:End Sub '#2 top rollover
- Sub sw52_UnHit:Controller.Switch(52)=0:DOF 104, DOFOff:End Sub '
- Sub sw53_Hit:Controller.Switch(53)=1:End Sub 'Right side rollover
- Sub sw53_UnHit:Controller.Switch(53)=0:End Sub '
- Sub sw54_Hit:Controller.Switch(54)=1:End Sub 'Right outside rollover
- Sub sw54_UnHit:Controller.Switch(54)=0:End Sub '
- Sub sw62_Hit:Controller.Switch(62)=1:End Sub '#3 top rollover
- Sub sw62_unHit:Controller.Switch(62)=0:End Sub '
- Sub sw72_Hit:Controller.Switch(72)=1:End Sub '#4 top rollover
- Sub sw72_unHit:Controller.Switch(72)=0:End Sub '
- Sub sw74_Hit:Controller.Switch(74)=1:End Sub 'Left outside rollover
- Sub sw74_unHit:Controller.Switch(74)=0:End Sub '
- Sub sw75_Hit:Controller.Switch(75)=1:End Sub 'Left inside rollover
- Sub sw75_unHit:Controller.Switch(75)=0:End Sub '
- 'Bumpers
- Sub Bumper1_Hit:vpmTimer.PulseSw(52):PlaySound SoundFX("fx_bumper5", DOFContactors): DOF 101, DOFPulse: End Sub
- Sub Bumper2_Hit:vpmTimer.PulseSw(52):PlaySound SoundFX("fx_bumper5", DOFContactors): DOF 103, DOFPulse: End Sub
- Sub Bumper3_Hit:vpmTimer.PulseSw(52):PlaySound SoundFX("fx_bumper5", DOFContactors): DOF 102, DOFPulse: End Sub
- '***********************************************************************
- 'GI Lights On
- '***********************************************************************
- Sub Encendido_timer
- playsound "encendido"
- For each xx in Ambiente:xx.State = 1: Next
- me.enabled=false
- End Sub
- '**********************************************************************
- 'Pause and Exit
- '**********************************************************************
- Sub Table1_Paused:Controller.Pause = 1:End Sub
- Sub Table1_unPaused:Controller.Pause = 0:End Sub
- Sub Table1_exit:Controller.stop:End Sub
- '************************************************************************
- 'Lights
- '************************************************************************
- Lights(3)=Array(L3,L3b) 'Shoot Again
- Set Lights(4)=L4 '3x multiplier
- Set Lights(5)=L5 '5x mult
- Set Lights(6)=L6 '10x mult
- Set Lights(7)=L7 'spinner
- Set Lights(8)=L8 'special
- Set Lights(10)=L10 'High score
- Set Lights(11)=L11 'Game Over
- Lights(12)=Array(L12,L12b) '#1 target and rollover
- Lights(13)=Array(L13,L13b) '#2 target and rollover
- Lights(14)=Array(L14,L14b) '#3 target and rollover
- Lights(15)=Array(L15,L15b) '#4 target and rollover
- Lights(16)=Array(L16,L16b) '#5 target and rollover
- Lights(17)=Array(L17,L17b) '#6 target and rollover
- Lights(18)=Array(L18,L18b) '#7 target and rollover
- Lights(19)=Array(L19,L19b) '#9 target and rollover
- Lights(20)=Array(L20,L20b) '#10 target and rollover
- Lights(21)=Array(L21,L21b) '#11 target and rollover
- Lights(22)=Array(L22,L22b) '#12 target and rollover
- Lights(23)=Array(L23,L23b) '#13 target and rollover
- Lights(24)=Array(L24,L24b) '#14 target and rollover
- Lights(25)=Array(L25,L25b) '#15 target and rollover
- Set Lights(26)=L26 '#1 rack
- Set Lights(27)=L27 '#2 rack
- Set Lights(28)=L28 '#3 rack
- Set Lights(29)=L29 '#4 rack
- Set Lights(30)=L30 '#5 rack
- Set Lights(31)=L31 '#6 rack
- Set Lights(32)=L32 '#7 rack
- Set Lights(33)=L33 '#8 rack
- Set Lights(34)=L34 '#9 rack
- Set Lights(35)=L35 '#10 rack
- Set Lights(36)=L36 '#11 rack
- Set Lights(37)=L37 '#12 rack
- Set Lights(38)=L38 '#13 rack
- Set Lights(39)=L39 '#14 rack
- Set Lights(40)=L40 '#15 rack
- Set Lights(41)=L41 '#8 Shooter
- Set Lights(42)=L42 '#1 rack
- Set Lights(43)=L43 '#2 rack complete
- Set Lights(44)=L44 'Spot target extra ball
- Set Lights(45)=L45 'Spot target spinner
- Set Lights(46)=L46 'Spot target solid
- Set Lights(47)=L47 'Spot target stripes
- '**********************************************************************************************************
- 'Digital Display
- '**********************************************************************************************************
- Dim Digits(32)
- ' 1st Player
- Digits(0) = Array(LED142,LED143,LED147,LED146,LED145,LED141,LED144,PIN,LED148)
- Digits(1) = Array(LED10,LED11,LED12,LED13,LED14,LED15,LED16,PIN,LED74)
- Digits(2) = Array(LED20,LED21,LED22,LED23,LED24,LED25,LED26,PIN,LED75)
- Digits(3) = Array(LED30,LED31,LED32,LED33,LED34,LED35,LED36,PIN,LED76)
- Digits(4) = Array(LED40,LED41,LED42,LED43,LED44,LED45,LED46,PIN,LED78)
- Digits(5) = Array(LED50,LED51,LED52,LED53,LED54,LED55,LED56,PIN,LED79)
- Digits(6) = Array(LED60,LED61,LED62,LED63,LED64,LED65,LED66,PIN,LED87)
- ' 2nd Player
- Digits(7) = Array(LED149,LED157,LED168,LED167,LED159,LED169,LED158,PIN,LED177)
- Digits(8) = Array(LED80,LED81,LED82,LED83,LED84,LED85,LED86,PIN,LED88)
- Digits(9) = Array(LED90,LED91,LED92,LED93,LED94,LED95,LED96,PIN,LED89)
- Digits(10) = Array(LED100,LED101,LED102,LED103,LED104,LED105,LED106,PIN,LED97)
- Digits(11) = Array(LED110,LED111,LED112,LED113,LED114,LED115,LED116,PIN,LED98)
- Digits(12) = Array(LED120,LED121,LED122,LED123,LED124,LED125,LED126,PIN,LED99)
- Digits(13) = Array(LED130,LED131,LED132,LED133,LED134,LED135,LED136,PIN,LED107)
- ' 3rd Player
- Digits(14) = Array(LED178,LED179,LED197,LED189,LED188,LED198,LED187,PIN,LED199)
- Digits(15) = Array(LED150,LED151,LED152,LED153,LED154,LED155,LED156,PIN,LED108)
- Digits(16) = Array(LED160,LED161,LED162,LED163,LED164,LED165,LED166,PIN,LED109)
- Digits(17) = Array(LED170,LED171,LED172,LED173,LED174,LED175,LED176,PIN,LED117)
- Digits(18) = Array(LED180,LED181,LED182,LED183,LED184,LED185,LED186,PIN,LED118)
- Digits(19) = Array(LED190,LED191,LED192,LED193,LED194,LED195,LED196,PIN,LED119)
- Digits(20) = Array(LED200,LED201,LED202,LED203,LED204,LED205,LED206,PIN,LED127)
- ' 4th Player
- Digits(21) = Array(LED207,LED208,LED212,LED211,LED210,LED213,LED209,PIN,LED214)
- Digits(22) = Array(LED220,LED221,LED222,LED223,LED224,LED225,LED226,PIN,LED128)
- Digits(23) = Array(LED230,LED231,LED232,LED233,LED234,LED235,LED236,PIN,LED129)
- Digits(24) = Array(LED240,LED241,LED242,LED243,LED244,LED245,LED246,PIN,LED137)
- Digits(25) = Array(LED250,LED251,LED252,LED253,LED254,LED255,LED256,PIN,LED138)
- Digits(26) = Array(LED260,LED261,LED262,LED263,LED264,LED265,LED266,PIN,LED139)
- Digits(27) = Array(LED270,LED271,LED272,LED273,LED274,LED275,LED276,PIN,LED140)
- ' Credits
- Digits(28) = Array(LED4,LED2,LED6,LED7,LED5,LED1,LED3,PIN,LED70)
- Digits(29) = Array(LED18,LED9,LED27,LED28,LED19,LED8,LED17,PIN,LED71)
- ' Balls
- Digits(30) = Array(LED39,LED37,LED48,LED49,LED47,LED29,LED38,PIN,LED72)
- Digits(31) = Array(LED67,LED58,LED69,LED77,LED68,LED57,LED59,PIN,LED73)
- Sub DisplayTimer_Timer
- Dim ChgLED,ii,num,chg,stat,obj
- ChgLed = Controller.ChangedLEDs(&Hffffffff, &Hffffffff)
- If Not IsEmpty(ChgLED) Then
- If DesktopMode = True Then
- For ii = 0 To UBound(chgLED)
- num = chgLED(ii, 0) : chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
- if (num < 37) then
- For Each obj In Digits(num)
- If chg And 1 Then obj.State = stat And 1
- chg = chg\2 : stat = stat\2
- Next
- else
- end if
- next
- end if
- end if
- End Sub
- '************************************************************************
- 'Gate Init ball
- '************************************************************************
- Sub Entrada_Hit()
- If ActiveBall.VelY<0 Then
- DivDir = -1
- PuertaCerrada.IsDropped=1
- PuertaAbierta.IsDropped=0
- End If
- End Sub
- Sub Retorno_Hit()
- DivDir = 1
- PuertaCerrada.IsDropped=0
- PuertaAbierta.IsDropped=1
- End Sub
- Sub Salida_Hit()
- DivDir = 1
- PuertaCerrada.IsDropped=0
- PuertaAbierta.IsDropped=1
- End Sub
- Dim DivDir: DivDir=0
- Dim DivPos: DivPos = 359
- Sub UpdateDiverter_Timer
- DivPos = DivPos + DivDir
- If DivPos >= 359 then DivPos = 359:DivDir = 0
- If DivPos <= 340 then DivPos = 340:DivDir = 0
- Puerta.ObjRotZ = DivPos
- End Sub
- '**********Sling Shot Animations
- ' Rstep and Lstep are the variables that increment the animation
- '****************
- Dim RStep, Lstep
- Sub RightSlingShot_Slingshot
- PlaySound SoundFX("right_slingshot",DOFContactors), 0,1, 0.05,0.05 '0,1, AudioPan(RightSlingShot), 0.05,0,0,1,AudioFade(RightSlingShot)
- DOF 106, DOFPulse
- RSling.Visible = 0
- RSling1.Visible = 1
- sling1.rotx = 20
- RStep = 0
- vpmTimer.PulseSw(73)
- RightSlingShot.TimerEnabled = 1
- End Sub
- Sub RightSlingShot_Timer
- Select Case RStep
- Case 3:RSLing1.Visible = 0:RSLing2.Visible = 1:sling1.rotx = 10
- Case 4:RSLing2.Visible = 0:RSLing.Visible = 1:sling1.rotx = 0:RightSlingShot.TimerEnabled = 0
- End Select
- RStep = RStep + 1
- End Sub
- Sub LeftSlingShot_Slingshot
- PlaySound SoundFX("left_slingshot",DOFContactors), 0,1, -0.05,0.05 '0,1, AudioPan(LeftSlingShot), 0.05,0,0,1,AudioFade(LeftSlingShot)
- DOF 105, DOFPulse
- LSling.Visible = 0
- LSling1.Visible = 1
- sling2.rotx = 20
- LStep = 0
- vpmTimer.PulseSw(73)
- LeftSlingShot.TimerEnabled = 1
- End Sub
- Sub LeftSlingShot_Timer
- Select Case LStep
- Case 3:LSLing1.Visible = 0:LSLing2.Visible = 1:sling2.rotx = 10
- Case 4:LSLing2.Visible = 0:LSLing.Visible = 1:sling2.rotx = 0:LeftSlingShot.TimerEnabled = 0
- End Select
- LStep = LStep + 1
- End Sub
- '*********************************************************************
- ' Positional Sound Playback Functions
- '*********************************************************************
- ' Play a sound, depending on the X,Y position of the table element (especially cool for surround speaker setups, otherwise stereo panning only)
- ' parameters (defaults): loopcount (1), volume (1), randompitch (0), pitch (0), useexisting (0), restart (1))
- ' Note that this will not work (currently) for walls/slingshots as these do not feature a simple, single X,Y position
- Sub PlayXYSound(soundname, tableobj, loopcount, volume, randompitch, pitch, useexisting, restart)
- PlaySound soundname, loopcount, volume, AudioPan(tableobj), randompitch, pitch, useexisting, restart, AudioFade(tableobj)
- End Sub
- ' Similar subroutines that are less complicated to use (e.g. simply use standard parameters for the PlaySound call)
- Sub PlaySoundAt(soundname, tableobj)
- PlaySound soundname, 1, 1, AudioPan(tableobj), 0,0,0, 1, AudioFade(tableobj)
- End Sub
- Sub PlaySoundAtBall(soundname)
- PlaySoundAt soundname, ActiveBall
- End Sub
- '*********************************************************************
- ' Supporting Ball & Sound Functions
- '*********************************************************************
- 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
- Dim tmp
- tmp = tableobj.y * 2 / table1.height-1
- If tmp > 0 Then
- AudioFade = Csng(tmp ^10)
- Else
- AudioFade = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function Pan(ball) ' Calculates the pan for a ball based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = ball.x * 2 / Table1.width-1
- If tmp > 0 Then
- Pan = Csng(tmp ^10)
- Else
- Pan = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function AudioPan(tableobj) ' Calculates the pan for a tableobj based on the X position on the table. "table1" is the name of the table
- Dim tmp
- tmp = tableobj.x * 2 / table1.width-1
- If tmp > 0 Then
- AudioPan = Csng(tmp ^10)
- Else
- AudioPan = Csng(-((- tmp) ^10) )
- End If
- End Function
- Function Vol(ball) ' Calculates the Volume of the sound based on the ball speed
- Vol = Csng(BallVel(ball) ^2 / 150)
- End Function
- Function Pitch(ball) ' Calculates the pitch of the sound based on the ball speed
- Pitch = BallVel(ball) * 20
- End Function
- Function BallVel(ball) 'Calculates the ball speed
- BallVel = INT(SQR((ball.VelX ^2) + (ball.VelY ^2) ) )
- End Function
- '*****************************************
- ' JP's VP10 Rolling Sounds
- '*****************************************
- Const tnob = 1 ' total number of balls
- ReDim rolling(tnob)
- InitRolling
- Sub InitRolling
- Dim i
- For i = 0 to tnob
- rolling(i) = False
- Next
- End Sub
- Sub RollingTimer_Timer()
- Dim BOT, b
- BOT = GetBalls
- ' stop the sound of deleted balls
- For b = UBound(BOT) + 1 to tnob
- rolling(b) = False
- StopSound("fx_ballrolling" & b)
- Next
- ' exit the sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' play the rolling sound for each ball
- For b = 0 to UBound(BOT)
- If BallVel(BOT(b) ) > 1 AND BOT(b).z < 30 Then
- rolling(b) = True
- PlaySound("fx_ballrolling" & b), -1, Vol(BOT(b)), AudioPan(BOT(b)), 0, Pitch(BOT(b)), 1, 0, AudioFade(BOT(b))
- Else
- If rolling(b) = True Then
- StopSound("fx_ballrolling" & b)
- rolling(b) = False
- End If
- End If
- Next
- End Sub
- '**********************
- ' Ball Collision Sound
- '**********************
- Sub OnBallBallCollision(ball1, ball2, velocity)
- PlaySound("fx_collide"), 0, Csng(velocity) ^2 / 2000, AudioPan(ball1), 0, Pitch(ball1), 0, 0, AudioFade(ball1)
- End Sub
- '*****************************************
- ' ninuzzu's FLIPPER SHADOWS
- '*****************************************
- sub FlipperTimer_Timer()
- FlipperLSh.RotZ = LeftFlipper.currentangle
- FlipperRSh.RotZ = RightFlipper.currentangle
- Flipperizq.rotz=leftFlipper.CurrentAngle +240
- Flipperder.rotz=rightFlipper.CurrentAngle +120
- End Sub
- '*****************************************
- ' ninuzzu's BALL SHADOW
- '*****************************************
- Dim BallShadow
- BallShadow = Array (BallShadow1,BallShadow2,BallShadow3,BallShadow4,BallShadow5)
- Sub BallShadowUpdate_timer()
- Dim BOT, b
- BOT = GetBalls
- ' hide shadow of deleted balls
- If UBound(BOT)<(tnob-1) Then
- For b = (UBound(BOT) + 1) to (tnob-1)
- BallShadow(b).visible = 0
- Next
- End If
- ' exit the Sub if no balls on the table
- If UBound(BOT) = -1 Then Exit Sub
- ' render the shadow for each ball
- For b = 0 to UBound(BOT)
- If BOT(b).X < Table1.Width/2 Then
- BallShadow(b).X = ((BOT(b).X) - (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) + 6
- Else
- BallShadow(b).X = ((BOT(b).X) + (Ballsize/6) + ((BOT(b).X - (Table1.Width/2))/7)) - 6
- End If
- ballShadow(b).Y = BOT(b).Y + 12
- If BOT(b).Z > 20 Then
- BallShadow(b).visible = 1
- Else
- BallShadow(b).visible = 0
- End If
- Next
- End Sub
- '************************************
- ' What you need to add to your table
- '************************************
- ' a timer called RollingTimer. With a fast interval, like 10
- ' one collision sound, in this script is called fx_collide
- ' as many sound files as max number of balls, with names ending with 0, 1, 2, 3, etc
- ' for ex. as used in this script: fx_ballrolling0, fx_ballrolling1, fx_ballrolling2, fx_ballrolling3, etc
- '******************************************
- ' Explanation of the rolling sound routine
- '******************************************
- ' sounds are played based on the ball speed and position
- ' the routine checks first for deleted balls and stops the rolling sound.
- ' The For loop goes through all the balls on the table and checks for the ball speed and
- ' if the ball is on the table (height lower than 30) then then it plays the sound
- ' otherwise the sound is stopped, like when the ball has stopped or is on a ramp or flying.
- ' The sound is played using the VOL, AUDIOPAN, AUDIOFADE and PITCH functions, so the volume and pitch of the sound
- ' will change according to the ball speed, and the AUDIOPAN & AUDIOFADE functions will change the stereo position
- ' according to the position of the ball on the table.
- '**************************************
- ' Explanation of the collision routine
- '**************************************
- ' The collision is built in VP.
- ' You only need to add a Sub OnBallBallCollision(ball1, ball2, velocity) and when two balls collide they
- ' 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
- ' depending of the speed of the collision.
- Sub Pins_Hit (idx)
- PlaySound "pinhit_low", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Madera_Hit (idx)
- PlaySound "fx_woodhit", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Plastico_Hit (idx)
- PlaySound "fx_plastichit", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Targets_Hit (idx)
- PlaySound "target", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 0, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Thin_Hit (idx)
- PlaySound "metalhit_thin", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals_Medium_Hit (idx)
- PlaySound "metalhit_medium", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Metals2_Hit (idx)
- PlaySound "metalhit2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Gates_Hit (idx)
- PlaySound "gate4", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Sub
- Sub Rubbers_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 20 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 20 then
- RandomSoundRubber()
- End If
- End Sub
- Sub Posts_Hit(idx)
- dim finalspeed
- finalspeed=SQR(activeball.velx * activeball.velx + activeball.vely * activeball.vely)
- If finalspeed > 16 then
- PlaySound "fx_rubber2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End if
- If finalspeed >= 6 AND finalspeed <= 16 then
- RandomSoundRubber()
- End If
- End Sub
- Sub RandomSoundRubber()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "rubber_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "rubber_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "rubber_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub LeftFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RightFlipper_Collide(parm)
- RandomSoundFlipper()
- End Sub
- Sub RandomSoundFlipper()
- Select Case Int(Rnd*3)+1
- Case 1 : PlaySound "flip_hit_1", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 2 : PlaySound "flip_hit_2", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- Case 3 : PlaySound "flip_hit_3", 0, Vol(ActiveBall), AudioPan(ActiveBall), 0, Pitch(ActiveBall), 1, 0, AudioFade(ActiveBall)
- End Select
- End Sub
- Sub editDips
- Dim vpmDips : Set vpmDips = New cvpmDips
- With vpmDips
- .AddForm 700,400,"Rack em up - DIP switches"
- .AddFrame 2,5,190,"Maximum credits",49152,Array("8 credits",0,"10 credits",32768,"15 credits",&H00004000,"25 credits",49152)'dip 15&16
- .AddFrame 2,81,190,"Coin chute 1 and 2 control",&H00002000,Array("seperate",0,"same",&H00002000)'dip 14
- .AddFrame 2,127,190,"Playfield special",&H00200000,Array("replay",0,"extra ball",&H00200000)'dip 22
- .AddFrame 2,173,190,"3rd coin chute credits control",&H20000000,Array("no effect",0,"add 9",&H20000000)'dip 30
- .AddFrameExtra 2,219,190,"Attract tune",&H0200,Array("no attract tune",0,"attract tune played every 6 minutes",&H0200)'S-board dip 2
- .AddChk 2,270,190,Array("Match feature",&H02000000)'dip 26
- .AddChkExtra 2,290,190,Array("Sound test enable",&H0100)'S-board dip 1
- .AddFrame 205,5,190,"High game to date awards",&H00C00000,Array("not displayed and no award",0,"displayed and no award",&H00800000,"displayed and 2 credits",&H00400000,"displayed and 3 credits",&H00C00000)'dip 23&24
- .AddFrame 205,81,190,"Balls per game",&H01000000,Array("5 balls",0,"3 balls",&H01000000)'dip 25
- .AddFrame 205,127,190,"Replay limit",&H04000000,Array("no limit",0,"one per game",&H04000000)'dip 27
- .AddFrame 205,173,190,"Novelty mode",&H08000000,Array("normal game mode",0,"50,000 points per special/extra ball",&H08000000)'dip 28
- .AddFrame 205,219,190,"Game mode",&H10000000,Array("replay",0,"extra ball",&H10000000)'dip 29
- .AddChk 205,270,190,Array("Background sound",&H40000000)'dip 31
- .AddLabel 50,320,300,20,"After hitting OK, press F3 to reset game with new settings."
- End With
- Dim extra
- extra = Controller.Dip(4) + Controller.Dip(5)*256
- extra = vpmDips.ViewDipsExtra(extra)
- Controller.Dip(4) = extra And 255
- Controller.Dip(5) = (extra And 65280)\256 And 255
- End Sub
- Set vpmShowDips = GetRef("editDips")
Advertisement
Add Comment
Please, Sign In to add comment