mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
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:
parent
4e8d59951b
commit
046799db68
4 changed files with 2 additions and 69 deletions
|
@ -669,22 +669,11 @@ public:
|
||||||
DVector3 Offset;
|
DVector3 Offset;
|
||||||
int Flags;
|
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
|
// Functions
|
||||||
FViewPosition()
|
FViewPosition()
|
||||||
{
|
{
|
||||||
Offset = PlrPos = CamPos = { 0,0,0 };
|
Offset = { 0,0,0 };
|
||||||
isUsed = false;
|
Flags = 0;
|
||||||
Distance = 0.0;
|
|
||||||
CamSec = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Set(DVector3 &off, int f = -1)
|
void Set(DVector3 &off, int f = -1)
|
||||||
|
@ -699,16 +688,6 @@ public:
|
||||||
{
|
{
|
||||||
return Offset.isZero();
|
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;
|
const double MinVel = EQUAL_EPSILON;
|
||||||
|
|
|
@ -5441,43 +5441,8 @@ void P_AdjustViewPos(AActor *t1, DVector3 orig, DVector3 &campos, sector_t *&Cam
|
||||||
{
|
{
|
||||||
campos = trace.HitPos - trace.HitVector * 1 / 256.;
|
campos = trace.HitPos - trace.HitVector * 1 / 256.;
|
||||||
}
|
}
|
||||||
// DVector3 cpos = campos;
|
|
||||||
CameraSector = trace.Sector;
|
CameraSector = trace.Sector;
|
||||||
unlinked = trace.unlinked;
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -734,12 +734,6 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
||||||
DVector3 thingorigin = thing->Pos();
|
DVector3 thingorigin = thing->Pos();
|
||||||
if (thruportal == 1) thingorigin += di->Level->Displacements.getOffset(thing->Sector->PortalGroup, sector->PortalGroup);
|
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;
|
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.
|
// Thing is invisible if close to the camera.
|
||||||
if (thing->renderflags & RF_MAYBEINVISIBLE)
|
if (thing->renderflags & RF_MAYBEINVISIBLE)
|
||||||
|
|
|
@ -794,7 +794,6 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
||||||
{
|
{
|
||||||
AActor *mo = viewpoint.camera;
|
AActor *mo = viewpoint.camera;
|
||||||
FViewPosition *VP = mo->ViewPos;
|
FViewPosition *VP = mo->ViewPos;
|
||||||
if (VP) VP->ResetTraceInfo();
|
|
||||||
const DVector3 orig = { mo->Pos().XY(), mo->player ? mo->player->viewz : mo->Z() + mo->GetCameraHeight() };
|
const DVector3 orig = { mo->Pos().XY(), mo->player ? mo->player->viewz : mo->Z() + mo->GetCameraHeight() };
|
||||||
viewpoint.ActorPos = orig;
|
viewpoint.ActorPos = orig;
|
||||||
|
|
||||||
|
@ -880,10 +879,6 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor
|
||||||
viewpoint.NoPortalPath = true;
|
viewpoint.NoPortalPath = true;
|
||||||
P_AdjustViewPos(mo, orig, next, viewpoint.sector, unlinked, VP);
|
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))
|
if (viewpoint.sector->PortalGroup != oldsector->PortalGroup || (unlinked && ((iview->New.Pos.XY() - iview->Old.Pos.XY()).LengthSquared()) > 256 * 256))
|
||||||
{
|
{
|
||||||
iview->otic = nowtic;
|
iview->otic = nowtic;
|
||||||
|
|
Loading…
Reference in a new issue