- cutscene recorder to handle pedestrian pads recording

This commit is contained in:
InspirationByte 2022-01-15 16:27:38 +03:00
parent 64a024991e
commit 04cffeb37c
3 changed files with 77 additions and 55 deletions

View File

@ -775,7 +775,7 @@ int CutRec_SaveChase()
return 0;
}
int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
int CutRec_RecordCarPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
{
if (gCutsceneAsReplay == 0 || NoPlayerControl || (-*cp->ai.padid) != gCutsceneAsReplay_PlayerId)
return 0;
@ -800,6 +800,27 @@ int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2)
return 1;
}
int CutRec_RecordPad(PLAYER* pl, uint* t0, char* t1, char* t2)
{
if (gCutsceneAsReplay == 0 || NoPlayerControl || (-pl->padid) != gCutsceneAsReplay_PlayerId)
return 0;
*t0 = Pads[0].mapped;
*t1 = Pads[0].mapanalog[2];
*t2 = Pads[0].type & 4;
// [A] handle REDRIVER2 dedicated car entry button
if (*t0 & TANNER_PAD_ACTION_DED)
{
*t0 &= ~TANNER_PAD_ACTION_DED;
*t0 |= TANNER_PAD_ACTION;
}
cjpRecord(-pl->padid, t0, t1, t2);
return 1;
}
int CutRec_IsRecording()
{
if (gCutsceneAsReplay == 0)

View File

@ -25,7 +25,8 @@ extern void CutRec_ReserveSlots();
extern void CutRec_HandleCarRequest();
extern int CutRec_InitPlayers();
extern int CutRec_InitMission(char* filename);
extern int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2);
extern int CutRec_RecordCarPad(CAR_DATA* cp, uint* t0, char* t1, char* t2);
extern int CutRec_RecordPad(PLAYER* pl, uint* t0, char* t1, char* t2);
extern int CutRec_SaveChase();
#ifdef CUTSCENE_RECORDER
@ -44,6 +45,7 @@ extern int CutRec_SaveChase();
#define _CutRec_HandleCarRequest() CutRec_HandleCarRequest()
#define _CutRec_InitPlayers() CutRec_InitPlayers()
#define _CutRec_InitMission(a) CutRec_InitMission(a)
#define _CutRec_RecordCarPad(a, b, c, d) CutRec_RecordCarPad(a, b, c, d)
#define _CutRec_RecordPad(a, b, c, d) CutRec_RecordPad(a, b, c, d)
#else
@ -62,6 +64,7 @@ extern int CutRec_SaveChase();
#define _CutRec_HandleCarRequest() (0)
#define _CutRec_InitPlayers() (0)
#define _CutRec_InitMission(a) (0)
#define _CutRec_RecordCarPad(a, b, c, d) (0)
#define _CutRec_RecordPad(a, b, c, d) (0)
#endif

View File

@ -1061,7 +1061,7 @@ void StepSim(void)
break;
case CONTROL_TYPE_CUTSCENE:
if (!_CutRec_RecordPad(cp, &t0, &t1, &t2))
if (!_CutRec_RecordCarPad(cp, &t0, &t1, &t2))
cjpPlay(-*cp->ai.padid, &t0, &t1, &t2);
ProcessCarPad(cp, t0, t1, t2);
@ -1081,64 +1081,62 @@ void StepSim(void)
stream = pl->padid;
if (stream < 0)
if (stream < 0) // Is cutscene stream?
{
if (cjpPlay(-stream, &t0, &t1, &t2) != 0)
if (!_CutRec_RecordPad(pl, &t0, &t1, &t2) && cjpPlay(-stream, &t0, &t1, &t2) != 0)
ProcessTannerPad(pl->pPed, t0, t1, t2);
continue;
}
if (Pads[stream].type == 4)
{
padAcc = Pads[stream].mapanalog[3];
// walk back
if (padAcc < -64)
{
if(padAcc < -100)
Pads[stream].mapped |= 0x1000;
else
Pads[stream].mapped |= 0x1008;
}
else if (padAcc > 32)
{
stream = pl->padid;
Pads[stream].mapped |= 0x4000;
}
}
t0 = Pads[stream].mapped;
t1 = Pads[stream].mapanalog[2];
t2 = Pads[stream].type & 4;
// [A] handle REDRIVER2 dedicated car entry button
if (t0 & TANNER_PAD_ACTION_DED)
{
t0 &= ~TANNER_PAD_ACTION_DED;
t0 |= TANNER_PAD_ACTION;
}
if (NoPlayerControl == 0)
{
if (gStopPadReads)
{
t2 = 0;
t1 = 0;
t0 = 0;
}
cjpRecord(stream, &t0, &t1, &t2);
}
else
{
if (Pads[stream].type == 4)
{
padAcc = Pads[stream].mapanalog[3];
// walk back
if (padAcc < -64)
{
if(padAcc < -100)
Pads[stream].mapped |= 0x1000;
else
Pads[stream].mapped |= 0x1008;
}
else if (padAcc > 32)
{
stream = pl->padid;
Pads[stream].mapped |= 0x4000;
}
}
stream = pl->padid;
t0 = Pads[stream].mapped;
t1 = Pads[stream].mapanalog[2];
t2 = Pads[stream].type & 4;
// [A] handle REDRIVER2 dedicated car entry button
if (t0 & TANNER_PAD_ACTION_DED)
{
t0 &= ~TANNER_PAD_ACTION_DED;
t0 |= TANNER_PAD_ACTION;
}
if (NoPlayerControl == 0)
{
if (gStopPadReads)
{
t2 = 0;
t1 = 0;
t0 = 0;
}
cjpRecord(stream, &t0, &t1, &t2);
}
else
{
if (cjpPlay(stream, &t0, &t1, &t2) == 0)
continue;
}
ProcessTannerPad(pl->pPed, t0, t1, t2);
if (cjpPlay(stream, &t0, &t1, &t2) == 0)
continue;
}
ProcessTannerPad(pl->pPed, t0, t1, t2);
}
if (requestStationaryCivCar == 1 && (numCivCars < maxCivCars || (PingOutCar(&car_data[furthestCivID]), numCivCars < maxCivCars)))