+extern cvar_t con_chatsound_team_file;
+static const vec3_t defaultmins = {-4096, -4096, -4096};
+static const vec3_t defaultmaxs = {4096, 4096, 4096};
+static void CL_SetupWorldModel(void)
+{
+ prvm_prog_t *prog = CLVM_prog;
+ // update the world model
+ cl.entities[0].render.model = cl.worldmodel = CL_GetModelByIndex(1);
+ CL_UpdateRenderEntity(&cl.entities[0].render);
+
+ // make sure the cl.worldname and related cvars are set up now that we know the world model name
+ // set up csqc world for collision culling
+ if (cl.worldmodel)
+ {
+ strlcpy(cl.worldname, cl.worldmodel->name, sizeof(cl.worldname));
+ FS_StripExtension(cl.worldname, cl.worldnamenoextension, sizeof(cl.worldnamenoextension));
+ strlcpy(cl.worldbasename, !strncmp(cl.worldnamenoextension, "maps/", 5) ? cl.worldnamenoextension + 5 : cl.worldnamenoextension, sizeof(cl.worldbasename));
+ Cvar_SetQuick(&cl_worldmessage, cl.worldmessage);
+ Cvar_SetQuick(&cl_worldname, cl.worldname);
+ Cvar_SetQuick(&cl_worldnamenoextension, cl.worldnamenoextension);
+ Cvar_SetQuick(&cl_worldbasename, cl.worldbasename);
+ World_SetSize(&cl.world, cl.worldname, cl.worldmodel->normalmins, cl.worldmodel->normalmaxs, prog);
+ }
+ else
+ {
+ Cvar_SetQuick(&cl_worldmessage, cl.worldmessage);
+ Cvar_SetQuick(&cl_worldnamenoextension, "");
+ Cvar_SetQuick(&cl_worldbasename, "");
+ World_SetSize(&cl.world, "", defaultmins, defaultmaxs, prog);
+ }
+ World_Start(&cl.world);
+
+ // load or reload .loc file for team chat messages
+ CL_Locs_Reload_f(cmd_local);
+
+ // make sure we send enough keepalives
+ CL_KeepaliveMessage(false);
+
+ // reset particles and other per-level things
+ R_Modules_NewMap();
+
+ // make sure we send enough keepalives
+ CL_KeepaliveMessage(false);
+
+ // load the team chat beep if possible
+ cl.foundteamchatsound = FS_FileExists(con_chatsound_team_file.string);
+
+ // check memory integrity
+ Mem_CheckSentinelsGlobal();
+
+#ifdef CONFIG_MENU
+ // make menu know
+ MR_NewMap();
+#endif
+
+ // load the csqc now
+ if (cl.loadcsqc)
+ {
+ cl.loadcsqc = false;
+
+ CL_VM_Init();
+ }
+}
+
+static qbool QW_CL_CheckOrDownloadFile(const char *filename)