hopefully fix alias model loading for multiple skins and/or skin groups

This commit is contained in:
Bill Currie 2000-09-27 17:01:17 +00:00
parent ae61fee723
commit 7c12c9b4c7
2 changed files with 14 additions and 19 deletions

View file

@ -188,8 +188,6 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
daliasskingroup_t *pinskingroup; daliasskingroup_t *pinskingroup;
int groupskins; int groupskins;
daliasskininterval_t *pinskinintervals; daliasskininterval_t *pinskinintervals;
skin = (byte *)pskintype;
if (numskins < 1 || numskins > MAX_SKINS) if (numskins < 1 || numskins > MAX_SKINS)
SV_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins); SV_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins);
@ -199,7 +197,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
for (i=0 ; i<numskins ; i++) for (i=0 ; i<numskins ; i++)
{ {
if (pskintype->type == ALIAS_SKIN_SINGLE) { if (pskintype->type == ALIAS_SKIN_SINGLE) {
skin+=4; skin = (byte *)(pskintype+1);
skin = Mod_LoadSkin (skin, skinsize, i, 0, false); skin = Mod_LoadSkin (skin, skinsize, i, 0, false);
for (j=1; j < 4; j++) { for (j=1; j < 4; j++) {
@ -231,9 +229,10 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
pheader->gl_fb_texturenum[i][j - k]; pheader->gl_fb_texturenum[i][j - k];
} }
} }
pskintype = (daliasskintype_t*)skin;
} }
return (void *)skin; return pskintype;
} }
/* /*
@ -271,7 +270,6 @@ void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
return (void *)pinframe; return (void *)pinframe;
} }
/* /*
================= =================
Mod_LoadAliasGroup Mod_LoadAliasGroup

View file

@ -95,7 +95,7 @@ Mod_LoadAllSkins
*/ */
void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex) void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex)
{ {
int i, j; int snum, gnum, t;
int skinsize; int skinsize;
byte *skin; byte *skin;
int groupskins; int groupskins;
@ -105,8 +105,6 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
maliasskingroup_t *paliasskingroup; maliasskingroup_t *paliasskingroup;
float *poutskinintervals; float *poutskinintervals;
skin = (byte *)pskintype;
if (numskins < 1 || numskins > MAX_SKINS) if (numskins < 1 || numskins > MAX_SKINS)
Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins); Sys_Error ("Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins);
@ -115,20 +113,18 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
loadname); loadname);
pheader->skindesc = (byte *)pskindesc - (byte *)pheader; pheader->skindesc = (byte *)pskindesc - (byte *)pheader;
for (i=0 ; i<numskins ; i++) for (snum=0 ; snum<numskins ; snum++)
{ {
if (pskintype->type == ALIAS_SKIN_SINGLE) { if (pskintype->type == ALIAS_SKIN_SINGLE) {
skin+=4; skin = (byte*)(pskintype+1);
skin = Mod_LoadSkin (skin, skinsize, &pskindesc[i].skin, i, 0); skin = Mod_LoadSkin (skin, skinsize, &pskindesc[snum].skin, snum, 0);
} else { } else {
pskintype++; pskintype++;
pinskingroup = (daliasskingroup_t *)pskintype; pinskingroup = (daliasskingroup_t *)pskintype;
groupskins = LittleLong (pinskingroup->numskins); groupskins = LittleLong (pinskingroup->numskins);
j = sizeof (maliasskingroup_t) + t = (int)&((maliasskingroup_t*)0)->skindescs[groupskins];
(groupskins - 1) * sizeof (paliasskingroup->skindescs[0]); paliasskingroup = Hunk_AllocName (t, loadname);
j = (int)&((maliasskingroup_t*)0)->skindescs[groupskins];
paliasskingroup = Hunk_AllocName (j, loadname);
paliasskingroup->numskins = groupskins; paliasskingroup->numskins = groupskins;
*pskinindex = (byte *)paliasskingroup - (byte *)pheader; *pskinindex = (byte *)paliasskingroup - (byte *)pheader;
@ -136,7 +132,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
pinskinintervals = (daliasskininterval_t *)(pinskingroup + 1); pinskinintervals = (daliasskininterval_t *)(pinskingroup + 1);
poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),loadname); poutskinintervals = Hunk_AllocName (groupskins * sizeof (float),loadname);
paliasskingroup->intervals = (byte *)poutskinintervals - (byte *)pheader; paliasskingroup->intervals = (byte *)poutskinintervals - (byte *)pheader;
for (i=0 ; i<groupskins ; i++) { for (gnum=0 ; gnum<groupskins ; gnum++) {
*poutskinintervals = LittleFloat (pinskinintervals->interval); *poutskinintervals = LittleFloat (pinskinintervals->interval);
if (*poutskinintervals <= 0) if (*poutskinintervals <= 0)
Sys_Error ("Mod_LoadAliasSkinGroup: interval<=0"); Sys_Error ("Mod_LoadAliasSkinGroup: interval<=0");
@ -148,14 +144,15 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind
pskintype = (void *)pinskinintervals; pskintype = (void *)pinskinintervals;
skin = (byte *)pskintype; 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 = (daliasskintype_t*)skin;
} }
return (void *)skin; return pskintype;
} }
void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr) void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)