- split animation management out of the texture manager into a separate class.

This commit is contained in:
Christoph Oelckers 2020-04-11 18:54:54 +02:00
commit be24023722
14 changed files with 394 additions and 345 deletions

View file

@ -47,6 +47,7 @@
#include "textures.h"
#include "actor.h"
#include "actorinlines.h"
#include "animations.h"
static FRandom pr_switchanim ("AnimSwitch");
@ -174,7 +175,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, const DVector3 *
if (open.range <= 0)
goto onesided;
if ((TexMan.FindSwitch(side->GetTexture(side_t::top))) != NULL)
if ((TexAnim.FindSwitch(side->GetTexture(side_t::top))) != NULL)
{
// Check 3D floors on back side
@ -198,7 +199,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, const DVector3 *
? (user->Top() >= open.top)
: (user->Top() > open.top);
}
else if ((TexMan.FindSwitch(side->GetTexture(side_t::bottom))) != NULL)
else if ((TexAnim.FindSwitch(side->GetTexture(side_t::bottom))) != NULL)
{
// Check 3D floors on back side
{
@ -222,7 +223,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, const DVector3 *
? (user->Z() <= open.bottom)
: (user->Z() < open.bottom);
}
else if ((flags & ML_3DMIDTEX) || (TexMan.FindSwitch(side->GetTexture(side_t::mid))) != NULL)
else if ((flags & ML_3DMIDTEX) || (TexAnim.FindSwitch(side->GetTexture(side_t::mid))) != NULL)
{
// 3DMIDTEX lines will force a mid texture check if no switch is found on this line
// to keep compatibility with Eternity's implementation.
@ -252,15 +253,15 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, uint8_t special, bool *q
int sound;
FSwitchDef *Switch;
if ((Switch = TexMan.FindSwitch (side->GetTexture(side_t::top))) != NULL)
if ((Switch = TexAnim.FindSwitch (side->GetTexture(side_t::top))) != NULL)
{
texture = side_t::top;
}
else if ((Switch = TexMan.FindSwitch (side->GetTexture(side_t::bottom))) != NULL)
else if ((Switch = TexAnim.FindSwitch (side->GetTexture(side_t::bottom))) != NULL)
{
texture = side_t::bottom;
}
else if ((Switch = TexMan.FindSwitch (side->GetTexture(side_t::mid))) != NULL)
else if ((Switch = TexAnim.FindSwitch (side->GetTexture(side_t::mid))) != NULL)
{
texture = side_t::mid;
}
@ -353,7 +354,7 @@ template<> FSerializer &Serialize (FSerializer &arc, const char *key, FSwitchDef
FTextureID tex;
tex.SetInvalid();
Serialize(arc, key, tex, nullptr);
Switch = TexMan.FindSwitch(tex);
Switch = TexAnim.FindSwitch(tex);
}
return arc;
}