diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index 1149bc2c3..29f24b47e 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -262,14 +262,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks) i = (pr_freeze.Random2()) % (numChunks/4); for (i = MAX (24, numChunks + i); i >= 0; i--) { - mo = Spawn("IceChunk", - self->x + (((pr_freeze()-128)*self->radius)>>7), - self->y + (((pr_freeze()-128)*self->radius)>>7), - self->z + (pr_freeze()*self->height/255), ALLOW_REPLACE); + mo = Spawn("IceChunk", self->Vec3Offset( + (((pr_freeze()-128)*self->radius)>>7), + (((pr_freeze()-128)*self->radius)>>7), + (pr_freeze()*self->height/255)), ALLOW_REPLACE); if (mo) { mo->SetState (mo->SpawnState + (pr_freeze()%3)); - mo->velz = FixedDiv(mo->z - self->z, self->height)<<2; + mo->velz = FixedDiv(mo->Z() - self->Z(), self->height)<<2; mo->velx = pr_freeze.Random2 () << (FRACBITS-7); mo->vely = pr_freeze.Random2 () << (FRACBITS-7); CALL_ACTION(A_IceSetTics, mo); // set a random tic wait @@ -279,11 +279,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks) } if (self->player) { // attach the player's view to a chunk of ice - AActor *head = Spawn("IceChunkHead", self->x, self->y, - self->z + self->player->mo->ViewHeight, ALLOW_REPLACE); + AActor *head = Spawn("IceChunkHead", self->PosPlusZ(self->player->mo->ViewHeight), ALLOW_REPLACE); if (head != NULL) { - head->velz = FixedDiv(head->z - self->z, self->height)<<2; + head->velz = FixedDiv(head->Z() - self->Z(), self->height)<<2; head->velx = pr_freeze.Random2 () << (FRACBITS-7); head->vely = pr_freeze.Random2 () << (FRACBITS-7); head->health = self->health; diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 2be2e179d..faa5392b7 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -965,7 +965,7 @@ void APowerFlight::InitEffect () Super::InitEffect(); Owner->flags2 |= MF2_FLY; Owner->flags |= MF_NOGRAVITY; - if (Owner->z <= Owner->floorz) + if (Owner->Z() <= Owner->floorz) { Owner->velz = 4*FRACUNIT; // thrust the player in the air a bit } @@ -1012,7 +1012,7 @@ void APowerFlight::EndEffect () if (!(Owner->flags7 & MF7_FLYCHEAT)) { - if (Owner->z != Owner->floorz) + if (Owner->Z() != Owner->floorz) { Owner->player->centering = true; } @@ -1250,7 +1250,7 @@ void APowerSpeed::DoEffect () if (P_AproxDistance (Owner->velx, Owner->vely) <= 12*FRACUNIT) return; - AActor *speedMo = Spawn (Owner->x, Owner->y, Owner->z, NO_REPLACE); + AActor *speedMo = Spawn (Owner->Pos(), NO_REPLACE); if (speedMo) { speedMo->angle = Owner->angle; diff --git a/src/g_shared/a_bridge.cpp b/src/g_shared/a_bridge.cpp index 4caa56287..eed95d8d2 100644 --- a/src/g_shared/a_bridge.cpp +++ b/src/g_shared/a_bridge.cpp @@ -110,9 +110,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit) if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / (100 * FRACUNIT)); self->angle += rotationspeed; - self->x = self->target->x + rotationradius * finecosine[self->angle >> ANGLETOFINESHIFT]; - self->y = self->target->y + rotationradius * finesine[self->angle >> ANGLETOFINESHIFT]; - self->z = self->target->z; + self->SetOrigin(self->target->Vec3Angle(rotationradius, self->angle, 0), true); + self->floorz = self->target->floorz; + self->ceilingz = self->target->ceilingz; } @@ -120,16 +120,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit) { angle_t startangle; AActor *ball; - fixed_t cx, cy, cz; ACTION_PARAM_START(1); ACTION_PARAM_CLASS(balltype, 0); if (balltype == NULL) balltype = PClass::FindClass("BridgeBall"); - cx = self->x; - cy = self->y; - cz = self->z; startangle = pr_orbit() << 24; // Spawn triad into world -- may be more than a triad now. @@ -137,7 +133,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit) for (int i = 0; i < ballcount; i++) { - ball = Spawn(balltype, cx, cy, cz, ALLOW_REPLACE); + ball = Spawn(balltype, self->Pos(), ALLOW_REPLACE); ball->angle = startangle + (ANGLE_45/32) * (256/ballcount) * i; ball->target = self; CALL_ACTION(A_BridgeOrbit, ball); diff --git a/src/g_shared/a_camera.cpp b/src/g_shared/a_camera.cpp index 24363851e..61a155ea7 100644 --- a/src/g_shared/a_camera.cpp +++ b/src/g_shared/a_camera.cpp @@ -176,11 +176,10 @@ void AAimingCamera::Tick () } if (MaxPitchChange) { // Aim camera's pitch; use floats for precision - float dx = FIXED2FLOAT(x - tracer->x); - float dy = FIXED2FLOAT(y - tracer->y); - float dz = FIXED2FLOAT(z - tracer->z - tracer->height/2); - float dist = (float)sqrt (dx*dx + dy*dy); - float ang = dist != 0.f ? (float)atan2 (dz, dist) : 0; + TVector2 vect = tracer->Vec2To(this); + double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2); + double dist = vect.Length(); + double ang = dist != 0.f ? atan2 (dz, dist) : 0; int desiredpitch = (angle_t)(ang * 2147483648.f / PI); if (abs (desiredpitch - pitch) < MaxPitchChange) { diff --git a/src/g_shared/a_debris.cpp b/src/g_shared/a_debris.cpp index e6fc79b0a..3b34a0d8a 100644 --- a/src/g_shared/a_debris.cpp +++ b/src/g_shared/a_debris.cpp @@ -36,17 +36,14 @@ void P_SpawnDirt (AActor *actor, fixed_t radius) AActor *mo; angle_t angle; - angle = pr_dirt()<<5; // <<24 >>19 - x = actor->x + FixedMul(radius,finecosine[angle]); - y = actor->y + FixedMul(radius,finesine[angle]); - z = actor->z + (pr_dirt()<<9) + FRACUNIT; + fixedvec3 pos = actor->Vec3Angle(radius, pr_dirt() << 24, (pr_dirt() << 9) + FRACUNIT); char fmt[8]; mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6); dtype = PClass::FindClass(fmt); if (dtype) { - mo = Spawn (dtype, x, y, z, ALLOW_REPLACE); + mo = Spawn (dtype, pos, ALLOW_REPLACE); if (mo) { mo->velz = pr_dirt()<<10; diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index 29fcbf8cb..64921d647 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -91,7 +91,7 @@ DBaseDecal::DBaseDecal (int statnum, fixed_t z) DBaseDecal::DBaseDecal (const AActor *basis) : DThinker(STAT_DECAL), - WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->z), ScaleX(basis->scaleX), ScaleY(basis->scaleY), + WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->Z()), ScaleX(basis->scaleX), ScaleY(basis->scaleY), Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum), RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle) { @@ -817,22 +817,22 @@ void ADecal::BeginPlay () { if (!tpl->PicNum.Exists()) { - Printf("Decal actor at (%d,%d) does not have a valid texture\n", x>>FRACBITS, y>>FRACBITS); + Printf("Decal actor at (%d,%d) does not have a valid texture\n", X()>>FRACBITS, Y()>>FRACBITS); } else { // Look for a wall within 64 units behind the actor. If none can be // found, then no decal is created, and this actor is destroyed // without effectively doing anything. - if (NULL == ShootDecal(tpl, this, Sector, x, y, z, angle + ANGLE_180, 64*FRACUNIT, true)) + if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), Z(), angle + ANGLE_180, 64*FRACUNIT, true)) { - DPrintf ("Could not find a wall to stick decal to at (%d,%d)\n", x>>FRACBITS, y>>FRACBITS); + DPrintf ("Could not find a wall to stick decal to at (%d,%d)\n", X()>>FRACBITS, Y()>>FRACBITS); } } } else { - DPrintf ("Decal actor at (%d,%d) does not have a good template\n", x>>FRACBITS, y>>FRACBITS); + DPrintf ("Decal actor at (%d,%d) does not have a good template\n", X()>>FRACBITS, Y()>>FRACBITS); } // This actor doesn't need to stick around anymore. Destroy(); diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index c019fcbf6..ae7f6a58b 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -25,10 +25,10 @@ void AFastProjectile::Tick () fixed_t zfrac; int changexy; - PrevX = x; - PrevY = y; - PrevZ = z; - fixed_t oldz = z; + PrevX = X(); + PrevY = Y(); + PrevZ = Z(); + fixed_t oldz = Z(); PrevAngle = angle; if (!(flags5 & MF5_NOTIMEFREEZE)) @@ -57,7 +57,7 @@ void AFastProjectile::Tick () } // Handle movement - if (velx || vely || (z != floorz) || velz) + if (velx || vely || (Z() != floorz) || velz) { xfrac = velx >> shift; yfrac = vely >> shift; @@ -73,14 +73,14 @@ void AFastProjectile::Tick () tm.LastRipped = NULL; // [RH] Do rip damage each step, like Hexen } - if (!P_TryMove (this, x + xfrac,y + yfrac, true, NULL, tm)) + if (!P_TryMove (this, X() + xfrac,Y() + yfrac, true, NULL, tm)) { // Blocked move if (!(flags3 & MF3_SKYEXPLODE)) { if (tm.ceilingline && tm.ceilingline->backsector && tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum && - z >= tm.ceilingline->backsector->ceilingplane.ZatPoint (x, y)) + Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint (this)) { // Hack to prevent missiles exploding against the sky. // Does not handle sky floors. @@ -99,10 +99,10 @@ void AFastProjectile::Tick () return; } } - z += zfrac; + AddZ(zfrac); UpdateWaterLevel (oldz); - oldz = z; - if (z <= floorz) + oldz = Z(); + if (Z() <= floorz) { // Hit the floor if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE)) @@ -113,12 +113,12 @@ void AFastProjectile::Tick () return; } - z = floorz; + SetZ(floorz); P_HitFloor (this); P_ExplodeMissile (this, NULL, NULL); return; } - if (z + height > ceilingz) + if (Top() > ceilingz) { // Hit the ceiling if (ceilingpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE)) @@ -127,7 +127,7 @@ void AFastProjectile::Tick () return; } - z = ceilingz - height; + SetZ(ceilingz - height); P_ExplodeMissile (this, NULL, NULL); return; } @@ -160,7 +160,7 @@ void AFastProjectile::Effect() FName name = (ENamedName) this->GetClass()->Meta.GetMetaInt (ACMETA_MissileName, NAME_None); if (name != NAME_None) { - fixed_t hitz = z-8*FRACUNIT; + fixed_t hitz = Z()-8*FRACUNIT; if (hitz < floorz) { @@ -172,7 +172,7 @@ void AFastProjectile::Effect() const PClass *trail = PClass::FindClass(name); if (trail != NULL) { - AActor *act = Spawn (trail, x, y, hitz, ALLOW_REPLACE); + AActor *act = Spawn (trail, X(), Y(), hitz, ALLOW_REPLACE); if (act != NULL) { act->angle = this->angle; diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index 4da6eb67b..bc63f7bf0 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -77,7 +77,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i return false; } - morphed = static_cast(Spawn (spawntype, actor->x, actor->y, actor->z, NO_REPLACE)); + morphed = static_cast(Spawn (spawntype, actor->Pos(), NO_REPLACE)); EndAllPowerupEffects(actor->Inventory); DObject::StaticPointerSubstitution (actor, morphed); if ((actor->tid != 0) && (style & MORPH_NEWTIDBEHAVIOUR)) @@ -105,7 +105,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, const PClass *spawntype, i morphed->flags |= actor->flags & (MF_SHADOW|MF_NOGRAVITY); morphed->flags2 |= actor->flags2 & MF2_FLY; morphed->flags3 |= actor->flags3 & MF3_GHOST; - AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->x, actor->y, actor->z + TELEFOGHEIGHT, ALLOW_REPLACE); + AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE); actor->player = NULL; actor->flags &= ~(MF_SOLID|MF_SHOOTABLE); actor->flags |= MF_UNMORPHED; @@ -192,7 +192,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, } mo = barrier_cast(pmo->tracer); - mo->SetOrigin (pmo->x, pmo->y, pmo->z); + mo->SetOrigin (pmo->Pos(), false); mo->flags |= MF_SOLID; pmo->flags &= ~MF_SOLID; if (!force && !P_TestMobjLocation (mo)) @@ -310,7 +310,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag, AActor *eflash = NULL; if (exit_flash != NULL) { - eflash = Spawn(exit_flash, pmo->x + 20*finecosine[angle], pmo->y + 20*finesine[angle], pmo->z + TELEFOGHEIGHT, ALLOW_REPLACE); + eflash = Spawn(exit_flash, pmo->Vec3Offset(20*finecosine[angle], 20*finesine[angle], TELEFOGHEIGHT), ALLOW_REPLACE); if (eflash) eflash->target = mo; } mo->SetupWeaponSlots(); // Use original class's weapon slots. @@ -381,7 +381,7 @@ bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int s return false; } - morphed = static_cast(Spawn (spawntype, actor->x, actor->y, actor->z, NO_REPLACE)); + morphed = static_cast(Spawn (spawntype, actor->Pos(), NO_REPLACE)); DObject::StaticPointerSubstitution (actor, morphed); morphed->tid = actor->tid; morphed->angle = actor->angle; @@ -410,7 +410,7 @@ bool P_MorphMonster (AActor *actor, const PClass *spawntype, int duration, int s actor->flags &= ~(MF_SOLID|MF_SHOOTABLE); actor->flags |= MF_UNMORPHED; actor->renderflags |= RF_INVISIBLE; - AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->x, actor->y, actor->z + TELEFOGHEIGHT, ALLOW_REPLACE); + AActor *eflash = Spawn(((enter_flash) ? enter_flash : RUNTIME_CLASS(ATeleportFog)), actor->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE); if (eflash) eflash->target = morphed; return true; @@ -436,7 +436,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force) return false; } actor = beast->UnmorphedMe; - actor->SetOrigin (beast->x, beast->y, beast->z); + actor->SetOrigin (beast->Pos(), false); actor->flags |= MF_SOLID; beast->flags &= ~MF_SOLID; ActorFlags6 beastflags6 = beast->flags6; @@ -472,7 +472,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force) DObject::StaticPointerSubstitution (beast, actor); const PClass *exit_flash = beast->MorphExitFlash; beast->Destroy (); - AActor *eflash = Spawn(exit_flash, beast->x, beast->y, beast->z + TELEFOGHEIGHT, ALLOW_REPLACE); + AActor *eflash = Spawn(exit_flash, beast->PosPlusZ(TELEFOGHEIGHT), ALLOW_REPLACE); if (eflash) eflash->target = actor; return true; diff --git a/src/g_shared/a_movingcamera.cpp b/src/g_shared/a_movingcamera.cpp index 0f847fa41..fe4526e16 100644 --- a/src/g_shared/a_movingcamera.cpp +++ b/src/g_shared/a_movingcamera.cpp @@ -282,7 +282,7 @@ void APathFollower::Activate (AActor *activator) if (CurrNode != NULL) { NewNode (); - SetOrigin (CurrNode->x, CurrNode->y, CurrNode->z); + SetOrigin (CurrNode->Pos(), false); Time = 0.f; HoldTime = 0; bJustStepped = true; @@ -302,9 +302,7 @@ void APathFollower::Tick () if (CurrNode->args[2]) { HoldTime = level.time + CurrNode->args[2] * TICRATE / 8; - x = CurrNode->x; - y = CurrNode->y; - z = CurrNode->z; + SetXYZ(CurrNode->X(), CurrNode->Y(), CurrNode->Z()); } } @@ -362,31 +360,33 @@ bool APathFollower::Interpolate () if ((args[2] & 8) && Time > 0.f) { - dx = x; - dy = y; - dz = z; + dx = X(); + dy = Y(); + dz = Z(); } if (CurrNode->Next==NULL) return false; UnlinkFromWorld (); + fixed_t x, y, z; if (args[2] & 1) { // linear - x = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->x), FIXED2FLOAT(CurrNode->Next->x))); - y = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->y), FIXED2FLOAT(CurrNode->Next->y))); - z = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->z), FIXED2FLOAT(CurrNode->Next->z))); + x = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->X()), FIXED2FLOAT(CurrNode->Next->X()))); + y = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->Y()), FIXED2FLOAT(CurrNode->Next->Y()))); + z = FLOAT2FIXED(Lerp (FIXED2FLOAT(CurrNode->Z()), FIXED2FLOAT(CurrNode->Next->Z()))); } else { // spline if (CurrNode->Next->Next==NULL) return false; - x = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->x), FIXED2FLOAT(CurrNode->x), - FIXED2FLOAT(CurrNode->Next->x), FIXED2FLOAT(CurrNode->Next->Next->x))); - y = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->y), FIXED2FLOAT(CurrNode->y), - FIXED2FLOAT(CurrNode->Next->y), FIXED2FLOAT(CurrNode->Next->Next->y))); - z = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->z), FIXED2FLOAT(CurrNode->z), - FIXED2FLOAT(CurrNode->Next->z), FIXED2FLOAT(CurrNode->Next->Next->z))); + x = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->X()), FIXED2FLOAT(CurrNode->X()), + FIXED2FLOAT(CurrNode->Next->X()), FIXED2FLOAT(CurrNode->Next->Next->X()))); + y = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->Y()), FIXED2FLOAT(CurrNode->Y()), + FIXED2FLOAT(CurrNode->Next->Y()), FIXED2FLOAT(CurrNode->Next->Next->Y()))); + z = FLOAT2FIXED(Splerp (FIXED2FLOAT(PrevNode->Z()), FIXED2FLOAT(CurrNode->Z()), + FIXED2FLOAT(CurrNode->Next->Z()), FIXED2FLOAT(CurrNode->Next->Next->Z()))); } + SetXYZ(x, y, z); LinkToWorld (); if (args[2] & 6) @@ -395,9 +395,9 @@ bool APathFollower::Interpolate () { if (args[2] & 1) { // linear - dx = CurrNode->Next->x - CurrNode->x; - dy = CurrNode->Next->y - CurrNode->y; - dz = CurrNode->Next->z - CurrNode->z; + dx = CurrNode->Next->X() - CurrNode->X(); + dy = CurrNode->Next->Y() - CurrNode->Y(); + dz = CurrNode->Next->Z() - CurrNode->Z(); } else if (Time > 0.f) { // spline @@ -422,6 +422,7 @@ bool APathFollower::Interpolate () x -= dx; y -= dy; z -= dz; + SetXYZ(x, y, z); } if (args[2] & 2) { // adjust yaw @@ -548,11 +549,11 @@ bool AActorMover::Interpolate () if (Super::Interpolate ()) { - fixed_t savedz = tracer->z; - tracer->z = z; - if (!P_TryMove (tracer, x, y, true)) + fixed_t savedz = tracer->Z(); + tracer->SetZ(Z()); + if (!P_TryMove (tracer, X(), Y(), true)) { - tracer->z = savedz; + tracer->SetZ(savedz); return false; } @@ -589,9 +590,9 @@ void AActorMover::Activate (AActor *activator) // Don't let the renderer interpolate between the actor's // old position and its new position. Interpolate (); - tracer->PrevX = tracer->x; - tracer->PrevY = tracer->y; - tracer->PrevZ = tracer->z; + tracer->PrevX = tracer->X(); + tracer->PrevY = tracer->Y(); + tracer->PrevZ = tracer->Z(); tracer->PrevAngle = tracer->angle; } @@ -667,15 +668,15 @@ bool AMovingCamera::Interpolate () if (Super::Interpolate ()) { - angle = R_PointToAngle2 (x, y, tracer->x, tracer->y); + angle = AngleTo(tracer, true); if (args[2] & 4) { // Also aim camera's pitch; use floats for precision - float dx = FIXED2FLOAT(x - tracer->x); - float dy = FIXED2FLOAT(y - tracer->y); - float dz = FIXED2FLOAT(z - tracer->z - tracer->height/2); - float dist = (float)sqrt (dx*dx + dy*dy); - float ang = dist != 0.f ? (float)atan2 (dz, dist) : 0; + double dx = FIXED2DBL(X() - tracer->X()); + double dy = FIXED2DBL(Y() - tracer->Y()); + double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2); + double dist = sqrt (dx*dx + dy*dy); + double ang = dist != 0.f ? atan2 (dz, dist) : 0; pitch = (angle_t)(ang * 2147483648.f / PI); } diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index eb2831024..9fe31db22 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -331,7 +331,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialDoomThing) { self->SetState (self->SpawnState); S_Sound (self, CHAN_VOICE, "misc/spawn", 1, ATTN_IDLE); - Spawn ("ItemFog", self->x, self->y, self->z, ALLOW_REPLACE); + Spawn ("ItemFog", self->Pos(), ALLOW_REPLACE); } } @@ -351,19 +351,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition) _y = self->SpawnPoint[1]; self->UnlinkFromWorld(); - self->x = _x; - self->y = _y; + self->SetXY(_x, _y); self->LinkToWorld(true); sec = self->Sector; - self->z = self->dropoffz = self->floorz = sec->floorplane.ZatPoint(_x, _y); self->ceilingz = sec->ceilingplane.ZatPoint(_x, _y); + self->SetZ(self->floorz); P_FindFloorCeiling(self, FFCF_ONLYSPAWNPOS); if (self->flags & MF_SPAWNCEILING) { - self->z = self->ceilingz - self->height - self->SpawnPoint[2]; + self->SetZ(self->ceilingz - self->height - self->SpawnPoint[2]); } else if (self->flags2 & MF2_SPAWNFLOAT) { @@ -371,33 +370,33 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition) if (space > 48*FRACUNIT) { space -= 40*FRACUNIT; - self->z = ((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT; + self->SetZ(((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT); } else { - self->z = self->floorz; + self->SetZ(self->floorz); } } else { - self->z = self->SpawnPoint[2] + self->floorz; + self->SetZ(self->SpawnPoint[2] + self->floorz); } // Redo floor/ceiling check, in case of 3D floors P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); - if (self->z < self->floorz) + if (self->Z() < self->floorz) { // Do not reappear under the floor, even if that's where we were for the // initial spawn. - self->z = self->floorz; + self->SetZ(self->floorz); } - if ((self->flags & MF_SOLID) && (self->z + self->height > self->ceilingz)) + if ((self->flags & MF_SOLID) && (self->Top() > self->ceilingz)) { // Do the same for the ceiling. - self->z = self->ceilingz - self->height; + self->SetZ(self->ceilingz - self->height); } // Do not interpolate from the position the actor was at when it was // picked up, in case that is different from where it is now. - self->PrevX = self->x; - self->PrevY = self->y; - self->PrevZ = self->z; + self->PrevX = self->X(); + self->PrevY = self->Y(); + self->PrevZ = self->Z(); } int AInventory::StaticLastMessageTic; @@ -728,8 +727,7 @@ AInventory *AInventory::CreateTossable () flags &= ~(MF_SPECIAL|MF_SOLID); return this; } - copy = static_cast(Spawn (GetClass(), Owner->x, - Owner->y, Owner->z, NO_REPLACE)); + copy = static_cast(Spawn (GetClass(), Owner->Pos(), NO_REPLACE)); if (copy != NULL) { copy->MaxAmount = MaxAmount; @@ -994,7 +992,7 @@ void AInventory::Touch (AActor *toucher) // This is the only situation when a pickup flash should ever play. if (PickupFlash != NULL && !ShouldStay()) { - Spawn(PickupFlash, x, y, z, ALLOW_REPLACE); + Spawn(PickupFlash, Pos(), ALLOW_REPLACE); } if (!(ItemFlags & IF_QUIET)) @@ -1290,8 +1288,8 @@ bool AInventory::DoRespawn () if (state != NULL) spot = state->GetRandomSpot(SpawnPointClass); if (spot != NULL) { - SetOrigin (spot->x, spot->y, spot->z); - z = floorz; + SetOrigin (spot->Pos(), false); + SetZ(floorz); } } return true; diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index 195f3ccbf..94a375d3e 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -131,7 +131,7 @@ void DEarthquake::Tick () dist = m_Spot->AproxDistance (victim, true); // Check if in damage radius - if (dist < m_DamageRadius && victim->z <= victim->floorz) + if (dist < m_DamageRadius && victim->Z() <= victim->floorz) { if (pr_quake() < 50) { diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 7d000f3d4..2ba445b7b 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -91,7 +91,7 @@ class ARandomSpawner : public AActor // So now we can spawn the dropped item. if (di == NULL || bouncecount >= MAX_RANDOMSPAWNERS_RECURSION) // Prevents infinite recursions { - Spawn("Unknown", x, y, z, NO_REPLACE); // Show that there's a problem. + Spawn("Unknown", Pos(), NO_REPLACE); // Show that there's a problem. Destroy(); return; } @@ -144,9 +144,9 @@ class ARandomSpawner : public AActor if (this->flags & MF_MISSILE && target && target->target) // Attempting to spawn a missile. { if ((tracer == NULL) && (flags2 & MF2_SEEKERMISSILE)) tracer = target->target; - newmobj = P_SpawnMissileXYZ(x, y, z, target, target->target, cls, false); + newmobj = P_SpawnMissileXYZ(Pos(), target, target->target, cls, false); } - else newmobj = Spawn(cls, x, y, z, NO_REPLACE); + else newmobj = Spawn(cls, Pos(), NO_REPLACE); if (newmobj != NULL) { // copy everything relevant @@ -179,7 +179,7 @@ class ARandomSpawner : public AActor // Handle special altitude flags if (newmobj->flags & MF_SPAWNCEILING) { - newmobj->z = newmobj->ceilingz - newmobj->height - SpawnPoint[2]; + newmobj->SetZ(newmobj->ceilingz - newmobj->height - SpawnPoint[2]); } else if (newmobj->flags2 & MF2_SPAWNFLOAT) { @@ -187,9 +187,9 @@ class ARandomSpawner : public AActor if (space > 48*FRACUNIT) { space -= 40*FRACUNIT; - newmobj->z = MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT; + newmobj->SetZ(MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT); } - newmobj->z += SpawnPoint[2]; + newmobj->AddZ(SpawnPoint[2]); } if (newmobj->flags & MF_MISSILE) P_CheckMissileSpawn(newmobj, 0); diff --git a/src/g_shared/a_spark.cpp b/src/g_shared/a_spark.cpp index 18b27d9ff..eee842f36 100644 --- a/src/g_shared/a_spark.cpp +++ b/src/g_shared/a_spark.cpp @@ -50,6 +50,6 @@ IMPLEMENT_CLASS (ASpark) void ASpark::Activate (AActor *activator) { Super::Activate (activator); - P_DrawSplash (args[0] ? args[0] : 32, x, y, z, angle, 1); + P_DrawSplash (args[0] ? args[0] : 32, X(), Y(), Z(), angle, 1); S_Sound (this, CHAN_AUTO, "world/spark", 1, ATTN_STATIC); } diff --git a/src/g_shared/a_specialspot.cpp b/src/g_shared/a_specialspot.cpp index d3994ed84..1d2747ceb 100644 --- a/src/g_shared/a_specialspot.cpp +++ b/src/g_shared/a_specialspot.cpp @@ -423,12 +423,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnSingleItem) return; } - AActor *spawned = Spawn(cls, self->x, self->y, self->z, ALLOW_REPLACE); + AActor *spawned = Spawn(cls, self->Pos(), ALLOW_REPLACE); if (spawned) { - spawned->SetOrigin (spot->x, spot->y, spot->z); - spawned->z = spawned->floorz; + spawned->SetOrigin (spot->Pos(), false); + spawned->SetZ(spawned->floorz); // We want this to respawn. if (!(self->flags & MF_DROPPED)) { diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index b351212d0..bd2946f2a 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1287,8 +1287,7 @@ void DBaseStatusBar::Draw (EHudState state) } fixedvec3 pos = CPlayer->mo->Pos(); - value = &pos.z; - for (i = 2, value = &CPlayer->mo->z; i >= 0; y -= height, --value, --i) + for (i = 2, value = &pos.z; i >= 0; y -= height, --value, --i) { mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS); screen->DrawText (SmallFont, CR_GREEN, xpos, y, line,