diff options
-rw-r--r-- | src/control/Garages.cpp | 639 | ||||
-rw-r--r-- | src/control/Garages.h | 69 | ||||
-rw-r--r-- | src/control/Script.cpp | 2 | ||||
-rw-r--r-- | src/control/Script10.cpp | 7 | ||||
-rw-r--r-- | src/control/Script3.cpp | 4 | ||||
-rw-r--r-- | src/control/Script7.cpp | 3 | ||||
-rw-r--r-- | src/control/ScriptCommands.h | 2 | ||||
-rw-r--r-- | src/modelinfo/ModelIndices.h | 2 | ||||
-rw-r--r-- | src/vehicles/Bike.cpp | 2 | ||||
-rw-r--r-- | src/vehicles/Bike.h | 1 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 1 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 6 |
12 files changed, 579 insertions, 159 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index ede252a7..a3e91f85 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -8,6 +8,7 @@ #include "DMAudio.h" #include "General.h" #include "Font.h" +#include "Frontend.h" #include "HandlingMgr.h" #include "Hud.h" #include "Messages.h" @@ -15,7 +16,9 @@ #include "Pad.h" #include "Particle.h" #include "PlayerPed.h" +#include "Radar.h" #include "Replay.h" +#include "Script.h" #include "Stats.h" #include "Streaming.h" #include "Text.h" @@ -43,7 +46,7 @@ #define RESPRAY_PRICE (100) // Distances -#define DISTANCE_TO_CALL_OFF_CHASE (10.0f) +#define DISTANCE_TO_CALL_OFF_CHASE (50.0f) #define DISTANCE_FOR_MRWHOOP_HACK (0.5f) #define DISTANCE_TO_ACTIVATE_GARAGE (8.0f) #define DISTANCE_TO_ACTIVATE_KEEPCAR_GARAGE (17.0f) @@ -100,10 +103,10 @@ const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLLECTCARS_CARS] = { - { MI_LANDSTAL, MI_IDAHO, MI_ESPERANT, MI_STALLION, MI_RANCHER, MI_BLISTAC }, - { MI_SABRE, MI_VIRGO, MI_SENTINEL, MI_STRETCH, MI_WASHING, MI_ADMIRAL }, - { MI_CHEETAH, MI_INFERNUS, MI_BANSHEE, MI_PHEONIX, MI_COMET, MI_STINGER }, - { MI_VOODOO, MI_CUBAN, MI_CADDY, MI_BAGGAGE, MI_MRWHOOP, MI_PIZZABOY } + { MI_HEARSE, MI_FAGGIO, MI_FREEWAY, MI_SPIDER, MI_MANANA, MI_SHELBY, MI_PONTIAC, MI_ESPRIT, MI_HOTROD, MI_PCJ600, MI_SENTINEL, MI_INFERNUS, MI_BANSHEE, MI_PATRIOT, MI_BFINJECT, MI_LANDSTAL }, + { MI_HEARSE, MI_FAGGIO, MI_FREEWAY, MI_SPIDER, MI_MANANA, MI_SHELBY, MI_PONTIAC, MI_ESPRIT, MI_HOTROD, MI_PCJ600, MI_SENTINEL, MI_INFERNUS, MI_BANSHEE, MI_PATRIOT, MI_BFINJECT, MI_LANDSTAL }, + { MI_HEARSE, MI_FAGGIO, MI_FREEWAY, MI_SPIDER, MI_MANANA, MI_SHELBY, MI_PONTIAC, MI_ESPRIT, MI_HOTROD, MI_PCJ600, MI_SENTINEL, MI_INFERNUS, MI_BANSHEE, MI_PATRIOT, MI_BFINJECT, MI_LANDSTAL }, + { MI_HEARSE, MI_FAGGIO, MI_FREEWAY, MI_SPIDER, MI_MANANA, MI_SHELBY, MI_PONTIAC, MI_ESPRIT, MI_HOTROD, MI_PCJ600, MI_SENTINEL, MI_INFERNUS, MI_BANSHEE, MI_PATRIOT, MI_BFINJECT, MI_LANDSTAL }, }; const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }; @@ -127,6 +130,7 @@ CStoredCar CGarages::aCarsInSafeHouses[TOTAL_HIDEOUT_GARAGES][NUM_GARAGE_STORED_ int32 hGarages = AEHANDLE_NONE; CGarage CGarages::aGarages[NUM_GARAGES]; bool CGarages::bCamShouldBeOutisde; +uint8 CGarages::CrusherRewardMultiplier; #ifndef MASTER bool bPrintNearestObject; @@ -137,6 +141,7 @@ void CGarages::Init(void) #ifndef MASTER VarConsole.Add("Print nearest object", &bPrintNearestObject, true); #endif + CrusherRewardMultiplier = 1; CrushedCarId = -1; NumGarages = 0; MessageEndTime = 0; @@ -217,7 +222,7 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X pGarage->m_fSupX = Max(Max(X1, X2), X3); pGarage->m_fInfY = Min(Min(Min(Y1, Y2), Y3), Y2 + Y3 - Y1); pGarage->m_fSupY = Max(Max(Y1, Y2), Y3); - pGarage->m_vecCorner1 = CVector(X1, Y1, Z1); + pGarage->m_vecCorner1 = CVector2D(X1, Y1); pGarage->m_fInfZ = Z1; pGarage->m_vDir1 = CVector2D(X2 - X1, Y2 - Y1); pGarage->m_vDir2 = CVector2D(X3 - X1, Y3 - Y1); @@ -235,6 +240,22 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X pGarage->m_bRecreateDoorOnNextRefresh = false; pGarage->m_bRotatedDoor = false; pGarage->m_bCameraFollowsPlayer = false; + pGarage->m_nTimeToStartAction = 0; + pGarage->field_2 = false; + pGarage->m_nTargetModelIndex = targetId; + pGarage->m_bCollectedCarsState = 0; + pGarage->m_bDeactivated = false; + pGarage->m_bResprayHappened = false; + pGarage->m_bInitialized = false; + pGarage->m_bSSGarageAcceptedVehicle = false; + pGarage->m_bSSGarageStateChanging = false; + pGarage->m_bInitialized = InitDoorGubbins(NumGarages, type); + return NumGarages++; +} + +bool CGarages::InitDoorGubbins(uint32 id, uint8 type) +{ + CGarage* pGarage = &aGarages[id]; pGarage->RefreshDoorPointers(true); if (pGarage->m_pDoor1) { pGarage->m_fDoor1Z = pGarage->m_pDoor1->GetPosition().z; @@ -249,12 +270,6 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X pGarage->m_fDoorHeight = pGarage->m_pDoor1 ? FindDoorHeightForMI(pGarage->m_pDoor1->GetModelIndex()) : 4.0f; pGarage->m_fDoorPos = 0.0f; pGarage->m_eGarageState = GS_FULLYCLOSED; - pGarage->m_nTimeToStartAction = 0; - pGarage->field_2 = false; - pGarage->m_nTargetModelIndex = targetId; - pGarage->m_bCollectedCarsState = 0; - pGarage->m_bDeactivated = false; - pGarage->m_bResprayHappened = false; switch (type) { case GARAGE_MISSION: case GARAGE_COLLECTORSITEMS: @@ -263,7 +278,6 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X case GARAGE_COLLECTCARS_2: case GARAGE_COLLECTCARS_3: case GARAGE_FORCARTOCOMEOUTOF: - case GARAGE_60SECONDS: case GARAGE_MISSION_KEEPCAR: case GARAGE_FOR_SCRIPT_TO_OPEN: case GARAGE_HIDEOUT_ONE: @@ -290,6 +304,7 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X case GARAGE_BOMBSHOP2: case GARAGE_BOMBSHOP3: case GARAGE_RESPRAY: + case GARAGE_CRATE_GARAGE: pGarage->m_eGarageState = GS_OPENED; pGarage->m_fDoorPos = pGarage->m_fDoorHeight; break; @@ -304,7 +319,16 @@ int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X pGarage->UpdateCrusherAngle(); else pGarage->UpdateDoorsHeight(); - return NumGarages++; + return pGarage->m_fDoorHeight > 0.0f; +} + +void CGarages::SetupAnyGaragesForThisIsland(void) +{ + for (uint32 i = 0; i < NumGarages; i++) { + CGarage* pGarage = &aGarages[i]; + if (!pGarage->m_bInitialized) + pGarage->m_bInitialized = InitDoorGubbins(i, pGarage->m_eGarageType); + } } void CGarages::ChangeGarageType(int16 garage, uint8 type, int32 mi) @@ -315,8 +339,27 @@ void CGarages::ChangeGarageType(int16 garage, uint8 type, int32 mi) pGarage->m_eGarageState = GS_FULLYCLOSED; } +void CGarages::LockGarage(int16 garage, bool state) +{ + CGarage* pGarage = &aGarages[garage]; + pGarage->m_bLocked = state; + if (pGarage->m_bLocked) { + pGarage->m_fDoorPos = 0.0f; + pGarage->m_eGarageState = GS_FULLYCLOSED; + pGarage->m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + 2000; + pGarage->UpdateDoorsHeight(); + } + else { + pGarage->m_eGarageState = GS_OPENING; + } +} + void CGarage::Update() { +#ifdef GTA_NETWORK + if (/* gIsMultiplayerGame && */m_eGarageType != GARAGE_CRATE_GARAGE) // TODO(multiplayer) + return; +#endif if (m_eGarageType != GARAGE_CRUSHER) { switch (m_eGarageState) { case GS_FULLYCLOSED: @@ -354,7 +397,7 @@ void CGarage::Update() if (m_bDeactivated && m_eGarageState == GS_FULLYCLOSED) return; if (m_bRotatedDoor) { -#ifdef GTA_PS2 +#if defined GTA_PS2 || defined GTA_PSP if (m_eGarageState == GS_OPENING) { if (m_pDoor1) { if (FindPlayerPed()->m_pCurrentPhysSurface == m_pDoor1) @@ -438,7 +481,10 @@ void CGarage::Update() #else if (FindPlayerVehicle()) #endif + { ((CAutomobile*)(FindPlayerVehicle()))->m_fFireBlowUpTimer = 0.0f; + FindPlayerVehicle()->m_bGarageTurnedLightsOff = true; + } CWorld::CallOffChaseForArea( m_fInfX - DISTANCE_TO_CALL_OFF_CHASE, m_fInfY - DISTANCE_TO_CALL_OFF_CHASE, @@ -446,6 +492,7 @@ void CGarage::Update() m_fSupY + DISTANCE_TO_CALL_OFF_CHASE); break; case GS_FULLYCLOSED: + m_fDoorPos = 0.0f; if (CTimer::GetTimeInMilliseconds() > m_nTimeToStartAction) { m_eGarageState = GS_OPENING; DMAudio.PlayFrontEndSound(SOUND_GARAGE_OPENING, 1); @@ -480,11 +527,8 @@ void CGarage::Update() FindPlayerVehicle()->GetRight() = -FindPlayerVehicle()->GetRight(); } bChangedColour = false; -#ifdef FIX_BUGS - if (!FindPlayerVehicle()->IsCar() || !((CAutomobile*)(FindPlayerVehicle()))->bFixedColour) { -#else - if (!((CAutomobile*)(FindPlayerVehicle()))->bFixedColour) { -#endif + if ((!FindPlayerVehicle()->IsCar() || !((CAutomobile*)(FindPlayerVehicle()))->bFixedColour) && + (!FindPlayerVehicle()->IsBike() || !((CBike*)(FindPlayerVehicle()))->bFixedColour)) { uint8 colour1, colour2; uint16 attempt; FindPlayerVehicle()->GetModelInfo()->ChooseVehicleColour(colour1, colour2); @@ -497,12 +541,36 @@ void CGarage::Update() FindPlayerVehicle()->m_currentColour1 = colour1; FindPlayerVehicle()->m_currentColour2 = colour2; if (bChangedColour) { + CVector vCorners[] = { + CVector(m_fInfX, m_fInfY, 0.0f), CVector(m_fInfX, m_fSupY, 0.0f), + CVector(m_fSupX, m_fInfY, 0.0f), CVector(m_fSupX, m_fSupY, 0.0f) + }; + CVector vMiddles[] = { + CVector(m_fInfX + (m_fSupX - m_fInfX) / 2, m_fInfY, 0.0f), CVector(m_fInfX, m_fInfY + (m_fSupY - m_fInfY) / 2, 0.0f), + CVector(m_fInfX + (m_fSupX - m_fInfX) / 2, m_fSupY, 0.0f), CVector(m_fSupX, m_fInfY + (m_fSupY - m_fInfY) / 2, 0.0f), + }; + int nClosestCornerToCamera = 0; + int nClosestMiddleToCamera = 0; + for (int i = 1; i < 4; i++) { + if ((vCorners[nClosestCornerToCamera] - TheCamera.GetPosition()).Magnitude() > + (vCorners[i] - TheCamera.GetPosition()).Magnitude()) + nClosestCornerToCamera = i; + if ((vMiddles[nClosestMiddleToCamera] - TheCamera.GetPosition()).Magnitude() > + (vMiddles[i] - TheCamera.GetPosition()).Magnitude()) + nClosestMiddleToCamera = i; + } + CVector vDirectionCenterToMiddle = vMiddles[nClosestMiddleToCamera] - CVector(GetGarageCenterX(), GetGarageCenterY(), 0.0f); + vDirectionCenterToMiddle.Normalise(); + for (int i = 0; i < NUM_PARTICLES_IN_RESPRAY; i++) { - CVector pos; - pos.x = CGeneral::GetRandomNumberInRange(m_fInfX + 0.5f, m_fSupX - 0.5f); - pos.y = CGeneral::GetRandomNumberInRange(m_fInfY + 0.5f, m_fSupY - 0.5f); - pos.z = CGeneral::GetRandomNumberInRange(m_fDoor1Z - 3.0f, m_fDoor1Z + 1.0f); - CParticle::AddParticle(PARTICLE_GARAGEPAINT_SPRAY, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, CVehicleModelInfo::mspInfo->ms_vehicleColourTable[colour1]); + CVector pos(vMiddles[nClosestMiddleToCamera] - vDirectionCenterToMiddle * 0.5f); + CVector dir(CrossProduct(vDirectionCenterToMiddle, CVector(0.0f, 0.0f, 1.0f))); + float fDirMultiplier = (vCorners[nClosestCornerToCamera] - vMiddles[nClosestMiddleToCamera]).Magnitude(); + pos += dir * CGeneral::GetRandomNumberInRange(-1.0f, 1.0f) * fDirMultiplier; // TODO: base::RandomReal? + pos += vDirectionCenterToMiddle * CGeneral::GetRandomNumberInRange(-6.0f, 0.4f); + dir = vDirectionCenterToMiddle * 0.04f; + pos.z = m_fInfZ + CGeneral::GetRandomNumberInRange(-0.4f, 0.0f); + CParticle::AddParticle(PARTICLE_GARAGEPAINT_SPRAY, pos, dir, nil, 0.0f, CVehicleModelInfo::mspInfo->ms_vehicleColourTable[colour1]); } } } @@ -512,8 +580,11 @@ void CGarage::Update() if (!CGarages::RespraysAreFree) { CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - RESPRAY_PRICE); CStats::AutoPaintingBudget += RESPRAY_PRICE; + CGarages::TriggerMessage("GA_2", -1, 4000, -1); // New engine and paint job. The cops won't recognize you! + } + else { + CGarages::TriggerMessage("GA_17", -1, 4000, -1); } - CGarages::TriggerMessage("GA_2", -1, 4000, -1); // New engine and paint job. The cops won't recognize you! } else if (bChangedColour) { if (CGeneral::GetRandomTrueFalse()) @@ -538,6 +609,8 @@ void CGarage::Update() UpdateDoorsHeight(); break; case GS_OPENEDCONTAINSCAR: + if (FindPlayerVehicle()) + FindPlayerVehicle()->m_bGarageTurnedLightsOff = false; if (IsPlayerOutsideGarage()) m_eGarageState = GS_OPENED; break; @@ -550,9 +623,20 @@ void CGarage::Update() case GARAGE_BOMBSHOP1: case GARAGE_BOMBSHOP2: case GARAGE_BOMBSHOP3: + if (m_bLocked) { + UpdateDoorsHeight(); + break; + } switch (m_eGarageState) { case GS_OPENED: + UpdateDoorsHeight(); if (IsStaticPlayerCarEntirelyInside()) { + if (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) { + CGarages::TriggerMessage("GA_22", -1, 4000, -1); + m_eGarageState = GS_OPENEDCONTAINSCAR; + DMAudio.PlayFrontEndSound(SOUND_GARAGE_BOMB_ALREADY_SET, 1); + break; + } if (!FindPlayerVehicle() || FindPlayerVehicle()->m_bombType) { CGarages::TriggerMessage("GA_5", -1, 4000, -1); //"Your car is already fitted with a bomb" m_eGarageState = GS_OPENEDCONTAINSCAR; @@ -579,6 +663,8 @@ void CGarage::Update() m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + TIME_TO_SETUP_BOMB; DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f); } + if (FindPlayerVehicle()) + FindPlayerVehicle()->m_bGarageTurnedLightsOff = true; UpdateDoorsHeight(); if (m_eGarageType == GARAGE_BOMBSHOP3) CStreaming::RequestModel(MI_BOMB, STREAMFLAGS_DONT_REMOVE); @@ -595,13 +681,25 @@ void CGarage::Update() if (!CGarages::BombsAreFree) CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - BOMB_PRICE); if (FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike())) { -#if (!defined GTA_PS2 || defined FIX_BUGS) +#if (!defined GTA_PS2 || defined FIX_BUGS) // <- this remained in CAutomobile in LCS FindPlayerVehicle()->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType); FindPlayerVehicle()->m_pBombRigger = FindPlayerPed(); #else // PS2 version contained a bug: CBike was casted to CAutomobile, but due to coincidence it didn't corrupt memory ((CAutomobile*)(FindPlayerVehicle()))->m_bombType = CGarages::GetBombTypeForGarageType(m_eGarageType); ((CAutomobile*)(FindPlayerVehicle()))->m_pBombRigger = FindPlayerPed(); #endif + // what is this + uint32 i = CPools::GetVehiclePool()->GetSize(); + while (i--) { + CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); + if (pVehicle) { + if (pVehicle->IsCar() && pVehicle->GetStatus() == STATUS_WRECKED) { + CAutomobile* pCar = (CAutomobile*)pVehicle; + pCar->m_pBombRigger = nil; + pCar->m_pBlowUpEntity = nil; + } + } + } if (m_eGarageType == GARAGE_BOMBSHOP3) CGarages::GivePlayerDetonator(); CStats::KgsOfExplosivesUsed += KGS_OF_EXPLOSIVES_IN_BOMB; @@ -640,6 +738,7 @@ void CGarage::Update() CHud::SetHelpMessage(TheText.Get("GA_8"), false); // Use the detonator to activate the bomb. break; } + CGarages::TriggerMessage(CGarages::BombsAreFree ? "GA_24" : "GA_23", -1, 4000, -1); CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE); FindPlayerPed()->m_pWanted->m_bIgnoredByCops = false; } @@ -657,6 +756,8 @@ void CGarage::Update() UpdateDoorsHeight(); break; case GS_OPENEDCONTAINSCAR: + if (FindPlayerVehicle()) + FindPlayerVehicle()->m_bGarageTurnedLightsOff = false; if (IsPlayerOutsideGarage()) m_eGarageState = GS_OPENED; break; @@ -670,16 +771,12 @@ void CGarage::Update() switch (m_eGarageState) { case GS_OPENED: if (((CVector2D)FindPlayerCoors() - CVector2D(GetGarageCenterX(), GetGarageCenterY())).MagnitudeSqr() > SQR(DISTANCE_TO_CLOSE_MISSION_GARAGE)) { - if ((CTimer::GetFrameCounter() & 0x1F) == 0 -#ifndef GTA_PS2 - && (!m_pTarget || IsEntityTouching3D(m_pTarget)) -#endif - ) { + if ((CTimer::GetFrameCounter() & 0x1F) == 0 && !IsAnyOtherCarTouchingGarage(nil)) { m_eGarageState = GS_CLOSING; m_bClosingWithoutTargetCar = true; } } - else if (!FindPlayerVehicle() && m_pTarget && IsEntityEntirelyInside3D(m_pTarget, 0.0f) && + else if (m_pTarget && IsEntityEntirelyInside3D(m_pTarget, 0.0f) && IsEntityEntirelyOutside(FindPlayerVehicle() ? (CEntity*)FindPlayerVehicle() : (CEntity*)FindPlayerPed(), 2.0f)) { CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_GARAGE); FindPlayerPed()->m_pWanted->m_bIgnoredByCops = true; @@ -691,7 +788,11 @@ void CGarage::Update() if (m_pTarget) ThrowCarsNearDoorOutOfGarage(m_pTarget); m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep()); - if (m_fDoorPos == 0.0f) { + if (!IsEntityEntirelyOutside(FindPlayerPed(), 1.0f)) { + printf("FIX FOR IE GARAGE TRAPPING PLAYER\n"); + m_eGarageState = GS_OPENING; + } + else if (m_fDoorPos == 0.0f) { DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f); if (m_bClosingWithoutTargetCar) m_eGarageState = GS_FULLYCLOSED; @@ -787,22 +888,21 @@ void CGarage::Update() UpdateDoorsHeight(); break; case GS_FULLYCLOSED: + if (CTheScripts::IsPlayerOnAMission()) { + m_pTarget = nil; + break; + } + if (!IsEntityEntirelyOutside(FindPlayerPed(), 0.0f)) { + printf("FIX FOR IE GARAGE TRAPPING PLAYER\n"); + m_eGarageState = GS_OPENING; + } if (FindPlayerVehicle() && CalcSmallestDistToGarageDoorSquared( FindPlayerVehicle()->GetPosition().x, FindPlayerVehicle()->GetPosition().y ) < SQR(DISTANCE_TO_ACTIVATE_GARAGE)) { if (DoesCraigNeedThisCar(FindPlayerVehicle()->GetModelIndex())) { - if (FindPlayerVehicle()->VehicleCreatedBy == MISSION_VEHICLE) - CGarages::TriggerMessage("GA_1A", -1, 5000, -1); // Come back when you're not so busy... - else - m_eGarageState = GS_OPENING; - } - else { - if (HasCraigCollectedThisCar(FindPlayerVehicle()->GetModelIndex())) - CGarages::TriggerMessage("GA_20", -1, 5000, -1); // We got more of these than we can shift. Sorry man, no deal. - else if (FindPlayerSpeed().Magnitude() < MAX_SPEED_TO_SHOW_COLLECTED_MESSAGE) - CGarages::TriggerMessage("GA_19", -1, 5000, -1); // We're not interested in that model. + m_eGarageState = GS_OPENING; } } m_pTarget = nil; @@ -838,6 +938,7 @@ void CGarage::Update() m_eGarageState = GS_FULLYCLOSED; DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f); } + UpdateDoorsHeight(); if (!IsGarageEmpty()) m_eGarageState = GS_OPENING; break; @@ -858,9 +959,93 @@ void CGarage::Update() break; } break; + case GARAGE_CRATE_GARAGE: +#ifdef GTA_NETWORK + { + switch (m_eGarageState) { + case GS_OPENED: + if (m_pSSVehicle) { + // if (m_pSSVehicle->GetVehiclePointer() && IsEntityEntirelyInside3D(m_pSSVehicle->GetVehiclePointer()) + { + if (m_pSSTargetCar) + m_pSSTargetCar->CleanUpOldReference((CEntity**)&m_pSSTargetCar); + // m_pSSTargetCar = m_pSSVehicle->GetVehiclePointer(); + m_pSSTargetCar->RegisterReference((CEntity**)&m_pSSTargetCar); + } + // else + { + if (m_pSSTargetCar) + m_pSSTargetCar->CleanUpOldReference((CEntity**)&m_pSSTargetCar); + m_pSSTargetCar = nil; + } + if (m_pSSTargetCar) { + if (!FindPlayerVehicle()/* && m_pSSTargetCar == m_pSSVehicle->GetVehiclePointer() */) + { + if (IsEntityEntirelyOutside(FindPlayerPed(), 6.0f)) { + if (FindPlayerPed()->m_fHealth > 0.0f) { + CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_GARAGE); + m_eGarageState = GS_CLOSING; + m_bSSGarageStateChanging = true; + } + } + } + } + } + break; + case GS_CLOSING: + m_fDoorPos = Max(0.0f, m_fDoorPos - (m_bRotatedDoor ? ROTATED_DOOR_CLOSE_SPEED : DEFAULT_DOOR_CLOSE_SPEED) * CTimer::GetTimeStep()); + if (m_fDoorPos == 0.0f) { + // if (? == m_nSSGarageState) + { + if (m_pSSTargetCar) { + // if (m_pSSVehicle->GetVehiclePointer()) + { + if (IsEntityEntirelyInside3D(/* m_pSSVehicle->GetVehiclePointer() */nil, 0.0f)) { + if (m_pSSTargetCar) + m_pSSTargetCar->CleanUpOldReference((CEntity**)&m_pSSTargetCar); + CWorld::Remove(m_pSSTargetCar); + delete m_pSSTargetCar; + m_pSSTargetCar = nil; + m_pSSVehicle = nil; + m_bSSGarageAcceptedVehicle = true; + printf("Destroying Car Inside Crate....\n"); + } + } + } + } + // TODO: some loop :( + CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE); + m_eGarageState = GS_FULLYCLOSED; + DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_CLOSED, 1.0f); + } + UpdateDoorsHeight(); + if (!IsGarageEmpty()) + m_eGarageState = GS_OPENING; + break; + case GS_FULLYCLOSED: + { + // if (? == m_nSSGarageState) + { + if (CalcDistToGarageRectangleSquared(FindPlayerPed()->GetPosition().x, FindPlayerPed()->GetPosition().y) > SQR(10.0f)) + m_eGarageState = GS_OPENING; + } + break; + } + case GS_OPENING: + m_fDoorPos = Min(m_fDoorHeight, m_fDoorPos + (m_bRotatedDoor ? ROTATED_DOOR_OPEN_SPEED : DEFAULT_DOOR_OPEN_SPEED) * CTimer::GetTimeStep()); + if (m_fDoorPos == m_fDoorHeight) { + m_bSSGarageStateChanging = false; + m_eGarageState = GS_OPENED; + DMAudio.PlayOneShot(hGarages, SOUND_GARAGE_DOOR_OPENED, 1.0f); + } + UpdateDoorsHeight(); + break; + } + break; + } +#endif case GARAGE_CRUSHER: { - // for now version from III switch (m_eGarageState) { case GS_OPENED: { @@ -870,9 +1055,10 @@ void CGarage::Update() CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i); if (!pVehicle) continue; - if (pVehicle->IsCar() && IsEntityEntirelyInside3D(pVehicle, 0.0f)) { - m_eGarageState = GS_CLOSING; + if ((pVehicle->IsCar() || pVehicle->IsBike()) && IsEntityEntirelyInside3D(pVehicle, 0.0f)) { + m_eGarageState = GS_WAITINGFORCAR; m_pTarget = pVehicle; + m_nTimeCrusherCraneActivated = CTimer::GetTimeInMilliseconds(); m_pTarget->RegisterReference((CEntity**)&m_pTarget); } } @@ -892,9 +1078,10 @@ void CGarage::Update() if (m_fDoorPos == 0.0f) { CGarages::CrushedCarId = CPools::GetVehiclePool()->GetIndex(m_pTarget); float reward = Min(CRUSHER_MAX_REWARD, CRUSHER_MIN_REWARD + m_pTarget->pHandling->nMonetaryValue * m_pTarget->m_fHealth * CRUSHER_REWARD_COEFFICIENT); - CWorld::Players[CWorld::PlayerInFocus].m_nMoney += reward; + CWorld::Players[CWorld::PlayerInFocus].m_nMoney += reward * CGarages::CrusherRewardMultiplier; + CMessages::AddMessageWithNumber(TheText.Get("CRUSHED"), 5000, 1, reward* CGarages::CrusherRewardMultiplier, -1, -1, -1, -1, -1); DestroyVehicleAndDriverAndPassengers(m_pTarget); - //++CStats::CarsCrushed; + //++CStats::CarsCrushed; // TODO m_pTarget = nil; m_eGarageState = GS_AFTERDROPOFF; m_nTimeToStartAction = CTimer::GetTimeInMilliseconds() + TIME_TO_CRUSH_CAR; @@ -922,9 +1109,12 @@ void CGarage::Update() } UpdateCrusherAngle(); break; - //case GS_FULLYCLOSED: - //case GS_CLOSEDCONTAINSCAR: - //case GS_OPENEDCONTAINSCAR: + case GS_WAITINGFORCAR: + if (m_pTarget) { + if (CTimer::GetTimeInMilliseconds() - m_nTimeCrusherCraneActivated > 3000) + m_eGarageState = GS_CLOSING; + } + break; default: break; } @@ -1089,7 +1279,10 @@ void CGarage::Update() break; case GS_FULLYCLOSED: { - float distance = CalcDistToGarageRectangleSquared(FindPlayerCoors().x, FindPlayerCoors().y); + float distance = INFINITY; + if (CWorld::Players[CWorld::PlayerInFocus].m_pPed) { + distance = CalcDistToGarageRectangleSquared(FindPlayerCoors().x, FindPlayerCoors().y); + } if (distance < SQR(DISTANCE_TO_OPEN_HIDEOUT_GARAGE_ON_FOOT) || distance < SQR(DISTANCE_TO_OPEN_HIDEOUT_GARAGE_IN_CAR) && FindPlayerVehicle()) { if (FindPlayerVehicle() && CGarages::CountCarsInHideoutGarage(m_eGarageType) >= FindMaxNumStoredCarsForGarage()) { @@ -1281,8 +1474,15 @@ bool CGarage::IsEntityEntirelyInside3D(CEntity* pEntity, float fMargin) for (int i = 0; i < pColModel->numSpheres; i++) { CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center; float radius = pColModel->spheres[i].radius; - if (!IsPointInsideGarage(pos, fMargin - radius)) - return false; + if (m_eGarageType == GARAGE_CRATE_GARAGE) { + if (pos.x + radius < m_fInfX - fMargin || pos.x - radius > m_fSupX + fMargin || + pos.y + radius < m_fInfY - fMargin || pos.y - radius > m_fSupX + fMargin) + return false; + } + else { + if (!IsPointInsideGarage(pos, fMargin - radius)) + return false; + } } return true; } @@ -1296,12 +1496,23 @@ bool CGarage::IsEntityEntirelyOutside(CEntity * pEntity, float fMargin) for (int i = 0; i < pColModel->numSpheres; i++) { CVector pos = pEntity->GetMatrix() * pColModel->spheres[i].center; float radius = pColModel->spheres[i].radius; - if (IsPointInsideGarage(pos, fMargin + radius)) - return false; + if (m_eGarageType == GARAGE_CRATE_GARAGE) { + if (pos.x + radius > m_fInfX - fMargin && pos.x - radius < m_fSupX + fMargin && + pos.y + radius > m_fInfY - fMargin && pos.y - radius < m_fSupX + fMargin) + return false; + } + else { + if (IsPointInsideGarage(pos, fMargin + radius)) + return false; + } } return true; } +#ifdef GTA_NETWORK +// some CGarage method (0x134E7C) +#endif + bool CGarage::IsGarageEmpty() { int16 num; @@ -1472,23 +1683,20 @@ void CGarage::RemoveCarsBlockingDoorNotInside() void CGarages::PrintMessages() { if (CTimer::GetTimeInMilliseconds() > MessageStartTime && CTimer::GetTimeInMilliseconds() < MessageEndTime) { + // CRadar::m_FadeDownRadar = true; // TODO CFont::DrawFonts(); - CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.5f)); + float x_scale = FrontEndMenuManager.m_PrefsUseWideScreen ? 0.34506f : 0.3834f; + CFont::SetScale(PSP_SCREEN_SCALE_X(x_scale), PSP_SCREEN_SCALE_Y(0.71f)); CFont::SetPropOn(); CFont::SetJustifyOff(); CFont::SetBackgroundOff(); -#ifdef FIX_BUGS - CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 50)); -#else - CFont::SetCentreSize(SCREEN_WIDTH - 50); -#endif CFont::SetCentreOn(); CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD)); CFont::SetColor(CRGBA(27, 89, 130, 255)); CFont::SetDropShadowPosition(2); CFont::SetDropColor(CRGBA(0, 0, 0, 255)); - - float y_offset = SCREEN_SCALE_Y(140.0f); + CFont::SetCentreSize(PSP_SCREEN_SCALE_X(454.0f)); + float y_offset = PSP_SCREEN_SCALE_Y(170.0f); if (MessageNumberInString2 >= 0) { CMessages::InsertNumberInString(TheText.Get(MessageIDString), MessageNumberInString, MessageNumberInString2, -1, -1, -1, -1, gUString); @@ -1509,6 +1717,7 @@ bool CGarages::IsCarSprayable(CVehicle * pVehicle) switch (pVehicle->GetModelIndex()) { case MI_FIRETRUCK: case MI_AMBULAN: + case MI_FBICAR: case MI_POLICE: case MI_ENFORCER: case MI_BUS: @@ -1516,9 +1725,6 @@ bool CGarages::IsCarSprayable(CVehicle * pVehicle) case MI_BARRACKS: case MI_DODO: case MI_COACH: -#ifndef GTA_PS2 - case MI_FBIRANCH: -#endif return false; default: break; @@ -1568,9 +1774,9 @@ void CGarage::BuildRotatedDoorMatrix(CEntity * pDoor, float fPosition) void CGarage::UpdateCrusherAngle() { RefreshDoorPointers(false); - m_pDoor1->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); - m_pDoor1->GetMatrix().UpdateRW(); - m_pDoor1->UpdateRwFrame(); + m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); + m_pDoor2->GetMatrix().UpdateRW(); + m_pDoor2->UpdateRwFrame(); } void CGarage::UpdateCrusherShake(float X, float Y) @@ -1655,6 +1861,7 @@ void CGarages::TriggerMessage(const char* text, int16 num1, uint16 time, int16 n MessageEndTime = CTimer::GetTimeInMilliseconds() - 500 + time; } else { + CMessages::AddToPreviousBriefArray(TheText.Get(text), -1, -1, -1, -1, -1, -1, nil); strcpy(MessageIDString, text); MessageStartTime = CTimer::GetTimeInMilliseconds(); MessageEndTime = CTimer::GetTimeInMilliseconds() + time; @@ -1700,7 +1907,8 @@ int32 CGarages::QueryCarsCollected(int16 garage) bool CGarages::HasImportExportGarageCollectedThisCar(int16 garage, int8 car) { - return CarTypesCollected[GetCarsCollectedIndexForGarageType(aGarages[garage].m_eGarageType)] & (BIT(car)); + uint32 total; + return CarTypesCollected[GetCarsCollectedIndexForGarageType(aGarages[garage].m_eGarageType, total)] & (BIT(car)); } bool CGarages::IsGarageOpen(int16 garage) @@ -1720,8 +1928,9 @@ bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id) bool CGarage::DoesCraigNeedThisCar(int32 mi) { - int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); - for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) { + uint32 total; + int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType, total); + for (int i = 0; i < total; i++) { if (mi == gaCarsToCollectInCraigsGarages[ct][i] || (gaCarsToCollectInCraigsGarages[ct][i] == MI_CHEETAH && mi == MI_VICECHEE)) return (CGarages::CarTypesCollected[ct] & BIT(i)) == 0; } @@ -1730,9 +1939,10 @@ bool CGarage::DoesCraigNeedThisCar(int32 mi) bool CGarage::HasCraigCollectedThisCar(int32 mi) { - int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); - for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) { - if (mi == gaCarsToCollectInCraigsGarages[ct][i] || (gaCarsToCollectInCraigsGarages[ct][i] == MI_CHEETAH && mi == MI_VICECHEE)) + uint32 total; + int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType, total); + for (int i = 0; i < total; i++) { + if (mi == gaCarsToCollectInCraigsGarages[ct][i]) return CGarages::CarTypesCollected[ct] & BIT(i); } return false; @@ -1740,24 +1950,21 @@ bool CGarage::HasCraigCollectedThisCar(int32 mi) bool CGarage::MarkThisCarAsCollectedForCraig(int32 mi) { - int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType); + uint32 total; + int ct = CGarages::GetCarsCollectedIndexForGarageType(m_eGarageType, total); int index; - for (index = 0; index < TOTAL_COLLECTCARS_CARS; index++) { - if (mi == gaCarsToCollectInCraigsGarages[ct][index] || (gaCarsToCollectInCraigsGarages[ct][index] == MI_CHEETAH && mi == MI_VICECHEE)) + for (index = 0; index < total; index++) { + if (mi == gaCarsToCollectInCraigsGarages[ct][index]) break; } - if (index >= TOTAL_COLLECTCARS_CARS) + if (index >= total) return false; CGarages::CarTypesCollected[ct] |= BIT(index); - CWorld::Players[CWorld::PlayerInFocus].m_nMoney += IMPORT_REWARD; - for (int i = 0; i < TOTAL_COLLECTCARS_CARS; i++) { + for (int i = 0; i < total; i++) { if ((CGarages::CarTypesCollected[ct] & BIT(i)) == 0) { - CGarages::TriggerMessage("GA_13", -1, 5000, -1); // Delivered like a pro. Complete the list and there'll be a bonus for you. return false; } } - CWorld::Players[CWorld::PlayerInFocus].m_nMoney += IMPORT_ALLCARS_REWARD; - CGarages::TriggerMessage("GA_14", -1, 5000, -1); // All the cars. NICE! Here's a little something. return true; } @@ -1854,8 +2061,27 @@ void CGarage::FindDoorsEntitiesSectorList(CPtrList& list, bool dummy) pEntity->m_scanCode = CWorld::GetCurrentScanCode(); if (!pEntity || !CGarages::IsModelIndexADoor(pEntity->GetModelIndex())) continue; - if (!IsPointInsideGarage(pEntity->GetPosition(), 2.0f)) + if (Abs(pEntity->GetPosition().x - GetGarageCenterX()) >= 20.0f || + Abs(pEntity->GetPosition().y - GetGarageCenterY()) >= 20.0f) continue; + if (pEntity->GetModelIndex() == MI_CRUSHERBODY) { + m_pDoor1 = pEntity; + m_bDoor1IsDummy = dummy; + if (dummy) + m_bDoor1PoolIndex = (CPools::GetDummyPool()->GetIndex((CDummy*)pEntity)) & 0x7F; + else + m_bDoor1PoolIndex = (CPools::GetObjectPool()->GetIndex((CObject*)pEntity)) & 0x7F; + continue; + } + if (pEntity->GetModelIndex() == MI_CRUSHERLID) { + m_pDoor2 = pEntity; + m_bDoor2IsDummy = dummy; + if (dummy) + m_bDoor2PoolIndex = (CPools::GetDummyPool()->GetIndex((CDummy*)pEntity)) & 0x7F; + else + m_bDoor2PoolIndex = (CPools::GetObjectPool()->GetIndex((CObject*)pEntity)) & 0x7F; + continue; + } if (!m_pDoor1) { m_pDoor1 = pEntity; m_bDoor1IsDummy = dummy; @@ -1912,25 +2138,48 @@ bool CGarages::HasCarBeenCrushed(int32 handle) void CStoredCar::StoreCar(CVehicle* pVehicle) { m_nModelIndex = pVehicle->GetModelIndex(); - m_vecPos = pVehicle->GetPosition(); - m_vecAngle = pVehicle->GetForward(); + m_fPosX = pVehicle->GetPosition().x; + m_fPosY = pVehicle->GetPosition().y; + m_fPosY = pVehicle->GetPosition().z; + m_fForwardX = pVehicle->GetForward().x; + m_fForwardY = pVehicle->GetForward().y; + m_fForwardZ = pVehicle->GetForward().z; + m_fTractionMultiplier = 1.0f; m_nPrimaryColor = pVehicle->m_currentColour1; m_nSecondaryColor = pVehicle->m_currentColour2; m_nRadioStation = pVehicle->m_nRadioStation; m_nVariationA = pVehicle->m_aExtras[0]; m_nVariationB = pVehicle->m_aExtras[1]; - m_bBulletproof = pVehicle->bBulletProof; - m_bFireproof = pVehicle->bFireProof; - m_bExplosionproof = pVehicle->bExplosionProof; - m_bCollisionproof = pVehicle->bCollisionProof; - m_bMeleeproof = pVehicle->bMeleeProof; - if (pVehicle->IsCar() || pVehicle->IsBike()) - m_nCarBombType = ((CAutomobile*)pVehicle)->m_bombType; // NB: cast to CAutomobile is original behaviour + m_nFlags = 0; + if (pVehicle->bRewardVehicle) m_nFlags |= FLAG_REWARD_VEHICLE; + if (pVehicle->bBulletProof) m_nFlags |= FLAG_BULLETPROOF; + if (pVehicle->bFireProof) m_nFlags |= FLAG_FIREPROOF; + if (pVehicle->bExplosionProof) m_nFlags |= FLAG_EXPLOSIONPROOF; + if (pVehicle->bCollisionProof) m_nFlags |= FLAG_COLLISIONPROOF; + if (pVehicle->bMeleeProof) m_nFlags |= FLAG_MELEEPROOF; + if (pVehicle->bTyresDontBurst) m_nFlags |= FLAG_TIRES_INVULNERABLE; + if (pVehicle->bTakeLessDamage) m_nFlags |= FLAG_STRONG; + if (pVehicle->bIsHeavy) m_nFlags |= FLAG_HEAVY; + if (pVehicle->IsCar()) { + CAutomobile* pAutomobile = (CAutomobile*)pVehicle; + if (pAutomobile->bFixedColour) m_nFlags |= FLAG_PERMANENT_COLOUR; + if (pAutomobile->m_bombType) m_nFlags |= FLAG_BOMB; + if (pAutomobile->bNotDamagedUpsideDown) m_nFlags |= FLAG_NOT_DAMAGED_UPSIDEDOWN; + m_fTractionMultiplier = pAutomobile->m_fTraction; + } + else if (pVehicle->IsBike()) { + CBike* pBike = (CBike*)pVehicle; + if (pBike->bFixedColour) m_nFlags |= FLAG_PERMANENT_COLOUR; + m_fTractionMultiplier = pBike->m_fTraction; + } } CVehicle* CStoredCar::RestoreCar() { CStreaming::RequestModel(m_nModelIndex, STREAMFLAGS_DEPENDENCY); + uint8 owner = RANDOM_VEHICLE; + if (m_nFlags & FLAG_REWARD_VEHICLE) + owner = MISSION_VEHICLE; if (!CStreaming::HasModelLoaded(m_nModelIndex)) return nil; #ifdef FIX_BUGS @@ -1943,19 +2192,19 @@ CVehicle* CStoredCar::RestoreCar() } CVehicle* pVehicle; if (CModelInfo::IsBoatModel(m_nModelIndex)) - pVehicle = new CBoat(m_nModelIndex, RANDOM_VEHICLE); + pVehicle = new CBoat(m_nModelIndex, owner); else if (CModelInfo::IsBikeModel(m_nModelIndex)) { - CBike* pBike = new CBike(m_nModelIndex, RANDOM_VEHICLE); + CBike* pBike = new CBike(m_nModelIndex, owner); pBike->bIsStanding = true; pVehicle = pBike; } else - pVehicle = new CAutomobile(m_nModelIndex, RANDOM_VEHICLE); - pVehicle->SetPosition(m_vecPos); + pVehicle = new CAutomobile(m_nModelIndex, owner); + pVehicle->SetPosition(m_fPosX, m_fPosY, m_fPosZ); pVehicle->SetStatus(STATUS_ABANDONED); - pVehicle->GetForward() = m_vecAngle; - pVehicle->GetRight() = CVector(m_vecAngle.y, -m_vecAngle.x, 0.0f); + pVehicle->GetForward() = CVector(m_fForwardX, m_fForwardY, m_fForwardZ); + pVehicle->GetRight() = CVector(m_fForwardY, -m_fForwardX, 0.0f); pVehicle->GetUp() = CVector(0.0f, 0.0f, 1.0f); pVehicle->pDriver = nil; pVehicle->m_currentColour1 = m_nPrimaryColor; @@ -1972,11 +2221,36 @@ CVehicle* CStoredCar::RestoreCar() } pVehicle->bHasBeenOwnedByPlayer = true; pVehicle->m_nDoorLock = CARLOCK_UNLOCKED; - pVehicle->bBulletProof = m_bBulletproof; - pVehicle->bFireProof = m_bFireproof; - pVehicle->bExplosionProof = m_bExplosionproof; - pVehicle->bCollisionProof = m_bCollisionproof; - pVehicle->bMeleeProof = m_bMeleeproof; + if (m_nFlags & FLAG_REWARD_VEHICLE) pVehicle->bRewardVehicle = true; + if (m_nFlags & FLAG_BULLETPROOF) pVehicle->bBulletProof = true; + if (m_nFlags & FLAG_FIREPROOF) pVehicle->bFireProof = true; + if (m_nFlags & FLAG_EXPLOSIONPROOF) pVehicle->bExplosionProof = true; + if (m_nFlags & FLAG_COLLISIONPROOF) pVehicle->bCollisionProof = true; + if (m_nFlags & FLAG_MELEEPROOF) pVehicle->bMeleeProof = true; + if (m_nFlags & FLAG_TIRES_INVULNERABLE) pVehicle->bTyresDontBurst = true; + if (m_nFlags & FLAG_STRONG) pVehicle->bTakeLessDamage = true; + if (m_nFlags & FLAG_HEAVY) { + pVehicle->bIsHeavy = true; + pVehicle->m_fMass = pVehicle->pHandling->GetMass(); + pVehicle->m_fTurnMass = pVehicle->pHandling->GetTurnMass(); + } + else { + pVehicle->bIsHeavy = false; + pVehicle->m_fMass = pVehicle->pHandling->GetMass() * 3.0f; + pVehicle->m_fTurnMass = pVehicle->pHandling->GetTurnMass() * 5.0f; + } + if (pVehicle->IsCar()) { + CAutomobile* pAutomobile = (CAutomobile*)pVehicle; + if (m_nFlags & FLAG_PERMANENT_COLOUR) pAutomobile->bFixedColour = true; + if (m_nFlags & FLAG_BOMB) pAutomobile->m_bombType = CARBOMB_TIMED; + if (m_nFlags & FLAG_NOT_DAMAGED_UPSIDEDOWN) pAutomobile->bNotDamagedUpsideDown = true; + m_fTractionMultiplier = pAutomobile->m_fTraction; + } + else if (pVehicle->IsBike()) { + CBike* pBike = (CBike*)pVehicle; + if (m_nFlags & FLAG_PERMANENT_COLOUR) pBike->bFixedColour = true; + m_fTractionMultiplier = pBike->m_fTraction; + } return pVehicle; } @@ -1991,13 +2265,23 @@ void CGarage::StoreAndRemoveCarsForThisHideout(CStoredCar* aCars, int32 nMax) if (!pVehicle) continue; if (IsPointInsideGarage(pVehicle->GetPosition())) { - if (pVehicle->VehicleCreatedBy != MISSION_VEHICLE) { - if (index < Max(NUM_GARAGE_STORED_CARS, nMax) && !EntityHasASphereWayOutsideGarage(pVehicle, 1.0f)) - aCars[index++].StoreCar(pVehicle); +#if defined GTA_PS2 || defined GTA_MOBILE + if (pVehicle->GetStatus() == STATUS_WRECKED) { CWorld::Players[CWorld::PlayerInFocus].CancelPlayerEnteringCars(pVehicle); CWorld::Remove(pVehicle); delete pVehicle; } + else if (pVehicle->m_bombType == CARBOMB_NONE || pVehicle->bRewardVehicle) // <- probably condition looked different +#endif + { + if (pVehicle->VehicleCreatedBy != MISSION_VEHICLE || pVehicle->bRewardVehicle) { + if (index < Max(NUM_GARAGE_STORED_CARS, nMax) && !EntityHasASphereWayOutsideGarage(pVehicle, 1.0f)) + aCars[index++].StoreCar(pVehicle); + CWorld::Players[CWorld::PlayerInFocus].CancelPlayerEnteringCars(pVehicle); + CWorld::Remove(pVehicle); + delete pVehicle; + } + } } } // why? @@ -2140,7 +2424,7 @@ void CGarage::PlayerArrestedOrDied() case GARAGE_COLLECTCARS_2: case GARAGE_COLLECTCARS_3: case GARAGE_FORCARTOCOMEOUTOF: - case GARAGE_60SECONDS: + case GARAGE_CRATE_GARAGE: case GARAGE_MISSION_KEEPCAR: case GARAGE_FOR_SCRIPT_TO_OPEN: case GARAGE_HIDEOUT_ONE: @@ -2302,6 +2586,8 @@ void CGarages::SetAllDoorsBackToOriginalHeight() default: aGarages[i].RefreshDoorPointers(true); if (aGarages[i].m_pDoor1) { + aGarages[i].m_pDoor1->GetMatrix().GetPosition().x = aGarages[i].m_fDoor1X; + aGarages[i].m_pDoor1->GetMatrix().GetPosition().y = aGarages[i].m_fDoor1Y; aGarages[i].m_pDoor1->GetMatrix().GetPosition().z = aGarages[i].m_fDoor1Z; if (aGarages[i].m_pDoor1->IsObject()) ((CObject*)aGarages[i].m_pDoor1)->m_objectMatrix.GetPosition().z = aGarages[i].m_fDoor1Z; @@ -2311,6 +2597,8 @@ void CGarages::SetAllDoorsBackToOriginalHeight() aGarages[i].m_pDoor1->UpdateRwFrame(); } if (aGarages[i].m_pDoor2) { + aGarages[i].m_pDoor2->GetMatrix().GetPosition().x = aGarages[i].m_fDoor2X; + aGarages[i].m_pDoor2->GetMatrix().GetPosition().y = aGarages[i].m_fDoor2Y; aGarages[i].m_pDoor2->GetMatrix().GetPosition().z = aGarages[i].m_fDoor2Z; if (aGarages[i].m_pDoor2->IsObject()) ((CObject*)aGarages[i].m_pDoor2)->m_objectMatrix.GetPosition().z = aGarages[i].m_fDoor2Z; @@ -2326,7 +2614,7 @@ void CGarages::SetAllDoorsBackToOriginalHeight() void CGarages::Save(uint8 * buf, uint32 * size) { //INITSAVEBUF - *size = 7876; // for some reason it's not actual size again + *size = 10692; // for some reason it's not actual size again //*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)); CloseHideOutGaragesBeforeSave(); WriteSaveBuf(buf, NumGarages); @@ -2348,29 +2636,10 @@ void CGarages::Save(uint8 * buf, uint32 * size) //VALIDATESAVEBUF(*size); } -const CStoredCar &CStoredCar::operator=(const CStoredCar & other) -{ - m_nModelIndex = other.m_nModelIndex; - m_vecPos = other.m_vecPos; - m_vecAngle = other.m_vecAngle; - m_bBulletproof = other.m_bBulletproof; - m_bFireproof = other.m_bFireproof; - m_bExplosionproof = other.m_bExplosionproof; - m_bCollisionproof = other.m_bCollisionproof; - m_bMeleeproof = other.m_bMeleeproof; - m_nPrimaryColor = other.m_nPrimaryColor; - m_nSecondaryColor = other.m_nSecondaryColor; - m_nRadioStation = other.m_nRadioStation; - m_nVariationA = other.m_nVariationA; - m_nVariationB = other.m_nVariationB; - m_nCarBombType = other.m_nCarBombType; - return *this; -} - void CGarages::Load(uint8* buf, uint32 size) { //INITSAVEBUF - assert(size = 7876); + assert(size == 10692); //assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage))); CloseHideOutGaragesBeforeSave(); NumGarages = ReadSaveBuf<uint32>(buf); @@ -2489,3 +2758,109 @@ bool CGarage::IsPlayerEntirelyInsideGarage() { return IsEntityEntirelyInside3D(FindPlayerVehicle() ? (CEntity*)FindPlayerVehicle() : (CEntity*)FindPlayerPed(), 0.0f); } + +int16 CGarages::AddCrateGarage(CVector pos, float angle) +{ + CMatrix matrix; + matrix.SetUnity(); + matrix.SetRotateZOnly(DEGTORAD(angle)); + CStreaming::RequestModel(MI_CRATE_SJL, STREAMFLAGS_DEPENDENCY); +#ifdef FIX_BUGS + CStreaming::LoadAllRequestedModels(false); +#endif + CObject* pCrate = new CObject(MI_CRATE_SJL, false); + pCrate->ObjectCreatedBy = MISSION_OBJECT; + pCrate->SetPosition(pos); + pCrate->SetOrientation(0.0f, 0.0f, DEGTORAD(angle)); + pCrate->GetMatrix().UpdateRW(); + pCrate->UpdateRwFrame(); + pCrate->bAffectedByGravity = false; + pCrate->m_phy_flagA08 = true; + pCrate->bExplosionProof = true; + pCrate->bIsStatic = false; + + CStreaming::RequestModel(MI_DOOR1_SJL, STREAMFLAGS_DEPENDENCY); +#ifdef FIX_BUGS + CStreaming::LoadAllRequestedModels(false); +#endif + CObject* pDoor1 = new CObject(MI_DOOR1_SJL, false); + pDoor1->ObjectCreatedBy = MISSION_OBJECT; + CVector vDoor1Pos = matrix * CVector(0.0f, 5.64f, 5.168f); + pDoor1->SetPosition(vDoor1Pos); + pDoor1->SetOrientation(0.0f, 0.0f, DEGTORAD(angle)); + pDoor1->GetMatrix().UpdateRW(); + pDoor1->UpdateRwFrame(); + pDoor1->bAffectedByGravity = false; + pDoor1->m_phy_flagA08 = true; + pDoor1->bExplosionProof = true; + pDoor1->bIsStatic = false; + + CStreaming::RequestModel(MI_DOOR2_SJL, STREAMFLAGS_DEPENDENCY); +#ifdef FIX_BUGS + CStreaming::LoadAllRequestedModels(false); +#endif + CObject* pDoor2 = new CObject(MI_DOOR2_SJL, false); + pDoor2->ObjectCreatedBy = MISSION_OBJECT; + CVector vDoor2Pos = matrix * CVector(0.0f, -5.64f, 5.168f); + pDoor2->SetPosition(vDoor2Pos); + pDoor2->SetOrientation(0.0f, 0.0f, DEGTORAD(angle)); + pDoor2->GetMatrix().UpdateRW(); + pDoor2->UpdateRwFrame(); + pDoor2->bAffectedByGravity = false; + pDoor2->m_phy_flagA08 = true; + pDoor2->bExplosionProof = true; + pDoor2->bIsStatic = false; + + CWorld::Add(pCrate); + CWorld::Add(pDoor1); + CWorld::Add(pDoor2); + + CVector corner = matrix * CVector(-3.0f, -3.5f, -0.5f) + pos; + CVector xplane = matrix * CVector(0.0f, 2.0f, 0.0f) + pos; + CVector yplane = matrix * CVector(0.0f, 0.0f, 0.0f) + pos; + + printf("Posttrans Corner[%f][%f][%f] XPlane[%f][%f][%f] YPlane[%f][%f][%f]", + corner.x, corner.y, corner.z, xplane.x, xplane.y, xplane.z, yplane.x, yplane.y, yplane.z); + int16 index = AddOne(corner.x, corner.y, corner.z, xplane.x, xplane.y, yplane.x, yplane.y, pos.z + 4.0f, GARAGE_CRATE_GARAGE, 0); + SetLeaveCameraForThisGarage(index); + CGarage* pGarage = &aGarages[index]; + pGarage->m_bSSGarageAcceptedVehicle = false; + pGarage->m_bSSGarageStateChanging = false; + pGarage->m_vecSSGaragePos = pos; + pGarage->m_fSSGarageAngle = angle; + return index; +} + +#ifdef GTA_NETWORK +void CGarages::RemoveAllCrateGarages() +{ + for (uint32 i = 0; i < NUM_GARAGES; i++) { + CGarage* pGarage = &aGarages[i]; + if (pGarage->m_eGarageType == GARAGE_CRATE_GARAGE) { + pGarage->m_eGarageType = GARAGE_NONE; + pGarage->m_bSSGarageStateChanging = false; + pGarage->m_bSSGarageAcceptedVehicle = false; + pGarage->m_pSSVehicle = nil; + --NumGarages; + } + } +} + +bool CGarages::HasSSGarageAcceptedVehicle(int16 garage) +{ + return aGarages[garage].m_bSSGarageAcceptedVehicle; +} + +void CGarages::SetVehicleForSSGarage(bool state, int16 garage, void* pVehicle) +{ + CGarage* pGarage = &aGarages[garage]; + pGarage->m_pSSVehicle = pVehicle; + pGarage->m_nSSGarageState = state; + pGarage->m_bSSGarageAcceptedVehicle = false; + if (!pVehicle) { + if (pGarage->m_pSSTargetCar) + pGarage->m_pSSTargetCar->CleanUpOldReference((CEntity**)pGarage->m_pSSTargetCar); + pGarage->m_pSSTargetCar = nil; + } +} +#endif diff --git a/src/control/Garages.h b/src/control/Garages.h index c3542d27..2ab74606 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -15,6 +15,7 @@ enum eGarageState GS_OPENEDCONTAINSCAR, GS_CLOSEDCONTAINSCAR, GS_AFTERDROPOFF, + GS_WAITINGFORCAR }; enum eGarageType @@ -31,7 +32,7 @@ enum eGarageType GARAGE_COLLECTCARS_2, GARAGE_COLLECTCARS_3, GARAGE_FORCARTOCOMEOUTOF, - GARAGE_60SECONDS, + GARAGE_CRATE_GARAGE, GARAGE_CRUSHER, GARAGE_MISSION_KEEPCAR, GARAGE_FOR_SCRIPT_TO_OPEN, @@ -58,19 +59,34 @@ enum { TOTAL_COLLECTCARS_GARAGES = 4, TOTAL_HIDEOUT_GARAGES = 12, - TOTAL_COLLECTCARS_CARS = 6 + TOTAL_COLLECTCARS_CARS = 16 }; class CStoredCar { + enum { + FLAG_BULLETPROOF = 0x1, + FLAG_FIREPROOF = 0x2, + FLAG_EXPLOSIONPROOF = 0x4, + FLAG_COLLISIONPROOF = 0x8, + FLAG_MELEEPROOF = 0x10, + FLAG_TIRES_INVULNERABLE = 0x20, + FLAG_STRONG = 0x40, + FLAG_HEAVY = 0x80, + FLAG_PERMANENT_COLOUR = 0x100, + FLAG_BOMB = 0x200, + FLAG_NOT_DAMAGED_UPSIDEDOWN = 0x400, + FLAG_REWARD_VEHICLE = 0x8000 + }; int32 m_nModelIndex; - CVector m_vecPos; - CVector m_vecAngle; - int32 m_bBulletproof : 1; - int32 m_bFireproof : 1; - int32 m_bExplosionproof : 1; - int32 m_bCollisionproof : 1; - int32 m_bMeleeproof : 1; + float m_fPosX; + float m_fPosY; + float m_fPosZ; + float m_fForwardX; + float m_fForwardY; + float m_fForwardZ; + float m_fTractionMultiplier; + int32 m_nFlags; int8 m_nPrimaryColor; int8 m_nSecondaryColor; int8 m_nRadioStation; @@ -81,7 +97,6 @@ public: void Init() { m_nModelIndex = 0; } void Clear() { m_nModelIndex = 0; } bool HasCar() { return m_nModelIndex != 0; } - const CStoredCar &operator=(const CStoredCar& other); void StoreCar(CVehicle*); CVehicle* RestoreCar(); }; @@ -115,12 +130,16 @@ public: CVector2D m_vDir1; CVector2D m_vDir2; float m_fSupZ; + CVector m_vecSSGaragePos; + float m_fSSGarageAngle; float m_fDir1Len; float m_fDir2Len; float m_fInfX; float m_fSupX; float m_fInfY; float m_fSupY; + uint32 m_nTimeCrusherCraneActivated; + CVehicle* m_pSSTargetCar; float m_fDoorPos; float m_fDoorHeight; float m_fDoor1X; @@ -133,6 +152,14 @@ public: uint8 m_bCollectedCarsState; CVehicle *m_pTarget; CStoredCar m_sStoredCar; // not needed + bool m_bInitialized; +#ifdef GTA_NETWORK + void* m_pSSVehicle; // some multiplayer vehicle structure, +104 == GetVehiclePointer +#endif + bool m_bSSGarageAcceptedVehicle; + bool m_bLocked; + bool m_nSSGarageState; + bool m_bSSGarageStateChanging; void OpenThisGarage(); void CloseThisGarage(); @@ -219,6 +246,7 @@ public: static CGarage aGarages[NUM_GARAGES]; static CStoredCar aCarsInSafeHouses[TOTAL_HIDEOUT_GARAGES][NUM_GARAGE_STORED_CARS]; static bool bCamShouldBeOutisde; + static uint8 CrusherRewardMultiplier; static void Init(void); #ifndef PS2 @@ -266,13 +294,13 @@ public: static void CloseHideOutGaragesBeforeSave(void); static int32 CountCarsInHideoutGarage(uint8); static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 1; } - static int32 GetCarsCollectedIndexForGarageType(uint8 type) + static int32 GetCarsCollectedIndexForGarageType(uint8 type, uint32& total) { switch (type) { - case GARAGE_COLLECTCARS_1: return 0; - case GARAGE_COLLECTCARS_2: return 1; - case GARAGE_COLLECTCARS_3: return 2; - case GARAGE_COLLECTCARS_4: return 3; + case GARAGE_COLLECTCARS_1: total = TOTAL_COLLECTCARS_CARS; return 0; + case GARAGE_COLLECTCARS_2: total = 0; return 1; + case GARAGE_COLLECTCARS_3: total = 0; return 2; + case GARAGE_COLLECTCARS_4: total = 0; return 3; default: assert(0); } return 0; @@ -297,6 +325,15 @@ public: } static bool IsThisGarageTypeSafehouse(uint8 type) { return FindSafeHouseIndexForGarageType(type) >= 0; } - static void SetupAnyGaragesForThisIsland(void) {} // TODO(LCS) + static bool InitDoorGubbins(uint32, uint8); + static void SetupAnyGaragesForThisIsland(void); + static void LockGarage(int16, bool); + static int16 AddCrateGarage(CVector, float); + +#ifdef GTA_NETWORK + static void RemoveAllCrateGarages(); + static bool HasSSGarageAcceptedVehicle(int16 garage); + static void SetVehicleForSSGarage(bool state, int16 garage, void* pVehicle); // void* -> ? +#endif }; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index d12bbb40..8ce2d84d 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1808,7 +1808,7 @@ const tScriptCommandData commands[] = { REGISTER_COMMAND(COMMAND_PRINT_HELP_FOREVER_NO_BRIEF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_PRINT_HELP_ALWAYS_NO_BRIEF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_PRINT_HELP_FOREVER_ALWAYS_NO_BRIEF, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), - REGISTER_COMMAND(COMMAND_SET_MISSION_CAR_CAN_BE_STORED_IN_GARAGE, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), + REGISTER_COMMAND(COMMAND_SET_CAR_IS_REWARD, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), }; #undef REGISTER_COMMAND diff --git a/src/control/Script10.cpp b/src/control/Script10.cpp index 6514ebe5..ac3961a7 100644 --- a/src/control/Script10.cpp +++ b/src/control/Script10.cpp @@ -7,6 +7,7 @@ #include "DMAudio.h" #include "Frontend.h" #include "GameLogic.h" +#include "Garages.h" #include "General.h" #include "Hud.h" #include "Messages.h" @@ -286,7 +287,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command) return 0; case COMMAND_LOCK_GARAGE: CollectParameters(&m_nIp, 2); - // CGarages::LockGarage(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); + CGarages::LockGarage(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); return 0; case COMMAND_IS_FINAL_GAME: #ifdef FINAL @@ -391,12 +392,12 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command) CHud::SetHelpMessage(text, false, true); // + false return 0; } - case COMMAND_SET_MISSION_CAR_CAN_BE_STORED_IN_GARAGE: + case COMMAND_SET_CAR_IS_REWARD: { CollectParameters(&m_nIp, 2); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); script_assert(pVehicle); - pVehicle->bAllowGarageToStore = (GET_INTEGER_PARAM(1) != 0); + pVehicle->bRewardVehicle = (GET_INTEGER_PARAM(1) != 0); return 0; } case COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS: diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp index f05c21eb..64014ac8 100644 --- a/src/control/Script3.cpp +++ b/src/control/Script3.cpp @@ -1225,6 +1225,10 @@ int8 CRunningScript::ProcessCommands600To699(int32 command) if (pVehicle->m_vehType == VEHICLE_TYPE_CAR) #endif ((CAutomobile*)pVehicle)->bFixedColour = (GET_INTEGER_PARAM(1) == 0); +#ifdef FIX_BUGS + else if (pVehicle->m_vehType == VEHICLE_TYPE_BIKE) + ((CBike*)pVehicle)->bFixedColour = (GET_INTEGER_PARAM(1) == 0); +#endif return 0; } diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp index c50f0dea..6dd6e281 100644 --- a/src/control/Script7.cpp +++ b/src/control/Script7.cpp @@ -438,8 +438,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) { CollectParameters(&m_nIp, 1); CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); - script_assert(pObject); - UpdateCompareFlag(pObject->bIsInWater); + UpdateCompareFlag(pObject && pObject->bIsInWater); return 0; } //case COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR_EVEN_MISSION_CAR: diff --git a/src/control/ScriptCommands.h b/src/control/ScriptCommands.h index 76bc4aa3..000f561c 100644 --- a/src/control/ScriptCommands.h +++ b/src/control/ScriptCommands.h @@ -1656,7 +1656,7 @@ enum { COMMAND_PRINT_HELP_FOREVER_NO_BRIEF, COMMAND_PRINT_HELP_ALWAYS_NO_BRIEF, COMMAND_PRINT_HELP_FOREVER_ALWAYS_NO_BRIEF, - COMMAND_SET_MISSION_CAR_CAN_BE_STORED_IN_GARAGE, + COMMAND_SET_CAR_IS_REWARD, COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS, #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT LAST_SCRIPT_COMMAND diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index cbc4ede8..3a6b8252 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -647,7 +647,7 @@ extern CModelIndices *gpModelIndices; X("ind_slidedoor", MI_GARAGEDOOR6) \ X("bankjobdoor", MI_GARAGEDOOR7) \ X("door_jmsgrage", MI_GARAGEDOOR9) \ - X("jamesgrge_kb", MI_GARAGEDOOR10) \ + X("ind_safeh_gdoor", MI_GARAGEDOOR10) \ X("door_sfehousegrge", MI_GARAGEDOOR11) \ X("shedgaragedoor", MI_GARAGEDOOR12) \ X("door4_garage", MI_GARAGEDOOR13) \ diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index 6ad59769..f8ef4746 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -134,6 +134,8 @@ CBike::CBike(int32 id, uint8 CreatedBy) bIsOnFire = false; bWheelieCam = false; + bFixedColour = false; // <- figure out actual place (TODO) + m_fTireTemperature = 1.0f; m_fBrakeDestabilization = 0.0f; m_fVelocityChangeForAudio = 0; diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h index 219d8872..611cd11d 100644 --- a/src/vehicles/Bike.h +++ b/src/vehicles/Bike.h @@ -75,6 +75,7 @@ public: uint8 bExtraSpeed : 1; // leaning forward uint8 bIsOnFire : 1; uint8 bWheelieCam : 1; + uint8 bFixedColour : 1; // <- figure out its actual place (TODO) int16 m_doingBurnout; float m_fTireTemperature; float m_fBrakeDestabilization; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index a3d07d5c..67acf47d 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -133,6 +133,7 @@ CVehicle::CVehicle(uint8 CreatedBy) bCreatedAsPoliceVehicle = false; bRestingOnPhysical = false; bParking = false; + m_bGarageTurnedLightsOff = false; bCanPark = CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.0f; // never true. probably doesn't work very well bIsVan = false; bIsBus = false; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index cebafd77..450f1c3b 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -240,17 +240,17 @@ public: uint8 bRestingOnPhysical : 1; // Dont go static cause car is sitting on a physical object that might get removed uint8 bParking : 1; uint8 bCanPark : 1; -#if (!defined GTA_PS2 || defined FIX_BUGS) +#if (!defined GTA_PS2 || defined FIX_BUGS) // <- I think this can be moved back to CAutomobile? uint8 m_bombType : 3; #endif uint8 bDriverLastFrame : 1; - - uint8 bAllowGarageToStore : 1; // <- many LCS flags before + uint8 bRewardVehicle : 1; // 25B_40 int8 m_numPedsUseItAsCover; uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default) int8 m_nPacManPickupsCarried; uint8 m_nRoadblockType; + bool m_bGarageTurnedLightsOff; float m_fHealth; // 1000.0f = full health. 250.0f = fire. 0 -> explode float m_fEngineEnergy; // TODO(LCS): better name. it adds up acceleration force, so possibly kinetic energy?? uint8 m_nCurrentGear; |