Improve default starting map
Instead of defaulting to MAP01/E1M1, select the map in the first episode after parsing. This significantly improves the autostart and netgame behavior by warping to the first defined and valid level. Also adds -episode to allow more easily specifying which episode to play for mapsets that don't have simple ExMy naming conventions.
This commit is contained in:
parent
cf9a9097b9
commit
ba953b2d6d
1 changed files with 36 additions and 2 deletions
|
|
@ -317,6 +317,7 @@ const char *D_DrawIcon; // [RH] Patch name of icon to draw on next refresh
|
|||
int NoWipe; // [RH] Allow wipe? (Needs to be set each time)
|
||||
bool singletics = false; // debug flag to cancel adaptiveness
|
||||
FString startmap;
|
||||
bool setmap;
|
||||
bool autostart;
|
||||
bool advancedemo;
|
||||
FILE *debugfile;
|
||||
|
|
@ -2114,6 +2115,7 @@ static void CheckCmdLine()
|
|||
dmflags3 = flags3;
|
||||
|
||||
// get skill / episode / map from parms
|
||||
setmap = false;
|
||||
if (gameinfo.gametype != GAME_Hexen)
|
||||
{
|
||||
startmap = (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1";
|
||||
|
|
@ -2153,7 +2155,7 @@ static void CheckCmdLine()
|
|||
}
|
||||
|
||||
startmap = CalcMapName (ep, map);
|
||||
autostart = true;
|
||||
autostart = setmap = true;
|
||||
}
|
||||
|
||||
// [RH] Hack to handle +map. The standard console command line handler
|
||||
|
|
@ -2169,7 +2171,7 @@ static void CheckCmdLine()
|
|||
else
|
||||
{
|
||||
startmap = mapvalue;
|
||||
autostart = true;
|
||||
autostart = setmap = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2219,6 +2221,37 @@ static void CheckCmdLine()
|
|||
}
|
||||
}
|
||||
|
||||
// Attempt to account for wads with episodes much better when playing online. Defaulting to MAP01 is sometimes
|
||||
// a really bad idea e.g. if a hub map is the actual start area.
|
||||
static void CheckEpisodeCmd()
|
||||
{
|
||||
bool setEpisode = false;
|
||||
int episode = 0;
|
||||
auto v = Args->CheckValue("-episode");
|
||||
if (v != nullptr)
|
||||
{
|
||||
episode = atoi(v) - 1;
|
||||
if (episode < 0 || episode >= AllEpisodes.Size())
|
||||
{
|
||||
Printf("Invalid episode %s\n", v);
|
||||
episode = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEpisode = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If -warp or +map were already used, keep whatever existing value they had.
|
||||
if (!setEpisode && setmap)
|
||||
return;
|
||||
|
||||
startmap = AllEpisodes[episode].mEpisodeMap;
|
||||
setmap = true;
|
||||
if (setEpisode)
|
||||
autostart = true;
|
||||
}
|
||||
|
||||
static void NewFailure ()
|
||||
{
|
||||
I_FatalError ("Failed to allocate memory from system heap");
|
||||
|
|
@ -3288,6 +3321,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, std::vector<std::string>& allw
|
|||
// [RH] Parse through all loaded mapinfo lumps
|
||||
if (!batchrun) Printf ("G_ParseMapInfo: Load map definitions.\n");
|
||||
G_ParseMapInfo (iwad_info->MapInfo);
|
||||
CheckEpisodeCmd();
|
||||
MessageBoxClass = gameinfo.MessageBoxClass;
|
||||
endoomName = gameinfo.Endoom;
|
||||
menuBlurAmount = gameinfo.bluramount;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue