55#ifdef CUTSCENE_RECORDER
66
77#include "driver2.h"
8+ #include "cutrecorder.h"
89
910#include "main.h"
1011#include "pad.h"
@@ -118,53 +119,53 @@ int CutRec_GotoChase(int number)
118119
119120void CutRec_Step ()
120121{
121- // goto previous chase
122- if (Pads [0 ].dirnew & CAR_PAD_LEFT )
122+ if (gCutsceneChaseAutoTest != 0 && CutRec_IsPlaying ())
123123 {
124- CutRec_GotoChase (gCutsceneChaseAutoTest - 1 );
125- return ;
126- }
124+ // goto previous chase
125+ if (Pads [0 ].dirnew & CAR_PAD_LEFT )
126+ {
127+ CutRec_GotoChase (gCutsceneChaseAutoTest - 1 );
128+ return ;
129+ }
127130
128- // goto next chase
129- if (Pads [0 ].dirnew & CAR_PAD_RIGHT )
130- {
131- CutRec_GotoChase (gCutsceneChaseAutoTest + 1 );
132- return ;
133- }
134-
135- if (!pauseflag )
136- {
137- if (gCutsceneChaseAutoTest != 0 )
131+ // goto next chase
132+ if (Pads [0 ].dirnew & CAR_PAD_RIGHT )
133+ {
134+ CutRec_GotoChase (gCutsceneChaseAutoTest + 1 );
135+ return ;
136+ }
137+
138+ if (!pauseflag )
138139 {
139140 int carId = player [gCutsceneAsReplay_PlayerId ].playerCarId ;
140-
141+
141142 if (car_data [carId ].hd .speed < 5 )
142143 gChaseStuckTimer ++ ;
143144 else
144145 gChaseStuckTimer = 0 ;
145146
146- if (gChaseStuckTimer > 45 )
147+ if (gChaseStuckTimer > 45 )
147148 {
148149 gAutoTestStats [gCutsceneChaseAutoTest ].stuck = 1 ;
149150 gChaseStuckTimer = 0 ;
150151 }
151- }
152-
153- return ;
154- }
155152
156- if (gCutsceneChaseAutoTest != 0 && gCutsceneChaseAutoTest < 15 &&
157- NoPlayerControl && ReplayParameterPtr -> RecordingEnd - 2 < CameraCnt || gDieWithFade )
158- {
159- gCutsceneChaseAutoTest ++ ;
153+ return ;
154+ }
160155
161- // load next replay and restart
162- if (! CutRec_GotoChase ( gCutsceneChaseAutoTest ))
156+ if ( gCutsceneChaseAutoTest < 15 &&
157+ ( NoPlayerControl && ReplayParameterPtr -> RecordingEnd - 2 < CameraCnt || gDieWithFade ))
163158 {
164- printInfo ("------- AUTOTEST RESULTS -------\n" );
165- for (int i = 0 ; i < 15 ; i ++ )
166- printInfo (" chase %d - hit cars: %d, stuck: %d\n" , i , gAutoTestStats [i ].numHitCars , gAutoTestStats [i ].stuck );
167- printInfo ("------- ---------------- -------\n" );
159+ gCutsceneChaseAutoTest ++ ;
160+
161+ // load next replay and restart
162+ if (!CutRec_GotoChase (gCutsceneChaseAutoTest ))
163+ {
164+ printInfo ("------- AUTOTEST RESULTS -------\n" );
165+ for (int i = 0 ; i < 15 ; i ++ )
166+ printInfo (" chase %d - hit cars: %d, stuck: %d\n" , i , gAutoTestStats [i ].numHitCars , gAutoTestStats [i ].stuck );
167+ printInfo ("------- ---------------- -------\n" );
168+ }
168169 }
169170 }
170171}
@@ -200,12 +201,20 @@ void CutRec_Draw()
200201 PrintString (text , 5 , 215 );
201202 }
202203
203- if ( gAutoTestStats [ gCutsceneChaseAutoTest ]. numHitCars > 0 )
204+ if ( PingBufferPos >= MAX_REPLAY_PINGS - 1 )
204205 SetTextColour (128 , 0 , 0 );
205206
206- sprintf (text , "Hit cars : %d" , gAutoTestStats [ gCutsceneChaseAutoTest ]. numHitCars );
207+ sprintf (text , "Pings : %d" , PingBufferPos );
207208 PrintString (text , 5 , 205 );
208209
210+ SetTextColour (128 , 128 , 128 );
211+
212+ if (gAutoTestStats [gCutsceneChaseAutoTest ].numHitCars > 0 )
213+ SetTextColour (128 , 0 , 0 );
214+
215+ sprintf (text , "Hit cars: %d" , gAutoTestStats [gCutsceneChaseAutoTest ].numHitCars );
216+ PrintString (text , 120 , 205 );
217+
209218 if (gAutoTestStats [gCutsceneChaseAutoTest ].stuck )
210219 {
211220 SetTextColour (128 , 0 , 0 );
@@ -403,10 +412,7 @@ int CutRec_StorePingInfo(int cookieCount, int carId)
403412 PING_PACKET * buffer ;
404413 PING_PACKET * packet ;
405414
406- if (gCutsceneAsReplay == 0 )
407- return 0 ;
408-
409- if (CurrentGameMode == GAMEMODE_REPLAY || gInGameChaseActive != 0 )
415+ if (!CutRec_IsRecording ())
410416 return 0 ;
411417
412418 if (PingBufferPos < MAX_REPLAY_PINGS - 1 )
@@ -417,12 +423,16 @@ int CutRec_StorePingInfo(int cookieCount, int carId)
417423
418424 packet -> cookieCount = cookieCount ;
419425
426+ PingBuffer [PingBufferPos - 1 ] = * packet ;
427+
420428 // always finalize last ping
421429 packet = & NewPingBuffer [PingBufferPos ];
422430 packet -> frame = 0xffff ;
423431 packet -> carId = -1 ;
424432 packet -> cookieCount = -1 ;
425433
434+
435+
426436 return 1 ;
427437 }
428438
@@ -780,4 +790,20 @@ int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
780790 return 1 ;
781791}
782792
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+
783809#endif // CUTSCENE_RECORDER
0 commit comments