Revert "Show hitboxes even for invisible things (not sure if this is the most elegant solution; will revert this commit if I could come up with a better way)"

This reverts commit 1fc1f467a0.

(Revert note: the fix here is messy and incorrect. Roll the code back to a cleaner slate to help smoothen the merge with the pending GZDoom 4.14 update, THEN later figure out how to fix this properly)
This commit is contained in:
nashmuhandes 2024-12-10 17:14:12 +08:00
commit ca469e57ed

View file

@ -823,7 +823,7 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
bool isFogball = thing->IsKindOf(NAME_Fogball);
// Don't waste time projecting sprites that are definitely not visible.
if ((thing->sprite == 0 && !isPicnumOverride && !isFogball && !r_showhitbox) || !thing->IsVisibleToPlayer() || ((thing->renderflags & RF_MASKROTATION) && !thing->IsInsideVisibleAngles()))
if ((thing->sprite == 0 && !isPicnumOverride && !isFogball) || !thing->IsVisibleToPlayer() || ((thing->renderflags & RF_MASKROTATION) && !thing->IsInsideVisibleAngles()))
{
return;
}
@ -848,13 +848,10 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
const auto &vp = di->Viewpoint;
AActor *camera = vp.camera;
if (!r_showhitbox)
if (thing->renderflags & RF_INVISIBLE || !thing->RenderStyle.IsVisible(thing->Alpha))
{
if (thing->renderflags & RF_INVISIBLE || !thing->RenderStyle.IsVisible(thing->Alpha))
{
if (!(thing->flags & MF_STEALTH) || !di->isStealthVision() || thing == camera)
return;
}
if (!(thing->flags & MF_STEALTH) || !di->isStealthVision() || thing == camera)
return;
}
// check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature,
@ -881,19 +878,15 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
}
// [Nash] filter visibility in mirrors
if (!r_showhitbox)
bool isInMirror = di->mCurrentPortal && (di->mCurrentPortal->mState->MirrorFlag > 0 || di->mCurrentPortal->mState->PlaneMirrorFlag > 0);
if (thing->renderflags2 & RF2_INVISIBLEINMIRRORS && isInMirror)
{
bool isInMirror = di->mCurrentPortal && (di->mCurrentPortal->mState->MirrorFlag > 0 || di->mCurrentPortal->mState->PlaneMirrorFlag > 0);
if (thing->renderflags2 & RF2_INVISIBLEINMIRRORS && isInMirror)
{
return;
}
else if (thing->renderflags2 & RF2_ONLYVISIBLEINMIRRORS && !isInMirror)
{
return;
}
return;
}
else if (thing->renderflags2 & RF2_ONLYVISIBLEINMIRRORS && !isInMirror)
{
return;
}
// Some added checks if the camera actor is not supposed to be seen. It can happen that some portal setup has this actor in view in which case it may not be skipped here
if (viewmaster == camera && !vp.showviewer)
{
@ -940,7 +933,7 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
if (speed >= thing->target->radius / 2)
{
double clipdist = clamp(thing->Speed, thing->target->radius, thing->target->radius * 2);
if ((thingpos - vp.Pos).LengthSquared() < clipdist * clipdist && !r_showhitbox) return;
if ((thingpos - vp.Pos).LengthSquared() < clipdist * clipdist) return;
}
}
thing->flags7 |= MF7_FLYCHEAT; // do this only once for the very first frame, but not if it gets into range again.
@ -1004,7 +997,7 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
{
// Animate picnum overrides.
auto tex = TexMan.GetGameTexture(thing->picnum, true);
if (tex == nullptr && !r_showhitbox) return;
if (tex == nullptr) return;
if (tex->GetRotations() != 0xFFFF)
{
@ -1053,10 +1046,10 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
patch = sprites[spritenum].GetSpriteFrame(thing->frame, rot, sprangle, &mirror, !!(thing->renderflags & RF_SPRITEFLIP));
}
if (!patch.isValid() && !r_showhitbox) return;
if (!patch.isValid()) return;
int type = thing->renderflags & RF_SPRITETYPEMASK;
auto tex = TexMan.GetGameTexture(patch, false);
if ((!tex || !tex->isValid()) && !r_showhitbox) return;
if (!tex || !tex->isValid()) return;
auto& spi = tex->GetSpritePositioning(type == RF_FACESPRITE);
offx = (float)thing->GetSpriteOffset(false);
@ -1085,7 +1078,7 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
}
texture = tex;
if ((!texture || !texture->isValid()) && !r_showhitbox)
if (!texture || !texture->isValid())
return;
if (thing->renderflags & RF_SPRITEFLIP) // [SP] Flip back
@ -1413,7 +1406,7 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
hw_styleflags = STYLEHW_NoAlphaTest;
}
if (trans == 0.0f && !r_showhitbox) return;
if (trans == 0.0f) return;
// end of light calculation