TITLE SCREEN DEMOS: Pick a random Staff Attack demo!!!

Also: Fix watching a demo replay of a map with a palette not resetting your palette back to normal when you go back to the menu(/titlescreen).
This commit is contained in:
toaster 2018-11-05 13:45:40 +00:00
parent e2f57e5ca0
commit 75d08f2048
2 changed files with 54 additions and 12 deletions

View File

@ -49,7 +49,7 @@ static tic_t stoptimer;
static boolean keypressed = false;
// (no longer) De-Demo'd Title Screen
static UINT8 curDemo = 0;
static UINT8 laststaff = 0;
static UINT32 demoDelayLeft;
static UINT32 demoIdleLeft;
@ -985,8 +985,8 @@ void F_TitleScreenTicker(boolean run)
if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN)
return;
// no demos to play? or, are they disabled?
if (!cv_rollingdemos.value || !numDemos)
// are demos disabled?
if (!cv_rollingdemos.value)
return;
// Wait for a while (for the music to finish, preferably)
@ -1009,27 +1009,53 @@ void F_TitleScreenTicker(boolean run)
{
char dname[9];
lumpnum_t l;
const char *mapname;
UINT8 numstaff;
// prevent console spam if failed
demoIdleLeft = demoIdleTime;
if ((l = W_CheckNumForName("MAP01S01")) == LUMPERROR) // gotta have ONE
{
F_StartIntro();
return;
}
// Replay intro when done cycling through demos
if (curDemo == numDemos)
/*if (curDemo == numDemos) -- uuuh... we have a LOT of maps AND a big devteam... probably not gonna see a repeat unless you're super unlucky :V
{
curDemo = 0;
F_StartIntro();
return;
}*/
mapname = G_BuildMapName(G_RandMap(TOL_RACE, -2, false, false, 0, false)+1);
numstaff = 1;
while (numstaff < 100 && (l = W_CheckNumForName(va("%sS%02u",mapname,numstaff+1))) != LUMPERROR)
numstaff++;
if (laststaff && laststaff <= numstaff) // don't do the same staff member twice in a row, even if they're on different maps
{
numstaff = M_RandomKey(numstaff-1)+1;
if (numstaff >= laststaff)
numstaff++;
laststaff = numstaff;
}
else
{
numstaff = M_RandomKey(numstaff)+1;
laststaff = 0;
}
// Setup demo name
snprintf(dname, 9, "DEMO_%03u", ++curDemo);
snprintf(dname, 9, "%sS%02u", mapname, numstaff);
if ((l = W_CheckNumForName(dname)) == LUMPERROR)
/*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;
}
}*/
titledemo = true;
G_DoPlayDemo(dname);

View File

@ -3312,7 +3312,7 @@ tryagain:
|| (!dedicated && M_MapLocked(ix+1))
|| (!maphell && (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU)) // this is bad
|| ((maphell == 2) && !(mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // gasp
isokmap = false;
continue; //isokmap = false;
if (!ignorebuffer)
{
@ -3328,8 +3328,17 @@ tryagain:
}
}
if (isokmap)
okmaps[numokmaps++] = ix;
if (!isokmap)
continue;
if (pprevmap == -2) // title demos
{
lumpnum_t l;
if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(ix+1)))) == LUMPERROR)
continue;
}
okmaps[numokmaps++] = ix;
}
if (numokmaps == 0) // If there's no matches... (Goodbye, incredibly silly function chains :V)
@ -4095,8 +4104,8 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride)
}
save_p += VERSIONSIZE;
// if (demoplayback) // reset game engine
// G_StopDemo();
if (demoplayback) // reset game engine
G_StopDemo();
// paused = false;
// automapactive = false;
@ -6321,10 +6330,17 @@ void G_StopDemo(void)
Z_Free(demobuffer);
demobuffer = NULL;
demoplayback = false;
if (titledemo)
modeattacking = false;
titledemo = false;
timingdemo = false;
singletics = false;
if (gamestate == GS_LEVEL && rendermode != render_none)
{
V_SetPaletteLump("PLAYPAL"); // Reset the palette
R_ReInitColormaps(0, LUMPERROR);
}
if (gamestate == GS_INTERMISSION)
Y_EndIntermission(); // cleanup
if (gamestate == GS_VOTING)