From db2cde0325c081566aa5b870389fb2876fb352f2 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Fri, 4 Aug 2017 09:20:44 +0200 Subject: [PATCH] Remove disgusting and broken Developer_searchpath() function. It's mush better and safer to query the "game" cvar instead. It's always set to the mods name and get's the baseq2 special case right. --- src/client/cl_entities.c | 9 +++++---- src/common/filesystem.c | 24 +----------------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/client/cl_entities.c b/src/client/cl_entities.c index 69da83e7..724c3f4f 100644 --- a/src/client/cl_entities.c +++ b/src/client/cl_entities.c @@ -93,8 +93,6 @@ S_RegisterSexedModel(entity_state_t *ent, char *base) return md2; } -extern int Developer_searchpath(int who); - void CL_AddPacketEntities(frame_t *frame) { @@ -108,6 +106,9 @@ CL_AddPacketEntities(frame_t *frame) clientinfo_t *ci; unsigned int effects, renderfx; + /* To distinguish baseq2, xatrix and rogue. */ + cvar_t *game = Cvar_Get("game", "", CVAR_LATCH | CVAR_SERVERINFO); + /* bonus items rotate at a fixed rate */ autorotate = anglemod(cl.time * 0.1f); @@ -377,7 +378,7 @@ CL_AddPacketEntities(frame_t *frame) something special */ if (renderfx & RF_SHELL_HALF_DAM) { - if (Developer_searchpath(2) == 2) + if (strcmp(game->string, "rogue") == 0) { /* ditch the half damage shell if any of red, blue, or double are on */ if (renderfx & (RF_SHELL_RED | RF_SHELL_BLUE | RF_SHELL_DOUBLE)) @@ -389,7 +390,7 @@ CL_AddPacketEntities(frame_t *frame) if (renderfx & RF_SHELL_DOUBLE) { - if (Developer_searchpath(2) == 2) + if (strcmp(game->string, "rogue") == 0) { /* lose the yellow shell if we have a red, blue, or green shell */ if (renderfx & (RF_SHELL_RED | RF_SHELL_BLUE | RF_SHELL_GREEN)) diff --git a/src/common/filesystem.c b/src/common/filesystem.c index 94673cb4..6466e2ee 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -330,28 +330,6 @@ FS_FCloseFile(fileHandle_t f) memset(handle, 0, sizeof(*handle)); } -int -Developer_searchpath(int who) -{ - fsSearchPath_t *search; - - // TODO: Distinguish baseq from mods. - for (search = fs_searchPaths; search; search = search->next) - { - if (strstr(search->path, "xatrix")) - { - return 1; - } - - if (strstr(search->path, "rogue")) - { - return 2; - } - } - - return 0; -} - /* * Finds the file in the search path. Returns filesize and an open FILE *. Used * for streaming data out of either a pak file or a seperate file. @@ -387,7 +365,7 @@ FS_FOpenFile(const char *name, fileHandle_t *f, qboolean gamedir_only) // Evil hack for maps.lst and players/ // TODO: A flag to ignore paks would be better - if ((Developer_searchpath(0) == 0) && search->pack) { + if ((strcmp(fs_gamedirvar->string, "") == 0) && search->pack) { if ((strcmp(name, "maps.lst") == 0)|| (strncmp(name, "players/", 8) == 0)) { continue; }