Demowarp (#85)

* implement a demo warp feature

* some adjustments
This commit is contained in:
Fabian Greffrath 2020-03-29 18:15:51 +02:00 committed by GitHub
parent 1486a7e310
commit ae5a01ad40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 1 deletions

View File

@ -1449,6 +1449,9 @@ static void D_ProcessDehInWad(int i)
#define D_ProcessDehInWads() D_ProcessDehInWad(lumpinfo[W_LumpNameHash \
("dehacked") % (unsigned) numlumps].index);
// [FG] fast-forward demo to the desired map
int demowarp = 0;
//
// D_DoomMain
//
@ -1700,6 +1703,8 @@ void D_DoomMain(void)
startmap = atoi(myargv[p+1]);
autostart = true;
}
// [FG] fast-forward demo to the desired map
demowarp = startmap;
}
//jff 1/22/98 add command line parms to disable sound and music
@ -1855,6 +1860,9 @@ void D_DoomMain(void)
G_DeferedPlayDemo(myargv[p]);
singledemo = true; // quit after one demo
}
else
// [FG] no demo playback
demowarp = 0;
if (slot && ++slot < myargc)
{

View File

@ -223,6 +223,8 @@ extern boolean singledemo;
extern boolean timingdemo;
// Run tick clock at fastest speed possible while playing demo. killough
extern boolean fastdemo;
// [FG] fast-forward demo to the desired map
extern int demowarp;
extern gamestate_t gamestate;

View File

@ -2451,6 +2451,12 @@ void G_DeferedPlayDemo(char* name)
{
defdemoname = name;
gameaction = ga_playdemo;
// [FG] fast-forward demo to the desired map
if (demowarp)
{
I_EnableWarp(true);
}
}
//===================

View File

@ -213,6 +213,7 @@ void I_InitKeyboard(void)
SDL_SetModState(KMOD_NONE);
}
extern boolean nomusicparm, nosfxparm;
void I_Init(void)
{
@ -247,12 +248,42 @@ void I_Init(void)
// killough 2/21/98: avoid sound initialization if no sound & no music
{
extern boolean nomusicparm, nosfxparm;
if(!(nomusicparm && nosfxparm))
I_InitSound();
}
}
// [FG] toggle demo warp mode
void I_EnableWarp (boolean warp)
{
static int (*I_GetTime_old)() = I_GetTime_Error;
static boolean nodrawers_old, noblit_old;
static boolean nomusicparm_old, nosfxparm_old;
if (warp)
{
I_GetTime_old = I_GetTime;
nodrawers_old = nodrawers;
noblit_old = noblit;
nomusicparm_old = nomusicparm;
nosfxparm_old = nosfxparm;
I_GetTime = I_GetTime_FastDemo;
nodrawers = true;
noblit = true;
nomusicparm = true;
nosfxparm = true;
}
else
{
I_GetTime = I_GetTime_old;
nodrawers = nodrawers_old;
noblit = noblit_old;
nomusicparm = nomusicparm_old;
nosfxparm = nosfxparm_old;
}
}
int waitAtExit;
//

View File

@ -44,6 +44,9 @@ int I_GetTime_RealTime(); // killough
int I_GetTime_Adaptive(void); // killough 4/10/98
extern int GetTime_Scale;
// [FG] toggle demo warp mode
extern void I_EnableWarp (boolean warp);
//
// Called by D_DoomLoop,
// called before processing any tics in a frame

View File

@ -1029,6 +1029,13 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
// Initial height of PointOfView will be set by player think.
players[consoleplayer].viewz = 1;
// [FG] fast-forward demo to the desired map
if (demowarp == map)
{
I_EnableWarp(false);
demowarp = 0;
}
// Make sure all sounds are stopped before Z_FreeTags.
S_Start();