mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-26 13:51:35 +00:00
- fixed some edge cases with visible player sprites through non-static line portals. This required reinstating some code which I thought was no longer needed.
This commit is contained in:
parent
76153dbccc
commit
fd0681edda
4 changed files with 42 additions and 2 deletions
|
@ -418,6 +418,7 @@ enum ActorRenderFlag
|
|||
RF_FLATSPRITE = 0x2000, // Flat sprite
|
||||
RF_VOXELSPRITE = 0x3000, // Voxel object
|
||||
RF_INVISIBLE = 0x8000, // Don't bother drawing this actor
|
||||
RF_MAYBEINVISIBLE = 0x10000,
|
||||
RF_ROLLSPRITE = 0x40000, //[marrub]roll the sprite billboard
|
||||
RF_DONTFLIP = 0x80000, // Don't flip it when viewed from behind.
|
||||
RF_ROLLCENTER = 0x00100000, // Rotate from the center of sprite instead of offsets
|
||||
|
|
|
@ -288,7 +288,9 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
savedAngle = ViewAngle;
|
||||
savedviewactor=GLRenderer->mViewActor;
|
||||
savedviewarea=in_area;
|
||||
savedvisibility = camera ? camera->renderflags & RF_INVISIBLE : ActorRenderFlags::FromInt(0);
|
||||
savedviewpath[0] = ViewPath[0];
|
||||
savedviewpath[1] = ViewPath[1];
|
||||
savedvisibility = camera ? camera->renderflags & RF_MAYBEINVISIBLE : ActorRenderFlags::FromInt(0);
|
||||
|
||||
|
||||
PrevPortal = GLRenderer->mCurrentPortal;
|
||||
|
@ -350,13 +352,15 @@ void GLPortal::End(bool usestencil)
|
|||
if (needdepth) FDrawInfo::EndDrawInfo();
|
||||
|
||||
// Restore the old view
|
||||
ViewPath[0] = savedviewpath[0];
|
||||
ViewPath[1] = savedviewpath[1];
|
||||
ViewPos = savedViewPos;
|
||||
r_showviewer = savedshowviewer;
|
||||
ViewActorPos = savedViewActorPos;
|
||||
ViewAngle = savedAngle;
|
||||
GLRenderer->mViewActor=savedviewactor;
|
||||
in_area=savedviewarea;
|
||||
if (camera != nullptr) camera->renderflags = (camera->renderflags & ~RF_INVISIBLE) | savedvisibility;
|
||||
if (camera != nullptr) camera->renderflags = (camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility;
|
||||
GLRenderer->SetupView(ViewPos.X, ViewPos.Y, ViewPos.Z, ViewAngle, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
|
||||
|
||||
{
|
||||
|
@ -1011,6 +1015,23 @@ void GLLineToLinePortal::DrawContents()
|
|||
P_TranslatePortalXY(origin, ViewActorPos.X, ViewActorPos.Y);
|
||||
P_TranslatePortalAngle(origin, ViewAngle);
|
||||
P_TranslatePortalZ(origin, ViewPos.Z);
|
||||
P_TranslatePortalXY(origin, ViewPath[0].X, ViewPath[0].Y);
|
||||
P_TranslatePortalXY(origin, ViewPath[1].X, ViewPath[1].Y);
|
||||
if (!r_showviewer && camera != nullptr && P_PointOnLineSidePrecise(ViewPath[0], glport->lines[0]->mDestination) != P_PointOnLineSidePrecise(ViewPath[1], glport->lines[0]->mDestination))
|
||||
{
|
||||
double distp = (ViewPath[0] - ViewPath[1]).Length();
|
||||
if (distp > EQUAL_EPSILON)
|
||||
{
|
||||
double dist1 = (ViewPos - ViewPath[0]).Length();
|
||||
double dist2 = (ViewPos - ViewPath[1]).Length();
|
||||
|
||||
if (dist1 + dist2 < distp + 1)
|
||||
{
|
||||
camera->renderflags |= RF_MAYBEINVISIBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SaveMapSection();
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ public:
|
|||
private:
|
||||
void DrawPortalStencil();
|
||||
|
||||
DVector3 savedviewpath[2];
|
||||
DVector3 savedViewPos;
|
||||
DVector3 savedViewActorPos;
|
||||
DAngle savedAngle;
|
||||
|
|
|
@ -677,6 +677,11 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
if (thruportal == 1) thingorigin += Displacements.getOffset(thing->Sector->PortalGroup, sector->PortalGroup);
|
||||
if (fabs(thingorigin.X - ViewActorPos.X) < 2 && fabs(thingorigin.Y - ViewActorPos.Y) < 2) return;
|
||||
}
|
||||
// Thing is invisible if close to the camera.
|
||||
if (thing->renderflags & RF_MAYBEINVISIBLE)
|
||||
{
|
||||
if (fabs(thingpos.X - ViewPos.X) < 32 && fabs(thingpos.Y - ViewPos.Y) < 32) return;
|
||||
}
|
||||
|
||||
// Too close to the camera. This doesn't look good if it is a sprite.
|
||||
if (fabs(thingpos.X - ViewPos.X) < 2 && fabs(thingpos.Y - ViewPos.Y) < 2)
|
||||
|
@ -693,6 +698,10 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (thing == camera)
|
||||
{
|
||||
int a = 0;
|
||||
}
|
||||
|
||||
// don't draw first frame of a player missile
|
||||
if (thing->flags&MF_MISSILE)
|
||||
|
@ -1203,6 +1212,14 @@ void gl_RenderActorsInPortal(FGLLinePortal *glport)
|
|||
DVector3 newpos = savedpos;
|
||||
sector_t fakesector;
|
||||
|
||||
if (!r_showviewer && th == camera)
|
||||
{
|
||||
if (fabs(savedpos.X - ViewActorPos.X) < 2 && fabs(savedpos.Y - ViewActorPos.Y) < 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
P_TranslatePortalXY(line, newpos.X, newpos.Y);
|
||||
P_TranslatePortalZ(line, newpos.Z);
|
||||
P_TranslatePortalAngle(line, th->Angles.Yaw);
|
||||
|
|
Loading…
Reference in a new issue