diff --git a/src/actor.h b/src/actor.h index b88aa057c..1d73e1698 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1252,6 +1252,33 @@ public: fixedvec3 ret = { X(), Y(), Z() }; return ret; } + fixedvec3 PosRelative(AActor *other) const + { + fixedvec3 ret = { X(), Y(), Z() }; + return ret; + } + fixedvec3 PosRelative(sector_t *sec) const + { + fixedvec3 ret = { X(), Y(), Z() }; + return ret; + } + fixedvec3 PosRelative(line_t *line) const + { + fixedvec3 ret = { X(), Y(), Z() }; + return ret; + } + fixed_t SoundX() const + { + return X(); + } + fixed_t SoundY() const + { + return Y(); + } + fixed_t SoundZ() const + { + return Z(); + } fixedvec3 InterpolatedPosition(fixed_t ticFrac) const { fixedvec3 ret; @@ -1418,6 +1445,10 @@ inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle) return ret; } +inline fixedvec3 PosRelative(const fixedvec3 &pos, line_t *line, sector_t *refsec = NULL) +{ + return pos; +} void PrintMiscActorInfo(AActor * query); diff --git a/src/p_map.cpp b/src/p_map.cpp index 69f8b6c5b..259becd67 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -581,7 +581,7 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) friction = FRICTION_FLY; } else if ((!(mo->flags & MF_NOGRAVITY) && mo->waterlevel > 1) || - (mo->waterlevel == 1 && mo->z > mo->floorz + 6 * FRACUNIT)) + (mo->waterlevel == 1 && mo->Z() > mo->floorz + 6 * FRACUNIT)) { friction = secfriction(mo->Sector); movefactor = secmovefac(mo->Sector) >> 1; @@ -593,8 +593,8 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) if (!(rover->flags & FF_EXISTS)) continue; if (!(rover->flags & FF_SWIMMABLE)) continue; - if (mo->z > rover->top.plane->ZatPoint(mo) || - mo->z < rover->bottom.plane->ZatPoint(mo)) + if (mo->Z() > rover->top.plane->ZatPoint(mo) || + mo->Z() < rover->bottom.plane->ZatPoint(mo)) continue; newfriction = secfriction(rover->model, rover->top.isceiling); @@ -623,13 +623,13 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) if (rover->flags & FF_SOLID) { // Must be standing on a solid floor - if (mo->z != rover->top.plane->ZatPoint(mo)) continue; + if (mo->Z() != rover->top.plane->ZatPoint(mo)) continue; } else if (rover->flags & FF_SWIMMABLE) { // Or on or inside a swimmable floor (e.g. in shallow water) - if (mo->z > rover->top.plane->ZatPoint(mo) || - (mo->z + mo->height) < rover->bottom.plane->ZatPoint(mo)) + if (mo->Z() > rover->top.plane->ZatPoint(mo) || + (mo->Top()) < rover->bottom.plane->ZatPoint(mo)) continue; } else @@ -650,9 +650,9 @@ int P_GetFriction(const AActor *mo, int *frictionfactor) } newfriction = secfriction(sec); if ((newfriction < friction || friction == ORIG_FRICTION) && - (mo->z <= sec->floorplane.ZatPoint(mo) || + (mo->Z() <= sec->floorplane.ZatPoint(mo) || (sec->GetHeightSec() != NULL && - mo->z <= sec->heightsec->floorplane.ZatPoint(mo)))) + mo->Z() <= sec->heightsec->floorplane.ZatPoint(mo)))) { friction = newfriction; movefactor = secmovefac(sec); @@ -768,6 +768,7 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm) bool NotBlocked = ((tm.thing->flags3 & MF3_NOBLOCKMONST) || ((i_compatflags & COMPATF_NOBLOCKFRIENDS) && (tm.thing->flags & MF_FRIENDLY))); + fixedvec3 pos = tm.thing->PosRelative(ld); if (!(Projectile) || (ld->flags & (ML_BLOCKEVERYTHING | ML_BLOCKPROJECTILE))) { if (ld->flags & ML_RAILING) @@ -786,7 +787,7 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm) } tm.thing->BlockingLine = ld; // Calculate line side based on the actor's original position, not the new one. - CheckForPushSpecial(ld, P_PointOnLineSide(tm.thing->x, tm.thing->y, ld), tm.thing, false); + CheckForPushSpecial(ld, P_PointOnLineSide(pos.x, pos.y, ld), tm.thing, false); return false; } } @@ -797,8 +798,8 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm) { secplane_t frontplane, backplane; // Check 3D floors as well - frontplane = P_FindFloorPlane(ld->frontsector, tm.thing->x, tm.thing->y, tm.thing->floorz); - backplane = P_FindFloorPlane(ld->backsector, tm.thing->x, tm.thing->y, tm.thing->floorz); + frontplane = P_FindFloorPlane(ld->frontsector, pos.x, pos.y, tm.thing->floorz); + backplane = P_FindFloorPlane(ld->backsector, pos.x, pos.y, tm.thing->floorz); if (frontplane.c < STEEPSLOPE || backplane.c < STEEPSLOPE) { const msecnode_t *node = tm.thing->touching_sectorlist; @@ -853,7 +854,7 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm) } else if (r >= (1 << 24)) { - P_LineOpening(open, tm.thing, ld, sx = ld->v2->x, sy = ld->v2->y, tm.thing->x, tm.thing->y); + P_LineOpening(open, tm.thing, ld, sx = ld->v2->x, sy = ld->v2->y, pos.x, pos.y); } else { @@ -1031,8 +1032,9 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY)) return true; // can't hit thing + fixedvec3 thingpos = thing->PosRelative(tm.thing); fixed_t blockdist = thing->radius + tm.thing->radius; - if (abs(thing->x - tm.x) >= blockdist || abs(thing->y - tm.y) >= blockdist) + if (abs(thingpos.x - tm.thing->X()) >= blockdist || abs(thingpos.y - tm.thing->Y()) >= blockdist) return true; if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS) @@ -1042,13 +1044,13 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) return true; tm.thing->BlockingMobj = thing; - topz = thing->z + thing->height; + topz = thing->Top(); if (!(i_compatflags & COMPATF_NO_PASSMOBJ) && !(tm.thing->flags & (MF_FLOAT | MF_MISSILE | MF_SKULLFLY | MF_NOGRAVITY)) && (thing->flags & MF_SOLID) && (thing->flags4 & MF4_ACTLIKEBRIDGE)) { // [RH] Let monsters walk on actors as well as floors if ((tm.thing->flags3 & MF3_ISMONSTER) && - topz >= tm.floorz && topz <= tm.thing->z + tm.thing->MaxStepHeight) + topz >= tm.floorz && topz <= tm.thing->Z() + tm.thing->MaxStepHeight) { // The commented-out if is an attempt to prevent monsters from walking off a // thing further than they would walk off a ledge. I can't think of an easy @@ -1071,12 +1073,12 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) { // 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 (tm.x == tm.thing->x && tm.y == tm.thing->y) + if (tm.x == tm.thing->X() && tm.y == tm.thing->Y()) { unblocking = true; } - else if (abs(thing->x - tm.thing->x) < (thing->radius+tm.thing->radius) && - abs(thing->y - tm.thing->y) < (thing->radius+tm.thing->radius)) + else if (abs(thingpos.x - tm.thing->X()) < (thing->radius+tm.thing->radius) && + abs(thingpos.y - tm.thing->Y()) < (thing->radius+tm.thing->radius)) { fixed_t newdist = thing->AproxDistance(tm.x, tm.y, tm.thing); @@ -1085,8 +1087,8 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) if (newdist > olddist) { // ... but not if they did not overlap in z-direction before but would after the move. - unblocking = !((tm.thing->z >= thing->z + thing->height && tm.z < thing->z + thing->height) || - (tm.thing->z + tm.thing->height <= thing->z && tm.z + tm.thing->height > thing->z)); + unblocking = !((tm.thing->Z() >= thingpos.z + thing->height && tm.z < thingpos.z + thing->height) || + (tm.thing->Top() <= thingpos.z && tm.thing->Top() > thingpos.z)); } } } @@ -1104,7 +1106,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) { // Some things prefer not to overlap each other, if possible return unblocking; } - if ((tm.thing->z >= topz) || (tm.thing->z + tm.thing->height <= thing->z)) + if ((tm.thing->Z() >= topz) || (tm.thing->Top() <= thing->Z())) return true; } } @@ -1120,7 +1122,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) // or different species if DONTHARMSPECIES (!(thing->flags6 & MF6_DONTHARMSPECIES) || thing->GetSpecies() != tm.thing->GetSpecies()) && // touches vertically - thing->z + thing->height >= tm.thing->z && tm.thing->z + tm.thing->height >= thing->z && + topz >= tm.thing->Z() && tm.thing->Z() + tm.thing->height >= thingpos.z && // prevents lost souls from exploding when fired by pain elementals (thing->master != tm.thing && tm.thing->master != thing)) // Difference with MBF: MBF hardcodes the LS/PE check and lets actors of the same species @@ -1223,11 +1225,11 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) } // Check if it went over / under - if (tm.thing->z > thing->z + clipheight) + if (tm.thing->Z() > thingpos.z + clipheight) { // Over thing return true; } - if (tm.thing->z + tm.thing->height < thing->z) + if (tm.thing->Top() < thingpos.z) { // Under thing return true; } @@ -1335,7 +1337,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) !(tm.thing->flags3 & MF3_BLOODLESSIMPACT) && (pr_checkthing() < 192)) { - P_BloodSplatter(tm.thing->x, tm.thing->y, tm.thing->z, thing); + P_BloodSplatter(tm.thing->X(), tm.thing->Y(), tm.thing->Z(), thing); } if (!(tm.thing->flags3 & MF3_BLOODLESSIMPACT)) { @@ -1377,7 +1379,7 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) // [RH] The next condition is to compensate for the extra height // that gets added by P_CheckPosition() so that you cannot pick // up things that are above your true height. - && thing->z < tm.thing->z + tm.thing->height - tm.thing->MaxStepHeight) + && thingpos.z < tm.thing->Top() - tm.thing->MaxStepHeight) { // Can be picked up by tmthing P_TouchSpecialThing(thing, tm.thing); // can remove thing } @@ -1464,7 +1466,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo F3DFloor* rover; fixed_t delta1; fixed_t delta2; - int thingtop = thing->z + (thing->height == 0 ? 1 : thing->height); + int thingtop = thing->Z() + (thing->height == 0 ? 1 : thing->height); for (unsigned i = 0; ie->XFloor.ffloors.Size(); i++) { @@ -1474,7 +1476,7 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo fixed_t ff_bottom = rover->bottom.plane->ZatPoint(x, y); fixed_t ff_top = rover->top.plane->ZatPoint(x, y); - delta1 = thing->z - (ff_bottom + ((ff_top - ff_bottom) / 2)); + delta1 = thing->Z() - (ff_bottom + ((ff_top - ff_bottom) / 2)); delta2 = thingtop - (ff_bottom + ((ff_top - ff_bottom) / 2)); if (ff_top > tm.floorz && abs(delta1) < abs(delta2)) @@ -1526,17 +1528,17 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo return false; } else if (!BlockingMobj->player && !(thing->flags & (MF_FLOAT | MF_MISSILE | MF_SKULLFLY)) && - BlockingMobj->z + BlockingMobj->height - thing->z <= thing->MaxStepHeight) + BlockingMobj->Top() - thing->Z() <= thing->MaxStepHeight) { if (thingblocker == NULL || - BlockingMobj->z > thingblocker->z) + BlockingMobj->Z() > thingblocker->Z()) { thingblocker = BlockingMobj; } thing->BlockingMobj = NULL; } else if (thing->player && - thing->z + thing->height - BlockingMobj->z <= thing->MaxStepHeight) + thing->Top() - BlockingMobj->Z() <= thing->MaxStepHeight) { if (thingblocker) { // There is something to step up on. Return this thing as @@ -1629,10 +1631,10 @@ bool P_TestMobjLocation(AActor *mobj) flags = mobj->flags; mobj->flags &= ~MF_PICKUP; - if (P_CheckPosition(mobj, mobj->x, mobj->y)) + if (P_CheckPosition(mobj, mobj->X(), mobj->Y())) { // XY is ok, now check Z mobj->flags = flags; - if ((mobj->z < mobj->floorz) || (mobj->z + mobj->height > mobj->ceilingz)) + if ((mobj->Z() < mobj->floorz) || (mobj->Top() > mobj->ceilingz)) { // Bad Z return false; } @@ -1656,10 +1658,10 @@ AActor *P_CheckOnmobj(AActor *thing) bool good; AActor *onmobj; - oldz = thing->z; + oldz = thing->Z(); P_FakeZMovement(thing); good = P_TestMobjZ(thing, false, &onmobj); - thing->z = oldz; + thing->SetZ(oldz); return good ? NULL : onmobj; } @@ -1679,7 +1681,7 @@ bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj) return true; } - FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius)); + FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius)); AActor *thing; while ((thing = it.Next())) @@ -1721,15 +1723,15 @@ bool P_TestMobjZ(AActor *actor, bool quick, AActor **pOnmobj) { // Don't clip against whoever shot the missile. continue; } - if (actor->z > thing->z + thing->height) + if (actor->Z() > thing->Top()) { // over thing continue; } - else if (actor->z + actor->height <= thing->z) + else if (actor->Top() <= thing->Z()) { // under thing continue; } - else if (!quick && onmobj != NULL && thing->z + thing->height < onmobj->z + onmobj->height) + else if (!quick && onmobj != NULL && thing->Top() < onmobj->Top()) { // something higher is in the way continue; } @@ -1753,35 +1755,35 @@ void P_FakeZMovement(AActor *mo) // // adjust height // - mo->z += mo->velz; + mo->AddZ(mo->velz); if ((mo->flags&MF_FLOAT) && mo->target) { // float down towards target if too close if (!(mo->flags & MF_SKULLFLY) && !(mo->flags & MF_INFLOAT)) { fixed_t dist = mo->AproxDistance(mo->target); - fixed_t delta = (mo->target->z + (mo->height >> 1)) - mo->z; + fixed_t delta = (mo->target->Z() + (mo->height >> 1)) - mo->Z(); if (delta < 0 && dist < -(delta * 3)) - mo->z -= mo->FloatSpeed; + mo->AddZ(-mo->FloatSpeed); else if (delta > 0 && dist < (delta * 3)) - mo->z += mo->FloatSpeed; + mo->AddZ(mo->FloatSpeed); } } - if (mo->player && mo->flags&MF_NOGRAVITY && (mo->z > mo->floorz) && !mo->IsNoClip2()) + if (mo->player && mo->flags&MF_NOGRAVITY && (mo->Z() > mo->floorz) && !mo->IsNoClip2()) { - mo->z += finesine[(FINEANGLES / 80 * level.maptime)&FINEMASK] / 8; + mo->AddZ(finesine[(FINEANGLES / 80 * level.maptime)&FINEMASK] / 8); } // // clip movement // - if (mo->z <= mo->floorz) + if (mo->Z() <= mo->floorz) { // hit the floor - mo->z = mo->floorz; + mo->SetZ(mo->floorz); } - if (mo->z + mo->height > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { // hit the ceiling - mo->z = mo->ceilingz - mo->height; + mo->SetZ(mo->ceilingz - mo->height); } } @@ -1802,8 +1804,8 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo fixed_t fzb = line->frontsector->floorplane.ZatPoint(mobj); fixed_t bzt = line->backsector->ceilingplane.ZatPoint(mobj); fixed_t bzb = line->backsector->floorplane.ZatPoint(mobj); - if (fzt >= mobj->z + mobj->height && bzt >= mobj->z + mobj->height && - fzb <= mobj->z && bzb <= mobj->z) + if (fzt >= mobj->Top() && bzt >= mobj->Top() && + fzb <= mobj->Z() && bzb <= mobj->Z()) { // we must also check if some 3D floor in the backsector may be blocking for (unsigned int i = 0; ibacksector->e->XFloor.ffloors.Size(); i++) @@ -1815,7 +1817,7 @@ static void CheckForPushSpecial(line_t *line, int side, AActor *mobj, bool windo fixed_t ff_bottom = rover->bottom.plane->ZatPoint(mobj); fixed_t ff_top = rover->top.plane->ZatPoint(mobj); - if (ff_bottom < mobj->z + mobj->height && ff_top > mobj->z) + if (ff_bottom < mobj->Top() && ff_top > mobj->Z()) { goto isblocking; } @@ -1858,8 +1860,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bool missileCheck) // [GZ] Fired missiles ignore the drop-off test { - fixed_t oldx; - fixed_t oldy; + fixedvec3 oldpos; + sector_t *oldsector; fixed_t oldz; int side; int oldside; @@ -1868,10 +1870,10 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, sector_t* newsec; tm.floatok = false; - oldz = thing->z; + oldz = thing->Z(); if (onfloor) { - thing->z = onfloor->ZatPoint(x, y); + thing->SetZ(onfloor->ZatPoint(x, y)); } thing->flags6 |= MF6_INTRYMOVE; if (!P_CheckPosition(thing, x, y, tm)) @@ -1888,19 +1890,16 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, { goto pushline; } - else if (BlockingMobj->z + BlockingMobj->height - thing->z - > thing->MaxStepHeight - || (BlockingMobj->Sector->ceilingplane.ZatPoint(x, y) - - (BlockingMobj->z + BlockingMobj->height) < thing->height) - || (tm.ceilingz - (BlockingMobj->z + BlockingMobj->height) - < thing->height)) + else if (BlockingMobj->Top() - thing->Z() > thing->MaxStepHeight + || (BlockingMobj->Sector->ceilingplane.ZatPoint(x, y) - (BlockingMobj->Top()) < thing->height) + || (tm.ceilingz - (BlockingMobj->Top()) < thing->height)) { goto pushline; } } if (!(tm.thing->flags2 & MF2_PASSMOBJ) || (i_compatflags & COMPATF_NO_PASSMOBJ)) { - thing->z = oldz; + thing->SetZ(oldz); thing->flags6 &= ~MF6_INTRYMOVE; return false; } @@ -1908,16 +1907,16 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, if (thing->flags3 & MF3_FLOORHUGGER) { - thing->z = tm.floorz; + thing->SetZ(tm.floorz); } else if (thing->flags3 & MF3_CEILINGHUGGER) { - thing->z = tm.ceilingz - thing->height; + thing->SetZ(tm.ceilingz - thing->height); } if (onfloor && tm.floorsector == thing->floorsector) { - thing->z = tm.floorz; + thing->SetZ(tm.floorz); } if (!(thing->flags & MF_NOCLIP)) { @@ -1929,7 +1928,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, tm.floatok = true; if (!(thing->flags & MF_TELEPORT) - && tm.ceilingz - thing->z < thing->height + && tm.ceilingz - thing->Z() < thing->height && !(thing->flags3 & MF3_CEILINGHUGGER) && (!(thing->flags2 & MF2_FLY) || !(thing->flags & MF_NOGRAVITY))) { @@ -1938,17 +1937,17 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, if (thing->flags2 & MF2_FLY && thing->flags & MF_NOGRAVITY) { #if 1 - if (thing->z + thing->height > tm.ceilingz) + if (thing->Top() > tm.ceilingz) goto pushline; #else // When flying, slide up or down blocking lines until the actor // is not blocked. - if (thing->z + thing->height > tm.ceilingz) + if (thing->Top() > tm.ceilingz) { thing->velz = -8 * FRACUNIT; goto pushline; } - else if (thing->z < tm.floorz && tm.floorz - tm.dropoffz > thing->MaxDropOffHeight) + else if (thing->Z() < tm.floorz && tm.floorz - tm.dropoffz > thing->MaxDropOffHeight) { thing->velz = 8 * FRACUNIT; goto pushline; @@ -1957,28 +1956,28 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, } if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER)) { - if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm.floorz > thing->z) + if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm.floorz > thing->Z()) { // [RH] Don't let normal missiles climb steps goto pushline; } - if (tm.floorz - thing->z > thing->MaxStepHeight) + if (tm.floorz - thing->Z() > thing->MaxStepHeight) { // too big a step up goto pushline; } - else if (thing->z < tm.floorz) + else if (thing->Z() < tm.floorz) { // [RH] Check to make sure there's nothing in the way for the step up - fixed_t savedz = thing->z; + fixed_t savedz = thing->Z(); bool good; - thing->z = tm.floorz; + thing->SetZ(tm.floorz); good = P_TestMobjZ(thing); - thing->z = savedz; + thing->SetZ(savedz); if (!good) { goto pushline; } if (thing->flags6 & MF6_STEPMISSILE) { - thing->z = tm.floorz; + thing->SetZ(tm.floorz); // If moving down, cancel vertical component of the velocity if (thing->velz < 0) { @@ -2004,7 +2003,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, } if (dropoff == 2 && // large jump down (e.g. dogs) - (tm.floorz - tm.dropoffz > 128 * FRACUNIT || thing->target == NULL || thing->target->z >tm.dropoffz)) + (tm.floorz - tm.dropoffz > 128 * FRACUNIT || thing->target == NULL || thing->target->Z() >tm.dropoffz)) { dropoff = false; } @@ -2020,14 +2019,14 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, // This is so that it does not walk off of things onto a drop off. if (thing->flags2 & MF2_ONMOBJ) { - floorz = MAX(thing->z, tm.floorz); + floorz = MAX(thing->Z(), tm.floorz); } if (floorz - tm.dropoffz > thing->MaxDropOffHeight && !(thing->flags2 & MF2_BLASTED) && !missileCheck) { // Can't move over a dropoff unless it's been blasted // [GZ] Or missile-spawned - thing->z = oldz; + thing->SetZ(oldz); thing->flags6 &= ~MF6_INTRYMOVE; return false; } @@ -2046,9 +2045,9 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, } if (thing->flags2 & MF2_CANTLEAVEFLOORPIC && (tm.floorpic != thing->floorpic - || tm.floorz - thing->z != 0)) + || tm.floorz - thing->Z() != 0)) { // must stay within a sector of a certain floor type - thing->z = oldz; + thing->SetZ(oldz); thing->flags6 &= ~MF6_INTRYMOVE; return false; } @@ -2063,7 +2062,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, thing->player->Bot->dest = NULL; thing->velx = 0; thing->vely = 0; - thing->z = oldz; + thing->SetZ(oldz); thing->flags6 &= ~MF6_INTRYMOVE; return false; } @@ -2090,7 +2089,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, // Borrowed from MBF: if (thing->BounceFlags & BOUNCE_MBF && // killough 8/13/98 !(thing->flags & (MF_MISSILE | MF_NOGRAVITY)) && - !thing->IsSentient() && tm.floorz - thing->z > 16 * FRACUNIT) + !thing->IsSentient() && tm.floorz - thing->Z() > 16 * FRACUNIT) { // too big a step up for MBF bouncers under gravity thing->flags6 &= ~MF6_INTRYMOVE; return false; @@ -2099,8 +2098,8 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, // the move is ok, so link the thing into its new position thing->UnlinkFromWorld(); - oldx = thing->x; - oldy = thing->y; + oldpos = thing->Pos(); + oldsector = thing->Sector; thing->floorz = tm.floorz; thing->ceilingz = tm.ceilingz; thing->dropoffz = tm.dropoffz; // killough 11/98: keep track of dropoffs @@ -2109,8 +2108,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, thing->floorsector = tm.floorsector; thing->ceilingpic = tm.ceilingpic; thing->ceilingsector = tm.ceilingsector; - thing->x = x; - thing->y = y; + thing->SetXY(x, y); thing->LinkToWorld(); @@ -2124,9 +2122,11 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, { while (spechit.Pop(ld)) { + fixedvec3 thingpos = thing->PosRelative(ld); + fixedvec3 oldrelpos = PosRelative(oldpos, ld, oldsector); // see if the line was crossed - side = P_PointOnLineSide(thing->x, thing->y, ld); - oldside = P_PointOnLineSide(oldx, oldy, ld); + side = P_PointOnLineSide(thingpos.x, thingpos.y, ld); + oldside = P_PointOnLineSide(oldrelpos.x, oldrelpos.y, ld); if (side != oldside && ld->special && !(thing->flags6 & MF6_NOTRIGGER)) { if (thing->player && (thing->player->cheats & CF_PREDICTING)) @@ -2171,7 +2171,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, if (newsec->heightsec && oldsec->heightsec && newsec->SecActTarget) { const sector_t *hs = newsec->heightsec; - fixed_t eyez = thing->z + viewheight; + fixed_t eyez = thing->Z() + viewheight; fixed_t fakez = hs->floorplane.ZatPoint(x, y); if (!oldAboveFakeFloor && eyez > fakez) @@ -2211,7 +2211,7 @@ pushline: return false; } - thing->z = oldz; + thing->SetZ(oldz); if (!(thing->flags&(MF_TELEPORT | MF_NOCLIP))) { int numSpecHitTemp; @@ -2225,7 +2225,8 @@ pushline: { // see which lines were pushed ld = spechit[--numSpecHitTemp]; - side = P_PointOnLineSide(thing->x, thing->y, ld); + fixedvec3 pos = thing->PosRelative(ld); + side = P_PointOnLineSide(pos.x, pos.y, ld); CheckForPushSpecial(ld, side, thing, true); } } @@ -2252,7 +2253,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y, bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y) { FCheckPosition tm; - fixed_t newz = thing->z; + fixed_t newz = thing->Z(); if (!P_CheckPosition(thing, x, y, tm)) { @@ -2284,7 +2285,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y) } if (thing->flags2 & MF2_FLY && thing->flags & MF_NOGRAVITY) { - if (thing->z + thing->height > tm.ceilingz) + if (thing->Top() > tm.ceilingz) return false; } if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER)) @@ -2299,10 +2300,10 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y) } else if (newz < tm.floorz) { // [RH] Check to make sure there's nothing in the way for the step up - fixed_t savedz = thing->z; - thing->z = newz = tm.floorz; + fixed_t savedz = thing->Z(); + thing->SetZ(newz = tm.floorz); bool good = P_TestMobjZ(thing); - thing->z = savedz; + thing->SetZ(savedz); if (!good) { return false; @@ -2383,7 +2384,7 @@ void FSlide::HitSlideLine(line_t* ld) icyfloor = (P_AproxDistance(tmxmove, tmymove) > 4 * FRACUNIT) && var_friction && // killough 8/28/98: calc friction on demand - slidemo->z <= slidemo->floorz && + slidemo->Z() <= slidemo->floorz && P_GetFriction(slidemo, NULL) > ORIG_FRICTION; if (ld->dx == 0) @@ -2421,7 +2422,8 @@ void FSlide::HitSlideLine(line_t* ld) // The wall is angled. Bounce if the angle of approach is // phares // less than 45 degrees. // phares - side = P_PointOnLineSide(slidemo->x, slidemo->y, ld); + fixedvec3 pos = slidemo->PosRelative(ld); + side = P_PointOnLineSide(pos.x, pos.y, ld); lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy); @@ -2473,8 +2475,8 @@ void FSlide::HitSlideLine(line_t* ld) P_MakeDivline(ld, &dll); - dlv.x = slidemo->x; - dlv.y = slidemo->y; + dlv.x = pos.x; + dlv.y = pos.y; dlv.dx = dll.dy; dlv.dy = -dll.dx; @@ -2526,7 +2528,8 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t if (!(li->flags & ML_TWOSIDED) || !li->backsector) { - if (P_PointOnLineSide(slidemo->x, slidemo->y, li)) + fixedvec3 pos = slidemo->PosRelative(li); + if (P_PointOnLineSide(pos.x, pos.y, li)) { // don't hit the back side continue; @@ -2554,19 +2557,19 @@ void FSlide::SlideTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t if (open.range < slidemo->height) goto isblocking; // doesn't fit - if (open.top - slidemo->z < slidemo->height) + if (open.top - slidemo->Z() < slidemo->height) goto isblocking; // mobj is too high - if (open.bottom - slidemo->z > slidemo->MaxStepHeight) + if (open.bottom - slidemo->Z() > slidemo->MaxStepHeight) { goto isblocking; // too big a step up } - else if (slidemo->z < open.bottom) + else if (slidemo->Z() < open.bottom) { // [RH] Check to make sure there's nothing in the way for the step up - fixed_t savedz = slidemo->z; - slidemo->z = open.bottom; + fixed_t savedz = slidemo->Z(); + slidemo->SetZ(open.bottom); bool good = P_TestMobjZ(slidemo); - slidemo->z = savedz; + slidemo->SetZ(savedz); if (!good) { goto isblocking; @@ -2627,24 +2630,24 @@ retry: // trace along the three leading corners if (tryx > 0) { - leadx = mo->x + mo->radius; - trailx = mo->x - mo->radius; + leadx = mo->X() + mo->radius; + trailx = mo->X() - mo->radius; } else { - leadx = mo->x - mo->radius; - trailx = mo->x + mo->radius; + leadx = mo->X() - mo->radius; + trailx = mo->X() + mo->radius; } if (tryy > 0) { - leady = mo->y + mo->radius; - traily = mo->y - mo->radius; + leady = mo->Y() + mo->radius; + traily = mo->Y() - mo->radius; } else { - leady = mo->y - mo->radius; - traily = mo->y + mo->radius; + leady = mo->Y() - mo->radius; + traily = mo->Y() + mo->radius; } bestslidefrac = FRACUNIT + 1; @@ -2661,11 +2664,11 @@ retry: // killough 3/15/98: Allow objects to drop off ledges xmove = 0, ymove = tryy; walkplane = P_CheckSlopeWalk(mo, xmove, ymove); - if (!P_TryMove(mo, mo->x + xmove, mo->y + ymove, true, walkplane)) + if (!P_TryMove(mo, mo->X() + xmove, mo->Y() + ymove, true, walkplane)) { xmove = tryx, ymove = 0; walkplane = P_CheckSlopeWalk(mo, xmove, ymove); - P_TryMove(mo, mo->x + xmove, mo->y + ymove, true, walkplane); + P_TryMove(mo, mo->X() + xmove, mo->Y() + ymove, true, walkplane); } return; } @@ -2682,7 +2685,7 @@ retry: const fixed_t startvely = mo->vely; // killough 3/15/98: Allow objects to drop off ledges - if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true)) + if (!P_TryMove(mo, mo->X() + newx, mo->Y() + newy, true)) goto stairstep; if (mo->velx != startvelx || mo->vely != startvely) @@ -2716,7 +2719,7 @@ retry: walkplane = P_CheckSlopeWalk(mo, tmxmove, tmymove); // killough 3/15/98: Allow objects to drop off ledges - if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true, walkplane)) + if (!P_TryMove(mo, mo->X() + tmxmove, mo->Y() + tmymove, true, walkplane)) { goto retry; } @@ -2752,7 +2755,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov fixed_t thisplanez = rover->top.plane->ZatPoint(actor); - if (thisplanez>planezhere && thisplanez <= actor->z + actor->MaxStepHeight) + if (thisplanez>planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight) { copyplane = *rover->top.plane; if (copyplane.c<0) copyplane.FlipVert(); @@ -2770,7 +2773,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov fixed_t thisplanez = rover->top.plane->ZatPoint(actor); - if (thisplanez>planezhere && thisplanez <= actor->z + actor->MaxStepHeight) + if (thisplanez>planezhere && thisplanez <= actor->Z() + actor->MaxStepHeight) { copyplane = *rover->top.plane; if (copyplane.c<0) copyplane.FlipVert(); @@ -2787,7 +2790,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov return NULL; } - if (actor->z - planezhere > FRACUNIT) + if (actor->Z() - planezhere > FRACUNIT) { // not on floor return NULL; } @@ -2797,9 +2800,9 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov fixed_t destx, desty; fixed_t t; - destx = actor->x + xmove; - desty = actor->y + ymove; - t = TMulScale16(plane->a, destx, plane->b, desty, plane->c, actor->z) + plane->d; + destx = actor->X() + xmove; + desty = actor->Y() + ymove; + t = TMulScale16(plane->a, destx, plane->b, desty, plane->c, actor->Z()) + plane->d; if (t < 0) { // Desired location is behind (below) the plane // (i.e. Walking up the plane) @@ -2821,7 +2824,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov const sector_t *sec = node->m_sector; if (sec->floorplane.c >= STEEPSLOPE) { - if (sec->floorplane.ZatPoint(destx, desty) >= actor->z - actor->MaxStepHeight) + if (sec->floorplane.ZatPoint(destx, desty) >= actor->Z() - actor->MaxStepHeight) { dopush = false; break; @@ -2841,19 +2844,19 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov // so that it lies on the plane's surface destx -= FixedMul(plane->a, t); desty -= FixedMul(plane->b, t); - xmove = destx - actor->x; - ymove = desty - actor->y; + xmove = destx - actor->X(); + ymove = desty - actor->Y(); return (actor->floorsector == actor->Sector) ? plane : NULL; } else if (t > 0) { // Desired location is in front of (above) the plane - if (planezhere == actor->z) + if (planezhere == actor->Z()) { // Actor's current spot is on/in the plane, so walk down it // Same principle as walking up, except reversed destx += FixedMul(plane->a, t); desty += FixedMul(plane->b, t); - xmove = destx - actor->x; - ymove = desty - actor->y; + xmove = destx - actor->X(); + ymove = desty - actor->Y(); return (actor->floorsector == actor->Sector) ? plane : NULL; } } @@ -2892,7 +2895,7 @@ bool FSlide::BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_ } if (!(li->flags&ML_TWOSIDED) || !li->backsector) { - if (P_PointOnLineSide(slidemo->x, slidemo->y, li)) + if (P_PointOnLineSide(slidemo->X(), slidemo->Y(), li)) continue; // don't hit the back side goto bounceblocking; } @@ -2903,10 +2906,10 @@ bool FSlide::BounceTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_ if (open.range < slidemo->height) goto bounceblocking; // doesn't fit - if (open.top - slidemo->z < slidemo->height) + if (open.top - slidemo->Z() < slidemo->height) goto bounceblocking; // mobj is too high - if (open.bottom > slidemo->z) + if (open.bottom > slidemo->Z()) goto bounceblocking; // mobj is too low continue; // this line doesn't block movement @@ -2950,26 +2953,26 @@ bool FSlide::BounceWall(AActor *mo) // if (mo->velx > 0) { - leadx = mo->x + mo->radius; + leadx = mo->X() + mo->radius; } else { - leadx = mo->x - mo->radius; + leadx = mo->X() - mo->radius; } if (mo->vely > 0) { - leady = mo->y + mo->radius; + leady = mo->Y() + mo->radius; } else { - leady = mo->y - mo->radius; + leady = mo->Y() - mo->radius; } bestslidefrac = FRACUNIT + 1; bestslideline = mo->BlockingLine; if (BounceTraverse(leadx, leady, leadx + mo->velx, leady + mo->vely) && mo->BlockingLine == NULL) { // Could not find a wall, so bounce off the floor/ceiling instead. - fixed_t floordist = mo->z - mo->floorz; - fixed_t ceildist = mo->ceilingz - mo->z; + fixed_t floordist = mo->Z() - mo->floorz; + fixed_t ceildist = mo->ceilingz - mo->Z(); if (floordist <= ceildist) { mo->FloorBounceMissile(mo->Sector->floorplane); @@ -3000,7 +3003,7 @@ bool FSlide::BounceWall(AActor *mo) return true; } - side = P_PointOnLineSide(mo->x, mo->y, line); + side = P_PointOnLineSide(mo->X(), mo->Y(), line); lineangle = R_PointToAngle2(0, 0, line->dx, line->dy); if (side == 1) { @@ -3015,11 +3018,14 @@ bool FSlide::BounceWall(AActor *mo) movelen = fixed_t(sqrt(double(mo->velx)*mo->velx + double(mo->vely)*mo->vely)); movelen = FixedMul(movelen, mo->wallbouncefactor); - FBoundingBox box(mo->x, mo->y, mo->radius); + FBoundingBox box(mo->X(), mo->Y(), mo->radius); if (box.BoxOnLineSide(line) == -1) { - mo->SetOrigin(mo->x + FixedMul(mo->radius, - finecosine[deltaangle]), mo->y + FixedMul(mo->radius, finesine[deltaangle]), mo->z); + fixedvec3 pos = mo->Vec3Offset( + FixedMul(mo->radius, finecosine[deltaangle]), + FixedMul(mo->radius, finesine[deltaangle]), 0); + mo->SetOrigin(pos, true); + } if (movelen < FRACUNIT) { @@ -3193,7 +3199,7 @@ bool aim_t::AimTraverse3DFloors(const divline_t &trace, intercept_t * in) fixed_t trY = trace.y + FixedMul(trace.dy, in->frac); fixed_t dist = FixedMul(attackrange, in->frac); - frontflag = P_PointOnLineSide(shootthing->x, shootthing->y, li); + frontflag = P_PointOnLineSide(shootthing->X(), shootthing->Y(), li); // 3D floor check. This is not 100% accurate but normally sufficient when // combined with a final sight check @@ -3365,7 +3371,7 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en { if (lastceilingplane) { - fixed_t ff_top = lastceilingplane->ZatPoint(th->x, th->y); + fixed_t ff_top = lastceilingplane->ZatPoint(th); fixed_t pitch = -(int)R_PointToAngle2(0, shootz, dist, ff_top); // upper slope intersects with this 3d-floor if (pitch > toppitch) @@ -3375,7 +3381,7 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en } if (lastfloorplane) { - fixed_t ff_bottom = lastfloorplane->ZatPoint(th->x, th->y); + fixed_t ff_bottom = lastfloorplane->ZatPoint(th); fixed_t pitch = -(int)R_PointToAngle2(0, shootz, dist, ff_bottom); // lower slope intersects with this 3d-floor if (pitch < bottompitch) @@ -3387,12 +3393,12 @@ void aim_t::AimTraverse(fixed_t startx, fixed_t starty, fixed_t endx, fixed_t en // check angles to see if the thing can be aimed at - thingtoppitch = -(int)R_PointToAngle2(0, shootz, dist, th->z + th->height); + thingtoppitch = -(int)R_PointToAngle2(0, shootz, dist, th->Z() + th->height); if (thingtoppitch > bottompitch) continue; // shot over the thing - thingbottompitch = -(int)R_PointToAngle2(0, shootz, dist, th->z); + thingbottompitch = -(int)R_PointToAngle2(0, shootz, dist, th->Z()); if (thingbottompitch < toppitch) continue; // shot under the thing @@ -3502,9 +3508,9 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL aim.shootthing = t1; aim.friender = (friender == NULL) ? t1 : friender; - x2 = t1->x + (distance >> FRACBITS)*finecosine[angle]; - y2 = t1->y + (distance >> FRACBITS)*finesine[angle]; - aim.shootz = t1->z + (t1->height >> 1) - t1->floorclip; + x2 = t1->X() + (distance >> FRACBITS)*finecosine[angle]; + y2 = t1->Y() + (distance >> FRACBITS)*finesine[angle]; + aim.shootz = t1->Z() + (t1->height >> 1) - t1->floorclip; if (t1->player != NULL) { aim.shootz += FixedMul(t1->player->mo->AttackZOffset, t1->player->crouchfactor); @@ -3559,15 +3565,15 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, AActor **pL for (unsigned i = 0; iSector->e->XFloor.ffloors.Size(); i++) { F3DFloor * rover = t1->Sector->e->XFloor.ffloors[i]; - fixed_t bottomz = rover->bottom.plane->ZatPoint(t1->x, t1->y); + fixed_t bottomz = rover->bottom.plane->ZatPoint(t1); - if (bottomz >= t1->z + t1->height) aim.lastceilingplane = rover->bottom.plane; + if (bottomz >= t1->Top()) aim.lastceilingplane = rover->bottom.plane; - bottomz = rover->top.plane->ZatPoint(t1->x, t1->y); - if (bottomz <= t1->z) aim.lastfloorplane = rover->top.plane; + bottomz = rover->top.plane->ZatPoint(t1); + if (bottomz <= t1->Z()) aim.lastfloorplane = rover->top.plane; } - aim.AimTraverse(t1->x, t1->y, x2, y2, target); + aim.AimTraverse(t1->X(), t1->Y(), x2, y2, target); if (!aim.linetarget) { @@ -3670,7 +3676,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, vy = FixedMul(finecosine[pitch], finesine[angle]); vz = -finesine[pitch]; - shootz = t1->z - t1->floorclip + (t1->height >> 1); + shootz = t1->Z() - t1->floorclip + (t1->height >> 1); if (t1->player != NULL) { shootz += FixedMul(t1->player->mo->AttackZOffset, t1->player->crouchfactor); @@ -3708,7 +3714,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) tflags = TRACE_NoSky; else tflags = TRACE_NoSky | TRACE_Impact; - if (!Trace(t1->x, t1->y, shootz, t1->Sector, vx, vy, vz, distance, + if (!Trace(t1->X(), t1->Y(), shootz, t1->Sector, vx, vy, vz, distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING | ML_BLOCKHITSCAN, t1, trace, tflags, CheckForActor, &TData)) { // hit nothing @@ -3738,8 +3744,8 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, if (trace.HitType != TRACE_HitWall || trace.Line->special != Line_Horizon) { fixed_t closer = trace.Distance - 4 * FRACUNIT; - puff = P_SpawnPuff(t1, pufftype, t1->x + FixedMul(vx, closer), - t1->y + FixedMul(vy, closer), + fixedvec2 pos = t1->Vec2Offset(FixedMul(vx, closer), FixedMul(vy, closer)); + puff = P_SpawnPuff(t1, pufftype, pos.x, pos.y, shootz + FixedMul(vz, closer), angle - ANG90, 0, puffFlags); } @@ -3775,8 +3781,8 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, { // Using the puff's position is not accurate enough. // Instead make it splash at the actual hit position - hitx = t1->x + FixedMul(vx, trace.Distance); - hity = t1->y + FixedMul(vy, trace.Distance); + hitx = t1->X() + FixedMul(vx, trace.Distance); + hity = t1->Y() + FixedMul(vy, trace.Distance); hitz = shootz + FixedMul(vz, trace.Distance); P_HitWater(puff, P_PointInSector(hitx, hity), hitx, hity, hitz); } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 1c5105235..e2d5a3cf6 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -380,11 +380,11 @@ void AActor::Serialize (FArchive &arc) Speed = GetDefault()->Speed; } } - PrevX = x; - PrevY = y; - PrevZ = z; + PrevX = X(); + PrevY = Y(); + PrevZ = Z(); PrevAngle = angle; - UpdateWaterLevel(z, false); + UpdateWaterLevel(Z(), false); } } @@ -396,12 +396,12 @@ AActor::AActor () throw() AActor::AActor (const AActor &other) throw() : DThinker() { - memcpy (&x, &other.x, (BYTE *)&this[1] - (BYTE *)&x); + memcpy (&snext, &other.snext, (BYTE *)&this[1] - (BYTE *)&snext); } AActor &AActor::operator= (const AActor &other) { - memcpy (&x, &other.x, (BYTE *)&this[1] - (BYTE *)&x); + memcpy (&snext, &other.snext, (BYTE *)&this[1] - (BYTE *)&snext); return *this; } @@ -738,7 +738,7 @@ AInventory *AActor::DropInventory (AInventory *item) return NULL; } an = angle >> ANGLETOFINESHIFT; - drop->SetOrigin(x, y, z + 10*FRACUNIT); + drop->SetOrigin(PosPlusZ(10*FRACUNIT), false); drop->angle = angle; drop->velx = velx + 5 * finecosine[an]; drop->vely = vely + 5 * finesine[an]; @@ -1165,7 +1165,7 @@ bool AActor::Grind(bool items) return false; } - AActor *gib = Spawn (i, x, y, z, ALLOW_REPLACE); + AActor *gib = Spawn (i, Pos(), ALLOW_REPLACE); if (gib != NULL) { gib->RenderStyle = RenderStyle; @@ -1284,7 +1284,8 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) if (line != NULL && cl_missiledecals) { - int side = P_PointOnLineSidePrecise (mo->x, mo->y, line); + fixedvec3 pos = mo->PosRelative(line); + int side = P_PointOnLineSidePrecise (pos.x, pos.y, line); if (line->sidedef[side] == NULL) side ^= 1; if (line->sidedef[side] != NULL) @@ -1301,7 +1302,7 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) { SDWORD frac; - num = (SQWORD)(mo->x-line->v1->x)*line->dx+(SQWORD)(mo->y-line->v1->y)*line->dy; + num = (SQWORD)(pos.x-line->v1->x)*line->dx+(SQWORD)(pos.y-line->v1->y)*line->dy; if (num <= 0) { frac = 0; @@ -1317,7 +1318,7 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) x = line->v1->x + MulScale30 (line->dx, frac); y = line->v1->y + MulScale30 (line->dy, frac); - z = mo->z; + z = pos.z; F3DFloor * ffloor=NULL; if (line->sidedef[side^1] != NULL) @@ -1427,7 +1428,7 @@ void AActor::PlayBounceSound(bool onfloor) bool AActor::FloorBounceMissile (secplane_t &plane) { - if (z <= floorz && P_HitFloor (this)) + if (Z() <= floorz && P_HitFloor (this)) { // Landed in some sort of liquid if (BounceFlags & BOUNCE_ExplodeOnWater) @@ -1666,15 +1667,15 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) { - if (actor->z + actor->height < target->z || - target->z + target->height < actor->z) + if (actor->Top() < target->Z() || + target->Top() < actor->Z()) { // Need to seek vertically dist = actor->AproxDistance (target) / speed; if (dist < 1) { dist = 1; } - actor->velz = ((target->z+target->height/2) - (actor->z+actor->height/2)) / dist; + actor->velz = ((target->Z() + target->height / 2) - (actor->Z() + actor->height / 2)) / dist; } } } @@ -1683,14 +1684,14 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci angle_t pitch = 0; if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) { // Need to seek vertically - double dist = MAX(1.0, FVector2(target->x - actor->x, target->y - actor->y).Length()); + double dist = MAX(1.0, FVector2(actor->Vec2To(target)).Length()); // Aim at a player's eyes and at the middle of the actor for everything else. fixed_t aimheight = target->height/2; if (target->IsKindOf(RUNTIME_CLASS(APlayerPawn))) { aimheight = static_cast(target)->ViewHeight; } - pitch = R_PointToAngle2(0, actor->z + actor->height/2, xs_CRoundToInt(dist), target->z + aimheight); + pitch = R_PointToAngle2(0, actor->Z() + actor->height/2, xs_CRoundToInt(dist), target->Z() + aimheight); pitch >>= ANGLETOFINESHIFT; } @@ -1725,7 +1726,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) int steps, step, totalsteps; fixed_t startx, starty; fixed_t oldfloorz = mo->floorz; - fixed_t oldz = mo->z; + fixed_t oldz = mo->Z(); fixed_t maxmove = (mo->waterlevel < 1) || (mo->flags & MF_MISSILE) || (mo->player && mo->player->crouchoffset<-10*FRACUNIT) ? MAXMOVE : MAXMOVE/4; @@ -1861,8 +1862,8 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) fixed_t onestepx = startxmove / steps; fixed_t onestepy = startymove / steps; - startx = mo->x; - starty = mo->y; + startx = mo->X(); + starty = mo->Y(); step = 1; totalsteps = steps; @@ -1948,8 +1949,8 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) onestepy = ymove / steps; P_CheckSlopeWalk (mo, xmove, ymove); } - startx = mo->x - Scale (xmove, step, steps); - starty = mo->y - Scale (ymove, step, steps); + startx = mo->X() - Scale (xmove, step, steps); + starty = mo->Y() - Scale (ymove, step, steps); } } else @@ -1962,7 +1963,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) fixed_t tx, ty; tx = 0, ty = onestepy; walkplane = P_CheckSlopeWalk (mo, tx, ty); - if (P_TryMove (mo, mo->x + tx, mo->y + ty, true, walkplane, tm)) + if (P_TryMove (mo, mo->X() + tx, mo->Y() + ty, true, walkplane, tm)) { mo->velx = 0; } @@ -1970,7 +1971,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) { tx = onestepx, ty = 0; walkplane = P_CheckSlopeWalk (mo, tx, ty); - if (P_TryMove (mo, mo->x + tx, mo->y + ty, true, walkplane, tm)) + if (P_TryMove (mo, mo->X() + tx, mo->Y() + ty, true, walkplane, tm)) { mo->vely = 0; } @@ -2033,7 +2034,9 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) float speed = (float)(mo->Speed); //dest->x - source->x - FVector3 velocity(origin->x - mo->x, origin->y - mo->y, (origin->z + (origin->height/2)) - mo->z); + fixedvec3 vect = mo->Vec3To(origin); + vect.z += origin->height / 2; + FVector3 velocity(vect); velocity.Resize(speed); mo->velx = (fixed_t)(velocity.X); mo->vely = (fixed_t)(velocity.Y); @@ -2077,7 +2080,7 @@ explode: if (tm.ceilingline && tm.ceilingline->backsector && tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum && - mo->z >= tm.ceilingline->backsector->ceilingplane.ZatPoint(mo)) + mo->Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(mo)) { // Hack to prevent missiles exploding against the sky. // Does not handle sky floors. @@ -2102,7 +2105,7 @@ explode: } else { - if (mo->x != ptryx || mo->y != ptryy) + if (mo->X() != ptryx || mo->Y() != ptryy) { // If the new position does not match the desired position, the player // must have gone through a teleporter, so stop moving right now if it @@ -2114,8 +2117,8 @@ explode: } else { - startx = mo->x - Scale (xmove, step, steps); - starty = mo->y - Scale (ymove, step, steps); + startx = mo->X() - Scale (xmove, step, steps); + starty = mo->Y() - Scale (ymove, step, steps); } } } @@ -2135,7 +2138,7 @@ explode: return oldfloorz; } - if (mo->z > mo->floorz && !(mo->flags2 & MF2_ONMOBJ) && + if (mo->Z() > mo->floorz && !(mo->flags2 & MF2_ONMOBJ) && !mo->IsNoClip2() && (!(mo->flags2 & MF2_FLY) || !(mo->flags & MF_NOGRAVITY)) && !mo->waterlevel) @@ -2157,7 +2160,7 @@ explode: // killough 8/11/98: add bouncers // killough 9/15/98: add objects falling off ledges // killough 11/98: only include bouncers hanging off ledges - if ((mo->flags & MF_CORPSE) || (mo->BounceFlags & BOUNCE_MBF && mo->z > mo->dropoffz) || (mo->flags6 & MF6_FALLING)) + if ((mo->flags & MF_CORPSE) || (mo->BounceFlags & BOUNCE_MBF && mo->Z() > mo->dropoffz) || (mo->flags6 & MF6_FALLING)) { // Don't stop sliding if halfway off a step with some velocity if (mo->velx > FRACUNIT/4 || mo->velx < -FRACUNIT/4 || mo->vely > FRACUNIT/4 || mo->vely < -FRACUNIT/4) { @@ -2172,7 +2175,7 @@ explode: // if the floor comes from one in the current sector stop sliding the corpse! F3DFloor * rover=mo->Sector->e->XFloor.ffloors[i]; if (!(rover->flags&FF_EXISTS)) continue; - if (rover->flags&FF_SOLID && rover->top.plane->ZatPoint(mo->x,mo->y)==mo->floorz) break; + if (rover->flags&FF_SOLID && rover->top.plane->ZatPoint(mo) == mo->floorz) break; } if (i==mo->Sector->e->XFloor.ffloors.Size()) return oldfloorz; @@ -2269,24 +2272,24 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) { fixed_t dist; fixed_t delta; - fixed_t oldz = mo->z; + fixed_t oldz = mo->Z(); fixed_t grav = mo->GetGravity(); // // check for smooth step up // - if (mo->player && mo->player->mo == mo && mo->z < mo->floorz) + if (mo->player && mo->player->mo == mo && mo->Z() < mo->floorz) { - mo->player->viewheight -= mo->floorz - mo->z; + mo->player->viewheight -= mo->floorz - mo->Z(); mo->player->deltaviewheight = mo->player->GetDeltaViewHeight(); } - mo->z += mo->velz; + mo->AddZ(mo->velz); // // apply gravity // - if (mo->z > mo->floorz && !(mo->flags & MF_NOGRAVITY)) + if (mo->Z() > mo->floorz && !(mo->flags & MF_NOGRAVITY)) { fixed_t startvelz = mo->velz; @@ -2295,7 +2298,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) { // [RH] Double gravity only if running off a ledge. Coming down from // an upward thrust (e.g. a jump) should not double it. - if (mo->velz == 0 && oldfloorz > mo->floorz && mo->z == oldfloorz) + if (mo->velz == 0 && oldfloorz > mo->floorz && mo->Z() == oldfloorz) { mo->velz -= grav + grav; } @@ -2368,7 +2371,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) // Do this only if the item was actually spawned by the map above ground to avoid problems. if (mo->special1 > 0 && (mo->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB)) { - mo->z = mo->floorz + mo->special1; + mo->SetZ(mo->floorz + mo->special1); } @@ -2380,18 +2383,18 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) if (!(mo->flags & (MF_SKULLFLY | MF_INFLOAT))) { dist = mo->AproxDistance (mo->target); - delta = (mo->target->z + (mo->height>>1)) - mo->z; + delta = (mo->target->Z() + (mo->height>>1)) - mo->Z(); if (delta < 0 && dist < -(delta*3)) - mo->z -= mo->FloatSpeed; + mo->AddZ(-mo->FloatSpeed); else if (delta > 0 && dist < (delta*3)) - mo->z += mo->FloatSpeed; + mo->AddZ(mo->FloatSpeed); } } - if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->z > mo->floorz)) + if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->Z() > mo->floorz)) { if (!mo->IsNoClip2()) { - mo->z += finesine[(FINEANGLES/80*level.maptime)&FINEMASK]/8; + mo->AddZ(finesine[(FINEANGLES/80*level.maptime)&FINEMASK]/8); } mo->velz = FixedMul (mo->velz, FRICTION_FLY); } @@ -2403,7 +2406,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) // // clip movement // - if (mo->z <= mo->floorz) + if (mo->Z() <= mo->floorz) { // Hit the floor if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && mo->Sector->SecActTarget != NULL && @@ -2414,11 +2417,11 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) P_CheckFor3DFloorHit(mo); // [RH] Need to recheck this because the sector action might have // teleported the actor so it is no longer below the floor. - if (mo->z <= mo->floorz) + if (mo->Z() <= mo->floorz) { if ((mo->flags & MF_MISSILE) && !(mo->flags & MF_NOCLIP)) { - mo->z = mo->floorz; + mo->AddZ(mo->floorz); if (mo->BounceFlags & BOUNCE_Floors) { mo->FloorBounceMissile (mo->floorsector->floorplane); @@ -2459,7 +2462,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) P_MonsterFallingDamage (mo); } } - mo->z = mo->floorz; + mo->SetZ(mo->floorz); if (mo->velz < 0) { const fixed_t minvel = -8*FRACUNIT; // landing speed from a jump with normal gravity @@ -2505,7 +2508,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) mo->AdjustFloorClip (); } - if (mo->z + mo->height > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { // hit the ceiling if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) && mo->Sector->SecActTarget != NULL && @@ -2516,9 +2519,9 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) P_CheckFor3DCeilingHit(mo); // [RH] Need to recheck this because the sector action might have // teleported the actor so it is no longer above the ceiling. - if (mo->z + mo->height > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { - mo->z = mo->ceilingz - mo->height; + mo->SetZ(mo->ceilingz - mo->height); if (mo->BounceFlags & BOUNCE_Ceilings) { // ceiling bounce mo->FloorBounceMissile (mo->ceilingsector->ceilingplane); @@ -2577,12 +2580,12 @@ void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheigh viewheight = mo->height / 2; } - if (oldz > waterz && mo->z <= waterz) + if (oldz > waterz && mo->Z() <= waterz) { // Feet hit fake floor sec->SecActTarget->TriggerAction (mo, SECSPAC_HitFakeFloor); } - newz = mo->z + viewheight; + newz = mo->Z() + viewheight; if (!oldz_has_viewheight) { oldz += viewheight; @@ -2684,22 +2687,22 @@ void P_NightmareRespawn (AActor *mobj) if (z == ONFLOORZ) { - mo->z += mobj->SpawnPoint[2]; - if (mo->z < mo->floorz) + mo->AddZ(mobj->SpawnPoint[2]); + if (mo->Z() < mo->floorz) { // Do not respawn monsters in the floor, even if that's where they // started. The initial P_ZMovement() call would have put them on // the floor right away, but we need them on the floor now so we // can use P_CheckPosition() properly. - mo->z = mo->floorz; + mo->SetZ(mo->floorz); } - if (mo->z + mo->height > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { - mo->z = mo->ceilingz - mo->height; + mo->SetZ(mo->ceilingz - mo->height); } } else if (z == ONCEILINGZ) { - mo->z -= mobj->SpawnPoint[2]; + mo->AddZ(-mobj->SpawnPoint[2]); } // If there are 3D floors, we need to find floor/ceiling again. @@ -2707,21 +2710,21 @@ void P_NightmareRespawn (AActor *mobj) if (z == ONFLOORZ) { - if (mo->z < mo->floorz) + if (mo->Z() < mo->floorz) { // Do not respawn monsters in the floor, even if that's where they // started. The initial P_ZMovement() call would have put them on // the floor right away, but we need them on the floor now so we // can use P_CheckPosition() properly. - mo->z = mo->floorz; + mo->SetZ(mo->floorz); } - if (mo->z + mo->height > mo->ceilingz) + if (mo->Top() > mo->ceilingz) { // Do the same for the ceiling. - mo->z = mo->ceilingz - mo->height; + mo->SetZ(mo->ceilingz - mo->height); } } // something is occupying its position? - if (!P_CheckPosition(mo, mo->x, mo->y, true)) + if (!P_CheckPosition(mo, mo->X(), mo->Y(), true)) { //[GrafZahl] MF_COUNTKILL still needs to be checked here. mo->ClearCounters(); @@ -2729,7 +2732,7 @@ void P_NightmareRespawn (AActor *mobj) return; // no respawn } - z = mo->z; + z = mo->Z(); // inherit attributes from deceased one mo->SpawnPoint[0] = mobj->SpawnPoint[0]; @@ -2749,7 +2752,7 @@ void P_NightmareRespawn (AActor *mobj) mo->PrevZ = z; // Do not interpolate Z position if we changed it since spawning. // spawn a teleport fog at old spot because of removal of the body? - P_SpawnTeleportFog(mobj, mobj->x, mobj->y, mobj->z + TELEFOGHEIGHT, true, true); + P_SpawnTeleportFog(mobj, mobj->PosPlusZ(TELEFOGHEIGHT), true, true); // spawn a teleport fog at the new spot P_SpawnTeleportFog(mobj, x, y, z + TELEFOGHEIGHT, false, true); @@ -3196,16 +3199,16 @@ void AActor::Tick () if (state == NULL) { Printf("Actor of type %s at (%f,%f) left without a state\n", GetClass()->TypeName.GetChars(), - x/65536., y/65536.); + X()/65536., Y()/65536.); Destroy(); return; } // This is necessary to properly interpolate movement outside this function // like from an ActorMover - PrevX = x; - PrevY = y; - PrevZ = z; + PrevX = X(); + PrevY = Y(); + PrevZ = Z(); PrevAngle = angle; if (flags5 & MF5_NOINTERACTION) @@ -3231,9 +3234,8 @@ void AActor::Tick () UnlinkFromWorld (); flags |= MF_NOBLOCKMAP; - x += velx; - y += vely; - z += velz; + SetXYZ(Vec3Offset(velx, vely, vely)); + SetMovement(velx, vely, velz); LinkToWorld (); } else @@ -3280,7 +3282,7 @@ void AActor::Tick () { // add some smoke behind the rocket smokecounter = 0; - AActor *th = Spawn("RocketSmokeTrail", x-velx, y-vely, z-velz, ALLOW_REPLACE); + AActor *th = Spawn("RocketSmokeTrail", Vec3Offset(-velx, -vely, -velz), ALLOW_REPLACE); if (th) { th->tics -= pr_rockettrail()&3; @@ -3295,10 +3297,10 @@ void AActor::Tick () { smokecounter = 0; angle_t moveangle = R_PointToAngle2(0,0,velx,vely); - AActor * th = Spawn("GrenadeSmokeTrail", - x - FixedMul (finecosine[(moveangle)>>ANGLETOFINESHIFT], radius*2) + (pr_rockettrail()<<10), - y - FixedMul (finesine[(moveangle)>>ANGLETOFINESHIFT], radius*2) + (pr_rockettrail()<<10), - z - (height>>3) * (velz>>16) + (2*height)/3, ALLOW_REPLACE); + AActor * th = Spawn("GrenadeSmokeTrail", Vec3Offset( + - FixedMul (finecosine[(moveangle)>>ANGLETOFINESHIFT], radius*2) + (pr_rockettrail()<<10), + - FixedMul (finesine[(moveangle)>>ANGLETOFINESHIFT], radius*2) + (pr_rockettrail()<<10), + - (height>>3) * (velz>>16) + (2*height)/3), ALLOW_REPLACE); if (th) { th->tics -= pr_rockettrail()&3; @@ -3308,7 +3310,7 @@ void AActor::Tick () } } - fixed_t oldz = z; + fixed_t oldz = Z(); // [RH] Give the pain elemental vertical friction // This used to be in APainElemental::Tick but in order to use @@ -3520,16 +3522,16 @@ void AActor::Tick () { continue; } - height = sec->floorplane.ZatPoint (x, y); - if (z > height) + height = sec->floorplane.ZatPoint (this); + if (Z() > height) { if (heightsec == NULL) { continue; } - waterheight = heightsec->floorplane.ZatPoint (x, y); - if (waterheight > height && z >= waterheight) + waterheight = heightsec->floorplane.ZatPoint (this); + if (waterheight > height && Z() >= waterheight) { continue; } @@ -3561,15 +3563,15 @@ void AActor::Tick () if ((flags & MF_SOLID) && !(flags & (MF_NOCLIP|MF_NOGRAVITY)) && !(flags & MF_NOBLOCKMAP) && velz <= 0 && - floorz == z) + floorz == Z()) { secplane_t floorplane; // Check 3D floors as well - floorplane = P_FindFloorPlane(floorsector, x, y, floorz); + floorplane = P_FindFloorPlane(floorsector, X(), Y(), floorz); if (floorplane.c < STEEPSLOPE && - floorplane.ZatPoint (x, y) <= floorz) + floorplane.ZatPoint (this) <= floorz) { const msecnode_t *node; bool dopush = true; @@ -3581,7 +3583,7 @@ void AActor::Tick () const sector_t *sec = node->m_sector; if (sec->floorplane.c >= STEEPSLOPE) { - if (floorplane.ZatPoint (x, y) >= z - MaxStepHeight) + if (floorplane.ZatPoint (this) >= Z() - MaxStepHeight) { dopush = false; break; @@ -3625,7 +3627,7 @@ void AActor::Tick () } } - if (velz || BlockingMobj || z != floorz) + if (velz || BlockingMobj || Z() != floorz) { // Handle Z velocity and gravity if (((flags2 & MF2_PASSMOBJ) || (flags & MF_SPECIAL)) && !(i_compatflags & COMPATF_NO_PASSMOBJ)) { @@ -3644,18 +3646,18 @@ void AActor::Tick () PlayerLandedOnThing (this, onmo); } } - if (onmo->z + onmo->height - z <= MaxStepHeight) + if (onmo->Top() - Z() <= MaxStepHeight) { if (player && player->mo == this) { - player->viewheight -= onmo->z + onmo->height - z; + player->viewheight -= onmo->Top() - Z(); fixed_t deltaview = player->GetDeltaViewHeight(); if (deltaview > player->deltaviewheight) { player->deltaviewheight = deltaview; } } - z = onmo->z + onmo->height; + SetZ(onmo->Top()); } // Check for MF6_BUMPSPECIAL // By default, only players can activate things by bumping into them @@ -3694,7 +3696,7 @@ void AActor::Tick () if (ObjectFlags & OF_EuthanizeMe) return; // actor was destroyed } - else if (z <= floorz) + else if (Z() <= floorz) { Crash(); } @@ -3796,25 +3798,25 @@ void AActor::CheckSectorTransition(sector_t *oldsec) if (Sector->SecActTarget != NULL) { int act = SECSPAC_Enter; - if (z <= Sector->floorplane.ZatPoint(x, y)) + if (Z() <= Sector->floorplane.ZatPoint(this)) { act |= SECSPAC_HitFloor; } - if (z + height >= Sector->ceilingplane.ZatPoint(x, y)) + if (Z() + height >= Sector->ceilingplane.ZatPoint(this)) { act |= SECSPAC_HitCeiling; } - if (Sector->heightsec != NULL && z == Sector->heightsec->floorplane.ZatPoint(x, y)) + if (Sector->heightsec != NULL && Z() == Sector->heightsec->floorplane.ZatPoint(this)) { act |= SECSPAC_HitFakeFloor; } Sector->SecActTarget->TriggerAction(this, act); } - if (z == floorz) + if (Z() == floorz) { P_CheckFor3DFloorHit(this); } - if (z + height == ceilingz) + if (Top() == ceilingz) { P_CheckFor3DCeilingHit(this); } @@ -3851,23 +3853,23 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) const sector_t *hsec = Sector->GetHeightSec(); if (hsec != NULL) { - fh = hsec->floorplane.ZatPoint (x, y); + fh = hsec->floorplane.ZatPoint (this); //if (hsec->MoreFlags & SECF_UNDERWATERMASK) // also check Boom-style non-swimmable sectors { - if (z < fh) + if (Z() < fh) { waterlevel = 1; - if (z + height/2 < fh) + if (Z() + height/2 < fh) { waterlevel = 2; - if ((player && z + player->viewheight <= fh) || - (z + height <= fh)) + if ((player && Z() + player->viewheight <= fh) || + (Z() + height <= fh)) { waterlevel = 3; } } } - else if (!(hsec->MoreFlags & SECF_FAKEFLOORONLY) && (z + height > hsec->ceilingplane.ZatPoint (x, y))) + else if (!(hsec->MoreFlags & SECF_FAKEFLOORONLY) && (Top() > hsec->ceilingplane.ZatPoint (this))) { waterlevel = 3; } @@ -3893,20 +3895,20 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash) if (!(rover->flags & FF_EXISTS)) continue; if(!(rover->flags & FF_SWIMMABLE) || rover->flags & FF_SOLID) continue; - fixed_t ff_bottom=rover->bottom.plane->ZatPoint(x, y); - fixed_t ff_top=rover->top.plane->ZatPoint(x, y); + fixed_t ff_bottom=rover->bottom.plane->ZatPoint(this); + fixed_t ff_top=rover->top.plane->ZatPoint(this); - if(ff_top <= z || ff_bottom > (z + (height >> 1))) continue; + if(ff_top <= Z() || ff_bottom > (Z() + (height >> 1))) continue; fh=ff_top; - if (z < fh) + if (Z() < fh) { waterlevel = 1; - if (z + height/2 < fh) + if (Z() + height/2 < fh) { waterlevel = 2; - if ((player && z + player->viewheight <= fh) || - (z + height <= fh)) + if ((player && Z() + player->viewheight <= fh) || + (Z() + height <= fh)) { waterlevel = 3; } @@ -3970,9 +3972,10 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t actor->Conversation = NULL; } - actor->x = actor->PrevX = ix; - actor->y = actor->PrevY = iy; - actor->z = actor->PrevZ = iz; + actor->PrevX = ix; + actor->PrevY = iy; + actor->PrevZ = iz; + actor->SetXYZ(ix, iy, iz); actor->picnum.SetInvalid(); actor->health = actor->SpawnHealth(); @@ -4017,11 +4020,11 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t // For FLOATRANDZ just use the floor here. if (iz == ONFLOORZ || iz == FLOATRANDZ) { - actor->z = actor->floorz; + actor->SetZ(actor->floorz, false); } else if (iz == ONCEILINGZ) { - actor->z = actor->ceilingz - actor->height; + actor->SetZ(actor->ceilingz - actor->height); } if (SpawningMapThing || !type->IsDescendantOf (RUNTIME_CLASS(APlayerPawn))) @@ -4060,11 +4063,11 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t if (iz == ONFLOORZ) { - actor->z = actor->floorz; + actor->SetZ(actor->floorz); } else if (iz == ONCEILINGZ) { - actor->z = actor->ceilingz - actor->height; + actor->SetZ(actor->ceilingz - actor->height); } else if (iz == FLOATRANDZ) { @@ -4072,16 +4075,16 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t if (space > 48*FRACUNIT) { space -= 40*FRACUNIT; - actor->z = MulScale8 (space, rng()) + actor->floorz + 40*FRACUNIT; + actor->SetZ(MulScale8 (space, rng()) + actor->floorz + 40*FRACUNIT); } else { - actor->z = actor->floorz; + actor->SetZ(actor->floorz); } } else { - actor->SpawnPoint[2] = (actor->z - actor->floorz); + actor->SpawnPoint[2] = (actor->Z() - actor->floorz); } if (actor->FloatBobPhase == (BYTE)-1) actor->FloatBobPhase = rng(); // Don't make everything bob in sync (unless deliberately told to do) @@ -4093,7 +4096,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t { actor->floorclip = 0; } - actor->UpdateWaterLevel (actor->z, false); + actor->UpdateWaterLevel (actor->Z(), false); if (!SpawningMapThing) { actor->BeginPlay (); @@ -4332,8 +4335,8 @@ void AActor::AdjustFloorClip () fixed_t shallowestclip = FIXED_MAX; const msecnode_t *m; - // possibly standing on a 3D-floor! - if (Sector->e->XFloor.ffloors.Size() && z>Sector->floorplane.ZatPoint(x,y)) floorclip=0; + // possibly standing on a 3D-floor + if (Sector->e->XFloor.ffloors.Size() && Z()>Sector->floorplane.ZatPoint(this)) floorclip=0; // [RH] clip based on shallowest floor player is standing on // If the sector has a deep water effect, then let that effect @@ -4341,7 +4344,7 @@ void AActor::AdjustFloorClip () for (m = touching_sectorlist; m; m = m->m_tnext) { sector_t *hsec = m->m_sector->GetHeightSec(); - if (hsec == NULL && m->m_sector->floorplane.ZatPoint (x, y) == z) + if (hsec == NULL && m->m_sector->floorplane.ZatPoint (this) == Z()) { fixed_t clip = Terrains[m->m_sector->GetTerrain(sector_t::floor)].FootClip; if (clip < shallowestclip) @@ -4430,9 +4433,9 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) ( !(p->mo->Sector->Flags & SECF_NORESPAWN) ) && ( p->mo->Sector->damageamount < TELEFRAG_DAMAGE )) // this really should be a bit smarter... { - spawn_x = p->mo->x; - spawn_y = p->mo->y; - spawn_z = p->mo->z; + spawn_x = p->mo->X(); + spawn_y = p->mo->Y(); + spawn_z = p->mo->Z(); spawn_angle = p->mo->angle; } @@ -4469,9 +4472,9 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) if (level.flags & LEVEL_USEPLAYERSTARTZ) { if (spawn_z == ONFLOORZ) - mobj->z += mthing->z; + mobj->AddZ(mthing->z); else if (spawn_z == ONCEILINGZ) - mobj->z -= mthing->z; + mobj->AddZ(-mthing->z); P_FindFloorCeiling(mobj, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); } @@ -4592,14 +4595,14 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) if (multiplayer) { unsigned an = mobj->angle >> ANGLETOFINESHIFT; - Spawn ("TeleportFog", mobj->x+20*finecosine[an], mobj->y+20*finesine[an], mobj->z + TELEFOGHEIGHT, ALLOW_REPLACE); + Spawn ("TeleportFog", mobj->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE); } // "Fix" for one of the starts on exec.wad MAP01: If you start inside the ceiling, // drop down below it, even if that means sinking into the floor. - if (mobj->z + mobj->height > mobj->ceilingz) + if (mobj->Top() > mobj->ceilingz) { - mobj->z = mobj->ceilingz - mobj->height; + mobj->SetZ(mobj->ceilingz - mobj->height, false); } // [BC] Do script stuff @@ -4907,14 +4910,14 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) if (z == ONFLOORZ) { - mobj->z += mthing->z; + mobj->AddZ(mthing->z); if ((mobj->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB)) { mobj->special1 = mthing->z; } } else if (z == ONCEILINGZ) - mobj->z -= mthing->z; + mobj->AddZ(-mthing->z); mobj->SpawnPoint[0] = mthing->x; mobj->SpawnPoint[1] = mthing->y; @@ -5208,7 +5211,7 @@ void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator) } if (bloodtype >= 1) { - P_DrawSplash2 (40, x, y, z, R_PointToAngle2 (x, y, originator->x, originator->y), 2, bloodcolor); + P_DrawSplash2 (40, x, y, z, R_PointToAngle2 (x, y, originator->X(), originator->Y()), 2, bloodcolor); } } @@ -5248,7 +5251,7 @@ void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator) } if (bloodtype >= 1) { - P_DrawSplash2 (100, x, y, z, R_PointToAngle2 (0, 0, originator->x - x, originator->y - y), 2, bloodcolor); + P_DrawSplash2 (100, x, y, z, R_PointToAngle2 (0, 0, originator->X() - x, originator->Y() - y), 2, bloodcolor); } } @@ -5260,13 +5263,13 @@ void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator) void P_RipperBlood (AActor *mo, AActor *bleeder) { - fixed_t x, y, z; PalEntry bloodcolor = bleeder->GetBloodColor(); const PClass *bloodcls = bleeder->GetBloodType(); - x = mo->x + (pr_ripperblood.Random2 () << 12); - y = mo->y + (pr_ripperblood.Random2 () << 12); - z = mo->z + (pr_ripperblood.Random2 () << 12); + fixedvec3 pos = mo->Vec3Offset( + (pr_ripperblood.Random2 () << 12), + (pr_ripperblood.Random2 () << 12), + (pr_ripperblood.Random2 () << 12)); int bloodtype = cl_bloodtype; @@ -5276,7 +5279,7 @@ void P_RipperBlood (AActor *mo, AActor *bleeder) if (bloodcls != NULL) { AActor *th; - th = Spawn (bloodcls, x, y, z, NO_REPLACE); // GetBloodType already performed the replacement + th = Spawn (bloodcls, pos, NO_REPLACE); // GetBloodType already performed the replacement // [NG] Applying PUFFGETSOWNER to the blood will make it target the owner if (th->flags5 & MF5_PUFFGETSOWNER) th->target = bleeder; if (gameinfo.gametype == GAME_Heretic) @@ -5295,7 +5298,7 @@ void P_RipperBlood (AActor *mo, AActor *bleeder) } if (bloodtype >= 1) { - P_DrawSplash2 (28, x, y, z, 0, 0, bloodcolor); + P_DrawSplash2 (28, pos.x, pos.y, pos.z, 0, 0, bloodcolor); } } @@ -5337,13 +5340,13 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z int terrainnum; sector_t *hsec = NULL; - if (x == FIXED_MIN) x = thing->x; - if (y == FIXED_MIN) y = thing->y; - if (z == FIXED_MIN) z = thing->z; + if (x == FIXED_MIN) x = thing->X(); + if (y == FIXED_MIN) y = thing->Y(); + if (z == FIXED_MIN) z = thing->Z(); // don't splash above the object if (checkabove) { - fixed_t compare_z = thing->z + (thing->height >> 1); + fixed_t compare_z = thing->Z() + (thing->height >> 1); // Missiles are typically small and fast, so they might // end up submerged by the move that calls P_HitWater. if (thing->flags & MF_MISSILE) @@ -5493,7 +5496,7 @@ bool P_HitFloor (AActor *thing) // don't splash if landing on the edge above water/lava/etc.... for (m = thing->touching_sectorlist; m; m = m->m_tnext) { - if (thing->z == m->m_sector->floorplane.ZatPoint(thing)) + if (thing->Z() == m->m_sector->floorplane.ZatPoint(thing)) { break; } @@ -5505,7 +5508,7 @@ bool P_HitFloor (AActor *thing) if (!(rover->flags & FF_EXISTS)) continue; if (rover->flags & (FF_SOLID|FF_SWIMMABLE)) { - if (rover->top.plane->ZatPoint(thing) == thing->z) + if (rover->top.plane->ZatPoint(thing) == thing->Z()) { return P_HitWater (thing, m->m_sector); } @@ -5530,12 +5533,12 @@ bool P_HitFloor (AActor *thing) void P_CheckSplash(AActor *self, fixed_t distance) { - if (self->z <= self->floorz + (distance<floorsector == self->Sector && self->Sector->GetHeightSec() == NULL) + if (self->Z() <= self->floorz + (distance<floorsector == self->Sector && self->Sector->GetHeightSec() == NULL) { // 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. - P_HitWater (self, self->Sector, self->x, self->y, self->floorz, false, false); + P_HitWater (self, self->Sector, self->X(), self->Y(), self->floorz, false, false); } } @@ -5572,9 +5575,10 @@ bool P_CheckMissileSpawn (AActor* th, fixed_t maxdist) advance *= 0.5f; } while (TVector2(advance).LengthSquared() >= maxsquared); - th->x += FLOAT2FIXED(advance.X); - th->y += FLOAT2FIXED(advance.Y); - th->z += FLOAT2FIXED(advance.Z); + th->SetXYZ( + th->X() + FLOAT2FIXED(advance.X), + th->Y() + FLOAT2FIXED(advance.Y), + th->Z() + FLOAT2FIXED(advance.Z)); } FCheckPosition tm(!!(th->flags2 & MF2_RIP)); @@ -5598,7 +5602,7 @@ bool P_CheckMissileSpawn (AActor* th, fixed_t maxdist) bool MBFGrenade = (!(th->flags & MF_MISSILE) || (th->BounceFlags & BOUNCE_MBF)); // killough 3/15/98: no dropoff (really = don't care for missiles) - if (!(P_TryMove (th, th->x, th->y, false, NULL, tm, true))) + if (!(P_TryMove (th, th->X(), th->Y(), false, NULL, tm, true))) { // [RH] Don't explode ripping missiles that spawn inside something if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP)) @@ -5651,7 +5655,7 @@ void P_PlaySpawnSound(AActor *missile, AActor *spawner) // If there is no spawner use the spawn position. // But not in a silenced sector. if (!(missile->Sector->Flags & SECF_SILENT)) - S_Sound (missile->x, missile->y, missile->z, CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM); + S_Sound (missile->X(), missile->Y(), missile->Z(), CHAN_WEAPON, missile->SeeSound, 1, ATTN_NORM); } } } @@ -5680,7 +5684,7 @@ AActor *P_SpawnMissile (AActor *source, AActor *dest, const PClass *type, AActor { return NULL; } - return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT + source->GetBobOffset(), + return P_SpawnMissileXYZ (source->X(), source->Y(), source->Z() + 32*FRACUNIT + source->GetBobOffset(), source, dest, type, true, owner); } @@ -5690,7 +5694,7 @@ AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, const PClass * { return NULL; } - return P_SpawnMissileXYZ (source->x, source->y, z, source, dest, type); + return P_SpawnMissileXYZ (source->X(), source->Y(), z, source, dest, type); } AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, @@ -5729,16 +5733,16 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, // missile? // Answer: No, because this way, you can set up sets of parallel missiles. - FVector3 velocity(dest->x - source->x, dest->y - source->y, dest->z - source->z); + FVector3 velocity = source->Vec3To(dest); // Floor and ceiling huggers should never have a vertical component to their velocity if (th->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)) { velocity.Z = 0; } // [RH] Adjust the trajectory if the missile will go over the target's head. - else if (z - source->z >= dest->height) + else if (z - source->Z() >= dest->height) { - velocity.Z += dest->height - z + source->z; + velocity.Z += dest->height - z + source->Z(); } velocity.Resize (speed); th->velx = (fixed_t)(velocity.X); @@ -5776,7 +5780,7 @@ AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const } angle_t an; fixed_t dist; - AActor *th = Spawn (type, source->x, source->y, source->z + 4*8*FRACUNIT, ALLOW_REPLACE); + AActor *th = Spawn (type, source->PosPlusZ(4*8*FRACUNIT), ALLOW_REPLACE); P_PlaySpawnSound(th, source); th->target = owner; // record missile's originator @@ -5792,7 +5796,7 @@ AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const if (dist < 1) dist = 1; - th->velz = (dest->z - source->z) / dist; + th->velz = (dest->Z() - source->Z()) / dist; if (th->flags4 & MF4_SPECTRAL) { @@ -5819,7 +5823,7 @@ AActor *P_SpawnMissileAngle (AActor *source, const PClass *type, { return NULL; } - return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT + source->GetBobOffset(), + return P_SpawnMissileAngleZSpeed (source, source->Z() + 32*FRACUNIT + source->GetBobOffset(), type, angle, velz, GetDefaultSpeed (type)); } @@ -5850,7 +5854,7 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const PCl dist = source->AproxDistance (dest); speed = GetDefaultSpeed (type); dist /= speed; - velz = dist != 0 ? (dest->z - source->z)/dist : speed; + velz = dist != 0 ? (dest->Z() - source->Z())/dist : speed; return P_SpawnMissileAngleZSpeed (source, z, type, an, velz, speed); } @@ -5870,7 +5874,7 @@ AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type, { return NULL; } - return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT + source->GetBobOffset(), + return P_SpawnMissileAngleZSpeed (source, source->Z() + 32*FRACUNIT + source->GetBobOffset(), type, angle, velz, speed); } @@ -5888,7 +5892,7 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z, z -= source->floorclip; } - mo = Spawn (type, source->x, source->y, z, ALLOW_REPLACE); + mo = Spawn (type, source->X(), source->Y(), z, ALLOW_REPLACE); P_PlaySpawnSound(mo, source); if (owner == NULL) owner = source; @@ -5988,7 +5992,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, if (z != ONFLOORZ && z != ONCEILINGZ) { // Doom spawns missiles 4 units lower than hitscan attacks for players. - z += source->z + (source->height>>1) - source->floorclip; + z += source->Z() + (source->height>>1) - source->floorclip; if (source->player != NULL) // Considering this is for player missiles, it better not be NULL. { z += FixedMul (source->player->mo->AttackZOffset - 4*FRACUNIT, source->player->crouchfactor); @@ -6003,7 +6007,8 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z, z = source->floorz; } } - AActor *MissileActor = Spawn (type, source->x + x, source->y + y, z, ALLOW_REPLACE); + fixedvec2 pos = source->Vec2Offset(x, y); + AActor *MissileActor = Spawn (type, pos.x, pos.y, z, ALLOW_REPLACE); if (pMissileActor) *pMissileActor = MissileActor; P_PlaySpawnSound(MissileActor, source); MissileActor->target = source; @@ -6511,7 +6516,7 @@ void PrintMiscActorInfo(AActor *query) query->args[4], query->special1, query->special2); Printf("\nTID: %d", query->tid); Printf("\nCoord= x: %f, y: %f, z:%f, floor:%f, ceiling:%f.", - FIXED2FLOAT(query->x), FIXED2FLOAT(query->y), FIXED2FLOAT(query->z), + FIXED2FLOAT(query->X()), FIXED2FLOAT(query->Y()), FIXED2FLOAT(query->Z()), FIXED2FLOAT(query->floorz), FIXED2FLOAT(query->ceilingz)); Printf("\nSpeed= %f, velocity= x:%f, y:%f, z:%f, combined:%f.\n", FIXED2FLOAT(query->Speed), FIXED2FLOAT(query->velx), FIXED2FLOAT(query->vely), FIXED2FLOAT(query->velz), diff --git a/src/po_man.cpp b/src/po_man.cpp index fb1d12519..a0cc4487b 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -901,7 +901,8 @@ void FPolyObj::ThrustMobj (AActor *actor, side_t *side) actor->vely += thrustY; if (crush) { - if (bHurtOnTouch || !P_CheckMove (actor, actor->x + thrustX, actor->y + thrustY)) + fixedvec2 pos = actor->Vec2Offset(thrustX, thrustY); + if (bHurtOnTouch || !P_CheckMove (actor, pos.x, pos.y)) { int newdam = P_DamageMobj (actor, NULL, NULL, crush, NAME_Crush); P_TraceBleed (newdam > 0 ? newdam : crush, actor); @@ -1199,8 +1200,8 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd) && !((mobj->flags & MF_FLOAT) && (ld->flags & ML_BLOCK_FLOATERS)) && (!(ld->flags & ML_3DMIDTEX) || (!P_LineOpening_3dMidtex(mobj, ld, open) && - (mobj->z + mobj->height < open.top) - ) || (open.abovemidtex && mobj->z > mobj->floorz)) + (mobj->Top() < open.top) + ) || (open.abovemidtex && mobj->Z() > mobj->floorz)) ) { // [BL] We can't just continue here since we must @@ -1213,7 +1214,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd) performBlockingThrust = true; } - FBoundingBox box(mobj->x, mobj->y, mobj->radius); + FBoundingBox box(mobj->X(), mobj->Y(), mobj->radius); if (box.Right() <= ld->bbox[BOXLEFT] || box.Left() >= ld->bbox[BOXRIGHT] @@ -1231,15 +1232,15 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd) // Best use the one facing the player and ignore the back side. if (ld->sidedef[1] != NULL) { - int side = P_PointOnLineSidePrecise(mobj->x, mobj->y, ld); + int side = P_PointOnLineSidePrecise(mobj->X(), mobj->Y(), ld); if (ld->sidedef[side] != sd) { continue; } // [BL] See if we hit below the floor/ceiling of the poly. else if(!performBlockingThrust && ( - mobj->z < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) || - mobj->z + mobj->height > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj) + mobj->Z() < ld->sidedef[!side]->sector->GetSecPlane(sector_t::floor).ZatPoint(mobj) || + mobj->Top() > ld->sidedef[!side]->sector->GetSecPlane(sector_t::ceiling).ZatPoint(mobj) )) { performBlockingThrust = true; diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 8508ff728..2a9703ae4 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -175,9 +175,10 @@ void S_NoiseDebug (void) return; } - listener.X = FIXED2FLOAT(players[consoleplayer].camera->x); - listener.Y = FIXED2FLOAT(players[consoleplayer].camera->z); - listener.Z = FIXED2FLOAT(players[consoleplayer].camera->y); + + listener.X = FIXED2FLOAT(players[consoleplayer].camera->SoundX()); + listener.Y = FIXED2FLOAT(players[consoleplayer].camera->SoundZ()); + listener.Z = FIXED2FLOAT(players[consoleplayer].camera->SoundY()); // Display the oldest channel first. for (chan = Channels; chan->NextChan != NULL; chan = chan->NextChan) @@ -666,9 +667,9 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector, if (players[consoleplayer].camera != NULL) { - x = players[consoleplayer].camera->x; - y = players[consoleplayer].camera->z; - z = players[consoleplayer].camera->y; + x = players[consoleplayer].camera->SoundX(); + y = players[consoleplayer].camera->SoundZ(); + z = players[consoleplayer].camera->SoundY(); } else { @@ -685,9 +686,9 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector, // assert(actor != NULL); if (actor != NULL) { - x = actor->x; - y = actor->z; - z = actor->y; + x = actor->SoundX(); + y = actor->SoundZ(); + z = actor->SoundY(); } break; @@ -723,7 +724,7 @@ static void CalcPosVel(int type, const AActor *actor, const sector_t *sector, { if ((chanflags & CHAN_LISTENERZ) && players[consoleplayer].camera != NULL) { - y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->z : 0; + y = players[consoleplayer].camera != NULL ? players[consoleplayer].camera->SoundZ() : 0; } pos->X = FIXED2FLOAT(x); pos->Y = FIXED2FLOAT(y); @@ -763,8 +764,8 @@ static void CalcSectorSoundOrg(const sector_t *sec, int channum, fixed_t *x, fix // Are we inside the sector? If yes, the closest point is the one we're on. if (P_PointInSector(*x, *y) == sec) { - *x = players[consoleplayer].camera->x; - *y = players[consoleplayer].camera->y; + *x = players[consoleplayer].camera->SoundX(); + *y = players[consoleplayer].camera->SoundY(); } else { @@ -1567,9 +1568,9 @@ void S_RelinkSound (AActor *from, AActor *to) { chan->Actor = NULL; chan->SourceType = SOURCE_Unattached; - chan->Point[0] = FIXED2FLOAT(from->x); - chan->Point[1] = FIXED2FLOAT(from->z); - chan->Point[2] = FIXED2FLOAT(from->y); + chan->Point[0] = FIXED2FLOAT(from->SoundX()); + chan->Point[1] = FIXED2FLOAT(from->SoundZ()); + chan->Point[2] = FIXED2FLOAT(from->SoundY()); } else { @@ -1959,9 +1960,9 @@ static void S_SetListener(SoundListener &listener, AActor *listenactor) listener.velocity.Z = listenactor->vely * (TICRATE/65536.f); */ listener.velocity.Zero(); - listener.position.X = FIXED2FLOAT(listenactor->x); - listener.position.Y = FIXED2FLOAT(listenactor->z); - listener.position.Z = FIXED2FLOAT(listenactor->y); + listener.position.X = FIXED2FLOAT(listenactor->SoundX()); + listener.position.Y = FIXED2FLOAT(listenactor->SoundZ()); + listener.position.Z = FIXED2FLOAT(listenactor->SoundY()); listener.underwater = listenactor->waterlevel == 3; assert(zones != NULL); listener.Environment = zones[listenactor->Sector->ZoneNumber].Environment; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 697aa7711..9b4304c9d 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4603,7 +4603,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack) fixedvec2 vec = self->Vec2To(self->target); fixed_t dx = abs (vec.x); fixed_t dy = abs (vec.y); - fixed_t dz; fixed_t dist = dx > dy ? dx : dy; // Some enemies are more precise