Skip to content

Commit b968543

Browse files
committed
- attempt to fix chase recorder & auto-test
1 parent fcee914 commit b968543

4 files changed

Lines changed: 32 additions & 7 deletions

File tree

src_rebuild/Game/C/cutrecorder.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifdef CUTSCENE_RECORDER
66

77
#include "driver2.h"
8+
#include "cutrecorder.h"
89

910
#include "main.h"
1011
#include "pad.h"
@@ -118,7 +119,7 @@ int CutRec_GotoChase(int number)
118119

119120
void CutRec_Step()
120121
{
121-
if (gCutsceneChaseAutoTest != 0)
122+
if (gCutsceneChaseAutoTest != 0 && CutRec_IsPlaying())
122123
{
123124
// goto previous chase
124125
if (Pads[0].dirnew & CAR_PAD_LEFT)
@@ -411,10 +412,7 @@ int CutRec_StorePingInfo(int cookieCount, int carId)
411412
PING_PACKET* buffer;
412413
PING_PACKET* packet;
413414

414-
if (gCutsceneAsReplay == 0)
415-
return 0;
416-
417-
if (CurrentGameMode == GAMEMODE_REPLAY || gInGameChaseActive != 0)
415+
if (!CutRec_IsRecording())
418416
return 0;
419417

420418
if (PingBufferPos < MAX_REPLAY_PINGS-1)
@@ -425,12 +423,16 @@ int CutRec_StorePingInfo(int cookieCount, int carId)
425423

426424
packet->cookieCount = cookieCount;
427425

426+
PingBuffer[PingBufferPos - 1] = *packet;
427+
428428
// always finalize last ping
429429
packet = &NewPingBuffer[PingBufferPos];
430430
packet->frame = 0xffff;
431431
packet->carId = -1;
432432
packet->cookieCount = -1;
433433

434+
435+
434436
return 1;
435437
}
436438

@@ -788,4 +790,20 @@ int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
788790
return 1;
789791
}
790792

793+
int CutRec_IsRecording()
794+
{
795+
if (gCutsceneAsReplay == 0)
796+
return 0;
797+
798+
return CurrentGameMode != GAMEMODE_REPLAY;
799+
}
800+
801+
int CutRec_IsPlaying()
802+
{
803+
if (gCutsceneAsReplay == 0)
804+
return 0;
805+
806+
return CurrentGameMode == GAMEMODE_REPLAY;
807+
}
808+
791809
#endif // CUTSCENE_RECORDER

src_rebuild/Game/C/cutrecorder.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ extern char gCurrentChasePauseText[64];
1212
extern void InitChaseAutoTest(char* configFilename);
1313
extern void InitCutsceneRecorder(char* configFilename);
1414

15+
extern int CutRec_IsRecording();
16+
extern int CutRec_IsPlaying();
17+
1518
extern void CutRec_Reset();
1619
extern void CutRec_Step();
1720
extern void CutRec_Draw();
@@ -29,6 +32,8 @@ extern int CutRec_SaveChase();
2932

3033
#define _CutRec_IsAutoTestOn() (gCutsceneChaseAutoTest != 0)
3134
#define _CutRec_IsOn() (gCutsceneAsReplay != 0)
35+
#define _CutRec_IsRecording() CutRec_IsRecording()
36+
#define _CutRec_IsPlaying() CutRec_IsPlaying()
3237
#define _CutRec_Step() CutRec_Step()
3338
#define _CutRec_Draw() CutRec_Draw()
3439
#define _CutRec_Reset() CutRec_Reset()
@@ -45,6 +50,8 @@ extern int CutRec_SaveChase();
4550

4651
#define _CutRec_IsAutoTestOn() (0)
4752
#define _CutRec_IsOn() (0)
53+
#define _CutRec_IsRecording() (0)
54+
#define _CutRec_IsPlaying() (0)
4855
#define _CutRec_Step() (0)
4956
#define _CutRec_Draw() (0)
5057
#define _CutRec_Reset() (0)

src_rebuild/Game/C/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ void StepSim(void)
918918
// control civcars pingin/pingout
919919
if (requestStationaryCivCar != 1 && requestRoadblock == 0)
920920
{
921-
if (gInGameChaseActive)
921+
if (gInGameChaseActive || _CutRec_IsPlaying())
922922
{
923923
// it will use ping buffer
924924
// checks are done internally

src_rebuild/Game/C/replays.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ char GetPingInfo(char *cookieCount)
364364
// [A] returns 1 if can use ping buffer
365365
int IsPingInfoAvailable()
366366
{
367-
if (!_CutRec_IsAutoTestOn() && (gUseStoredPings == 0 || gInGameChaseActive == 0))// && gLoadedReplay == 0)
367+
if (!_CutRec_IsPlaying() && (gUseStoredPings == 0 || gInGameChaseActive == 0))// && gLoadedReplay == 0)
368368
return 0;
369369

370370
return PingBuffer != NULL && PingBufferPos < MAX_REPLAY_PINGS;

0 commit comments

Comments
 (0)