Removed all attempts to stop the sprite from appearing in portals. This may likely require a fundamental breakdown of the system itself in order to address the problem.

This commit is contained in:
Major Cooke 2021-12-06 02:13:40 -06:00 committed by Rachael Alexanderson
parent 4e8d59951b
commit 046799db68
4 changed files with 2 additions and 69 deletions

View File

@ -669,22 +669,11 @@ public:
DVector3 Offset;
int Flags;
// Engine only.
// Used to do a backwards trace to disable rendering over portals.
bool isUsed;
DVector3 PlrPos,
CamPos;
double Distance;
sector_t *CamSec;
// Functions
FViewPosition()
{
Offset = PlrPos = CamPos = { 0,0,0 };
isUsed = false;
Distance = 0.0;
CamSec = nullptr;
Offset = { 0,0,0 };
Flags = 0;
}
void Set(DVector3 &off, int f = -1)
@ -699,16 +688,6 @@ public:
{
return Offset.isZero();
}
void ResetTraceInfo()
{
isUsed = false;
PlrPos = CamPos = {0,0,0};
Distance = 0.;
CamSec = nullptr;
}
bool TraceBack(AActor *Owner);
};
const double MinVel = EQUAL_EPSILON;

View File

@ -5441,43 +5441,8 @@ void P_AdjustViewPos(AActor *t1, DVector3 orig, DVector3 &campos, sector_t *&Cam
{
campos = trace.HitPos - trace.HitVector * 1 / 256.;
}
// DVector3 cpos = campos;
CameraSector = trace.Sector;
unlinked = trace.unlinked;
// Save the info for the renderers. Needed to disable sprites across portals.
VP->Distance = distance;
VP->isUsed = true;
}
struct EViewPosFinder
{
AActor *Owner;
};
static ETraceStatus TraceToOwner(FTraceResults &res, void *userdata)
{
// Try to guarantee hitting the owner if possible.
if (res.HitType != TRACE_HitActor)
return TRACE_Skip;
EViewPosFinder *data = (EViewPosFinder *)userdata;
ETraceStatus ret = (res.Actor == data->Owner) ? TRACE_Stop : TRACE_Skip;
return ret;
}
bool FViewPosition::TraceBack(AActor *Owner)
{
if (!isUsed || !Owner)
return false;
DVector3 vvec = (CamPos - PlrPos).Unit() * -1.0;
FTraceResults res;
EViewPosFinder TrcBack = {Owner};
bool ret = Trace(CamPos, CamSec, vvec, Distance, 0, 0, nullptr, res, TRACE_ReportPortals, TraceToOwner, &TrcBack);
return ret;
}
//==========================================================================

View File

@ -734,12 +734,6 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
DVector3 thingorigin = thing->Pos();
if (thruportal == 1) thingorigin += di->Level->Displacements.getOffset(thing->Sector->PortalGroup, sector->PortalGroup);
if (fabs(thingorigin.X - vp.ActorPos.X) < 2 && fabs(thingorigin.Y - vp.ActorPos.Y) < 2) return;
// Try to do an inverted trace to get to the camera's body. This way, we know exactly behind which line to disable.
// Currently doesn't work.
FViewPosition *vpos = camera->ViewPos;
if (vpos && vpos->TraceBack(camera))
return;
}
// Thing is invisible if close to the camera.
if (thing->renderflags & RF_MAYBEINVISIBLE)

View File

@ -794,7 +794,6 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
{
AActor *mo = viewpoint.camera;
FViewPosition *VP = mo->ViewPos;
if (VP) VP->ResetTraceInfo();
const DVector3 orig = { mo->Pos().XY(), mo->player ? mo->player->viewz : mo->Z() + mo->GetCameraHeight() };
viewpoint.ActorPos = orig;
@ -880,10 +879,6 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
viewpoint.NoPortalPath = true;
P_AdjustViewPos(mo, orig, next, viewpoint.sector, unlinked, VP);
VP->PlrPos = orig;
VP->CamPos = next;
VP->CamSec = viewpoint.sector;
if (viewpoint.sector->PortalGroup != oldsector->PortalGroup || (unlinked && ((iview->New.Pos.XY() - iview->Old.Pos.XY()).LengthSquared()) > 256 * 256))
{
iview->otic = nowtic;