Skip to content

Commit

Permalink
- revert adding in the sprite/frame support for visual thinkers
Browse files Browse the repository at this point in the history
  • Loading branch information
madame-rachelle committed Nov 13, 2024
1 parent a0c1f5b commit ccd38af
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 28 deletions.
5 changes: 1 addition & 4 deletions src/playsim/p_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,6 @@ void DVisualThinker::Construct()
PT.subsector = nullptr;
cursector = nullptr;
PT.color = 0xffffff;
sprite = -1;
AnimatedTexture.SetNull();
}

Expand Down Expand Up @@ -1111,7 +1110,7 @@ void DVisualThinker::Tick()
return;

// There won't be a standard particle for this, it's only for graphics.
if (!PT.texture.isValid() && (sprite == -1))
if (!PT.texture.isValid())
{
Printf("No valid texture, destroyed");
Destroy();
Expand Down Expand Up @@ -1326,5 +1325,3 @@ DEFINE_FIELD(DVisualThinker, PrevRoll);
DEFINE_FIELD(DVisualThinker, Translation);
DEFINE_FIELD(DVisualThinker, LightLevel);
DEFINE_FIELD(DVisualThinker, cursector);
DEFINE_FIELD(DVisualThinker, sprite);
DEFINE_FIELD(DVisualThinker, frame);
2 changes: 1 addition & 1 deletion src/playsim/p_effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ struct SPortalHit
void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = nullAngle, int duration = TICRATE, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270, DAngle pitch = nullAngle);
void P_DrawSplash (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int kind);
void P_DrawSplash2 (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int updown, int kind);
void P_DisconnectEffect (AActor *actor);
void P_DisconnectEffect (AActor *actor);
2 changes: 0 additions & 2 deletions src/playsim/p_visualthinker.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class DVisualThinker : public DThinker
sector_t *cursector;

int flags;
int sprite; // used to find patch_t and flip value
uint8_t frame; // sprite frame to draw

// internal only variables
particle_t PT;
Expand Down
21 changes: 3 additions & 18 deletions src/rendering/hwrenderer/scene/hw_sprites.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ bool HWSprite::CalculateVertices(HWDrawInfo* di, FVector3* v, DVector3* vp)
const bool drawBillboardFacingCamera = hw_force_cambbpref ? gl_billboard_faces_camera :
gl_billboard_faces_camera
|| ((actor && (!(actor->renderflags2 & RF2_BILLBOARDNOFACECAMERA) && (actor->renderflags2 & RF2_BILLBOARDFACECAMERA)))
|| (particle && (!(particle->flags & SPF_NOFACECAMERA) && (particle->flags & SPF_FACECAMERA))));
|| (particle && particle->texture.isValid() && (!(particle->flags & SPF_NOFACECAMERA) && (particle->flags & SPF_FACECAMERA))));

// [Nash] has +ROLLSPRITE
const bool drawRollSpriteActor = (actor != nullptr && actor->renderflags & RF_ROLLSPRITE);
Expand Down Expand Up @@ -1409,10 +1409,8 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
if (!particle || particle->alpha <= 0)
return;

if (spr && spr->PT.texture.isNull() && (spr->sprite == -1))
{
if (spr && spr->PT.texture.isNull())
return;
}

lightlevel = hw_ClampLight(spr ? spr->GetLightLevel(sector) : sector->GetSpriteLight());
foglevel = (uint8_t)clamp<short>(sector->lightlevel, 0, 255);
Expand Down Expand Up @@ -1485,7 +1483,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
}
else
{
bool has_texture = particle->texture.isValid() || !!spr;
bool has_texture = particle->texture.isValid();
bool custom_animated_texture = (particle->flags & SPF_LOCAL_ANIM) && particle->animData.ok;

int particle_style = has_texture ? 2 : gl_particles_style; // Treat custom texture the same as smooth particles
Expand All @@ -1507,19 +1505,6 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s
else if(has_texture)
{
lump = particle->texture;
if (spr && !lump.isValid())
{
bool mirror = false;
DVector3 thingpos = (DVector3)spr->InterpolatedPosition(vp.TicFrac);
DAngle ang = (thingpos - vp.Pos).Angle();
if (di->Viewpoint.IsOrtho()) ang = vp.Angles.Yaw;

bool spriteflip = false; // !!(thing->renderflags & RF_SPRITEFLIP)

int rot;
rot = -1;
lump = sprites[spr->sprite].GetSpriteFrame(spr->frame, rot, ang, &mirror, spriteflip);
}
}
else
{
Expand Down
3 changes: 0 additions & 3 deletions wadsrc/static/zscript/visualthinker.zs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ Class VisualThinker : Thinker native
native void SetRenderStyle(int mode); // see ERenderStyle
native bool IsFrozen();

native SpriteID sprite;
native uint8 frame;

native protected void UpdateSector(); // needs to be called if the thinker is set to a non-ticking statnum and the position is modified (or if Tick is overriden and doesn't call Super.Tick())
native protected void UpdateSpriteInfo(); // needs to be called every time the texture is updated if the thinker uses SPF_LOCAL_ANIM and is set to a non-ticking statnum (or if Tick is overriden and doesn't call Super.Tick())

Expand Down

0 comments on commit ccd38af

Please sign in to comment.