From 242f341f5e65c808ce4a16c78da1a21b3589662a Mon Sep 17 00:00:00 2001 From: Ian Date: Thu, 7 Sep 2023 13:44:24 -0400 Subject: [PATCH] NX/VITA: Zombie skin variance --- source/gl_model.c | 29 +++++++++++++++++++++++------ source/r_alias.c | 4 ++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/source/gl_model.c b/source/gl_model.c index 9eb19ce..70125de 100644 --- a/source/gl_model.c +++ b/source/gl_model.c @@ -2571,6 +2571,28 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) if (loadmodel->flags & MF_HOLEY) texflags |= TEXPREF_ALPHA; + // Force-fill 4 Zombie Skins + if (model_is_zombie(loadmodel->name)) { + Mod_FloodFillSkin( skin, pheader->skinwidth, pheader->skinheight ); + + byte* zomb_data; + int zwidth = 0, zheight = 0; + + for(int j = 0; j < 4; j++) { + char filename[MAX_QPATH]; + q_snprintf(filename, sizeof(filename), "models/ai/zfull.mdl_%i", j); + zomb_data = Image_LoadImage(filename, &zwidth, &zheight); + pheader->gltextures[j][0] = TexMgr_LoadImage(loadmodel, filename, zwidth, zheight, + SRC_RGBA, zomb_data, filename, 0, TEXPREF_ALPHA|texflags|TEXPREF_MIPMAP); + pheader->fbtextures[j][0] = NULL; + pheader->gltextures[j][3] = pheader->gltextures[j][2] = pheader->gltextures[j][1] = pheader->gltextures[j][0]; + pheader->fbtextures[j][3] = pheader->fbtextures[j][2] = pheader->fbtextures[j][1] = pheader->fbtextures[j][0]; + } + + pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + size); + return (void *)pskintype; + } + for (i=0 ; itype == ALIAS_SKIN_SINGLE) @@ -2591,12 +2613,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype) qboolean malloced=false; enum srcformat fmt = SRC_RGBA; - if (model_is_zombie(loadmodel->name)) { - q_snprintf (filename, sizeof(filename), "models/ai/zfull.mdl_0", loadmodel->name); - } else { - q_snprintf (filename, sizeof(filename), "%s_%i", loadmodel->name, i); - } - + q_snprintf (filename, sizeof(filename), "%s_%i", loadmodel->name, i); data = Image_LoadImage (filename, &fwidth, &fheight); if (data) { diff --git a/source/r_alias.c b/source/r_alias.c index 441d183..70f751f 100644 --- a/source/r_alias.c +++ b/source/r_alias.c @@ -1053,7 +1053,7 @@ R_DrawAliasModel -- johnfitz -- almost completely rewritten */ //extern int doZHack; - +extern qboolean model_is_zombie(char name[MAX_QPATH]); void R_DrawAliasModel (entity_t *e) { aliashdr_t *paliashdr; @@ -1165,7 +1165,7 @@ void R_DrawAliasModel (entity_t *e) anim = (int)(cl.time*10) & 3; skinnum = e->skinnum; - if ((skinnum >= paliashdr->numskins) || (skinnum < 0)) + if (((skinnum >= paliashdr->numskins) || (skinnum < 0)) && !model_is_zombie(e->model->name)) { Con_DPrintf ("R_DrawAliasModel: no such skin # %d for '%s'\n", skinnum, e->model->name); // ericw -- display skin 0 for winquake compatibility