Add handling for +warp at the command line.

- Command-line console commands are executed before a level is entered, so
  trying to use +warp to position yourself at a specific location will not
  work. We now specially handle this command so that it does work.
This commit is contained in:
Randy Heit 2013-10-09 22:11:33 -05:00
parent c2bac9d2df
commit 637798c1b5
3 changed files with 17 additions and 2 deletions

View file

@ -626,10 +626,17 @@ void C_DoCommand (const char *cmd, int keynum)
com->Run (args, players[consoleplayer].mo, keynum); com->Run (args, players[consoleplayer].mo, keynum);
} }
else else
{
if (len == 4 && strnicmp(beg, "warp", 4) == 0)
{
StoredWarp = beg;
}
else
{ {
new DStoredCommand (com, beg); new DStoredCommand (com, beg);
} }
} }
}
else else
{ // Check for any console vars that match the command { // Check for any console vars that match the command
FBaseCVar *var = FindCVarSub (beg, int(len)); FBaseCVar *var = FindCVarSub (beg, int(len));

View file

@ -218,6 +218,7 @@ int NoWipe; // [RH] Allow wipe? (Needs to be set each time)
bool singletics = false; // debug flag to cancel adaptiveness bool singletics = false; // debug flag to cancel adaptiveness
FString startmap; FString startmap;
bool autostart; bool autostart;
FString StoredWarp;
bool advancedemo; bool advancedemo;
FILE *debugfile; FILE *debugfile;
event_t events[MAXEVENTS]; event_t events[MAXEVENTS];
@ -2081,7 +2082,7 @@ static void CheckCmdLine()
{ {
startmap = "&wt@01"; startmap = "&wt@01";
} }
autostart = false; autostart = StoredWarp.IsNotEmpty();
const char *val = Args->CheckValue ("-skill"); const char *val = Args->CheckValue ("-skill");
if (val) if (val)
@ -2529,6 +2530,11 @@ void D_DoomMain (void)
if (demorecording) if (demorecording)
G_BeginRecording (startmap); G_BeginRecording (startmap);
G_InitNew (startmap, false); G_InitNew (startmap, false);
if (StoredWarp.IsNotEmpty())
{
AddCommandString(StoredWarp.LockBuffer());
StoredWarp = NULL;
}
} }
else else
{ {

View file

@ -59,6 +59,8 @@ extern FString startmap; // [RH] Actual map name now
extern bool autostart; extern bool autostart;
extern FString StoredWarp; // [RH] +warp at the command line
// Selected by user. // Selected by user.
EXTERN_CVAR (Int, gameskill); EXTERN_CVAR (Int, gameskill);
extern int NextSkill; // [RH] Skill to use at next level load extern int NextSkill; // [RH] Skill to use at next level load