mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- use one of the new floating point special variables to store the portal plane height of the skybox things.
This commit is contained in:
parent
289cdfbefd
commit
7ebb96f15c
9 changed files with 40 additions and 38 deletions
|
@ -292,7 +292,7 @@ void P_ThinkParticles ()
|
|||
if (!particle->subsector->sector->PortalBlocksMovement(sector_t::ceiling))
|
||||
{
|
||||
AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::ceiling];
|
||||
if (particle->z > skybox->threshold)
|
||||
if (particle->z > FLOAT2FIXED(skybox->specialf1))
|
||||
{
|
||||
particle->x += FLOAT2FIXED(skybox->Scale.X);
|
||||
particle->y += FLOAT2FIXED(skybox->Scale.Y);
|
||||
|
@ -302,7 +302,7 @@ void P_ThinkParticles ()
|
|||
else if (!particle->subsector->sector->PortalBlocksMovement(sector_t::floor))
|
||||
{
|
||||
AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::floor];
|
||||
if (particle->z < skybox->threshold)
|
||||
if (particle->z < FLOAT2FIXED(skybox->specialf1))
|
||||
{
|
||||
particle->x += FLOAT2FIXED(skybox->Scale.X);
|
||||
particle->y += FLOAT2FIXED(skybox->Scale.Y);
|
||||
|
|
|
@ -752,14 +752,14 @@ static int LineIsAbove(line_t *line, AActor *actor)
|
|||
{
|
||||
AActor *point = line->frontsector->SkyBoxes[sector_t::floor];
|
||||
if (point == NULL) return -1;
|
||||
return point->threshold >= actor->_f_Top();
|
||||
return point->specialf1 >= actor->Top();
|
||||
}
|
||||
|
||||
static int LineIsBelow(line_t *line, AActor *actor)
|
||||
{
|
||||
AActor *point = line->frontsector->SkyBoxes[sector_t::ceiling];
|
||||
if (point == NULL) return -1;
|
||||
return point->threshold <= actor->_f_Z();
|
||||
return point->specialf1 <= actor->Z();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -858,7 +858,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
|
|||
if (state == 1)
|
||||
{
|
||||
// the line should not block but we should set the ceilingz to the portal boundary so that we can't float up into that line.
|
||||
double portalz = FIXED2FLOAT(cres.line->frontsector->SkyBoxes[sector_t::floor]->threshold);
|
||||
double portalz = cres.line->frontsector->SkyBoxes[sector_t::floor]->specialf1;
|
||||
if (portalz < tm.ceilingz)
|
||||
{
|
||||
tm.ceilingz = portalz;
|
||||
|
@ -874,7 +874,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
|
|||
if (state == -1) return true;
|
||||
if (state == 1)
|
||||
{
|
||||
double portalz = FIXED2DBL(cres.line->frontsector->SkyBoxes[sector_t::ceiling]->threshold);
|
||||
double portalz = cres.line->frontsector->SkyBoxes[sector_t::ceiling]->specialf1;
|
||||
if (portalz > tm.floorz)
|
||||
{
|
||||
tm.floorz = portalz;
|
||||
|
@ -3661,8 +3661,8 @@ struct aim_t
|
|||
{
|
||||
AActor *portal = entersec->SkyBoxes[position];
|
||||
|
||||
if (position == sector_t::ceiling && portal->threshold < limitz) return;
|
||||
else if (position == sector_t::floor && portal->threshold > limitz) return;
|
||||
if (position == sector_t::ceiling && FLOAT2FIXED(portal->specialf1) < limitz) return;
|
||||
else if (position == sector_t::floor && FLOAT2FIXED(portal->specialf1) > limitz) return;
|
||||
aim_t newtrace = Clone();
|
||||
|
||||
|
||||
|
@ -3672,7 +3672,7 @@ struct aim_t
|
|||
newtrace.startpos = { startpos.x + FLOAT2FIXED(portal->Scale.X), startpos.y + FLOAT2FIXED(portal->Scale.Y), startpos.z };
|
||||
newtrace.startfrac = frac + FixedDiv(FRACUNIT, attackrange); // this is to skip the transition line to the portal which would produce a bogus opening
|
||||
newtrace.lastsector = P_PointInSector(newtrace.startpos.x + FixedMul(aimtrace.x, newtrace.startfrac) , newtrace.startpos.y + FixedMul(aimtrace.y, newtrace.startfrac));
|
||||
newtrace.limitz = portal->threshold;
|
||||
newtrace.limitz = FLOAT2FIXED(portal->specialf1);
|
||||
if (aimdebug)
|
||||
Printf("-----Entering %s portal from sector %d to sector %d\n", position ? "ceiling" : "floor", lastsector->sectornum, newtrace.lastsector->sectornum);
|
||||
newtrace.AimTraverse();
|
||||
|
|
|
@ -214,7 +214,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
|
|||
{
|
||||
// We must check through the portal for the actual dropoff.
|
||||
// If there's no lines in the lower sections we'd never get a usable value otherwise.
|
||||
open.lowfloor = back->NextLowestFloorAt(refx, refy, back->SkyBoxes[sector_t::floor]->threshold-1);
|
||||
open.lowfloor = back->NextLowestFloorAt(refx, refy, FLOAT2FIXED(back->SkyBoxes[sector_t::floor]->specialf1)-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -228,7 +228,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef,
|
|||
{
|
||||
// We must check through the portal for the actual dropoff.
|
||||
// If there's no lines in the lower sections we'd never get a usable value otherwise.
|
||||
open.lowfloor = front->NextLowestFloorAt(refx, refy, front->SkyBoxes[sector_t::floor]->threshold - 1);
|
||||
open.lowfloor = front->NextLowestFloorAt(refx, refy, FLOAT2FIXED(front->SkyBoxes[sector_t::floor]->specialf1) - 1);
|
||||
}
|
||||
}
|
||||
open.frontfloorplane = front->floorplane;
|
||||
|
|
|
@ -301,6 +301,8 @@ void AActor::Serialize(FArchive &arc)
|
|||
}
|
||||
arc << special1
|
||||
<< special2
|
||||
<< specialf1
|
||||
<< specialf2
|
||||
<< health
|
||||
<< movedir
|
||||
<< visdir
|
||||
|
@ -3258,13 +3260,13 @@ fixedvec3 AActor::GetPortalTransition(fixed_t byoffset, sector_t **pSec)
|
|||
{
|
||||
bool moved = false;
|
||||
sector_t *sec = Sector;
|
||||
fixed_t testz = _f_Z() + byoffset;
|
||||
double testz = Z() + FIXED2FLOAT(byoffset);
|
||||
fixedvec3 pos = _f_Pos();
|
||||
|
||||
while (!sec->PortalBlocksMovement(sector_t::ceiling))
|
||||
{
|
||||
AActor *port = sec->SkyBoxes[sector_t::ceiling];
|
||||
if (testz > port->threshold)
|
||||
if (testz > port->specialf1)
|
||||
{
|
||||
pos = PosRelative(port->Sector);
|
||||
sec = P_PointInSector(pos.x, pos.y);
|
||||
|
@ -3277,7 +3279,7 @@ fixedvec3 AActor::GetPortalTransition(fixed_t byoffset, sector_t **pSec)
|
|||
while (!sec->PortalBlocksMovement(sector_t::floor))
|
||||
{
|
||||
AActor *port = sec->SkyBoxes[sector_t::floor];
|
||||
if (testz <= port->threshold)
|
||||
if (testz <= port->specialf1)
|
||||
{
|
||||
pos = PosRelative(port->Sector);
|
||||
sec = P_PointInSector(pos.x, pos.y);
|
||||
|
@ -3297,7 +3299,7 @@ void AActor::CheckPortalTransition(bool islinked)
|
|||
while (!Sector->PortalBlocksMovement(sector_t::ceiling))
|
||||
{
|
||||
AActor *port = Sector->SkyBoxes[sector_t::ceiling];
|
||||
if (_f_Z() > port->threshold)
|
||||
if (Z() > port->specialf1)
|
||||
{
|
||||
fixedvec3 oldpos = _f_Pos();
|
||||
if (islinked && !moved) UnlinkFromWorld();
|
||||
|
@ -3316,7 +3318,7 @@ void AActor::CheckPortalTransition(bool islinked)
|
|||
while (!Sector->PortalBlocksMovement(sector_t::floor))
|
||||
{
|
||||
AActor *port = Sector->SkyBoxes[sector_t::floor];
|
||||
if (_f_Z() < port->threshold && _f_floorz() < port->threshold)
|
||||
if (Z() < port->specialf1 && floorz < port->specialf1)
|
||||
{
|
||||
fixedvec3 oldpos = _f_Pos();
|
||||
if (islinked && !moved) UnlinkFromWorld();
|
||||
|
|
|
@ -877,9 +877,9 @@ void sector_t::CheckPortalPlane(int plane)
|
|||
AActor *portal = SkyBoxes[plane];
|
||||
if (!portal || portal->special1 != SKYBOX_LINKEDPORTAL) return;
|
||||
|
||||
fixed_t planeh = planes[plane].TexZ;
|
||||
double planeh = FIXED2DBL(planes[plane].TexZ);
|
||||
int obstructed = PLANEF_OBSTRUCTED * (plane == sector_t::floor ?
|
||||
planeh > portal->threshold : planeh < portal->threshold);
|
||||
planeh > portal->specialf1 : planeh < portal->specialf1);
|
||||
planes[plane].Flags = (planes[plane].Flags & ~PLANEF_OBSTRUCTED) | obstructed;
|
||||
}
|
||||
|
||||
|
@ -895,12 +895,12 @@ fixed_t sector_t::_f_HighestCeilingAt(fixed_t x, fixed_t y, sector_t **resultsec
|
|||
fixed_t planeheight = FIXED_MIN;
|
||||
|
||||
// Continue until we find a blocking portal or a portal below where we actually are.
|
||||
while (!check->PortalBlocksMovement(ceiling) && planeheight < check->SkyBoxes[ceiling]->threshold)
|
||||
while (!check->PortalBlocksMovement(ceiling) && planeheight < FLOAT2FIXED(check->SkyBoxes[ceiling]->specialf1))
|
||||
{
|
||||
fixedvec2 pos = check->CeilingDisplacement();
|
||||
x += pos.x;
|
||||
y += pos.y;
|
||||
planeheight = check->SkyBoxes[ceiling]->threshold;
|
||||
planeheight = FLOAT2FIXED(check->SkyBoxes[ceiling]->specialf1);
|
||||
check = P_PointInSector(x, y);
|
||||
}
|
||||
if (resultsec) *resultsec = check;
|
||||
|
@ -919,12 +919,12 @@ fixed_t sector_t::_f_LowestFloorAt(fixed_t x, fixed_t y, sector_t **resultsec)
|
|||
fixed_t planeheight = FIXED_MAX;
|
||||
|
||||
// Continue until we find a blocking portal or a portal above where we actually are.
|
||||
while (!check->PortalBlocksMovement(floor) && planeheight > check->SkyBoxes[floor]->threshold)
|
||||
while (!check->PortalBlocksMovement(floor) && planeheight > FLOAT2FIXED(check->SkyBoxes[floor]->specialf1))
|
||||
{
|
||||
fixedvec2 pos = check->FloorDisplacement();
|
||||
x += pos.x;
|
||||
y += pos.y;
|
||||
planeheight = check->SkyBoxes[floor]->threshold;
|
||||
planeheight = FLOAT2FIXED(check->SkyBoxes[floor]->specialf1);
|
||||
check = P_PointInSector(x, y);
|
||||
}
|
||||
if (resultsec) *resultsec = check;
|
||||
|
@ -959,7 +959,7 @@ fixed_t sector_t::NextHighestCeilingAt(fixed_t x, fixed_t y, fixed_t bottomz, fi
|
|||
return ff_bottom;
|
||||
}
|
||||
}
|
||||
if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(ceiling) || planeheight >= sec->SkyBoxes[ceiling]->threshold)
|
||||
if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(ceiling) || planeheight >= FLOAT2FIXED(sec->SkyBoxes[ceiling]->specialf1))
|
||||
{ // Use sector's floor
|
||||
if (resultffloor) *resultffloor = NULL;
|
||||
if (resultsec) *resultsec = sec;
|
||||
|
@ -970,7 +970,7 @@ fixed_t sector_t::NextHighestCeilingAt(fixed_t x, fixed_t y, fixed_t bottomz, fi
|
|||
fixedvec2 pos = sec->CeilingDisplacement();
|
||||
x += pos.x;
|
||||
y += pos.y;
|
||||
planeheight = sec->SkyBoxes[ceiling]->threshold;
|
||||
planeheight = FLOAT2FIXED(sec->SkyBoxes[ceiling]->specialf1);
|
||||
sec = P_PointInSector(x, y);
|
||||
}
|
||||
}
|
||||
|
@ -1004,7 +1004,7 @@ fixed_t sector_t::NextLowestFloorAt(fixed_t x, fixed_t y, fixed_t z, int flags,
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(sector_t::floor) || planeheight <= sec->SkyBoxes[floor]->threshold)
|
||||
if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(sector_t::floor) || planeheight <= FLOAT2FIXED(sec->SkyBoxes[floor]->specialf1))
|
||||
{ // Use sector's floor
|
||||
if (resultffloor) *resultffloor = NULL;
|
||||
if (resultsec) *resultsec = sec;
|
||||
|
@ -1015,7 +1015,7 @@ fixed_t sector_t::NextLowestFloorAt(fixed_t x, fixed_t y, fixed_t z, int flags,
|
|||
fixedvec2 pos = sec->FloorDisplacement();
|
||||
x += pos.x;
|
||||
y += pos.y;
|
||||
planeheight = sec->SkyBoxes[floor]->threshold;
|
||||
planeheight = FLOAT2FIXED(sec->SkyBoxes[floor]->specialf1);
|
||||
sec = P_PointInSector(x, y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1051,7 +1051,7 @@ void P_SpawnPortal(line_t *line, int sectortag, int plane, int alpha, int linked
|
|||
// store the portal displacement in the unused scaleX/Y members of the portal reference actor.
|
||||
anchor->Scale.X = -(reference->Scale.X = FIXED2DBL(x2 - x1));
|
||||
anchor->Scale.Y = -(reference->Scale.Y = FIXED2DBL(y2 - y1));
|
||||
anchor->threshold = reference->threshold = z;
|
||||
anchor->specialf1 = reference->specialf1 = FIXED2FLOAT(z);
|
||||
|
||||
reference->Mate = anchor;
|
||||
anchor->Mate = reference;
|
||||
|
|
|
@ -195,8 +195,8 @@ void FTraceInfo::EnterSectorPortal(int position, fixed_t frac, sector_t *enterse
|
|||
if (aimdir != -1 && aimdir != position) return;
|
||||
AActor *portal = entersec->SkyBoxes[position];
|
||||
|
||||
if (aimdir == sector_t::ceiling && portal->threshold < limitz) return;
|
||||
else if (aimdir == sector_t::floor && portal->threshold > limitz) return;
|
||||
if (aimdir == sector_t::ceiling && FLOAT2FIXED(portal->specialf1) < limitz) return;
|
||||
else if (aimdir == sector_t::floor && FLOAT2FIXED(portal->specialf1) > limitz) return;
|
||||
|
||||
FTraceInfo newtrace;
|
||||
FTraceResults results;
|
||||
|
@ -229,7 +229,7 @@ void FTraceInfo::EnterSectorPortal(int position, fixed_t frac, sector_t *enterse
|
|||
newtrace.inshootthrough = true;
|
||||
newtrace.startfrac = frac;
|
||||
newtrace.aimdir = position;
|
||||
newtrace.limitz = portal->threshold;
|
||||
newtrace.limitz = FLOAT2FIXED(portal->specialf1);
|
||||
newtrace.sectorsel = 0;
|
||||
|
||||
if (newtrace.TraceTraverse(ActorMask ? PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE : PT_ADDLINES))
|
||||
|
|
|
@ -1089,8 +1089,8 @@ void P_CreateLinkedPortals()
|
|||
}
|
||||
if (sectors[i].PortalIsLinked(sector_t::ceiling) && sectors[i].PortalIsLinked(sector_t::floor))
|
||||
{
|
||||
fixed_t cz = sectors[i].SkyBoxes[sector_t::ceiling]->threshold;
|
||||
fixed_t fz = sectors[i].SkyBoxes[sector_t::floor]->threshold;
|
||||
double cz = sectors[i].SkyBoxes[sector_t::ceiling]->specialf1;
|
||||
double fz = sectors[i].SkyBoxes[sector_t::floor]->specialf1;
|
||||
if (cz < fz)
|
||||
{
|
||||
// This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane
|
||||
|
@ -1204,7 +1204,7 @@ bool P_CollectConnectedGroups(int startgroup, const fixedvec3 &position, fixed_t
|
|||
{
|
||||
sector_t *sec = P_PointInSector(position.x, position.y);
|
||||
sector_t *wsec = sec;
|
||||
while (!wsec->PortalBlocksMovement(sector_t::ceiling) && upperz > wsec->SkyBoxes[sector_t::ceiling]->threshold)
|
||||
while (!wsec->PortalBlocksMovement(sector_t::ceiling) && upperz > FLOAT2FIXED(wsec->SkyBoxes[sector_t::ceiling]->specialf1))
|
||||
{
|
||||
sector_t *othersec = wsec->SkyBoxes[sector_t::ceiling]->Sector;
|
||||
fixedvec2 pos = Displacements.getOffset(startgroup, othersec->PortalGroup);
|
||||
|
@ -1216,7 +1216,7 @@ bool P_CollectConnectedGroups(int startgroup, const fixedvec3 &position, fixed_t
|
|||
retval = true;
|
||||
}
|
||||
wsec = sec;
|
||||
while (!wsec->PortalBlocksMovement(sector_t::floor) && position.z < wsec->SkyBoxes[sector_t::floor]->threshold)
|
||||
while (!wsec->PortalBlocksMovement(sector_t::floor) && position.z < FLOAT2FIXED(wsec->SkyBoxes[sector_t::floor]->specialf1))
|
||||
{
|
||||
sector_t *othersec = wsec->SkyBoxes[sector_t::floor]->Sector;
|
||||
fixedvec2 pos = Displacements.getOffset(startgroup, othersec->PortalGroup);
|
||||
|
@ -1256,7 +1256,7 @@ bool P_CollectConnectedGroups(int startgroup, const fixedvec3 &position, fixed_t
|
|||
sector_t *sec = s ? ld->backsector : ld->frontsector;
|
||||
if (sec && !(sec->PortalBlocksMovement(sector_t::ceiling)))
|
||||
{
|
||||
if (sec->SkyBoxes[sector_t::ceiling]->threshold < upperz)
|
||||
if (FLOAT2FIXED(sec->SkyBoxes[sector_t::ceiling]->specialf1) < upperz)
|
||||
{
|
||||
int grp = sec->SkyBoxes[sector_t::ceiling]->Sector->PortalGroup;
|
||||
if (!(processMask.getBit(grp)))
|
||||
|
@ -1275,7 +1275,7 @@ bool P_CollectConnectedGroups(int startgroup, const fixedvec3 &position, fixed_t
|
|||
sector_t *sec = s ? ld->backsector : ld->frontsector;
|
||||
if (sec && !(sec->PortalBlocksMovement(sector_t::floor)))
|
||||
{
|
||||
if (sec->SkyBoxes[sector_t::floor]->threshold > position.z)
|
||||
if (FLOAT2FIXED(sec->SkyBoxes[sector_t::floor]->specialf1) > position.z)
|
||||
{
|
||||
int grp = sec->SkyBoxes[sector_t::floor]->Sector->PortalGroup;
|
||||
if (!(processMask.getBit(grp)))
|
||||
|
|
|
@ -713,7 +713,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
|||
while (!viewsector->PortalBlocksMovement(sector_t::ceiling))
|
||||
{
|
||||
AActor *point = viewsector->SkyBoxes[sector_t::ceiling];
|
||||
if (viewz > point->threshold)
|
||||
if (viewz > FLOAT2FIXED(point->specialf1))
|
||||
{
|
||||
viewx += FLOAT2FIXED(point->Scale.X);
|
||||
viewy += FLOAT2FIXED(point->Scale.Y);
|
||||
|
@ -727,7 +727,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
|||
while (!viewsector->PortalBlocksMovement(sector_t::floor))
|
||||
{
|
||||
AActor *point = viewsector->SkyBoxes[sector_t::floor];
|
||||
if (viewz < point->threshold)
|
||||
if (viewz < FLOAT2FIXED(point->specialf1))
|
||||
{
|
||||
viewx += FLOAT2FIXED(point->Scale.X);
|
||||
viewy += FLOAT2FIXED(point->Scale.Y);
|
||||
|
|
Loading…
Reference in a new issue