Start with some strange multiplayer replay init stuff

Mostly just disabling the parts of the replay that assume
a single player, right now.

# Conflicts:
#	src/g_game.c
This commit is contained in:
fickleheart 2019-01-27 14:33:38 -06:00
parent e45b2ea257
commit 1f72df4edb

View file

@ -4481,6 +4481,7 @@ char *G_BuildMapTitle(INT32 mapnum)
#define DF_NIGHTSATTACK 0x04 // This demo is from NiGHTS attack and contains its time left, score, and mares!
#define DF_ATTACKMASK 0x06 // This demo is from ??? attack and contains ???
#define DF_ATTACKSHIFT 1
#define DF_MULTIPLAYER 0x80 // This demo contains a dynamic number of players!
// For demos
#define ZT_FWD 0x01
@ -5442,7 +5443,7 @@ void G_BeginRecording(void)
memset(name,0,sizeof(name));
demo_p = demobuffer;
demoflags = DF_GHOST|(modeattacking<<DF_ATTACKSHIFT);
demoflags = DF_GHOST|(multiplayer ? DF_MULTIPLAYER : (modeattacking<<DF_ATTACKSHIFT));
// Setup header.
M_Memcpy(demo_p, DEMOHEADER, 12); demo_p += 12;
@ -5479,6 +5480,12 @@ void G_BeginRecording(void)
WRITEUINT32(demo_p,P_GetInitSeed());
if (demoflags & DF_MULTIPLAYER) {
// Net replays don't store player info here! Just skip to the netvars and return out.
CV_SaveNetVars(&demo_p);
return;
}
// Name
for (i = 0; i < 16 && cv_playername.string[i]; i++)
name[i] = cv_playername.string[i];
@ -5836,6 +5843,7 @@ void G_DoPlayDemo(char *defdemoname)
demoflags = READUINT8(demo_p);
modeattacking = (demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT;
multiplayer = !!(demoflags & DF_MULTIPLAYER);
CON_ToggleOff();
hu_demotime = UINT32_MAX;
@ -5861,6 +5869,7 @@ void G_DoPlayDemo(char *defdemoname)
// Random seed
randseed = READUINT32(demo_p);
if (!multiplayer) {
// Player name
M_Memcpy(player_names[0],demo_p,16);
demo_p += 16;
@ -5888,6 +5897,7 @@ void G_DoPlayDemo(char *defdemoname)
accelstart = READUINT8(demo_p);
acceleration = READUINT8(demo_p);
jumpfactor = READFIXED(demo_p);
}
// net var data
CV_LoadNetVars(&demo_p);
@ -5932,10 +5942,12 @@ void G_DoPlayDemo(char *defdemoname)
#endif*/
displayplayer = consoleplayer = 0;
memset(playeringame,0,sizeof(playeringame));
playeringame[0] = true;
playeringame[0] = !multiplayer;
P_SetRandSeed(randseed);
G_InitNew(false, G_BuildMapName(gamemap), true, true); // Doesn't matter whether you reset or not here, given changes to resetplayer.
if (!multiplayer) {
// Set skin
SetPlayerSkin(0, skin);
@ -5973,6 +5985,7 @@ void G_DoPlayDemo(char *defdemoname)
players[0].accelstart = accelstart;
players[0].acceleration = acceleration;
players[0].jumpfactor = jumpfactor;
}
demo_start = true;
}