From: divverent Date: Sat, 20 Aug 2011 16:46:20 +0000 (+0000) Subject: cvar: csqc_usedemoprogs X-Git-Tag: xonotic-v0.5.0~34 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b470807e53b3d5b6655fbee991ebca973a6453c2;p=xonotic%2Fdarkplaces.git cvar: csqc_usedemoprogs allows to use the file system csprogs.dat for demo playback, mainly useful for debugging csqc issues that happen when playing back a demo git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11288 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=8ab7e82de6aed81dec7da6debee9d4e37cea9c2b --- diff --git a/cl_main.c b/cl_main.c index 420203b4..c6d9319d 100644 --- a/cl_main.c +++ b/cl_main.c @@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cvar_t csqc_progname = {0, "csqc_progname","csprogs.dat","name of csprogs.dat file to load"}; cvar_t csqc_progcrc = {CVAR_READONLY, "csqc_progcrc","-1","CRC of csprogs.dat file to load (-1 is none), only used during level changes and then reset to -1"}; cvar_t csqc_progsize = {CVAR_READONLY, "csqc_progsize","-1","file size of csprogs.dat file to load (-1 is none), only used during level changes and then reset to -1"}; +cvar_t csqc_usedemoprogs = {0, "csqc_usedemoprogs","1","use csprogs stored in demos"}; cvar_t cl_shownet = {0, "cl_shownet","0","1 = print packet size, 2 = print packet message list"}; cvar_t cl_nolerp = {0, "cl_nolerp", "0","network update smoothing"}; diff --git a/csprogs.c b/csprogs.c index 55bf6bf1..ab2cc35b 100644 --- a/csprogs.c +++ b/csprogs.c @@ -951,10 +951,11 @@ qboolean MakeDownloadPacket(const char *filename, unsigned char *data, size_t le return false; } +extern cvar_t csqc_usedemoprogs; void CL_VM_Init (void) { const char* csprogsfn; - unsigned char *csprogsdata; + unsigned char *csprogsdata = NULL; fs_offset_t csprogsdatasize; int csprogsdatacrc, requiredcrc; int requiredsize; @@ -972,8 +973,11 @@ void CL_VM_Init (void) // see if the requested csprogs.dat file matches the requested crc csprogsdatacrc = -1; - csprogsfn = va("dlcache/%s.%i.%i", csqc_progname.string, requiredsize, requiredcrc); - csprogsdata = FS_LoadFile(csprogsfn, tempmempool, true, &csprogsdatasize); + if (!cls.demoplayback || csqc_usedemoprogs.integer) + { + csprogsfn = va("dlcache/%s.%i.%i", csqc_progname.string, requiredsize, requiredcrc); + csprogsdata = FS_LoadFile(csprogsfn, tempmempool, true, &csprogsdatasize); + } if (!csprogsdata) { csprogsfn = csqc_progname.string; diff --git a/sv_main.c b/sv_main.c index bc6eaf0a..87187b51 100644 --- a/sv_main.c +++ b/sv_main.c @@ -426,6 +426,7 @@ void SV_Init (void) extern cvar_t csqc_progname; //[515]: csqc crc check and right csprogs name according to progs.dat extern cvar_t csqc_progcrc; extern cvar_t csqc_progsize; + extern cvar_t csqc_usedemoprogs; Cvar_RegisterVariable(&sv_worldmessage); Cvar_RegisterVariable(&sv_worldname); @@ -435,6 +436,7 @@ void SV_Init (void) Cvar_RegisterVariable (&csqc_progname); Cvar_RegisterVariable (&csqc_progcrc); Cvar_RegisterVariable (&csqc_progsize); + Cvar_RegisterVariable (&csqc_usedemoprogs); Cmd_AddCommand("sv_saveentfile", SV_SaveEntFile_f, "save map entities to .ent file (to allow external editing)"); Cmd_AddCommand("sv_areastats", SV_AreaStats_f, "prints statistics on entity culling during collision traces");