Title demos: Add support for game loading vRes staff ghosts as title demos

This commit is contained in:
toaster 2023-02-03 18:23:59 +00:00
parent 29ddf06f1e
commit 96297aad1c
2 changed files with 16 additions and 46 deletions

View file

@ -2194,25 +2194,20 @@ void F_TitleScreenTicker(boolean run)
return; return;
} }
#ifdef STAFFGHOSTS
// is it time? // is it time?
if (!(--demoIdleLeft)) if (!(--demoIdleLeft))
{ {
//static boolean use_netreplay = false; char dname[MAXMAPLUMPNAME+1+8+1];
UINT16 mapnum;
char dname[9];
char *dname2 = dname;
lumpnum_t l;
const char *mapname;
UINT8 numstaff; UINT8 numstaff;
static boolean use_netreplay = false;
//@TODO uncomment this when this goes into vanilla if ((use_netreplay = !use_netreplay))
/*if ((use_netreplay = !use_netreplay))*/
{ {
numstaff = 1; lumpnum_t l = LUMPERROR;
while ((l = W_CheckNumForName(va("TDEMO%03u", numstaff))) != LUMPERROR) numstaff = 0;
while (numstaff < 99 && (l = W_CheckNumForName(va("TDEMO%03u", numstaff))) != LUMPERROR)
numstaff++; numstaff++;
numstaff--;
if (numstaff) if (numstaff)
{ {
@ -2225,43 +2220,24 @@ void F_TitleScreenTicker(boolean run)
// prevent console spam if failed // prevent console spam if failed
demoIdleLeft = demoIdleTime; demoIdleLeft = demoIdleTime;
if ((l = W_CheckNumForName("MAP01S01")) == LUMPERROR) // gotta have ONE mapnum = G_RandMap(TOL_RACE|TOL_BATTLE, -2, 2, 0, false, NULL);
if (mapnum == 0) // gotta have ONE
{ {
F_StartIntro();
return; return;
} }
mapname = G_BuildMapName(G_RandMap(TOL_RACE, -2, 0, 0, false, NULL)+1); numstaff = M_RandomKey(mapheaderinfo[mapnum]->ghostCount)+1;
numstaff = 1;
while (numstaff < 99 && (l = W_CheckNumForLongName(va("%sS%02u",mapname,numstaff+1))) != LUMPERROR)
numstaff++;
numstaff = M_RandomKey(numstaff)+1;
// Setup demo name // Setup demo name
dname2 = Z_StrDup(va("%sS%02u", mapname, numstaff)); sprintf(dname, "%s/GHOST_%u", mapheaderinfo[mapnum]->lumpname, numstaff);
/*if ((l = W_CheckNumForName(dname)) == LUMPERROR) -- we KNOW it exists now
{
CONS_Alert(CONS_ERROR, M_GetText("Demo lump \"%s\" doesn't exist\n"), dname);
F_StartIntro();
return;
}*/
loadreplay: loadreplay:
demo.title = demo.fromtitle = true; demo.title = demo.fromtitle = true;
demo.ignorefiles = true; demo.ignorefiles = true;
demo.loadfiles = false; demo.loadfiles = false;
G_DoPlayDemo(dname2); G_DoPlayDemo(dname);
if (dname2 != dname)
{
Z_Free(dname2);
} }
} }
#endif //#ifdef STAFFGHOSTS
}
void F_TitleDemoTicker(void) void F_TitleDemoTicker(void)
{ {

View file

@ -3441,6 +3441,10 @@ tryagain:
|| (usehellmaps != (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // this is bad || (usehellmaps != (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // this is bad
continue; //isokmap = false; continue; //isokmap = false;
if (pprevmap == -2 // title demo hack
&& mapheaderinfo[ix]->ghostCount == 0)
continue;
if (!ignorebuffer) if (!ignorebuffer)
{ {
if (extbufsize > 0) if (extbufsize > 0)
@ -3475,16 +3479,6 @@ tryagain:
continue; continue;
} }
#ifdef STAFFGHOSTS
if (pprevmap == -2) // title demo hack
{
lumpnum_t l;
// TODO: Use map header to determine lump name
if ((l = W_CheckNumForLongName(va("%sS01",G_BuildMapName(ix+1)))) == LUMPERROR)
continue;
}
#endif //#ifdef STAFFGHOSTS
okmaps[numokmaps++] = ix; okmaps[numokmaps++] = ix;
} }