Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Most Awesome PR! #182

Open
wants to merge 85 commits into
base: develop-SoapyMan
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
d64948a
[Frontend] Add helper macros/defines for user functions
Fireboyd78 May 16, 2022
87c1acd
Fixed incorrect debris color bug.
Fireboyd78 May 26, 2022
045e429
Initial support for extra configuration data in profiles + replays/cu…
Fireboyd78 Jun 17, 2022
362a52f
Add full support for more than 32 cars on non-PSX builds.
Fireboyd78 Jun 18, 2022
55430ff
Improve draw performance of many cars at once.
Fireboyd78 Jun 18, 2022
88fea59
[Frontend] Refactor code + misc. improvements
Fireboyd78 Jun 18, 2022
ec43cc6
[Frontend] Add Traffic/Pedestrian Density screens.
Fireboyd78 Jun 18, 2022
7a99d9e
Add support for custom traffic/pedestrian densities.
Fireboyd78 Jun 18, 2022
0815106
Add support for fixing regressions w/ backwards compatibility.
Fireboyd78 Jun 18, 2022
4ef7f98
Add pedestrian density to debug information.
Fireboyd78 Jun 18, 2022
48c60d7
[Frontend] Fix incorrect density screen button selections.
Fireboyd78 Jun 18, 2022
8453251
Add regression fix for Tanner phasing through cars on foot.
Fireboyd78 Jun 18, 2022
4fb2445
Tried getting clippedPolygon working... at least it doesn't crash! xD
Fireboyd78 Jun 18, 2022
5ae9b7b
Remove all bug regression checks per Soapy's request.
Fireboyd78 Jun 18, 2022
fb9443c
Such minor grammar mistake
Fireboyd78 Jun 18, 2022
353072c
Replaced some inline code with equivalent function/macro.
Fireboyd78 Jun 18, 2022
5f64034
Added missing changes to remove bug regression stuff.
Fireboyd78 Jun 18, 2022
cde81af
Merge branch 'develop-SoapyMan' into develop-Fireboyd78
SoapyMan Jun 18, 2022
fa19818
Refactor extra data structure and add some more features.
Fireboyd78 Jun 19, 2022
04ef491
Fix a bug where the extra data magic gets overwritten.
Fireboyd78 Jun 19, 2022
f1e2dfd
Only load extra data if the header has correct magic.
Fireboyd78 Jun 19, 2022
d51d5bb
Haha oops
Fireboyd78 Jun 19, 2022
066f9c6
Flag cars with an ugly low LOD, increase some distances on PC.
Fireboyd78 Jun 19, 2022
7dd68b6
Merge branch 'develop-SoapyMan' into develop-Fireboyd78
SoapyMan Jul 12, 2022
d48420c
- fix PSX compile errors
SoapyMan Jul 12, 2022
c8ded05
Fixed bugs + cleaned up code related to noisy car sounds.
Fireboyd78 Jul 25, 2022
c5a67d4
Cleanup ResidentModelsBodge, MapCarIndexToBank
Fireboyd78 Jul 26, 2022
1733c23
Fix up some conditional operators for readability sake.
Fireboyd78 Aug 4, 2022
283da52
[Game:civ_ai] Minor code cleanup
Fireboyd78 Aug 4, 2022
b3efd1e
[Game:gamesnd] Some code cleanup and refactoring
Fireboyd78 Aug 4, 2022
959ab52
[Game:glaunch] Minor code cleanup
Fireboyd78 Aug 4, 2022
0ae9be2
[Game:handling] Some code cleanup and refactoring
Fireboyd78 Aug 4, 2022
bcf089d
[Game:job_fx] Cleaned up DrawExplosion, added reusable DrawGlobe func…
Fireboyd78 Aug 4, 2022
4300795
[Game:leadai] Corrected DIFF_ANGLES macro usage
Fireboyd78 Aug 4, 2022
b8f6b19
[Game:main] Minor code cleanup and refactoring
Fireboyd78 Aug 4, 2022
a44a186
[Game:main] Add missing reset value for Havana3DLevelMode
Fireboyd78 Aug 4, 2022
09dd49d
[Game:mc_snd] Code cleanup and refactoring
Fireboyd78 Aug 4, 2022
bd785cb
[Game:mdraw] Minor code cleanup and refactoring
Fireboyd78 Aug 4, 2022
3a93223
[Game:motion_c] Fixed sprite shadow drawing bugs, cleaned up code
Fireboyd78 Aug 5, 2022
26e947f
[Game:objanim] Fixed incorrect coordinates check for Vegas street lights
Fireboyd78 Aug 5, 2022
fa65031
[Game:pedest] Some code cleanup and refactoring
Fireboyd78 Aug 5, 2022
320c0e5
[Game:players] Minor code cleanup
Fireboyd78 Aug 5, 2022
f878b96
[Game:tile] Draw models unlit if no dynamic lights are available
Fireboyd78 Aug 5, 2022
399cdba
[Game:wheelforces] Minor code cleanup and refactoring
Fireboyd78 Aug 5, 2022
4a058c9
[redriver2_psxpc] Fixed a bug where FreeRoamer debug test cars may ha…
Fireboyd78 Aug 5, 2022
0538d27
Add missing MAX_PED_COLLISIONS define
Fireboyd78 Aug 5, 2022
04cdce5
[Game:cars] Draw cars unlit if no dynamic lights are available
Fireboyd78 Aug 5, 2022
80439d4
[Game:cars] Make use of gte_NormalColorCol macro
Fireboyd78 Aug 5, 2022
ddf78dd
Added support for more profile/mission data overrides.
Fireboyd78 Aug 5, 2022
d60f169
Added GetPlayerFelonyData and UpdatePlayerFelonyData functions.
Fireboyd78 Aug 5, 2022
f83cd21
[Game:felony] Minor code cleanup and refactoring
Fireboyd78 Aug 5, 2022
fb7d70e
[Game:draw] Minor code cleanup and refactoring
Fireboyd78 Aug 5, 2022
850ba2c
[Game:mission] Cleanup and refactor code; improved mission script dumps
Fireboyd78 Aug 5, 2022
1a6f6a4
[Game:pedest] Use PED_ACTION_TIME as the idle animation for a nicer l…
Fireboyd78 Aug 5, 2022
71d27ae
[Game:pres] Added support for custom text scaling values
Fireboyd78 Aug 5, 2022
8797858
Add missing data for new mission script dump code.
Fireboyd78 Aug 5, 2022
d19a88b
Added support for custom user mission threads/handlers.
Fireboyd78 Aug 5, 2022
b6ed4d8
[Game:cop_ai] Minor code cleanup and refactoring
Fireboyd78 Aug 5, 2022
c1c5b52
[Game:debris] Fixed some incorrect debris color entries
Fireboyd78 Aug 5, 2022
809a8fb
[Game:overlay] [PC] Added custom speedometer code
Fireboyd78 Aug 5, 2022
718cc18
Attempt to hackily fix yet another wibbly-wobbly car bug...
Fireboyd78 Aug 5, 2022
b227ae8
Add MORE missing code because I've gotten really good at this :D
Fireboyd78 Aug 5, 2022
d53a172
Added much-improved headlight drawing code.
Fireboyd78 Aug 5, 2022
31caa2b
[Game:event] Minor code cleanup and refactoring pass
Fireboyd78 Aug 5, 2022
b150b13
Created 'AddEvent' and 'NewEvent' functions for easier linked list op…
Fireboyd78 Aug 5, 2022
45f8792
[Game:event] Major code cleanup and refactoring
Fireboyd78 Aug 5, 2022
4724a56
Yet ANOTHER missing piece of code for my speedometer..sheesh!
Fireboyd78 Aug 5, 2022
e127c58
Make the pedestrians be more lively once in awhile!
Fireboyd78 Aug 5, 2022
f2e1a96
[Game:debris] Minor code cleanup and refactoring
Fireboyd78 Aug 5, 2022
e77f9ba
[Game:cars] Just a little code cleanup
Fireboyd78 Aug 5, 2022
4dd6279
Merge branch 'develop-SoapyMan' into develop-Fireboyd78
Fireboyd78 Aug 5, 2022
2e34a8d
Merge branch 'develop-SoapyMan' into develop-Fireboyd78
SoapyMan Sep 10, 2022
d2f6dcb
- fix rain drops
SoapyMan Aug 31, 2022
06e669b
- SetUpCivCollFlags regression fix causing height check to skip
SoapyMan Sep 13, 2022
49c37ee
Fixed some compiler errors :P
Fireboyd78 Sep 13, 2022
f62a2b6
[Game:mission] Fixed a code refactoring bug where chase hits were nev…
Fireboyd78 Sep 10, 2022
6de91ad
[Game:mission] Fixed a bug where palettes get overridden by mistake.
Fireboyd78 Sep 13, 2022
d790f3d
[Game:overmap] Fix speedometer overlap in minigames.
Fireboyd78 Sep 13, 2022
4abcb60
[Game:motion_c] Fixed OTHER_SPRITE's using TannerShadow by mistake.
Fireboyd78 Sep 13, 2022
27a0999
[Game:event] Disabled testing stuff for user event threads.
Fireboyd78 Sep 13, 2022
761e6bf
Improved fixes for wibbly wobbly cars.
Fireboyd78 Sep 13, 2022
963de5e
Merge branch 'develop-SoapyMan' into develop-Fireboyd78
SoapyMan Dec 13, 2022
0287aa6
Merge branch 'develop-Fireboyd78' of github.com:OpenDriver2/REDRIVER2…
SoapyMan Apr 21, 2023
593cb7e
Merge branch 'develop-SoapyMan' into develop-Fireboyd78
SoapyMan Apr 21, 2023
475e610
- support locale for Game graphics options menu
SoapyMan Apr 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src_rebuild/DebugOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ void DrawDebugOverlays()
extern int numParkedCars;
extern int maxCopCars;
extern int maxCivCars;
extern int num_pedestrians;
extern int max_pedestrians;
extern int current_region;
extern int LoadedArea;

