From 464215e882e3435603a848f82e19508cb5eadae0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 27 Sep 2000 16:03:12 +0000 Subject: [PATCH] fix loading alias models with multiple skins and/or skin groups in software mode. --- source/sw_model_alias.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/source/sw_model_alias.c b/source/sw_model_alias.c index 72585ec..042a255 100644 --- a/source/sw_model_alias.c +++ b/source/sw_model_alias.c @@ -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 ; itype == 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 ; iinterval); 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 ; jskindescs[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)