mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 20:31:30 +00:00
[HACK] Save correct lap count on netreplays
This commit is contained in:
parent
ab226c1e39
commit
26770c5103
5 changed files with 18 additions and 8 deletions
|
@ -1355,7 +1355,7 @@ static void Got_NetVar(UINT8 **p, INT32 playernum)
|
|||
Setvalue(cvar, svalue, stealth);
|
||||
}
|
||||
|
||||
void CV_SaveNetVars(UINT8 **p)
|
||||
void CV_SaveNetVars(UINT8 **p, boolean demorecording)
|
||||
{
|
||||
consvar_t *cvar;
|
||||
UINT8 *count_p = *p;
|
||||
|
@ -1365,10 +1365,20 @@ void CV_SaveNetVars(UINT8 **p)
|
|||
// the client will reset all netvars to default before loading
|
||||
WRITEUINT16(*p, 0x0000);
|
||||
for (cvar = consvar_vars; cvar; cvar = cvar->next)
|
||||
if ((cvar->flags & CV_NETVAR) && !CV_IsSetToDefault(cvar))
|
||||
if (((cvar->flags & CV_NETVAR) && !CV_IsSetToDefault(cvar)) || (demorecording && cvar->netid == cv_numlaps.netid))
|
||||
{
|
||||
WRITEUINT16(*p, cvar->netid);
|
||||
WRITESTRING(*p, cvar->string);
|
||||
|
||||
// UGLY HACK: Save proper lap count in net replays
|
||||
if (demorecording && cvar->netid == cv_numlaps.netid)
|
||||
{
|
||||
WRITESTRING(*p, cv_basenumlaps.string);
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITESTRING(*p, cvar->string);
|
||||
}
|
||||
|
||||
WRITEUINT8(*p, false);
|
||||
++count;
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ void CV_AddValue(consvar_t *var, INT32 increment);
|
|||
void CV_SaveVariables(FILE *f);
|
||||
|
||||
// load/save gamesate (load and save option and for network join in game)
|
||||
void CV_SaveNetVars(UINT8 **p);
|
||||
void CV_SaveNetVars(UINT8 **p, boolean demorecording);
|
||||
void CV_LoadNetVars(UINT8 **p);
|
||||
|
||||
// reset cheat netvars after cheats is deactivated
|
||||
|
|
|
@ -1500,7 +1500,7 @@ static boolean SV_SendServerConfig(INT32 node)
|
|||
op = p = netbuffer->u.servercfg.varlengthinputs;
|
||||
|
||||
CV_SavePlayerNames(&p);
|
||||
CV_SaveNetVars(&p);
|
||||
CV_SaveNetVars(&p, false);
|
||||
{
|
||||
const size_t len = sizeof (serverconfig_pak) + (size_t)(p - op);
|
||||
|
||||
|
|
|
@ -5494,7 +5494,7 @@ void G_BeginRecording(void)
|
|||
|
||||
if (demoflags & DF_MULTIPLAYER) {
|
||||
// Netvars first :)
|
||||
CV_SaveNetVars(&demo_p);
|
||||
CV_SaveNetVars(&demo_p, true);
|
||||
|
||||
// Now store a SIMPLIFIED data struct for each in-game player
|
||||
for (p = 0; p < MAXPLAYERS; p++) {
|
||||
|
@ -5576,7 +5576,7 @@ void G_BeginRecording(void)
|
|||
WRITEFIXED(demo_p, player->jumpfactor);
|
||||
|
||||
// Save netvar data (SONICCD, etc)
|
||||
CV_SaveNetVars(&demo_p);
|
||||
CV_SaveNetVars(&demo_p, false); //@TODO can this be true? it's not necessary for now but would be nice for consistency
|
||||
|
||||
memset(&oldcmd,0,sizeof(oldcmd));
|
||||
memset(&oldghost,0,sizeof(oldghost));
|
||||
|
|
|
@ -3447,7 +3447,7 @@ void P_SaveNetGame(void)
|
|||
mobj_t *mobj;
|
||||
INT32 i = 1; // don't start from 0, it'd be confused with a blank pointer otherwise
|
||||
|
||||
CV_SaveNetVars(&save_p);
|
||||
CV_SaveNetVars(&save_p, false);
|
||||
P_NetArchiveMisc();
|
||||
|
||||
// Assign the mobjnumber for pointer tracking
|
||||
|
|
Loading…
Reference in a new issue