home *** CD-ROM | disk | FTP | other *** search
- property pKeyDir, pRamp, kPower, kBoost, pMyScore, pMyBonus, pMember, pSprite, spriteNum, pCarShell, pChassisName, pCarCollider, pCarBody, pLocalDown, pLocalForward, pLocalRight, forwardVel, pUserCar, pCarName, pCarShadow, pBumperPos, pWheelNameA, pWheelNameB, pWheelNameC, pWheelNameD, pwidth, pFrontWheelBase, pBackWheelBase, pWheelRadius, pStrength, pDamping, pHoverDist, pMaxWheelTurn, pWheelSpinCoeff, pWheelList, pWheelPointList, pIsHoveringList, pHoverDistList, pChassisRB, pChassisMDL, pCarMass, pChassisMass, pChassisWeigth, pGravityStrength, pWheelTurn, pWheelSpin, pLastCarTransform, pCarFlame, pBodyOffset, pExhaustDummy, pDoubleshotLight, p3DWorld, pMotivator, pThrustor, pEmitterRegionList, pDirection, pRotation, pthrust, pIsLanding, pIsPrepared, pIsStarted, pIsReady, pHasFinished, pIsJumping, pPlayerID, pEnemyID, pKeyIsDn, pKeyPower, pKeyTimer, pGear, pIsFinished, pHasHitRamp, pImFinished, pEnemyFinished, angDashpot, pJumperSpin, pJumperSpinIncr, pRocketBuild, pHasStarted, pRocketMaxBuild, pBaseScore, pWasFinished, pMyFrame
- global isPlaying, gHavok, g3DWorld, gTextures, gCarsPrepared, gCarsReady, gTrackZ, gCarName, gHasStarted, p1score, p2score, gP1Event_1_score, gP1Event_2_score, gP1Event_3_score, gP2Event_1_score, gP2Event_2_score, gP2Event_3_score, gP1Finished, gP2Finished, gFrameCounter, gWinner, ovTxt, ovFader, ovBackdrop, ovDial_1, ovDial_2, ovWinner_1, ovWinner_2, ovNeedle_1, ovNeedle_2, ovDSLight_1, ovDSLight_2, ovP1Score_1, ovP1Score_2, ovP1Score_3, ovP1Score_4, ovP1Score_5, ovP2Score_1, ovP2Score_2, ovP2Score_3, ovP2Score_4, ovP2Score_5, ovKey_1_1, ovKey_1_2, ovKey_2_1, ovKey_2_2, mCamera, mTrack, mFinish, SndC_Music, SndC_Grnd, SndC_FX1, SndC_FX2, SndC_Engine, SndC_EnemyFX, gEngineSndList, gCar1Used, gPlayerKeysList, gEventID, gScoresList, ovResultsPanel_1, ovResultsPanel_2, ovP1Results_1, ovP1Results_2, ovP1Results_3, ovP1Results_4, ovP1Results_5, ovP2Results_1, ovP2Results_2, ovP2Results_3, ovP2Results_4, ovP2Results_5, gUserFramePlay, gUserFrameRecord, gGameMODE
-
- on doUpdateScore me
- if (pWasFinished = 1) and (g3DWorld.model("Collider_1").userData.isFinished = 1) and (g3DWorld.model("Collider_2").userData.isFinished = 1) then
- if pMyBonus = 1000 then
- gEngineSndList[pPlayerID].play(member("teletype"))
- gFrameCounter = 0
- SndC_Music.fadeOut(2000)
- end if
- if pMyBonus >= 10 then
- pMyBonus = max(0, pMyBonus - 10)
- pMyScore = pMyScore + 10
- else
- gEngineSndList[pPlayerID].stop()
- end if
- end if
- tScore = max(0, integer(gScoresList[gEventID][pPlayerID]))
- t5 = floor(tScore / 10000)
- tScore = tScore - (t5 * 10000)
- t4 = floor(tScore / 1000.0)
- tScore = tScore - (t4 * 1000)
- t3 = floor(tScore / 100.0)
- tScore = tScore - (t3 * 100)
- t2 = floor(tScore / 10.0)
- tScore = tScore - (t2 * 10)
- t1 = floor(tScore / 1.0)
- tScore = tScore - (t1 * 1)
- mCamera.overlay[value("ovP" & pPlayerID & "Score_5")].source = gTextures.getProp("Digit_" & t1)
- mCamera.overlay[value("ovP" & pPlayerID & "Score_4")].source = gTextures.getProp("Digit_" & t2)
- mCamera.overlay[value("ovP" & pPlayerID & "Score_3")].source = gTextures.getProp("Digit_" & t3)
- mCamera.overlay[value("ovP" & pPlayerID & "Score_2")].source = gTextures.getProp("Digit_" & t4)
- mCamera.overlay[value("ovP" & pPlayerID & "Score_1")].source = gTextures.getProp("Digit_" & t5)
- gScoresList[gEventID][pPlayerID] = integer(pMyScore)
- end
-
- on doUpdateResult me
- mCamera.overlay[value("ovResultsPanel_" & pPlayerID)].blend = 100
- mCamera.overlay[value("ovP" & pPlayerID & "Results_1")].blend = 100
- mCamera.overlay[value("ovP" & pPlayerID & "Results_2")].blend = 100
- mCamera.overlay[value("ovP" & pPlayerID & "Results_3")].blend = 100
- mCamera.overlay[value("ovP" & pPlayerID & "Results_4")].blend = 100
- mCamera.overlay[value("ovP" & pPlayerID & "Results_5")].blend = 100
- tScore = max(0, integer(gScoresList[gEventID][pPlayerID]))
- t5 = floor(tScore / 10000)
- tScore = tScore - (t5 * 10000)
- t4 = floor(tScore / 1000.0)
- tScore = tScore - (t4 * 1000)
- t3 = floor(tScore / 100.0)
- tScore = tScore - (t3 * 100)
- t2 = floor(tScore / 10.0)
- tScore = tScore - (t2 * 10)
- t1 = floor(tScore / 1.0)
- tScore = tScore - (t1 * 1)
- mCamera.overlay[value("ovP" & pPlayerID & "Results_5")].source = gTextures.getProp("Digit_" & t1)
- mCamera.overlay[value("ovP" & pPlayerID & "Results_4")].source = gTextures.getProp("Digit_" & t2)
- mCamera.overlay[value("ovP" & pPlayerID & "Results_3")].source = gTextures.getProp("Digit_" & t3)
- mCamera.overlay[value("ovP" & pPlayerID & "Results_2")].source = gTextures.getProp("Digit_" & t4)
- mCamera.overlay[value("ovP" & pPlayerID & "Results_1")].source = gTextures.getProp("Digit_" & t5)
- end
-
- on beginSprite me
- if gGameMODE = 1 then
- gUserFrameRecord = value(member("recorder_" & gCarName).text)
- end if
- gUserFramePlay = []
- pMyFrame = 1
- tdoBoost = 0
- pKeyDir = 1
- pWasFinished = 0
- pRocketMaxBuild = 1
- pHasStarted = 0
- pRocketBuild = 0
- pJumperSpin = 0
- pJumperSpinIncr = 20
- if gCar1Used = 0 then
- gCar1Used = 1
- pPlayerID = 1
- pEnemyID = 2
- kPower = string(gPlayerKeysList[1])
- kBoost = string(gPlayerKeysList[2])
- else
- pPlayerID = 2
- pEnemyID = 1
- kPower = string(gPlayerKeysList[3])
- kBoost = string(gPlayerKeysList[4])
- end if
- pHasHitRamp = 0
- pSuspensionOn = 1
- gWinner = 0
- pDoubleshotLight = 0
- gP1Finished = 0
- gP2Finished = 0
- pMyScore = 0
- pMyBonus = 0
- pGear = 1
- pKeyTimer = 0
- pKeyIsDn = 0
- pOldWheelTurn = 0
- pWheelTurn_3 = 0
- pWheelTurn_4 = 0
- pWheelSpin2 = 0
- pSprite = sprite(me.spriteNum)
- pMember = pSprite.member
- pIsFinished = 0
- pIsPrepared = 0
- pIsStarted = 0
- pIsReady = 0
- pIsJumping = 0
- pIsLanding = 0
- gCarsPrepared = 0
- gCarsReady = 0
- pCarMass = 1000
- pStrength = 3
- pDamping = 0.06
- pScalar = 1.0
- pHoverDist = 1.5
- pMaxWheelTurn = 45
- pWheelSpinCoeff = 2
- pBrakeGain = 0.29999999999999999
- pAccGain = 0.12
- pDecGain = 0.03
- pTurnBuild = 0
- pMaxSpeed = 65.0
- pTurnBuildFactor = 20
- pGripFactor = 1
- pGrip = 1.0
- pDrag = 0.0
- gTrackZ = 0
- case gCarName of
- "Dragster":
- pFrontWheelBase = 2
- pBackWheelBase = 1.69999999999999996
- pwidth = 1.89999999999999991
- pWheelRadius = 0.59999999999999998
- pBodyOffset = -0.05
- "Jumper":
- pFrontWheelBase = 1.80000000000000004
- pBackWheelBase = 1.85000000000000009
- pwidth = 1.89999999999999991
- pWheelRadius = 0.69999999999999996
- pBodyOffset = -0.29999999999999999
- "Rocket":
- pFrontWheelBase = 1.80000000000000004
- pBackWheelBase = 1.85000000000000009
- pwidth = 1.89999999999999991
- pWheelRadius = 0.46999999999999997
- pBodyOffset = 0
- end case
- end
-
- on exitFrame me
- if pIsStarted = 0 then
- return
- end if
- me.updateCar()
- end
-
- on startCar me
- pIsStarted = 1
- end
-
- on checkPrepared me
- if pIsPrepared = 0 then
- gCarsPrepared = 0
- end if
- end
-
- on checkReady me
- if pIsReady = 0 then
- gCarsReady = 0
- end if
- end
-
- on prepareCar me
- pKeyPower = 0
- pLocalDown = vector(0, 0, -1)
- pLocalForward = vector(0, 1, 0)
- pCarBody = g3DWorld.model("Collider_" & pPlayerID)
- pCarBody.addModifier(#meshDeform)
- pCarBody.visibility = #none
- pCarBody.userData.addProp(#kind, "userCar")
- pCarBody.userData.addProp(#isFinished, 0)
- pCarBody.userData.addProp(#hasJumped, 0)
- pCarBody.userData.addProp(#myX, pCarBody.transform.position.x)
- pChassisName = pCarBody.name
- pCarShell = g3DWorld.model(gCarName & "_Body").cloneDeep(gCarName & "_Body_" & pPlayerID)
- put pCarShell.shaderList
- if pPlayerID = 2 then
- case gCarName of
- "Dragster":
- pCarShell.shaderList[1].diffuse = rgb(0, 100, 255)
- "Jumper":
- pCarShell.shaderList[3].diffuse = rgb(0, 100, 255)
- "Rocket":
- pCarShell.shaderList[1].diffuse = rgb(0, 100, 255)
- end case
- end if
- pExhaustDummy = g3DWorld.model(gCarName & "_Dummy").clone(gCarName & "_Dummy_" & pPlayerID)
- pExhaustDummy.visibility = #none
- if gCarName = "Rocket" then
- pCarShadow = g3DWorld.model("Shadow_" & pPlayerID)
- pCarShadow.visibility = #none
- else
- pCarShadow = g3DWorld.model("Shadow_" & pPlayerID)
- pCarShadow.shader.texture.renderFormat = #rgba4444
- pWheelA = g3DWorld.model(gCarName & "_Wheel_FL").clone(gCarName & "_Wheel_FL_" & pPlayerID)
- pWheelB = g3DWorld.model(gCarName & "_Wheel_FR").clone(gCarName & "_Wheel_FR_" & pPlayerID)
- pWheelC = g3DWorld.model(gCarName & "_Wheel_RL").clone(gCarName & "_Wheel_RL_" & pPlayerID)
- pWheelD = g3DWorld.model(gCarName & "_Wheel_RR").clone(gCarName & "_Wheel_RR_" & pPlayerID)
- pWheelA.visibility = #both
- pWheelB.visibility = #both
- pWheelC.visibility = #both
- pWheelD.visibility = #both
- pWheelNameA = pWheelA.name
- pWheelNameB = pWheelB.name
- pWheelNameC = pWheelC.name
- pWheelNameD = pWheelD.name
- end if
- pCarFlame = g3DWorld.model("Flame").clone("Flame_" & pPlayerID)
- pCarFlame.transform.position = pCarShell.transform.position
- pCarFlame.visibility = #none
- pCarFlame.shader.texture.renderFormat = #rgba4444
- pCarFlame.shader.emissive = rgb(255, 255, 0)
- if gCarName = "Jumper" then
- pRamp = g3DWorld.model("RAMP_" & pPlayerID)
- end if
- gHavok.makeMovableRigidBody(pCarBody.name, pCarMass, 1, #box)
- pChassisRB = gHavok.rigidBody(pCarBody.name)
- pChassisMass = pChassisRB.mass
- pChassisRB.restitution = 0
- pChassisRB.friction = 0
- pGravityStrength = gHavok.gravity.length
- pChassisWeigth = pChassisMass * pGravityStrength
- pChassisMDL = pCarBody
- pWheelList = [pWheelA, pWheelB, pWheelD, pWheelC]
- pIsHoveringList = [0, 0, 0, 0]
- pHoverDistList = [0.0, 0.0, 0.0, 0.0, 0.0]
- com = pChassisRB.centerOfMass
- pLocalForward.normalize()
- pLocalDown.normalize()
- pLocalRight = pLocalDown.cross(pLocalForward)
- pLocalRight.normalize()
- posA = com + (pFrontWheelBase * pLocalForward) + (pwidth * 0.5 * -pLocalRight)
- posB = com + (pFrontWheelBase * pLocalForward) + (pwidth * 0.5 * pLocalRight)
- posC = com + (pBackWheelBase * -pLocalForward) + (pwidth * 0.5 * pLocalRight)
- posD = com + (pBackWheelBase * -pLocalForward) + (pwidth * 0.5 * -pLocalRight)
- pWheelPointList = [posA, posB, posC, posD]
- pFrontBumperPos = com + ((pFrontWheelBase + 0.5) * pLocalForward)
- pThrustor = g3DWorld.newModelResource("Thrustor" & pPlayerID, #particle)
- tParticles = g3DWorld.newModel("ThrustGas" & pPlayerID, pThrustor)
- pDirection = vector(0, 0, 1)
- tVector_1 = vector(-0.5, -3, 0)
- tVector_2 = vector(0.5, -3, 0)
- pEmitterRegionList = [tVector_1, tVector_2]
- tParticleTexture = member("Smoke")
- tRenderFormat = #rgba4444
- pThrustor.emitter.numParticles = 50
- pThrustor.emitter.angle = 35
- pThrustor.lifeTime = 500
- pThrustor.sizeRange.start = 0.40000000000000002
- pThrustor.sizeRange.end = 3.0
- pThrustor.gravity = vector(0, 0, 0)
- pThrustor.wind = vector(0, 0, 0)
- pThrustor.emitter.distribution = #gaussian
- pThrustor.blendRange.start = 0
- pThrustor.blendRange.end = 0
- pThrustor.emitter.maxSpeed = 3
- pThrustor.emitter.minSpeed = 1
- pThrustor.emitter.region = pEmitterRegionList
- pThrustor.emitter.direction = pDirection
- ttexture = g3DWorld.newTexture("ParticleTexture_" & pPlayerID)
- ttexture.member = tParticleTexture
- ttexture.renderFormat = tRenderFormat
- pThrustor.texture = ttexture
- pRotation = vector()
- pIsPrepared = 1
- end
-
- on updateCar me
- tTrans = pCarBody.transform
- tPosition = tTrans.position
- tRotation = tTrans.rotation
- tempTrans = tTrans.duplicate()
- if tempTrans = VOID then
- tempTrans = pLastCarTransform.duplicate()
- end if
- tempTrans2 = tempTrans.duplicate()
- tempTrans.position = vector(0, 0, 0)
- tempTrans.scale = vector(1, 1, 1)
- worldAxis = tempTrans * -pLocalDown
- worldForward = tempTrans * pLocalForward
- worldRight = worldForward.cross(worldAxis)
- worldDownDir = tempTrans * pLocalDown
- worldAxis.normalize()
- worldForward.normalize()
- worldRight.normalize()
- worldDownDir.normalize()
- chassisPos = pChassisRB.position + pChassisRB.centerOfMass
- linVel = pChassisRB.linearVelocity
- forwardVel = linVel.dot(worldForward)
- angVel = pChassisRB.angularVelocity
- tAngVel = pChassisRB.angularVelocity.z
- tAngMom = pChassisRB.angularmomentum.z
- if forwardVel = 0 then
- forwardVel = 0.0001
- end if
- pPowerCoeff = pIsHoveringList[1] + pIsHoveringList[2] + pIsHoveringList[3] + pIsHoveringList[4]
- if not pPowerCoeff = 0 then
- pIsReady = 1
- pPowerCoeff = pPowerCoeff / 4.0
- end if
- if isPlaying = 1 then
- if pPlayerID = 1 then
- pImFinished = g3DWorld.model("Collider_1").userData.isFinished
- pEnemyFinished = g3DWorld.model("Collider_2").userData.isFinished
- gP1Finished = pImFinished
- gP2Finished = pEnemyFinished
- if (pWasFinished = 0) and (pImFinished = 1) then
- pBaseScore = pMyScore
- pWasFinished = 1
- put "FINISHED " & pPlayerID
- doUpdateResult()
- end if
- else
- pImFinished = g3DWorld.model("Collider_2").userData.isFinished
- pEnemyFinished = g3DWorld.model("Collider_1").userData.isFinished
- gP2Finished = pImFinished
- gP1Finished = pEnemyFinished
- if (pWasFinished = 0) and (pImFinished = 1) then
- pBaseScore = pMyScore
- pWasFinished = 1
- put "FINISHED " & pPlayerID
- doUpdateResult()
- end if
- end if
- case gCarName of
- "Dragster":
- if (pImFinished = 0) and (pCarShell.transform.position.y > mFinish.transform.position.y) then
- pImFinished = 1
- pCarBody.userData.isFinished = 1
- g3DWorld.model("Collider_1").userData.isFinished = 1
- g3DWorld.model("Collider_2").userData.isFinished = 1
- if pEnemyFinished = 0 then
- mCamera.overlay[value("ovWinner_" & pPlayerID)].blend = 100
- pMyScore = pMyScore + (forwardVel * 0.10000000000000001)
- pMyBonus = 1000
- pEnemyFinished = 1
- end if
- pGear = 10
- else
- if (pImFinished = 0) and (pEnemyFinished = 0) then
- pMyScore = pMyScore + (forwardVel * 0.10000000000000001)
- end if
- end if
- "Jumper":
- if (pImFinished = 1) and (pEnemyFinished = 1) then
- pImFinished = 1
- pEnemyFinished = 1
- g3DWorld.model("Collider_1").userData.isFinished = 1
- g3DWorld.model("Collider_2").userData.isFinished = 1
- if (gScoresList[gEventID][pPlayerID] > gScoresList[gEventID][pEnemyID]) and (gWinner = 0) then
- gWinner = pPlayerID
- mCamera.overlay[value("ovWinner_" & pPlayerID)].blend = 100
- pMyBonus = 1000
- end if
- end if
- "Rocket":
- pMyScore = max(pMyScore, pCarShell.transform.position.y)
- if (pImFinished = 0) and (pCarShell.transform.position.y < (pMyScore - 2)) then
- put pCarShell & "IS FINISHED"
- pImFinished = 1
- pCarBody.userData.isFinished = 1
- pGear = 10
- end if
- if (pImFinished = 1) and ((pEnemyFinished = 1) or (gScoresList[gEventID][pEnemyID] < 35)) then
- pImFinished = 1
- pEnemyFinished = 1
- g3DWorld.model("Collider_1").userData.isFinished = 1
- g3DWorld.model("Collider_2").userData.isFinished = 1
- if (gScoresList[gEventID][pPlayerID] > gScoresList[gEventID][pEnemyID]) and (gWinner = 0) then
- gWinner = pPlayerID
- mCamera.overlay[value("ovWinner_" & pPlayerID)].blend = 100
- pMyBonus = 1000
- else
- if (gScoresList[gEventID][pPlayerID] = gScoresList[gEventID][pEnemyID]) and (gWinner = 0) then
- pMyScore = pMyScore + pPlayerID
- gWinner = 1
- doUpdateScore()
- mCamera.overlay[value("ovWinner_1")].blend = 100
- pMyBonus = 1000
- end if
- end if
- end if
- end case
- if (pPlayerID = 1) or (gGameMODE = 2) then
- case pGear of
- 1:
- if keyPressed(kPower) then
- if pKeyIsDn = 0 then
- pHasStarted = 1
- gHasStarted = 1
- if gEngineSndList[pPlayerID].isBusy() = 0 then
- gEngineSndList[pPlayerID].play(member("Snd_Engine_1"))
- end if
- pKeyTimer = the ticks
- pKeyIsDn = 1
- if gCarName = "Rocket" then
- pRocketBuild = min(pRocketMaxBuild, pRocketBuild + 0.02)
- imp = 2.5 * pChassisMass * pRocketBuild
- pChassisRB.applyImpulse(imp * worldForward)
- if pPlayerID = 1 then
- gUserFramePlay.append(1)
- end if
- else
- imp = 2.5 * pChassisMass
- pChassisRB.applyImpulse(imp * worldForward)
- if pPlayerID = 1 then
- gUserFramePlay.append(1)
- end if
- end if
- end if
- else
- pKeyIsDn = 0
- if pPlayerID = 1 then
- gUserFramePlay.append(0)
- end if
- end if
- if pChassisMDL.transform.position.y > 800 then
- pRocketMaxBuild = max(-1, pRocketMaxBuild - 0.20000000000000001)
- end if
- if the ticks > (pKeyTimer + 30) then
- imp = -forwardVel * pChassisMass
- pChassisRB.applyImpulse(0.02 * imp * worldForward)
- if (pHasStarted = 1) and (gCarName = "Rocket") then
- pRocketMaxBuild = max(-1, pRocketMaxBuild - 0.20000000000000001)
- if pChassisMDL.transform.position.y > 0.01 then
- imp = -pChassisMass
- pChassisRB.applyImpulse(imp * worldForward)
- else
- pChassisRB.linearMomentum = vector(0, 0, 0)
- end if
- end if
- end if
- if keyPressed(kBoost) and (forwardVel > 144) then
- gEngineSndList[pPlayerID].play(member("Snd_Engine_2"))
- pKeyTimer = the ticks + (60 * 5)
- pGear = 2
- pCarFlame.visibility = #both
- pCarFlame.shader.blend = 0
- if pPlayerID = 1 then
- gUserFramePlay.append(3)
- end if
- end if
- 2:
- if the ticks > pKeyTimer then
- pGear = 3
- else
- imp = 2.5 * pChassisMass
- pChassisRB.applyImpulse(imp * worldForward)
- pCarFlame.shader.blend = min(70, pCarFlame.shader.blend + 10)
- end if
- 3:
- if pCarFlame.visibility = #both then
- pCarFlame.shader.blend = max(0, pCarFlame.shader.blend - 5)
- if pCarFlame.shader.blend = 0 then
- pCarFlame.visibility = #none
- end if
- end if
- imp = -forwardVel * pChassisMass
- pChassisRB.applyImpulse(0.02 * imp * worldForward)
- if gCarName = "Rocket" then
- imp = -pChassisMass
- pChassisRB.applyImpulse(imp * worldForward)
- pCarShell.rotate(2, 0.025, 0)
- if pChassisMDL.transform.position.y < 0 then
- pChassisRB.linearMomentum = vector(0, 0, 0)
- end if
- end if
- 10:
- mCamera.overlay[ovKey_1_1].blend = 0
- mCamera.overlay[ovKey_1_2].blend = 0
- mCamera.overlay[ovKey_2_1].blend = 0
- mCamera.overlay[ovKey_2_2].blend = 0
- if pCarFlame.visibility = #both then
- pCarFlame.shader.blend = max(0, pCarFlame.shader.blend - 5)
- if pCarFlame.shader.blend = 0 then
- pCarFlame.visibility = #none
- end if
- end if
- imp = -forwardVel * pChassisMass
- pChassisRB.applyImpulse(0.03 * imp * worldForward)
- if gCarName = "Rocket" then
- pCarShell.rotate(2, 0.025, 0)
- if pChassisMDL.transform.position.y < 0 then
- pChassisRB.linearMomentum = vector(0, 0, 0)
- end if
- end if
- end case
- else
- case pGear of
- 1:
- if pMyFrame > gUserFrameRecord.count then
- put "EXTENDING RECORDING"
- pMyFrame = 1
- tdoBoost = 1
- end if
- if gUserFrameRecord[pMyFrame] = 1 then
- if pKeyIsDn = 0 then
- pHasStarted = 1
- gHasStarted = 1
- if gEngineSndList[pPlayerID].isBusy() = 0 then
- gEngineSndList[pPlayerID].play(member("Snd_Engine_1"))
- end if
- pKeyTimer = the ticks
- pKeyIsDn = 1
- if gCarName = "Rocket" then
- pRocketBuild = min(pRocketMaxBuild, pRocketBuild + 0.02)
- imp = 2.5 * pChassisMass * pRocketBuild
- pChassisRB.applyImpulse(imp * worldForward)
- else
- imp = 2.5 * pChassisMass
- pChassisRB.applyImpulse(imp * worldForward)
- end if
- end if
- else
- pKeyIsDn = 0
- end if
- if pChassisMDL.transform.position.y > 800 then
- pRocketMaxBuild = max(-1, pRocketMaxBuild - 0.20000000000000001)
- end if
- if the ticks > (pKeyTimer + 30) then
- imp = -forwardVel * pChassisMass
- pChassisRB.applyImpulse(0.02 * imp * worldForward)
- if (pHasStarted = 1) and (gCarName = "Rocket") then
- pRocketMaxBuild = max(-1, pRocketMaxBuild - 0.20000000000000001)
- if pChassisMDL.transform.position.y > 0.01 then
- imp = -pChassisMass
- pChassisRB.applyImpulse(imp * worldForward)
- else
- pChassisRB.linearMomentum = vector(0, 0, 0)
- end if
- end if
- end if
- if (tdoBoost = 1) and (gUserFrameRecord[gUserFrameRecord.count] = 3) and (forwardVel > 144) then
- gEngineSndList[pPlayerID].play(member("Snd_Engine_2"))
- pKeyTimer = the ticks + (60 * 5)
- pGear = 2
- pCarFlame.visibility = #both
- pCarFlame.shader.blend = 0
- end if
- 2:
- if the ticks > pKeyTimer then
- pGear = 3
- else
- imp = 2.5 * pChassisMass
- pChassisRB.applyImpulse(imp * worldForward)
- pCarFlame.shader.blend = min(70, pCarFlame.shader.blend + 10)
- end if
- 3:
- if pCarFlame.visibility = #both then
- pCarFlame.shader.blend = max(0, pCarFlame.shader.blend - 5)
- if pCarFlame.shader.blend = 0 then
- pCarFlame.visibility = #none
- end if
- end if
- imp = -forwardVel * pChassisMass
- pChassisRB.applyImpulse(0.02 * imp * worldForward)
- if gCarName = "Rocket" then
- imp = -pChassisMass
- pChassisRB.applyImpulse(imp * worldForward)
- pCarShell.rotate(2, 0.025, 0)
- if pChassisMDL.transform.position.y < 0 then
- pChassisRB.linearMomentum = vector(0, 0, 0)
- end if
- end if
- 10:
- mCamera.overlay[ovKey_1_1].blend = 0
- mCamera.overlay[ovKey_1_2].blend = 0
- mCamera.overlay[ovKey_2_1].blend = 0
- mCamera.overlay[ovKey_2_2].blend = 0
- if pCarFlame.visibility = #both then
- pCarFlame.shader.blend = max(0, pCarFlame.shader.blend - 5)
- if pCarFlame.shader.blend = 0 then
- pCarFlame.visibility = #none
- end if
- end if
- imp = -forwardVel * pChassisMass
- pChassisRB.applyImpulse(0.03 * imp * worldForward)
- if gCarName = "Rocket" then
- pCarShell.rotate(2, 0.025, 0)
- if pChassisMDL.transform.position.y < 0 then
- pChassisRB.linearMomentum = vector(0, 0, 0)
- end if
- end if
- end case
- pMyFrame = pMyFrame + 1
- end if
- if forwardVel > 144 then
- if pDoubleshotLight = 0 then
- mCamera.overlay[value("ovDSLight_" & pPlayerID)].blend = 100
- pDoubleshotLight = 1
- gEngineSndList[pPlayerID].play(member("Snd_DS"))
- mCamera.overlay[value("ovKey_" & pPlayerID & "_1")].blend = 30
- mCamera.overlay[value("ovKey_" & pPlayerID & "_2")].blend = 100
- end if
- else
- mCamera.overlay[value("ovDSLight_" & pPlayerID)].blend = max(0, mCamera.overlay[value("ovDSLight_" & pPlayerID)].blend - 5)
- if pDoubleshotLight = 1 then
- pDoubleshotLight = 0
- mCamera.overlay[value("ovKey_" & pPlayerID & "_1")].blend = 100
- mCamera.overlay[value("ovKey_" & pPlayerID & "_2")].blend = 30
- end if
- end if
- t1 = mCamera.overlay[value("ovNeedle_" & pPlayerID)].rotation
- t2 = max(0, min(180, forwardVel))
- t3 = ((t2 - t1) * 0.14999999999999999) + t1
- mCamera.overlay[value("ovNeedle_" & pPlayerID)].rotation = t3
- doUpdateScore()
- end if
- tPos = pChassisMDL.transform.position
- rotx = pChassisMDL.transform.rotation.x
- roty = pChassisMDL.transform.rotation.y
- rotz = pChassisMDL.transform.rotation.z
- if gCarName = "Jumper" then
- pChassisMDL.transform.position.x = pCarBody.userData.myX
- end if
- if pPowerCoeff = 0 then
- pIsLanding = 1
- if (gCarName = "Jumper") and (pHasHitRamp = 1) then
- pMyScore = max(pMyScore, (tPos.y - pRamp.transform.position.y) * 10)
- pChassisRB.applyAngularImpulse(-pChassisRB.angularmomentum * 0.5)
- pJumperSpin = pJumperSpin + pJumperSpinIncr
- if pJumperSpin >= 360 then
- pJumperSpin = 360
- else
- if pJumperSpin >= (360 - 91) then
- pJumperSpinIncr = pJumperSpinIncr - 2
- end if
- end if
- pChassisMDL.transform.rotation.y = pJumperSpin
- end if
- else
- if pIsLanding = 1 then
- pIsJumping = 0
- pIsLanding = 0
- if (gCarName = "Jumper") and (pHasHitRamp = 1) then
- pChassisRB.linearMomentum = vector(0, 0, 0)
- put pPlayerID & " FINISH LAND"
- pCarBody.userData.isFinished = 1
- pHasHitRamp = 0
- pGear = 10
- gEngineSndList[pPlayerID].stop()
- pChassisRB.attemptMoveTo(vector(pCarBody.userData.myX, tPos.y, 1), [vector(1, 1, 1), 0])
- pChassisRB.applyAngularImpulse(-pChassisRB.angularmomentum)
- end if
- else
- pChassisRB.applyAngularImpulse(vector(0, 0, -tAngMom * 0.20000000000000001))
- slideSpeed = worldRight.dot(linVel)
- imp = worldRight * (-slideSpeed * pChassisMass)
- pChassisRB.applyImpulse(imp)
- end if
- end if
- if (tPos.z < 0) or ((gCarName = "Jumper2") and (pCarBody.userData.isFinished = 1)) then
- T = pChassisRB.attemptMoveTo(vector(pCarBody.userData.myX, tPos.y, 1), [vector(1, 1, 1), 0])
- put "ATTEMPT TO CORRECT = " & T
- end if
- pLastCarTransform = pChassisMDL.transform.duplicate()
- repeat with i = 1 to pWheelPointList.count
- pIsHoveringList[i] = 0
- worldWheelPoint = tempTrans2 * pWheelPointList[i]
- tUseHover = 0
- if gCarName = "Jumper" then
- details = pMember.modelsUnderRay(worldWheelPoint, worldDownDir, [#maxNumberOfModels: 1, #levelOfDetail: #detailed, #modelList: [pRamp, mTrack], #maxDistance: 2])
- if details <> [] then
- if (pPowerCoeff = 1) and (details[1][1] = mTrack) then
- hoverDst = worldWheelPoint.z - 0
- hoverPnt = vector(worldWheelPoint.x, worldWheelPoint.y, 0)
- tUseHover = 1
- else
- hoverDst = details[1][2]
- hoverPnt = details[1][3]
- tUseHover = 1
- end if
- end if
- else
- hoverDst = worldWheelPoint.z - 0
- hoverPnt = vector(worldWheelPoint.x, worldWheelPoint.y, 0)
- tUseHover = 1
- end if
- if tUseHover = 1 then
- if hoverDst < pHoverDist then
- pointVelocity = linVel + angVel.cross(worldWheelPoint - chassisPos)
- diff = hoverPnt - worldWheelPoint
- f = -pStrength * (pHoverDist - hoverDst)
- f = f - (pDamping * pointVelocity.dot(diff))
- pChassisRB.applyImpulseAtPoint(diff * f * pChassisMass, pWheelPointList[i])
- pIsHoveringList[i] = 1
- pHoverDistList[i] = hoverDst
- end if
- next repeat
- end if
- pHoverDistList[i] = pHoverDist
- end repeat
- t1 = (pChassisMDL.transform * pWheelPointList[3]) + (pHoverDistList[3] * worldDownDir) - (pWheelRadius * worldDownDir)
- t2 = (pChassisMDL.transform * pWheelPointList[4]) + (pHoverDistList[4] * worldDownDir) - (pWheelRadius * worldDownDir)
- mid = ((t2 - t1) * 0.5) + t1
- if gCarName = "Jumper" then
- details = pMember.modelsUnderRay(mid, vector(0, 0, -1), [#maxNumberOfModels: 1, #levelOfDetail: #detailed, #modelList: [pRamp, mTrack], #maxDistance: 2])
- else
- details = pMember.modelsUnderRay(mid, vector(0, 0, -1), [#maxNumberOfModels: 1, #levelOfDetail: #detailed, #modelList: [mTrack], #maxDistance: 2])
- end if
- if gCarName <> "Rocket" then
- if details = [] then
- nothing()
- else
- hoverDst = details[1][2]
- shadowPoint = details[1][3]
- if (pHasHitRamp = 0) and (details[1][1] = pRamp) then
- pHasHitRamp = 1
- pJumperSpin = 0
- end if
- pCarShadow.transform.position = details[1][3] + vector(0, 0, 0.05)
- pCarShadow.transform.rotation.z = pCarShell.transform.rotation.z
- end if
- pCarShell.transform.position = pChassisMDL.transform.position
- pCarShell.transform.rotation = pChassisMDL.transform.rotation
- pCarShell.translate(0, 0, pBodyOffset)
- else
- pCarShell.transform.position = pChassisMDL.transform.position
- pCarShell.rotate(0, forwardVel * 0.025, 0)
- end if
- if gCarName <> "Rocket" then
- pWheelSpin = pWheelSpin - (forwardVel * pWheelSpinCoeff)
- if pWheelSpin > 360 then
- pWheelSpin = pWheelSpin - 360
- else
- if pWheelSpin < -360 then
- pWheelSpin = pWheelSpin - 360
- end if
- end if
- repeat with i = 1 to 4
- worldWheelPoint = pChassisMDL.transform * pWheelPointList[i]
- T = pHoverDistList[i]
- pWheelList[i].transform.position = worldWheelPoint + (T * worldDownDir) - (pWheelRadius * worldDownDir)
- pWheelList[i].transform.rotation = pChassisMDL.transform.rotation
- pWheelList[i].rotate(pWheelSpin, 0, 0)
- end repeat
- end if
- if isPlaying = 1 then
- tTrans = pCarShell.getWorldTransform()
- pExhaustDummy.transform.position = pCarShell.transform.position
- pExhaustDummy.translate(0, 0, 0)
- pExhaustDummy.transform.rotation = pCarShell.transform.rotation
- tTrans = pExhaustDummy.getWorldTransform()
- tEmitterRegionList = pEmitterRegionList.duplicate()
- repeat with i = 1 to tEmitterRegionList.count
- tEmitterRegionList[i] = tTrans * tEmitterRegionList[i]
- end repeat
- pThrustor.emitter.region = tEmitterRegionList
- tTrans.position = vector(0, 0, 0)
- if (pHasStarted = 1) and (gCarName = "Rocket") and (pCarShell.transform.position.y <= 2) then
- newSmoke = 100
- pThrustor.blendRange.start = min(newSmoke, pThrustor.blendRange.start + 3)
- pThrustor.wind = vector(0, 8, 5)
- else
- newSmoke = 40 * min(1, abs(forwardVel) / 55)
- pThrustor.blendRange.start = max(newSmoke, pThrustor.blendRange.start - 1.5)
- pThrustor.wind = vector(0, 0, 0)
- end if
- else
- pThrustor.blendRange.start = max(0, pThrustor.blendRange.start - 2)
- end if
- pCarFlame.transform.position = pExhaustDummy.transform.position
- pCarFlame.translate(0, -4, 0)
- pCarFlame.transform.rotation = pExhaustDummy.transform.rotation
- tOverlayID = value("ovKey_" & pPlayerID & "_1")
- if mCamera.overlay[tOverlayID].blend > 30 then
- if pKeyDir = 1 then
- mCamera.overlay[tOverlayID].blend = min(100, mCamera.overlay[tOverlayID].blend + 10)
- if mCamera.overlay[tOverlayID].blend = 100 then
- pKeyDir = -1
- end if
- else
- mCamera.overlay[tOverlayID].blend = max(31, mCamera.overlay[tOverlayID].blend - 10)
- if mCamera.overlay[tOverlayID].blend = 31 then
- pKeyDir = 1
- end if
- end if
- end if
- tOverlayID = value("ovKey_" & pPlayerID & "_2")
- if mCamera.overlay[tOverlayID].blend > 30 then
- if pKeyDir = 1 then
- mCamera.overlay[tOverlayID].blend = min(100, mCamera.overlay[tOverlayID].blend + 10)
- if mCamera.overlay[tOverlayID].blend = 100 then
- pKeyDir = -1
- end if
- else
- mCamera.overlay[tOverlayID].blend = max(31, mCamera.overlay[tOverlayID].blend - 10)
- if mCamera.overlay[tOverlayID].blend = 31 then
- pKeyDir = 1
- end if
- end if
- end if
- end
-