- streamlined and fixed game startup with '-map' option.

* Blood: Initialize global pointers in app_init so that they are not NULL.
* consider Mapinfo data when checking for a given level name.
* removed redundant level name output.
This commit is contained in:
Christoph Oelckers 2021-06-26 10:11:50 +02:00
parent 63bc36e3c4
commit 0f7d3d0cbb
2 changed files with 9 additions and 8 deletions

View file

@ -454,19 +454,18 @@ void UserConfig::ProcessOptions()
void CheckUserMap() void CheckUserMap()
{ {
if (userConfig.CommandMap.IsEmpty()) return; if (userConfig.CommandMap.IsEmpty()) return;
if (FindMapByName(userConfig.CommandMap))
{
return; // we already got a record for this map so no need for further checks.
}
FString startupMap = userConfig.CommandMap; FString startupMap = userConfig.CommandMap;
if (startupMap.IndexOfAny("/\\") < 0) startupMap.Insert(0, "/");
DefaultExtension(startupMap, ".map"); DefaultExtension(startupMap, ".map");
startupMap.Substitute("\\", "/"); startupMap.Substitute("\\", "/");
NormalizeFileName(startupMap); NormalizeFileName(startupMap);
if (fileSystem.FileExists(startupMap)) if (!fileSystem.FileExists(startupMap))
{ {
Printf("Using level: \"%s\".\n", startupMap.GetChars()); Printf(PRINT_HIGH, "Level \"%s\" not found.\n", startupMap.GetChars());
}
else
{
Printf("Level \"%s\" not found.\n", startupMap.GetChars());
startupMap = ""; startupMap = "";
} }
userConfig.CommandMap = startupMap; userConfig.CommandMap = startupMap;

View file

@ -453,11 +453,13 @@ void GameInterface::app_init()
UpdateDacs(0, true); UpdateDacs(0, true);
enginecompatibility_mode = ENGINECOMPATIBILITY_19960925; enginecompatibility_mode = ENGINECOMPATIBILITY_19960925;
gViewIndex = myconnectindex;
gMe = gView = &gPlayer[myconnectindex];
} }
static void gameInit() static void gameInit()
{ {
//RESTART:
gViewIndex = myconnectindex; gViewIndex = myconnectindex;
gMe = gView = &gPlayer[myconnectindex]; gMe = gView = &gPlayer[myconnectindex];