Merge pull request #1013 from Nick007J/lcs

garages
This commit is contained in:
Nikolay 2021-02-06 01:04:06 +03:00 committed by GitHub
commit 410eb19ce6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 585 additions and 165 deletions

View file

@ -52,8 +52,8 @@ void CAutoPilot::Save(uint8*& buf)
WriteSaveBuf<int32>(buf, m_nCurrentRouteNode); WriteSaveBuf<int32>(buf, m_nCurrentRouteNode);
WriteSaveBuf<int32>(buf, m_nNextRouteNode); WriteSaveBuf<int32>(buf, m_nNextRouteNode);
WriteSaveBuf<int32>(buf, m_nPrevRouteNode); WriteSaveBuf<int32>(buf, m_nPrevRouteNode);
WriteSaveBuf<uint32>(buf, m_nTimeEnteredCurve); WriteSaveBuf<int32>(buf, m_nTimeEnteredCurve);
WriteSaveBuf<uint32>(buf, m_nTimeToSpendOnCurrentCurve); WriteSaveBuf<int32>(buf, m_nTimeToSpendOnCurrentCurve);
WriteSaveBuf<uint32>(buf, m_nCurrentPathNodeInfo); WriteSaveBuf<uint32>(buf, m_nCurrentPathNodeInfo);
WriteSaveBuf<uint32>(buf, m_nNextPathNodeInfo); WriteSaveBuf<uint32>(buf, m_nNextPathNodeInfo);
WriteSaveBuf<uint32>(buf, m_nPreviousPathNodeInfo); WriteSaveBuf<uint32>(buf, m_nPreviousPathNodeInfo);
@ -95,8 +95,8 @@ void CAutoPilot::Load(uint8*& buf)
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf); m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
m_nNextRouteNode = ReadSaveBuf<int32>(buf); m_nNextRouteNode = ReadSaveBuf<int32>(buf);
m_nPrevRouteNode = ReadSaveBuf<int32>(buf); m_nPrevRouteNode = ReadSaveBuf<int32>(buf);
m_nTimeEnteredCurve = ReadSaveBuf<uint32>(buf); m_nTimeEnteredCurve = ReadSaveBuf<int32>(buf);
m_nTimeToSpendOnCurrentCurve = ReadSaveBuf<uint32>(buf); m_nTimeToSpendOnCurrentCurve = ReadSaveBuf<int32>(buf);
m_nCurrentPathNodeInfo = ReadSaveBuf<uint32>(buf); m_nCurrentPathNodeInfo = ReadSaveBuf<uint32>(buf);
m_nNextPathNodeInfo = ReadSaveBuf<uint32>(buf); m_nNextPathNodeInfo = ReadSaveBuf<uint32>(buf);
m_nPreviousPathNodeInfo = ReadSaveBuf<uint32>(buf); m_nPreviousPathNodeInfo = ReadSaveBuf<uint32>(buf);

View file

@ -64,8 +64,8 @@ public:
int32 m_nCurrentRouteNode; int32 m_nCurrentRouteNode;
int32 m_nNextRouteNode; int32 m_nNextRouteNode;
int32 m_nPrevRouteNode; int32 m_nPrevRouteNode;
uint32 m_nTimeEnteredCurve; int32 m_nTimeEnteredCurve;
uint32 m_nTimeToSpendOnCurrentCurve; int32 m_nTimeToSpendOnCurrentCurve;
uint32 m_nCurrentPathNodeInfo; uint32 m_nCurrentPathNodeInfo;
uint32 m_nNextPathNodeInfo; uint32 m_nNextPathNodeInfo;
uint32 m_nPreviousPathNodeInfo; uint32 m_nPreviousPathNodeInfo;

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,7 @@ enum eGarageState
GS_OPENEDCONTAINSCAR, GS_OPENEDCONTAINSCAR,
GS_CLOSEDCONTAINSCAR, GS_CLOSEDCONTAINSCAR,
GS_AFTERDROPOFF, GS_AFTERDROPOFF,
GS_WAITINGFORCAR
}; };
enum eGarageType enum eGarageType
@ -31,7 +32,7 @@ enum eGarageType
GARAGE_COLLECTCARS_2, GARAGE_COLLECTCARS_2,
GARAGE_COLLECTCARS_3, GARAGE_COLLECTCARS_3,
GARAGE_FORCARTOCOMEOUTOF, GARAGE_FORCARTOCOMEOUTOF,
GARAGE_60SECONDS, GARAGE_CRATE_GARAGE,
GARAGE_CRUSHER, GARAGE_CRUSHER,
GARAGE_MISSION_KEEPCAR, GARAGE_MISSION_KEEPCAR,
GARAGE_FOR_SCRIPT_TO_OPEN, GARAGE_FOR_SCRIPT_TO_OPEN,
@ -58,19 +59,34 @@ enum
{ {
TOTAL_COLLECTCARS_GARAGES = 4, TOTAL_COLLECTCARS_GARAGES = 4,
TOTAL_HIDEOUT_GARAGES = 12, TOTAL_HIDEOUT_GARAGES = 12,
TOTAL_COLLECTCARS_CARS = 6 TOTAL_COLLECTCARS_CARS = 16
}; };
class CStoredCar 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; int32 m_nModelIndex;
CVector m_vecPos; float m_fPosX;
CVector m_vecAngle; float m_fPosY;
int32 m_bBulletproof : 1; float m_fPosZ;
int32 m_bFireproof : 1; float m_fForwardX;
int32 m_bExplosionproof : 1; float m_fForwardY;
int32 m_bCollisionproof : 1; float m_fForwardZ;
int32 m_bMeleeproof : 1; float m_fTractionMultiplier;
int32 m_nFlags;
int8 m_nPrimaryColor; int8 m_nPrimaryColor;
int8 m_nSecondaryColor; int8 m_nSecondaryColor;
int8 m_nRadioStation; int8 m_nRadioStation;
@ -81,7 +97,6 @@ public:
void Init() { m_nModelIndex = 0; } void Init() { m_nModelIndex = 0; }
void Clear() { m_nModelIndex = 0; } void Clear() { m_nModelIndex = 0; }
bool HasCar() { return m_nModelIndex != 0; } bool HasCar() { return m_nModelIndex != 0; }
const CStoredCar &operator=(const CStoredCar& other);
void StoreCar(CVehicle*); void StoreCar(CVehicle*);
CVehicle* RestoreCar(); CVehicle* RestoreCar();
}; };
@ -115,12 +130,16 @@ public:
CVector2D m_vDir1; CVector2D m_vDir1;
CVector2D m_vDir2; CVector2D m_vDir2;
float m_fSupZ; float m_fSupZ;
CVector m_vecSSGaragePos;
float m_fSSGarageAngle;
float m_fDir1Len; float m_fDir1Len;
float m_fDir2Len; float m_fDir2Len;
float m_fInfX; float m_fInfX;
float m_fSupX; float m_fSupX;
float m_fInfY; float m_fInfY;
float m_fSupY; float m_fSupY;
uint32 m_nTimeCrusherCraneActivated;
CVehicle* m_pSSTargetCar;
float m_fDoorPos; float m_fDoorPos;
float m_fDoorHeight; float m_fDoorHeight;
float m_fDoor1X; float m_fDoor1X;
@ -133,6 +152,14 @@ public:
uint8 m_bCollectedCarsState; uint8 m_bCollectedCarsState;
CVehicle *m_pTarget; CVehicle *m_pTarget;
CStoredCar m_sStoredCar; // not needed 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 OpenThisGarage();
void CloseThisGarage(); void CloseThisGarage();
@ -219,6 +246,7 @@ public:
static CGarage aGarages[NUM_GARAGES]; static CGarage aGarages[NUM_GARAGES];
static CStoredCar aCarsInSafeHouses[TOTAL_HIDEOUT_GARAGES][NUM_GARAGE_STORED_CARS]; static CStoredCar aCarsInSafeHouses[TOTAL_HIDEOUT_GARAGES][NUM_GARAGE_STORED_CARS];
static bool bCamShouldBeOutisde; static bool bCamShouldBeOutisde;
static uint8 CrusherRewardMultiplier;
static void Init(void); static void Init(void);
#ifndef PS2 #ifndef PS2
@ -266,13 +294,13 @@ public:
static void CloseHideOutGaragesBeforeSave(void); static void CloseHideOutGaragesBeforeSave(void);
static int32 CountCarsInHideoutGarage(uint8); static int32 CountCarsInHideoutGarage(uint8);
static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 1; } static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 1; }
static int32 GetCarsCollectedIndexForGarageType(uint8 type) static int32 GetCarsCollectedIndexForGarageType(uint8 type, uint32& total)
{ {
switch (type) { switch (type) {
case GARAGE_COLLECTCARS_1: return 0; case GARAGE_COLLECTCARS_1: total = TOTAL_COLLECTCARS_CARS; return 0;
case GARAGE_COLLECTCARS_2: return 1; case GARAGE_COLLECTCARS_2: total = 0; return 1;
case GARAGE_COLLECTCARS_3: return 2; case GARAGE_COLLECTCARS_3: total = 0; return 2;
case GARAGE_COLLECTCARS_4: return 3; case GARAGE_COLLECTCARS_4: total = 0; return 3;
default: assert(0); default: assert(0);
} }
return 0; return 0;
@ -297,6 +325,15 @@ public:
} }
static bool IsThisGarageTypeSafehouse(uint8 type) { return FindSafeHouseIndexForGarageType(type) >= 0; } 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
}; };

