- optimized storage for animation definitions.

Instead of allocating everything on the heap as single blocks, use a value TArray and allocate the frame arrays from the texture manager's memory arena, since lifetime of the data is identical.
Most importantly this avoids using a variable size array at the end of the struct.
This commit is contained in:
Christoph Oelckers 2022-07-17 10:14:37 +02:00
commit 6d635ce715
5 changed files with 44 additions and 48 deletions

View file

@ -102,11 +102,11 @@ static void AddToList(uint8_t *hitlist, FTextureID texid, int bitmask)
const auto addAnimations = [hitlist, bitmask](const FTextureID texid)
{
for (auto anim : TexAnim.GetAnimations())
for (auto& anim : TexAnim.GetAnimations())
{
if (texid == anim->BasePic || (!anim->bDiscrete && anim->BasePic < texid && texid < anim->BasePic + anim->NumFrames))
if (texid == anim.BasePic || (!anim.bDiscrete && anim.BasePic < texid && texid < anim.BasePic + anim.NumFrames))
{
for (int i = anim->BasePic.GetIndex(); i < anim->BasePic.GetIndex() + anim->NumFrames; i++)
for (int i = anim.BasePic.GetIndex(); i < anim.BasePic.GetIndex() + anim.NumFrames; i++)
{
hitlist[i] |= (uint8_t)bitmask;
}