Expand All @@ -103,7 +105,7 @@ void DrawDebugOverlays()
sprintf(tempBuf, "Spooling: %d spec: %d, active: %d, Reg: %d, Ar: %d, Cn: %d %d", doSpooling, allowSpecSpooling, spoolactive, current_region, LoadedArea, spoolptr->connected_areas[0] & 0x3f, spoolptr->connected_areas[1] & 0x3f);
PrintString(tempBuf, 10, 30);

sprintf(tempBuf, "Civs: %d - %d parked - max %d", numCivCars, numParkedCars, maxCivCars);
sprintf(tempBuf, "Civs: %d - %d parked - max %d, Peds: %d - max %d", numCivCars, numParkedCars, maxCivCars, num_pedestrians, max_pedestrians);
PrintString(tempBuf, 10, 40);

sprintf(tempBuf, "Cops: %d - %d active - max %d - seen: %d", numCopCars, numActiveCops, maxCopCars, CopsCanSeePlayer);
Expand Down
19 changes: 19 additions & 0 deletions src_rebuild/Game/C/bcollide.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "objanim.h"
#include "system.h"
#include "cutscene.h"
#include "event.h"

extern int gCameraBoxOverlap;

Expand Down Expand Up @@ -678,6 +679,7 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,

#if defined(COLLISION_DEBUG) && !defined(PSX)
extern int gShowCollisionDebug;
extern SVECTOR boatOffset;
if (gShowCollisionDebug == 1)
{
extern void Debug_AddLine(VECTOR & pointA, VECTOR & pointB, CVECTOR & color);
Expand All @@ -687,13 +689,30 @@ int CarBuildingCollision(CAR_DATA *cp, BUILDING_BOX *building, CELL_OBJECT *cop,
CVECTOR rrcv = { 250, 0, 0 };
CVECTOR yycv = { 250, 250, 0 };

VECTOR offset = { 0 };

// show both box axes
{
VECTOR _zero = { 0 };
VECTOR b1p = cd[0].x;
VECTOR b2p = cd[1].x;
b2p.vy = b1p.vy;

if (carsOnBoat.count != 0 && carsOnBoat.cars[cp->id])
{
offset.vx = boatOffset.vx;
offset.vy = boatOffset.vy;
offset.vz = boatOffset.vz;

b1p.vx -= offset.vx;
b1p.vy -= offset.vy;
b1p.vz -= offset.vz;

b2p.vx -= offset.vx;
b2p.vy -= offset.vy;
b2p.vz -= offset.vz;
}

// show position to position
//Debug_AddLine(b1p1, b2p1, yycv);

Expand Down
8 changes: 4 additions & 4 deletions src_rebuild/Game/C/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ short gCameraDefaultScrZ = 256;


CAR_DATA *jcam = NULL;
int switch_detail_distance = 10000;
int switch_detail_distance = SWITCH_LOD_DIST;

// [D] [T]
void PlaceCameraFollowCar(PLAYER *lp)
Expand Down Expand Up @@ -545,7 +545,7 @@ void PlaceCameraFollowCar(PLAYER *lp)
camera_angle.vz = 0;

SetGeomScreen(scr_z = gCameraDefaultScrZ);
switch_detail_distance = 10000;
switch_detail_distance = SWITCH_LOD_DIST;

BuildWorldMatrix();
}
Expand Down Expand Up @@ -651,7 +651,7 @@ void PlaceCameraInCar(PLAYER *lp, int BumperCam)

SetGeomScreen(scr_z = gCameraDefaultScrZ);

switch_detail_distance = 10000;
switch_detail_distance = SWITCH_LOD_DIST;
}

// [D] [T]
Expand Down Expand Up @@ -727,6 +727,6 @@ void PlaceCameraAtLocation(PLAYER* lp, int zoom)
scr_z = gCameraDefaultScrZ;

SetGeomScreen(scr_z);
switch_detail_distance = 10000 + (d >> 1);
switch_detail_distance = SWITCH_LOD_DIST + (d >> 1);
BuildWorldMatrix();
}
22 changes: 13 additions & 9 deletions src_rebuild/Game/C/cars.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ struct plotCarGlobals
u_char* damageLevel;
};


