if (buf)
{
+ char *bufend = (char *)buf + fs_filesize;
num = LittleLong(*((int *)buf));
// call the apropriate loader
loadmodel = mod;
- if (!memcmp(buf, "IDPO", 4)) Mod_IDP0_Load(mod, buf);
- else if (!memcmp(buf, "IDP2", 4)) Mod_IDP2_Load(mod, buf);
- else if (!memcmp(buf, "IDP3", 4)) Mod_IDP3_Load(mod, buf);
- else if (!memcmp(buf, "IDSP", 4)) Mod_IDSP_Load(mod, buf);
- else if (!memcmp(buf, "IDS2", 4)) Mod_IDS2_Load(mod, buf);
- else if (!memcmp(buf, "IBSP", 4)) Mod_IBSP_Load(mod, buf);
- else if (!memcmp(buf, "ZYMOTICMODEL", 12)) Mod_ZYMOTICMODEL_Load(mod, buf);
- else if (strlen(mod->name) >= 4 && !strcmp(mod->name - 4, ".map")) Mod_MAP_Load(mod, buf);
- else if (num == BSPVERSION || num == 30) Mod_Q1BSP_Load(mod, buf);
+ if (!memcmp(buf, "IDPO", 4)) Mod_IDP0_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IDP2", 4)) Mod_IDP2_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IDP3", 4)) Mod_IDP3_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IDSP", 4)) Mod_IDSP_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IDS2", 4)) Mod_IDS2_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "IBSP", 4)) Mod_IBSP_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "ZYMOTICMODEL", 12)) Mod_ZYMOTICMODEL_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "DARKPLACESMODEL", 16)) Mod_DARKPLACESMODEL_Load(mod, buf, bufend);
+ else if (!strcmp(buf, "ACTRHEAD")) Mod_PSKMODEL_Load(mod, buf, bufend);
+ else if (strlen(mod->name) >= 4 && !strcmp(mod->name - 4, ".map")) Mod_MAP_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "MCBSP", 5)) Mod_Q1BSP_Load(mod, buf, bufend);
+ else if (num == BSPVERSION || num == 30) Mod_Q1BSP_Load(mod, buf, bufend);
else Con_Printf("Mod_LoadModel: model \"%s\" is of unknown/unsupported type\n", mod->name);
Mem_Free(buf);
}
}
#endif
-void Mod_ValidateElements(const int *elements, int numtriangles, int numverts, const char *filename, int fileline)
+void Mod_ValidateElements(int *elements, int numtriangles, int numverts, const char *filename, int fileline)
{
- int i;
+ int i, warned = false;
for (i = 0;i < numtriangles * 3;i++)
+ {
if ((unsigned int)elements[i] >= (unsigned int)numverts)
- Con_Printf("Mod_ValidateElements: out of bounds element detected at %s:%d\n", filename, fileline);
+ {
+ if (!warned)
+ {
+ warned = true;
+ Con_Printf("Mod_ValidateElements: out of bounds elements detected at %s:%d\n", filename, fileline);
+ }
+ elements[i] = 0;
+ }
+ }
}
// warning: this is an expensive function!
if (s.shirtpixels != NULL)
skinframe->shirt = R_LoadTexture2D (loadmodel->texturepool, va("%s_shirt", basename), s.shirtpixels_width, s.shirtpixels_height, s.shirtpixels, TEXTYPE_RGBA, textureflags, NULL);
}
+ if (!skinframe->base)
+ skinframe->base = r_texture_notexture;
+ if (!skinframe->nmap)
+ skinframe->nmap = r_texture_blanknormalmap;
image_freeskin(&s);
return true;
}
skinframe->base = GL_TextureForSkinLayer(skindata, width, height, va("%s_nospecial", basename), palette_nocolormap, textureflags); // no pants or shirt
}
}
+ if (!skinframe->nmap)
+ skinframe->nmap = r_texture_blanknormalmap;
return true;
}