fix loading alias models with multiple skins and/or skin groups in software

mode.
This commit is contained in:
Bill Currie 2000-09-27 16:03:12 +00:00
parent 111791e0f6
commit 464215e882

View file

@ -94,7 +94,7 @@ Mod_LoadAllSkins
*/
void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
{
int i, j;
int snum, gnum, t;
int skinsize;
byte *skin;
int groupskins;
@ -114,20 +114,18 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
loadname);
pheader->skindesc = (byte *)pskindesc - (byte *)pheader;
for (i=0 ; i<numskins ; i++)
for (snum=0 ; snum<numskins ; snum++)
{
if (pskintype->type == ALIAS_SKIN_SINGLE) {
skin+=4;
skin = Mod_LoadSkin (skin, skinsize, &pskindesc[i].skin, i, 0);
skin = Mod_LoadSkin (skin, skinsize, &pskindesc[snum].skin, snum, 0);
} else {
pskintype++;
pinskingroup = (daliasskingroup_t *)pskintype;
groupskins = LittleLong (pinskingroup->numskins);
j = sizeof (maliasskingroup_t) +
(groupskins - 1) * sizeof (paliasskingroup->skindescs[0]);
j = (int)&((maliasskingroup_t*)0)->skindescs[groupskins];
paliasskingroup = Hunk_AllocName (j, loadname);
t = (int)&((maliasskingroup_t*)0)->skindescs[groupskins];
paliasskingroup = Hunk_AllocName (t, loadname);
paliasskingroup->numskins = groupskins;
*pskinindex = (byte *)paliasskingroup - (byte *)pheader;
@ -135,7 +133,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
pinskinintervals = (daliasskininterval_t *)(pinskingroup + 1);
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),loadname);
paliasskingroup->intervals = (byte *)poutskinintervals - (byte *)pheader;
for (i=0 ; i<groupskins ; i++) {
for (gnum=0 ; gnum<groupskins ; gnum++) {
*poutskinintervals = LittleFloat (pinskinintervals->interval);
if (*poutskinintervals <= 0)
Sys_Error ("Mod_LoadAliasSkinGroup: interval<=0");
@ -147,14 +145,15 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
pskintype = (void *)pinskinintervals;
skin = (byte *)pskintype;
for (j=0 ; j<groupskins ; j++)
for (gnum=0 ; gnum<groupskins ; gnum++)
{
skin = Mod_LoadSkin (skin, skinsize, &paliasskingroup->skindescs[i].skin, i, j);
skin = Mod_LoadSkin (skin, skinsize, &paliasskingroup->skindescs[snum].skin, snum, gnum);
}
}
pskintype = (void*)skin;
}
return (void *)skin;
return pskintype;
}
void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)