- removed the last remaining Blood helpers from the file system, also deleted a few short files whose contents could be moved.

This commit is contained in:
Christoph Oelckers 2020-07-26 23:59:29 +02:00
parent 5f14153f3b
commit 218a9c84fd
34 changed files with 75 additions and 302 deletions

View File

@ -29,7 +29,6 @@ set( PCH_SOURCES
src/blood.cpp src/blood.cpp
src/callback.cpp src/callback.cpp
src/choke.cpp src/choke.cpp
src/config.cpp
src/controls.cpp src/controls.cpp
src/credits.cpp src/credits.cpp
src/db.cpp src/db.cpp
@ -39,7 +38,6 @@ set( PCH_SOURCES
src/eventq.cpp src/eventq.cpp
src/fire.cpp src/fire.cpp
src/fx.cpp src/fx.cpp
src/gamemenu.cpp
src/gameutil.cpp src/gameutil.cpp
src/gib.cpp src/gib.cpp
src/globals.cpp src/globals.cpp

View File

@ -37,7 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "aiunicult.h" #include "aiunicult.h"
#include "blood.h" #include "blood.h"
#include "callback.h" #include "callback.h"
#include "config.h"
#include "db.h" #include "db.h"
#include "endgame.h" #include "endgame.h"
#include "eventq.h" #include "eventq.h"

View File

@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "common_game.h" #include "common_game.h"
//#include "blood.h" //#include "blood.h"
#include "view.h" #include "view.h"
#include "config.h" #include "globals.h"
#include "db.h" #include "db.h"
#include "player.h" #include "player.h"
#include "sound.h" #include "sound.h"

View File

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "db.h" #include "db.h"
#include "blood.h" #include "blood.h"
#include "choke.h" #include "choke.h"
#include "config.h"
#include "controls.h" #include "controls.h"
#include "credits.h" #include "credits.h"
#include "demo.h" #include "demo.h"
@ -436,6 +435,21 @@ int gHealthTemp[kMaxPlayers];
vec3_t startpos; vec3_t startpos;
int16_t startang, startsectnum; int16_t startang, startsectnum;
static void drawLoadingScreen(void)
{
char buffer[80];
if (gGameOptions.nGameType == 0)
{
if (gDemo.at1)
strcpy(buffer, GStrings("TXTB_LDEMO"));
else
strcpy(buffer, GStrings("TXTB_LLEVEL"));
}
else
strcpy(buffer, GStrings(FStringf("TXTB_NETGT%d", gGameOptions.nGameType)));
viewLoadingScreen(2049, buffer, levelGetTitle(), NULL);
}
void StartLevel(GAMEOPTIONS *gameOptions) void StartLevel(GAMEOPTIONS *gameOptions)
{ {
STAT_Update(0); STAT_Update(0);

View File

@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "ai.h" #include "ai.h"
#include "blood.h" #include "blood.h"
#include "callback.h" #include "callback.h"
#include "config.h"
#include "db.h" #include "db.h"
#include "dude.h" #include "dude.h"
#include "eventq.h" #include "eventq.h"

View File

@ -1,65 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT
This file is part of NBlood.
NBlood is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else!
#include "baselayer.h"
#include "common_game.h"
#include "build.h"
#include "baselayer.h"
#include "gamecontrol.h"
#include "blood.h"
#include "config.h"
#include "globals.h"
#include "screen.h"
#include "sound.h"
#include "view.h"
// we load this in to get default button and key assignments
// as well as setting up function mappings
BEGIN_BLD_NS
int32_t gTurnSpeed = 92;
int32_t gDetail = 4;
int32_t cl_weaponswitch;
int32_t gFollowMap = 1;
int32_t gOverlayMap = 0;
int32_t gRotateMap = 0;
int32_t gMessageCount = 4;
int32_t gMessageTime = 5;
int32_t gMessageFont = 0;
int32_t gMouseSensitivity;
bool gNoClip;
bool gInfiniteAmmo;
int32_t gDeliriumBlur = 1;
//////////
int gWeaponsV10x;
/////////
END_BLD_NS

View File

@ -1,53 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT
This file is part of NBlood.
NBlood is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#ifndef config_public_h_
#define config_public_h_
#include "gamecvars.h"
#include "gamecontrol.h"
BEGIN_BLD_NS
#define MAXPLAYERNAME 16
extern int32_t gTurnSpeed;
extern int32_t gDetail;
extern int32_t gFollowMap;
extern int32_t gOverlayMap;
extern int32_t gRotateMap;
extern int32_t gMessageCount;
extern int32_t gMessageTime;
extern int32_t gMessageFont;
extern int32_t gMouseSensitivity;
extern bool gNoClip;
extern bool gInfiniteAmmo;
extern int32_t gDeliriumBlur;
///////
extern int gWeaponsV10x;
//////
END_BLD_NS
#endif

View File

@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecontrol.h" #include "gamecontrol.h"
#include "common_game.h" #include "common_game.h"
#include "blood.h" #include "blood.h"
#include "config.h"
#include "controls.h" #include "controls.h"
#include "globals.h" #include "globals.h"
#include "levels.h" #include "levels.h"

View File

@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "SmackerDecoder.h" #include "SmackerDecoder.h"
#include "common_game.h" #include "common_game.h"
#include "blood.h" #include "blood.h"
#include "config.h"
#include "controls.h" #include "controls.h"
#include "globals.h" #include "globals.h"
#include "screen.h" #include "screen.h"

View File

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h" #include "compat.h"
#include "common_game.h" #include "common_game.h"
#include "blood.h" #include "blood.h"
#include "config.h"
#include "globals.h" #include "globals.h"
#include "inifile.h" #include "inifile.h"
#include "levels.h" #include "levels.h"

View File

@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "actor.h" #include "actor.h"
#include "blood.h" #include "blood.h"
#include "callback.h" #include "callback.h"
#include "config.h" #include "globals.h"
#include "db.h" #include "db.h"
#include "eventq.h" #include "eventq.h"
#include "fx.h" #include "fx.h"

View File

@ -1,59 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT
This file is part of NBlood.
NBlood is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else!
#include "build.h"
#include "compat.h"
#include "common_game.h"
#include "blood.h"
#include "config.h"
#include "globals.h"
#include "inifile.h"
#include "levels.h"
#include "qav.h"
#include "demo.h"
#include "view.h"
#include "c_bind.h"
#include "gstrings.h"
BEGIN_BLD_NS
void drawLoadingScreen(void)
{
char buffer[80];
if (gGameOptions.nGameType == 0)
{
if (gDemo.at1)
strcpy(buffer, GStrings("TXTB_LDEMO"));
else
strcpy(buffer, GStrings("TXTB_LLEVEL"));
}
else
strcpy(buffer, GStrings(FStringf("TXTB_NETGT%d", gGameOptions.nGameType)));
viewLoadingScreen(2049, buffer, levelGetTitle(), NULL);
}
END_BLD_NS

View File

@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "blood.h" #include "blood.h"
#include "db.h" #include "db.h"
#include "callback.h" #include "callback.h"
#include "config.h" #include "globals.h"
#include "eventq.h" #include "eventq.h"
#include "fx.h" #include "fx.h"
#include "gib.h" #include "gib.h"

View File

@ -42,6 +42,20 @@ int gFrameRate;
static const char *_module; static const char *_module;
static int _line; static int _line;
int32_t gTurnSpeed = 92;
int32_t gDetail = 4;
int32_t gFollowMap = 1;
int32_t gOverlayMap = 0;
int32_t gRotateMap = 0;
bool gNoClip;
bool gInfiniteAmmo;
int32_t gDeliriumBlur = 1;
//////////
int gWeaponsV10x;
/////////
void _SetErrorLoc(const char *pzFile, int nLine) void _SetErrorLoc(const char *pzFile, int nLine)
{ {
_module = pzFile; _module = pzFile;

View File

@ -25,6 +25,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "build.h" #include "build.h"
#include "version.h" #include "version.h"
#include "filesystem.h" #include "filesystem.h"
#include "gamecvars.h"
#include "gamecontrol.h"
BEGIN_BLD_NS BEGIN_BLD_NS
@ -35,4 +37,19 @@ extern int gFrame;
extern int gFrameRate; extern int gFrameRate;
extern bool bVanilla; extern bool bVanilla;
#define MAXPLAYERNAME 16
extern int32_t gTurnSpeed;
extern int32_t gDetail;
extern int32_t gFollowMap;
extern int32_t gOverlayMap;
extern int32_t gRotateMap;
extern bool gNoClip;
extern bool gInfiniteAmmo;
extern int32_t gDeliriumBlur;
///////
extern int gWeaponsV10x;
//////
END_BLD_NS END_BLD_NS

View File

@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "common_game.h" #include "common_game.h"
#include "blood.h" #include "blood.h"
#include "config.h" #include "globals.h"
#include "credits.h" #include "credits.h"
#include "endgame.h" #include "endgame.h"
#include "inifile.h" #include "inifile.h"

View File

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h" #include "compat.h"
#include "mmulti.h" #include "mmulti.h"
#include "common_game.h" #include "common_game.h"
#include "config.h"
#include "ai.h" #include "ai.h"
#include "blood.h" #include "blood.h"
#include "demo.h" #include "demo.h"

View File

@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecontrol.h" #include "gamecontrol.h"
#include "common_game.h" #include "common_game.h"
#include "blood.h" #include "blood.h"
#include "config.h"
#include "demo.h" #include "demo.h"
#include "eventq.h" #include "eventq.h"
#include "globals.h" #include "globals.h"

View File

@ -35,7 +35,6 @@ void ChangeExtension(char *pzFile, const char *pzExt);
void SplitPath(const char *pzPath, char *pzDirectory, char *pzFile, char *pzType); void SplitPath(const char *pzPath, char *pzDirectory, char *pzFile, char *pzType);
void FireInit(void); void FireInit(void);
void FireProcess(void); void FireProcess(void);
void drawLoadingScreen(void);
void UpdateNetworkMenus(void); void UpdateNetworkMenus(void);
void InitMirrors(void); void InitMirrors(void);
void sub_5571C(char mode); void sub_5571C(char mode);

View File

@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mmulti.h" #include "mmulti.h"
#include "pragmas.h" #include "pragmas.h"
#include "compat.h" #include "compat.h"
#include "config.h"
#include "controls.h" #include "controls.h"
#include "globals.h" #include "globals.h"
#include "network.h" #include "network.h"

View File

@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h" #include "compat.h"
#include "mmulti.h" #include "mmulti.h"
#include "common_game.h" #include "common_game.h"
#include "config.h"
#include "blood.h" #include "blood.h"
#include "demo.h" #include "demo.h"
#include "globals.h" #include "globals.h"
@ -49,20 +48,19 @@ static int osdcmd_map(CCmdFuncPtr parm)
if (parm->numparms != 1) if (parm->numparms != 1)
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
char filename[BMAX_PATH]; FString mapname = parm->parms[0];
FString mapfilename = mapname;
DefaultExtension(mapfilename, ".map");
strcpy(filename, parm->parms[0]); if (!fileSystem.FindFile(mapfilename))
ChangeExtension(filename, "");
if (!fileSystem.Lookup(filename, "MAP"))
{ {
Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", filename); Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapfilename);
return CCMD_OK; return CCMD_OK;
} }
for (int i = 0; i < 512; i++) for (int i = 0; i < 512; i++)
{ {
if (mapList[i].labelName.CompareNoCase(filename) == 0) if (mapList[i].labelName.CompareNoCase(mapname) == 0)
{ {
int e = i / kMaxLevels; int e = i / kMaxLevels;
int m = i % kMaxLevels; int m = i % kMaxLevels;
@ -75,7 +73,7 @@ static int osdcmd_map(CCmdFuncPtr parm)
if (gDemo.at1) if (gDemo.at1)
gDemo.StopPlayback(); gDemo.StopPlayback();
levelAddUserMap(filename); levelAddUserMap(mapname);
if (numplayers > 1) if (numplayers > 1)
{ {

View File

@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "actor.h" #include "actor.h"
#include "blood.h" #include "blood.h"
#include "callback.h" #include "callback.h"
#include "config.h"
#include "controls.h" #include "controls.h"
#include "demo.h" #include "demo.h"
#include "eventq.h" #include "eventq.h"

View File

@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "build.h" #include "build.h"
#include "common_game.h" #include "common_game.h"
#include "compat.h" #include "compat.h"
#include "config.h" #include "globals.h"
#include "controls.h" #include "controls.h"
#include "db.h" #include "db.h"
#include "dude.h" #include "dude.h"

View File

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "common_game.h" #include "common_game.h"
#include "globals.h" #include "globals.h"
#include "config.h"
#include "screen.h" #include "screen.h"
#include "v_video.h" #include "v_video.h"

View File

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h" #include "compat.h"
#include "common_game.h" #include "common_game.h"
#include "config.h"
#include "gameutil.h" #include "gameutil.h"
#include "player.h" #include "player.h"
#include "sound.h" #include "sound.h"

View File

@ -25,12 +25,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "build.h" #include "build.h"
#include "compat.h" #include "compat.h"
#include "common_game.h" #include "common_game.h"
#include "config.h"
#include "levels.h" #include "levels.h"
#include "sound.h" #include "sound.h"
#include "baselayer.h" #include "baselayer.h"
#include "raze_music.h" #include "raze_music.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "gamecontrol.h"
BEGIN_BLD_NS BEGIN_BLD_NS

View File

@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "common_game.h" #include "common_game.h"
#include "blood.h" #include "blood.h"
#include "config.h"
#include "globals.h" #include "globals.h"
#include "view.h" #include "view.h"

View File

@ -34,7 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "aistate.h" #include "aistate.h"
#include "blood.h" #include "blood.h"
#include "choke.h" #include "choke.h"
#include "config.h"
#include "db.h" #include "db.h"
#include "endgame.h" #include "endgame.h"
#include "gameutil.h" #include "gameutil.h"
@ -1834,15 +1833,10 @@ void viewInit(void)
memset(data, TRANSPARENT_INDEX, kLensSize*kLensSize); memset(data, TRANSPARENT_INDEX, kLensSize*kLensSize);
gGameMessageMgr.SetState(hud_messages); gGameMessageMgr.SetState(hud_messages);
gGameMessageMgr.SetCoordinates(1, 1); gGameMessageMgr.SetCoordinates(1, 1);
char nFont;
if (gMessageFont == 0)
nFont = 3;
else
nFont = 0;
gGameMessageMgr.SetFont(nFont); gGameMessageMgr.SetFont(3);
gGameMessageMgr.SetMaxMessages(gMessageCount); gGameMessageMgr.SetMaxMessages(4);
gGameMessageMgr.SetMessageTime(gMessageTime); gGameMessageMgr.SetMessageTime(5);
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {

View File

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "blood.h" #include "blood.h"
#include "db.h" #include "db.h"
#include "callback.h" #include "callback.h"
#include "config.h"
#include "eventq.h" #include "eventq.h"
#include "fx.h" #include "fx.h"
#include "gameutil.h" #include "gameutil.h"

View File

@ -1629,73 +1629,8 @@ static void PrintLastError ()
// //
//========================================================================== //==========================================================================
FResourceLump *FileSystem::Lookup(const char *name, const char *type)
{
FStringf fname("%s.%s", name, type);
auto lump = FindFile(fname);
if (lump >= 0) return FileInfo[lump].lump;
else return nullptr;
}
FResourceLump* FileSystem::GetFileAt(int no) FResourceLump* FileSystem::GetFileAt(int no)
{ {
return FileInfo[no].lump; return FileInfo[no].lump;
} }
//==========================================================================
//
// Stand-ins for Blood's resource class
//
//==========================================================================
const void *FileSystem::Lock(int lump)
{
if ((size_t)lump >= FileInfo.Size()) return nullptr;
auto lumpp = FileInfo[lump].lump;
return lumpp->Lock();
}
void FileSystem::Unlock(int lump)
{
if ((size_t)lump >= FileInfo.Size()) return;
auto lumpp = FileInfo[lump].lump;
lumpp->Unlock();
}
const void *FileSystem::Get(int lump)
{
if ((size_t)lump >= FileInfo.Size()) return nullptr;
auto lumpp = FileInfo[lump].lump;
auto p = lumpp->Lock();
lumpp->RefCount = INT_MAX/2; // lock forever.
return p;
}
//==========================================================================
//
// Stand-ins for Blood's resource class
//
//==========================================================================
const void *FileSystem::Lock(FResourceLump *lump)
{
if (lump) return lump->Lock();
else return nullptr;
}
void FileSystem::Unlock(FResourceLump *lump)
{
if (lump) lump->Unlock();
}
const void *FileSystem::Load(FResourceLump *lump)
{
if (lump)
{
auto p = lump->Lock();
lump->RefCount = INT_MAX/2; // lock forever.
return p;
}
else return nullptr;
}

View File

@ -187,19 +187,8 @@ public:
int AddFromBuffer(const char* name, const char* type, char* data, int size, int id, int flags); int AddFromBuffer(const char* name, const char* type, char* data, int size, int id, int flags);
FileReader* GetFileReader(int wadnum); // Gets a FileReader object to the entire WAD FileReader* GetFileReader(int wadnum); // Gets a FileReader object to the entire WAD
void InitHashChains(); void InitHashChains();
// Blood stuff
FResourceLump* Lookup(const char* name, const char* type);
FResourceLump* GetFileAt(int no); FResourceLump* GetFileAt(int no);
const void* Lock(int lump);
void Unlock(int lump);
const void* Get(int lump);
static const void* Lock(FResourceLump* lump);
static void Unlock(FResourceLump* lump);
static const void* Load(FResourceLump* lump);;
protected: protected:
struct LumpRecord; struct LumpRecord;

View File

@ -68,10 +68,12 @@ static int osdcmd_map(CCmdFuncPtr parm)
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
} }
FString mapname = parm->parms[0]; FString mapname = parm->parms[0];
FString mapfilename = mapname;
DefaultExtension(mapfilename, ".map");
if (!fileSystem.Lookup(mapname, "MAP")) if (!fileSystem.FindFile(mapfilename))
{ {
Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars()); Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapfilename.GetChars());
return CCMD_OK; return CCMD_OK;
} }

View File

@ -90,8 +90,10 @@ static int ccmd_map(CCmdFuncPtr parm)
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
} }
FString mapname = parm->parms[0]; FString mapname = parm->parms[0];
FString mapfilename = mapname;
DefaultExtension(mapfilename, ".map");
if (!fileSystem.Lookup(mapname, "MAP")) if (!fileSystem.FindFile(mapfilename))
{ {
Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars()); Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars());
return CCMD_OK; return CCMD_OK;
@ -106,9 +108,8 @@ static int ccmd_map(CCmdFuncPtr parm)
Printf(TEXTCOLOR_RED "Cannot use user maps in shareware.\n"); Printf(TEXTCOLOR_RED "Cannot use user maps in shareware.\n");
return CCMD_OK; return CCMD_OK;
} }
DefaultExtension(mapname, ".map"); if (mapfilename[0] != '/') mapfilename.Insert(0, "/");
if (mapname[0] != '/') mapname.Insert(0, "/"); map = SetupUserMap(mapfilename, !isRR() ? "dethtoll.mid" : nullptr);
map = SetupUserMap(mapname, !isRR() ? "dethtoll.mid" : nullptr);
} }
if (numplayers > 1) if (numplayers > 1)
{ {

View File

@ -61,10 +61,12 @@ static int osdcmd_map(CCmdFuncPtr parm)
return CCMD_SHOWHELP; return CCMD_SHOWHELP;
} }
FString mapname = parm->parms[0]; FString mapname = parm->parms[0];
FString mapfilename = mapname;
DefaultExtension(mapfilename, ".map");
if (!fileSystem.Lookup(mapname, "MAP")) if (!fileSystem.FindFile(mapfilename))
{ {
Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapname.GetChars()); Printf(TEXTCOLOR_RED "map: file \"%s\" not found.\n", mapfilename.GetChars());
return CCMD_OK; return CCMD_OK;
} }