Staff attack ghost names on the REPLAY... menu.

Also: Remove playercolor being set to the replay's color. No need to kill your settings, seeing as it makes no tangible effect on your replay (doesn't even lose colour when you die, so I don't even know...)
This commit is contained in:
toaster 2018-11-04 01:00:17 +00:00
parent f9ad07da5f
commit 6604d0181c
4 changed files with 91 additions and 3 deletions

View file

@ -5861,7 +5861,7 @@ void G_DoPlayDemo(char *defdemoname)
players[0].skincolor = i;
break;
}
CV_StealthSetValue(&cv_playercolor, players[0].skincolor);
//CV_StealthSetValue(&cv_playercolor, players[0].skincolor); -- as far as I can tell this is more trouble than it's worth
if (players[0].mo)
{
players[0].mo->color = players[0].skincolor;
@ -6115,6 +6115,68 @@ void G_AddGhost(char *defdemoname)
Z_Free(pdemoname);
}
// A simplified version of G_AddGhost...
void G_UpdateStaffGhostName(lumpnum_t l)
{
UINT8 *buffer,*p;
UINT16 ghostversion;
UINT8 flags;
buffer = p = W_CacheLumpNum(l, PU_CACHE);
// read demo header
if (memcmp(p, DEMOHEADER, 12))
{
goto fail;
} p += 12; // DEMOHEADER
p++; // VERSION
p++; // SUBVERSION
ghostversion = READUINT16(p);
switch(ghostversion)
{
case DEMOVERSION: // latest always supported
break;
// too old, cannot support.
default:
goto fail;
}
p += 16; // demo checksum
if (memcmp(p, "PLAY", 4))
{
goto fail;
} p += 4; // "PLAY"
p += 2; // gamemap
p += 16; // mapmd5 (possibly check for consistency?)
flags = READUINT8(p);
if (!(flags & DF_GHOST))
{
goto fail; // we don't NEED to do it here, but whatever
}
switch ((flags & DF_ATTACKMASK)>>DF_ATTACKSHIFT)
{
case ATTACKING_NONE: // 0
break;
case ATTACKING_RECORD: // 1
p += 8; // demo time, lap
break;
/*case ATTACKING_NIGHTS: // 2
p += 8; // demo time left, score
break;*/
default: // 3
break;
}
p += 4; // random seed
// Player name
M_Memcpy(dummystaffname, p,16);
dummystaffname[16] = '\0';
// Ok, no longer any reason to care, bye
fail:
Z_Free(buffer);
return;
}
//
// G_TimeDemo
// NOTE: name is a full filename for external demos

View file

@ -183,6 +183,7 @@ extern demoghost *ghosts;
void G_DoPlayDemo(char *defdemoname);
void G_TimeDemo(const char *name);
void G_AddGhost(char *defdemoname);
void G_UpdateStaffGhostName(lumpnum_t l);
void G_DoPlayMetal(void);
void G_DoneLevelLoad(void);
void G_StopMetalDemo(void);

View file

@ -1472,7 +1472,7 @@ static menuitem_t OP_ServerOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 40},
{IT_STRING | IT_CVAR, NULL, "Map Progression", &cv_advancemap, 50},
{IT_STRING | IT_CVAR, NULL, "Voting Timer", &cv_votetime, 60},
{IT_STRING | IT_CVAR, NULL, "Voting Rule Changes", &cv_kartvoterulechanges, 70},
{IT_STRING | IT_CVAR, NULL, "Voting Rule Changes", &cv_kartvoterulechanges, 70},
#ifndef NONET
{IT_STRING | IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 90},
@ -2098,6 +2098,9 @@ static void Nextmap_OnChange(void)
SP_GhostMenu[4].status = IT_STRING|IT_CVAR;
CV_StealthSetValue(&cv_dummystaff, 1);
active |= 1;
dummystaffname[0] = '\0';
G_UpdateStaffGhostName(l);
}
if (active) {
@ -2145,9 +2148,14 @@ static void Dummymenuplayer_OnChange(void)
}
}*/
char dummystaffname[17];
static void Dummystaff_OnChange(void)
{
lumpnum_t l;
dummystaffname[0] = '\0';
if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(cv_nextmap.value)))) == LUMPERROR)
{
CV_StealthSetValue(&cv_dummystaff, 0);
@ -2163,6 +2171,11 @@ static void Dummystaff_OnChange(void)
CV_StealthSetValue(&cv_dummystaff, numstaff);
else if (cv_dummystaff.value > numstaff)
CV_StealthSetValue(&cv_dummystaff, 1);
if ((l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value), cv_dummystaff.value))) == LUMPERROR)
return; // shouldn't happen but might as well check...
G_UpdateStaffGhostName(l);
}
}
@ -6433,7 +6446,17 @@ void M_DrawTimeAttackMenu(void)
}
}
else if ((currentMenu->menuitems[i].status & IT_TYPE) == IT_KEYHANDLER && cv_dummystaff.value) // bad hacky assumption: IT_KEYHANDLER is assumed to be staff ghost selector
V_DrawString(BASEVIDWIDTH - x - 80 - V_StringWidth(cv_dummystaff.string, 0), y, highlightflags, cv_dummystaff.string);
{
INT32 strw = V_StringWidth(dummystaffname, V_ALLOWLOWERCASE);
V_DrawString(BASEVIDWIDTH - x - strw, y, highlightflags|V_ALLOWLOWERCASE, dummystaffname);
if (i == itemOn)
{
V_DrawCharacter(BASEVIDWIDTH - x - 10 - strw - (skullAnimCounter/5), y,
'\x1C' | highlightflags, false); // left arrow
V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y,
'\x1D' | highlightflags, false); // right arrow
}
}
}
x = currentMenu->x;

View file

@ -211,6 +211,8 @@ extern description_t description[32];
extern consvar_t cv_newgametype, cv_nextmap, cv_chooseskin, cv_serversort;
extern CV_PossibleValue_t gametype_cons_t[];
extern char dummystaffname[17];
extern INT16 startmap;
extern INT32 ultimate_selectable;