/* ================== Mod_ForName Loads in a model for the given name ================== */ model_t *Mod_ForName (char *name, qboolean crash) { model_t *mod; mod = Mod_FindName (name); return Mod_LoadModel (mod, crash); }
/* ================== Mod_TouchModel ================== */ void Mod_TouchModel (char *name) { model_t *mod; mod = Mod_FindName (name); if (!mod->needload) { if (mod->type == mod_alias) Cache_Check (&mod->cache); } }
/* ================= Mod_LoadBrushModel ================= */ void Mod_LoadBrushModel (model_t *mod, void *buffer) { int i, j; dheader_t *header; dmodel_t *bm; loadmodel->type = mod_brush; header = (dheader_t *)buffer; i = LittleLong (header->version); if (i != BSPVERSION) Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION); // swap all the lumps mod_base = (byte *)header; for (i=0 ; i<sizeof(dheader_t)/4 ; i++) ((int *)header)[i] = LittleLong ( ((int *)header)[i]); // load into heap Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]); Mod_LoadEdges (&header->lumps[LUMP_EDGES]); Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]); Mod_LoadTextures (&header->lumps[LUMP_TEXTURES]); Mod_LoadLighting (&header->lumps[LUMP_LIGHTING]); Mod_LoadPlanes (&header->lumps[LUMP_PLANES]); Mod_LoadTexinfo (&header->lumps[LUMP_TEXINFO]); Mod_LoadFaces (&header->lumps[LUMP_FACES]); Mod_LoadMarksurfaces (&header->lumps[LUMP_MARKSURFACES]); Mod_LoadVisibility (&header->lumps[LUMP_VISIBILITY]); Mod_LoadLeafs (&header->lumps[LUMP_LEAFS]); Mod_LoadNodes (&header->lumps[LUMP_NODES]); Mod_LoadClipnodes (&header->lumps[LUMP_CLIPNODES]); Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]); Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]); Mod_MakeHull0 (); mod->numframes = 2; // regular and alternate animation // // set up the submodels (FIXME: this is confusing) // for (i=0 ; i<mod->numsubmodels ; i++) { bm = &mod->submodels[i]; mod->hulls[0].firstclipnode = bm->headnode[0]; for (j=1 ; j<MAX_MAP_HULLS ; j++) { mod->hulls[j].firstclipnode = bm->headnode[j]; mod->hulls[j].lastclipnode = mod->numclipnodes-1; } mod->firstmodelsurface = bm->firstface; mod->nummodelsurfaces = bm->numfaces; VectorCopy (bm->maxs, mod->maxs); VectorCopy (bm->mins, mod->mins); mod->radius = RadiusFromBounds (mod->mins, mod->maxs); mod->numleafs = bm->visleafs; if (i < mod->numsubmodels-1) { // duplicate the basic information char name[10]; sprintf (name, "*%i", i+1); loadmodel = Mod_FindName (name); *loadmodel = *mod; strcpy (loadmodel->name, name); mod = loadmodel; } } }
void Mod_LoadBrushModel (model_t *mod, void *buffer, loadedfile_t *brush_fileinfo) // 2001-09-12 .ENT support by Maddes { int i, j; dheader_t *header; dmodel_t *bm; int fhandle; // 2001-12-28 .VIS support by Maddes if (r_coloredlights->value == 2){ coloredlights = 1; // normal light quality if (hqlite) coloredmethod = 0; // don't do lookup stuff else coloredmethod = 1; // do lookup stuff because we don't have a high quality table. :( } else if (r_coloredlights->value == 1){ coloredlights = 1; // normal light quality coloredmethod = 1; // do lookup stuff } else if (r_coloredlights->value == 3){ coloredlights = 2; // dithered light quality coloredmethod = 0; // don't do lookup stuff } else { coloredlights = 0; // mono lights coloredmethod = 0; // don't do lookup stuff } truecolor = (int)r_truecolor->value; // sanity check lowworld = (int)r_lowworld->value; // sanity check ditheredrend = (int)r_dither->value; // sanity checking also // FogTableRefresh(); if (nolookups){ coloredlights = 0; // DON'T ALLOW THESE THINGS!!! ditheredrend = 0; } // if(overbrights != r_overbrightBits->value || (fullbrights != (int)r_fullbrights->value)){ // overbrights = r_overbrightBits->value; // fullbrights = r_fullbrights->value; // GrabColorMap(); // } loadmodel->type = mod_brush; header = (dheader_t *)buffer; i = LittleLong (header->version); if ((i != BSPVERSION) && (i != BSPVERSIONHL) && (i != BSPVERSION91)) // 2001-12-16 No crash on wrong BSP version by MrG start // Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION); { Con_Printf("Mod_LoadBrushModel: %s has wrong version number (%i should be 28, 29 or 30)", mod->name, i, BSPVERSION); mod->numvertexes=-1; // HACK - incorrect BSP version is no longer fatal return; } // 2001-12-16 No crash on wrong BSP version by MrG end if (i == BSPVERSIONHL) loadmodel->fromgame = fg_halflife; if (i == BSPVERSION91) loadmodel->fromgame = fg_quakeold; // swap all the lumps mod_base = (byte *)header; for (i=0 ; i<sizeof(dheader_t)/4 ; i++) ((int *)header)[i] = LittleLong ( ((int *)header)[i]); // load into heap Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]); Mod_LoadEdges (&header->lumps[LUMP_EDGES]); Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]); if (truecolor) Mod_LoadTextures32 (&header->lumps[LUMP_TEXTURES]); else Mod_LoadTextures (&header->lumps[LUMP_TEXTURES]); Mod_LoadLighting (&header->lumps[LUMP_LIGHTING]); Mod_LoadPlanes (&header->lumps[LUMP_PLANES]); Mod_LoadTexinfo (&header->lumps[LUMP_TEXINFO]); Mod_LoadFaces (&header->lumps[LUMP_FACES]); Mod_LoadMarksurfaces (&header->lumps[LUMP_MARKSURFACES]); // 2001-12-28 .VIS support by Maddes start loadmodel->visdata = NULL; loadmodel->leafs = NULL; loadmodel->numleafs = 0; fhandle = Mod_FindExternalVIS (brush_fileinfo); if (fhandle >= 0) { Mod_LoadExternalVisibility (fhandle); Mod_LoadExternalLeafs (fhandle); } if ((loadmodel->visdata == NULL) || (loadmodel->leafs == NULL) || (loadmodel->numleafs == 0)) { if (fhandle >= 0) { Con_Printf("External VIS data are invalid!!!\n"); } // 2001-12-28 .VIS support by Maddes end Mod_LoadVisibility (&header->lumps[LUMP_VISIBILITY]); Mod_LoadLeafs (&header->lumps[LUMP_LEAFS]); // 2001-12-28 .VIS support by Maddes start } if (fhandle >= 0) { COM_CloseFile(fhandle); } // 2001-12-28 .VIS support by Maddes end Mod_LoadNodes (&header->lumps[LUMP_NODES]); Mod_LoadClipnodes (&header->lumps[LUMP_CLIPNODES]); Mod_LoadEntities (&header->lumps[LUMP_ENTITIES], brush_fileinfo); // 2001-09-12 .ENT support by Maddes Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]); Mod_MakeHull0 (); mod->numframes = 2; // regular and alternate animation #ifndef GLQUAKE mod->flags = 0; #endif // // set up the submodels (FIXME: this is confusing) // for (i=0 ; i<mod->numsubmodels ; i++) { bm = &mod->submodels[i]; mod->hulls[0].firstclipnode = bm->headnode[0]; for (j=1 ; j<MAX_MAP_HULLS ; j++) { mod->hulls[j].firstclipnode = bm->headnode[j]; mod->hulls[j].lastclipnode = mod->numclipnodes-1; } mod->firstmodelsurface = bm->firstface; mod->nummodelsurfaces = bm->numfaces; VectorCopy (bm->maxs, mod->maxs); VectorCopy (bm->mins, mod->mins); mod->radius = RadiusFromBounds (mod->mins, mod->maxs); mod->numleafs = bm->visleafs; if (i < mod->numsubmodels-1) { // duplicate the basic information char name[10]; sprintf (name, "*%i", i+1); loadmodel = Mod_FindName (name); *loadmodel = *mod; strcpy (loadmodel->name, name); mod = loadmodel; } } // if (sv.worldmodel && !lightingavailable) // LoadPointLighting(sv.worldmodel->entities); }
/* ================= Mod_LoadBrushModel ================= */ void Mod_LoadBrushModel (model_t *mod, void *buffer) { int i, j; dheader_t *header; dmodel_t *bm; loadmodel->type = mod_brush; header = (dheader_t *)buffer; i = LittleLong (header->version); if (i != BSPVERSION) SV_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION); // swap all the lumps mod_base = (byte *)header; for (i=0 ; i<sizeof(dheader_t)/4 ; i++) ((int *)header)[i] = LittleLong ( ((int *)header)[i]); // load into heap mod->checksum = 0; mod->checksum2 = 0; // checksum all of the map, except for entities for (i = 0; i < HEADER_LUMPS; i++) { if (i == LUMP_ENTITIES) continue; mod->checksum ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, header->lumps[i].filelen)); if (i == LUMP_VISIBILITY || i == LUMP_LEAFS || i == LUMP_NODES) continue; mod->checksum2 ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs, header->lumps[i].filelen)); } Mod_LoadPlanes (&header->lumps[LUMP_PLANES]); Mod_LoadVisibility (&header->lumps[LUMP_VISIBILITY]); Mod_LoadLeafs (&header->lumps[LUMP_LEAFS]); Mod_LoadNodes (&header->lumps[LUMP_NODES]); Mod_LoadClipnodes (&header->lumps[LUMP_CLIPNODES]); Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]); Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]); Mod_MakeHull0 (); mod->numframes = 2; // regular and alternate animation // // set up the submodels (FIXME: this is confusing) // for (i=0 ; i<mod->numsubmodels ; i++) { bm = &mod->submodels[i]; mod->hulls[0].firstclipnode = bm->headnode[0]; for (j=1 ; j<MAX_MAP_HULLS ; j++) { mod->hulls[j].firstclipnode = bm->headnode[j]; mod->hulls[j].lastclipnode = mod->numclipnodes-1; } VectorCopy (bm->maxs, mod->maxs); VectorCopy (bm->mins, mod->mins); mod->numleafs = bm->visleafs; if (i < mod->numsubmodels-1) { // duplicate the basic information char name[10]; sprintf (name, "*%i", i+1); loadmodel = Mod_FindName (name); *loadmodel = *mod; strcpy (loadmodel->name, name); mod = loadmodel; } } }
/* ================== CL_ParseServerInfo ================== */ static void CL_ParseServerInfo (void) { const char *str; int i; int nummodels, numsounds; char model_precache[MAX_MODELS][MAX_QPATH]; char sound_precache[MAX_SOUNDS][MAX_QPATH]; // rjr edict_t *ent; Con_DPrintf ("Serverinfo packet received.\n"); // // wipe the client_state_t struct // CL_ClearState (); // parse protocol version number cl_protocol = MSG_ReadLong (); switch (cl_protocol) { case PROTOCOL_RAVEN_111: case PROTOCOL_RAVEN_112: case PROTOCOL_UQE_113: Con_Printf ("\nServer using protocol %i\n", cl_protocol); break; default: Con_Printf ("\nServer returned version %i, not %i or %i\n", cl_protocol, PROTOCOL_RAVEN_112, PROTOCOL_UQE_113); return; } // parse maxclients cl.maxclients = MSG_ReadByte (); if (cl.maxclients < 1 || cl.maxclients > MAX_CLIENTS) { Con_Printf("Bad maxclients (%d) from server\n", cl.maxclients); return; } cl.scores = (scoreboard_t *) Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores"); // parse gametype cl.gametype = MSG_ReadByte (); if (cl.gametype == GAME_DEATHMATCH && cl_protocol > PROTOCOL_RAVEN_111) sv_kingofhill = MSG_ReadShort (); // parse signon message str = MSG_ReadString (); q_strlcpy (cl.levelname, str, sizeof(cl.levelname)); // seperate the printfs so the server message can have a color Con_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n"); 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 // // precache models memset (cl.model_precache, 0, sizeof(cl.model_precache)); for (nummodels = 1 ; ; nummodels++) { str = MSG_ReadString (); if (!str[0]) break; if (nummodels == MAX_MODELS) { Con_Printf ("Server sent too many model precaches\n"); return; } q_strlcpy (model_precache[nummodels], str, MAX_QPATH); Mod_TouchModel (str); } // precache sounds memset (cl.sound_precache, 0, sizeof(cl.sound_precache)); for (numsounds = 1 ; ; numsounds++) { str = MSG_ReadString (); if (!str[0]) break; if (numsounds == MAX_SOUNDS) { Con_Printf ("Server sent too many sound precaches\n"); return; } q_strlcpy (sound_precache[numsounds], str, MAX_QPATH); S_TouchSound (str); } // // now we try to load everything else until a cache allocation fails // if (precache.integer) { total_loading_size = nummodels + numsounds; current_loading_size = 1; loading_stage = 2; } // copy the naked name of the map file to the cl structure COM_StripExtension (COM_SkipPath(model_precache[1]), cl.mapname, sizeof(cl.mapname)); //always precache the world!!! cl.model_precache[1] = Mod_ForName (model_precache[1], false); for (i = 2; i < nummodels; i++) { if (precache.integer) { cl.model_precache[i] = Mod_ForName (model_precache[i], false); current_loading_size++; D_ShowLoadingSize(); } else cl.model_precache[i] = (model_t *)Mod_FindName (model_precache[i]); if (cl.model_precache[i] == NULL) { Host_Error("Model %s not found", model_precache[i]); return; } CL_KeepaliveMessage (); } player_models[0] = (model_t *)Mod_FindName ("models/paladin.mdl"); // Note: old demo doesnt have necro and crusader classes. add // a GAME_OLD_DEMO flag check ? player_models[1] = (model_t *)Mod_FindName ("models/crusader.mdl"); player_models[2] = (model_t *)Mod_FindName ("models/necro.mdl"); player_models[3] = (model_t *)Mod_FindName ("models/assassin.mdl"); if (gameflags & GAME_PORTALS) player_models[4] = (model_t *)Mod_FindName ("models/succubus.mdl"); S_BeginPrecaching (); for (i = 1; i < numsounds; i++) { cl.sound_precache[i] = S_PrecacheSound (sound_precache[i]); if (precache.integer) { current_loading_size++; D_ShowLoadingSize(); } CL_KeepaliveMessage (); } S_EndPrecaching (); total_loading_size = 0; loading_stage = 0; // local state cl_entities[0].model = cl.worldmodel = cl.model_precache[1]; R_NewMap (); if (!sv.active) { PR_LoadStrings(); } PR_LoadPuzzleStrings(); // mission pack, objectives strings if (gameflags & GAME_PORTALS) PR_LoadInfoStrings(); Hunk_Check (); // make sure nothing is hurt // we connected to the server, make sure the mouse is going - S.A. menu_disabled_mouse = false; IN_ActivateMouse(); }
/* ================== CL_ParseServerInfo ================== */ void CL_ParseServerInfo (void) { char *str; int i; int nummodels, numsounds; static char model_precache[MAX_MODELS][MAX_QPATH]; static char sound_precache[MAX_SOUNDS][MAX_QPATH]; Con_DPrintf ("Serverinfo packet received.\n"); // // wipe the client_state_t struct // CL_ClearState (); // parse protocol version number i = MSG_ReadLong (); if (i != PROTOCOL_VERSION) { Con_Printf ("Server returned version %i, not %i", i, PROTOCOL_VERSION); return; } // parse maxclients cl.maxclients = MSG_ReadByte (); if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD) { Con_Printf("Bad maxclients (%u) from server\n", cl.maxclients); return; } cl.scores = Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores"); // parse gametype cl.gametype = MSG_ReadByte (); if (cl.gametype == GAME_DEATHMATCH) sv_kingofhill = MSG_ReadShort (); // parse signon message str = MSG_ReadString (); strncpy (cl.levelname, str, sizeof(cl.levelname)-1); // seperate the printfs so the server message can have a color Con_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n"); 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 // // precache models memset (cl.model_precache, 0, sizeof(cl.model_precache)); for (nummodels=1 ; ; nummodels++) { str = MSG_ReadString (); if (!str[0]) break; if (nummodels==MAX_MODELS) { Con_Printf ("Server sent too many model precaches\n"); return; } strcpy (model_precache[nummodels], str); Mod_TouchModel (str); } // precache sounds memset (cl.sound_precache, 0, sizeof(cl.sound_precache)); for (numsounds=1 ; ; numsounds++) { str = MSG_ReadString (); if (!str[0]) break; if (numsounds==MAX_SOUNDS) { Con_Printf ("Server sent too many sound precaches\n"); return; } strcpy (sound_precache[numsounds], str); S_TouchSound (str); } // // now we try to load everything else until a cache allocation fails // if (precache.value) { total_loading_size = nummodels + numsounds; current_loading_size = 1; loading_stage = 2; } //always precache the world!!! cl.model_precache[1] = Mod_ForName (model_precache[1], false); for (i=2 ; i<nummodels ; i++) { if (precache.value) { cl.model_precache[i] = Mod_ForName (model_precache[i], false); current_loading_size++; //SCR_DrawLoading(); //D_ShowLoadingSize(); } else cl.model_precache[i] = (model_t *)Mod_FindName (model_precache[i]); if (cl.model_precache[i] == NULL) { Con_Printf("Model %s not found\n", model_precache[i]); return; } CL_KeepaliveMessage (); } player_models[0] = (model_t *)Mod_FindName ("models/paladin.mdl"); player_models[1] = (model_t *)Mod_FindName ("models/crusader.mdl"); player_models[2] = (model_t *)Mod_FindName ("models/necro.mdl"); player_models[3] = (model_t *)Mod_FindName ("models/assassin.mdl"); #ifndef NO_PRAVEUS player_models[4] = (model_t *)Mod_FindName ("models/succubus.mdl"); #endif S_BeginPrecaching (); for (i=1 ; i<numsounds ; i++) { cl.sound_precache[i] = S_PrecacheSound (sound_precache[i]); if (precache.value) { current_loading_size++; //SCR_DrawLoading(); //D_ShowLoadingSize(); } CL_KeepaliveMessage (); } S_EndPrecaching (); total_loading_size = 0; loading_stage = 0; // local state cl_entities[0].model = cl.worldmodel = cl.model_precache[1]; R_NewMap (); puzzle_strings = (char *)COM_LoadHunkFile ("puzzles.txt"); Hunk_Check (); // make sure nothing is hurt noclip_anglehack = false; // noclip is turned off at start }
/* ================= Mod_LoadBrushModel ================= */ void Mod_LoadBrushModel (model_t *mod, void *buffer) { int i, j, maxhulls; dheader_t *header; mmodel_t *bm; extern cvar_t host_mapname; loadmodel->type = mod_brush; header = (dheader_t *)buffer; #ifdef BSP23TEST mod_bspversion = #endif i = LittleLong (header->version); if ((i != BSPVERSION) && (i != BSPVERSION-1)) // JDH: bsps from v0.8 beta work fine too // Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION); #ifdef BSP23TEST if (i != 23) #endif { Con_Printf ("Mod_LoadBrushModel: %s has wrong version number %i (should be %i)\n", mod->name, i, BSPVERSION); mod->numsubmodels = -1; // HACK - incorrect BSP version is no longer fatal return; } loadmodel->isworldmodel = COM_FilenamesEqual (loadmodel->name, va("maps/%s.bsp", host_mapname.string)); if (loadmodel->isworldmodel) mod_oversized = false; // swap all the lumps mod_base = (byte *)header; #ifdef BSP23TEST if (mod_bspversion == 23) { for (i=0 ; i<sizeof(dheader_t)/4 - 8 ; i++) ((int *)header)[i] = LittleLong (((int *)header)[i]); Mod_LoadPlanes (&header->lumps[LUMP_PLANES]); #ifndef RQM_SV_ONLY Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]); Mod_LoadEdges (&header->lumps[LUMP_EDGES-1]); Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES-1]); Mod_LoadTextures (&header->lumps[LUMP_TEXTURES]); Mod_LoadLighting (&header->lumps[LUMP_LIGHTING-1]); // Mod_LoadTexinfo (&header->lumps[LUMP_TEXINFO]); Mod_LoadFaces (&header->lumps[LUMP_FACES-1]); Mod_LoadMarksurfaces (&header->lumps[LUMP_MARKSURFACES-1]); #endif Mod_LoadVisibility (&header->lumps[LUMP_VISIBILITY]); Mod_LoadLeafs (&header->lumps[LUMP_LEAFS-1]); Mod_LoadNodes (&header->lumps[LUMP_NODES]); Mod_LoadClipnodes (&header->lumps[LUMP_CLIPNODES-1]); Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]); Mod_LoadSubmodels (&header->lumps[LUMP_MODELS-1]); } else #endif { for (i=0 ; i<sizeof(dheader_t)/4 ; i++) ((int *)header)[i] = LittleLong (((int *)header)[i]); // load into heap Mod_LoadPlanes (&header->lumps[LUMP_PLANES]); #ifndef RQM_SV_ONLY Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]); Mod_LoadEdges (&header->lumps[LUMP_EDGES]); Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]); Mod_LoadTextures (&header->lumps[LUMP_TEXTURES]); Mod_LoadLighting (&header->lumps[LUMP_LIGHTING]); Mod_LoadTexinfo (&header->lumps[LUMP_TEXINFO]); Mod_LoadFaces (&header->lumps[LUMP_FACES]); Mod_LoadMarksurfaces (&header->lumps[LUMP_MARKSURFACES]); #endif Mod_LoadVisibility (&header->lumps[LUMP_VISIBILITY]); Mod_LoadLeafs (&header->lumps[LUMP_LEAFS]); Mod_LoadNodes (&header->lumps[LUMP_NODES]); Mod_LoadClipnodes (&header->lumps[LUMP_CLIPNODES]); Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]); Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]); } Mod_MakeHull0 (); if (loadmodel->isworldmodel && mod_oversized) Mod_RecalcNodeBounds (); #ifndef RQM_SV_ONLY mod->numframes = 2; // regular and alternate animation #endif #ifdef HEXEN2_SUPPORT if (hexen2) maxhulls = MAX_MAP_HULLS_H2; else #endif maxhulls = MAX_MAP_HULLS; // set up the submodels (FIXME: this is confusing) for (i = 0 ; i < mod->numsubmodels ; i++) { bm = &mod->submodels[i]; mod->hulls[0].firstclipnode = bm->headnode[0]; for (j=1 ; j<maxhulls ; j++) { mod->hulls[j].firstclipnode = bm->headnode[j]; mod->hulls[j].lastclipnode = mod->numclipnodes - 1; } mod->firstmodelsurface = bm->firstface; mod->nummodelsurfaces = bm->numfaces; VectorCopy (bm->maxs, mod->maxs); VectorCopy (bm->mins, mod->mins); #ifndef RQM_SV_ONLY mod->radius = RadiusFromBounds (mod->mins, mod->maxs); #endif mod->numleafs = bm->visleafs; if (i < mod->numsubmodels - 1) { // duplicate the basic information char name[10]; sprintf (name, "*%i", i+1); loadmodel = Mod_FindName (name); *loadmodel = *mod; Q_strcpy (loadmodel->name, name, sizeof(loadmodel->name)); mod = loadmodel; } } /**********JDH************/ // can't do this in Mod_LoadLeafs, since the "loadmodel" at that time // is not what becomes the worldmodel /*if ( origmod->isworldmodel ) { Mod_DecompressVis( mod ); }*/ /**********JDH************/ }