View file

@ -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_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_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_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, ""), REGISTER_COMMAND(COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
}; };
#undef REGISTER_COMMAND #undef REGISTER_COMMAND

View file

@ -7,6 +7,7 @@
#include "DMAudio.h" #include "DMAudio.h"
#include "Frontend.h" #include "Frontend.h"
#include "GameLogic.h" #include "GameLogic.h"
#include "Garages.h"
#include "General.h" #include "General.h"
#include "Hud.h" #include "Hud.h"
#include "Messages.h" #include "Messages.h"
@ -286,7 +287,7 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
return 0; return 0;
case COMMAND_LOCK_GARAGE: case COMMAND_LOCK_GARAGE:
CollectParameters(&m_nIp, 2); 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; return 0;
case COMMAND_IS_FINAL_GAME: case COMMAND_IS_FINAL_GAME:
#ifdef FINAL #ifdef FINAL
@ -391,12 +392,12 @@ int8 CRunningScript::ProcessCommands1600To1699(int32 command)
CHud::SetHelpMessage(text, false, true); // + false CHud::SetHelpMessage(text, false, true); // + false
return 0; return 0;
} }
case COMMAND_SET_MISSION_CAR_CAN_BE_STORED_IN_GARAGE: case COMMAND_SET_CAR_IS_REWARD:
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0)); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle); script_assert(pVehicle);
pVehicle->bAllowGarageToStore = (GET_INTEGER_PARAM(1) != 0); pVehicle->bRewardVehicle = (GET_INTEGER_PARAM(1) != 0);
return 0; return 0;
} }
case COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS: case COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS:

View file

@ -1225,6 +1225,10 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
if (pVehicle->m_vehType == VEHICLE_TYPE_CAR) if (pVehicle->m_vehType == VEHICLE_TYPE_CAR)
#endif #endif
((CAutomobile*)pVehicle)->bFixedColour = (GET_INTEGER_PARAM(1) == 0); ((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; return 0;
} }

View file

@ -438,8 +438,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0)); CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject); UpdateCompareFlag(pObject && pObject->bIsInWater);
UpdateCompareFlag(pObject->bIsInWater);
return 0; return 0;
} }
//case COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR_EVEN_MISSION_CAR: //case COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR_EVEN_MISSION_CAR:

View file