#ifndef PSX
#define CAR_LOD_SWITCH_DISTANCE switch_detail_distance
#else
#define CAR_LOD_SWITCH_DISTANCE 5500
#endif

MATRIX light_matrix =
{
{
Expand Down Expand Up @@ -1508,11 +1501,22 @@ void DrawCar(CAR_DATA* cp, int view)
AddSmokingEngine(cp, doSmoke - 1, WheelSpeed);

#if ENABLE_GAME_ENCHANCEMENTS
AddExhaustSmoke(cp, doSmoke > 1, WheelSpeed);
if (pos.vz < (CAR_LOD_SWITCH_DISTANCE / 2) + 750)
AddExhaustSmoke(cp, doSmoke > 1, WheelSpeed);
#endif

#ifndef PSX
SetShadowPoints(cp, corners);

// do simple shadows when further away
if (pos.vz >= CAR_LOD_SWITCH_DISTANCE / 4)
PlaceShadowForCar(corners, 0, 10, yVal < 0 ? 0 : 2);
else
PlaceShadowForCar(corners, 4, 10, yVal < 0 ? 0 : 2);
#else
SetShadowPoints(cp, corners);
PlaceShadowForCar(corners, 4, 10, yVal < 0 ? 0 : 2);
#endif

ComputeCarLightingLevels(cp, 1);

Expand Down Expand Up @@ -1573,7 +1577,7 @@ void DrawCar(CAR_DATA* cp, int view)
if(CarHasSiren(cp->ap.model))
{
if ((IS_ROADBLOCK_CAR(cp) || cp->controlType == CONTROL_TYPE_PURSUER_AI) || // any regular cop car including roadblock
gInGameCutsceneActive && cp->controlType == CONTROL_TYPE_CUTSCENE && force_siren[CAR_INDEX(cp)] != 0 || // any car with siren in cutscene
gInGameCutsceneActive && cp->controlType == CONTROL_TYPE_CUTSCENE && CARNOISE_HAS_FORCED_SIREN(CAR_INDEX(cp)) != 0 || // any car with siren in cutscene
gCurrentMissionNumber == 26 && cp->controlType == CONTROL_TYPE_CUTSCENE && cp->ap.model == 4) // Vegas ambulance
{
if (cp->ai.p.dying < 75)
Expand Down
6 changes: 6 additions & 0 deletions src_rebuild/Game/C/cars.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

#define IS_ROADBLOCK_CAR(cp) (cp->controlType == CONTROL_TYPE_CIV_AI && (cp->controlFlags & CONTROL_FLAG_COP_SLEEPING))

#ifndef PSX
#define CAR_LOD_SWITCH_DISTANCE (switch_detail_distance+500)
#else
#define CAR_LOD_SWITCH_DISTANCE 5500
#endif

// PHYSICS
extern CAR_DATA car_data[MAX_CARS + 2]; // all cars + Tanner cbox + Camera cbox

Expand Down
85 changes: 78 additions & 7 deletions src_rebuild/Game/C/civ_ai.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "overlay.h"
#include "cutrecorder.h"
#include "draw.h"
#include "glaunch.h"

const u_char speedLimits[3] = { 56, 97, 138 };

Expand Down Expand Up @@ -85,6 +86,15 @@ int test555 = 0;
cp->ai.c.thrustState = 3; cp->ai.c.ctrlState = 7;
#endif

#ifndef PSX
char UglyLowCarLODs[4][10] = {
{ 0,0,0,0,0, 1,0,0,0, 0 },
{ 0,0,0,0,0, 0,0,0,0, 0 },
{ 0,0,0,0,0, 0,0,1,1, 0 },
{ 1,0,0,0,0, 1,1,1,0, 0 },
};
#endif

// [D] [T]
int InitCar(CAR_DATA* cp, int direction, LONGVECTOR4* startPos, unsigned char control, int model, int palette, char* extraData)
{
Expand Down Expand Up @@ -159,6 +169,16 @@ int InitCar(CAR_DATA* cp, int direction, LONGVECTOR4* startPos, unsigned char co
break;
}

#ifndef PSX
int rm = MissionHeader->residentModels[cp->ap.model];

if (rm >= 8)
rm -= 3;

if (UglyLowCarLODs[GameLevel][rm])
cp->controlFlags |= CONTROL_FLAG_DONT_USE_LOW_LOD;
#endif

CreateDentableCar(cp);
DentCar(cp);

Expand Down Expand Up @@ -1741,8 +1761,30 @@ int TrafficLightCycle(int exit)
return 2;
}

struct TRAFFIC_DENSITY_DATA
{
int maxCivCars;
int maxParkedCars;
};

TRAFFIC_DENSITY_DATA trafficDensityMap[2][4] = {
{
{ 14, 7 },
{ 25, 11 },
{ 40, 24 },
{ 64, 32 },
},
{
// recording-specific densities
{ 14, 7 },
{ 25, 11 },
{ 32, 24 }, // <-- recordings have fixed limits above Medium
{ 32, 24 },
},
};

// [D] [T]
void InitCivCars(void)
void InitCivCars(/*[A]*/int recording)
{
PingBufferPos = 0;
cookieCount = 0;
Expand All @@ -1763,6 +1805,22 @@ void InitCivCars(void)
testNumPingedOut = 0;
currentAngle = 0;
closeEncounter = 3;

#ifndef PSX
if (gExtraConfig.gTrafficDensity != 0)
{
TRAFFIC_DENSITY_DATA *trafficDensity = &trafficDensityMap[recording & 1][(gExtraConfig.gTrafficDensity - 1) & 3];

maxCivCars = trafficDensity->maxCivCars;
maxParkedCars = trafficDensity->maxParkedCars;
}
else
{
// make sure we always have the bare minimum amount available
maxCivCars = 14;
maxParkedCars = 7;
}
#endif
}

const int EVENT_CAR_SPEED = 60;
Expand Down Expand Up @@ -2304,20 +2362,18 @@ int PingInCivCar(int minPingInDist)
{
int theta;
int minDistAlong;
int scDist;

// don't spawn outside straight
if (requestCopCar == 0)
{
scDist = lbody * 2;
minDistAlong = lbody * 3;
}
else
{
scDist = lbody * 2;
minDistAlong = 0;
}

if (roadInfo.straight->length <= (scDist + lbody) * 2) // don't spawn outside straight
if (roadInfo.straight->length <= lbody * 6)
return 0;

dx = randomLoc.vx - roadInfo.straight->Midx;
Expand Down Expand Up @@ -2470,6 +2526,19 @@ int PingInCivCar(int minPingInDist)
{
numParkedCars++;

if (gExtraConfig.m.AllowParkedTurnedWheels)
{
int tmp = ((Random2(0) & 0xff) + 1536) & 0x1ff;

if (FrameCnt % 16)
{
if (tmp & 8)
tmp = -tmp;

newCar->wheel_angle = tmp;
}
}

// parked car is going to unpark
if (newCar->ai.c.thrustState == 3)
newCar->controlFlags |= CONTROL_FLAG_WAS_PARKED;
Expand Down Expand Up @@ -3648,9 +3717,11 @@ int CivControl(CAR_DATA* cp)
steer = CivSteerAngle(cp);

thrust = CivAccel(cp);
if (thrust != 0) // [A] reduce acceleration when steering is applied
thrust = CivAccel(cp) - MAX(ABS(steer), 4) * 3;

// [A] reduce acceleration when steering is applied
if (thrust != 0)
thrust -= MAX(ABS(steer), 4) * 3;

// [A] fix backwards crawl
if (thrust < 0 && cp->hd.wheel_speed < 100)
thrust = 0;
Expand Down
2 changes: 1 addition & 1 deletion src_rebuild/Game/C/civ_ai.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern char makeLimoPullOver;

extern char junctionLightsPhase[2];

extern void InitCivCars(); // 0x0002CDA4
extern void InitCivCars(int recording); // 0x0002CDA4

extern int InitCar(CAR_DATA *cp, int direction, LONGVECTOR4* startPos, unsigned char control, int model, int palette, char *extraData); // 0x00023DE8
extern int InitCivState(CAR_DATA* cp, EXTRA_CIV_DATA* extraData); // 0x000280D8
Expand Down
28 changes: 4 additions & 24 deletions src_rebuild/Game/C/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,8 @@ void BuildWorldMatrix(void)
{
MATRIX newmatrix;

newmatrix.m[0][0] = ONE;
newmatrix.m[1][0] = 0;
newmatrix.m[2][0] = 0;

newmatrix.m[0][1] = 0;
newmatrix.m[1][1] = ONE;
newmatrix.m[2][1] = 0;

newmatrix.m[0][2] = 0;
newmatrix.m[1][2] = 0;
newmatrix.m[2][2] = ONE;

InitMatrix(newmatrix);

_RotMatrixY(&newmatrix, camera_angle.vy);
_RotMatrixZ(&newmatrix, camera_angle.vz);
_RotMatrixX(&newmatrix, camera_angle.vx);
Expand Down Expand Up @@ -115,18 +105,8 @@ void ScaleCamera(void)
RotMatrixYXZ(&tempang, &temp);
InvertMatrix(&temp, &temp2);

scale.m[0][0] = ONE;
scale.m[0][1] = 0;
scale.m[0][2] = 0;

scale.m[1][0] = 0;
scale.m[1][1] = ONE;
scale.m[1][2] = 0;

scale.m[2][0] = 0;
scale.m[2][1] = 0;
scale.m[2][2] = ONE;

InitMatrix(scale);

MulMatrix0(&scale, &inv_camera_matrix, &scaledcammat);
TransMatrix(&scaledcammat, &pos);
SetRotMatrix(&scaledcammat);
Expand Down
11 changes: 9 additions & 2 deletions src_rebuild/Game/C/cutrecorder.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,11 @@ int CutRec_LoadCutsceneAsReplayFromBuffer(char* buffer)
NumPlayers = header->NumPlayers;
gRandomChase = header->RandomChase;
CutsceneEventTrigger = header->CutsceneEvent;

StoreGameVars(1);

LoadExtraData(&header->ExtraData, 0);

gCopDifficultyLevel = header->gCopDifficultyLevel;
ActiveCheats = header->ActiveCheats; // TODO: restore old value

Expand Down Expand Up @@ -640,7 +645,7 @@ int CutRec_LoadCutsceneAsReplayFromBuffer(char* buffer)

replayptr = (char*)(PingBuffer + MAX_REPLAY_PINGS);

if (header->HaveStoredData == 0x91827364) // -0x6e7d8c9c
if (header->HaveStoredData == 0x91827364)
{
memcpy((u_char*)&MissionStartData, (u_char*)pt, sizeof(MISSION_DATA));
gHaveStoredData = 1;
Expand Down Expand Up @@ -710,10 +715,12 @@ int CutRec_SaveReplayToBuffer(char* buffer)
// [A] is that ever valid?
if (gHaveStoredData)
{
header->HaveStoredData = 0x91827364; // -0x6e7d8c9c
header->HaveStoredData = 0x91827364;
memcpy((u_char*)pt, (u_char*)&MissionStartData, sizeof(MISSION_DATA));
}

SaveExtraData(&header->ExtraData, 0);

return pt - buffer;
}

Expand Down
Loading