From 8b6b5e7b1c38b0dc992f480579374de155995b16 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 25 Mar 2016 14:18:50 +0100 Subject: [PATCH] - preparation for upcoming work: rename the fixed point versions of PosRelative. --- src/actor.h | 30 +++++++++++++++--------------- src/am_map.cpp | 6 +++--- src/g_shared/a_fastprojectile.cpp | 2 +- src/p_enemy.cpp | 6 +++--- src/p_map.cpp | 20 ++++++++++---------- src/p_maputl.cpp | 2 +- src/p_mobj.cpp | 24 ++++++++++++------------ src/p_sight.cpp | 4 ++-- src/p_spec.cpp | 2 +- src/p_switch.cpp | 2 +- src/r_defs.h | 10 +++++----- 11 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/actor.h b/src/actor.h index 5bd462a0b9..b6142f698d 100644 --- a/src/actor.h +++ b/src/actor.h @@ -837,13 +837,13 @@ public: // to distinguish between portal-aware and portal-unaware distance calculation. fixed_t AproxDistance(AActor *other, bool absolute = false) { - fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this); + fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this); return P_AproxDistance(_f_X() - otherpos.x, _f_Y() - otherpos.y); } fixed_t AproxDistance(AActor *other, fixed_t xadd, fixed_t yadd, bool absolute = false) { - fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this); + fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this); return P_AproxDistance(_f_X() - otherpos.x + xadd, _f_Y() - otherpos.y + yadd); } @@ -855,7 +855,7 @@ public: // more precise, but slower version, being used in a few places double Distance2D(AActor *other, bool absolute = false) { - fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this); + fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this); return (DVector2(_f_X() - otherpos.x, _f_Y() - otherpos.y).Length())/FRACUNIT; } @@ -867,13 +867,13 @@ public: // a full 3D version of the above fixed_t Distance3D(AActor *other, bool absolute = false) { - fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this); + fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this); return xs_RoundToInt(DVector3(_f_X() - otherpos.x, _f_Y() - otherpos.y, _f_Z() - otherpos.z).Length()); } angle_t __f_AngleTo(AActor *other, bool absolute = false) { - fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this); + fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this); return R_PointToAngle2(_f_X(), _f_Y(), otherpos.x, otherpos.y); } @@ -884,13 +884,13 @@ public: DAngle AngleTo(AActor *other, bool absolute = false) { - fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this); + fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this); return VecToAngle(otherpos.x - _f_X(), otherpos.y - _f_Y()); } DAngle AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const { - fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this); + fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this); return VecToAngle(otherpos.y + oxofs - _f_Y(), otherpos.x + oyofs - _f_X()); } @@ -901,27 +901,27 @@ public: fixedvec2 _f_Vec2To(AActor *other) const { - fixedvec3 otherpos = other->PosRelative(this); + fixedvec3 otherpos = other->_f_PosRelative(this); fixedvec2 ret = { otherpos.x - _f_X(), otherpos.y - _f_Y() }; return ret; } fixedvec3 _f_Vec3To(AActor *other) const { - fixedvec3 otherpos = other->PosRelative(this); + fixedvec3 otherpos = other->_f_PosRelative(this); fixedvec3 ret = { otherpos.x - _f_X(), otherpos.y - _f_Y(), otherpos.z - _f_Z() }; return ret; } DVector2 Vec2To(AActor *other) const { - fixedvec3 otherpos = other->PosRelative(this); + fixedvec3 otherpos = other->_f_PosRelative(this); return{ FIXED2DBL(otherpos.x - _f_X()), FIXED2DBL(otherpos.y - _f_Y()) }; } DVector3 Vec3To(AActor *other) const { - fixedvec3 otherpos = other->PosRelative(this); + fixedvec3 otherpos = other->_f_PosRelative(this); return { FIXED2DBL(otherpos.x - _f_X()), FIXED2DBL(otherpos.y - _f_Y()), FIXED2DBL(otherpos.z - _f_Z()) }; } @@ -1419,10 +1419,10 @@ public: return DVector3(X(), Y(), Z()); } - fixedvec3 PosRelative(int grp) const; - fixedvec3 PosRelative(const AActor *other) const; - fixedvec3 PosRelative(sector_t *sec) const; - fixedvec3 PosRelative(line_t *line) const; + fixedvec3 _f_PosRelative(int grp) const; + fixedvec3 _f_PosRelative(const AActor *other) const; + fixedvec3 _f_PosRelative(sector_t *sec) const; + fixedvec3 _f_PosRelative(line_t *line) const; fixed_t SoundX() const { diff --git a/src/am_map.cpp b/src/am_map.cpp index a8076550c5..65cc1c5833 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2732,7 +2732,7 @@ void AM_drawPlayers () if (p->mo != NULL) { - fixedvec3 pos = p->mo->PosRelative(MapPortalGroup); + fixedvec3 pos = p->mo->_f_PosRelative(MapPortalGroup); pt.x = pos.x >> FRACTOMAPBITS; pt.y = pos.y >> FRACTOMAPBITS; @@ -2766,7 +2766,7 @@ void AM_drawKeys () while ((key = it.Next()) != NULL) { - fixedvec3 pos = key->PosRelative(MapPortalGroup); + fixedvec3 pos = key->_f_PosRelative(MapPortalGroup); p.x = pos.x >> FRACTOMAPBITS; p.y = pos.y >> FRACTOMAPBITS; @@ -2813,7 +2813,7 @@ void AM_drawThings () { if (am_cheat > 0 || !(t->flags6 & MF6_NOTONAUTOMAP)) { - fixedvec3 pos = t->PosRelative(MapPortalGroup); + fixedvec3 pos = t->_f_PosRelative(MapPortalGroup); p.x = pos.x >> FRACTOMAPBITS; p.y = pos.y >> FRACTOMAPBITS; diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index 89b2690e16..c82e0874b9 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -73,7 +73,7 @@ void AFastProjectile::Tick () if (tm.ceilingline && tm.ceilingline->backsector && tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum && - Z() >= tm.ceilingline->backsector->ceilingplane.ZatPointF(PosRelative(tm.ceilingline))) + Z() >= tm.ceilingline->backsector->ceilingplane.ZatPointF(_f_PosRelative(tm.ceilingline))) { // Hack to prevent missiles exploding against the sky. // Does not handle sky floors. diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index ac0178fa10..904b41bf9d 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -588,7 +588,7 @@ bool P_Move (AActor *actor) else { // The monster just hit the floor, so trigger any actions. if (actor->floorsector->SecActTarget != NULL && - actor->_f_floorz() == actor->floorsector->floorplane.ZatPoint(actor->PosRelative(actor->floorsector))) + actor->_f_floorz() == actor->floorsector->floorplane.ZatPoint(actor->_f_PosRelative(actor->floorsector))) { actor->floorsector->SecActTarget->TriggerAction(actor, SECSPAC_HitFloor); } @@ -898,8 +898,8 @@ void P_NewChaseDir(AActor * actor) box.Bottom() < line->bbox[BOXTOP] && box.BoxOnLineSide(line) == -1) { - double front = line->frontsector->floorplane.ZatPointF(actor->PosRelative(line)); - double back = line->backsector->floorplane.ZatPointF(actor->PosRelative(line)); + double front = line->frontsector->floorplane.ZatPointF(actor->_f_PosRelative(line)); + double back = line->backsector->floorplane.ZatPointF(actor->_f_PosRelative(line)); DAngle angle; // The monster must contact one of the two floors, diff --git a/src/p_map.cpp b/src/p_map.cpp index 697d926fa8..77fceae4e7 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -638,7 +638,7 @@ double P_GetFriction(const AActor *mo, double *frictionfactor) for (m = mo->touching_sectorlist; m; m = m->m_tnext) { sec = m->m_sector; - fixedvec3 pos = mo->PosRelative(sec); + fixedvec3 pos = mo->_f_PosRelative(sec); // 3D floors must be checked, too for (unsigned i = 0; i < sec->e->XFloor.ffloors.Size(); i++) @@ -809,7 +809,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec spechit_t spec; spec.line = ld; spec.refpos = cres.position; - spec.oldrefpos = tm.thing->PosRelative(ld); + spec.oldrefpos = tm.thing->_f_PosRelative(ld); portalhit.Push(spec); return true; } @@ -977,14 +977,14 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec { spec.line = ld; spec.refpos = cres.position; - spec.oldrefpos = tm.thing->PosRelative(ld); + spec.oldrefpos = tm.thing->_f_PosRelative(ld); spechit.Push(spec); } if (ld->isLinePortal()) { spec.line = ld; spec.refpos = cres.position; - spec.oldrefpos = tm.thing->PosRelative(ld); + spec.oldrefpos = tm.thing->_f_PosRelative(ld); portalhit.Push(spec); } @@ -1242,7 +1242,7 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch if (((tm.FromPMove || tm.thing->player != NULL) && thing->flags&MF_SOLID)) { - fixedvec3 oldpos = tm.thing->PosRelative(thing); + fixedvec3 oldpos = tm.thing->_f_PosRelative(thing); // Both actors already overlap. To prevent them from remaining stuck allow the move if it // takes them further apart or the move does not change the position (when called from P_ChangeSector.) if (oldpos.x == thing->_f_X() && oldpos.y == thing->_f_Y()) @@ -1963,7 +1963,7 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, fixedvec2 if (posforwindowcheck && !(ib_compatflags & BCOMPATF_NOWINDOWCHECK) && line->backsector != NULL) { // Make sure this line actually blocks us and is not a window // or similar construct we are standing inside of. - fixedvec3 pos = mobj->PosRelative(line); + fixedvec3 pos = mobj->_f_PosRelative(line); fixed_t fzt = line->frontsector->ceilingplane.ZatPoint(*posforwindowcheck); fixed_t fzb = line->frontsector->floorplane.ZatPoint(*posforwindowcheck); fixed_t bzt = line->backsector->ceilingplane.ZatPoint(*posforwindowcheck); @@ -2698,7 +2698,7 @@ void FSlide::HitSlideLine(line_t* ld) // The wall is angled. Bounce if the angle of approach is // phares // less than 45 degrees. // phares - fixedvec3 pos = slidemo->PosRelative(ld); + fixedvec3 pos = slidemo->_f_PosRelative(ld); side = P_PointOnLineSide(pos.x, pos.y, ld); lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy); @@ -2804,7 +2804,7 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t if (!(li->flags & ML_TWOSIDED) || !li->backsector) { - fixedvec3 pos = slidemo->PosRelative(li); + fixedvec3 pos = slidemo->_f_PosRelative(li); if (P_PointOnLineSide(pos.x, pos.y, li)) { // don't hit the back side @@ -3020,7 +3020,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov return NULL; } - fixedvec3 pos = actor->PosRelative(actor->floorsector); + fixedvec3 pos = actor->_f_PosRelative(actor->floorsector); const secplane_t *plane = &actor->floorsector->floorplane; fixed_t planezhere = plane->ZatPoint(pos); @@ -3100,7 +3100,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov sector_t *sec = node->m_sector; if (sec->floorplane.c >= STEEPSLOPE) { - fixedvec3 pos = actor->PosRelative(sec); + fixedvec3 pos = actor->_f_PosRelative(sec); pos.x += xmove; pos.y += ymove; diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 51c79358d5..488260a7f8 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -497,7 +497,7 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) for (int i = -1; i < (int)check.Size(); i++) { - fixedvec3 pos = i==-1? _f_Pos() : PosRelative(check[i]); + fixedvec3 pos = i==-1? _f_Pos() : _f_PosRelative(check[i]); int x1 = GetSafeBlockX(pos.x - _f_radius() - bmaporgx); int x2 = GetSafeBlockX(pos.x + _f_radius() - bmaporgx); diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 6ceaaa4e34..17b529ca9a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1388,7 +1388,7 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) if (line != NULL && cl_missiledecals) { - fixedvec3 pos = mo->PosRelative(line); + fixedvec3 pos = mo->_f_PosRelative(line); int side = P_PointOnLineSidePrecise (pos.x, pos.y, line); if (line->sidedef[side] == NULL) side ^= 1; @@ -2116,7 +2116,7 @@ explode: if (tm.ceilingline && tm.ceilingline->backsector && tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum && - mo->_f_Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(mo->PosRelative(tm.ceilingline))) + mo->_f_Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(mo->_f_PosRelative(tm.ceilingline))) { // Hack to prevent missiles exploding against the sky. // Does not handle sky floors. @@ -3263,7 +3263,7 @@ fixedvec3 AActor::GetPortalTransition(fixed_t byoffset, sector_t **pSec) AActor *port = sec->SkyBoxes[sector_t::ceiling]; if (testz > port->specialf1) { - pos = PosRelative(port->Sector); + pos = _f_PosRelative(port->Sector); sec = P_PointInSector(pos.x, pos.y); moved = true; } @@ -3276,7 +3276,7 @@ fixedvec3 AActor::GetPortalTransition(fixed_t byoffset, sector_t **pSec) AActor *port = sec->SkyBoxes[sector_t::floor]; if (testz <= port->specialf1) { - pos = PosRelative(port->Sector); + pos = _f_PosRelative(port->Sector); sec = P_PointInSector(pos.x, pos.y); } else break; @@ -3298,7 +3298,7 @@ void AActor::CheckPortalTransition(bool islinked) { fixedvec3 oldpos = _f_Pos(); if (islinked && !moved) UnlinkFromWorld(); - SetXYZ(PosRelative(port->Sector)); + SetXYZ(_f_PosRelative(port->Sector)); PrevX += _f_X() - oldpos.x; PrevY += _f_Y() - oldpos.y; PrevZ += _f_Z() - oldpos.z; @@ -3317,7 +3317,7 @@ void AActor::CheckPortalTransition(bool islinked) { fixedvec3 oldpos = _f_Pos(); if (islinked && !moved) UnlinkFromWorld(); - SetXYZ(PosRelative(port->Sector)); + SetXYZ(_f_PosRelative(port->Sector)); PrevX += _f_X() - oldpos.x; PrevY += _f_Y() - oldpos.y; PrevZ += _f_Z() - oldpos.z; @@ -3681,7 +3681,7 @@ void AActor::Tick () { continue; } - fixedvec3 pos = PosRelative(sec); + fixedvec3 pos = _f_PosRelative(sec); height = sec->floorplane.ZatPoint (pos); if (_f_Z() > height) { @@ -3731,7 +3731,7 @@ void AActor::Tick () floorplane = P_FindFloorPlane(floorsector, _f_X(), _f_Y(), _f_floorz()); if (floorplane.c < STEEPSLOPE && - floorplane.ZatPoint (PosRelative(floorsector)) <= _f_floorz()) + floorplane.ZatPoint (_f_PosRelative(floorsector)) <= _f_floorz()) { const msecnode_t *node; bool dopush = true; @@ -3743,7 +3743,7 @@ void AActor::Tick () const sector_t *sec = node->m_sector; if (sec->floorplane.c >= STEEPSLOPE) { - if (floorplane.ZatPointF (PosRelative(node->m_sector)) >= Z() - MaxStepHeight) + if (floorplane.ZatPointF (_f_PosRelative(node->m_sector)) >= Z() - MaxStepHeight) { dopush = false; break; @@ -4517,7 +4517,7 @@ void AActor::AdjustFloorClip () // do the floorclipping instead of the terrain type. for (m = touching_sectorlist; m; m = m->m_tnext) { - fixedvec3 pos = PosRelative(m->m_sector); + fixedvec3 pos = _f_PosRelative(m->m_sector); sector_t *hsec = m->m_sector->GetHeightSec(); if (hsec == NULL && m->m_sector->floorplane.ZatPoint (pos) == _f_Z()) { @@ -5684,7 +5684,7 @@ bool P_HitFloor (AActor *thing) fixedvec3 pos; for (m = thing->touching_sectorlist; m; m = m->m_tnext) { - pos = thing->PosRelative(m->m_sector); + pos = thing->_f_PosRelative(m->m_sector); if (thing->_f_Z() == m->m_sector->floorplane.ZatPoint(pos.x, pos.y)) { break; @@ -5729,7 +5729,7 @@ void P_CheckSplash(AActor *self, double distance) // Explosion splashes never alert monsters. This is because A_Explode has // a separate parameter for that so this would get in the way of proper // behavior. - fixedvec3 pos = self->PosRelative(floorsec); + fixedvec3 pos = self->_f_PosRelative(floorsec); pos.z = self->_f_floorz(); P_HitWater (self, floorsec, pos, false, false); } diff --git a/src/p_sight.cpp b/src/p_sight.cpp index d9652cb01b..20d7d21130 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -112,8 +112,8 @@ public: void init(AActor * t1, AActor * t2, sector_t *startsector, SightTask *task, int flags) { - sightstart = t1->PosRelative(task->portalgroup); - sightend = t2->PosRelative(task->portalgroup); + sightstart = t1->_f_PosRelative(task->portalgroup); + sightend = t2->_f_PosRelative(task->portalgroup); sightstart.z += t1->_f_height() - (t1->_f_height() >> 2); startfrac = task->frac; diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 0c4380cd41..7a32c9fa16 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -2307,7 +2307,7 @@ void DPusher::Tick () continue; sector_t *hsec = sec->GetHeightSec(); - fixedvec3 pos = thing->PosRelative(sec); + fixedvec3 pos = thing->_f_PosRelative(sec); DVector2 pushvel; if (m_Type == p_wind) { diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 2c0c8c2f61..2e5649d8e4 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -140,7 +140,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpo P_MakeDivline (line, &dll); - fixedvec3 pos = optpos? *optpos : user->PosRelative(line); + fixedvec3 pos = optpos? *optpos : user->_f_PosRelative(line); dlu.x = pos.x; dlu.y = pos.y; dlu.dx = finecosine[user->_f_angle() >> ANGLETOFINESHIFT]; diff --git a/src/r_defs.h b/src/r_defs.h index 57fdba270a..f8260996b8 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -1334,27 +1334,27 @@ inline sector_t *P_PointInSector(const DVector2 &pos) return P_PointInSubsector(FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y))->sector; } -inline fixedvec3 AActor::PosRelative(int portalgroup) const +inline fixedvec3 AActor::_f_PosRelative(int portalgroup) const { return __pos + Displacements.getOffset(Sector->PortalGroup, portalgroup); } -inline fixedvec3 AActor::PosRelative(const AActor *other) const +inline fixedvec3 AActor::_f_PosRelative(const AActor *other) const { return __pos + Displacements.getOffset(Sector->PortalGroup, other->Sector->PortalGroup); } -inline fixedvec3 AActor::PosRelative(sector_t *sec) const +inline fixedvec3 AActor::_f_PosRelative(sector_t *sec) const { return __pos + Displacements.getOffset(Sector->PortalGroup, sec->PortalGroup); } -inline fixedvec3 AActor::PosRelative(line_t *line) const +inline fixedvec3 AActor::_f_PosRelative(line_t *line) const { return __pos + Displacements.getOffset(Sector->PortalGroup, line->frontsector->PortalGroup); } -inline fixedvec3 PosRelative(const fixedvec3 &pos, line_t *line, sector_t *refsec = NULL) +inline fixedvec3 _f_PosRelative(const fixedvec3 &pos, line_t *line, sector_t *refsec = NULL) { return pos + Displacements.getOffset(refsec->PortalGroup, line->frontsector->PortalGroup); }