From a0e7300da2d86056539ff57dbcc7acb98bfe7f30 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Wed, 13 Jul 2011 05:48:09 +0000 Subject: [PATCH] add cl_yieldcpu, fix setmodel with NULL pointer git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3869 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 4 +++- engine/qclib/progslib.h | 2 +- engine/server/pr_cmds.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index aa034317d..3e46b017b 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -49,6 +49,7 @@ cvar_t cl_sbar = CVARFC("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_Callback); cvar_t cl_hudswap = CVARF("cl_hudswap", "0", CVAR_ARCHIVE); cvar_t cl_maxfps = CVARF("cl_maxfps", "500", CVAR_ARCHIVE); cvar_t cl_idlefps = CVARF("cl_idlefps", "0", CVAR_ARCHIVE); +cvar_t cl_yieldcpu = CVARF("cl_yieldcpu", "0", CVAR_ARCHIVE); cvar_t cl_nopext = CVARF("cl_nopext", "0", CVAR_ARCHIVE); cvar_t cl_pext_mask = CVAR("cl_pext_mask", "0xffffffff"); cvar_t cl_nolerp = CVAR("cl_nolerp", "2"); @@ -3002,6 +3003,7 @@ void CL_Init (void) Cvar_Register (&cl_hudswap, cl_screengroup); Cvar_Register (&cl_maxfps, cl_screengroup); Cvar_Register (&cl_idlefps, cl_screengroup); + Cvar_Register (&cl_yieldcpu, cl_screengroup); Cvar_Register (&cl_timeout, cl_controlgroup); Cvar_Register (&lookspring, cl_inputgroup); Cvar_Register (&lookstrafe, cl_inputgroup); @@ -3452,7 +3454,7 @@ double Host_Frame (double time) realtime += spare/1000; //don't use it all! spare = CL_FilterTime((realtime - oldrealtime)*1000, maxfps, maxfpsignoreserver); if (!spare) - return 0; + return cl_yieldcpu.ival ? (1.0 / maxfps - (realtime - oldrealtime)) : 0; if (spare < 0 || cls.state < ca_onserver) spare = 0; //uncapped. if (spare > cl_sparemsec.ival) diff --git a/engine/qclib/progslib.h b/engine/qclib/progslib.h index 1e9b61255..843dee0bb 100644 --- a/engine/qclib/progslib.h +++ b/engine/qclib/progslib.h @@ -15,7 +15,7 @@ #endif #if defined(_M_IX86) || defined(__i386__) -//#define QCJIT +#define QCJIT #endif #ifdef QCJIT diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 7fea8227c..6b0388612 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -2132,7 +2132,7 @@ void PF_setmodel_Internal (progfuncs_t *prinst, edict_t *e, char *m) e->v->modelindex = i; // if it is an inline model, get the size information for it - if (m[0] == '*' || (*m&&progstype == PROG_H2)) + if (m && (m[0] == '*' || (*m&&progstype == PROG_H2))) { mod = Mod_ForName (m, false); if (mod)