mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-22 11:51:10 +00:00
Add title to netreplays and do some format cleanup
This commit is contained in:
parent
7af0554aba
commit
c7109c0ae4
5 changed files with 107 additions and 80 deletions
|
@ -140,6 +140,7 @@ static UINT8 localtextcmd3[MAXTEXTCMD]; // splitscreen == 2
|
||||||
static UINT8 localtextcmd4[MAXTEXTCMD]; // splitscreen == 3
|
static UINT8 localtextcmd4[MAXTEXTCMD]; // splitscreen == 3
|
||||||
static tic_t neededtic;
|
static tic_t neededtic;
|
||||||
SINT8 servernode = 0; // the number of the server node
|
SINT8 servernode = 0; // the number of the server node
|
||||||
|
char connectedservername[MAXSERVERNAME];
|
||||||
/// \brief do we accept new players?
|
/// \brief do we accept new players?
|
||||||
/// \todo WORK!
|
/// \todo WORK!
|
||||||
boolean acceptnewnode = true;
|
boolean acceptnewnode = true;
|
||||||
|
@ -2320,6 +2321,9 @@ static void CL_ConnectToServer(boolean viams)
|
||||||
{
|
{
|
||||||
INT32 j;
|
INT32 j;
|
||||||
const char *gametypestr = NULL;
|
const char *gametypestr = NULL;
|
||||||
|
|
||||||
|
strncpy(connectedservername, serverlist[i].info.servername, MAXSERVERNAME);
|
||||||
|
|
||||||
CONS_Printf(M_GetText("Connecting to: %s\n"), serverlist[i].info.servername);
|
CONS_Printf(M_GetText("Connecting to: %s\n"), serverlist[i].info.servername);
|
||||||
for (j = 0; gametype_cons_t[j].strvalue; j++)
|
for (j = 0; gametype_cons_t[j].strvalue; j++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -532,6 +532,7 @@ extern boolean dedicated; // For dedicated server
|
||||||
extern UINT16 software_MAXPACKETLENGTH;
|
extern UINT16 software_MAXPACKETLENGTH;
|
||||||
extern boolean acceptnewnode;
|
extern boolean acceptnewnode;
|
||||||
extern SINT8 servernode;
|
extern SINT8 servernode;
|
||||||
|
extern char connectedservername[MAXSERVERNAME];
|
||||||
|
|
||||||
void Command_Ping_f(void);
|
void Command_Ping_f(void);
|
||||||
extern tic_t connectiontimeout;
|
extern tic_t connectiontimeout;
|
||||||
|
|
|
@ -487,6 +487,8 @@ extern UINT32 timesBeaten; // # of times the game has been beaten.
|
||||||
extern UINT32 timesBeatenWithEmeralds;
|
extern UINT32 timesBeatenWithEmeralds;
|
||||||
//extern UINT32 timesBeatenUltimate;
|
//extern UINT32 timesBeatenUltimate;
|
||||||
|
|
||||||
|
extern char demotitle[65];
|
||||||
|
|
||||||
// ===========================
|
// ===========================
|
||||||
// Internal parameters, fixed.
|
// Internal parameters, fixed.
|
||||||
// ===========================
|
// ===========================
|
||||||
|
|
53
src/g_game.c
53
src/g_game.c
|
@ -289,6 +289,7 @@ UINT32 timesBeatenWithEmeralds;
|
||||||
|
|
||||||
//@TODO put these all in a struct for namespacing purposes?
|
//@TODO put these all in a struct for namespacing purposes?
|
||||||
static char demoname[64];
|
static char demoname[64];
|
||||||
|
char demotitle[65];
|
||||||
boolean demorecording, demosaved, demodefersave, demoplayback;
|
boolean demorecording, demosaved, demodefersave, demoplayback;
|
||||||
boolean demo_loadfiles, demo_ignorefiles; // Demo file loading options
|
boolean demo_loadfiles, demo_ignorefiles; // Demo file loading options
|
||||||
tic_t demosavebutton;
|
tic_t demosavebutton;
|
||||||
|
@ -6061,13 +6062,6 @@ void G_BeginRecording(void)
|
||||||
demo_p = demobuffer;
|
demo_p = demobuffer;
|
||||||
demoflags = DF_GHOST|(multiplayer ? DF_MULTIPLAYER : (modeattacking<<DF_ATTACKSHIFT));
|
demoflags = DF_GHOST|(multiplayer ? DF_MULTIPLAYER : (modeattacking<<DF_ATTACKSHIFT));
|
||||||
|
|
||||||
demoflags |= gametype<<DF_GAMESHIFT;
|
|
||||||
|
|
||||||
// Demo compat: don't write filelist in record attack for now so those replays can still be submitted to the records site
|
|
||||||
//@TODO remove this check eventually and always write the file list
|
|
||||||
if (!modeattacking)
|
|
||||||
demoflags |= DF_FILELIST;/* new versions */
|
|
||||||
|
|
||||||
if (encoremode)
|
if (encoremode)
|
||||||
demoflags |= DF_ENCORE;
|
demoflags |= DF_ENCORE;
|
||||||
|
|
||||||
|
@ -6077,6 +6071,10 @@ void G_BeginRecording(void)
|
||||||
WRITEUINT8(demo_p,SUBVERSION);
|
WRITEUINT8(demo_p,SUBVERSION);
|
||||||
WRITEUINT16(demo_p,DEMOVERSION);
|
WRITEUINT16(demo_p,DEMOVERSION);
|
||||||
|
|
||||||
|
// Full replay title
|
||||||
|
demo_p += 64;
|
||||||
|
snprintf(demotitle, 64, "%s - %s", G_BuildMapTitle(gamemap), modeattacking ? "Record Attack" : connectedservername);
|
||||||
|
|
||||||
// demo checksum
|
// demo checksum
|
||||||
demo_p += 16;
|
demo_p += 16;
|
||||||
|
|
||||||
|
@ -6086,9 +6084,8 @@ void G_BeginRecording(void)
|
||||||
M_Memcpy(demo_p, mapmd5, 16); demo_p += 16;
|
M_Memcpy(demo_p, mapmd5, 16); demo_p += 16;
|
||||||
|
|
||||||
WRITEUINT8(demo_p, demoflags);
|
WRITEUINT8(demo_p, demoflags);
|
||||||
|
WRITEUINT8(demo_p, gametype & 0xFF);
|
||||||
|
|
||||||
if (demoflags & DF_FILELIST)
|
|
||||||
{
|
|
||||||
// file list
|
// file list
|
||||||
m = demo_p;/* file count */
|
m = demo_p;/* file count */
|
||||||
demo_p += 1;
|
demo_p += 1;
|
||||||
|
@ -6105,7 +6102,6 @@ void G_BeginRecording(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITEUINT8(m, totalfiles);
|
WRITEUINT8(m, totalfiles);
|
||||||
}
|
|
||||||
|
|
||||||
switch ((demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT)
|
switch ((demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT)
|
||||||
{
|
{
|
||||||
|
@ -6471,6 +6467,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
||||||
I_Assert(c == SUBVERSION);
|
I_Assert(c == SUBVERSION);
|
||||||
s = READUINT16(p);
|
s = READUINT16(p);
|
||||||
I_Assert(s == DEMOVERSION);
|
I_Assert(s == DEMOVERSION);
|
||||||
|
p += 64; // full demo title
|
||||||
p += 16; // demo checksum
|
p += 16; // demo checksum
|
||||||
I_Assert(!memcmp(p, "PLAY", 4));
|
I_Assert(!memcmp(p, "PLAY", 4));
|
||||||
p += 4; // PLAY
|
p += 4; // PLAY
|
||||||
|
@ -6521,10 +6518,11 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
|
||||||
switch(oldversion) // demoversion
|
switch(oldversion) // demoversion
|
||||||
{
|
{
|
||||||
case DEMOVERSION: // latest always supported
|
case DEMOVERSION: // latest always supported
|
||||||
|
p += 64; // full demo title
|
||||||
break;
|
break;
|
||||||
#ifdef DEMO_COMPAT_100
|
#ifdef DEMO_COMPAT_100
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
I_Error("You need to implement demo compat here, doofus! %s:%s", __FILE__, __LINE__);
|
I_Error("You need to implement demo compat here, doofus! %s:%d", __FILE__, __LINE__);
|
||||||
#endif
|
#endif
|
||||||
// too old, cannot support.
|
// too old, cannot support.
|
||||||
default:
|
default:
|
||||||
|
@ -6667,10 +6665,15 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
switch(demoversion)
|
switch(demoversion)
|
||||||
{
|
{
|
||||||
case DEMOVERSION: // latest always supported
|
case DEMOVERSION: // latest always supported
|
||||||
|
// demo title
|
||||||
|
M_Memcpy(demotitle, demo_p, 64);
|
||||||
|
CONS_Printf("Demo title: %s\n", demotitle);
|
||||||
|
demo_p += 64;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#ifdef DEMO_COMPAT_100
|
#ifdef DEMO_COMPAT_100
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
I_Error("You need to implement demo compat here, doofus! %s:%s", __FILE__, __LINE__);
|
I_Error("You need to implement demo compat here, doofus! %s:%d", __FILE__, __LINE__);
|
||||||
#endif
|
#endif
|
||||||
// too old, cannot support.
|
// too old, cannot support.
|
||||||
default:
|
default:
|
||||||
|
@ -6700,8 +6703,12 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
demo_p += 16; // mapmd5
|
demo_p += 16; // mapmd5
|
||||||
|
|
||||||
demoflags = READUINT8(demo_p);
|
demoflags = READUINT8(demo_p);
|
||||||
if (demoflags & DF_FILELIST)
|
#ifdef DEMO_COMPAT_100
|
||||||
|
if (demoversion != 0x0001)
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
|
gametype = READUINT8(demo_p);
|
||||||
|
|
||||||
if (titledemo) // Titledemos should always play and ought to always be compatible with whatever wadlist is running.
|
if (titledemo) // Titledemos should always play and ought to always be compatible with whatever wadlist is running.
|
||||||
G_SkipDemoExtraFiles(&demo_p);
|
G_SkipDemoExtraFiles(&demo_p);
|
||||||
else if (demo_loadfiles)
|
else if (demo_loadfiles)
|
||||||
|
@ -6757,11 +6764,12 @@ void G_DoPlayDemo(char *defdemoname)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef DEMO_COMPAT_100
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
modeattacking = (demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT;
|
modeattacking = (demoflags & DF_ATTACKMASK)>>DF_ATTACKSHIFT;
|
||||||
multiplayer = !!(demoflags & DF_MULTIPLAYER);
|
multiplayer = !!(demoflags & DF_MULTIPLAYER);
|
||||||
gametype = (demoflags & DF_GAMETYPEMASK)>>DF_GAMESHIFT;
|
|
||||||
CON_ToggleOff();
|
CON_ToggleOff();
|
||||||
|
|
||||||
hu_demotime = UINT32_MAX;
|
hu_demotime = UINT32_MAX;
|
||||||
|
@ -7043,7 +7051,7 @@ void G_AddGhost(char *defdemoname)
|
||||||
break;
|
break;
|
||||||
#ifdef DEMO_COMPAT_100
|
#ifdef DEMO_COMPAT_100
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
I_Error("You need to implement demo compat here, doofus! %s:%s", __FILE__, __LINE__);
|
I_Error("You need to implement demo compat here, doofus! %s:%d", __FILE__, __LINE__);
|
||||||
#endif
|
#endif
|
||||||
// too old, cannot support.
|
// too old, cannot support.
|
||||||
default:
|
default:
|
||||||
|
@ -7244,10 +7252,11 @@ void G_UpdateStaffGhostName(lumpnum_t l)
|
||||||
switch(ghostversion)
|
switch(ghostversion)
|
||||||
{
|
{
|
||||||
case DEMOVERSION: // latest always supported
|
case DEMOVERSION: // latest always supported
|
||||||
|
p += 64; // full demo title
|
||||||
break;
|
break;
|
||||||
#ifdef DEMO_COMPAT_100
|
#ifdef DEMO_COMPAT_100
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
I_Error("You need to implement demo compat here, doofus! %s:%s", __FILE__, __LINE__);
|
CONS_Printf("You need to implement demo compat here, doofus! %s:%d\n", __FILE__, __LINE__);
|
||||||
#endif
|
#endif
|
||||||
// too old, cannot support.
|
// too old, cannot support.
|
||||||
default:
|
default:
|
||||||
|
@ -7362,7 +7371,7 @@ void G_DoPlayMetal(void)
|
||||||
break;
|
break;
|
||||||
#ifdef DEMO_COMPAT_100
|
#ifdef DEMO_COMPAT_100
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
I_Error("You need to implement demo compat here, doofus! %s:%s", __FILE__, __LINE__);
|
I_Error("You need to implement demo compat here, doofus! %s:%d", __FILE__, __LINE__);
|
||||||
#endif
|
#endif
|
||||||
// too old, cannot support.
|
// too old, cannot support.
|
||||||
default:
|
default:
|
||||||
|
@ -7534,13 +7543,19 @@ void G_SaveDemo(void)
|
||||||
UINT8 *p = demobuffer+16; // checksum position
|
UINT8 *p = demobuffer+16; // checksum position
|
||||||
#ifdef NOMD5
|
#ifdef NOMD5
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
#endif
|
||||||
|
|
||||||
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
||||||
|
M_Memcpy(p, demotitle, 64); // Write demo title here
|
||||||
|
p += 64;
|
||||||
|
|
||||||
|
#ifdef NOMD5
|
||||||
for (i = 0; i < 16; i++, p++)
|
for (i = 0; i < 16; i++, p++)
|
||||||
*p = P_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
*p = M_RandomByte(); // This MD5 was chosen by fair dice roll and most likely < 50% correct.
|
||||||
#else
|
#else
|
||||||
WRITEUINT8(demo_p, DEMOMARKER); // add the demo end marker
|
|
||||||
md5_buffer((char *)p+16, demo_p - (p+16), p); // make a checksum of everything after the checksum in the file.
|
md5_buffer((char *)p+16, demo_p - (p+16), p); // make a checksum of everything after the checksum in the file.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
demosaved = FIL_WriteFile(va(pandf, srb2home, demoname), demobuffer, demo_p - demobuffer); // finally output the file.
|
demosaved = FIL_WriteFile(va(pandf, srb2home, demoname), demobuffer, demo_p - demobuffer); // finally output the file.
|
||||||
free(demobuffer);
|
free(demobuffer);
|
||||||
demorecording = false;
|
demorecording = false;
|
||||||
|
|
|
@ -2204,6 +2204,11 @@ static void HU_DrawDemoInfo(void)
|
||||||
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, 0, M_GetText("Replay:"));
|
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-40, 0, M_GetText("Replay:"));
|
||||||
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[0]);
|
V_DrawCenteredString((BASEVIDWIDTH/2), BASEVIDHEIGHT-32, V_ALLOWLOWERCASE, player_names[0]);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
V_DrawRightAlignedThinString(BASEVIDWIDTH-2, BASEVIDHEIGHT-10, V_ALLOWLOWERCASE, demotitle);
|
||||||
|
}
|
||||||
|
|
||||||
if (modeattacking)
|
if (modeattacking)
|
||||||
{
|
{
|
||||||
V_DrawRightAlignedString((BASEVIDWIDTH/2)-4, BASEVIDHEIGHT-24, V_YELLOWMAP|V_MONOSPACE, "BEST TIME:");
|
V_DrawRightAlignedString((BASEVIDWIDTH/2)-4, BASEVIDHEIGHT-24, V_YELLOWMAP|V_MONOSPACE, "BEST TIME:");
|
||||||
|
|
Loading…
Reference in a new issue