Demos now store map lumpname rather than mapheader ID

This was the last thing we needed to do before infinite maps. Stay tuned.
This commit is contained in:
toaster 2022-09-21 22:37:30 +01:00 committed by GenericHeroGuy
parent a9f1408376
commit 13dacbb162

View file

@ -2079,7 +2079,7 @@ void G_BeginRecording(void)
// game data
M_Memcpy(demobuf.p, "PLAY", 4); demobuf.p += 4;
WRITEINT16(demobuf.p,gamemap);
WRITESTRINGN(demobuf.p, mapheaderinfo[gamemap-1]->lumpname, 255);
M_Memcpy(demobuf.p, mapmd5, 16); demobuf.p += 16;
WRITEUINT8(demobuf.p, demoflags);
@ -2502,6 +2502,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
UINT16 s ATTRUNUSED;
UINT8 aflags = 0;
boolean uselaps = false;
char discard[255];
// load the new file
FIL_DefaultExtension(newname, ".lmp");
@ -2522,7 +2523,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
p += 16; // demo checksum
I_Assert(!memcmp(p, "PLAY", 4));
p += 4; // PLAY
p += 2; // gamemap
READSTRINGN(p, discard, sizeof(discard)); // gamemap
p += 16; // map md5
flags = READUINT8(p); // demoflags
p++; // gametype
@ -2580,7 +2581,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
Z_Free(buffer);
return UINT8_MAX;
} p += 4; // "PLAY"
p += 2; // gamemap
READSTRINGN(p, discard, sizeof(discard)); // gamemap
p += 16; // mapmd5
flags = READUINT8(p);
p++; // gametype
@ -2972,7 +2973,8 @@ void G_DoPlayDemo(char *defdemoname)
}
demobuf.p += 4; // "PLAY"
gamemap = READINT16(demobuf.p);
READSTRINGN(demobuf.p, mapname, sizeof(mapname)); // gamemap
gamemap = G_MapNumber(mapname)+1;
demobuf.p += 16; // mapmd5
demoflags = READUINT8(demobuf.p);
@ -3293,7 +3295,7 @@ void G_AddGhost(char *defdemoname)
{
INT32 i;
lumpnum_t l;
char name[17],skin[17],color[MAXCOLORNAME+1],*n,*pdemoname,md5[16];
char name[17],skin[17],color[MAXCOLORNAME+1],discard[255],*n,*pdemoname,md5[16];
demoghost *gh;
UINT8 flags;
UINT8 *buffer,*p;
@ -3382,7 +3384,7 @@ void G_AddGhost(char *defdemoname)
} p += 4; // "PLAY"
p += 2; // gamemap
READSTRINGN(p, discard, sizeof(discard)); // gamemap
p += 16; // mapmd5 (possibly check for consistency?)
flags = READUINT8(p);
@ -3581,6 +3583,7 @@ void G_UpdateStaffGhostName(lumpnum_t l)
UINT8 *buffer,*p;
UINT16 ghostversion;
UINT8 flags;
char discard[255];
buffer = p = W_CacheLumpNum(l, PU_CACHE);
@ -3614,7 +3617,7 @@ void G_UpdateStaffGhostName(lumpnum_t l)
}
p += 4; // "PLAY"
p += 2; // gamemap
READSTRINGN(p, discard, sizeof(discard)); // gamemap
p += 16; // mapmd5 (possibly check for consistency?)
flags = READUINT8(p);