mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 22:10:59 +00:00
models: ignore sprites/skins bigger than MAX_MD2SKINS
This commit is contained in:
parent
5c0883594f
commit
63d990487a
1 changed files with 19 additions and 6 deletions
|
@ -112,6 +112,14 @@ Mod_LoadMD2 (const char *mod_name, const void *buffer, int modfilelen,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (pheader->num_skins > MAX_MD2SKINS)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "%s has too many skins (%i > %i), "
|
||||
"extra sprites will be ignored\n",
|
||||
mod_name, pheader->num_skins, MAX_MD2SKINS);
|
||||
pheader->num_skins = MAX_MD2SKINS;
|
||||
}
|
||||
|
||||
//
|
||||
// load base s and t vertices (not used in gl version)
|
||||
//
|
||||
|
@ -212,7 +220,7 @@ SPRITE MODELS
|
|||
Mod_LoadSP2
|
||||
|
||||
support for .sp2 sprites
|
||||
====
|
||||
=================
|
||||
*/
|
||||
void *
|
||||
Mod_LoadSP2 (const char *mod_name, const void *buffer, int modfilelen,
|
||||
|
@ -239,9 +247,10 @@ Mod_LoadSP2 (const char *mod_name, const void *buffer, int modfilelen,
|
|||
|
||||
if (sprout->numframes > MAX_MD2SKINS)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "%s has too many frames (%i > %i)",
|
||||
R_Printf(PRINT_ALL, "%s has too many frames (%i > %i), "
|
||||
"extra frames will be ignored\n",
|
||||
mod_name, sprout->numframes, MAX_MD2SKINS);
|
||||
return NULL;
|
||||
sprout->numframes = MAX_MD2SKINS;
|
||||
}
|
||||
|
||||
/* byte swap everything */
|
||||
|
@ -279,7 +288,9 @@ Mod_ReLoadSkins(struct image_s **skins, findimage_t find_image, void *extradata,
|
|||
|
||||
sprout = (dsprite_t *)extradata;
|
||||
for (i=0; i < sprout->numframes; i++)
|
||||
{
|
||||
skins[i] = find_image(sprout->frames[i].name, it_sprite);
|
||||
}
|
||||
return sprout->numframes;
|
||||
}
|
||||
else if (type == mod_alias)
|
||||
|
@ -289,7 +300,9 @@ Mod_ReLoadSkins(struct image_s **skins, findimage_t find_image, void *extradata,
|
|||
|
||||
pheader = (dmdl_t *)extradata;
|
||||
for (i=0; i < pheader->num_skins; i++)
|
||||
{
|
||||
skins[i] = find_image ((char *)pheader + pheader->ofs_skins + i*MAX_SKINNAME, it_skin);
|
||||
}
|
||||
return pheader->num_frames;
|
||||
}
|
||||
/* Unknow format, no images associated with it */
|
||||
|
|
Loading…
Reference in a new issue