/* ===================== CL_ClearState ===================== */ void CL_ClearState (void) { S_StopAllSounds (); CL_ClearEffects (); CL_ClearTEnts (); // wipe the entire cl structure memset (&cl, 0, sizeof(cl)); memset (&cl_entities, 0, sizeof(cl_entities)); SZ_Clear (&cls.netchan.message); }
/* ===================== CL_ClearState ===================== */ void CL_ClearState (void) { S_StopAllSounds (); CL_ClearEffects (); CL_ClearTEnts (); R_SetFogVars (false, 0, 0, 0, 0, 0, 0, 0); // clear fog effets // wipe the entire cl structure memset (&cl, 0, sizeof(cl)); memset (&cl_entities, 0, sizeof(cl_entities)); SZ_Clear (&cls.netchan.message); }
/* ===================== CL_ClearState ===================== */ void CL_ClearState (void) { S_StopAllSounds (); CL_ClearEffects (); CL_ClearTEnts (); // R_SetFogVars (false, 0, 0, 0, 0, 0, 0, 0); // clear fog effets R_ClearState (); // wipe the entire cl structure memset (&cl, 0, sizeof(cl)); memset (&cl_entities, 0, sizeof(cl_entities)); SZ_Clear (&cls.netchan.message); // if (vr_enabled->value) // VR_ResetOrientation(); }
/* ===================== CL_ClearState ===================== */ void CL_ClearState( void ) { S_StopAllSounds (); CL_ClearEffects (); CL_FreeEdicts (); CL_ClearPhysEnts (); // wipe the entire cl structure Q_memset( &cl, 0, sizeof( cl )); BF_Clear( &cls.netchan.message ); Q_memset( &clgame.fade, 0, sizeof( clgame.fade )); Q_memset( &clgame.shake, 0, sizeof( clgame.shake )); Cvar_FullSet( "cl_background", "0", CVAR_READ_ONLY ); cl.refdef.movevars = &clgame.movevars; cl.maxclients = 1; // allow to drawing player in menu Cvar_SetFloat( "scr_download", 0.0f ); Cvar_SetFloat( "scr_loading", 0.0f ); // restore real developer level host.developer = host.old_developer; }
void V_InitRenderer() { guard(V_InitRenderer); int i; if (!cl.configstrings[CS_MODELS+1][0]) return; // no map loaded SCR_SetLevelshot(); // wait a small time to let server complete initialization // allow map to be changed before initializing renderer, when loading savegames, // saved at point of changing map; this situation is possible because: // - server frame#1: // - loading savegame, will create configstrings + may be insert command string "gamemap <newmap>" // - send configstrings#1 // - server frame#2: // - exec "gamemap" command from previous frame, change map etc. // - send configstrings#2 // in some circumstances, client will receive configstrings#1 after server frame#2 - this will load // client map#1 after loading server map#2 (out-of-sync client/server maps -- fatal error) static int startTime = 0; static int serverCount = 0; if (serverCount != cl.servercount) { serverCount = cl.servercount; startTime = cls.realtime; return; } if (cls.realtime < startTime + 300) return; CL_ClearEffects(); // can use shaders ... CL_ClearTEnts(); // temp entities linked to models, which are invalid after vid_restart // let the render dll load the map char mapname[MAX_QPATH]; strcpy(mapname, cl.configstrings[CS_MODELS+1] + 5); // skip "maps/" mapname[strlen(mapname)-4] = 0; // cut off ".bsp" // compute total loading weight float totalWeight = W_MAP + W_TEXTURES + W_SKY; for (i = 1; i < MAX_MODELS && cl.configstrings[CS_MODELS+i][0]; i++) // models if (cl.configstrings[CS_MODELS+i][0] != '*') totalWeight += W_MODEL; for (i = 0; i < MAX_CLIENTS; i++) // clients if (cl.configstrings[CS_PLAYERSKINS+i][0]) totalWeight += W_CLIENT; // register models, pics, and skins float loadingFrac = 0; SCR_LoadingNotify(va("map: %s", mapname), 0); loadingFrac += W_MAP / totalWeight; RE_LoadNewWorld(); // precache status bar pics SCR_TouchPics(); CL_RegisterTEntModels(); RegisterShaders(); strcpy(cl_weaponmodels[0], "weapon.md2"); // default weapon model num_cl_weaponmodels = 1; for (i = 1; i < MAX_MODELS && cl.configstrings[CS_MODELS+i][0]; i++) { const char *name = cl.configstrings[CS_MODELS+i]; if (name[0] != '*') { SCR_LoadingNotify(name, loadingFrac); loadingFrac += W_MODEL / totalWeight; } if (name[0] == '#') { // special player weapon model if (num_cl_weaponmodels < MAX_CLIENTWEAPONMODELS) strncpy(cl_weaponmodels[num_cl_weaponmodels++], cl.configstrings[CS_MODELS+i]+1, sizeof(cl_weaponmodels[0])-1); } else { const char *mdl = cl.configstrings[CS_MODELS + i]; const char *ext = strrchr(name, '.'); // load model, but do not reload BSP file: cl.model_draw[i] = (!ext || stricmp(ext, ".bsp")) ? RE_RegisterModel(mdl) : NULL; cl.model_clip[i] = (name[0] == '*') ? CM_InlineModel(mdl) : NULL; } } SCR_LoadingNotify("textures", loadingFrac); loadingFrac += W_TEXTURES / totalWeight; for (i = 1; i < MAX_IMAGES && cl.configstrings[CS_IMAGES+i][0]; i++) cl.image_precache[i] = RE_RegisterPic(va("pics/%s", cl.configstrings[CS_IMAGES+i])); for (i = 0; i < MAX_CLIENTS; i++) { if (!cl.configstrings[CS_PLAYERSKINS+i][0]) continue; SCR_LoadingNotify(va("client %d: %s", i, cl.configstrings[CS_PLAYERSKINS+i]), loadingFrac); loadingFrac += W_CLIENT / totalWeight; CL_ParseClientinfo(i); } if (!cl.configstrings[CS_PLAYERSKINS+cl.playernum][0]) { // in a singleplayer mode, server will not send clientinfo - generate it by // ourself for correct third-person view // Com_DPrintf("Fixing CI[playernum]\n"); CL_UpdatePlayerClientInfo(); } // setup sky SCR_LoadingNotify("sky", loadingFrac); float rotate = atof(cl.configstrings[CS_SKYROTATE]); CVec3 axis; sscanf(cl.configstrings[CS_SKYAXIS], "%f %f %f", &axis[0], &axis[1], &axis[2]); RE_SetSky(cl.configstrings[CS_SKY], rotate, axis); // the renderer can now free unneeded stuff RE_FinishLoadingWorld(); Con_ClearNotify(); SCR_EndLoadingPlaque(true); cl.rendererReady = true; cl.forceViewFrame = true; // start the cd track CDAudio_Play(atoi(cl.configstrings[CS_CDTRACK]), true); unguard; }