@ -1656,7 +1656,7 @@ enum {
COMMAND_PRINT_HELP_FOREVER_NO_BRIEF, COMMAND_PRINT_HELP_FOREVER_NO_BRIEF,
COMMAND_PRINT_HELP_ALWAYS_NO_BRIEF, COMMAND_PRINT_HELP_ALWAYS_NO_BRIEF,
COMMAND_PRINT_HELP_FOREVER_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, COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS,
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
LAST_SCRIPT_COMMAND LAST_SCRIPT_COMMAND

View file

@ -647,7 +647,7 @@ extern CModelIndices *gpModelIndices;
X("ind_slidedoor", MI_GARAGEDOOR6) \ X("ind_slidedoor", MI_GARAGEDOOR6) \
X("bankjobdoor", MI_GARAGEDOOR7) \ X("bankjobdoor", MI_GARAGEDOOR7) \
X("door_jmsgrage", MI_GARAGEDOOR9) \ X("door_jmsgrage", MI_GARAGEDOOR9) \
X("jamesgrge_kb", MI_GARAGEDOOR10) \ X("ind_safeh_gdoor", MI_GARAGEDOOR10) \
X("door_sfehousegrge", MI_GARAGEDOOR11) \ X("door_sfehousegrge", MI_GARAGEDOOR11) \
X("shedgaragedoor", MI_GARAGEDOOR12) \ X("shedgaragedoor", MI_GARAGEDOOR12) \
X("door4_garage", MI_GARAGEDOOR13) \ X("door4_garage", MI_GARAGEDOOR13) \

View file

@ -134,6 +134,8 @@ CBike::CBike(int32 id, uint8 CreatedBy)
bIsOnFire = false; bIsOnFire = false;
bWheelieCam = false; bWheelieCam = false;
bFixedColour = false; // <- figure out actual place (TODO)
m_fTireTemperature = 1.0f; m_fTireTemperature = 1.0f;
m_fBrakeDestabilization = 0.0f; m_fBrakeDestabilization = 0.0f;
m_fVelocityChangeForAudio = 0; m_fVelocityChangeForAudio = 0;

View file

@ -75,6 +75,7 @@ public:
uint8 bExtraSpeed : 1; // leaning forward uint8 bExtraSpeed : 1; // leaning forward
uint8 bIsOnFire : 1; uint8 bIsOnFire : 1;
uint8 bWheelieCam : 1; uint8 bWheelieCam : 1;
uint8 bFixedColour : 1; // <- figure out its actual place (TODO)
int16 m_doingBurnout; int16 m_doingBurnout;
float m_fTireTemperature; float m_fTireTemperature;
float m_fBrakeDestabilization; float m_fBrakeDestabilization;

View file

@ -133,6 +133,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
bCreatedAsPoliceVehicle = false; bCreatedAsPoliceVehicle = false;
bRestingOnPhysical = false; bRestingOnPhysical = false;
bParking = false; bParking = false;
m_bGarageTurnedLightsOff = false;
bCanPark = CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.0f; // never true. probably doesn't work very well bCanPark = CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.0f; // never true. probably doesn't work very well
bIsVan = false; bIsVan = false;
bIsBus = false; bIsBus = false;

View file

@ -240,17 +240,17 @@ public:
uint8 bRestingOnPhysical : 1; // Dont go static cause car is sitting on a physical object that might get removed uint8 bRestingOnPhysical : 1; // Dont go static cause car is sitting on a physical object that might get removed
uint8 bParking : 1; uint8 bParking : 1;
uint8 bCanPark : 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; uint8 m_bombType : 3;
#endif #endif
uint8 bDriverLastFrame : 1; uint8 bDriverLastFrame : 1;
uint8 bRewardVehicle : 1; // 25B_40
uint8 bAllowGarageToStore : 1; // <- many LCS flags before
int8 m_numPedsUseItAsCover; int8 m_numPedsUseItAsCover;
uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default) uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default)
int8 m_nPacManPickupsCarried; int8 m_nPacManPickupsCarried;
uint8 m_nRoadblockType; uint8 m_nRoadblockType;
bool m_bGarageTurnedLightsOff;
float m_fHealth; // 1000.0f = full health. 250.0f = fire. 0 -> explode 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?? float m_fEngineEnergy; // TODO(LCS): better name. it adds up acceleration force, so possibly kinetic energy??
uint8 m_nCurrentGear; uint8 m_nCurrentGear;