From: havoc Date: Wed, 15 Jan 2003 11:40:17 +0000 (+0000) Subject: cleanup of precache messages and assorted comments X-Git-Tag: RELEASE_0_2_0_RC1~22 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8804a5dfce3048bf1f48b49f795bd429654111a2;p=xonotic%2Fdarkplaces.git cleanup of precache messages and assorted comments git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2686 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_parse.c b/cl_parse.c index b63a017a..d8cd4452 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -365,82 +365,76 @@ void CL_ParseServerInfo (void) Con_Printf ("%c%s\n", 2, str); } -// -// first we go through and touch all of the precache data that still -// happens to be in the cache, so precaching something else doesn't -// needlessly purge it -// - + // check memory integrity Mem_CheckSentinelsGlobal(); - Mod_ClearUsed(); - // disable until we get textures for it R_ResetSkyBox(); -// precache models memset (cl.model_precache, 0, sizeof(cl.model_precache)); + memset (cl.sound_precache, 0, sizeof(cl.sound_precache)); + + // touch all of the precached models that are still loaded so we can free + // anything that isn't needed + Mod_ClearUsed(); for (nummodels=1 ; ; nummodels++) { + CL_KeepaliveMessage (); str = MSG_ReadString (); if (!str[0]) break; if (nummodels==MAX_MODELS) - { Host_Error ("Server sent too many model precaches\n"); - return; - } if (strlen(str) >= MAX_QPATH) Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1); strcpy (model_precache[nummodels], str); Mod_TouchModel (str); } -// precache sounds - memset (cl.sound_precache, 0, sizeof(cl.sound_precache)); + // do the same for sounds for (numsounds=1 ; ; numsounds++) { + CL_KeepaliveMessage (); str = MSG_ReadString (); if (!str[0]) break; if (numsounds==MAX_SOUNDS) - { Host_Error ("Server sent too many sound precaches\n"); - return; - } if (strlen(str) >= MAX_QPATH) Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1); strcpy (sound_precache[numsounds], str); S_TouchSound (str); } + // purge anything that was not touched Mod_PurgeUnused(); -// -// now we try to load everything else until a cache allocation fails -// + // now we try to load everything that is new + + // world model + CL_KeepaliveMessage (); + cl.model_precache[1] = Mod_ForName (model_precache[1], false, false, true); + if (cl.model_precache[1] == NULL) + Con_Printf("Map %s not found\n", model_precache[1]); - for (i=1 ; istate_current.active = true; @@ -456,10 +450,11 @@ void CL_ParseServerInfo (void) R_NewMap (); CL_CGVM_Start(); - noclip_anglehack = false; // noclip is turned off at start + // noclip is turned off at start + noclip_anglehack = false; + // check memory integrity Mem_CheckSentinelsGlobal(); - } void CL_ValidateState(entity_state_t *s)