mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- handle the player sprite when crossing a portal.
This commit is contained in:
parent
5cd9e58af5
commit
ddbb8d79c1
2 changed files with 22 additions and 0 deletions
|
@ -312,6 +312,8 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
|||
savedviewactor=GLRenderer->mViewActor;
|
||||
savedviewarea=in_area;
|
||||
savedshowviewer = r_showviewer;
|
||||
savedviewpath[0] = ViewPath[0];
|
||||
savedviewpath[1] = ViewPath[1];
|
||||
|
||||
NextPortal = GLRenderer->mCurrentPortal;
|
||||
GLRenderer->mCurrentPortal = NULL; // Portals which need this have to set it themselves
|
||||
|
@ -374,6 +376,8 @@ void GLPortal::End(bool usestencil)
|
|||
if (needdepth) FDrawInfo::EndDrawInfo();
|
||||
|
||||
// Restore the old view
|
||||
ViewPath[0] = savedviewpath[0];
|
||||
ViewPath[1] = savedviewpath[1];
|
||||
ViewPos = savedViewPos;
|
||||
ViewAngle = savedAngle;
|
||||
GLRenderer->mViewActor=savedviewactor;
|
||||
|
@ -992,6 +996,23 @@ void GLLineToLinePortal::DrawContents()
|
|||
P_TranslatePortalXY(origin, ViewPos.X, ViewPos.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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
r_showviewer = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SaveMapSection();
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ private:
|
|||
AActor * savedviewactor;
|
||||
area_t savedviewarea;
|
||||
bool savedshowviewer;
|
||||
DVector3 savedviewpath[2];
|
||||
GLPortal *NextPortal;
|
||||
TArray<BYTE> savedmapsection;
|
||||
TArray<unsigned int> mPrimIndices;
|
||||
|
|
Loading…
Reference in a new issue