diff options
-rw-r--r-- | src/core/Pad.cpp | 44 | ||||
-rw-r--r-- | src/core/Pad.h | 4 | ||||
-rw-r--r-- | src/core/config.h | 2 | ||||
-rw-r--r-- | src/vehicles/Automobile.cpp | 24 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 89 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 3 |
6 files changed, 158 insertions, 8 deletions
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 8a3fc7cb..44b22d6d 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -291,6 +291,38 @@ void KangarooCheat() } #endif +#ifdef ALLCARSHELI_CHEAT +void AllCarsHeliCheat(void) +{ + wchar* string; + if (bAllCarCheat) { + string = TheText.Get("CHEATOF"); + bAllCarCheat = false; + } + else { + string = TheText.Get("CHEAT1"); + bAllCarCheat = true; + } + CHud::SetHelpMessage(string, true); +} +#endif + +#ifdef ALT_DODO_CHEAT +void AltDodoCheat(void) +{ + wchar* string; + if (CVehicle::bAltDodoCheat) { + string = TheText.Get("CHEATOF"); + CVehicle::bAltDodoCheat = false; + } + else { + string = TheText.Get("CHEAT1"); + CVehicle::bAltDodoCheat = true; + } + CHud::SetHelpMessage(string, true); +} +#endif + void CControllerState::Clear(void) { @@ -861,6 +893,18 @@ void CPad::AddToPCCheatString(char c) if (!_CHEATCMP("GUBEDDEP")) CPed::SwitchDebugDisplay(); #endif + +#ifdef ALLCARSHELI_CHEAT + // "CARSAREHELI" + if (!_CHEATCMP("ILEHERASRAC")) + AllCarsHeliCheat(); +#endif + +#ifdef ALT_DODO_CHEAT + // "IWANTTOMASTERDODO" + if (!_CHEATCMP("ODODRETSAMOTTNAWI")) + AltDodoCheat(); +#endif #undef _CHEATCMP } diff --git a/src/core/Pad.h b/src/core/Pad.h index b3b0849b..b8228444 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -450,3 +450,7 @@ public: VALIDATE_SIZE(CPad, 0xFC); extern CPad Pads[MAX_PADS]; + +#ifdef ALLCARSHELI_CHEAT +extern bool bAllCarCheat; +#endif diff --git a/src/core/config.h b/src/core/config.h index 84712af3..a6876ab0 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -202,6 +202,8 @@ enum Config { // Pad #define XINPUT #define KANGAROO_CHEAT +#define ALLCARSHELI_CHEAT +#define ALT_DODO_CHEAT #define REGISTER_START_BUTTON // Hud, frontend and radar diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 74609e15..bfb215d2 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1013,16 +1013,28 @@ CAutomobile::ProcessControl(void) m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f); }else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) && m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){ - FlyingControl(FLIGHT_MODEL_DODO); +#ifdef ALT_DODO_CHEAT + if (bAltDodoCheat) + FlyingControl(FLIGHT_MODEL_SEAPLANE); + else +#endif + FlyingControl(FLIGHT_MODEL_DODO); }else if(GetModelIndex() == MI_MIAMI_RCBARON){ FlyingControl(FLIGHT_MODEL_RCPLANE); }else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){ - if(CPad::GetPad(0)->GetCircleJustDown()) - m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.03f, 0.0f); - if(m_aWheelSpeed[0] < 0.22f) - m_aWheelSpeed[0] += 0.0001f; - if(m_aWheelSpeed[0] > 0.15f) +#ifdef ALLCARSHELI_CHEAT + if (bAllCarCheat) FlyingControl(FLIGHT_MODEL_HELI); + else +#endif + { + if (CPad::GetPad(0)->GetCircleJustDown()) + m_aWheelSpeed[0] = Max(m_aWheelSpeed[0] - 0.03f, 0.0f); + if (m_aWheelSpeed[0] < 0.22f) + m_aWheelSpeed[0] += 0.0001f; + if (m_aWheelSpeed[0] > 0.15f) + FlyingControl(FLIGHT_MODEL_HELI); + } } } diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index a3bb705a..d0ccd31b 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -24,6 +24,9 @@ bool CVehicle::bAllDodosCheat; bool CVehicle::bCheat3; bool CVehicle::bCheat4; bool CVehicle::bCheat5; +#ifdef ALT_DODO_CHEAT +bool CVehicle::bAltDodoCheat; +#endif bool CVehicle::m_bDisableMouseSteering = true; void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); } @@ -214,6 +217,19 @@ const CVector vecSeaAeroResistance(0.995f, 0.995f, 0.85f); const float fSpeedResistanceY = 500.0f; const float fSpeedResistanceZ = 500.0f; +const CVector vecHeliMoveRes(0.995f, 0.995f, 0.99f); +const CVector vecRCHeliMoveRes(0.99f, 0.99f, 0.99f); +const float fThrustVar = 0.3f; +const float fRotorFallOff = 0.75f; +const float fStabiliseVar = 0.015f; +const float fPitchBrake = 10.0f; +const float fPitchVar = 0.006f; +const float fRollVar = 0.006f; +const float fYawVar = -0.001f; +const CVector vecHeliResistance(0.81f, 0.85f, 0.99f); +const CVector vecRCHeliResistance(0.92f, 0.92f, 0.998f); +const float fSpinSpeedRes = 20.0f; + void CVehicle::FlyingControl(eFlightModel flightModel) { @@ -332,7 +348,7 @@ CVehicle::FlyingControl(eFlightModel flightModel) fPitchImpulse = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed; else fPitchImpulse = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed; - ApplyTurnForce(fPitchImpulse* m_fTurnMass* GetUp()* CTimer::GetTimeStep(), vecWidthForward); + ApplyTurnForce(fPitchImpulse * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward); float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude()); float fLiftImpluse; @@ -365,7 +381,76 @@ CVehicle::FlyingControl(eFlightModel flightModel) break; } case FLIGHT_MODEL_HELI: - assert(0 && "Heli flight model not implemented"); + { + CVector vecMoveResistance; + if (GetModelIndex() == MI_MIAMI_SPARROW) + vecMoveResistance = vecHeliMoveRes; + else + vecMoveResistance = vecRCHeliMoveRes; + float rmX = Pow(vecMoveResistance.x, CTimer::GetTimeStep()); + float rmY = Pow(vecMoveResistance.y, CTimer::GetTimeStep()); + float rmZ = Pow(vecMoveResistance.z, CTimer::GetTimeStep()); + m_vecMoveSpeed.x *= rmX; + m_vecMoveSpeed.y *= rmY; + m_vecMoveSpeed.z *= rmZ; + if (m_status != STATUS_PLAYER && m_status != STATUS_PLAYER_REMOTE) + return; + float fThrust; + if (bCheat5) + fThrust = CPad::GetPad(0)->GetSteeringUpDown() * fThrustVar / 128.0f + 0.95f; + else + fThrust = fThrustVar * (CPad::GetPad(0)->GetAccelerate() - 2 * CPad::GetPad(0)->GetBrake()) / 255.0f + 0.95f; + fThrust -= fRotorFallOff * DotProduct(m_vecMoveSpeed, GetUp()); +#ifdef GTA3_1_1_PATCH + if (fThrust > 0.9f && GetPosition().z > 80.0f) + fThrust = 0.9f; +#endif + ApplyMoveForce(GRAVITY * GetUp() * fThrust * m_fMass * CTimer::GetTimeStep()); + + if (GetUp().z > 0.0f) + ApplyTurnForce(-CVector(GetUp().x, GetUp().y, 0.0f) * fStabiliseVar * m_fTurnMass * CTimer::GetTimeStep(), GetUp()); + + float fRoll, fPitch, fYaw; + if (bCheat5) { + fPitch = CPad::GetPad(0)->GetCarGunUpDown() / 128.0f; + fRoll = -CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f; + fYaw = CPad::GetPad(0)->GetCarGunLeftRight() / 128.0f; + } + else { + fPitch = CPad::GetPad(0)->GetSteeringUpDown() / 128.0f; + fRoll = CPad::GetPad(0)->GetLookLeft(); + if (CPad::GetPad(0)->GetLookRight()) + fRoll = -1.0f; + fYaw = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f; + } + if (CPad::GetPad(0)->GetHorn()) { + fYaw = 0.0f; + fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetUp()), -200.0f, 1.3f); + fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f); + } + debug("fPitch: %f\n", fPitch); + ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward()); + ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); + ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); + + CVector vecResistance; + if (GetModelIndex() == MI_MIAMI_SPARROW) + vecResistance = vecHeliResistance; + else + vecResistance = vecRCHeliResistance; + float rX = Pow(vecResistance.x, CTimer::GetTimeStep()); + float rY = Pow(vecResistance.y, CTimer::GetTimeStep()); + float rZ = Pow(vecResistance.z, CTimer::GetTimeStep()); + CVector vecTurnSpeed = Multiply3x3(m_vecTurnSpeed, GetMatrix()); + float fResistanceMultiplier = Pow(1.0f / (fSpinSpeedRes * SQR(vecTurnSpeed.z) + 1.0f), CTimer::GetTimeStep()); + float fResistance = vecTurnSpeed.z * fResistanceMultiplier - vecTurnSpeed.z; + vecTurnSpeed.x *= rX; + vecTurnSpeed.y *= rY; + vecTurnSpeed.z *= rZ; + m_vecTurnSpeed = Multiply3x3(GetMatrix(), vecTurnSpeed); + ApplyTurnForce(-GetRight() * fResistance * m_fTurnMass, GetForward() + Multiply3x3(GetMatrix(), m_vecCentreOfMass)); + break; + } } } diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 2ae78829..f9ff1037 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -280,6 +280,9 @@ public: static bool bCheat3; static bool bCheat4; static bool bCheat5; +#ifdef ALT_DODO_CHEAT + static bool bAltDodoCheat; +#endif static bool m_bDisableMouseSteering; }; |