mirror of https://github.com/ZDoom/gzdoom.git
Do the same for Visual Thinkers
This commit is contained in:
parent
7eab519795
commit
3bd80ab8f6
|
@ -984,7 +984,7 @@ bool FTextureAnimator::InitStandaloneAnimation(FStandaloneAnimation &animInfo, F
|
||||||
{
|
{
|
||||||
FAnimDef * anim;
|
FAnimDef * anim;
|
||||||
animInfo.ok = false;
|
animInfo.ok = false;
|
||||||
for(int i = 0; i < mAnimations.Size(); i++)
|
for(unsigned i = 0; i < mAnimations.Size(); i++)
|
||||||
{
|
{
|
||||||
if(mAnimations[i].BasePic == tex)
|
if(mAnimations[i].BasePic == tex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1024,6 +1024,7 @@ void DVisualThinker::Construct()
|
||||||
cursector = nullptr;
|
cursector = nullptr;
|
||||||
PT.color = 0xffffff;
|
PT.color = 0xffffff;
|
||||||
spr = new HWSprite();
|
spr = new HWSprite();
|
||||||
|
AnimatedTexture.SetNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
DVisualThinker::DVisualThinker()
|
DVisualThinker::DVisualThinker()
|
||||||
|
@ -1078,6 +1079,11 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, SpawnVisualThinker, SpawnVisualThink
|
||||||
void DVisualThinker::UpdateSpriteInfo()
|
void DVisualThinker::UpdateSpriteInfo()
|
||||||
{
|
{
|
||||||
PT.style = ERenderStyle(GetRenderStyle());
|
PT.style = ERenderStyle(GetRenderStyle());
|
||||||
|
if((PT.flags & SPF_STANDALONE_ANIMATIONS) && PT.texture != AnimatedTexture)
|
||||||
|
{
|
||||||
|
AnimatedTexture = PT.texture;
|
||||||
|
TexAnim.InitStandaloneAnimation(PT.animData, PT.texture, Level->maptime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This runs just like Actor's, make sure to call Super.Tick() in ZScript.
|
// This runs just like Actor's, make sure to call Super.Tick() in ZScript.
|
||||||
|
|
|
@ -163,6 +163,7 @@ public:
|
||||||
float PrevRoll;
|
float PrevRoll;
|
||||||
int16_t LightLevel;
|
int16_t LightLevel;
|
||||||
FTranslationID Translation;
|
FTranslationID Translation;
|
||||||
|
FTextureID AnimatedTexture;
|
||||||
sector_t *cursector;
|
sector_t *cursector;
|
||||||
|
|
||||||
bool bXFlip,
|
bool bXFlip,
|
||||||
|
|
|
@ -1343,7 +1343,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool has_texture = particle->texture.isValid();
|
bool has_texture = particle->texture.isValid();
|
||||||
bool custom_animated_texture = has_texture && (particle->flags & SPF_STANDALONE_ANIMATIONS) && particle->animData.ok;
|
bool custom_animated_texture = (particle->flags & SPF_STANDALONE_ANIMATIONS) && particle->animData.ok;
|
||||||
|
|
||||||
int particle_style = has_texture ? 2 : gl_particles_style; // Treat custom texture the same as smooth particles
|
int particle_style = has_texture ? 2 : gl_particles_style; // Treat custom texture the same as smooth particles
|
||||||
|
|
||||||
|
@ -1442,11 +1442,21 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
|
||||||
void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t* sector)
|
void HWSprite::AdjustVisualThinker(HWDrawInfo* di, DVisualThinker* spr, sector_t* sector)
|
||||||
{
|
{
|
||||||
translation = spr->Translation;
|
translation = spr->Translation;
|
||||||
texture = TexMan.GetGameTexture(spr->PT.texture, true);
|
|
||||||
|
|
||||||
const auto& vp = di->Viewpoint;
|
const auto& vp = di->Viewpoint;
|
||||||
double timefrac = vp.TicFrac;
|
double timefrac = vp.TicFrac;
|
||||||
if (paused || spr->isFrozen() || spr->bDontInterpolate)
|
|
||||||
|
if (paused || spr->isFrozen())
|
||||||
|
timefrac = 0.;
|
||||||
|
|
||||||
|
bool custom_anim = ((spr->PT.flags & SPF_STANDALONE_ANIMATIONS) && spr->PT.animData.ok);
|
||||||
|
|
||||||
|
texture = TexMan.GetGameTexture(
|
||||||
|
custom_anim
|
||||||
|
? TexAnim.UpdateStandaloneAnimation(spr->PT.animData, di->Level->maptime + timefrac)
|
||||||
|
: spr->PT.texture, !custom_anim);
|
||||||
|
|
||||||
|
if (spr->bDontInterpolate)
|
||||||
timefrac = 0.;
|
timefrac = 0.;
|
||||||
|
|
||||||
FVector3 interp = spr->InterpolatedPosition(timefrac);
|
FVector3 interp = spr->InterpolatedPosition(timefrac);
|
||||||
|
|
Loading…
Reference in New Issue