From 7c12c9b4c7be5e477a0c11705df61d8d2f7f897f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 27 Sep 2000 17:01:17 +0000 Subject: [PATCH] hopefully fix alias model loading for multiple skins and/or skin groups --- source/gl_model_alias.c | 8 +++----- source/sw_model_alias.c | 25 +++++++++++-------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/source/gl_model_alias.c b/source/gl_model_alias.c index 5d036d5..e12a7a2 100644 --- a/source/gl_model_alias.c +++ b/source/gl_model_alias.c @@ -188,8 +188,6 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind daliasskingroup_t *pinskingroup; int groupskins; daliasskininterval_t *pinskinintervals; - - skin = (byte *)pskintype; if (numskins < 1 || numskins > MAX_SKINS) 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 ; itype == ALIAS_SKIN_SINGLE) { - skin+=4; + skin = (byte *)(pskintype+1); skin = Mod_LoadSkin (skin, skinsize, i, 0, false); 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]; } } + pskintype = (daliasskintype_t*)skin; } - return (void *)skin; + return pskintype; } /* @@ -271,7 +270,6 @@ void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame) return (void *)pinframe; } - /* ================= Mod_LoadAliasGroup diff --git a/source/sw_model_alias.c b/source/sw_model_alias.c index 4097844..d661250 100644 --- a/source/sw_model_alias.c +++ b/source/sw_model_alias.c @@ -95,7 +95,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; @@ -105,8 +105,6 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinind maliasskingroup_t *paliasskingroup; float *poutskinintervals; - skin = (byte *)pskintype; - if (numskins < 1 || numskins > MAX_SKINS) 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); 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 = (byte*)(pskintype+1); + 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; @@ -136,7 +132,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"); @@ -148,14 +144,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 = (daliasskintype_t*)skin; } - return (void *)skin; + return pskintype; } void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)