precache csqc-used stuff on server too
authorRudolf Polzer <divverent@xonotic.org>
Mon, 8 Jul 2013 07:47:42 +0000 (09:47 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 8 Jul 2013 07:57:39 +0000 (09:57 +0200)
This fixes load savegame performance, and the loading progress bar.

defaultXonotic.cfg
qcsrc/Makefile
qcsrc/client/Main.qc
qcsrc/client/autocvars.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/progs.src

index 2437360c4a91c44b667cd52b18070de50296fa72..d26c173e1dabd78d289b5690a6222843f66f2cc7 100644 (file)
@@ -1329,7 +1329,6 @@ set developer_csqcentities 0 "csqc entity spam"
 set waypoint_benchmark 0 "quit after waypoint loading to benchmark bot navigation code"
 set g_debug_bot_commands 0 "print scripted bot commands before executing"
 set g_debug_defaultsounds 0 "always use default sounds"
-set cl_precacheplayermodels 0 "TODO please check if this needs to be 1 or if precaching a model the server already requested is fast enough to do it at runtime"
 seta cl_forceplayermodels 0 "make everyone look like your own model (requires server to have sv_defaultcharacter 0)"
 seta cl_forceplayercolors 0 "make everyone look like your own color (requires server to have sv_defaultcharacter 0, and is ignored in teamplay with more than two teams)"
 seta cl_forcemyplayermodel "" "set to the model file name you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
index df1e9a3883226e55c877350d1e732086ad768f9b..3708ab48332a01d55a07edcefda76f971f99c597 100644 (file)
@@ -60,8 +60,11 @@ FILES_CSPROGS = $(shell find client common warpzonelib csqcmodellib -type f -not
        @echo make[1]: Entering directory \`$(PWD)/client\'
        cd client && $(QCC) $(QCCFLAGS)
 
+server/precache-for-csqc.qc: $(FILES_CSPROGS)
+       sh collect-precache.sh
+
 FILES_PROGS = $(shell find server common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm) $(wildcard server/w_*.qc)
-../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE)
+../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE) server/precache-for-csqc.qc
        @echo make[1]: Entering directory \`$(PWD)/server\'
        cd server && $(QCC) $(QCCFLAGS)
 
index 7178cdba1abbf9c4a62aac03d833c1191fddfb03..42fadc0c18a86b0cc0cec1eb145409adebe08efb 100644 (file)
@@ -32,55 +32,6 @@ void menu_sub_null()
 float __engine_check;
 #endif
 
-void precache_playermodel(string m)
-{
-       string f;
-
-       if(substring(m, -9,5) == "_lod1")
-               return;
-       if(substring(m, -9,5) == "_lod2")
-               return;
-       precache_model(m);
-       f = strcat(substring(m, 0, -5), "_lod1", substring(m, -4, -1));
-       if(fexists(f))
-               precache_model(f);
-       f = strcat(substring(m, 0, -5), "_lod2", substring(m, -4, -1));
-       if(fexists(f))
-               precache_model(f);
-
-       /*
-       float globhandle, i, n;
-       globhandle = search_begin(strcat(m, "_*.sounds"), TRUE, FALSE);
-       if (globhandle < 0)
-               return;
-       n = search_getsize(globhandle);
-       for (i = 0; i < n; ++i)
-       {
-               //print(search_getfilename(globhandle, i), "\n");
-               f = search_getfilename(globhandle, i);
-               PrecachePlayerSounds(f);
-       }
-       search_end(globhandle);
-       */
-}
-void precache_all_playermodels(string pattern)
-{
-       float globhandle, i, n;
-       string f;
-
-       globhandle = search_begin(pattern, TRUE, FALSE);
-       if (globhandle < 0)
-               return;
-       n = search_getsize(globhandle);
-       for (i = 0; i < n; ++i)
-       {
-               //print(search_getfilename(globhandle, i), "\n");
-               f = search_getfilename(globhandle, i);
-               precache_playermodel(f);
-       }
-       search_end(globhandle);
-}
-
 string forcefog;
 void WaypointSprite_Load();
 void ConsoleCommand_macro_init();
@@ -164,14 +115,6 @@ void CSQC_Init(void)
        precache_model("null");
        precache_sound("misc/hit.wav");
        precache_sound("misc/typehit.wav");
-       if (autocvar_cl_precacheplayermodels)
-       {
-               precache_all_playermodels("models/player/*.zym");
-               precache_all_playermodels("models/player/*.dpm");
-               precache_all_playermodels("models/player/*.md3");
-               precache_all_playermodels("models/player/*.psk");
-               precache_all_playermodels("models/player/*.iqm");
-       }
 
        Projectile_Precache();
        Hook_Precache();
index af7008150eadf03b39bebccad78c018f5aaadbdc..8175695abb0ac5ef0a4c033e671a742a907776fb 100644 (file)
@@ -424,7 +424,6 @@ float autocvar_cl_forcemyplayercolors;
 float autocvar__cl_color;
 float autocvar__cl_playerskin;
 string autocvar__cl_playermodel;
-float autocvar_cl_precacheplayermodels;
 float autocvar_cl_deathglow;
 float autocvar_developer_csqcentities;
 float autocvar_g_jetpack_attenuation;
index f69b133213f50666be3099491ce665f7f9767abf..190870d7b7239bcc91ebb066d50e84ec674ffd7c 100644 (file)
@@ -1416,6 +1416,8 @@ void precache()
         ambientsound ('0 0 0', self.noise, VOL_BASE, ATTN_NONE);
     }
 #endif
+
+    PrecacheForCSQC();
 }
 
 // WARNING: this kills the trace globals
index 367e8609ded2741ab10a74503dbf7888a82bd1a6..aa09444995c6cebdd06215684b65ba07f1ff3d33 100644 (file)
@@ -100,6 +100,7 @@ secret.qh
 
 scores_rules.qc
 
+precache-for-csqc.qc
 miscfunctions.qc
 
 waypointsprites.qc