Support animations

This commit is contained in:
Jaime Passos 2019-11-09 13:23:38 -03:00
parent 3e7be585ca
commit 78a0048ee4

View file

@ -138,6 +138,13 @@ static size_t maxanims;
static animdef_t *animdefs = NULL; static animdef_t *animdefs = NULL;
// Increase the size of animdefs to make room for a new animation definition
static void GrowAnimDefs(void)
{
maxanims++;
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
}
// A prototype; here instead of p_spec.h, so they're "private" // A prototype; here instead of p_spec.h, so they're "private"
void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum); void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum);
void P_ParseAnimationDefintion(SINT8 istexture); void P_ParseAnimationDefintion(SINT8 istexture);
@ -347,8 +354,7 @@ void P_ParseAnimationDefintion(SINT8 istexture)
if (i == maxanims) if (i == maxanims)
{ {
// Increase the size to make room for the new animation definition // Increase the size to make room for the new animation definition
maxanims++; GrowAnimDefs();
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
strncpy(animdefs[i].startname, animdefsToken, 9); strncpy(animdefs[i].startname, animdefsToken, 9);
} }
@ -434,8 +440,17 @@ void P_ParseAnimationDefintion(SINT8 istexture)
} }
animdefs[i].speed = animSpeed; animdefs[i].speed = animSpeed;
Z_Free(animdefsToken); Z_Free(animdefsToken);
}
#ifdef WALLFLATS
// hehe... uhh.....
if (!istexture)
{
GrowAnimDefs();
M_Memcpy(&animdefs[maxanims-1], &animdefs[i], sizeof(animdef_t));
animdefs[maxanims-1].istexture = 1;
}
#endif
}
/** Checks for flats in levelflats that are part of a flat animation sequence /** Checks for flats in levelflats that are part of a flat animation sequence
* and sets them up for animation. * and sets them up for animation.