diff --git a/src/playsim/p_effect.cpp b/src/playsim/p_effect.cpp index 12e86a423..61c61c4d5 100644 --- a/src/playsim/p_effect.cpp +++ b/src/playsim/p_effect.cpp @@ -1006,6 +1006,7 @@ DZSprite::DZSprite() Translation = Flags = 0; sub = nullptr; cursector = nullptr; + scolor = 0xffffff; } void DZSprite::CallPostBeginPlay() @@ -1054,6 +1055,19 @@ DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, SpawnZSprite, SpawnZSprite) ACTION_RETURN_OBJECT(zs); } +void DZSprite::UpdateSpriteInfo() +{ + PT.color = scolor; + PT.Pos = Pos; + PT.Vel = Vel; + PT.Roll = Roll; + PT.alpha = Alpha; + PT.texture = Texture; + PT.style = ERenderStyle(GetRenderStyle()); + PT.flags = Flags; + PT.subsector = sub; + PT.sprite = this; +} // This runs just like Actor's, make sure to call Super.Tick() in ZScript. void DZSprite::Tick() @@ -1070,8 +1084,10 @@ void DZSprite::Tick() } if (isFrozen()) + { // needed here because it won't retroactively update like actors do. + UpdateSpriteInfo(); return; - + } Prev = Pos; PrevRoll = Roll; // Handle crossing a line portal @@ -1101,17 +1117,7 @@ void DZSprite::Tick() cursector = nullptr; } } - PT.color = 0xffffff; - PT.Pos = Pos; - PT.Vel = Vel; - PT.Roll = Roll; - PT.size = Scale.X; - PT.alpha = Alpha; - PT.texture = Texture; - PT.style = ERenderStyle(GetRenderStyle()); - PT.flags = Flags; - PT.subsector = sub; - PT.sprite = this; + UpdateSpriteInfo(); } int DZSprite::GetLightLevel(sector_t* rendersector) const @@ -1218,6 +1224,7 @@ void DZSprite::Serialize(FSerializer& arc) ("style", Style) ("translation", Translation) ("cursector", cursector) + ("scolor", scolor) ("flipx", bXFlip) ("flipy", bYFlip) ("dontinterpolate", bDontInterpolate) @@ -1239,6 +1246,7 @@ DEFINE_FIELD(DZSprite, Texture); DEFINE_FIELD(DZSprite, Translation); DEFINE_FIELD(DZSprite, Flags); DEFINE_FIELD(DZSprite, LightLevel); +DEFINE_FIELD(DZSprite, scolor); DEFINE_FIELD(DZSprite, cursector); DEFINE_FIELD(DZSprite, bXFlip); DEFINE_FIELD(DZSprite, bYFlip); diff --git a/src/playsim/p_effect.h b/src/playsim/p_effect.h index 4ae9c8713..d0a0ed883 100644 --- a/src/playsim/p_effect.h +++ b/src/playsim/p_effect.h @@ -155,6 +155,8 @@ public: double Roll, PrevRoll, Alpha; int16_t LightLevel; + int scolor; + FRenderStyle Style; FTextureID Texture; uint32_t Translation; @@ -186,6 +188,7 @@ public: float InterpolatedRoll(double ticFrac) const; void Tick() override; + void UpdateSpriteInfo(); void Serialize(FSerializer& arc) override; }; diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index 204425ee7..548cd5ad2 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -1410,7 +1410,9 @@ void HWSprite::ProcessParticle (HWDrawInfo *di, particle_t *particle, sector_t * rendered_sprites++; } -// [MC] ZSprites are to be rendered akin to actor sprites. +// [MC] ZSprites are to be rendered akin to actor sprites. The reason this whole system +// is hitching a ride on particle_t is because of the large number of checks with +// HWSprite elsewhere in the draw lists. void HWSprite::AdjustZSprite(HWDrawInfo* di, DZSprite* spr, sector_t* sector) { translation = spr->Translation; diff --git a/wadsrc/static/zscript/zsprite.zs b/wadsrc/static/zscript/zsprite.zs index 24360b6de..a4b259585 100644 --- a/wadsrc/static/zscript/zsprite.zs +++ b/wadsrc/static/zscript/zsprite.zs @@ -10,6 +10,7 @@ Class ZSprite : Thinker native native bool bXFlip, bYFlip, bDontInterpolate, bAddLightLevel; + native Color scolor; native Sector CurSector; // can be null!