diff --git a/src/actor.h b/src/actor.h index b371fdaee..52b746ef8 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1252,6 +1252,15 @@ public: fixedvec3 ret = { X(), Y(), Z() }; return ret; } + fixedvec3 InterpolatedPosition(fixed_t ticFrac) const + { + fixedvec3 ret; + + ret.x = PrevX + FixedMul (ticFrac, X() - PrevX); + ret.y = PrevY + FixedMul (ticFrac, Y() - PrevY); + ret.z = PrevZ + FixedMul (ticFrac, Z() - PrevZ); + return ret; + } fixedvec3 PosPlusZ(fixed_t zadd) const { fixedvec3 ret = { X(), Y(), Z() + zadd }; diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index b2f1184ea..0fe8a4588 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -826,9 +826,9 @@ static void DrawCoordinates(player_t * CPlayer) if (!map_point_coordinates || !automapactive) { - x=CPlayer->mo->x; - y=CPlayer->mo->y; - z=CPlayer->mo->z; + x=CPlayer->mo->X(); + y=CPlayer->mo->Y(); + z=CPlayer->mo->Z(); } else { diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index b74350633..b351212d0 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1286,7 +1286,8 @@ void DBaseStatusBar::Draw (EHudState state) y -= height * 2; } - value = &CPlayer->mo->z; + fixedvec3 pos = CPlayer->mo->Pos(); + value = &pos.z; for (i = 2, value = &CPlayer->mo->z; i >= 0; y -= height, --value, --i) { mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS); diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 2b9f499e9..c6339f33d 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -22,7 +22,7 @@ AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target); DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall) { - AActor *foo = Spawn("AlienChunkSmall", self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE); + AActor *foo = Spawn("AlienChunkSmall", self->PosPlusZ(10*FRACUNIT), ALLOW_REPLACE); if (foo != NULL) { @@ -40,7 +40,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall) DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge) { - AActor *foo = Spawn("AlienChunkLarge", self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE); + AActor *foo = Spawn("AlienChunkLarge", self->PosPlusZ(10*FRACUNIT), ALLOW_REPLACE); if (foo != NULL) { @@ -62,7 +62,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack) if (self->target == NULL) return; - AActor *foo = Spawn("SpectralLightningV2", self->x, self->y, self->z + 32*FRACUNIT, ALLOW_REPLACE); + AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE); foo->velz = -12*FRACUNIT; foo->target = self; diff --git a/src/g_strife/a_coin.cpp b/src/g_strife/a_coin.cpp index dd3610039..36b531001 100644 --- a/src/g_strife/a_coin.cpp +++ b/src/g_strife/a_coin.cpp @@ -80,22 +80,22 @@ AInventory *ACoin::CreateTossable () if (Amount >= 50) { Amount -= 50; - tossed = static_cast(Spawn("Gold50", Owner->x, Owner->y, Owner->z, NO_REPLACE)); + tossed = static_cast(Spawn("Gold50", Owner->Pos(), NO_REPLACE)); } else if (Amount >= 25) { Amount -= 25; - tossed = static_cast(Spawn("Gold25", Owner->x, Owner->y, Owner->z, NO_REPLACE)); + tossed = static_cast(Spawn("Gold25", Owner->Pos(), NO_REPLACE)); } else if (Amount >= 10) { Amount -= 10; - tossed = static_cast(Spawn("Gold10", Owner->x, Owner->y, Owner->z, NO_REPLACE)); + tossed = static_cast(Spawn("Gold10", Owner->Pos(), NO_REPLACE)); } else if (Amount > 1 || (ItemFlags & IF_KEEPDEPLETED)) { Amount -= 1; - tossed = static_cast(Spawn("Coin", Owner->x, Owner->y, Owner->z, NO_REPLACE)); + tossed = static_cast(Spawn("Coin", Owner->Pos(), NO_REPLACE)); } else // Amount == 1 && !(ItemFlags & IF_KEEPDEPLETED) { diff --git a/src/g_strife/a_crusader.cpp b/src/g_strife/a_crusader.cpp index cf5f03a23..8655e10bc 100644 --- a/src/g_strife/a_crusader.cpp +++ b/src/g_strife/a_crusader.cpp @@ -27,18 +27,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose) { A_FaceTarget (self); self->angle -= ANGLE_180/16; - P_SpawnMissileZAimed (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile")); + P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile")); } else { if (P_CheckMissileRange (self)) { A_FaceTarget (self); - P_SpawnMissileZAimed (self, self->z + 56*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile")); + P_SpawnMissileZAimed (self, self->Z() + 56*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile")); self->angle -= ANGLE_45/32; - P_SpawnMissileZAimed (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile")); + P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile")); self->angle += ANGLE_45/16; - P_SpawnMissileZAimed (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile")); + P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindClass("CrusaderMissile")); self->angle -= ANGLE_45/16; self->reactiontime += 15; } @@ -49,7 +49,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose) DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft) { self->angle += ANGLE_90/16; - AActor *misl = P_SpawnMissileZAimed (self, self->z + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile")); + AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile")); if (misl != NULL) { misl->velz += FRACUNIT; @@ -59,7 +59,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft) DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight) { self->angle -= ANGLE_90/16; - AActor *misl = P_SpawnMissileZAimed (self, self->z + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile")); + AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile")); if (misl != NULL) { misl->velz += FRACUNIT; diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index fafb3b862..04b586b67 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -24,7 +24,7 @@ void A_SpectralMissile (AActor *self, const char *missilename) { if (self->target != NULL) { - AActor *missile = P_SpawnMissileXYZ (self->x, self->y, self->z + 32*FRACUNIT, + AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT), self, self->target, PClass::FindClass(missilename), false); if (missile != NULL) { @@ -70,7 +70,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack) DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity) { - AActor *entity = Spawn("EntityBoss", self->x, self->y, self->z + 70*FRACUNIT, ALLOW_REPLACE); + AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70*FRACUNIT), ALLOW_REPLACE); if (entity != NULL) { entity->angle = self->angle; @@ -89,13 +89,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath) AActor *spot = self->tracer; if (spot == NULL) spot = self; - fixed_t SpawnX = spot->x; - fixed_t SpawnY = spot->y; - fixed_t SpawnZ = spot->z + (self->tracer? 70*FRACUNIT : 0); + fixedvec3 pos = spot->Vec3Angle(secondRadius, self->angle, self->tracer? 70*FRACUNIT : 0); an = self->angle >> ANGLETOFINESHIFT; - second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]), - SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE); + second = Spawn("EntitySecond", pos, ALLOW_REPLACE); second->CopyFriendliness(self, true); //second->target = self->target; A_FaceTarget (second); @@ -103,18 +100,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath) second->velx += FixedMul (finecosine[an], 320000); second->vely += FixedMul (finesine[an], 320000); + pos = spot->Vec3Angle(secondRadius, self->angle + ANGLE_90, self->tracer? 70*FRACUNIT : 0); an = (self->angle + ANGLE_90) >> ANGLETOFINESHIFT; - second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]), - SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE); + second = Spawn("EntitySecond", pos, ALLOW_REPLACE); second->CopyFriendliness(self, true); //second->target = self->target; second->velx = FixedMul (secondRadius, finecosine[an]) << 2; second->vely = FixedMul (secondRadius, finesine[an]) << 2; A_FaceTarget (second); + pos = spot->Vec3Angle(secondRadius, self->angle - ANGLE_90, self->tracer? 70*FRACUNIT : 0); an = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT; - second = Spawn("EntitySecond", SpawnX + FixedMul (secondRadius, finecosine[an]), - SpawnY + FixedMul (secondRadius, finesine[an]), SpawnZ, ALLOW_REPLACE); + second = Spawn("EntitySecond", pos, ALLOW_REPLACE); second->CopyFriendliness(self, true); //second->target = self->target; second->velx = FixedMul (secondRadius, finecosine[an]) << 2; diff --git a/src/g_strife/a_inquisitor.cpp b/src/g_strife/a_inquisitor.cpp index 1a0739d36..b93933422 100644 --- a/src/g_strife/a_inquisitor.cpp +++ b/src/g_strife/a_inquisitor.cpp @@ -35,9 +35,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide) { self->SetState (self->FindState("Grenade")); } - if (self->target->z != self->z) + if (self->target->Z() != self->Z()) { - if (self->z + self->height + 54*FRACUNIT < self->ceilingz) + if (self->Top() + 54*FRACUNIT < self->ceilingz) { self->SetState (self->FindState("Jump")); } @@ -53,20 +53,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack) A_FaceTarget (self); - self->z += 32*FRACUNIT; + self->AddZ(32*FRACUNIT); self->angle -= ANGLE_45/32; - proj = P_SpawnMissileZAimed (self, self->z, self->target, PClass::FindClass("InquisitorShot")); + proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindClass("InquisitorShot")); if (proj != NULL) { proj->velz += 9*FRACUNIT; } self->angle += ANGLE_45/16; - proj = P_SpawnMissileZAimed (self, self->z, self->target, PClass::FindClass("InquisitorShot")); + proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindClass("InquisitorShot")); if (proj != NULL) { proj->velz += 16*FRACUNIT; } - self->z -= 32*FRACUNIT; + self->AddZ(-32*FRACUNIT); } DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump) @@ -79,7 +79,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump) return; S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM); - self->z += 64*FRACUNIT; + self->AddZ(64*FRACUNIT); A_FaceTarget (self); an = self->angle >> ANGLETOFINESHIFT; speed = self->Speed * 2/3; @@ -91,7 +91,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump) { dist = 1; } - self->velz = (self->target->z - self->z) / dist; + self->velz = (self->target->Z() - self->Z()) / dist; self->reactiontime = 60; self->flags |= MF_NOGRAVITY; } @@ -102,7 +102,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand) if (self->reactiontime < 0 || self->velx == 0 || self->vely == 0 || - self->z <= self->floorz) + self->Z() <= self->floorz) { self->SetState (self->SeeState); self->reactiontime = 0; @@ -119,7 +119,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand) DEFINE_ACTION_FUNCTION(AActor, A_TossArm) { - AActor *foo = Spawn("InquisitorArm", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE); + AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); foo->angle = self->angle - ANGLE_90 + (pr_inq.Random2() << 22); foo->velx = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]) >> 3; foo->vely = FixedMul (foo->Speed, finesine[foo->angle >> ANGLETOFINESHIFT]) >> 3; diff --git a/src/g_strife/a_loremaster.cpp b/src/g_strife/a_loremaster.cpp index d984bbdd3..1b12c2436 100644 --- a/src/g_strife/a_loremaster.cpp +++ b/src/g_strife/a_loremaster.cpp @@ -21,16 +21,14 @@ IMPLEMENT_CLASS (ALoreShot) int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype) { - FVector3 thrust; if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST)) { - thrust.X = float(target->x - victim->x); - thrust.Y = float(target->y - victim->y); - thrust.Z = float(target->z - victim->z); - + fixedvec3 fixthrust = victim->Vec3To(target); + TVector3 thrust(fixthrust.x, fixthrust.y, fixthrust.z); + thrust.MakeUnit(); - thrust *= float((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1)); + thrust *= double((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1)); victim->velx += fixed_t(thrust.X); victim->vely += fixed_t(thrust.Y); @@ -42,7 +40,7 @@ int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype) DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain) { S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM); - Spawn("LoreShot2", self->x, self->y, self->z, ALLOW_REPLACE); - Spawn("LoreShot2", self->x - (self->velx >> 1), self->y - (self->vely >> 1), self->z - (self->velz >> 1), ALLOW_REPLACE); - Spawn("LoreShot2", self->x - self->velx, self->y - self->vely, self->z - self->velz, ALLOW_REPLACE); + Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE); + Spawn("LoreShot2", self->Vec3Offset(-(self->velx >> 1), -(self->vely >> 1), -(self->velz >> 1)), ALLOW_REPLACE); + Spawn("LoreShot2", self->Vec3Offset(-self->velx, -self->vely, -self->velz), ALLOW_REPLACE); } diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index 78689468b..5835b3566 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -104,7 +104,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning) if (self->target == NULL) return; - spot = Spawn("SpectralLightningSpot", self->target->x, self->target->y, self->target->floorz, ALLOW_REPLACE); + spot = Spawn("SpectralLightningSpot", self->target->X(), self->target->Y(), self->target->floorz, ALLOW_REPLACE); if (spot != NULL) { spot->threshold = 25; @@ -122,7 +122,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning) DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase) { - AActor *foo = Spawn("ProgrammerBase", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE); + AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); if (foo != NULL) { foo->angle = self->angle + ANGLE_180 + (pr_prog.Random2() << 22); diff --git a/src/g_strife/a_rebels.cpp b/src/g_strife/a_rebels.cpp index 81490c361..6c8652f7c 100644 --- a/src/g_strife/a_rebels.cpp +++ b/src/g_strife/a_rebels.cpp @@ -75,8 +75,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon) AActor *rebel; angle_t an; - rebel = Spawn("Rebel1", self->x, self->y, self->floorz, ALLOW_REPLACE); - if (!P_TryMove (rebel, rebel->x, rebel->y, true)) + rebel = Spawn("Rebel1", self->X(), self->Y(), self->floorz, ALLOW_REPLACE); + if (!P_TryMove (rebel, rebel->X(), rebel->Y(), true)) { rebel->Destroy (); return; @@ -112,7 +112,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon) rebel->SetState (rebel->SeeState); rebel->angle = self->angle; an = self->angle >> ANGLETOFINESHIFT; - Spawn (rebel->x + 20*finecosine[an], rebel->y + 20*finesine[an], rebel->z + TELEFOGHEIGHT, ALLOW_REPLACE); + Spawn (rebel->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE); if (--self->health < 0) { self->SetState(self->FindState(NAME_Death)); diff --git a/src/g_strife/a_sentinel.cpp b/src/g_strife/a_sentinel.cpp index 74f0e917f..550a89ff7 100644 --- a/src/g_strife/a_sentinel.cpp +++ b/src/g_strife/a_sentinel.cpp @@ -27,7 +27,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob) { minz = maxz; } - if (minz < self->z) + if (minz < self->Z()) { self->velz -= FRACUNIT; } @@ -35,7 +35,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob) { self->velz += FRACUNIT; } - self->reactiontime = (minz >= self->z) ? 4 : 0; + self->reactiontime = (minz >= self->Z()) ? 4 : 0; } DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack) @@ -48,16 +48,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack) return; } - missile = P_SpawnMissileZAimed (self, self->z + 32*FRACUNIT, self->target, PClass::FindClass("SentinelFX2")); + missile = P_SpawnMissileZAimed (self, self->Z() + 32*FRACUNIT, self->target, PClass::FindClass("SentinelFX2")); if (missile != NULL && (missile->velx | missile->vely) != 0) { for (int i = 8; i > 1; --i) { trail = Spawn("SentinelFX1", - self->x + FixedMul (missile->radius * i, finecosine[missile->angle >> ANGLETOFINESHIFT]), - self->y + FixedMul (missile->radius * i, finesine[missile->angle >> ANGLETOFINESHIFT]), - missile->z + (missile->velz / 4 * i), ALLOW_REPLACE); + self->Vec3Angle(missile->radius*i, missile->angle, (missile->velz / 4 * i)), ALLOW_REPLACE); if (trail != NULL) { trail->target = self; @@ -67,7 +65,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack) P_CheckMissileSpawn (trail, self->radius); } } - missile->z += missile->velz >> 2; + missile->AddZ(missile->velz >> 2); } } diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp index 6f80fe42c..91e43dba9 100644 --- a/src/g_strife/a_spectral.cpp +++ b/src/g_strife/a_spectral.cpp @@ -28,7 +28,7 @@ void ASpectralMonster::Touch (AActor *toucher) DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail) { - AActor *foo = Spawn("SpectralLightningHTail", self->x - self->velx, self->y - self->vely, self->z, ALLOW_REPLACE); + AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->velx, -self->vely, 0), ALLOW_REPLACE); foo->angle = self->angle; foo->FriendPlayer = self->FriendPlayer; @@ -61,17 +61,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning) self->velx += pr_zap5.Random2(3) << FRACBITS; self->vely += pr_zap5.Random2(3) << FRACBITS; - x = self->x + pr_zap5.Random2(3) * FRACUNIT * 50; - y = self->y + pr_zap5.Random2(3) * FRACUNIT * 50; + fixedvec2 pos = self->Vec2Offset( + pr_zap5.Random2(3) * FRACUNIT * 50, + pr_zap5.Random2(3) * FRACUNIT * 50); flash = Spawn (self->threshold > 25 ? PClass::FindClass(NAME_SpectralLightningV2) : - PClass::FindClass(NAME_SpectralLightningV1), x, y, ONCEILINGZ, ALLOW_REPLACE); + PClass::FindClass(NAME_SpectralLightningV1), pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE); flash->target = self->target; flash->velz = -18*FRACUNIT; flash->FriendPlayer = self->FriendPlayer; - flash = Spawn(NAME_SpectralLightningV2, self->x, self->y, ONCEILINGZ, ALLOW_REPLACE); + flash = Spawn(NAME_SpectralLightningV2, self->X(), self->Y(), ONCEILINGZ, ALLOW_REPLACE); flash->target = self->target; flash->velz = -18*FRACUNIT; @@ -128,11 +129,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2) } if (dest->height >= 56*FRACUNIT) { - slope = (dest->z+40*FRACUNIT - self->z) / dist; + slope = (dest->Z()+40*FRACUNIT - self->Z()) / dist; } else { - slope = (dest->z + self->height*2/3 - self->z) / dist; + slope = (dest->Z() + self->height*2/3 - self->Z()) / dist; } if (slope < self->velz) { diff --git a/src/g_strife/a_stalker.cpp b/src/g_strife/a_stalker.cpp index 258cbef3f..6a06bf867 100644 --- a/src/g_strife/a_stalker.cpp +++ b/src/g_strife/a_stalker.cpp @@ -17,7 +17,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_StalkerChaseDecide) { self->SetState (self->FindState("SeeFloor")); } - else if (self->ceilingz - self->height > self->z) + else if (self->ceilingz > self->Top()) { self->SetState (self->FindState("Drop")); } diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 9f3ebb272..3145290ef 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -580,7 +580,7 @@ IMPLEMENT_CLASS (AMeat) DEFINE_ACTION_FUNCTION(AActor, A_TossGib) { const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat"; - AActor *gib = Spawn (gibtype, self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE); + AActor *gib = Spawn (gibtype, self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); angle_t an; int speed; @@ -628,7 +628,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain) { sector_t *sec = self->Sector; - if (self->z == sec->floorplane.ZatPoint(self)) + if (self->Z() == sec->floorplane.ZatPoint(self)) { if (sec->special == Damage_InstantDeath) { @@ -681,7 +681,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ItBurnsItBurns) DEFINE_ACTION_FUNCTION(AActor, A_DropFire) { - AActor *drop = Spawn("FireDroplet", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE); + AActor *drop = Spawn("FireDroplet", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); drop->velz = -FRACUNIT; P_RadiusAttack (self, self, 64, 64, NAME_Fire, 0); } diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index f5d4a3576..a33521087 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -360,8 +360,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight) AActor *trail; S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM); - P_SpawnPuff (self, PClass::FindClass("MiniMissilePuff"), self->x, self->y, self->z, self->angle - ANGLE_180, 2, PF_HITTHING); - trail = Spawn("RocketTrail", self->x - self->velx, self->y - self->vely, self->z, ALLOW_REPLACE); + P_SpawnPuff (self, PClass::FindClass("MiniMissilePuff"), self->Pos(), self->angle - ANGLE_180, 2, PF_HITTHING); + trail = Spawn("RocketTrail", self->Vec3Offset(-self->velx, -self->vely, 0), ALLOW_REPLACE); if (trail != NULL) { trail->velz = FRACUNIT; @@ -516,10 +516,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) self->angle += ANGLE_180; // If the torpedo hit the ceiling, it should still spawn the wave - savedz = self->z; - if (wavedef && self->ceilingz - self->z < wavedef->height) + savedz = self->Z(); + if (wavedef && self->ceilingz - self->Z() < wavedef->height) { - self->z = self->ceilingz - wavedef->height; + self->SetZ(self->ceilingz - wavedef->height); } for (int i = 0; i < 80; ++i) @@ -527,12 +527,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave) self->angle += ANGLE_45/10; P_SpawnSubMissile (self, PClass::FindClass("MaulerTorpedoWave"), self->target); } - self->z = savedz; + self->SetZ(savedz); } AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target) { - AActor *other = Spawn (type, source->x, source->y, source->z, ALLOW_REPLACE); + AActor *other = Spawn (type, source->Pos(), ALLOW_REPLACE); if (other == NULL) { @@ -619,20 +619,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination) yofs = -yofs; } - fixed_t x = self->x + (xofs << FRACBITS); - fixed_t y = self->y + (yofs << FRACBITS); - sector_t * sector = P_PointInSector(x, y); + fixedvec2 pos = self->Vec2Offset(xofs << FRACBITS, yofs << FRACBITS); + sector_t * sector = P_PointInSector(pos.x, pos.y); // The sector's floor is too high so spawn the flame elsewhere. - if (sector->floorplane.ZatPoint(x, y) > self->z + self->MaxStepHeight) + if (sector->floorplane.ZatPoint(pos.x, pos.y) > self->Z() + self->MaxStepHeight) { - x = self->x; - y = self->y; + pos.x = self->X(); + pos.y = self->Y(); } AActor *drop = Spawn ( - x, y, - self->z + 4*FRACUNIT, ALLOW_REPLACE); + pos.x, pos.y, + self->Z() + 4*FRACUNIT, ALLOW_REPLACE); if (drop != NULL) { drop->velx = self->velx + ((pr_phburn.Random2 (7)) << FRACBITS); @@ -677,9 +676,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade) if (grenadetype != NULL) { - self->z += 32*FRACUNIT; + self->AddZ(32*FRACUNIT); grenade = P_SpawnSubMissile (self, grenadetype, self); - self->z -= 32*FRACUNIT; + self->AddZ(-32*FRACUNIT); if (grenade == NULL) return; @@ -690,15 +689,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade) grenade->velz = FixedMul (finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], grenade->Speed) + 8*FRACUNIT; + fixedvec2 offset; + an = self->angle >> ANGLETOFINESHIFT; tworadii = self->radius + grenade->radius; - grenade->x += FixedMul (finecosine[an], tworadii); - grenade->y += FixedMul (finesine[an], tworadii); + offset.x = FixedMul (finecosine[an], tworadii); + offset.y = FixedMul (finesine[an], tworadii); an = self->angle + Angle; an >>= ANGLETOFINESHIFT; - grenade->x += FixedMul (finecosine[an], 15*FRACUNIT); - grenade->y += FixedMul (finesine[an], 15*FRACUNIT); + offset.x += FixedMul (finecosine[an], 15*FRACUNIT); + offset.y += FixedMul (finesine[an], 15*FRACUNIT); + + fixedvec2 newpos = grenade->Vec2Offset(offset.x, offset.y); + grenade->SetOrigin(newpos.x, newpos.y, grenade->Z(), false); } } @@ -923,7 +927,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) P_BulletSlope (self, &linetarget); if (linetarget != NULL) { - spot = Spawn("SpectralLightningSpot", linetarget->x, linetarget->y, linetarget->floorz, ALLOW_REPLACE); + spot = Spawn("SpectralLightningSpot", linetarget->X(), linetarget->Y(), linetarget->floorz, ALLOW_REPLACE); if (spot != NULL) { spot->tracer = linetarget; @@ -931,7 +935,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) } else { - spot = Spawn("SpectralLightningSpot", self->x, self->y, self->z, ALLOW_REPLACE); + spot = Spawn("SpectralLightningSpot", self->Pos(), ALLOW_REPLACE); if (spot != NULL) { spot->velx += 28 * finecosine[self->angle >> ANGLETOFINESHIFT]; @@ -989,7 +993,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3) spot = P_SpawnSubMissile (self, PClass::FindClass("SpectralLightningBall1"), self); if (spot != NULL) { - spot->z = self->z + 32*FRACUNIT; + spot->SetZ(self->Z() + 32*FRACUNIT); } } self->angle -= (ANGLE_180/20)*10; diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index d27260451..86ae7282e 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -20,10 +20,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud) { fixed_t spawnx, spawny; - spawnx = self->x + (pr_bang4cloud.Random2() & 3) * 10240; - spawny = self->y + (pr_bang4cloud.Random2() & 3) * 10240; + fixedvec3 pos = self->Vec3Offset((pr_bang4cloud.Random2() & 3) * 10240, (pr_bang4cloud.Random2() & 3) * 10240, 0); - Spawn("Bang4Cloud", spawnx, spawny, self->z, ALLOW_REPLACE); + Spawn("Bang4Cloud", pos, ALLOW_REPLACE); } // ------------------------------------------------------------------- @@ -97,7 +96,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut) for (int i = 0; i < 8; ++i) { - foo = Spawn("Rubble1", self->x, self->y, self->z, ALLOW_REPLACE); + foo = Spawn("Rubble1", self->Pos(), ALLOW_REPLACE); if (foo != NULL) { int t = pr_lightout() & 15; diff --git a/src/p_writemap.cpp b/src/p_writemap.cpp index e31d2c4c3..8f1a4edfa 100644 --- a/src/p_writemap.cpp +++ b/src/p_writemap.cpp @@ -98,8 +98,8 @@ static int WriteTHINGS (FILE *file) mapthinghexen_t mt = { 0, 0, 0, 0, 0, 0, 0, 0, {0} }; AActor *mo = players[consoleplayer].mo; - mt.x = LittleShort(short(mo->x >> FRACBITS)); - mt.y = LittleShort(short(mo->y >> FRACBITS)); + mt.x = LittleShort(short(mo->X() >> FRACBITS)); + mt.y = LittleShort(short(mo->Y() >> FRACBITS)); mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360))); mt.type = LittleShort((short)1); mt.flags = LittleShort((short)(7|224|MTF_SINGLE)); diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 96a77930a..84967c164 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -1224,9 +1224,10 @@ void R_DrawSkyBoxes () extralight = 0; R_SetVisibility (sky->args[0] * 0.25f); - viewx = sky->PrevX + FixedMul(r_TicFrac, sky->x - sky->PrevX); - viewy = sky->PrevY + FixedMul(r_TicFrac, sky->y - sky->PrevY); - viewz = sky->PrevZ + FixedMul(r_TicFrac, sky->z - sky->PrevZ); + fixedvec3 viewpos = sky->InterpolatedPosition(r_TicFrac); + viewx = viewpos.x; + viewy = viewpos.y; + viewz = viewpos.z; viewangle = savedangle + sky->PrevAngle + FixedMul(r_TicFrac, sky->angle - sky->PrevAngle); R_CopyStackedViewParameters(); @@ -1235,8 +1236,8 @@ void R_DrawSkyBoxes () { extralight = pl->extralight; R_SetVisibility (pl->visibility); - viewx = pl->viewx - sky->Mate->x + sky->x; - viewy = pl->viewy - sky->Mate->y + sky->y; + viewx = pl->viewx - sky->Mate->X() + sky->X(); + viewy = pl->viewy - sky->Mate->Y() + sky->Y(); viewz = pl->viewz; viewangle = pl->viewangle; } diff --git a/src/r_things.cpp b/src/r_things.cpp index 8e53fb6d1..8ad5f76a9 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -670,9 +670,10 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor } // [RH] Interpolate the sprite's position to make it look smooth - fx = thing->PrevX + FixedMul (r_TicFrac, thing->x - thing->PrevX); - fy = thing->PrevY + FixedMul (r_TicFrac, thing->y - thing->PrevY); - fz = thing->PrevZ + FixedMul (r_TicFrac, thing->z - thing->PrevZ) + thing->GetBobOffset(r_TicFrac); + fixedvec3 pos = thing->InterpolatedPosition(r_TicFrac); + fx = pos.x; + fy = pos.y; + fz = pos.z +thing->GetBobOffset(r_TicFrac); tex = NULL; voxel = NULL; @@ -1145,12 +1146,12 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside) { if(!(rover->top.plane->a) && !(rover->top.plane->b)) { - if(rover->top.plane->Zat0() <= thing->z) fakefloor = rover; + if(rover->top.plane->Zat0() <= thing->Z()) fakefloor = rover; } } if(!(rover->bottom.plane->a) && !(rover->bottom.plane->b)) { - if(rover->bottom.plane->Zat0() >= thing->z + thing->height) fakeceiling = rover; + if(rover->bottom.plane->Zat0() >= thing->Top()) fakeceiling = rover; } } R_ProjectSprite (thing, fakeside, fakefloor, fakeceiling); diff --git a/src/r_utility.cpp b/src/r_utility.cpp index cfe1767c7..d4d3ec97b 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -587,8 +587,8 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi player - players == consoleplayer && camera == player->mo && !demoplayback && - iview->nviewx == camera->x && - iview->nviewy == camera->y && + iview->nviewx == camera->X() && + iview->nviewy == camera->Y() && !(player->cheats & (CF_TOTALLYFROZEN|CF_FROZEN)) && player->playerstate == PST_LIVE && player->mo->reactiontime == 0 && @@ -839,9 +839,9 @@ void R_SetupFrame (AActor *actor) } else { - iview->nviewx = camera->x; - iview->nviewy = camera->y; - iview->nviewz = camera->player ? camera->player->viewz : camera->z + camera->GetClass()->Meta.GetMetaFixed(AMETA_CameraHeight); + iview->nviewx = camera->X(); + iview->nviewy = camera->Y(); + iview->nviewz = camera->player ? camera->player->viewz : camera->Z() + camera->GetClass()->Meta.GetMetaFixed(AMETA_CameraHeight); viewsector = camera->Sector; r_showviewer = false; }