From e339bfa096a17908f96eb75d6fc1dc922b92b330 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Fri, 19 Aug 2005 19:06:22 +0000 Subject: [PATCH] progs control cvars, pf_cs_sound fix git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1239 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/pr_csqc.c | 30 +++++++++++++++++++----------- engine/client/pr_menu.c | 16 ++++++++++++++-- engine/server/pr_cmds.c | 4 ++++ engine/server/sv_main.c | 16 ++++++++++------ 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 96b3b9f14..ba9053301 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -24,8 +24,11 @@ qboolean csqc_drawsbar; qboolean csqc_addcrosshair; static int num_csqc_edicts; +#define CSQCPROGSGROUP "CSQC progs control" cvar_t pr_csmaxedicts = {"pr_csmaxedicts", "3072"}; cvar_t cl_csqcdebug = {"cl_csqcdebug", "0"}; //prints entity numbers which arrive (so I can tell people not to apply it to players...) +cvar_t cl_nocsqc = {"cl_nocsqc", "0"}; +cvar_t pr_csqc_coreonerror = {"pr_csqc_coreonerror", "1"}; //If I do it like this, I'll never forget to register something... #define csqcglobals \ @@ -1908,7 +1911,7 @@ void PF_cs_sound(progfuncs_t *prinst, struct globalvars_s *pr_globals) char *sample; int channel; csqcedict_t *entity; - int volume; + float volume; float attenuation; sfx_t *sfx; @@ -3384,14 +3387,14 @@ void VARGS CSQC_Abort (char *format, ...) //an error occured. Con_Printf("CSQC_Abort: %s\nShutting down csqc\n", string); - -{ - int size = 1024*1024*8; - char *buffer = BZ_Malloc(size); - csqcprogs->save_ents(csqcprogs, buffer, &size, 3); - COM_WriteFile("csqccore.txt", buffer, size); - BZ_Free(buffer); -} + if (pr_csqc_coreonerror.value) + { + int size = 1024*1024*8; + char *buffer = BZ_Malloc(size); + csqcprogs->save_ents(csqcprogs, buffer, &size, 3); + COM_WriteFile("csqccore.txt", buffer, size); + BZ_Free(buffer); + } Host_EndGame("csqc error"); } @@ -3497,6 +3500,9 @@ qboolean CSQC_Init (unsigned int checksum) return false; } + if (cl_nocsqc.value) + return false; + memset(cl.model_csqcname, 0, sizeof(cl.model_csqcname)); memset(cl.model_csqcprecache, 0, sizeof(cl.model_csqcprecache)); @@ -3604,8 +3610,10 @@ void CSQC_RegisterCvarsAndThings(void) { Cmd_AddCommand("coredump_csqc", CSQC_CoreDump); - Cvar_Register(&pr_csmaxedicts, "csqc"); - Cvar_Register(&cl_csqcdebug, "csqc"); + Cvar_Register(&pr_csmaxedicts, CSQCPROGSGROUP); + Cvar_Register(&cl_csqcdebug, CSQCPROGSGROUP); + Cvar_Register(&cl_nocsqc, CSQCPROGSGROUP); + Cvar_Register(&pr_csqc_coreonerror, CSQCPROGSGROUP); } qboolean CSQC_DrawView(void) diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index f71402a55..3ccb721bd 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -26,6 +26,11 @@ char *PF_TempStr(progfuncs_t *prinst); int menuentsize; +// cvars +#define MENUPROGSGROUP "Menu progs control" +cvar_t forceqmenu = {"forceqmenu", "0"}; +cvar_t pr_menuqc_coreonerror = {"pr_menuqc_coreonerror", "1"}; + //pr_cmds.c builtins that need to be moved to a common. void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...); void PF_cvar_string (progfuncs_t *prinst, struct globalvars_s *pr_globals); @@ -1331,7 +1336,7 @@ void VARGS Menu_Abort (char *format, ...) Con_Printf("Menu_Abort: %s\nShutting down menu.dat\n", string); - + if (pr_menuqc_coreonerror.value) { char *buffer; int size = 1024*1024*8; @@ -1351,7 +1356,8 @@ void MP_Init (void) { return; } - if (COM_CheckParm("-qmenu")) + + if (forceqmenu.value) return; M_DeInit_Internal(); @@ -1464,6 +1470,12 @@ void MP_CoreDump(void) void MP_RegisterCvarsAndCmds(void) { Cmd_AddCommand("coredump_menuqc", MP_CoreDump); + + Cvar_Register(&forceqmenu, MENUPROGSGROUP); + Cvar_Register(&pr_menuqc_coreonerror, MENUPROGSGROUP); + + if (COM_CheckParm("-qmenu")) + Cvar_Set(&forceqmenu, "1"); } void MP_Draw(void) diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index e25e40802..72eb5cb75 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -57,6 +57,8 @@ cvar_t pr_overridebuiltins = {"pr_overridebuiltins", "1"}; cvar_t pr_compatabilitytest = {"pr_compatabilitytest", "0", NULL, CVAR_LATCH}; +cvar_t pr_ssqc_coreonerror = {"pr_coreonerror", "1"}; + cvar_t sv_addon[MAXADDONS]; char cvargroup_progs[] = "Progs variables"; @@ -881,6 +883,8 @@ void PR_Init(void) Cvar_Register (&qc_nonetaccess, cvargroup_progs); Cvar_Register (&pr_overridebuiltins, cvargroup_progs); + + Cvar_Register (&pr_ssqc_coreonerror, cvargroup_progs); } void Q_InitProgs(void) diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 6850b0285..804eb011b 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -242,13 +242,17 @@ void VARGS SV_Error (char *error, ...) _vsnprintf (string,sizeof(string)-1, error,argptr); va_end (argptr); - if (svprogfuncs) { - int size = 1024*1024*8; - char *buffer = BZ_Malloc(size); - svprogfuncs->save_ents(svprogfuncs, buffer, &size, 3); - COM_WriteFile("ssqccore.txt", buffer, size); - BZ_Free(buffer); + extern cvar_t pr_ssqc_coreonerror; + + if (svprogfuncs && pr_ssqc_coreonerror.value) + { + int size = 1024*1024*8; + char *buffer = BZ_Malloc(size); + svprogfuncs->save_ents(svprogfuncs, buffer, &size, 3); + COM_WriteFile("ssqccore.txt", buffer, size); + BZ_Free(buffer); + } }