From: divverent Date: Mon, 25 Feb 2013 12:28:46 +0000 (+0000) Subject: Add a cvar to change menu progs filename X-Git-Tag: xonotic-v0.8.0~96^2~131 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=73e441dcaf8470073e3b48755c15085790f2abed;p=xonotic%2Fdarkplaces.git Add a cvar to change menu progs filename From: Mario git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11908 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/menu.c b/menu.c index 26b690e2..184ae366 100644 --- a/menu.c +++ b/menu.c @@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TYPE_BOTH 3 static cvar_t forceqmenu = { 0, "forceqmenu", "0", "enables the quake menu instead of the quakec menu.dat (if present)" }; +static cvar_t menu_progs = { 0, "menu_progs", "menu.dat", "name of quakec menu.dat file" }; static int NehGameType; @@ -5364,9 +5365,9 @@ static void MP_Init (void) prog->ExecuteProgram = MVM_ExecuteProgram; // allocate the mempools - prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME, 0, NULL); + prog->progs_mempool = Mem_AllocPool(menu_progs.string, 0, NULL); - PRVM_Prog_Load(prog, M_PROG_FILENAME, NULL, 0, m_numrequiredfunc, m_required_func, m_numrequiredfields, m_required_fields, m_numrequiredglobals, m_required_globals); + PRVM_Prog_Load(prog, menu_progs.string, NULL, 0, m_numrequiredfunc, m_required_func, m_numrequiredfields, m_required_fields, m_numrequiredglobals, m_required_globals); // note: OP_STATE is not supported by menu qc, we don't even try to detect // it here @@ -5389,7 +5390,7 @@ void (*MR_NewMap) (void); void MR_SetRouting(qboolean forceold) { // if the menu prog isnt available or forceqmenu ist set, use the old menu - if(!FS_FileExists(M_PROG_FILENAME) || forceqmenu.integer || forceold) + if(!FS_FileExists(menu_progs.string) || forceqmenu.integer || forceold) { // set menu router function pointers MR_KeyEvent = M_KeyEvent; @@ -5432,6 +5433,7 @@ void MR_Init_Commands(void) // set router console commands Cvar_RegisterVariable (&forceqmenu); Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue); + Cvar_RegisterVariable (&menu_progs); Cmd_AddCommand ("menu_restart",MR_Restart, "restart menu system (reloads menu.dat)"); Cmd_AddCommand ("togglemenu", Call_MR_ToggleMenu_f, "opens or closes menu"); } diff --git a/menu.h b/menu.h index aac8a4bc..f8094596 100644 --- a/menu.h +++ b/menu.h @@ -21,8 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef MENU_H #define MENU_H -#define M_PROG_FILENAME "menu.dat" - enum m_state_e { m_none, m_main,