From 815ec2a3316374373d3c0a90131c60cf20ff2502 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 8 Jul 2013 09:47:42 +0200 Subject: [PATCH] precache csqc-used stuff on server too This fixes load savegame performance, and the loading progress bar. --- defaultXonotic.cfg | 1 - qcsrc/Makefile | 5 ++- qcsrc/client/Main.qc | 57 ----------------------------------- qcsrc/client/autocvars.qh | 1 - qcsrc/server/miscfunctions.qc | 2 ++ qcsrc/server/progs.src | 1 + 6 files changed, 7 insertions(+), 60 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 2437360c4..d26c173e1 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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)" diff --git a/qcsrc/Makefile b/qcsrc/Makefile index df1e9a388..3708ab483 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -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) diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 7178cdba1..42fadc0c1 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -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(); diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index af7008150..8175695ab 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -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; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index f69b13321..190870d7b 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1416,6 +1416,8 @@ void precache() ambientsound ('0 0 0', self.noise, VOL_BASE, ATTN_NONE); } #endif + + PrecacheForCSQC(); } // WARNING: this kills the trace globals diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index 367e8609d..aa0944499 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -100,6 +100,7 @@ secret.qh scores_rules.qc +precache-for-csqc.qc miscfunctions.qc waypointsprites.qc -- 2.39.2