2019-05-29 18:02:58 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-04-10 08:03:38 +00:00
|
|
|
class CAutomobile;
|
2020-02-16 20:08:54 +00:00
|
|
|
class CVehicle;
|
2020-04-10 08:03:38 +00:00
|
|
|
class CControllerState;
|
2020-02-16 20:08:54 +00:00
|
|
|
|
2020-04-10 23:03:42 +00:00
|
|
|
class CCarStateEachFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int16 velX;
|
|
|
|
int16 velY;
|
|
|
|
int16 velZ;
|
|
|
|
int8 rightX;
|
|
|
|
int8 rightY;
|
|
|
|
int8 rightZ;
|
|
|
|
int8 forwardX;
|
|
|
|
int8 forwardY;
|
|
|
|
int8 forwardZ;
|
|
|
|
int8 wheel;
|
2020-07-16 19:21:09 +00:00
|
|
|
int8 gas;
|
|
|
|
int8 brake;
|
2020-04-10 23:03:42 +00:00
|
|
|
bool handbrake;
|
|
|
|
CVector pos;
|
2019-06-28 10:34:02 +00:00
|
|
|
};
|
|
|
|
|
2020-07-16 19:21:09 +00:00
|
|
|
extern char gString[256];
|
2020-04-10 23:03:42 +00:00
|
|
|
|
2019-09-12 00:43:18 +00:00
|
|
|
class CRecordDataForChase
|
2019-05-29 18:02:58 +00:00
|
|
|
{
|
2020-04-10 08:03:38 +00:00
|
|
|
enum {
|
|
|
|
NUM_CHASE_CARS = 20
|
|
|
|
};
|
2020-04-10 23:03:42 +00:00
|
|
|
enum {
|
|
|
|
STATE_NONE = 0,
|
|
|
|
STATE_RECORD = 1,
|
|
|
|
STATE_PLAYBACK_INIT = 2,
|
|
|
|
STATE_PLAYBACK = 3,
|
|
|
|
STATE_PLAYBACK_BEFORE_RECORDING = 4
|
|
|
|
};
|
2020-04-17 05:54:14 +00:00
|
|
|
static uint8 Status;
|
|
|
|
static int PositionChanges;
|
|
|
|
static uint8 CurrentCar;
|
|
|
|
static CAutomobile*pChaseCars[NUM_CHASE_CARS];
|
|
|
|
static float AnimTime;
|
|
|
|
static uint32 AnimStartTime;
|
|
|
|
static CCarStateEachFrame* pBaseMemForCar[NUM_CHASE_CARS];
|
|
|
|
static float TimeMultiplier;
|
|
|
|
static int FId2;
|
2020-04-10 23:03:42 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
static bool IsRecording(void) { return Status == STATE_RECORD; }
|
2019-09-12 00:43:18 +00:00
|
|
|
|
2020-04-10 23:03:42 +00:00
|
|
|
static void Init(void);
|
2019-10-18 22:23:40 +00:00
|
|
|
static void SaveOrRetrieveDataForThisFrame(void);
|
2019-09-12 00:43:18 +00:00
|
|
|
static void SaveOrRetrieveCarPositions(void);
|
2020-04-10 23:03:42 +00:00
|
|
|
static void StoreInfoForCar(CAutomobile*, CCarStateEachFrame*);
|
|
|
|
static void RestoreInfoForMatrix(CMatrix&, CCarStateEachFrame*);
|
|
|
|
static void RestoreInfoForCar(CAutomobile*, CCarStateEachFrame*, bool);
|
|
|
|
static void ProcessControlCars(void);
|
|
|
|
#if (defined(GTA_PS2) || defined(FIX_BUGS))
|
|
|
|
static bool ShouldThisPadBeLeftAlone(uint8 pad);
|
|
|
|
#endif
|
|
|
|
static void GiveUsACar(int32, CVector, float, CAutomobile**, uint8, uint8);
|
2020-01-03 16:48:13 +00:00
|
|
|
static void StartChaseScene(float);
|
2020-04-10 23:03:42 +00:00
|
|
|
static void CleanUpChaseScene(void);
|
|
|
|
static void SetUpCarsForChaseScene(void);
|
|
|
|
static void CleanUpCarsForChaseScene(void);
|
2020-02-16 20:08:54 +00:00
|
|
|
static void RemoveCarFromChase(int32);
|
|
|
|
static CVehicle* TurnChaseCarIntoScriptCar(int32);
|
2020-04-10 23:03:42 +00:00
|
|
|
|
2019-05-29 22:47:33 +00:00
|
|
|
};
|
|
|
|
|
2020-04-10 08:03:38 +00:00
|
|
|
struct tGameBuffer
|
|
|
|
{
|
|
|
|
float m_fTimeStep;
|
|
|
|
uint32 m_nTimeInMilliseconds;
|
|
|
|
uint8 m_nSizeOfPads[2];
|
|
|
|
uint16 m_nChecksum;
|
|
|
|
uint8 m_ControllerBuffer[116];
|
|
|
|
};
|
2019-09-12 00:43:18 +00:00
|
|
|
|
|
|
|
class CRecordDataForGame
|
2019-05-29 22:47:33 +00:00
|
|
|
{
|
2020-04-10 08:03:38 +00:00
|
|
|
enum {
|
|
|
|
STATE_NONE = 0,
|
|
|
|
STATE_RECORD = 1,
|
|
|
|
STATE_PLAYBACK = 2,
|
|
|
|
};
|
2020-04-17 05:54:14 +00:00
|
|
|
static uint16 RecordingState;
|
|
|
|
static uint8* pDataBuffer;
|
|
|
|
static uint8* pDataBufferPointer;
|
|
|
|
static int FId;
|
|
|
|
static tGameBuffer pDataBufferForFrame;
|
2020-04-10 08:03:38 +00:00
|
|
|
|
2019-05-29 22:47:33 +00:00
|
|
|
public:
|
2020-04-10 08:03:38 +00:00
|
|
|
static bool IsRecording() { return RecordingState == STATE_RECORD; }
|
|
|
|
static bool IsPlayingBack() { return RecordingState == STATE_PLAYBACK; }
|
2019-10-18 22:23:40 +00:00
|
|
|
|
|
|
|
static void SaveOrRetrieveDataForThisFrame(void);
|
2020-03-22 14:23:40 +00:00
|
|
|
static void Init(void);
|
2020-04-10 08:03:38 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static uint16 CalcGameChecksum(void);
|
|
|
|
static uint8* PackCurrentPadValues(uint8*, CControllerState*, CControllerState*);
|
|
|
|
static uint8* UnPackCurrentPadValues(uint8*, uint8, CControllerState*);
|
2019-05-29 22:47:33 +00:00
|
|
|
};
|