- fix cutscene-replay saving/loading bugs

This commit is contained in:
Ilya Shurumov 2020-11-17 22:01:20 +06:00
parent 96d338bc80
commit 898cf2cef1
4 changed files with 14 additions and 10 deletions

View File

@ -3792,7 +3792,7 @@ int PingInCivCar(int minPingInDist)
PingOutCivsOnly = 0;
// [A] REDRIVER2 always stores pings
StorePingInfo(cookieCount, newCar->id); // + 1 since car with id 1 is not getting pinged in chases
StorePingInfo(cookieCount, newCar->id);
return newCar->id + 1;
}

View File

@ -36,7 +36,7 @@ int gThePlayerCar = -1;
static int CutsceneStreamIndex = 0;
int CutsceneFrameCnt = 0;
static int NumCutsceneStreams = 0;
int NumCutsceneStreams = 0;
static int gHaveInGameCutscene = 0;
static int gCSDestroyPlayer = 0;
static int PreLoadedCutscene = -1;
@ -692,10 +692,11 @@ void ReleaseInGameCutscene(void)
replayptr = CutsceneReplayStart;
NumReplayStreams -= NumCutsceneStreams;
NumCutsceneStreams = 0;
CutsceneReplayStart = NULL;
CutsceneStreamIndex = 0;
NumCutsceneStreams = 0;
PreLoadedCutscene = -1;
gHaveInGameCutscene = 0;
gCSDestroyPlayer = 0;
@ -1293,7 +1294,7 @@ int LoadCutsceneToReplayBuffer(int residentCutscene)
return 0;
}
CutsceneStreamIndex = NumReplayStreams;
CutsceneStreamIndex = NumReplayStreams; //rheader->NumReplayStreams;
NumCutsceneStreams = rheader->NumReplayStreams;
CutsceneReplayStart = replayptr;
@ -1329,7 +1330,7 @@ int LoadCutsceneToReplayBuffer(int residentCutscene)
pt += size;
}
NumReplayStreams += rheader->NumReplayStreams;
NumReplayStreams += NumCutsceneStreams;
// copy cutscene cameras and pings
CutsceneCamera = (PLAYBACKCAMERA *)replayptr;

View File

@ -13,6 +13,7 @@ extern void InitUserReplays(const char* str);
extern CUTSCENE_BUFFER CutsceneBuffer;
extern int NumCutsceneStreams;
extern int gSkipInGameCutscene;
extern int gInGameCutsceneID;
extern int gInGameCutsceneActive;

View File

@ -116,6 +116,9 @@ void InitPadRecording(void)
}
else
{
// reset stream count as cutscene/chase can increase it
NumReplayStreams = NumPlayers;
for (i = 0; i < NumReplayStreams; i++)
{
ReplayStreams[i].playbackrun = 0;
@ -175,9 +178,9 @@ int SaveReplayToBuffer(char *buffer)
header->magic = 0x14793209; // TODO: custom
header->GameLevel = GameLevel;
header->GameType = GameType;
header->NumReplayStreams = NumReplayStreams;
header->MissionNumber = gCurrentMissionNumber;
header->NumReplayStreams = NumReplayStreams - NumCutsceneStreams;
header->NumPlayers = NumPlayers;
header->CutsceneEvent = -1;
header->RandomChase = gRandomChase;
@ -733,11 +736,10 @@ char GetPingInfo(char *cookieCount)
// [A] Stores ping info into replay buffer
int StorePingInfo(int cookieCount, int carId)
{
#ifdef CUTSCENE_RECORDER
PING_PACKET* packet;
#ifdef CUTSCENE_RECORDER
extern int gCutsceneAsReplay;
//extern int gCutsceneAsReplay;
if (gCutsceneAsReplay == 0)
return 0;