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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -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
};

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_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

View File

@ -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:

View File

@ -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;
}

View File

@ -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:

View File

@ -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

View File

@ -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) \

View File

@ -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;

View File

@ -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;

View File

@ -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;

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 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;