From 35271187a5cb481f4a2326ab9795db6fc170fc97 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 20 Jan 2016 13:48:05 +0100 Subject: [PATCH] - took care of the rest of p_map.cpp. --- src/p_map.cpp | 208 ++++++++++++++++++++++------------------------- src/p_maputl.cpp | 2 +- 2 files changed, 99 insertions(+), 111 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 364656d24..43c7f6af0 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3801,8 +3801,8 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance, fixed_t dist = trace.Distance; // position a bit closer for puffs/blood if using compatibility mode. if (i_compatflags & COMPATF_HITSCAN) dist -= 10 * FRACUNIT; - hitx = t1->x + FixedMul(vx, dist); - hity = t1->y + FixedMul(vy, dist); + hitx = t1->X() + FixedMul(vx, dist); + hity = t1->Y() + FixedMul(vy, dist); hitz = shootz + FixedMul(vz, dist); @@ -3943,7 +3943,7 @@ AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch, 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); @@ -3959,7 +3959,7 @@ AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch, TData.Caller = t1; TData.hitGhosts = true; - 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, actorMask, wallMask, t1, trace, TRACE_NoSky, CheckForActor, &TData)) { if (trace.HitType == TRACE_HitActor) @@ -4063,7 +4063,7 @@ void P_TraceBleed(int damage, fixed_t x, fixed_t y, fixed_t z, AActor *actor, an void P_TraceBleed(int damage, AActor *target, angle_t angle, int pitch) { - P_TraceBleed(damage, target->x, target->y, target->z + target->height / 2, + P_TraceBleed(damage, target->X(), target->Y(), target->Z() + target->height / 2, target, angle, pitch); } @@ -4086,14 +4086,14 @@ void P_TraceBleed(int damage, AActor *target, AActor *missile) { double aim; - aim = atan((double)missile->velz / (double)P_AproxDistance(missile->x - target->x, missile->y - target->y)); + aim = atan((double)missile->velz / (double)target->AproxDistance(missile)); pitch = -(int)(aim * ANGLE_180 / PI); } else { pitch = 0; } - P_TraceBleed(damage, target->x, target->y, target->z + target->height / 2, + P_TraceBleed(damage, target->X(), target->Y(), target->Z() + target->height / 2, target, missile->AngleTo(target), pitch); } @@ -4111,7 +4111,7 @@ void P_TraceBleed(int damage, AActor *target) fixed_t one = pr_tracebleed() << 24; fixed_t two = (pr_tracebleed() - 128) << 16; - P_TraceBleed(damage, target->x, target->y, target->z + target->height / 2, + P_TraceBleed(damage, target->X(), target->Y(), target->Z() + target->height / 2, target, one, two); } } @@ -4174,7 +4174,6 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i { fixed_t vx, vy, vz; angle_t angle, pitch; - fixed_t x1, y1; TVector3 start, end; FTraceResults trace; fixed_t shootz; @@ -4188,10 +4187,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i vy = FixedMul(finecosine[pitch], finesine[angle]); vz = finesine[pitch]; - x1 = source->x; - y1 = source->y; - - shootz = source->z - source->floorclip + (source->height >> 1) + offset_z; + shootz = source->Z() - source->floorclip + (source->height >> 1) + offset_z; if (!(railflags & RAF_CENTERZ)) { @@ -4206,15 +4202,15 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i } angle = ((source->angle + angleoffset) - ANG90) >> ANGLETOFINESHIFT; - x1 += offset_xy * finecosine[angle]; - y1 += offset_xy * finesine[angle]; + + fixedvec2 xy = source->Vec2Offset(offset_xy * finecosine[angle], offset_xy * finesine[angle]); RailData rail_data; rail_data.Caller = source; rail_data.StopAtOne = !!(railflags & RAF_NOPIERCE); - start.X = FIXED2FLOAT(x1); - start.Y = FIXED2FLOAT(y1); + start.X = FIXED2FLOAT(xy.x); + start.Y = FIXED2FLOAT(xy.y); start.Z = FIXED2FLOAT(shootz); int flags; @@ -4225,7 +4221,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i flags = (puffDefaults->flags6 & MF6_NOTRIGGER) ? 0 : TRACE_PCross | TRACE_Impact; rail_data.StopAtInvul = (puffDefaults->flags3 & MF3_FOILINVUL) ? false : true; rail_data.ThruSpecies = (puffDefaults->flags6 & MF6_MTHRUSPECIES) ? true : false; - Trace(x1, y1, shootz, source->Sector, vx, vy, vz, + Trace(xy.x, xy.y, shootz, source->Sector, vx, vy, vz, distance, MF_SHOOTABLE, ML_BLOCKEVERYTHING, source, trace, flags, ProcessRailHit, &rail_data); @@ -4236,7 +4232,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i // used as damage inflictor AActor *thepuff = NULL; - if (puffclass != NULL) thepuff = Spawn(puffclass, source->x, source->y, source->z, ALLOW_REPLACE); + if (puffclass != NULL) thepuff = Spawn(puffclass, source->Pos(), ALLOW_REPLACE); for (i = 0; i < rail_data.RailHits.Size(); i++) { @@ -4250,8 +4246,8 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i AActor *hitactor = rail_data.RailHits[i].HitActor; fixed_t hitdist = rail_data.RailHits[i].Distance; - x = x1 + FixedMul(hitdist, vx); - y = y1 + FixedMul(hitdist, vy); + x = xy.x + FixedMul(hitdist, vx); + y = xy.y + FixedMul(hitdist, vy); z = shootz + FixedMul(hitdist, vz); if ((hitactor->flags & MF_NOBLOOD) || @@ -4329,7 +4325,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i trace.CrossedWater == NULL && trace.Sector->heightsec == NULL) { - thepuff->SetOrigin(trace.X, trace.Y, trace.Z); + thepuff->SetOrigin(trace.X, trace.Y, trace.Z, false); P_HitWater(thepuff, trace.Sector); } if (trace.Crossed3DWater || trace.CrossedWater) @@ -4367,16 +4363,16 @@ void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camera vy = FixedMul(finecosine[pitch], finesine[angle]); vz = finesine[pitch]; - sz = t1->z - t1->floorclip + t1->height + (fixed_t)(clamp(chase_height, -1000, 1000) * FRACUNIT); + sz = t1->Z() - t1->floorclip + t1->height + (fixed_t)(clamp(chase_height, -1000, 1000) * FRACUNIT); - if (Trace(t1->x, t1->y, sz, t1->Sector, + if (Trace(t1->X(), t1->Y(), sz, t1->Sector, vx, vy, vz, distance, 0, 0, NULL, trace) && trace.Distance > 10 * FRACUNIT) { // Position camera slightly in front of hit thing fixed_t dist = trace.Distance - 5 * FRACUNIT; - CameraX = t1->x + FixedMul(vx, dist); - CameraY = t1->y + FixedMul(vy, dist); + CameraX = t1->X() + FixedMul(vx, dist); + CameraY = t1->Y() + FixedMul(vy, dist); CameraZ = sz + FixedMul(vz, dist); } else @@ -4443,7 +4439,7 @@ bool P_TalkFacing(AActor *player) bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline) { - FPathTraverse it(usething->x, usething->y, endx, endy, PT_ADDLINES | PT_ADDTHINGS); + FPathTraverse it(usething->X(), usething->Y(), endx, endy, PT_ADDLINES | PT_ADDTHINGS); intercept_t *in; while ((in = it.Next())) @@ -4492,7 +4488,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline return true; } - sec = P_PointOnLineSide(usething->x, usething->y, in->d.line) == 0 ? + sec = P_PointOnLineSide(usething->X(), usething->Y(), in->d.line) == 0 ? in->d.line->frontsector : in->d.line->backsector; if (sec != NULL && sec->SecActTarget && @@ -4511,7 +4507,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline continue; // not a special line, but keep checking } - if (P_PointOnLineSide(usething->x, usething->y, in->d.line) == 1) + if (P_PointOnLineSide(usething->X(), usething->Y(), in->d.line) == 1) { if (!(in->d.line->activation & SPAC_UseBack)) { @@ -4571,7 +4567,7 @@ bool P_UseTraverse(AActor *usething, fixed_t endx, fixed_t endy, bool &foundline bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy) { - FPathTraverse it(usething->x, usething->y, endx, endy, PT_ADDLINES); + FPathTraverse it(usething->X(), usething->Y(), endx, endy, PT_ADDLINES); intercept_t *in; while ((in = it.Next())) @@ -4586,8 +4582,8 @@ bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy) P_LineOpening(open, NULL, ld, it.Trace().x + FixedMul(it.Trace().dx, in->frac), it.Trace().y + FixedMul(it.Trace().dy, in->frac)); if (open.range <= 0 || - open.bottom > usething->z + usething->MaxStepHeight || - open.top < usething->z + usething->height) return true; + open.bottom > usething->Z() + usething->MaxStepHeight || + open.top < usething->Top()) return true; } return false; } @@ -4602,18 +4598,10 @@ bool P_NoWayTraverse(AActor *usething, fixed_t endx, fixed_t endy) void P_UseLines(player_t *player) { - angle_t angle; - fixed_t x1, y1, usedist; - bool foundline; - - foundline = false; - - angle = player->mo->angle >> ANGLETOFINESHIFT; - usedist = player->mo->UseRange; + bool foundline = false; // [NS] Now queries the Player's UseRange. - x1 = player->mo->x + FixedMul(usedist, finecosine[angle]); - y1 = player->mo->y + FixedMul(usedist, finesine[angle]); + fixedvec2 end = player->mo->Vec2Angle(player->mo->UseRange, player->mo->angle, true); // old code: // @@ -4621,13 +4609,13 @@ void P_UseLines(player_t *player) // // This added test makes the "oof" sound work on 2s lines -- killough: - if (!P_UseTraverse(player->mo, x1, y1, foundline)) + if (!P_UseTraverse(player->mo, end.x, end.y, foundline)) { // [RH] Give sector a chance to eat the use sector_t *sec = player->mo->Sector; int spac = SECSPAC_Use; if (foundline) spac |= SECSPAC_UseWall; if ((!sec->SecActTarget || !sec->SecActTarget->TriggerAction(player->mo, spac)) && - P_NoWayTraverse(player->mo, x1, y1)) + P_NoWayTraverse(player->mo, end.x, end.y)) { S_Sound(player->mo, CHAN_VOICE, "*usefail", 1, ATTN_IDLE); } @@ -4648,8 +4636,8 @@ bool P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType) fixed_t x1, y1, x2, y2, usedist; angle = PuzzleItemUser->angle >> ANGLETOFINESHIFT; - x1 = PuzzleItemUser->x; - y1 = PuzzleItemUser->y; + x1 = PuzzleItemUser->X(); + y1 = PuzzleItemUser->Y(); // [NS] If it's a Player, get their UseRange. if (PuzzleItemUser->player) @@ -4680,7 +4668,7 @@ bool P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType) } continue; } - if (P_PointOnLineSide(PuzzleItemUser->x, PuzzleItemUser->y, in->d.line) == 1) + if (P_PointOnLineSide(PuzzleItemUser->X(), PuzzleItemUser->Y(), in->d.line) == 1) { // Don't use back sides return false; } @@ -4747,7 +4735,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo double bombdistancefloat = 1.f / (double)(bombdistance - fulldamagedistance); double bombdamagefloat = (double)bombdamage; - FBlockThingsIterator it(FBoundingBox(bombspot->x, bombspot->y, bombdistance << FRACBITS)); + FBlockThingsIterator it(FBoundingBox(bombspot->X(), bombspot->Y(), bombdistance << FRACBITS)); AActor *thing; if (flags & RADF_SOURCEISSPOT) @@ -4796,24 +4784,25 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo fixed_t dx, dy; double boxradius; - dx = abs(thing->x - bombspot->x); - dy = abs(thing->y - bombspot->y); + fixedvec2 vec = bombspot->Vec2To(thing); + dx = abs(vec.x); + dy = abs(vec.y); boxradius = double(thing->radius); // The damage pattern is square, not circular. len = double(dx > dy ? dx : dy); - if (bombspot->z < thing->z || bombspot->z >= thing->z + thing->height) + if (bombspot->Z() < thing->Z() || bombspot->Z() >= thing->Top()) { double dz; - if (bombspot->z > thing->z) + if (bombspot->Z() > thing->Z()) { - dz = double(bombspot->z - thing->z - thing->height); + dz = double(bombspot->Z() - thing->Top()); } else { - dz = double(thing->z - bombspot->z); + dz = double(thing->Z() - bombspot->Z()); } if (len <= boxradius) { @@ -4870,7 +4859,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo { thrust *= selfthrustscale; } - velz = (double)(thing->z + (thing->height >> 1) - bombspot->z) * thrust; + velz = (double)(thing->Z() + (thing->height >> 1) - bombspot->Z()) * thrust; if (bombsource != thing) { velz *= 0.5f; @@ -4895,8 +4884,9 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo // [RH] Old code just for barrels fixed_t dx, dy, dist; - dx = abs(thing->x - bombspot->x); - dy = abs(thing->y - bombspot->y); + fixedvec2 vec = bombspot->Vec2To(thing); + dx = abs(vec.x); + dy = abs(vec.y); dist = dx>dy ? dx : dy; dist = (dist - thing->radius) >> FRACBITS; @@ -4983,7 +4973,7 @@ bool P_AdjustFloorCeil(AActor *thing, FChangePosition *cpos) thing->flags2 |= MF2_PASSMOBJ; } - bool isgood = P_CheckPosition(thing, thing->x, thing->y, tm); + bool isgood = P_CheckPosition(thing, thing->X(), thing->Y(), tm); thing->floorz = tm.floorz; thing->ceilingz = tm.ceilingz; thing->dropoffz = tm.dropoffz; // killough 11/98: remember dropoffs @@ -5014,7 +5004,7 @@ void P_FindAboveIntersectors(AActor *actor) return; AActor *thing; - FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius)); + FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius)); while ((thing = it.Next())) { if (!thing->intersects(actor)) @@ -5045,8 +5035,8 @@ void P_FindAboveIntersectors(AActor *actor) // not what is wanted here. continue; } - if (thing->z >= actor->z && - thing->z <= actor->z + actor->height) + if (thing->Z() >= actor->Z() && + thing->Z() <= actor->Top()) { // Thing intersects above the base intersectors.Push(thing); } @@ -5068,7 +5058,7 @@ void P_FindBelowIntersectors(AActor *actor) return; AActor *thing; - FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius)); + FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius)); while ((thing = it.Next())) { if (!thing->intersects(actor)) @@ -5099,8 +5089,8 @@ void P_FindBelowIntersectors(AActor *actor) // not what is wanted here. continue; } - if (thing->z + thing->height <= actor->z + actor->height && - thing->z + thing->height > actor->z) + if (thing->Top() <= actor->Top() && + thing->Top() > actor->Z()) { // Thing intersects below the base intersectors.Push(thing); } @@ -5136,8 +5126,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos) { AActor *mo; - mo = Spawn(bloodcls, thing->x, thing->y, - thing->z + thing->height / 2, ALLOW_REPLACE); + mo = Spawn(bloodcls, thing->PosPlusZ(thing->height / 2), ALLOW_REPLACE); mo->velx = pr_crunch.Random2() << 12; mo->vely = pr_crunch.Random2() << 12; @@ -5153,7 +5142,7 @@ void P_DoCrunch(AActor *thing, FChangePosition *cpos) an = (M_Random() - 128) << 24; if (cl_bloodtype >= 1) { - P_DrawSplash2(32, thing->x, thing->y, thing->z + thing->height / 2, an, 2, bloodcolor); + P_DrawSplash2(32, thing->X(), thing->Y(), thing->Z() + thing->height / 2, an, 2, bloodcolor); } } if (thing->CrushPainSound != 0 && !S_GetSoundPlayingInfo(thing, thing->CrushPainSound)) @@ -5181,7 +5170,7 @@ int P_PushUp(AActor *thing, FChangePosition *cpos) unsigned int lastintersect; int mymass = thing->Mass; - if (thing->z + thing->height > thing->ceilingz) + if (thing->Top() > thing->ceilingz) { return 1; } @@ -5210,13 +5199,13 @@ int P_PushUp(AActor *thing, FChangePosition *cpos) return 2; } fixed_t oldz; - oldz = intersect->z; + oldz = intersect->Z(); P_AdjustFloorCeil(intersect, cpos); - intersect->z = thing->z + thing->height + 1; + intersect->SetZ(thing->Top() + 1); if (P_PushUp(intersect, cpos)) { // Move blocked P_DoCrunch(intersect, cpos); - intersect->z = oldz; + intersect->SetZ(oldz); return 2; } } @@ -5237,7 +5226,7 @@ int P_PushDown(AActor *thing, FChangePosition *cpos) unsigned int lastintersect; int mymass = thing->Mass; - if (thing->z <= thing->floorz) + if (thing->Z() <= thing->floorz) { return 1; } @@ -5254,15 +5243,15 @@ int P_PushDown(AActor *thing, FChangePosition *cpos) // Can't push bridges or things more massive than ourself return 2; } - fixed_t oldz = intersect->z; + fixed_t oldz = intersect->Z(); P_AdjustFloorCeil(intersect, cpos); - if (oldz > thing->z - intersect->height) + if (oldz > thing->Z() - intersect->height) { // Only push things down, not up. - intersect->z = thing->z - intersect->height; + intersect->SetZ(thing->Z() - intersect->height); if (P_PushDown(intersect, cpos)) { // Move blocked P_DoCrunch(intersect, cpos); - intersect->z = oldz; + intersect->SetZ(oldz); return 2; } } @@ -5287,24 +5276,24 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos) if (thing->velz == 0 && (!(thing->flags & MF_NOGRAVITY) || - (thing->z == oldfloorz && !(thing->flags & MF_NOLIFTDROP)))) + (thing->Z() == oldfloorz && !(thing->flags & MF_NOLIFTDROP)))) { - fixed_t oldz = thing->z; + fixed_t oldz = thing->Z(); if ((thing->flags & MF_NOGRAVITY) || (thing->flags5 & MF5_MOVEWITHSECTOR) || (((cpos->sector->Flags & SECF_FLOORDROP) || cpos->moveamt < 9 * FRACUNIT) - && thing->z - thing->floorz <= cpos->moveamt)) + && thing->Z() - thing->floorz <= cpos->moveamt)) { - thing->z = thing->floorz; + thing->SetZ(thing->floorz); P_CheckFakeFloorTriggers(thing, oldz); } } - else if ((thing->z != oldfloorz && !(thing->flags & MF_NOLIFTDROP))) + else if ((thing->Z() != oldfloorz && !(thing->flags & MF_NOLIFTDROP))) { - fixed_t oldz = thing->z; + fixed_t oldz = thing->Z(); if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR)) { - thing->z = thing->z - oldfloorz + thing->floorz; + thing->AddZ(-oldfloorz + thing->floorz); P_CheckFakeFloorTriggers(thing, oldz); } } @@ -5319,14 +5308,14 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos) void PIT_FloorRaise(AActor *thing, FChangePosition *cpos) { fixed_t oldfloorz = thing->floorz; - fixed_t oldz = thing->z; + fixed_t oldz = thing->Z(); P_AdjustFloorCeil(thing, cpos); if (oldfloorz == thing->floorz) return; // Move things intersecting the floor up - if (thing->z <= thing->floorz) + if (thing->Z() <= thing->floorz) { if (thing->flags4 & MF4_ACTLIKEBRIDGE) { @@ -5334,14 +5323,14 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos) return; // do not move bridge things } intersectors.Clear(); - thing->z = thing->floorz; + thing->SetZ(thing->floorz); } else { if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR)) { intersectors.Clear(); - thing->z = thing->z - oldfloorz + thing->floorz; + thing->AddZ(-oldfloorz + thing->floorz); } else return; } @@ -5356,7 +5345,7 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos) break; case 2: P_DoCrunch(thing, cpos); - thing->z = oldz; + thing->SetZ(oldz); break; } } @@ -5371,10 +5360,10 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos) { bool onfloor; - onfloor = thing->z <= thing->floorz; + onfloor = thing->Z() <= thing->floorz; P_AdjustFloorCeil(thing, cpos); - if (thing->z + thing->height > thing->ceilingz) + if (thing->Top() > thing->ceilingz) { if (thing->flags4 & MF4_ACTLIKEBRIDGE) { @@ -5382,14 +5371,14 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos) return; // do not move bridge things } intersectors.Clear(); - fixed_t oldz = thing->z; + fixed_t oldz = thing->Z(); if (thing->ceilingz - thing->height >= thing->floorz) { - thing->z = thing->ceilingz - thing->height; + thing->SetZ(thing->ceilingz - thing->height); } else { - thing->z = thing->floorz; + thing->SetZ(thing->floorz); } switch (P_PushDown(thing, cpos)) { @@ -5397,7 +5386,7 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos) // intentional fall-through case 1: if (onfloor) - thing->z = thing->floorz; + thing->SetZ(thing->floorz); P_DoCrunch(thing, cpos); P_CheckFakeFloorTriggers(thing, oldz); break; @@ -5423,25 +5412,24 @@ void PIT_CeilingRaise(AActor *thing, FChangePosition *cpos) // For DOOM compatibility, only move things that are inside the floor. // (or something else?) Things marked as hanging from the ceiling will // stay where they are. - if (thing->z < thing->floorz && - thing->z + thing->height >= thing->ceilingz - cpos->moveamt && + if (thing->Z() < thing->floorz && + thing->Top() >= thing->ceilingz - cpos->moveamt && !(thing->flags & MF_NOLIFTDROP)) { - fixed_t oldz = thing->z; - thing->z = thing->floorz; - if (thing->z + thing->height > thing->ceilingz) + fixed_t oldz = thing->Z(); + thing->SetZ(thing->floorz); + if (thing->Top() > thing->ceilingz) { - thing->z = thing->ceilingz - thing->height; + thing->SetZ(thing->ceilingz - thing->height); } P_CheckFakeFloorTriggers(thing, oldz); } - else if ((thing->flags2 & MF2_PASSMOBJ) && !isgood && thing->z + thing->height < thing->ceilingz) + else if ((thing->flags2 & MF2_PASSMOBJ) && !isgood && thing->Top() < thing->ceilingz) { AActor *onmobj; - if (!P_TestMobjZ(thing, true, &onmobj) && onmobj->z <= thing->z) + if (!P_TestMobjZ(thing, true, &onmobj) && onmobj->Z() <= thing->Z()) { - thing->z = MIN(thing->ceilingz - thing->height, - onmobj->z + onmobj->height); + thing->SetZ( MIN(thing->ceilingz - thing->height, onmobj->Top())); } } } @@ -5598,8 +5586,8 @@ bool P_ChangeSector(sector_t *sector, int crunch, int amt, int floorOrCeil, bool { n->visited = true; // mark thing as processed - n->m_thing->UpdateWaterLevel(n->m_thing->z, false); - P_CheckFakeFloorTriggers(n->m_thing, n->m_thing->z - amt); + n->m_thing->UpdateWaterLevel(n->m_thing->Z(), false); + P_CheckFakeFloorTriggers(n->m_thing, n->m_thing->Z() - amt); } } } while (n); // repeat from scratch until all things left are marked valid @@ -5819,7 +5807,7 @@ void P_CreateSecNodeList(AActor *thing, fixed_t x, fixed_t y) node = node->m_tnext; } - FBoundingBox box(thing->x, thing->y, thing->radius); + FBoundingBox box(thing->X(), thing->Y(), thing->radius); FBlockLinesIterator it(box); line_t *ld; @@ -5922,13 +5910,13 @@ static void SpawnDeepSplash(AActor *t1, const FTraceResults &trace, AActor *puff den = TMulScale16(plane->a, vx, plane->b, vy, plane->c, vz); if (den != 0) { - num = TMulScale16(plane->a, t1->x, plane->b, t1->y, plane->c, shootz) + plane->d; + num = TMulScale16(plane->a, t1->X(), plane->b, t1->Y(), plane->c, shootz) + plane->d; hitdist = FixedDiv(-num, den); if (hitdist >= 0 && hitdist <= trace.Distance) { - fixed_t hitx = t1->x + FixedMul(vx, hitdist); - fixed_t hity = t1->y + FixedMul(vy, hitdist); + fixed_t hitx = t1->X() + FixedMul(vx, hitdist); + fixed_t hity = t1->Y() + FixedMul(vy, hitdist); fixed_t hitz = shootz + FixedMul(vz, hitdist); P_HitWater(puff != NULL ? puff : t1, P_PointInSector(hitx, hity), hitx, hity, hitz); diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 1c7a205a1..28714bef6 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -326,7 +326,7 @@ void AActor::LinkToWorld (bool buggy) if (!buggy || numgamenodes == 0) { - sec = P_PointInSector (x, y); + sec = P_PointInSector (X(), Y()); } else {