// all models use memory, so allocate a memory pool
mod->mempool = Mem_AllocPool(mod->name, 0, NULL);
- // call the apropriate loader
+ // We need to have a reference to the base model in case we're parsing submodels
loadmodel = mod;
- // Try matching magic bytes.
+ // Call the appropriate loader. Try matching magic bytes.
for (i = 0; loader[i].Load; i++)
{
// Headerless formats can just load based on extension. Otherwise match the magic string.
void Mod_SetDrawSkyAndWater(model_t* mod)
{
- size_t j;
+ int j;
uint64_t basematerialflags = 0;
// by default assume there is no sky or water used in this model
mod->DrawSky = NULL;
{
// make an optimal set of texture-sorted batches to draw...
int j, k;
- Mod_MakeSortedSurfaces_qsortsurface_t *info = (Mod_MakeSortedSurfaces_qsortsurface_t*)R_FrameData_Alloc(mod->num_surfaces * sizeof(*info));
+ Mod_MakeSortedSurfaces_qsortsurface_t *info;
+
+ if(cls.state == ca_dedicated)
+ return;
+
+ info = (Mod_MakeSortedSurfaces_qsortsurface_t*)R_FrameData_Alloc(mod->num_surfaces * sizeof(*info));
if (!mod->modelsurfaces_sorted)
mod->modelsurfaces_sorted = (int *) Mem_Alloc(loadmodel->mempool, mod->num_surfaces * sizeof(*mod->modelsurfaces_sorted));
// the goal is to sort by submodel (can't change which submodel a surface belongs to), and then by effects and textures