Force use of external Zombie skins and override MDL loading

This commit is contained in:
Ian 2022-12-21 15:05:34 -05:00
parent c00c821ecb
commit 45257e7d73
2 changed files with 44 additions and 0 deletions

View file

@ -2448,11 +2448,29 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
}
}
qboolean model_is_zombie(char name[MAX_QPATH])
{
if (Q_strcmp(name, "models/ai/zbod.mdl") == 0 ||
Q_strcmp(name, "models/ai/zcbod.mdl") == 0 ||
Q_strcmp(name, "models/ai/zcfull.mdl") == 0 ||
Q_strcmp(name, "models/ai/zchead.mdl") == 0 ||
Q_strcmp(name, "models/ai/zclarm.mdl") == 0 ||
Q_strcmp(name, "models/ai/zcrarm.mdl") == 0 ||
Q_strcmp(name, "models/ai/zfull.mdl") == 0 ||
Q_strcmp(name, "models/ai/zhead.mdl") == 0 ||
Q_strcmp(name, "models/ai/zlarm.mdl") == 0 ||
Q_strcmp(name, "models/ai/zrarm.mdl") == 0)
return qtrue;
return qfalse;
}
/*
===============
Mod_LoadAllSkins
===============
*/
extern gltexture_t *zombie_skins[4];
void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
{
int i, j, k, size, groupskins;
@ -2474,6 +2492,24 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
if (loadmodel->flags & MF_HOLEY)
texflags |= TEXPREF_ALPHA;
if (model_is_zombie(loadmodel->name) == qtrue) {
Mod_FloodFillSkin(skin, pheader->skinwidth, pheader->skinheight);
// save 8 bit texels for the player model to remap
texels = (byte *) Hunk_AllocName(size, loadname);
pheader->texels[i] = texels - (byte *)pheader;
memcpy (texels, (byte *)(pskintype + 1), size);
// force-fill 4 skin slots
for (int i = 0; i < 4; i++) {
pheader->gltextures[i][0] = zombie_skins[i];
pheader->fbtextures[i][0] = NULL;
}
pskintype = (daliasskintype_t *)((byte *)(pskintype+1) + s);
return (void *)pskintype;
}
for (i=0 ; i<numskins ; i++)
{
if (pskintype->type == ALIAS_SKIN_SINGLE)

View file

@ -59,6 +59,8 @@ gltexture_t *decal_burn;
gltexture_t *decal_mark;
gltexture_t *decal_glow;
gltexture_t *zombie_skins[4];
/*
====================
@ -676,5 +678,11 @@ void R_InitOtherTextures (void)
decal_burn = loadtextureimage ("textures/decals/explo_burn01");
decal_mark = loadtextureimage ("textures/decals/particle_burn01");
decal_glow = loadtextureimage ("textures/decals/glow2");
// external zombie skins
zombie_skins[0] = loadtextureimage ("models/ai/zfull.mdl_0", 0, 0, qtrue, qtrue);
zombie_skins[1] = loadtextureimage ("models/ai/zfull.mdl_1", 0, 0, qtrue, qtrue);
zombie_skins[2] = loadtextureimage ("models/ai/zfull.mdl_2", 0, 0, qtrue, qtrue);
zombie_skins[3] = loadtextureimage ("models/ai/zfull.mdl_3", 0, 0, qtrue, qtrue);
}