implement G_GetCurrentComplevelName function (#668)

* implement G_GetCurrentComplevelName function

* move gameversions to doomstat.h

* include GNUInstallDirs

* fix cmake doc dir
This commit is contained in:
Roman Fomin 2022-07-18 22:23:43 +07:00 committed by GitHub
parent 000bcd5e72
commit 54cd8b9ca9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 29 deletions

View File

@ -1,3 +1,4 @@
include(GNUInstallDirs)
if(Python3_EXECUTABLE)
add_custom_target(paramsgen
@ -13,7 +14,7 @@ install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/WoofInstall.cmake")
if(WIN32)
install(FILES CMDLINE.txt DESTINATION .)
elseif(UNIX AND NOT APPLE)
install(FILES CMDLINE.txt DESTINATION "share/doc/${PROJECT_SHORTNAME}")
install(FILES CMDLINE.txt DESTINATION "${CMAKE_INSTALL_DOCDIR}/${PROJECT_SHORTNAME}")
install(FILES "${PROJECT_SHORTNAME}.6" DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)
install(FILES "${PROJECT_SHORTNAME}-setup.6" DESTINATION ${CMAKE_INSTALL_MANDIR}/man6)
install(FILES "bash-completion/${PROJECT_SHORTNAME}"

View File

@ -1069,19 +1069,6 @@ void IdentifyVersion (void)
// [FG] emulate a specific version of Doom
static struct
{
const char *description;
const char *cmdline;
GameVersion_t version;
} gameversions[] = {
{"Doom 1.9", "1.9", exe_doom_1_9},
{"Ultimate Doom", "ultimate", exe_ultimate},
{"Final Doom", "final", exe_final},
{"Chex Quest", "chex", exe_chex},
{ NULL, NULL, 0},
};
static void InitGameVersion(void)
{
int i, p;
@ -1154,11 +1141,6 @@ static void InitGameVersion(void)
}
}
const char* GetGameVersionCmdline(void)
{
return gameversions[gameversion].cmdline;
}
// killough 5/3/98: old code removed
//

View File

@ -34,6 +34,14 @@ GameMission_t gamemission = doom;
// [FG] emulate a specific version of Doom
GameVersion_t gameversion = exe_doom_1_9;
GameVersions_t gameversions[] = {
{"Doom 1.9", "1.9", exe_doom_1_9},
{"Ultimate Doom", "ultimate", exe_ultimate},
{"Final Doom", "final", exe_final},
{"Chex Quest", "chex", exe_chex},
{ NULL, NULL, 0},
};
// Language.
Language_t language = english;

View File

@ -66,6 +66,15 @@ extern GameMission_t gamemission;
// [FG] emulate a specific version of Doom
extern GameVersion_t gameversion;
typedef struct
{
const char *description;
const char *cmdline;
GameVersion_t version;
} GameVersions_t;
extern GameVersions_t gameversions[];
extern char *MAPNAME(int e, int m);
// Set if homebrew PWAD stuff has been added.

View File

@ -1576,12 +1576,7 @@ static void G_DoPlayDemo(void)
// [FG] report compatibility mode
fprintf(stderr, "G_DoPlayDemo: Playing demo with %s (%d) compatibility.\n",
mbf21 ? "MBF21" :
demover >= 203 ? "MBF" :
demover >= 200 ? (compatibility ? "Boom compatibility" : "Boom") :
gameversion == exe_final ? "Final Doom" :
gameversion == exe_ultimate ? "Ultimate Doom" :
"Doom 1.9", demover);
G_GetCurrentComplevelName(), demover);
}
#define VERSIONSIZE 16
@ -2616,6 +2611,23 @@ static int G_GetDefaultComplevel()
}
}
const char *G_GetCurrentComplevelName(void)
{
switch (demo_version)
{
case 109:
return gameversions[gameversion].description;
case 202:
return "Boom";
case 203:
return "MBF";
case 221:
return "MBF21";
default:
return "Unknown";
}
}
static int G_GetWadComplevel(void)
{
int lumpnum;
@ -3523,7 +3535,6 @@ void G_DeferedPlayDemo(char* name)
}
#define DEMO_FOOTER_SEPARATOR "\n"
extern const char* GetGameVersionCmdline(void);
extern char **dehfiles;
static void G_AddDemoFooter(void)
@ -3564,7 +3575,7 @@ static void G_AddDemoFooter(void)
if (demo_compatibility)
{
mem_fputs(" -complevel vanilla", stream);
tmp = M_StringJoin(" -gameversion ", GetGameVersionCmdline(), NULL);
tmp = M_StringJoin(" -gameversion ", gameversions[gameversion].cmdline, NULL);
mem_fputs(tmp, stream);
free(tmp);
}

View File

@ -72,6 +72,8 @@ int G_ValidateMapName(const char *mapname, int *pEpi, int *pMap);
void G_EnableWarp(boolean warp);
const char *G_GetCurrentComplevelName(void);
extern int default_complevel;
// killough 5/2/98: moved from m_misc.c:

View File

@ -1635,14 +1635,15 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
// [FG] log level setup
{
fprintf(stderr, "P_SetupLevel: %.8s (%s), %s%s%s\n",
fprintf(stderr, "P_SetupLevel: %.8s (%s), %s%s%s, %s compatibility\n",
lumpname, W_WadNameForLump(lumpnum),
mapformat == MFMT_ZDBSPX ? "ZDBSP nodes" :
mapformat == MFMT_ZDBSPZ ? "compressed ZDBSP nodes" :
mapformat == MFMT_DEEPBSP ? "DeepBSP nodes" :
"Doom nodes",
gen_blockmap ? " + generated Blockmap" : "",
pad_reject ? " + padded Reject table" : "");
pad_reject ? " + padded Reject table" : "",
G_GetCurrentComplevelName());
}
}