From 7ebb96f15c5383cdfe0349dd00ace7489e87e723 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 21 Mar 2016 00:05:44 +0100 Subject: [PATCH] - use one of the new floating point special variables to store the portal plane height of the skybox things. --- src/p_effect.cpp | 4 ++-- src/p_map.cpp | 14 +++++++------- src/p_maputl.cpp | 4 ++-- src/p_mobj.cpp | 12 +++++++----- src/p_sectors.cpp | 20 ++++++++++---------- src/p_spec.cpp | 2 +- src/p_trace.cpp | 6 +++--- src/portal.cpp | 12 ++++++------ src/r_utility.cpp | 4 ++-- 9 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 83568420f..4108be2d5 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -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); diff --git a/src/p_map.cpp b/src/p_map.cpp index 579176443..993180b1f 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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(); diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 3de8aa764..46a0cda5f 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -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; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 4fb4c2a03..96fe0dad1 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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(); diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 905678d5f..6a91d7072 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -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); } } diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 92c12c9a2..3d5e07638 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -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; diff --git a/src/p_trace.cpp b/src/p_trace.cpp index 64c895f41..bd011e5fc 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -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)) diff --git a/src/portal.cpp b/src/portal.cpp index 9341b965a..ef6013f51 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -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))) diff --git a/src/r_utility.cpp b/src/r_utility.cpp index b1c7d6cc1..f69427a1c 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -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);