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).
This commit is contained in:
Bill Currie 2011-09-11 08:04:47 +09:00
parent b9401fe7c6
commit 8bab548d16
6 changed files with 40 additions and 30 deletions

View file

@ -16,12 +16,24 @@ Quake = {
Inherit = QF; Inherit = QF;
Path = "id1"; Path = "id1";
GameCode = "progs.dat"; GameCode = "progs.dat";
HudType = "id";
}; };
QuakeWorld = { QuakeWorld = {
Inherit = (Quake); Inherit = (Quake);
Path = "qw"; Path = "qw";
SkinPath = "${path}/skins"; SkinPath = "${path}/skins";
GameCode = "qwprogs.dat"; GameCode = "qwprogs.dat";
HudType = "id";
};
"Hipnotic" = {
Inherit = (Quake);
Path = "hipnotic";
HudType = "hipnotic";
};
"Rogue" = {
Inherit = (Quake);
Path = "rogue";
HudType = "rogue";
}; };
"qw:qw" = { "qw:qw" = {
Inherit = (QuakeWorld); Inherit = (QuakeWorld);
@ -34,20 +46,12 @@ QuakeWorld = {
Inherit = (Quake); Inherit = (Quake);
Path = "$gamedir"; Path = "$gamedir";
}; };
"hipnotic" = {
Inherit = (Quake);
Path = "hipnotic";
};
"hipnotic:*" = { "hipnotic:*" = {
Inherit = (hipnotic); Inherit = (Hipnotic);
Path = "$gamedir"; Path = "$gamedir";
}; };
"rogue" = {
Inherit = (Quake);
Path = "rogue";
};
"rogue:*" = { "rogue:*" = {
Inherit = (rogue); Inherit = (Rogue);
Path = "$gamedir"; Path = "$gamedir";
}; };
"abyss" = { "abyss" = {
@ -72,6 +76,9 @@ Supported attributes are:
<dt><code>GameCode</code></dt> <dt><code>GameCode</code></dt>
<dd>The name of the mod progs file. This is relative to the mod <dd>The name of the mod progs file. This is relative to the mod
directory</dd> directory</dd>
<dt><code>HudType</code></dt>
<dd>The name of the hud style. Currently, "id", "hipnotic" and
"rogue" are supported. Has no effect in quakeworld.</dd>
<dt><code>SkinPath</code></dt> <dt><code>SkinPath</code></dt>
<dd>Directory to which downloaded skins will be saved. This is <dd>Directory to which downloaded skins will be saved. This is
relative to the QuakeForge data directory, and thus the default relative to the QuakeForge data directory, and thus the default

View file

@ -57,6 +57,7 @@ typedef struct gamedir_s {
const char *gamedir; ///< the actual game dir const char *gamedir; ///< the actual game dir
const char *path; ///< colon separated list of search paths const char *path; ///< colon separated list of search paths
const char *gamecode; ///< name of file to load for gamecode const char *gamecode; ///< name of file to load for gamecode
const char *hudtype; ///< name of the hud type
struct { struct {
const char *def; ///< directory to which to write other files const char *def; ///< directory to which to write other files
const char *skins; ///< directory to which to write skins const char *skins; ///< directory to which to write skins

View file

@ -159,12 +159,24 @@ static const char *qfs_default_dirconf =
" Inherit = QF;" " Inherit = QF;"
" Path = \"id1\";" " Path = \"id1\";"
" GameCode = \"progs.dat\";" " GameCode = \"progs.dat\";"
" HudType = \"id\";"
" };" " };"
" QuakeWorld = {" " QuakeWorld = {"
" Inherit = (Quake);" " Inherit = (Quake);"
" Path = \"qw\";" " Path = \"qw\";"
" SkinPath = \"${path}/skins\";" " SkinPath = \"${path}/skins\";"
" GameCode = \"qwprogs.dat\";" " GameCode = \"qwprogs.dat\";"
" HudType = \"id\";"
" };"
" \"Hipnotic\" = {"
" Inherit = (Quake);"
" Path = \"hipnotic\";"
" HudType = \"hipnotic\";"
" };"
" \"Rogue\" = {"
" Inherit = (Quake);"
" Path = \"rogue\";"
" HudType = \"rogue\";"
" };" " };"
" \"qw:qw\" = {" " \"qw:qw\" = {"
" Inherit = (QuakeWorld);" " Inherit = (QuakeWorld);"
@ -177,20 +189,12 @@ static const char *qfs_default_dirconf =
" Inherit = (Quake);" " Inherit = (Quake);"
" Path = \"$gamedir\";" " Path = \"$gamedir\";"
" };" " };"
" \"hipnotic\" = {"
" Inherit = (Quake);"
" Path = \"hipnotic\";"
" };"
" \"hipnotic:*\" = {" " \"hipnotic:*\" = {"
" Inherit = (hipnotic);" " Inherit = (Hipnotic);"
" Path = \"$gamedir\";" " Path = \"$gamedir\";"
" };" " };"
" \"rogue\" = {"
" Inherit = (Quake);"
" Path = \"rogue\";"
" };"
" \"rogue:*\" = {" " \"rogue:*\" = {"
" Inherit = (rogue);" " Inherit = (Rogue);"
" Path = \"$gamedir\";" " Path = \"$gamedir\";"
" };" " };"
" \"abyss\" = {" " \"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"))) if (!gamedir->gamecode && (p = PL_ObjectForKey (gdpl, "GameCode")))
gamedir->gamecode = qfs_var_subst (PL_String (p), vars); 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"))) if (!gamedir->dir.skins && (p = PL_ObjectForKey (gdpl, "SkinPath")))
gamedir->dir.skins = qfs_var_subst (PL_String (p), vars); gamedir->dir.skins = qfs_var_subst (PL_String (p), vars);
if (!gamedir->dir.models && (p = PL_ObjectForKey (gdpl, "ModelPath"))) 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, " gamedir : %s\n", qfs_gamedir->gamedir);
Sys_MaskPrintf (SYS_FS, " path : %s\n", qfs_gamedir->path); Sys_MaskPrintf (SYS_FS, " path : %s\n", qfs_gamedir->path);
Sys_MaskPrintf (SYS_FS, " gamecode: %s\n", qfs_gamedir->gamecode); 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, " def : %s\n", qfs_gamedir->dir.def);
Sys_MaskPrintf (SYS_FS, " skins : %s\n", qfs_gamedir->dir.skins); Sys_MaskPrintf (SYS_FS, " skins : %s\n", qfs_gamedir->dir.skins);
Sys_MaskPrintf (SYS_FS, " models : %s\n", qfs_gamedir->dir.models); Sys_MaskPrintf (SYS_FS, " models : %s\n", qfs_gamedir->dir.models);

View file

@ -162,7 +162,7 @@ extern int current_skill; // skill level for currently loaded level (in case
// running, this reflects the level actually in use) // running, this reflects the level actually in use)
extern qboolean isDedicated; extern qboolean isDedicated;
extern qboolean abyss, rogue, hipnotic, standard_quake; extern qboolean standard_quake;
extern struct cvar_s *registered; extern struct cvar_s *registered;
const char *Game_Init (void); const char *Game_Init (void);

View file

@ -36,8 +36,6 @@
#include "game.h" #include "game.h"
qboolean standard_quake = false; qboolean standard_quake = false;
qboolean hipnotic, rogue, abyss;
const char * const char *
Game_Init (void) Game_Init (void)
@ -49,14 +47,11 @@ Game_Init (void)
if ((i = COM_CheckParm ("-hipnotic"))) { if ((i = COM_CheckParm ("-hipnotic"))) {
standard_quake = false; standard_quake = false;
hipnotic = true;
return "hipnotic"; return "hipnotic";
} else if ((i = COM_CheckParm ("-rogue"))) { } else if ((i = COM_CheckParm ("-rogue"))) {
standard_quake = false; standard_quake = false;
rogue = true;
return "rogue"; return "rogue";
} else if ((i = COM_CheckParm ("-abyss"))) { } else if ((i = COM_CheckParm ("-abyss"))) {
abyss = true;
return "abyss"; return "abyss";
} }

View file

@ -1611,10 +1611,10 @@ init_views (void)
view_insert (con_module->data->console->view, stuff_view, 0); view_insert (con_module->data->console->view, stuff_view, 0);
} }
if (hipnotic) { if (!strcmp (qfs_gamedir->hudtype, "hipnotic")) {
init_hipnotic_sbar_views (); init_hipnotic_sbar_views ();
init_hipnotic_hud_views (); init_hipnotic_hud_views ();
} else if (rogue) { } else if (!strcmp (qfs_gamedir->hudtype, "rogue")) {
init_rogue_sbar_views (); init_rogue_sbar_views ();
init_rogue_hud_views (); init_rogue_hud_views ();
} else { } else {
@ -1723,7 +1723,7 @@ Sbar_Init (void)
sb_scorebar = Draw_PicFromWad ("scorebar"); sb_scorebar = Draw_PicFromWad ("scorebar");
// MED 01/04/97 added new hipnotic weapons // 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][0] = Draw_PicFromWad ("inv_laser");
hsb_weapons[0][1] = Draw_PicFromWad ("inv_mjolnir"); hsb_weapons[0][1] = Draw_PicFromWad ("inv_mjolnir");
hsb_weapons[0][2] = Draw_PicFromWad ("inv_gren_prox"); hsb_weapons[0][2] = Draw_PicFromWad ("inv_gren_prox");
@ -1753,7 +1753,7 @@ Sbar_Init (void)
} }
// FIXME: MISSIONHUD // FIXME: MISSIONHUD
if (rogue) { if (!strcmp (qfs_gamedir->hudtype, "rogue")) {
rsb_invbar[0] = Draw_PicFromWad ("r_invbar1"); rsb_invbar[0] = Draw_PicFromWad ("r_invbar1");
rsb_invbar[1] = Draw_PicFromWad ("r_invbar2"); rsb_invbar[1] = Draw_PicFromWad ("r_invbar2");