From 3e446ea04d35f8a9afb1b634a94143c9c0db69fa Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Jan 2016 13:48:16 +0100 Subject: [PATCH] - replaced access to AActor's coordinate members with access functions (first 200 compile errors down...) --- src/am_map.cpp | 42 +++++++++++++++++----------------- src/b_func.cpp | 26 +++++++++++----------- src/b_move.cpp | 10 ++++----- src/b_think.cpp | 4 ++-- src/c_cmds.cpp | 4 ++-- src/d_dehacked.cpp | 2 +- src/d_net.cpp | 4 ++-- src/g_game.cpp | 6 ++--- src/m_cheat.cpp | 2 +- src/p_3dfloors.cpp | 14 ++++++------ src/p_3dmidtex.cpp | 6 ++--- src/p_acs.cpp | 20 ++++++++--------- src/p_effect.cpp | 6 ++--- src/p_enemy.cpp | 52 +++++++++++++++++++++---------------------- src/p_interaction.cpp | 6 ++--- src/p_lnspec.cpp | 4 ++-- src/p_things.cpp | 6 ++--- src/r_defs.h | 5 +++++ 18 files changed, 112 insertions(+), 107 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 606a65ae85..64d5420b0c 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -998,8 +998,8 @@ void AM_restoreScaleAndLoc () } else { - m_x = (players[consoleplayer].camera->x >> FRACTOMAPBITS) - m_w/2; - m_y = (players[consoleplayer].camera->y >> FRACTOMAPBITS)- m_h/2; + m_x = (players[consoleplayer].camera->X() >> FRACTOMAPBITS) - m_w/2; + m_y = (players[consoleplayer].camera->Y() >> FRACTOMAPBITS)- m_h/2; } m_x2 = m_x + m_w; m_y2 = m_y + m_h; @@ -1249,8 +1249,8 @@ void AM_initVariables () if (playeringame[pnum]) break; assert(pnum >= 0 && pnum < MAXPLAYERS); - m_x = (players[pnum].camera->x >> FRACTOMAPBITS) - m_w/2; - m_y = (players[pnum].camera->y >> FRACTOMAPBITS) - m_h/2; + m_x = (players[pnum].camera->X() >> FRACTOMAPBITS) - m_w/2; + m_y = (players[pnum].camera->Y() >> FRACTOMAPBITS) - m_h/2; AM_changeWindowLoc(); // for saving & restoring @@ -1571,25 +1571,25 @@ void AM_doFollowPlayer () fixed_t sx, sy; if (players[consoleplayer].camera != NULL && - (f_oldloc.x != players[consoleplayer].camera->x || - f_oldloc.y != players[consoleplayer].camera->y)) + (f_oldloc.x != players[consoleplayer].camera->X() || + f_oldloc.y != players[consoleplayer].camera->Y())) { - m_x = (players[consoleplayer].camera->x >> FRACTOMAPBITS) - m_w/2; - m_y = (players[consoleplayer].camera->y >> FRACTOMAPBITS) - m_h/2; + m_x = (players[consoleplayer].camera->X() >> FRACTOMAPBITS) - m_w/2; + m_y = (players[consoleplayer].camera->Y() >> FRACTOMAPBITS) - m_h/2; m_x2 = m_x + m_w; m_y2 = m_y + m_h; // do the parallax parchment scrolling. - sx = (players[consoleplayer].camera->x - f_oldloc.x) >> FRACTOMAPBITS; - sy = (f_oldloc.y - players[consoleplayer].camera->y) >> FRACTOMAPBITS; + sx = (players[consoleplayer].camera->X() - f_oldloc.x) >> FRACTOMAPBITS; + sy = (f_oldloc.y - players[consoleplayer].camera->Y()) >> FRACTOMAPBITS; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { AM_rotate (&sx, &sy, players[consoleplayer].camera->angle - ANG90); } AM_ScrollParchment (sx, sy); - f_oldloc.x = players[consoleplayer].camera->x; - f_oldloc.y = players[consoleplayer].camera->y; + f_oldloc.x = players[consoleplayer].camera->X(); + f_oldloc.y = players[consoleplayer].camera->Y(); } } @@ -2612,8 +2612,8 @@ void AM_drawPlayers () mline_t *arrow; int numarrowlines; - pt.x = players[consoleplayer].camera->x >> FRACTOMAPBITS; - pt.y = players[consoleplayer].camera->y >> FRACTOMAPBITS; + pt.x = players[consoleplayer].camera->X() >> FRACTOMAPBITS; + pt.y = players[consoleplayer].camera->Y() >> FRACTOMAPBITS; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { angle = ANG90; @@ -2675,8 +2675,8 @@ void AM_drawPlayers () if (p->mo != NULL) { - pt.x = p->mo->x >> FRACTOMAPBITS; - pt.y = p->mo->y >> FRACTOMAPBITS; + pt.x = p->mo->X() >> FRACTOMAPBITS; + pt.y = p->mo->Y() >> FRACTOMAPBITS; angle = p->mo->angle; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) @@ -2707,8 +2707,8 @@ void AM_drawKeys () while ((key = it.Next()) != NULL) { - p.x = key->x >> FRACTOMAPBITS; - p.y = key->y >> FRACTOMAPBITS; + p.x = key->X() >> FRACTOMAPBITS; + p.y = key->Y() >> FRACTOMAPBITS; angle = key->angle; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) @@ -2752,8 +2752,8 @@ void AM_drawThings () { if (am_cheat > 0 || !(t->flags6 & MF6_NOTONAUTOMAP)) { - p.x = t->x >> FRACTOMAPBITS; - p.y = t->y >> FRACTOMAPBITS; + p.x = t->X() >> FRACTOMAPBITS; + p.y = t->Y() >> FRACTOMAPBITS; if (am_showthingsprites > 0 && t->sprite > 0) { @@ -2979,7 +2979,7 @@ void AM_drawAuthorMarkers () marked->subsector->flags & SSECF_DRAWN : marked->Sector->MoreFlags & SECF_DRAWN))) { - DrawMarker (tex, marked->x >> FRACTOMAPBITS, marked->y >> FRACTOMAPBITS, 0, + DrawMarker (tex, marked->X() >> FRACTOMAPBITS, marked->Y() >> FRACTOMAPBITS, 0, flip, mark->scaleX, mark->scaleY, mark->Translation, mark->alpha, mark->fillcolor, mark->RenderStyle); } diff --git a/src/b_func.cpp b/src/b_func.cpp index 9594d29d8b..79518e82f9 100644 --- a/src/b_func.cpp +++ b/src/b_func.cpp @@ -30,17 +30,17 @@ bool DBot::Reachable (AActor *rtarget) if (player->mo == rtarget) return false; - if ((rtarget->Sector->ceilingplane.ZatPoint (rtarget->x, rtarget->y) - - rtarget->Sector->floorplane.ZatPoint (rtarget->x, rtarget->y)) + if ((rtarget->Sector->ceilingplane.ZatPoint (rtarget) - + rtarget->Sector->floorplane.ZatPoint (rtarget)) < player->mo->height) //Where rtarget is, player->mo can't be. return false; sector_t *last_s = player->mo->Sector; - fixed_t last_z = last_s->floorplane.ZatPoint (player->mo->x, player->mo->y); + fixed_t last_z = last_s->floorplane.ZatPoint (player->mo); fixed_t estimated_dist = player->mo->AproxDistance(rtarget); bool reachable = true; - FPathTraverse it(player->mo->x+player->mo->velx, player->mo->y+player->mo->vely, rtarget->x, rtarget->y, PT_ADDLINES|PT_ADDTHINGS); + FPathTraverse it(player->mo->X()+player->mo->velx, player->mo->Y()+player->mo->vely, rtarget->X(), rtarget->Y(), PT_ADDLINES|PT_ADDTHINGS); intercept_t *in; while ((in = it.Next())) { @@ -96,7 +96,7 @@ bool DBot::Reachable (AActor *rtarget) thing = in->d.thing; if (thing == player->mo) //Can't reach self in this case. continue; - if (thing == rtarget && (rtarget->Sector->floorplane.ZatPoint (rtarget->x, rtarget->y) <= (last_z+MAXMOVEHEIGHT))) + if (thing == rtarget && (rtarget->Sector->floorplane.ZatPoint (rtarget) <= (last_z+MAXMOVEHEIGHT))) { return true; } @@ -219,7 +219,7 @@ void DBot::Dofire (ticcmd_t *cmd) shootmissile: dist = player->mo->AproxDistance (enemy); m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->Speed; - bglobal.SetBodyAt (enemy->x + enemy->velx*m*2, enemy->y + enemy->vely*m*2, enemy->z, 1); + bglobal.SetBodyAt (enemy->X() + enemy->velx*m*2, enemy->Y() + enemy->vely*m*2, enemy->Z(), 1); angle = player->mo->AngleTo(bglobal.body1); if (Check_LOS (enemy, SHOOTFOV)) no_fire = false; @@ -459,7 +459,7 @@ void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum) //Emulates missile travel. Returns distance travelled. fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd) { - AActor *th = Spawn ("CajunTrace", source->x, source->y, source->z + 4*8*FRACUNIT, NO_REPLACE); + AActor *th = Spawn ("CajunTrace", source->X(), source->Y(), source->Z() + 4*8*FRACUNIT, NO_REPLACE); th->target = source; // where it came from @@ -494,9 +494,9 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd) AActor *actor; int m; - bglobal.SetBodyAt (player->mo->x + FixedMul(player->mo->velx, 5*FRACUNIT), - player->mo->y + FixedMul(player->mo->vely, 5*FRACUNIT), - player->mo->z + (player->mo->height / 2), 2); + bglobal.SetBodyAt (player->mo->X() + FixedMul(player->mo->velx, 5*FRACUNIT), + player->mo->Y() + FixedMul(player->mo->vely, 5*FRACUNIT), + player->mo->Z() + (player->mo->height / 2), 2); actor = bglobal.body2; @@ -506,14 +506,14 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd) //Predict. m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->Speed); - bglobal.SetBodyAt (enemy->x + FixedMul(enemy->velx, (m+2*FRACUNIT)), - enemy->y + FixedMul(enemy->vely, (m+2*FRACUNIT)), ONFLOORZ, 1); + bglobal.SetBodyAt (enemy->X() + FixedMul(enemy->velx, (m+2*FRACUNIT)), + enemy->Y() + FixedMul(enemy->vely, (m+2*FRACUNIT)), ONFLOORZ, 1); //try the predicted location if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile { FCheckPosition tm; - if (bglobal.SafeCheckPosition (player->mo, actor->x, actor->y, tm)) + if (bglobal.SafeCheckPosition (player->mo, actor->X(), actor->Y(), tm)) { if (bglobal.FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST) { diff --git a/src/b_move.cpp b/src/b_move.cpp index 5cacd56645..e0c49159e7 100644 --- a/src/b_move.cpp +++ b/src/b_move.cpp @@ -67,8 +67,8 @@ bool DBot::Move (ticcmd_t *cmd) if ((unsigned)player->mo->movedir >= 8) I_Error ("Weird bot movedir!"); - tryx = player->mo->x + 8*xspeed[player->mo->movedir]; - tryy = player->mo->y + 8*yspeed[player->mo->movedir]; + tryx = player->mo->X() + 8*xspeed[player->mo->movedir]; + tryy = player->mo->Y() + 8*yspeed[player->mo->movedir]; try_ok = bglobal.CleanAhead (player->mo, tryx, tryy, cmd); @@ -282,7 +282,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm if ( !(thing->flags & MF_TELEPORT) && - tm.ceilingz - thing->z < thing->height) + tm.ceilingz - thing->Z() < thing->height) return false; // mobj must lower itself to fit // jump out of water @@ -290,7 +290,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm // maxstep=37*FRACUNIT; if ( !(thing->flags & MF_TELEPORT) && - (tm.floorz - thing->z > maxstep ) ) + (tm.floorz - thing->Z() > maxstep ) ) return false; // too big a step up @@ -346,7 +346,7 @@ void DBot::Pitch (AActor *target) double aim; double diff; - diff = target->z - player->mo->z; + diff = target->Z() - player->mo->Z(); aim = atan(diff / (double)player->mo->AproxDistance(target)); player->mo->pitch = -(int)(aim * ANGLE_180/M_PI); } diff --git a/src/b_think.cpp b/src/b_think.cpp index ced5b4b4e0..de74c04dbe 100644 --- a/src/b_think.cpp +++ b/src/b_think.cpp @@ -303,8 +303,8 @@ void DBot::ThinkForMove (ticcmd_t *cmd) if (t_fight<(AFTERTICS/2)) player->mo->flags |= MF_DROPOFF; - oldx = player->mo->x; - oldy = player->mo->y; + oldx = player->mo->X(); + oldy = player->mo->Y(); } //BOT_WhatToGet diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 57290a98ae..3cfbf1c650 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -944,7 +944,7 @@ static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const cha { Printf ("%s at (%d,%d,%d)\n", mo->GetClass()->TypeName.GetChars(), - mo->x >> FRACBITS, mo->y >> FRACBITS, mo->z >> FRACBITS); + mo->X() >> FRACBITS, mo->Y() >> FRACBITS, mo->Z() >> FRACBITS); } } } @@ -1084,7 +1084,7 @@ CCMD(currentpos) { AActor *mo = players[consoleplayer].mo; Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n", - FIXED2FLOAT(mo->x), FIXED2FLOAT(mo->y), FIXED2FLOAT(mo->z), mo->angle/float(ANGLE_1), FIXED2FLOAT(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel); + FIXED2FLOAT(mo->X()), FIXED2FLOAT(mo->Y()), FIXED2FLOAT(mo->Z()), mo->angle/float(ANGLE_1), FIXED2FLOAT(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel); } //----------------------------------------------------------------------------- diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index bc0acc6665..31ff05b649 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -3056,7 +3056,7 @@ bool ADehackedPickup::TryPickup (AActor *&toucher) { return false; } - RealPickup = static_cast(Spawn (type, x, y, z, NO_REPLACE)); + RealPickup = static_cast(Spawn (type, X(), Y(), Z(), NO_REPLACE)); if (RealPickup != NULL) { // The internally spawned item should never count towards statistics. diff --git a/src/d_net.cpp b/src/d_net.cpp index 780b893827..2b7a2d3d9f 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -2373,8 +2373,8 @@ void Net_DoCommand (int type, BYTE **stream, int player) s = ReadString (stream); - if (Trace (players[player].mo->x, players[player].mo->y, - players[player].mo->z + players[player].mo->height - (players[player].mo->height>>2), + if (Trace (players[player].mo->X(), players[player].mo->Y(), + players[player].mo->Z() + players[player].mo->height - (players[player].mo->height>>2), players[player].mo->Sector, vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, players[player].mo, trace, TRACE_NoSky)) diff --git a/src/g_game.cpp b/src/g_game.cpp index b7d10251b5..aa2ba0ab87 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1176,7 +1176,7 @@ void G_Ticker () } if (players[i].mo) { - DWORD sum = rngsum + players[i].mo->x + players[i].mo->y + players[i].mo->z + DWORD sum = rngsum + players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z() + players[i].mo->angle + players[i].mo->pitch; sum ^= players[i].health; consistancy[i][buf] = sum; @@ -1435,12 +1435,12 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing) if (!players[playernum].mo) { // first spawn of level, before corpses for (i = 0; i < playernum; i++) - if (players[i].mo && players[i].mo->x == x && players[i].mo->y == y) + if (players[i].mo && players[i].mo->X() == x && players[i].mo->Y() == y) return false; return true; } - oldz = players[playernum].mo->z; // [RH] Need to save corpse's z-height + oldz = players[playernum].mo->Z(); // [RH] Need to save corpse's z-height players[playernum].mo->z = z; // [RH] Checks are now full 3-D // killough 4/2/98: fix bug where P_CheckPosition() uses a non-solid diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index ab9c0aee71..3bab8f7e5e 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -580,7 +580,7 @@ void GiveSpawner (player_t *player, const PClass *type, int amount) } AInventory *item = static_cast - (Spawn (type, player->mo->x, player->mo->y, player->mo->z, NO_REPLACE)); + (Spawn (type, player->mo->X(), player->mo->Y(), player->mo->Z(), NO_REPLACE)); if (item != NULL) { if (amount > 0) diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 496809fac6..a9af52724e 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -331,13 +331,13 @@ void P_PlayerOnSpecial3DFloor(player_t* player) if(rover->flags & FF_SOLID) { // Player must be on top of the floor to be affected... - if(player->mo->z != rover->top.plane->ZatPoint(player->mo->x, player->mo->y)) continue; + if(player->mo->Z() != rover->top.plane->ZatPoint(player->mo)) continue; } else { //Water and DEATH FOG!!! heh - if (player->mo->z > rover->top.plane->ZatPoint(player->mo->x, player->mo->y) || - (player->mo->z + player->mo->height) < rover->bottom.plane->ZatPoint(player->mo->x, player->mo->y)) + if (player->mo->Z() > rover->top.plane->ZatPoint(player->mo) || + (player->mo->Z() + player->mo->height) < rover->bottom.plane->ZatPoint(player->mo)) continue; } @@ -372,7 +372,7 @@ bool P_CheckFor3DFloorHit(AActor * mo) if(rover->flags & FF_SOLID && rover->model->SecActTarget) { - if(mo->floorz == rover->top.plane->ZatPoint(mo->x, mo->y)) + if(mo->floorz == rover->top.plane->ZatPoint(mo)) { rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor); return true; @@ -402,7 +402,7 @@ bool P_CheckFor3DCeilingHit(AActor * mo) if(rover->flags & FF_SOLID && rover->model->SecActTarget) { - if(mo->ceilingz == rover->bottom.plane->ZatPoint(mo->x, mo->y)) + if(mo->ceilingz == rover->bottom.plane->ZatPoint(mo)) { rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling); return true; @@ -748,7 +748,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li { fixed_t thingbot, thingtop; - thingbot = thing->z; + thingbot = thing->Z(); thingtop = thingbot + (thing->height==0? 1:thing->height); extsector_t::xfloor *xf[2] = {&linedef->frontsector->e->XFloor, &linedef->backsector->e->XFloor}; @@ -789,7 +789,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li lowestceilingpic = *rover->bottom.texture; } - if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->z >= ff_top)) + if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->Z() >= ff_top)) { highestfloor = ff_top; highestfloorpic = *rover->top.texture; diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index dbca50d105..3338956f32 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -276,7 +276,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening & open.abovemidtex = false; if (P_GetMidTexturePosition(linedef, 0, &tt, &tb)) { - if (thing->z + (thing->height/2) < (tt + tb)/2) + if (thing->Z() + (thing->height/2) < (tt + tb)/2) { if (tb < open.top) { @@ -286,7 +286,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening & } else { - if (tt > open.bottom && (!restrict || thing->z >= tt)) + if (tt > open.bottom && (!restrict || thing->Z() >= tt)) { open.bottom = tt; open.abovemidtex = true; @@ -295,7 +295,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening & } // returns true if it touches the midtexture - return (abs(thing->z - tt) <= thing->MaxStepHeight); + return (abs(thing->Z() - tt) <= thing->MaxStepHeight); } } return false; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 6f136d98b7..8c8c0a5f1e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3441,12 +3441,12 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool forc while ( (aspot = iterator.Next ()) ) { - spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, angle, force); + spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, angle, force); } } else if (activator != NULL) { - spawned += DoSpawn (type, activator->x, activator->y, activator->z, tid, angle, force); + spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, angle, force); } return spawned; } @@ -3462,12 +3462,12 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force) while ( (aspot = iterator.Next ()) ) { - spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, aspot->angle >> 24, force); + spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, aspot->angle >> 24, force); } } else if (activator != NULL) { - spawned += DoSpawn (type, activator->x, activator->y, activator->z, tid, activator->angle >> 24, force); + spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, activator->angle >> 24, force); } return spawned; } @@ -4145,7 +4145,7 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b F3DFloor *ff = sec->e->XFloor.ffloors[i]; if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) && - actor->z >= ff->top.plane->ZatPoint(actor->x, actor->y)) + actor->Z() >= ff->top.plane->ZatPoint(actor)) { // This floor is beneath our feet. secpic = *ff->top.texture; break; @@ -4158,14 +4158,14 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b } else { - fixed_t z = actor->z + actor->height; + fixed_t z = actor->Z() + actor->height; // Looking through planes from bottom to top for (i = numff-1; i >= 0; --i) { F3DFloor *ff = sec->e->XFloor.ffloors[i]; if ((ff->flags & (FF_EXISTS | FF_SOLID)) == (FF_EXISTS | FF_SOLID) && - z <= ff->bottom.plane->ZatPoint(actor->x, actor->y)) + z <= ff->bottom.plane->ZatPoint(actor)) { // This floor is above our eyes. secpic = *ff->bottom.texture; break; @@ -4728,8 +4728,8 @@ static bool DoSpawnDecal(AActor *actor, const FDecalTemplate *tpl, int flags, an { angle += actor->angle; } - return NULL != ShootDecal(tpl, actor, actor->Sector, actor->x, actor->y, - actor->z + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs, + return NULL != ShootDecal(tpl, actor, actor->Sector, actor->X(), actor->Y(), + actor->Z() + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs, angle, distance, !!(flags & SDF_PERMANENT)); } @@ -8598,7 +8598,7 @@ scriptwait: } else if (pcd == PCD_GETACTORZ) { - STACK(1) = actor->z + actor->GetBobOffset(); + STACK(1) = actor->Z() + actor->GetBobOffset(); } else { diff --git a/src/p_effect.cpp b/src/p_effect.cpp index db31295219..0f04de8eb2 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -619,8 +619,8 @@ void P_DrawRailTrail(AActor *source, const TVector3 &start, const TVecto double r; double dirz; - if (abs(mo->x - FLOAT2FIXED(start.X)) < 20 * FRACUNIT - && (mo->y - FLOAT2FIXED(start.Y)) < 20 * FRACUNIT) + if (abs(mo->X() - FLOAT2FIXED(start.X)) < 20 * FRACUNIT + && (mo->Y() - FLOAT2FIXED(start.Y)) < 20 * FRACUNIT) { // This player (probably) fired the railgun S_Sound (mo, CHAN_WEAPON, sound, 1, ATTN_NORM); } @@ -630,7 +630,7 @@ void P_DrawRailTrail(AActor *source, const TVector3 &start, const TVecto // Only consider sound in 2D (for now, anyway) // [BB] You have to divide by lengthsquared here, not multiply with it. - r = ((start.Y - FIXED2DBL(mo->y)) * (-dir.Y) - (start.X - FIXED2DBL(mo->x)) * (dir.X)) / lengthsquared; + r = ((start.Y - FIXED2DBL(mo->Y())) * (-dir.Y) - (start.X - FIXED2DBL(mo->X())) * (dir.X)) / lengthsquared; r = clamp(r, 0., 1.); dirz = dir.Z; diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 7b7e27b2e3..165ac35a1d 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -243,9 +243,9 @@ bool AActor::CheckMeleeRange () // [RH] Don't melee things too far above or below actor. if (!(flags5 & MF5_NOVERTICALMELEERANGE)) { - if (pl->z > z + height) + if (pl->Z() > z + height) return false; - if (pl->z + pl->height < z) + if (pl->Z() + pl->height < z) return false; } @@ -280,11 +280,11 @@ bool P_CheckMeleeRange2 (AActor *actor) { return false; } - if (mo->z > actor->z+actor->height) + if (mo->Z() > actor->Z()+actor->height) { // Target is higher than the attacker return false; } - else if (actor->z > mo->z+mo->height) + else if (actor->Z() > mo->Z()+mo->height) { // Attacker is higher return false; } @@ -434,7 +434,7 @@ bool P_Move (AActor *actor) // it difficult to thrust them vertically in a reasonable manner. // [GZ] Let jumping actors jump. if (!((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP)) - && actor->z > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) + && actor->Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) { return false; } @@ -538,11 +538,11 @@ bool P_Move (AActor *actor) // actually walking down a step. if (try_ok && !((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP)) - && actor->z > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) + && actor->Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ)) { - if (actor->z <= actor->floorz + actor->MaxStepHeight) + if (actor->Y() <= actor->floorz + actor->MaxStepHeight) { - fixed_t savedz = actor->z; + fixed_t savedz = actor->Z(); actor->z = actor->floorz; // Make sure that there isn't some other actor between us and // the floor we could get stuck in. The old code did not do this. @@ -553,7 +553,7 @@ bool P_Move (AActor *actor) else { // The monster just hit the floor, so trigger any actions. if (actor->floorsector->SecActTarget != NULL && - actor->floorz == actor->floorsector->floorplane.ZatPoint(actor->x, actor->y)) + actor->floorz == actor->floorsector->floorplane.ZatPoint(actor)) { actor->floorsector->SecActTarget->TriggerAction(actor, SECSPAC_HitFloor); } @@ -566,7 +566,7 @@ bool P_Move (AActor *actor) { if (((actor->flags6 & MF6_CANJUMP)||(actor->flags & MF_FLOAT)) && tm.floatok) { // must adjust height - fixed_t savedz = actor->z; + fixed_t savedz = actor->Z(); if (actor->z < tm.floorz) actor->z += actor->FloatSpeed; @@ -847,11 +847,11 @@ void P_NewChaseDir(AActor * actor) // Try to move away from a dropoff if (actor->floorz - actor->dropoffz > actor->MaxDropOffHeight && - actor->z <= actor->floorz && !(actor->flags & MF_DROPOFF) && + actor->Z() <= actor->floorz && !(actor->flags & MF_DROPOFF) && !(actor->flags2 & MF2_ONMOBJ) && !(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF)) { - FBoundingBox box(actor->x, actor->y, actor->radius); + FBoundingBox box(actor->X(), actor->Y(), actor->radius); FBlockLinesIterator it(box); line_t *line; @@ -866,14 +866,14 @@ void P_NewChaseDir(AActor * actor) box.Bottom() < line->bbox[BOXTOP] && box.BoxOnLineSide(line) == -1) { - fixed_t front = line->frontsector->floorplane.ZatPoint(actor->x,actor->y); - fixed_t back = line->backsector->floorplane.ZatPoint(actor->x,actor->y); + fixed_t front = line->frontsector->floorplane.ZatPoint(actor); + fixed_t back = line->backsector->floorplane.ZatPoint(actor); angle_t angle; // The monster must contact one of the two floors, // and the other must be a tall dropoff. - if (back == actor->z && front < actor->z - actor->MaxDropOffHeight) + if (back == actor->Z() && front < actor->Z() - actor->MaxDropOffHeight) { angle = R_PointToAngle2(0,0,line->dx,line->dy); // front side dropoff } @@ -2551,11 +2551,11 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) if (testsec) { fixed_t zdist1, zdist2; - if (P_Find3DFloor(testsec, corpsehit->x, corpsehit->y, corpsehit->z, false, true, zdist1) - != P_Find3DFloor(testsec, self->x, self->y, self->z, false, true, zdist2)) + if (P_Find3DFloor(testsec, corpsehit->X(), corpsehit->Y(), corpsehit->Z(), false, true, zdist1) + != P_Find3DFloor(testsec, self->X(), self->Y(), self->Z(), false, true, zdist2)) { // Not on same floor - if (vilesec == corpsec || abs(zdist1 - self->z) > self->height) + if (vilesec == corpsec || abs(zdist1 - self->Z()) > self->height) continue; } } @@ -2569,7 +2569,7 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates) corpsehit->flags |= MF_SOLID; corpsehit->height = corpsehit->GetDefault()->height; - bool check = P_CheckPosition(corpsehit, corpsehit->x, corpsehit->y); + bool check = P_CheckPosition(corpsehit, corpsehit->X(), corpsehit->Y()); corpsehit->flags = oldflags; corpsehit->radius = oldradius; corpsehit->height = oldheight; @@ -2792,19 +2792,19 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a // If the target z is above the target's head, reposition to the middle of // its body. - if (target_z >= other->z + other->height) + if (target_z >= other->Z() + other->height) { - target_z = other->z + (other->height / 2); + target_z = other->Z() + (other->height / 2); } //Note there is no +32*FRACUNIT on purpose. This is for customization sake. //If one doesn't want this behavior, just don't use FAF_BOTTOM. if (flags & FAF_BOTTOM) - target_z = other->z + other->GetBobOffset(); + target_z = other->Z() + other->GetBobOffset(); if (flags & FAF_MIDDLE) - target_z = other->z + (other->height / 2) + other->GetBobOffset(); + target_z = other->Z() + (other->height / 2) + other->GetBobOffset(); if (flags & FAF_TOP) - target_z = other->z + (other->height) + other->GetBobOffset(); + target_z = other->Z() + (other->height) + other->GetBobOffset(); if (!(flags & FAF_NODISTFACTOR)) target_z += pitch_offset; @@ -3072,7 +3072,7 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int dropamount, int AActor *mo; fixed_t spawnz; - spawnz = source->z; + spawnz = source->Z(); if (!(i_compatflags & COMPATF_NOTOSSDROPS)) { int style = sv_dropstyle; @@ -3087,7 +3087,7 @@ AInventory *P_DropItem (AActor *source, const PClass *type, int dropamount, int spawnz += source->height / 2; } } - mo = Spawn (type, source->x, source->y, spawnz, ALLOW_REPLACE); + mo = Spawn (type, source->X(), source->Y(), spawnz, ALLOW_REPLACE); if (mo != NULL) { mo->flags |= MF_DROPPED; diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 5534fb14ab..0c61b2d7df 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -84,7 +84,7 @@ FName MeansOfDeath; // void P_TouchSpecialThing (AActor *special, AActor *toucher) { - fixed_t delta = special->z - toucher->z; + fixed_t delta = special->Z() - toucher->Z(); // The pickup is at or above the toucher's feet OR // The pickup is below the toucher. @@ -1158,7 +1158,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // If the origin and target are in exactly the same spot, choose a random direction. // (Most likely cause is from telefragging somebody during spawning because they // haven't moved from their spawn spot at all.) - if (origin->x == target->x && origin->y == target->y) + if (origin->X() == target->X() && origin->Y() == target->Y()) { ang = pr_kickbackdir.GenRand32(); } @@ -1184,7 +1184,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // make fall forwards sometimes if ((damage < 40) && (damage > target->health) - && (target->z - origin->z > 64*FRACUNIT) + && (target->Z() - origin->Z() > 64*FRACUNIT) && (pr_damagemobj()&1) // [RH] But only if not too fast and not flying && thrust < 10*FRACUNIT diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 53090ef186..22e901c73d 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -148,7 +148,7 @@ FUNC(LS_Polyobj_MoveToSpot) FActorIterator iterator (arg2); AActor *spot = iterator.Next(); if (spot == NULL) return false; - return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->x, spot->y, false); + return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->X(), spot->Y(), false); } FUNC(LS_Polyobj_DoorSwing) @@ -199,7 +199,7 @@ FUNC(LS_Polyobj_OR_MoveToSpot) FActorIterator iterator (arg2); AActor *spot = iterator.Next(); if (spot == NULL) return false; - return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->x, spot->y, true); + return EV_MovePolyTo (ln, arg0, SPEED(arg1), spot->X(), spot->Y(), true); } FUNC(LS_Polyobj_Stop) diff --git a/src/p_things.cpp b/src/p_things.cpp index 631f1be5e8..e8f9d60114 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -82,7 +82,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog, } while (spot != NULL) { - mobj = Spawn (kind, spot->x, spot->y, spot->z, ALLOW_REPLACE); + mobj = Spawn (kind, spot->X(), spot->Y(), spot->Z(), ALLOW_REPLACE); if (mobj != NULL) { @@ -94,7 +94,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog, mobj->angle = (angle != ANGLE_MAX ? angle : spot->angle); if (fog) { - P_SpawnTeleportFog(mobj, spot->x, spot->y, spot->z + TELEFOGHEIGHT, false, true); + P_SpawnTeleportFog(mobj, spot->X(), spot->Y(), spot->Z() + TELEFOGHEIGHT, false, true); } if (mobj->flags & MF_SPECIAL) mobj->flags |= MF_DROPPED; // Don't respawn @@ -165,7 +165,7 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog) if (source != NULL && target != NULL) { - return P_MoveThing(source, target->x, target->y, target->z, fog); + return P_MoveThing(source, target->X(), target->Y(), target->Z(), fog); } return false; } diff --git a/src/r_defs.h b/src/r_defs.h index 05fd7bd036..6f69a26a01 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -248,6 +248,11 @@ struct secplane_t return FixedMul (ic, -d - DMulScale16 (a, v->x, b, v->y)); } + fixed_t ZatPoint (const AActor *ac) const + { + return FixedMul (ic, -d - DMulScale16 (a, ac->X(), b, ac->Y())); + } + // Returns the value of z at (x,y) if d is equal to dist fixed_t ZatPointDist (fixed_t x, fixed_t y, fixed_t dist) const {