mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- make Blood's line to line portal operational.
Note that these portals cannot be rotated, so to preserve bad setups this limitation needs to be replicated. If we want proper line to line portals for all games they need to be made a different portal type.
This commit is contained in:
parent
829be9b56b
commit
9903b39cf5
2 changed files with 32 additions and 4 deletions
|
@ -601,7 +601,7 @@ const char *HWMirrorPortal::GetName() { return "Mirror"; }
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
// only used by Blood - they can not change the angle.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clipper)
|
||||
|
@ -619,11 +619,39 @@ bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *cl
|
|||
auto destcenter = (WallStart(line) + WallEnd(line)) / 2;
|
||||
DVector2 npos = vp.Pos - srccenter + destcenter;
|
||||
|
||||
//vp.ViewActor = nullptr;
|
||||
#if 0 // Blood does not rotate these. Needs map checking to make sure it can be added.
|
||||
int dx = wall[origin->point2].x - origin->x;
|
||||
int dy = wall[origin->point2].y - origin->y;
|
||||
int dx2 = wall[line->point2].x - line->x;
|
||||
int dy2 = wall[line->point2].y - line->y;
|
||||
|
||||
int srcang = gethiq16angle(dx, dy);
|
||||
int destang = gethiq16angle(-dx, -dy);
|
||||
|
||||
vp.RotAngle += q16ang(destang - srcang).asbam();
|
||||
#endif
|
||||
|
||||
// Nothing in the entire setup mandates that both lines have the same length.
|
||||
// So we need to calculate the clip range from the origin line, not the destination, because that is what determines the visible part of the scene.
|
||||
int origx = vp.Pos.X * 16;
|
||||
int origy = vp.Pos.Y * -16;
|
||||
|
||||
vp.SectNum = line->sector;
|
||||
vp.Pos.X = npos.X;
|
||||
vp.Pos.Y = npos.Y;
|
||||
|
||||
vp.Pos.Z -= (sector[line->sector].floorz - sector[origin->sector].floorz) / 256.f; // for testing only. Blood does not do it.
|
||||
|
||||
di->SetClipLine(line);
|
||||
di->SetupView(rstate, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, !!(state->MirrorFlag & 1), !!(state->PlaneMirrorFlag & 1));
|
||||
clipper->Clear();
|
||||
|
||||
ClearClipper(di, clipper);
|
||||
angle_t af = di->FrustumAngle();
|
||||
if (af < ANGLE_180) clipper->SafeAddClipRange(bamang(vp.RotAngle + af), bamang(vp.RotAngle - af));
|
||||
|
||||
auto startan = gethiq16angle(line->x - origx, line->y - origy);
|
||||
auto endan = gethiq16angle(wall[line->point2].x - origx, wall[line->point2].y - origy);
|
||||
clipper->SafeAddClipRange(q16ang(startan), q16ang(endan)); // we check the line from the backside so angles are reversed.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ void HWWall::SkyPlane(HWDrawInfo *di, sectortype *sector, int plane, bool allowr
|
|||
|
||||
if (sector->portalflags == PORTAL_SECTOR_CEILING || sector->portalflags == PORTAL_SECTOR_FLOOR)
|
||||
{
|
||||
if (screen->instack[1 - plane]) return;
|
||||
if (screen->instack[1 - plane] || allPortals.Size() == 0) return;
|
||||
portal = &allPortals[sector->portalnum];
|
||||
PutPortal(di, PORTALTYPE_SECTORSTACK, plane);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue