mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-22 09:09:15 +01:00
minor refactoring
This commit is contained in:
parent
02a28996f4
commit
416a898943
@ -81,6 +81,7 @@ VALIDATE_SIZE(CStoredCar, 0x28);
|
||||
|
||||
class CGarage
|
||||
{
|
||||
public:
|
||||
uint8 m_eGarageType;
|
||||
uint8 m_eGarageState;
|
||||
bool field_2; // unused
|
||||
@ -167,9 +168,6 @@ class CGarage
|
||||
void FindDoorsEntitiesSectorList(CPtrList&, bool);
|
||||
void PlayerArrestedOrDied();
|
||||
|
||||
friend class CGarages;
|
||||
friend class cAudioManager;
|
||||
friend class CCamera;
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(CGarage, 140);
|
||||
@ -179,6 +177,7 @@ class CGarages
|
||||
enum {
|
||||
MESSAGE_LENGTH = 8
|
||||
};
|
||||
public:
|
||||
static int32 BankVansCollected;
|
||||
static bool BombsAreFree;
|
||||
static bool RespraysAreFree;
|
||||
@ -200,7 +199,6 @@ class CGarages
|
||||
static CStoredCar aCarsInSafeHouse3[NUM_GARAGE_STORED_CARS];
|
||||
static bool bCamShouldBeOutisde;
|
||||
|
||||
public:
|
||||
static void Init(void);
|
||||
#ifndef PS2
|
||||
static void Shutdown(void);
|
||||
@ -240,7 +238,6 @@ public:
|
||||
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
|
||||
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
|
||||
|
||||
private:
|
||||
static bool IsCarSprayable(CVehicle*);
|
||||
static float FindDoorHeightForMI(int32);
|
||||
static void CloseHideOutGaragesBeforeSave(void);
|
||||
@ -249,9 +246,4 @@ private:
|
||||
static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 1; }
|
||||
static int32 GetCarsCollectedIndexForGarageType(uint8 type) { return type - GARAGE_COLLECTCARS_1; }
|
||||
|
||||
friend class cAudioManager;
|
||||
friend class CGarage;
|
||||
#ifdef FIX_BUGS
|
||||
friend class CReplay;
|
||||
#endif
|
||||
};
|
||||
|
@ -1225,7 +1225,7 @@ const tScriptCommandData commands[] = {
|
||||
REGISTER_COMMAND(COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
|
||||
REGISTER_COMMAND(COMMAND_LOAD_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
|
||||
REGISTER_COMMAND(COMMAND_ENABLE_PLAYER_CONTROL_CAMERA, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
|
||||
#ifndef GTA_PS2
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
REGISTER_COMMAND(COMMAND_SET_OBJECT_ROTATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
|
||||
REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
|
||||
REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
|
||||
@ -1444,10 +1444,16 @@ void CUpsideDownCarCheck::Init()
|
||||
|
||||
bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id)
|
||||
{
|
||||
CVehicle* v = CPools::GetVehiclePool()->GetAt(id);
|
||||
return v->GetUp().z <= -0.97f &&
|
||||
v->GetMoveSpeed().Magnitude() < 0.01f &&
|
||||
v->GetTurnSpeed().Magnitude() < 0.02f;
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(id);
|
||||
return IsCarUpsideDown(pVehicle);
|
||||
}
|
||||
|
||||
bool CUpsideDownCarCheck::IsCarUpsideDown(CVehicle* pVehicle)
|
||||
{
|
||||
assert(pVehicle);
|
||||
return pVehicle->GetUp().z <= UPSIDEDOWN_UP_THRESHOLD &&
|
||||
pVehicle->GetMoveSpeed().Magnitude() < UPSIDEDOWN_MOVE_SPEED_THRESHOLD &&
|
||||
pVehicle->GetTurnSpeed().Magnitude() < UPSIDEDOWN_TURN_SPEED_THRESHOLD;
|
||||
}
|
||||
|
||||
void CUpsideDownCarCheck::UpdateTimers()
|
||||
@ -1470,7 +1476,7 @@ void CUpsideDownCarCheck::UpdateTimers()
|
||||
bool CUpsideDownCarCheck::AreAnyCarsUpsideDown()
|
||||
{
|
||||
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
|
||||
if (m_sCars[i].m_nVehicleIndex >= 0 && m_sCars[i].m_nUpsideDownTimer > 1000)
|
||||
if (m_sCars[i].m_nVehicleIndex >= 0 && m_sCars[i].m_nUpsideDownTimer > UPSIDEDOWN_TIMER_THRESHOLD)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1481,8 +1487,10 @@ void CUpsideDownCarCheck::AddCarToCheck(int32 id)
|
||||
uint16 index = 0;
|
||||
while (index < MAX_UPSIDEDOWN_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
|
||||
index++;
|
||||
#ifdef FIX_BUGS
|
||||
if (index >= MAX_UPSIDEDOWN_CAR_CHECKS)
|
||||
return;
|
||||
#endif
|
||||
m_sCars[index].m_nVehicleIndex = id;
|
||||
m_sCars[index].m_nUpsideDownTimer = 0;
|
||||
}
|
||||
@ -1501,7 +1509,7 @@ bool CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile(int32 id)
|
||||
{
|
||||
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
|
||||
if (m_sCars[i].m_nVehicleIndex == id)
|
||||
return m_sCars[i].m_nUpsideDownTimer > 1000;
|
||||
return m_sCars[i].m_nUpsideDownTimer > UPSIDEDOWN_TIMER_THRESHOLD;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1551,7 +1559,10 @@ void CStuckCarCheck::AddCarToCheck(int32 id, float radius, uint32 time)
|
||||
int index = 0;
|
||||
while (index < MAX_STUCK_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
|
||||
index++;
|
||||
/* Would be nice to return if index >= MAX_STUCK_CAR_CHECKS... */
|
||||
#ifdef FIX_BUGS
|
||||
if (index >= MAX_STUCK_CAR_CHECKS)
|
||||
return;
|
||||
#endif
|
||||
m_sCars[index].m_nVehicleIndex = id;
|
||||
m_sCars[index].m_vecPos = pv->GetPosition();
|
||||
m_sCars[index].m_nLastCheck = CTimer::GetTimeInMilliseconds();
|
||||
@ -2098,7 +2109,7 @@ int8 CRunningScript::ProcessOneCommand()
|
||||
retval = ProcessCommands800To899(command);
|
||||
else if (command < 1000)
|
||||
retval = ProcessCommands900To999(command);
|
||||
#ifdef GTA_PS2
|
||||
#if GTA_VERSION <= GTA3_PS2_160
|
||||
else if (command < 1200)
|
||||
retval = ProcessCommands1000To1099(command);
|
||||
#else
|
||||
@ -4314,81 +4325,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void CRunningScript::Save(uint8*& buf)
|
||||
{
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
SkipSaveBuf(buf, 8);
|
||||
for (int i = 0; i < 8; i++)
|
||||
WriteSaveBuf<char>(buf, m_abScriptName[i]);
|
||||
WriteSaveBuf<uint32>(buf, m_nIp);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||
#endif
|
||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||
WriteSaveBuf<uint32>(buf, m_anStack[i]);
|
||||
WriteSaveBuf<uint16>(buf, m_nStackPointer);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||
#endif
|
||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
|
||||
WriteSaveBuf<bool>(buf, m_bCondResult);
|
||||
WriteSaveBuf<bool>(buf, m_bIsMissionScript);
|
||||
WriteSaveBuf<bool>(buf, m_bSkipWakeTime);
|
||||
SkipSaveBuf(buf, 1);
|
||||
WriteSaveBuf<uint32>(buf, m_nWakeTime);
|
||||
WriteSaveBuf<uint16>(buf, m_nAndOrState);
|
||||
WriteSaveBuf<bool>(buf, m_bNotFlag);
|
||||
WriteSaveBuf<bool>(buf, m_bDeatharrestEnabled);
|
||||
WriteSaveBuf<bool>(buf, m_bDeatharrestExecuted);
|
||||
WriteSaveBuf<bool>(buf, m_bMissionFlag);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#else
|
||||
WriteSaveBuf(buf, *this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRunningScript::Load(uint8*& buf)
|
||||
{
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
SkipSaveBuf(buf, 8);
|
||||
for (int i = 0; i < 8; i++)
|
||||
m_abScriptName[i] = ReadSaveBuf<char>(buf);
|
||||
m_nIp = ReadSaveBuf<uint32>(buf);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||
#endif
|
||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||
m_anStack[i] = ReadSaveBuf<uint32>(buf);
|
||||
m_nStackPointer = ReadSaveBuf<uint16>(buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||
#endif
|
||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
|
||||
m_bCondResult = ReadSaveBuf<bool>(buf);
|
||||
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
|
||||
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
|
||||
SkipSaveBuf(buf, 1);
|
||||
m_nWakeTime = ReadSaveBuf<uint32>(buf);
|
||||
m_nAndOrState = ReadSaveBuf<uint16>(buf);
|
||||
m_bNotFlag = ReadSaveBuf<bool>(buf);
|
||||
m_bDeatharrestEnabled = ReadSaveBuf<bool>(buf);
|
||||
m_bDeatharrestExecuted = ReadSaveBuf<bool>(buf);
|
||||
m_bMissionFlag = ReadSaveBuf<bool>(buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#else
|
||||
CRunningScript* n = next;
|
||||
CRunningScript* p = prev;
|
||||
*this = ReadSaveBuf<CRunningScript>(buf);
|
||||
next = n;
|
||||
prev = p;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MISSION_REPLAY
|
||||
|
||||
bool CRunningScript::CanAllowMissionReplay()
|
||||
|
@ -20,27 +20,32 @@ extern int32 ScriptParams[32];
|
||||
void FlushLog();
|
||||
#define script_assert(_Expression) FlushLog(); assert(_Expression);
|
||||
|
||||
#define PICKUP_PLACEMENT_OFFSET 0.5f
|
||||
#define PED_FIND_Z_OFFSET 5.0f
|
||||
#define PICKUP_PLACEMENT_OFFSET (0.5f)
|
||||
#define PED_FIND_Z_OFFSET (5.0f)
|
||||
|
||||
#define SPHERE_MARKER_R 0
|
||||
#define SPHERE_MARKER_G 128
|
||||
#define SPHERE_MARKER_B 255
|
||||
#define SPHERE_MARKER_A 128
|
||||
#define SPHERE_MARKER_PULSE_PERIOD 2048
|
||||
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
|
||||
#define UPSIDEDOWN_UP_THRESHOLD (-0.97f)
|
||||
#define UPSIDEDOWN_MOVE_SPEED_THRESHOLD (0.01f)
|
||||
#define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f)
|
||||
#define UPSIDEDOWN_TIMER_THRESHOLD (1000)
|
||||
|
||||
#define SPHERE_MARKER_R (0)
|
||||
#define SPHERE_MARKER_G (128)
|
||||
#define SPHERE_MARKER_B (255)
|
||||
#define SPHERE_MARKER_A (128)
|
||||
#define SPHERE_MARKER_PULSE_PERIOD (2048)
|
||||
#define SPHERE_MARKER_PULSE_FRACTION (0.1f)
|
||||
|
||||
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
|
||||
#define METERS_IN_FOOT 0.3048f
|
||||
#define FEET_IN_METER 3.28084f
|
||||
#define METERS_IN_FOOT (0.3048f)
|
||||
#define FEET_IN_METER (3.28084f)
|
||||
#else
|
||||
#define METERS_IN_FOOT 0.3f
|
||||
#define FEET_IN_METER 3.33f
|
||||
#define METERS_IN_FOOT (0.3f)
|
||||
#define FEET_IN_METER (3.33f)
|
||||
#endif
|
||||
|
||||
#define KEY_LENGTH_IN_SCRIPT 8
|
||||
#define KEY_LENGTH_IN_SCRIPT (8)
|
||||
|
||||
#if GTA_VERSION <= GTA_PS2_160
|
||||
#if GTA_VERSION <= GTA3_PS2_160
|
||||
#define GTA_SCRIPT_COLLECTIVE
|
||||
#endif
|
||||
|
||||
@ -95,8 +100,8 @@ struct intro_text_line
|
||||
m_bCentered = false;
|
||||
m_bBackground = false;
|
||||
m_bBackgroundOnly = false;
|
||||
m_fWrapX = 182.0f; /* TODO: scaling as bugfix */
|
||||
m_fCenterSize = 640.0f; /* --||-- */
|
||||
m_fWrapX = 182.0f;
|
||||
m_fCenterSize = DEFAULT_SCREEN_WIDTH;
|
||||
m_sBackgroundColor = CRGBA(128, 128, 128, 128);
|
||||
m_bTextProportional = true;
|
||||
m_bTextBeforeFade = false;
|
||||
@ -162,7 +167,7 @@ public:
|
||||
void Process();
|
||||
};
|
||||
|
||||
struct CUpsideDownCarCheckEntry
|
||||
struct upsidedown_car_data
|
||||
{
|
||||
int32 m_nVehicleIndex;
|
||||
uint32 m_nUpsideDownTimer;
|
||||
@ -170,11 +175,12 @@ struct CUpsideDownCarCheckEntry
|
||||
|
||||
class CUpsideDownCarCheck
|
||||
{
|
||||
CUpsideDownCarCheckEntry m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
|
||||
upsidedown_car_data m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
|
||||
|
||||
public:
|
||||
void Init();
|
||||
bool IsCarUpsideDown(int32);
|
||||
bool IsCarUpsideDown(CVehicle*);
|
||||
void UpdateTimers();
|
||||
bool AreAnyCarsUpsideDown();
|
||||
void AddCarToCheck(int32);
|
||||
@ -192,7 +198,7 @@ struct stuck_car_data
|
||||
bool m_bStuck;
|
||||
|
||||
stuck_car_data() { }
|
||||
inline void Reset();
|
||||
void Reset();
|
||||
};
|
||||
|
||||
class CStuckCarCheck
|
||||
@ -269,6 +275,7 @@ enum {
|
||||
|
||||
class CTheScripts
|
||||
{
|
||||
public:
|
||||
static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
|
||||
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
|
||||
static int32 BaseBriefIdForContact[MAX_NUM_CONTACTS];
|
||||
@ -310,7 +317,6 @@ class CTheScripts
|
||||
static uint16 CommandsExecuted;
|
||||
static uint16 ScriptsUpdated;
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Process();
|
||||
|
||||
@ -367,8 +373,6 @@ public:
|
||||
return Read4BytesFromScript(&tmp);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static CRunningScript* StartNewScript(uint32);
|
||||
|
||||
static void CleanUpThisVehicle(CVehicle*);
|
||||
@ -418,13 +422,6 @@ private:
|
||||
static void SetObjectiveForAllPedsInCollective(int, eObjective);
|
||||
#endif
|
||||
|
||||
friend class CRunningScript;
|
||||
friend class CHud;
|
||||
friend void CMissionCleanup::Process();
|
||||
#ifdef MISSION_REPLAY
|
||||
friend void RetryMission(int, int);
|
||||
#endif
|
||||
|
||||
#ifdef MISSION_SWITCHER
|
||||
public:
|
||||
static void SwitchToMission(int32 mission);
|
||||
@ -433,7 +430,11 @@ public:
|
||||
|
||||
|
||||
enum {
|
||||
MAX_STACK_DEPTH = 6, // 4 PS2
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
MAX_STACK_DEPTH = 6,
|
||||
#else
|
||||
MAX_STACK_DEPTH = 4,
|
||||
#endif
|
||||
NUM_LOCAL_VARS = 16,
|
||||
NUM_TIMERS = 2
|
||||
};
|
||||
@ -460,6 +461,7 @@ class CRunningScript
|
||||
ORS_8
|
||||
};
|
||||
|
||||
public:
|
||||
CRunningScript* next;
|
||||
CRunningScript* prev;
|
||||
char m_abScriptName[8];
|
||||
@ -497,7 +499,6 @@ public:
|
||||
|
||||
static const uint32 nSaveStructSize;
|
||||
|
||||
private:
|
||||
void CollectParameters(uint32*, int16);
|
||||
int32 CollectNextParameterWithoutIncreasingPC(uint32);
|
||||
int32* GetPointerToScriptVariable(uint32*, int16);
|
||||
@ -519,7 +520,7 @@ private:
|
||||
int8 ProcessCommands800To899(int32);
|
||||
int8 ProcessCommands900To999(int32);
|
||||
int8 ProcessCommands1000To1099(int32);
|
||||
#ifndef GTA_PS2
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
int8 ProcessCommands1100To1199(int32);
|
||||
#endif
|
||||
void LocatePlayerCommand(int32, uint32*);
|
||||
@ -575,8 +576,6 @@ private:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
friend class CTheScripts;
|
||||
};
|
||||
|
||||
#ifdef MISSION_REPLAY
|
||||
|
@ -342,7 +342,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CGarages::SetFreeBombs(ScriptParams[0] != 0);
|
||||
return 0;
|
||||
#ifdef GTA_PS2
|
||||
#if GTA_VERSION <= GTA3_PS2_160
|
||||
case COMMAND_SET_POWERPOINT:
|
||||
{
|
||||
CollectParameters(&m_nIp, 7);
|
||||
@ -376,7 +376,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // GTA_PS2
|
||||
#endif // GTA_VERSION <= GTA3_PS2_160
|
||||
case COMMAND_SET_ALL_TAXI_LIGHTS:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0);
|
||||
|
@ -2075,6 +2075,80 @@ VALIDATESAVEBUF(size)
|
||||
|
||||
#undef SCRIPT_DATA_SIZE
|
||||
|
||||
void CRunningScript::Save(uint8*& buf)
|
||||
{
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
SkipSaveBuf(buf, 8);
|
||||
for (int i = 0; i < 8; i++)
|
||||
WriteSaveBuf<char>(buf, m_abScriptName[i]);
|
||||
WriteSaveBuf<uint32>(buf, m_nIp);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||
#endif
|
||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||
WriteSaveBuf<uint32>(buf, m_anStack[i]);
|
||||
WriteSaveBuf<uint16>(buf, m_nStackPointer);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||
#endif
|
||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
|
||||
WriteSaveBuf<bool>(buf, m_bCondResult);
|
||||
WriteSaveBuf<bool>(buf, m_bIsMissionScript);
|
||||
WriteSaveBuf<bool>(buf, m_bSkipWakeTime);
|
||||
SkipSaveBuf(buf, 1);
|
||||
WriteSaveBuf<uint32>(buf, m_nWakeTime);
|
||||
WriteSaveBuf<uint16>(buf, m_nAndOrState);
|
||||
WriteSaveBuf<bool>(buf, m_bNotFlag);
|
||||
WriteSaveBuf<bool>(buf, m_bDeatharrestEnabled);
|
||||
WriteSaveBuf<bool>(buf, m_bDeatharrestExecuted);
|
||||
WriteSaveBuf<bool>(buf, m_bMissionFlag);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#else
|
||||
WriteSaveBuf(buf, *this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRunningScript::Load(uint8*& buf)
|
||||
{
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
SkipSaveBuf(buf, 8);
|
||||
for (int i = 0; i < 8; i++)
|
||||
m_abScriptName[i] = ReadSaveBuf<char>(buf);
|
||||
m_nIp = ReadSaveBuf<uint32>(buf);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||
#endif
|
||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||
m_anStack[i] = ReadSaveBuf<uint32>(buf);
|
||||
m_nStackPointer = ReadSaveBuf<uint16>(buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||
#endif
|
||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
|
||||
m_bCondResult = ReadSaveBuf<bool>(buf);
|
||||
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
|
||||
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
|
||||
SkipSaveBuf(buf, 1);
|
||||
m_nWakeTime = ReadSaveBuf<uint32>(buf);
|
||||
m_nAndOrState = ReadSaveBuf<uint16>(buf);
|
||||
m_bNotFlag = ReadSaveBuf<bool>(buf);
|
||||
m_bDeatharrestEnabled = ReadSaveBuf<bool>(buf);
|
||||
m_bDeatharrestExecuted = ReadSaveBuf<bool>(buf);
|
||||
m_bMissionFlag = ReadSaveBuf<bool>(buf);
|
||||
SkipSaveBuf(buf, 2);
|
||||
#else
|
||||
CRunningScript* n = next;
|
||||
CRunningScript* p = prev;
|
||||
*this = ReadSaveBuf<CRunningScript>(buf);
|
||||
next = n;
|
||||
prev = p;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntity)
|
||||
{
|
||||
static CColPoint aTempColPoints[MAX_COLLISION_POINTS];
|
||||
|
@ -33,9 +33,12 @@
|
||||
#include "Zones.h"
|
||||
#include "main.h"
|
||||
|
||||
// NB: on PS2 this file did not exist; ProcessCommands1000To1099 was in Script5.cpp and ProcessCommands1100To1199 was only added on PC
|
||||
// however to avoid redundant copies of code, Script6.cpp is used with PS2 defines
|
||||
|
||||
int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||
{
|
||||
#ifdef GTA_PS2
|
||||
#if GTA_VERSION <= GTA3_PS2_160
|
||||
char tmp[48];
|
||||
#endif
|
||||
switch (command) {
|
||||
@ -746,7 +749,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||
pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER);
|
||||
return 0;
|
||||
}
|
||||
#ifndef GTA_PS2
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
default:
|
||||
script_assert(0);
|
||||
}
|
||||
@ -838,8 +841,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||
case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA:
|
||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
|
||||
return 0;
|
||||
#ifndef GTA_PS2
|
||||
// To be precise, on PS2 previous handlers were in 1000-1099 function
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
// These are "beta" VC commands (with bugs)
|
||||
case COMMAND_SET_OBJECT_ROTATION:
|
||||
{
|
||||
|
@ -1108,7 +1108,7 @@ enum {
|
||||
COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER,
|
||||
COMMAND_LOAD_END_OF_GAME_TUNE,
|
||||
COMMAND_ENABLE_PLAYER_CONTROL_CAMERA,
|
||||
#ifndef GTA_PS2
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
COMMAND_SET_OBJECT_ROTATION,
|
||||
COMMAND_GET_DEBUG_CAMERA_COORDINATES,
|
||||
COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR,
|
||||
|
@ -323,6 +323,11 @@ enum Config {
|
||||
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifdef MASTER
|
||||
#undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
#undef USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||
#endif
|
||||
|
||||
// Replay
|
||||
//#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool!
|
||||
//#define USE_BETA_REPLAY_MODE // adds another replay mode, a few seconds slomo (caution: buggy!)
|
||||
|
Loading…
Reference in New Issue
Block a user