From 8bab548d1641be5befdceceb6badb2861b1c613e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 11 Sep 2011 08:04:47 +0900 Subject: [PATCH] Make the hud type configurable via dirconf. Currently only "id", "hipnotic" and "rogue" are supported (anything else is treated as "id"). Has no effect in quakeworld (good thing too: changing gamedirs is a little broken). --- doc/dirconf.dox | 27 +++++++++++++++++---------- include/QF/quakefs.h | 1 + libs/util/quakefs.c | 27 +++++++++++++++++---------- nq/include/game.h | 2 +- nq/source/game.c | 5 ----- nq/source/sbar.c | 8 ++++---- 6 files changed, 40 insertions(+), 30 deletions(-) diff --git a/doc/dirconf.dox b/doc/dirconf.dox index 6e37df11c..fe614c2a5 100644 --- a/doc/dirconf.dox +++ b/doc/dirconf.dox @@ -16,12 +16,24 @@ Quake = { Inherit = QF; Path = "id1"; GameCode = "progs.dat"; + HudType = "id"; }; QuakeWorld = { Inherit = (Quake); Path = "qw"; SkinPath = "${path}/skins"; GameCode = "qwprogs.dat"; + HudType = "id"; +}; +"Hipnotic" = { + Inherit = (Quake); + Path = "hipnotic"; + HudType = "hipnotic"; +}; +"Rogue" = { + Inherit = (Quake); + Path = "rogue"; + HudType = "rogue"; }; "qw:qw" = { Inherit = (QuakeWorld); @@ -34,20 +46,12 @@ QuakeWorld = { Inherit = (Quake); Path = "$gamedir"; }; -"hipnotic" = { - Inherit = (Quake); - Path = "hipnotic"; -}; "hipnotic:*" = { - Inherit = (hipnotic); + Inherit = (Hipnotic); Path = "$gamedir"; }; -"rogue" = { - Inherit = (Quake); - Path = "rogue"; -}; "rogue:*" = { - Inherit = (rogue); + Inherit = (Rogue); Path = "$gamedir"; }; "abyss" = { @@ -72,6 +76,9 @@ Supported attributes are:
GameCode
The name of the mod progs file. This is relative to the mod directory
+
HudType
+
The name of the hud style. Currently, "id", "hipnotic" and + "rogue" are supported. Has no effect in quakeworld.
SkinPath
Directory to which downloaded skins will be saved. This is relative to the QuakeForge data directory, and thus the default diff --git a/include/QF/quakefs.h b/include/QF/quakefs.h index 11985c23f..e5b3ef3f3 100644 --- a/include/QF/quakefs.h +++ b/include/QF/quakefs.h @@ -57,6 +57,7 @@ typedef struct gamedir_s { const char *gamedir; ///< the actual game dir const char *path; ///< colon separated list of search paths const char *gamecode; ///< name of file to load for gamecode + const char *hudtype; ///< name of the hud type struct { const char *def; ///< directory to which to write other files const char *skins; ///< directory to which to write skins diff --git a/libs/util/quakefs.c b/libs/util/quakefs.c index c25a65fa6..d4431b80a 100644 --- a/libs/util/quakefs.c +++ b/libs/util/quakefs.c @@ -159,12 +159,24 @@ static const char *qfs_default_dirconf = " Inherit = QF;" " Path = \"id1\";" " GameCode = \"progs.dat\";" + " HudType = \"id\";" " };" " QuakeWorld = {" " Inherit = (Quake);" " Path = \"qw\";" " SkinPath = \"${path}/skins\";" " GameCode = \"qwprogs.dat\";" + " HudType = \"id\";" + " };" + " \"Hipnotic\" = {" + " Inherit = (Quake);" + " Path = \"hipnotic\";" + " HudType = \"hipnotic\";" + " };" + " \"Rogue\" = {" + " Inherit = (Quake);" + " Path = \"rogue\";" + " HudType = \"rogue\";" " };" " \"qw:qw\" = {" " Inherit = (QuakeWorld);" @@ -177,20 +189,12 @@ static const char *qfs_default_dirconf = " Inherit = (Quake);" " Path = \"$gamedir\";" " };" - " \"hipnotic\" = {" - " Inherit = (Quake);" - " Path = \"hipnotic\";" - " };" " \"hipnotic:*\" = {" - " Inherit = (hipnotic);" + " Inherit = (Hipnotic);" " Path = \"$gamedir\";" " };" - " \"rogue\" = {" - " Inherit = (Quake);" - " Path = \"rogue\";" - " };" " \"rogue:*\" = {" - " Inherit = (rogue);" + " Inherit = (Rogue);" " Path = \"$gamedir\";" " };" " \"abyss\" = {" @@ -329,6 +333,8 @@ qfs_get_gd_params (plitem_t *gdpl, gamedir_t *gamedir, dstring_t *path, } if (!gamedir->gamecode && (p = PL_ObjectForKey (gdpl, "GameCode"))) gamedir->gamecode = qfs_var_subst (PL_String (p), vars); + if (!gamedir->hudtype && (p = PL_ObjectForKey (gdpl, "HudType"))) + gamedir->hudtype = qfs_var_subst (PL_String (p), vars); if (!gamedir->dir.skins && (p = PL_ObjectForKey (gdpl, "SkinPath"))) gamedir->dir.skins = qfs_var_subst (PL_String (p), vars); if (!gamedir->dir.models && (p = PL_ObjectForKey (gdpl, "ModelPath"))) @@ -553,6 +559,7 @@ qfs_build_gamedir (const char **list) Sys_MaskPrintf (SYS_FS, " gamedir : %s\n", qfs_gamedir->gamedir); Sys_MaskPrintf (SYS_FS, " path : %s\n", qfs_gamedir->path); Sys_MaskPrintf (SYS_FS, " gamecode: %s\n", qfs_gamedir->gamecode); + Sys_MaskPrintf (SYS_FS, " hudtype : %s\n", qfs_gamedir->hudtype); Sys_MaskPrintf (SYS_FS, " def : %s\n", qfs_gamedir->dir.def); Sys_MaskPrintf (SYS_FS, " skins : %s\n", qfs_gamedir->dir.skins); Sys_MaskPrintf (SYS_FS, " models : %s\n", qfs_gamedir->dir.models); diff --git a/nq/include/game.h b/nq/include/game.h index f40aadaf8..ffa96c1e5 100644 --- a/nq/include/game.h +++ b/nq/include/game.h @@ -162,7 +162,7 @@ extern int current_skill; // skill level for currently loaded level (in case // running, this reflects the level actually in use) extern qboolean isDedicated; -extern qboolean abyss, rogue, hipnotic, standard_quake; +extern qboolean standard_quake; extern struct cvar_s *registered; const char *Game_Init (void); diff --git a/nq/source/game.c b/nq/source/game.c index db44eaef7..969583021 100644 --- a/nq/source/game.c +++ b/nq/source/game.c @@ -36,8 +36,6 @@ #include "game.h" qboolean standard_quake = false; -qboolean hipnotic, rogue, abyss; - const char * Game_Init (void) @@ -49,14 +47,11 @@ Game_Init (void) if ((i = COM_CheckParm ("-hipnotic"))) { standard_quake = false; - hipnotic = true; return "hipnotic"; } else if ((i = COM_CheckParm ("-rogue"))) { standard_quake = false; - rogue = true; return "rogue"; } else if ((i = COM_CheckParm ("-abyss"))) { - abyss = true; return "abyss"; } diff --git a/nq/source/sbar.c b/nq/source/sbar.c index 88e8b4050..a7a8a7c23 100644 --- a/nq/source/sbar.c +++ b/nq/source/sbar.c @@ -1611,10 +1611,10 @@ init_views (void) view_insert (con_module->data->console->view, stuff_view, 0); } - if (hipnotic) { + if (!strcmp (qfs_gamedir->hudtype, "hipnotic")) { init_hipnotic_sbar_views (); init_hipnotic_hud_views (); - } else if (rogue) { + } else if (!strcmp (qfs_gamedir->hudtype, "rogue")) { init_rogue_sbar_views (); init_rogue_hud_views (); } else { @@ -1723,7 +1723,7 @@ Sbar_Init (void) sb_scorebar = Draw_PicFromWad ("scorebar"); // MED 01/04/97 added new hipnotic weapons - if (hipnotic) { + if (!strcmp (qfs_gamedir->hudtype, "hipnotic")) { hsb_weapons[0][0] = Draw_PicFromWad ("inv_laser"); hsb_weapons[0][1] = Draw_PicFromWad ("inv_mjolnir"); hsb_weapons[0][2] = Draw_PicFromWad ("inv_gren_prox"); @@ -1753,7 +1753,7 @@ Sbar_Init (void) } // FIXME: MISSIONHUD - if (rogue) { + if (!strcmp (qfs_gamedir->hudtype, "rogue")) { rsb_invbar[0] = Draw_PicFromWad ("r_invbar1"); rsb_invbar[1] = Draw_PicFromWad ("r_invbar2");