- conversion of floorz to double.

This commit is contained in:
Christoph Oelckers 2016-03-20 19:52:35 +01:00
parent b81080ce08
commit 8362c6a856
45 changed files with 275 additions and 262 deletions

View file

@ -1106,12 +1106,16 @@ public:
FBlockNode *BlockNode; // links in blocks (if needed)
struct sector_t *Sector;
subsector_t * subsector;
fixed_t floorz; double ceilingz; // closest together of contacted secs
double floorz, ceilingz; // closest together of contacted secs
inline fixed_t _f_ceilingz()
{
return FLOAT2FIXED(ceilingz);
}
inline fixed_t _f_floorz()
{
return FLOAT2FIXED(floorz);
}
fixed_t dropoffz; // killough 11/98: the lowest floor over all contacted Sectors.

View file

@ -270,16 +270,16 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
if (!(thing->flags & MF_NOCLIP) )
{
fixed_t maxstep = thing->MaxStepHeight;
if (tm._f_ceilingz() - tm.floorz < thing->height)
if (tm.ceilingz - tm.floorz < thing->_Height())
return false; // doesn't fit
if (!(thing->flags&MF_MISSILE))
{
if(tm.floorz > (thing->Sector->floorplane.ZatPoint (x, y)+MAXMOVEHEIGHT)) //Too high wall
if(tm._f_floorz() > (thing->Sector->floorplane.ZatPoint (x, y)+MAXMOVEHEIGHT)) //Too high wall
return false;
//Jumpable
if(tm.floorz>(thing->Sector->floorplane.ZatPoint (x, y)+thing->MaxStepHeight))
if(tm._f_floorz()>(thing->Sector->floorplane.ZatPoint (x, y)+thing->MaxStepHeight))
cmd->ucmd.buttons |= BT_JUMP;
@ -292,12 +292,12 @@ 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->_f_Z() > maxstep ) )
(tm._f_floorz() - thing->_f_Z() > maxstep ) )
return false; // too big a step up
if ( !(thing->flags&(MF_DROPOFF|MF_FLOAT))
&& tm.floorz - tm.dropoffz > thing->MaxDropOffHeight )
&& tm._f_floorz() - tm.dropoffz > thing->MaxDropOffHeight )
return false; // don't stand over a dropoff
}

View file

@ -1086,7 +1086,7 @@ CCMD(currentpos)
if(mo)
{
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw, FIXED2DBL(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel);
mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw, mo->floorz, mo->Sector->sectornum, mo->Sector->lightlevel);
}
else
{

View file

@ -45,7 +45,7 @@ void AChickenPlayer::MorphPlayerThink ()
{ // Twitch view angle
Angles.Yaw += pr_chickenplayerthink.Random2() * (360. / 256. / 32.);
}
if ((_f_Z() <= floorz) && (pr_chickenplayerthink() < 32))
if ((Z() <= floorz) && (pr_chickenplayerthink() < 32))
{ // Jump and noise
Vel.Z += JumpZ;

View file

@ -159,7 +159,7 @@ void P_DSparilTeleport (AActor *actor)
S_Sound (mo, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->SetState (actor->FindState("Teleport"));
S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->_f_SetZ(actor->floorz, false);
actor->SetZ(actor->floorz);
actor->Angles.Yaw = spot->Angles.Yaw;
actor->Vel.Zero();
}

View file

@ -196,7 +196,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
unsigned int i;
AActor *tiny;
if (self->_f_Z() <= self->floorz)
if (self->Z() <= self->floorz)
{
self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT;

View file

@ -528,7 +528,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
AActor *tiny;
if ((self->_f_Z() <= self->floorz) && P_HitFloor (self))
if ((self->Z() <= self->floorz) && P_HitFloor (self))
{ // Landed in some sort of liquid
self->Destroy ();
return 0;
@ -624,7 +624,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
bool newAngle;
FTranslatedLineTarget t;
if ((self->_f_Z() <= self->floorz) && P_HitFloor (self))
if ((self->Z() <= self->floorz) && P_HitFloor (self))
{ // Landed in some sort of liquid
self->Destroy ();
return 0;
@ -720,7 +720,7 @@ void ABlasterFX1::Effect ()
{
if (pr_bfx1t() < 64)
{
Spawn("BlasterSmoke", PosAtZ(MAX(Z() - 8., FIXED2DBL(floorz))), ALLOW_REPLACE);
Spawn("BlasterSmoke", PosAtZ(MAX(Z() - 8., floorz)), ALLOW_REPLACE);
}
}
@ -1095,7 +1095,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
DEFINE_ACTION_FUNCTION(AActor, A_RainImpact)
{
PARAM_ACTION_PROLOGUE;
if (self->_f_Z() > self->floorz)
if (self->Z() > self->floorz)
{
self->SetState (self->FindState("NotFloor"));
}

View file

@ -43,17 +43,15 @@ void ACFlameMissile::BeginPlay ()
void ACFlameMissile::Effect ()
{
fixed_t newz;
if (!--special1)
{
special1 = 4;
newz = _f_Z()-12*FRACUNIT;
double newz = Z()-12;
if (newz < floorz)
{
newz = floorz;
}
AActor *mo = Spawn ("CFlameFloor", _f_X(), _f_Y(), newz, ALLOW_REPLACE);
AActor *mo = Spawn ("CFlameFloor", PosAtZ(newz), ALLOW_REPLACE);
if (mo)
{
mo->Angles.Yaw = Angles.Yaw;

View file

@ -302,7 +302,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonCheckCrash)
{
PARAM_ACTION_PROLOGUE;
if (self->_f_Z() <= self->floorz)
if (self->Z() <= self->floorz)
{
self->SetState (self->FindState ("Crash"));
}

View file

@ -101,7 +101,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SmBounce)
PARAM_ACTION_PROLOGUE;
// give some more velocity (x,y,&z)
self->_f_SetZ(self->floorz + FRACUNIT);
self->SetZ(self->floorz + 1);
self->Vel.Z = 2. + pr_smbounce() / 64.;
self->Vel.X = pr_smbounce() % 3;
self->Vel.Y = pr_smbounce() % 3;
@ -148,9 +148,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
self->special1 = (weaveindex + 2) & 63;
// Ensure it stays above certain height
if (self->_f_Z() < self->floorz + (64*FRACUNIT))
if (self->Z() < self->floorz + 64)
{
self->_f_AddZ(2*FRACUNIT);
self->AddZ(2);
}
if(!self->target || !(self->target->flags&MF_SHOOTABLE))

View file

@ -457,7 +457,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2)
if (self->Vel.Z < 2 && self->Vel.LengthSquared() < (9./4.))
{
self->SetState (self->SpawnState + 6);
self->_f_SetZ(self->floorz);
self->SetZ(self->floorz);
self->Vel.Z = 0;
self->BounceFlags = BOUNCE_None;
self->flags &= ~MF_MISSILE;

View file

@ -141,7 +141,7 @@ IMPLEMENT_CLASS (AZCorpseLynchedNoHeart)
void AZCorpseLynchedNoHeart::PostBeginPlay ()
{
Super::PostBeginPlay ();
Spawn ("BloodPool", _f_X(), _f_Y(), floorz, ALLOW_REPLACE);
Spawn ("BloodPool", PosAtZ(floorz), ALLOW_REPLACE);
}
//============================================================================

View file

@ -156,7 +156,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
{
return 0;
}
self->_f_SetZ(self->floorz);
self->SetZ(self->floorz);
target = self->lastenemy->tracer;
}
else if (self->flags3 & MF3_CEILINGHUGGER)

View file

@ -99,7 +99,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PigPain)
PARAM_ACTION_PROLOGUE;
CALL_ACTION(A_Pain, self);
if (self->_f_Z() <= self->floorz)
if (self->Z() <= self->floorz)
{
self->Vel.Z = 3.5;
}

View file

@ -228,12 +228,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentSpawnGibs)
for (int i = countof(GibTypes)-1; i >= 0; --i)
{
fixedvec2 pos = self->Vec2Offset(
((pr_serpentgibs() - 128) << 12),
((pr_serpentgibs() - 128) << 12));
double x = (pr_serpentgibs() - 128) / 16.;
double y = (pr_serpentgibs() - 128) / 16.;
mo = Spawn (GibTypes[i], pos.x, pos.y,
self->floorz+FRACUNIT, ALLOW_REPLACE);
mo = Spawn (GibTypes[i], self->Vec2OffsetZ(x, y, self->floorz + 1), ALLOW_REPLACE);
if (mo)
{
mo->Vel.X = (pr_serpentgibs() - 128) / 1024.f;
@ -296,7 +294,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentHeadCheck)
{
PARAM_ACTION_PROLOGUE;
if (self->_f_Z() <= self->floorz)
if (self->Z() <= self->floorz)
{
if (Terrains[P_GetThingFloorType(self)].IsLiquid)
{

View file

@ -1242,7 +1242,7 @@ void G_FinishTravel ()
{
pawn->Angles = pawndup->Angles;
}
pawn->SetXYZ(pawndup->_f_X(), pawndup->_f_Y(), pawndup->_f_Z());
pawn->SetXYZ(pawndup->Pos());
pawn->Vel = pawndup->Vel;
pawn->Sector = pawndup->Sector;
pawn->floorz = pawndup->floorz;

View file

@ -212,7 +212,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
self->VelFromAngle(MNTR_CHARGE_SPEED);
self->special1 = TICRATE/2; // Charge duration
}
else if (target->_f_Z() == target->floorz
else if (target->Z() == target->floorz
&& dist < 9*64*FRACUNIT
&& pr_minotaurdecide() < (friendly ? 100 : 220))
{ // Floor fire attack
@ -389,11 +389,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
AActor *mo;
self->_f_SetZ(self->floorz);
fixedvec2 pos = self->Vec2Offset(
(pr_fire.Random2 () << 10),
(pr_fire.Random2 () << 10));
mo = Spawn("MinotaurFX3", pos.x, pos.y, self->floorz, ALLOW_REPLACE);
self->SetZ(self->floorz);
double x = pr_fire.Random2() / 64.;
double y = pr_fire.Random2() / 64.;
mo = Spawn("MinotaurFX3", self->Vec2OffsetZ(x, y, self->floorz), ALLOW_REPLACE);
mo->target = self->target;
mo->Vel.X = MinVel; // Force block checking
P_CheckMissileSpawn (mo, self->radius);

View file

@ -979,7 +979,7 @@ void APowerFlight::InitEffect ()
Super::InitEffect();
Owner->flags2 |= MF2_FLY;
Owner->flags |= MF_NOGRAVITY;
if (Owner->_f_Z() <= Owner->floorz)
if (Owner->Z() <= Owner->floorz)
{
Owner->Vel.Z = 4;; // thrust the player in the air a bit
}
@ -1026,7 +1026,7 @@ void APowerFlight::EndEffect ()
if (!(Owner->flags7 & MF7_FLYCHEAT))
{
if (Owner->_f_Z() != Owner->floorz)
if (Owner->Z() != Owner->floorz)
{
Owner->player->centering = true;
}

View file

@ -56,7 +56,7 @@ void AFastProjectile::Tick ()
}
// Handle movement
if (Vel.X != 0 || Vel.Y != 0 || (_f_Z() != floorz) || _f_velz())
if (!Vel.isZero() || (Z() != floorz))
{
xfrac = _f_velx() >> shift;
yfrac = _f_vely() >> shift;
@ -101,7 +101,7 @@ void AFastProjectile::Tick ()
_f_AddZ(zfrac);
UpdateWaterLevel (oldz);
oldz = _f_Z();
if (_f_Z() <= floorz)
if (Z() <= floorz)
{ // Hit the floor
if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
@ -112,7 +112,7 @@ void AFastProjectile::Tick ()
return;
}
_f_SetZ(floorz);
SetZ(floorz);
P_HitFloor (this);
P_ExplodeMissile (this, NULL, NULL);
return;
@ -156,28 +156,25 @@ void AFastProjectile::Tick ()
void AFastProjectile::Effect()
{
//if (pr_smoke() < 128) // [RH] I think it looks better if it's consistent
FName name = GetClass()->MissileName;
if (name != NAME_None)
{
FName name = GetClass()->MissileName;
if (name != NAME_None)
{
fixed_t hitz = _f_Z()-8*FRACUNIT;
double hitz = Z()-8;
if (hitz < floorz)
{
hitz = floorz;
}
// Do not clip this offset to the floor.
hitz += GetClass()->MissileHeight;
if (hitz < floorz)
{
hitz = floorz;
}
// Do not clip this offset to the floor.
hitz += GetClass()->MissileHeight;
PClassActor *trail = PClass::FindActor(name);
if (trail != NULL)
PClassActor *trail = PClass::FindActor(name);
if (trail != NULL)
{
AActor *act = Spawn (trail, PosAtZ(hitz), ALLOW_REPLACE);
if (act != NULL)
{
AActor *act = Spawn (trail, _f_X(), _f_Y(), hitz, ALLOW_REPLACE);
if (act != NULL)
{
act->Angles.Yaw = Angles.Yaw;
}
act->Angles.Yaw = Angles.Yaw;
}
}
}

View file

@ -430,27 +430,27 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
}
else if (self->flags2 & MF2_SPAWNFLOAT)
{
fixed_t space = self->_f_ceilingz() - self->height - self->floorz;
if (space > 48*FRACUNIT)
double space = self->ceilingz - self->_Height() - self->floorz;
if (space > 48)
{
space -= 40*FRACUNIT;
self->_f_SetZ(((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT);
space -= 40;
self->SetZ((space * pr_restore()) / 256. + self->floorz + 40);
}
else
{
self->_f_SetZ(self->floorz);
self->SetZ(self->floorz);
}
}
else
{
self->_f_SetZ(self->SpawnPoint[2] + self->floorz);
self->_f_SetZ(self->SpawnPoint[2] + self->_f_floorz());
}
// Redo floor/ceiling check, in case of 3D floors and portals
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
if (self->_f_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->_f_SetZ(self->floorz);
self->SetZ(self->floorz);
}
if ((self->flags & MF_SOLID) && (self->Top() > self->ceilingz))
{ // Do the same for the ceiling.
@ -1354,7 +1354,7 @@ bool AInventory::DoRespawn ()
if (spot != NULL)
{
SetOrigin (spot->Pos(), false);
_f_SetZ(floorz);
_f_SetZ(_f_floorz());
}
}
return true;

View file

@ -133,7 +133,7 @@ void DEarthquake::Tick ()
dist = m_Spot->AproxDistance (victim, true);
// Check if in damage _f_radius()
if (dist < m_DamageRadius && victim->_f_Z() <= victim->floorz)
if (dist < m_DamageRadius && victim->Z() <= victim->floorz)
{
if (pr_quake() < 50)
{

View file

@ -192,11 +192,11 @@ class ARandomSpawner : public AActor
}
else if (newmobj->flags2 & MF2_SPAWNFLOAT)
{
fixed_t space = newmobj->_f_ceilingz() - newmobj->height - newmobj->floorz;
if (space > 48*FRACUNIT)
double space = newmobj->ceilingz - newmobj->_Height() - newmobj->floorz;
if (space > 48)
{
space -= 40*FRACUNIT;
newmobj->_f_SetZ(MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT);
space -= 40;
newmobj->SetZ((space * pr_randomspawn()) / 256. + newmobj->floorz + 40);
}
newmobj->_f_AddZ(SpawnPoint[2]);
}

View file

@ -429,7 +429,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnSingleItem)
if (spawned)
{
spawned->SetOrigin (spot->Pos(), false);
spawned->_f_SetZ(spawned->floorz);
spawned->SetZ(spawned->floorz);
// We want this to respawn.
if (!(self->flags & MF_DROPPED))
{

View file

@ -108,7 +108,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
if (self->reactiontime < 0 ||
self->Vel.X == 0 ||
self->Vel.Y == 0 ||
self->_f_Z() <= self->floorz)
self->Z() <= self->floorz)
{
self->SetState (self->SeeState);
self->reactiontime = 0;

View file

@ -109,7 +109,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning)
if (self->target == NULL)
return 0;
spot = Spawn("SpectralLightningSpot", self->target->_f_X(), self->target->_f_Y(), self->target->floorz, ALLOW_REPLACE);
spot = Spawn("SpectralLightningSpot", self->target->PosAtZ(self->target->floorz), ALLOW_REPLACE);
if (spot != NULL)
{
spot->threshold = 25;

View file

@ -80,8 +80,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
AActor *rebel;
angle_t an;
rebel = Spawn("Rebel1", self->_f_X(), self->_f_Y(), self->floorz, ALLOW_REPLACE);
if (!P_TryMove (rebel, rebel->_f_X(), rebel->_f_Y(), true))
rebel = Spawn("Rebel1", self->PosAtZ(self->floorz), ALLOW_REPLACE);
if (!P_TryMove (rebel, rebel->X(), rebel->Y(), true))
{
rebel->Destroy ();
return 0;

View file

@ -24,7 +24,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
return 0;
maxz = self->ceilingz - self->_Height() - 16;
minz = FIXED2FLOAT(self->floorz) + 96;
minz = self->floorz + 96;
if (minz > maxz)
{
minz = maxz;

View file

@ -987,7 +987,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
P_BulletSlope (self, &t, ALF_PORTALRESTRICT);
if (t.linetarget != NULL)
{
spot = Spawn("SpectralLightningSpot", t.linetarget->_f_X(), t.linetarget->_f_Y(), t.linetarget->floorz, ALLOW_REPLACE);
spot = Spawn("SpectralLightningSpot", t.linetarget->PosAtZ(t.linetarget->floorz), ALLOW_REPLACE);
if (spot != NULL)
{
spot->tracer = t.linetarget;

View file

@ -266,7 +266,7 @@ public:
int MeleeDamage;
FSoundID MeleeSound;
FName MissileName;
fixed_t MissileHeight;
double MissileHeight;
// For those times when being able to scan every kind of actor is convenient
static TArray<PClassActor *> AllActorClasses;

View file

@ -378,7 +378,7 @@ bool P_CheckFor3DFloorHit(AActor * mo)
if(rover->flags & FF_SOLID && rover->model->SecActTarget)
{
if(mo->floorz == rover->top.plane->ZatPoint(mo))
if(mo->_f_floorz() == rover->top.plane->ZatPoint(mo))
{
rover->model->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor);
return true;

View file

@ -8708,7 +8708,7 @@ scriptwait:
case PCD_GETACTORFLOORZ:
{
AActor *actor = SingleActorFromTID(STACK(1), activator);
STACK(1) = actor == NULL ? 0 : actor->floorz;
STACK(1) = actor == NULL ? 0 : DoubleToACS(actor->floorz);
}
break;

View file

@ -19,7 +19,7 @@ struct FCheckPosition
// out
sector_t *sector;
fixed_t floorz;
double floorz;
double ceilingz;
fixed_t dropoffz;
FTextureID floorpic;
@ -51,6 +51,10 @@ struct FCheckPosition
{
return FLOAT2FIXED(ceilingz);
}
inline fixed_t _f_floorz()
{
return FLOAT2FIXED(floorz);
}
};

View file

@ -473,7 +473,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->_f_Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ))
&& actor->Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ))
{
return false;
}
@ -574,22 +574,22 @@ bool P_Move (AActor *actor)
// actually walking down a step.
if (try_ok &&
!((actor->flags & MF_NOGRAVITY) || (actor->flags6 & MF6_CANJUMP))
&& actor->_f_Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ))
&& actor->Z() > actor->floorz && !(actor->flags2 & MF2_ONMOBJ))
{
if (actor->_f_Z() <= actor->floorz + actor->MaxStepHeight)
if (actor->_f_Z() <= actor->_f_floorz() + actor->MaxStepHeight)
{
fixed_t savedz = actor->_f_Z();
actor->_f_SetZ(actor->floorz);
double savedz = actor->Z();
actor->SetZ(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.
if (!P_TestMobjZ(actor))
{
actor->_f_SetZ(savedz);
actor->SetZ(savedz);
}
else
{ // The monster just hit the floor, so trigger any actions.
if (actor->floorsector->SecActTarget != NULL &&
actor->floorz == actor->floorsector->floorplane.ZatPoint(actor->PosRelative(actor->floorsector)))
actor->_f_floorz() == actor->floorsector->floorplane.ZatPoint(actor->PosRelative(actor->floorsector)))
{
actor->floorsector->SecActTarget->TriggerAction(actor, SECSPAC_HitFloor);
}
@ -602,12 +602,12 @@ bool P_Move (AActor *actor)
{
if (((actor->flags6 & MF6_CANJUMP)||(actor->flags & MF_FLOAT)) && tm.floatok)
{ // must adjust height
fixed_t savedz = actor->_f_Z();
double savedz = actor->Z();
if (actor->_f_Z() < tm.floorz)
actor->_f_AddZ(actor->_f_floatspeed());
if (actor->Z() < tm.floorz)
actor->AddZ(actor->FloatSpeed);
else
actor->_f_AddZ(-actor->_f_floatspeed());
actor->AddZ(-actor->FloatSpeed);
// [RH] Check to make sure there's nothing in the way of the float
@ -616,7 +616,7 @@ bool P_Move (AActor *actor)
actor->flags |= MF_INFLOAT;
return true;
}
actor->_f_SetZ(savedz);
actor->SetZ(savedz);
}
if (!spechit.Size ())
@ -879,8 +879,8 @@ void P_NewChaseDir(AActor * actor)
}
// Try to move away from a dropoff
if (actor->floorz - actor->dropoffz > actor->MaxDropOffHeight &&
actor->_f_Z() <= actor->floorz && !(actor->flags & MF_DROPOFF) &&
if (actor->_f_floorz() - actor->dropoffz > actor->MaxDropOffHeight &&
actor->Z() <= actor->floorz && !(actor->flags & MF_DROPOFF) &&
!(actor->flags2 & MF2_ONMOBJ) &&
!(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF))
{

View file

@ -279,6 +279,10 @@ AActor *P_CheckOnmobj (AActor *thing);
void P_FakeZMovement (AActor *mo);
bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane_t * onfloor, FCheckPosition &tm, bool missileCheck = false);
bool P_TryMove (AActor* thing, fixed_t x, fixed_t y, int dropoff, const secplane_t * onfloor = NULL);
inline bool P_TryMove(AActor* thing, double x, double y, int dropoff, const secplane_t * onfloor = NULL)
{
return P_TryMove(thing, FLOAT2FIXED(x), FLOAT2FIXED(y), dropoff, onfloor);
}
bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y);
void P_ApplyTorque(AActor *mo);
bool P_TeleportMove (AActor* thing, fixed_t x, fixed_t y, fixed_t z, bool telefrag, bool modifyactor = true); // [RH] Added z and telefrag parameters

View file

@ -253,16 +253,16 @@ static bool PIT_FindFloorCeiling(FMultiBlockLinesIterator &mit, FMultiBlockLines
if (!(flags & FFCF_NOFLOOR))
{
if (open.bottom > tmf.floorz)
if (open.bottom > tmf._f_floorz())
{
tmf.floorz = open.bottom;
tmf.floorz = FIXED2DBL(open.bottom);
if (open.bottomsec != NULL) tmf.floorsector = open.bottomsec;
tmf.touchmidtex = open.touchmidtex;
tmf.abovemidtex = open.abovemidtex;
if (ffcf_verbose) Printf(" Adjust floorz to %f\n", FIXED2FLOAT(open.bottom));
if (tmf.floorz > tmf.dropoffz + tmf.thing->MaxDropOffHeight) mit.StopDown();
if (tmf._f_floorz() > tmf.dropoffz + tmf.thing->MaxDropOffHeight) mit.StopDown();
}
else if (open.bottom == tmf.floorz)
else if (open.bottom == tmf._f_floorz())
{
tmf.touchmidtex |= open.touchmidtex;
tmf.abovemidtex |= open.abovemidtex;
@ -272,7 +272,7 @@ static bool PIT_FindFloorCeiling(FMultiBlockLinesIterator &mit, FMultiBlockLines
{
tmf.dropoffz = open.lowfloor;
if (ffcf_verbose) Printf(" Adjust dropoffz to %f\n", FIXED2FLOAT(open.bottom));
if (tmf.floorz > tmf.dropoffz + tmf.thing->MaxDropOffHeight) mit.StopDown();
if (tmf._f_floorz() > tmf.dropoffz + tmf.thing->MaxDropOffHeight) mit.StopDown();
}
}
return true;
@ -292,7 +292,8 @@ void P_GetFloorCeilingZ(FCheckPosition &tmf, int flags)
F3DFloor *ffc, *fff;
tmf.ceilingz = FIXED2DBL(sec->NextHighestCeilingAt(tmf.x, tmf.y, tmf.z, tmf.z + tmf.thing->height, flags, &tmf.ceilingsector, &ffc));
tmf.floorz = tmf.dropoffz = sec->NextLowestFloorAt(tmf.x, tmf.y, tmf.z, flags, tmf.thing->MaxStepHeight, &tmf.floorsector, &fff);
tmf.dropoffz = sec->NextLowestFloorAt(tmf.x, tmf.y, tmf.z, flags, tmf.thing->MaxStepHeight, &tmf.floorsector, &fff);
tmf.floorz = FIXED2DBL(tmf.dropoffz);
if (fff)
{
@ -343,7 +344,7 @@ void P_FindFloorCeiling(AActor *actor, int flags)
actor->floorsector = tmf.floorsector;
actor->ceilingpic = tmf.ceilingpic;
actor->ceilingsector = tmf.ceilingsector;
if (ffcf_verbose) Printf("Starting with ceilingz = %f, floorz = %f\n", tmf.ceilingz, FIXED2FLOAT(tmf.floorz));
if (ffcf_verbose) Printf("Starting with ceilingz = %f, floorz = %f\n", tmf.ceilingz, tmf.floorz);
tmf.touchmidtex = false;
tmf.abovemidtex = false;
@ -363,9 +364,9 @@ void P_FindFloorCeiling(AActor *actor, int flags)
PIT_FindFloorCeiling(mit, cres, mit.Box(), tmf, flags|cres.portalflags);
}
if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz;
if (tmf.touchmidtex) tmf.dropoffz = tmf._f_floorz();
bool usetmf = !(flags & FFCF_ONLYSPAWNPOS) || (tmf.abovemidtex && (tmf.floorz <= actor->_f_Z()));
bool usetmf = !(flags & FFCF_ONLYSPAWNPOS) || (tmf.abovemidtex && (tmf.floorz <= actor->Z()));
// when actual floor or ceiling are beyond a portal plane we also need to use the result of the blockmap iterator, regardless of the flags being specified.
if (usetmf || tmf.floorsector->PortalGroup != actor->Sector->PortalGroup)
@ -444,7 +445,7 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra
}
thing->_f_SetZ(savedz);
if (tmf.touchmidtex) tmf.dropoffz = tmf.floorz;
if (tmf.touchmidtex) tmf.dropoffz = tmf._f_floorz();
FMultiBlockThingsIterator mit2(grouplist, x, y, z, thing->height, thing->_f_radius(), false, sector);
FMultiBlockThingsIterator::CheckResult cres2;
@ -605,7 +606,7 @@ int P_GetFriction(const AActor *mo, int *frictionfactor)
friction = FRICTION_FLY;
}
else if ((!(mo->flags & MF_NOGRAVITY) && mo->waterlevel > 1) ||
(mo->waterlevel == 1 && mo->_f_Z() > mo->floorz + 6 * FRACUNIT))
(mo->waterlevel == 1 && mo->Z() > mo->floorz+ 6))
{
friction = mo->Sector->GetFriction(sector_t::floor, &movefactor);
movefactor >>= 1;
@ -873,7 +874,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
if (state == -1) return true;
if (state == 1)
{
fixed_t portalz = cres.line->frontsector->SkyBoxes[sector_t::ceiling]->threshold;
double portalz = FIXED2DBL(cres.line->frontsector->SkyBoxes[sector_t::ceiling]->threshold);
if (portalz > tm.floorz)
{
tm.floorz = portalz;
@ -948,9 +949,9 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
if (!(cres.portalflags & FFCF_NOFLOOR))
{
if (open.bottom > tm.floorz)
if (open.bottom > tm._f_floorz())
{
tm.floorz = open.bottom;
tm.floorz = FIXED2DBL(open.bottom);
tm.floorsector = open.bottomsec;
tm.floorpic = open.floorpic;
tm.floorterrain = open.floorterrain;
@ -958,7 +959,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
tm.abovemidtex = open.abovemidtex;
tm.thing->BlockingLine = ld;
}
else if (open.bottom == tm.floorz)
else if (open.bottom == tm._f_floorz())
{
tm.touchmidtex |= open.touchmidtex;
tm.abovemidtex |= open.abovemidtex;
@ -1069,9 +1070,9 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera
ret = true;
}
if (open.bottom - zofs > tm.floorz)
if (open.bottom - zofs > tm._f_floorz())
{
tm.floorz = open.bottom - zofs;
tm.floorz = FIXED2DBL(open.bottom - zofs);
tm.floorpic = open.floorpic;
tm.floorterrain = open.floorterrain;
/*
@ -1223,18 +1224,18 @@ bool PIT_CheckThing(FMultiBlockThingsIterator &it, FMultiBlockThingsIterator::Ch
{
// [RH] Let monsters walk on actors as well as floors
if ((tm.thing->flags3 & MF3_ISMONSTER) &&
topz >= tm.floorz && topz <= tm.thing->_f_Z() + tm.thing->MaxStepHeight)
topz >= tm._f_floorz() && topz <= tm.thing->_f_Z() + tm.thing->MaxStepHeight)
{
// The commented-out if is an attempt to prevent monsters from walking off a
// thing further than they would walk off a ledge. I can't think of an easy
// way to do this, so I restrict them to only walking on bridges instead.
// Uncommenting the if here makes it almost impossible for them to walk on
// anything, bridge or otherwise.
// if (abs(thing->x - tmx) <= thing->_f_radius() &&
// abs(thing->y - tmy) <= thing->_f_radius())
// if (abs(thing->x - tmx) <= thing->radius &&
// abs(thing->y - tmy) <= thing->radius)
{
tm.stepthing = thing;
tm.floorz = topz;
tm.floorz = FIXED2DBL(topz);
}
}
}
@ -1590,7 +1591,7 @@ MOVEMENT CLIPPING
//
// out:
// newsubsec
// floorz
// _f_floorz()
// ceilingz
// tmdropoffz = the lowest point contacted (monsters won't move to a dropoff)
// speciallines[]
@ -1624,7 +1625,8 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
else
{
// With noclip2, we must ignore 3D floors and go right to the uppermost ceiling and lowermost floor.
tm.floorz = tm.dropoffz = newsec->_f_LowestFloorAt(x, y, &tm.floorsector);
tm.dropoffz = newsec->_f_LowestFloorAt(x, y, &tm.floorsector);
tm.floorz = FIXED2DBL(tm.dropoffz);
tm.ceilingz = FIXED2DBL(newsec->_f_HighestCeilingAt(x, y, &tm.ceilingsector));
tm.floorpic = tm.floorsector->GetTexture(sector_t::floor);
tm.floorterrain = tm.floorsector->GetTerrain(sector_t::floor);
@ -1723,9 +1725,9 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
FMultiBlockLinesIterator it(pcheck, x, y, thing->_f_Z(), thing->height, thing->_f_radius(), newsec);
FMultiBlockLinesIterator::CheckResult lcres;
fixed_t thingdropoffz = tm.floorz;
fixed_t thingdropoffz = tm._f_floorz();
//bool onthing = (thingdropoffz != tmdropoffz);
tm.floorz = tm.dropoffz;
tm.floorz = FIXED2DBL(tm.dropoffz);
bool good = true;
@ -1752,13 +1754,13 @@ bool P_CheckPosition(AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, bo
{
return false;
}
if (tm._f_ceilingz() - tm.floorz < thing->height)
if (tm.ceilingz - tm.floorz < thing->_Height())
{
return false;
}
if (tm.touchmidtex)
{
tm.dropoffz = tm.floorz;
tm.dropoffz = tm._f_floorz();
}
else if (tm.stepthing != NULL)
{
@ -1789,10 +1791,10 @@ bool P_TestMobjLocation(AActor *mobj)
flags = mobj->flags;
mobj->flags &= ~MF_PICKUP;
if (P_CheckPosition(mobj, mobj->_f_X(), mobj->_f_Y()))
if (P_CheckPosition(mobj, mobj->Pos()))
{ // XY is ok, now check Z
mobj->flags = flags;
if ((mobj->_f_Z() < mobj->floorz) || (mobj->Top() > mobj->ceilingz))
if ((mobj->Z() < mobj->floorz) || (mobj->Top() > mobj->ceilingz))
{ // Bad Z
return false;
}
@ -1930,7 +1932,7 @@ void P_FakeZMovement(AActor *mo)
mo->_f_AddZ(mo->_f_floatspeed());
}
}
if (mo->player && mo->flags&MF_NOGRAVITY && (mo->_f_Z() > mo->floorz) && !mo->IsNoClip2())
if (mo->player && mo->flags&MF_NOGRAVITY && (mo->Z() > mo->floorz) && !mo->IsNoClip2())
{
mo->_f_AddZ(finesine[(FINEANGLES / 80 * level.maptime)&FINEMASK] / 8);
}
@ -1938,9 +1940,9 @@ void P_FakeZMovement(AActor *mo)
//
// clip movement
//
if (mo->_f_Z() <= mo->floorz)
if (mo->Z() <= mo->floorz)
{ // hit the floor
mo->_f_SetZ(mo->floorz);
mo->SetZ(mo->floorz);
}
if (mo->Top() > mo->ceilingz)
@ -2069,7 +2071,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
if (thing->flags3 & MF3_FLOORHUGGER)
{
thing->_f_SetZ(tm.floorz);
thing->SetZ(tm.floorz);
}
else if (thing->flags3 & MF3_CEILINGHUGGER)
{
@ -2078,11 +2080,11 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
if (onfloor && tm.floorsector == thing->floorsector)
{
thing->_f_SetZ(tm.floorz);
thing->SetZ(tm.floorz);
}
if (!(thing->flags & MF_NOCLIP))
{
if (tm._f_ceilingz() - tm.floorz < thing->height)
if (tm.ceilingz - tm.floorz < thing->_Height())
{
goto pushline; // doesn't fit
}
@ -2106,42 +2108,42 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
// is not blocked.
if (thing->Top() > tm.ceilingz)
{
thing->_f_velz() = -8 * FRACUNIT;
thing->Vel.Z = -8;
goto pushline;
}
else if (thing->_f_Z() < tm.floorz && tm.floorz - tm.dropoffz > thing->MaxDropOffHeight)
else if (thing->Z() < tm.floorz && tm._f_floorz() - tm.dropoffz > thing->MaxDropOffHeight)
{
thing->_f_velz() = 8 * FRACUNIT;
thing->Vel.Z = 8;
goto pushline;
}
#endif
}
if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER))
{
if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm.floorz > thing->_f_Z())
if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm.floorz > thing->Z())
{ // [RH] Don't let normal missiles climb steps
goto pushline;
}
if (tm.floorz - thing->_f_Z() > thing->MaxStepHeight)
if (tm._f_floorz() - thing->_f_Z() > thing->MaxStepHeight)
{ // too big a step up
goto pushline;
}
else if (thing->_f_Z() < tm.floorz)
else if (thing->Z() < tm.floorz)
{ // [RH] Check to make sure there's nothing in the way for the step up
fixed_t savedz = thing->_f_Z();
double savedz = thing->Z();
bool good;
thing->_f_SetZ(tm.floorz);
thing->SetZ(tm.floorz);
good = P_TestMobjZ(thing);
thing->_f_SetZ(savedz);
thing->SetZ(savedz);
if (!good)
{
goto pushline;
}
if (thing->flags6 & MF6_STEPMISSILE)
{
thing->_f_SetZ(tm.floorz);
thing->SetZ(tm.floorz);
// If moving down, cancel vertical component of the velocity
if (thing->_f_velz() < 0)
if (thing->Vel.Z < 0)
{
// If it's a bouncer, let it bounce off its new floor, too.
if (thing->BounceFlags & BOUNCE_Floors)
@ -2165,7 +2167,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
}
if (dropoff == 2 && // large jump down (e.g. dogs)
(tm.floorz - tm.dropoffz > 128 * FRACUNIT || thing->target == NULL || thing->target->_f_Z() >tm.dropoffz))
(tm._f_floorz() - tm.dropoffz > 128 * FRACUNIT || thing->target == NULL || thing->target->_f_Z() >tm.dropoffz))
{
dropoff = false;
}
@ -2176,15 +2178,15 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
{
if (!(thing->flags5&MF5_AVOIDINGDROPOFF))
{
fixed_t floorz = tm.floorz;
double floorz = tm.floorz;
// [RH] If the thing is standing on something, use its current z as the floorz.
// This is so that it does not walk off of things onto a drop off.
if (thing->flags2 & MF2_ONMOBJ)
{
floorz = MAX(thing->_f_Z(), tm.floorz);
floorz = MAX(thing->Z(), tm.floorz);
}
if (floorz - tm.dropoffz > thing->MaxDropOffHeight &&
if (FLOAT2FIXED(floorz) - tm.dropoffz > thing->MaxDropOffHeight &&
!(thing->flags2 & MF2_BLASTED) && !missileCheck)
{ // Can't move over a dropoff unless it's been blasted
// [GZ] Or missile-spawned
@ -2197,7 +2199,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
{
// special logic to move a monster off a dropoff
// this intentionally does not check for standing on things.
if (thing->floorz - tm.floorz > thing->MaxDropOffHeight ||
if (thing->_f_floorz() - tm._f_floorz() > thing->MaxDropOffHeight ||
thing->dropoffz - tm.dropoffz > thing->MaxDropOffHeight)
{
thing->flags6 &= ~MF6_INTRYMOVE;
@ -2207,7 +2209,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
}
if (thing->flags2 & MF2_CANTLEAVEFLOORPIC
&& (tm.floorpic != thing->floorpic
|| tm.floorz - thing->_f_Z() != 0))
|| tm.floorz - thing->Z() != 0))
{ // must stay within a sector of a certain floor type
thing->_f_SetZ(oldz);
thing->flags6 &= ~MF6_INTRYMOVE;
@ -2250,7 +2252,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
// Borrowed from MBF:
if (thing->BounceFlags & BOUNCE_MBF && // killough 8/13/98
!(thing->flags & (MF_MISSILE | MF_NOGRAVITY)) &&
!thing->IsSentient() && tm.floorz - thing->_f_Z() > 16 * FRACUNIT)
!thing->IsSentient() && tm.floorz - thing->Z() > 16)
{ // too big a step up for MBF bouncers under gravity
thing->flags6 &= ~MF6_INTRYMOVE;
return false;
@ -2539,7 +2541,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
if (thing->flags3 & MF3_FLOORHUGGER)
{
newz = tm.floorz;
newz = tm._f_floorz();
}
else if (thing->flags3 & MF3_CEILINGHUGGER)
{
@ -2548,7 +2550,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
if (!(thing->flags & MF_NOCLIP))
{
if (tm._f_ceilingz() - tm.floorz < thing->height)
if (tm.ceilingz - tm.floorz < thing->_Height())
{
return false;
}
@ -2567,18 +2569,18 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
}
if (!(thing->flags & MF_TELEPORT) && !(thing->flags3 & MF3_FLOORHUGGER))
{
if (tm.floorz - newz > thing->MaxStepHeight)
if (tm._f_floorz() - newz > thing->MaxStepHeight)
{ // too big a step up
return false;
}
else if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm.floorz > newz)
else if ((thing->flags & MF_MISSILE) && !(thing->flags6 & MF6_STEPMISSILE) && tm._f_floorz() > newz)
{ // [RH] Don't let normal missiles climb steps
return false;
}
else if (newz < tm.floorz)
else if (newz < tm._f_floorz())
{ // [RH] Check to make sure there's nothing in the way for the step up
fixed_t savedz = thing->_f_Z();
thing->_f_SetZ(newz = tm.floorz);
thing->_f_SetZ(newz = tm._f_floorz());
bool good = P_TestMobjZ(thing);
thing->_f_SetZ(savedz);
if (!good)
@ -2590,7 +2592,7 @@ bool P_CheckMove(AActor *thing, fixed_t x, fixed_t y)
if (thing->flags2 & MF2_CANTLEAVEFLOORPIC
&& (tm.floorpic != thing->floorpic
|| tm.floorz - newz != 0))
|| tm._f_floorz() - newz != 0))
{ // must stay within a sector of a certain floor type
return false;
}
@ -2661,7 +2663,7 @@ void FSlide::HitSlideLine(line_t* ld)
icyfloor =
(P_AproxDistance(tmxmove, tmymove) > 4 * FRACUNIT) &&
var_friction && // killough 8/28/98: calc friction on demand
slidemo->_f_Z() <= slidemo->floorz &&
slidemo->Z() <= slidemo->floorz &&
P_GetFriction(slidemo, NULL) > ORIG_FRICTION;
if (ld->dx == 0)
@ -3063,7 +3065,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, fixed_t &xmove, fixed_t &ymov
if (actor->floorsector != actor->Sector)
{
// this additional check prevents sliding on sloped dropoffs
if (planezhere>actor->floorz + 4 * FRACUNIT)
if (planezhere>actor->_f_floorz() + 4 * FRACUNIT)
return NULL;
}
@ -3253,8 +3255,8 @@ bool FSlide::BounceWall(AActor *mo)
bestslideline = mo->BlockingLine;
if (BounceTraverse(leadx, leady, leadx + mo->_f_velx(), leady + mo->_f_vely()) && mo->BlockingLine == NULL)
{ // Could not find a wall, so bounce off the floor/ceiling instead.
fixed_t floordist = mo->_f_Z() - mo->floorz;
fixed_t ceildist = mo->_f_ceilingz() - mo->_f_Z();
double floordist = mo->Z() - mo->floorz;
double ceildist = mo->ceilingz - mo->Z();
if (floordist <= ceildist)
{
mo->FloorBounceMissile(mo->Sector->floorplane);
@ -5736,7 +5738,7 @@ int P_PushDown(AActor *thing, FChangePosition *cpos)
unsigned int lastintersect;
int mymass = thing->Mass;
if (thing->_f_Z() <= thing->floorz)
if (thing->Z() <= thing->floorz)
{
return 1;
}
@ -5778,12 +5780,12 @@ int P_PushDown(AActor *thing, FChangePosition *cpos)
void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
{
fixed_t oldfloorz = thing->floorz;
fixed_t oldfloorz = thing->_f_floorz();
fixed_t oldz = thing->_f_Z();
P_AdjustFloorCeil(thing, cpos);
if (oldfloorz == thing->floorz) return;
if (oldfloorz == thing->_f_floorz()) return;
if (thing->flags4 & MF4_ACTLIKEBRIDGE) return; // do not move bridge things
if (thing->_f_velz() == 0 &&
@ -5794,9 +5796,9 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
if ((thing->flags & MF_NOGRAVITY) || (thing->flags5 & MF5_MOVEWITHSECTOR) ||
(((cpos->sector->Flags & SECF_FLOORDROP) || cpos->moveamt < 9 * FRACUNIT)
&& thing->_f_Z() - thing->floorz <= cpos->moveamt))
&& thing->_f_Z() - thing->_f_floorz() <= cpos->moveamt))
{
thing->_f_SetZ(thing->floorz);
thing->SetZ(thing->floorz);
P_CheckFakeFloorTriggers(thing, oldz);
}
}
@ -5805,7 +5807,7 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
fixed_t oldz = thing->_f_Z();
if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR))
{
thing->_f_AddZ(-oldfloorz + thing->floorz);
thing->_f_AddZ(-oldfloorz + thing->_f_floorz());
P_CheckFakeFloorTriggers(thing, oldz);
}
}
@ -5823,15 +5825,15 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
{
fixed_t oldfloorz = thing->floorz;
fixed_t oldfloorz = thing->_f_floorz();
fixed_t oldz = thing->_f_Z();
P_AdjustFloorCeil(thing, cpos);
if (oldfloorz == thing->floorz) return;
if (oldfloorz == thing->_f_floorz()) return;
// Move things intersecting the floor up
if (thing->_f_Z() <= thing->floorz)
if (thing->Z() <= thing->floorz)
{
if (thing->flags4 & MF4_ACTLIKEBRIDGE)
{
@ -5839,14 +5841,14 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
return; // do not move bridge things
}
intersectors.Clear();
thing->_f_SetZ(thing->floorz);
thing->SetZ(thing->floorz);
}
else
{
if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR))
{
intersectors.Clear();
thing->_f_AddZ(-oldfloorz + thing->floorz);
thing->_f_AddZ(-oldfloorz + thing->_f_floorz());
}
else return;
}
@ -5881,7 +5883,7 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos)
bool onfloor;
fixed_t oldz = thing->_f_Z();
onfloor = thing->_f_Z() <= thing->floorz;
onfloor = thing->Z() <= thing->floorz;
P_AdjustFloorCeil(thing, cpos);
if (thing->Top() > thing->ceilingz)
@ -5893,13 +5895,13 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos)
}
intersectors.Clear();
fixed_t oldz = thing->_f_Z();
if (thing->_f_ceilingz() - thing->height >= thing->floorz)
if (thing->ceilingz - thing->_Height() >= thing->floorz)
{
thing->SetZ(thing->ceilingz - thing->_Height());
}
else
{
thing->_f_SetZ(thing->floorz);
thing->SetZ(thing->floorz);
}
switch (P_PushDown(thing, cpos))
{
@ -5907,7 +5909,7 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos)
// intentional fall-through
case 1:
if (onfloor)
thing->_f_SetZ(thing->floorz);
thing->SetZ(thing->floorz);
P_DoCrunch(thing, cpos);
P_CheckFakeFloorTriggers(thing, oldz);
break;
@ -5938,12 +5940,12 @@ 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->_f_Z() < thing->floorz &&
if (thing->_f_Z() < thing->_f_floorz() &&
thing->_f_Top() >= thing->_f_ceilingz() - cpos->moveamt &&
!(thing->flags & MF_NOLIFTDROP))
{
fixed_t oldz = thing->_f_Z();
thing->_f_SetZ(thing->floorz);
thing->SetZ(thing->floorz);
if (thing->Top() > thing->ceilingz)
{
thing->SetZ(thing->ceilingz - thing->_Height());

View file

@ -1528,7 +1528,7 @@ void AActor::PlayBounceSound(bool onfloor)
bool AActor::FloorBounceMissile (secplane_t &plane)
{
if (_f_Z() <= floorz && P_HitFloor (this))
if (_f_Z() <= _f_floorz() && P_HitFloor (this))
{
// Landed in some sort of liquid
if (BounceFlags & BOUNCE_ExplodeOnWater)
@ -1776,7 +1776,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
static const double windTab[3] = { 5 / 32., 10 / 32., 25 / 32. };
int steps, step, totalsteps;
fixed_t startx, starty;
fixed_t oldfloorz = mo->floorz;
fixed_t oldfloorz = mo->_f_floorz();
fixed_t oldz = mo->_f_Z();
double maxmove = (mo->waterlevel < 1) || (mo->flags & MF_MISSILE) ||
@ -2186,7 +2186,7 @@ explode:
return oldfloorz;
}
if (mo->_f_Z() > mo->floorz && !(mo->flags2 & MF2_ONMOBJ) &&
if (mo->Z() > mo->floorz && !(mo->flags2 & MF2_ONMOBJ) &&
!mo->IsNoClip2() &&
(!(mo->flags2 & MF2_FLY) || !(mo->flags & MF_NOGRAVITY)) &&
!mo->waterlevel)
@ -2212,9 +2212,9 @@ explode:
{ // Don't stop sliding if halfway off a step with some velocity
if (mo->_f_velx() > FRACUNIT/4 || mo->_f_velx() < -FRACUNIT/4 || mo->_f_vely() > FRACUNIT/4 || mo->_f_vely() < -FRACUNIT/4)
{
if (mo->floorz > mo->Sector->floorplane.ZatPoint(mo))
if (mo->_f_floorz() > mo->Sector->floorplane.ZatPoint(mo))
{
if (mo->dropoffz != mo->floorz) // 3DMidtex or other special cases that must be excluded
if (mo->dropoffz != mo->_f_floorz()) // 3DMidtex or other special cases that must be excluded
{
unsigned i;
for(i=0;i<mo->Sector->e->XFloor.ffloors.Size();i++)
@ -2223,7 +2223,7 @@ explode:
// if the floor comes from one in the current sector stop sliding the corpse!
F3DFloor * rover=mo->Sector->e->XFloor.ffloors[i];
if (!(rover->flags&FF_EXISTS)) continue;
if (rover->flags&FF_SOLID && rover->top.plane->ZatPoint(mo) == mo->floorz) break;
if (rover->flags&FF_SOLID && rover->top.plane->ZatPoint(mo) == mo->_f_floorz()) break;
}
if (i==mo->Sector->e->XFloor.ffloors.Size())
return oldfloorz;
@ -2334,9 +2334,9 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
//
// check for smooth step up
//
if (mo->player && mo->player->mo == mo && mo->_f_Z() < mo->floorz)
if (mo->player && mo->player->mo == mo && mo->Z() < mo->floorz)
{
mo->player->viewheight -= mo->floorz - mo->_f_Z();
mo->player->viewheight -= mo->_f_floorz() - mo->_f_Z();
mo->player->deltaviewheight = mo->player->GetDeltaViewHeight();
}
@ -2345,7 +2345,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
//
// apply gravity
//
if (mo->_f_Z() > mo->floorz && !(mo->flags & MF_NOGRAVITY))
if (mo->Z() > mo->floorz && !(mo->flags & MF_NOGRAVITY))
{
double startvelz = mo->Vel.Z;
@ -2354,7 +2354,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
{
// [RH] Double gravity only if running off a ledge. Coming down from
// an upward thrust (e.g. a jump) should not double it.
if (mo->_f_velz() == 0 && oldfloorz > mo->floorz && mo->_f_Z() == oldfloorz)
if (mo->Vel.Z == 0 && oldfloorz > mo->_f_floorz() && mo->_f_Z() == oldfloorz)
{
mo->Vel.Z -= grav + grav;
}
@ -2427,7 +2427,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
// Do this only if the item was actually spawned by the map above ground to avoid problems.
if (mo->special1 > 0 && (mo->flags2 & MF2_FLOATBOB) && (ib_compatflags & BCOMPATF_FLOATBOB))
{
mo->_f_SetZ(mo->floorz + mo->special1);
mo->_f_SetZ(mo->_f_floorz() + mo->special1);
}
@ -2446,7 +2446,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
mo->_f_AddZ(mo->_f_floatspeed());
}
}
if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->_f_Z() > mo->floorz))
if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->Z() > mo->floorz))
{
if (!mo->IsNoClip2())
{
@ -2480,22 +2480,22 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
//
// clip movement
//
if (mo->_f_Z() <= mo->floorz)
if (mo->Z() <= mo->floorz)
{ // Hit the floor
if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) &&
mo->Sector->SecActTarget != NULL &&
mo->Sector->floorplane.ZatPoint(mo) == mo->floorz)
mo->Sector->floorplane.ZatPoint(mo) == mo->_f_floorz())
{ // [RH] Let the sector do something to the actor
mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor);
}
P_CheckFor3DFloorHit(mo);
// [RH] Need to recheck this because the sector action might have
// teleported the actor so it is no longer below the floor.
if (mo->_f_Z() <= mo->floorz)
if (mo->Z() <= mo->floorz)
{
if ((mo->flags & MF_MISSILE) && !(mo->flags & MF_NOCLIP))
{
mo->_f_SetZ(mo->floorz);
mo->SetZ(mo->floorz);
if (mo->BounceFlags & BOUNCE_Floors)
{
mo->FloorBounceMissile (mo->floorsector->floorplane);
@ -2536,7 +2536,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
P_MonsterFallingDamage (mo);
}
}
mo->_f_SetZ(mo->floorz);
mo->SetZ(mo->floorz);
if (mo->_f_velz() < 0)
{
const fixed_t minvel = -8*FRACUNIT; // landing speed from a jump with normal gravity
@ -2760,12 +2760,12 @@ void P_NightmareRespawn (AActor *mobj)
if (z == ONFLOORZ)
{
mo->_f_AddZ(mobj->SpawnPoint[2]);
if (mo->_f_Z() < mo->floorz)
if (mo->Z() < mo->floorz)
{ // Do not respawn monsters in the floor, even if that's where they
// started. The initial P_ZMovement() call would have put them on
// the floor right away, but we need them on the floor now so we
// can use P_CheckPosition() properly.
mo->_f_SetZ(mo->floorz);
mo->SetZ(mo->floorz);
}
if (mo->Top() > mo->ceilingz)
{
@ -2782,12 +2782,12 @@ void P_NightmareRespawn (AActor *mobj)
if (z == ONFLOORZ)
{
if (mo->_f_Z() < mo->floorz)
if (mo->Z() < mo->floorz)
{ // Do not respawn monsters in the floor, even if that's where they
// started. The initial P_ZMovement() call would have put them on
// the floor right away, but we need them on the floor now so we
// can use P_CheckPosition() properly.
mo->_f_SetZ(mo->floorz);
mo->SetZ(mo->floorz);
}
if (mo->Top() > mo->ceilingz)
{ // Do the same for the ceiling.
@ -3316,7 +3316,7 @@ void AActor::CheckPortalTransition(bool islinked)
while (!Sector->PortalBlocksMovement(sector_t::floor))
{
AActor *port = Sector->SkyBoxes[sector_t::floor];
if (_f_Z() < port->threshold && floorz < port->threshold)
if (_f_Z() < port->threshold && _f_floorz() < port->threshold)
{
fixedvec3 oldpos = _f_Pos();
if (islinked && !moved) UnlinkFromWorld();
@ -3724,16 +3724,16 @@ void AActor::Tick ()
// [RH] If standing on a steep slope, fall down it
if ((flags & MF_SOLID) && !(flags & (MF_NOCLIP|MF_NOGRAVITY)) &&
!(flags & MF_NOBLOCKMAP) &&
_f_velz() <= 0 &&
floorz == _f_Z())
Vel.Z <= 0 &&
floorz == Z())
{
secplane_t floorplane;
// Check 3D floors as well
floorplane = P_FindFloorPlane(floorsector, _f_X(), _f_Y(), floorz);
floorplane = P_FindFloorPlane(floorsector, _f_X(), _f_Y(), _f_floorz());
if (floorplane.c < STEEPSLOPE &&
floorplane.ZatPoint (PosRelative(floorsector)) <= floorz)
floorplane.ZatPoint (PosRelative(floorsector)) <= _f_floorz())
{
const msecnode_t *node;
bool dopush = true;
@ -3791,7 +3791,7 @@ void AActor::Tick ()
}
}
if (Vel.Z != 0 || BlockingMobj || _f_Z() != floorz)
if (Vel.Z != 0 || BlockingMobj || Z() != floorz)
{ // Handle Z velocity and gravity
if (((flags2 & MF2_PASSMOBJ) || (flags & MF_SPECIAL)) && !(i_compatflags & COMPATF_NO_PASSMOBJ))
{
@ -3860,7 +3860,7 @@ void AActor::Tick ()
if (ObjectFlags & OF_EuthanizeMe)
return; // actor was destroyed
}
else if (_f_Z() <= floorz)
else if (Z() <= floorz)
{
Crash();
}
@ -4001,7 +4001,7 @@ void AActor::CheckSectorTransition(sector_t *oldsec)
}
Sector->SecActTarget->TriggerAction(this, act);
}
if (_f_Z() == floorz)
if (Z() == floorz)
{
P_CheckFor3DFloorHit(this);
}
@ -4195,14 +4195,15 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t
actor->ClearInterpolation();
actor->dropoffz = // killough 11/98: for tracking dropoffs
actor->floorz = actor->Sector->floorplane.ZatPoint (ix, iy);
actor->Sector->floorplane.ZatPoint (ix, iy);
actor->floorz = FIXED2DBL(actor->dropoffz);
actor->ceilingz = FIXED2DBL(actor->Sector->ceilingplane.ZatPoint (ix, iy));
// The z-coordinate needs to be set once before calling P_FindFloorCeiling
// For FLOATRANDZ just use the floor here.
if (iz == ONFLOORZ || iz == FLOATRANDZ)
{
actor->_f_SetZ(actor->floorz, false);
actor->SetZ(actor->floorz);
}
else if (iz == ONCEILINGZ)
{
@ -4245,7 +4246,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t
if (iz == ONFLOORZ)
{
actor->_f_SetZ(actor->floorz);
actor->SetZ(actor->floorz);
}
else if (iz == ONCEILINGZ)
{
@ -4253,15 +4254,15 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t
}
else if (iz == FLOATRANDZ)
{
fixed_t space = actor->_f_ceilingz() - actor->height - actor->floorz;
if (space > 48*FRACUNIT)
double space = actor->ceilingz - actor->_Height() - actor->floorz;
if (space > 48)
{
space -= 40*FRACUNIT;
actor->_f_SetZ(MulScale8 (space, rng()) + actor->floorz + 40*FRACUNIT);
space -= 40;
actor->SetZ( space * rng() / 256. + actor->floorz + 40);
}
else
{
actor->_f_SetZ(actor->floorz);
actor->SetZ(actor->floorz);
}
}
else
@ -5595,7 +5596,7 @@ bool P_HitWater (AActor * thing, sector_t * sec, fixed_t x, fixed_t y, fixed_t z
}
}
planez = rover->bottom.plane->ZatPoint(x, y);
if (planez < z && !(planez < thing->floorz)) return false;
if (planez < z && !(planez < thing->_f_floorz())) return false;
}
}
hsec = sec->GetHeightSec();
@ -5617,7 +5618,7 @@ foundone:
return Terrains[terrainnum].IsLiquid;
// don't splash when touching an underwater floor
if (thing->waterlevel>=1 && z<=thing->floorz) return Terrains[terrainnum].IsLiquid;
if (thing->waterlevel>=1 && z<=thing->_f_floorz()) return Terrains[terrainnum].IsLiquid;
plane = hsec != NULL? &sec->heightsec->floorplane : &sec->floorplane;
@ -5746,13 +5747,13 @@ void P_CheckSplash(AActor *self, double distance)
{
sector_t *floorsec;
self->Sector->_f_LowestFloorAt(self, &floorsec);
if (self->_f_Z() <= self->floorz + FLOAT2FIXED(distance) && self->floorsector == floorsec && self->Sector->GetHeightSec() == NULL && floorsec->heightsec == NULL)
if (self->Z() <= self->floorz + distance && self->floorsector == floorsec && self->Sector->GetHeightSec() == NULL && floorsec->heightsec == NULL)
{
// Explosion splashes never alert monsters. This is because A_Explode has
// a separate parameter for that so this would get in the way of proper
// behavior.
fixedvec3 pos = self->PosRelative(floorsec);
P_HitWater (self, floorsec, pos.x, pos.y, self->floorz, false, false);
P_HitWater (self, floorsec, pos.x, pos.y, self->_f_floorz(), false, false);
}
}
@ -6204,9 +6205,9 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
z += 4*FRACUNIT;
}
// Do not fire beneath the floor.
if (z < source->floorz)
if (z < source->_f_floorz())
{
z = source->floorz;
z = source->_f_floorz();
}
}
fixedvec2 pos = source->Vec2Offset(x, y);
@ -6697,7 +6698,7 @@ void PrintMiscActorInfo(AActor *query)
Printf("\nTID: %d", query->tid);
Printf("\nCoord= x: %f, y: %f, z:%f, floor:%f, ceiling:%f.",
query->X(), query->Y(), query->Z(),
FIXED2DBL(query->floorz), query->ceilingz);
FIXED2DBL(query->_f_floorz()), query->ceilingz);
Printf("\nSpeed= %f, velocity= x:%f, y:%f, z:%f, combined:%f.\n",
query->Speed, query->Vel.X, query->Vel.Y, query->Vel.Z, query->Vel.Length());
}

View file

@ -2296,7 +2296,7 @@ void DPusher::Tick ()
{
if (hsec == NULL)
{ // NOT special water sector
if (thing->_f_Z() > thing->floorz) // above ground
if (thing->Z() > thing->floorz) // above ground
{
pushvel = m_PushVec; // full force
}

View file

@ -924,6 +924,10 @@ inline void P_SpawnTeleportFog(AActor *mobj, const fixedvec3 &pos, bool beforeTe
{
P_SpawnTeleportFog(mobj, pos.x, pos.y, pos.z, beforeTele, setTarget);
}
inline void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele = true, bool setTarget = false)
{
P_SpawnTeleportFog(mobj, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), beforeTele, setTarget);
}
bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, int flags); // bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false
bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int flags);
bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse);

View file

@ -112,7 +112,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, i
double missilespeed = 0;
old = thing->_f_Pos();
aboveFloor = thing->_f_Z() - thing->floorz;
aboveFloor = thing->_f_Z() - thing->_f_floorz();
destsect = P_PointInSector (x, y);
// killough 5/12/98: exclude voodoo dolls:
player = thing->player;
@ -489,7 +489,7 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
bool stepdown = l->frontsector->floorplane.ZatPoint(x, y) < l->backsector->floorplane.ZatPoint(x, y);
// Height of thing above ground
fixed_t z = thing->_f_Z() - thing->floorz;
fixed_t z = thing->_f_Z() - thing->_f_floorz();
// Side to exit the linedef on positionally.
//

View file

@ -721,7 +721,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
xofs + FixedMul(rad, finecosine[fineangle]),
yofs + FixedMul(rad, finesine[fineangle]),
0), true);
caller->_f_SetZ(caller->floorz + zofs);
caller->_f_SetZ(caller->_f_floorz() + zofs);
}
else
{
@ -736,7 +736,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
if (flags & WARPF_TOFLOOR)
{
caller->SetOrigin(xofs + FixedMul(rad, finecosine[fineangle]), yofs + FixedMul(rad, finesine[fineangle]), zofs, true);
caller->_f_SetZ(caller->floorz + zofs);
caller->_f_SetZ(caller->_f_floorz() + zofs);
}
else
{

View file

@ -768,7 +768,7 @@ void APlayerPawn::PostBeginPlay()
if (player == NULL || player->mo != this)
{
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS|FFCF_NOPORTALS);
_f_SetZ(floorz);
SetZ(floorz);
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS);
}
else
@ -1907,7 +1907,7 @@ void P_CalcHeight (player_t *player)
}
player->viewz = player->mo->_f_Z() + player->viewheight + FLOAT2FIXED(bob);
if (player->mo->floorclip && player->playerstate != PST_DEAD
&& player->mo->_f_Z() <= player->mo->floorz)
&& player->mo->Z() <= player->mo->floorz)
{
player->viewz -= player->mo->floorclip;
}
@ -1915,9 +1915,9 @@ void P_CalcHeight (player_t *player)
{
player->viewz = player->mo->_f_ceilingz() - 4*FRACUNIT;
}
if (player->viewz < player->mo->floorz + 4*FRACUNIT)
if (player->viewz < player->mo->_f_floorz() + 4*FRACUNIT)
{
player->viewz = player->mo->floorz + 4*FRACUNIT;
player->viewz = player->mo->_f_floorz() + 4*FRACUNIT;
}
}
@ -1950,7 +1950,7 @@ void P_MovePlayer (player_t *player)
mo->Angles.Yaw += cmd->ucmd.yaw * (360./65536.);
}
player->onground = (mo->_f_Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
player->onground = (mo->Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
// killough 10/98:
//
@ -2138,7 +2138,7 @@ void P_DeathThink (player_t *player)
P_MovePsprites (player);
player->onground = (player->mo->_f_Z() <= player->mo->floorz);
player->onground = (player->mo->Z() <= player->mo->floorz);
if (player->mo->IsKindOf (RUNTIME_CLASS(APlayerChunk)))
{ // Flying bloody skull or flying ice chunk
player->viewheight = 6 * FRACUNIT;
@ -3180,7 +3180,7 @@ void player_t::Serialize (FArchive &arc)
}
else
{
onground = (mo->_f_Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (cheats & CF_NOCLIP2);
onground = (mo->Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (cheats & CF_NOCLIP2);
}
if (SaveVersion < 4514 && IsBot)

View file

@ -1202,7 +1202,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
&& (!(ld->flags & ML_3DMIDTEX) ||
(!P_LineOpening_3dMidtex(mobj, ld, open) &&
(mobj->_f_Top() < open.top)
) || (open.abovemidtex && mobj->_f_Z() > mobj->floorz))
) || (open.abovemidtex && mobj->Z() > mobj->floorz))
)
{
// [BL] We can't just continue here since we must

View file

@ -599,7 +599,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_UnsetFloat)
//
//==========================================================================
static void DoAttack (AActor *self, bool domelee, bool domissile,
int MeleeDamage, FSoundID MeleeSound, PClassActor *MissileType,fixed_t MissileHeight)
int MeleeDamage, FSoundID MeleeSound, PClassActor *MissileType,double MissileHeight)
{
if (self->target == NULL) return;
@ -614,9 +614,10 @@ static void DoAttack (AActor *self, bool domelee, bool domissile,
else if (domissile && MissileType != NULL)
{
// This seemingly senseless code is needed for proper aiming.
self->_f_AddZ(MissileHeight + self->GetBobOffset() - 32*FRACUNIT);
double add = MissileHeight + FIXED2FLOAT(self->GetBobOffset()) - 32;
self->AddZ(add);
AActor *missile = P_SpawnMissileXYZ (self->PosPlusZ(32*FRACUNIT), self, self->target, MissileType, false);
self->_f_AddZ(-(MissileHeight + self->GetBobOffset() - 32*FRACUNIT));
self->AddZ(-add);
if (missile)
{
@ -643,8 +644,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MissileAttack)
{
PARAM_ACTION_PROLOGUE;
PClassActor *MissileType = PClass::FindActor(self->GetClass()->MissileName);
fixed_t MissileHeight = self->GetClass()->MissileHeight;
DoAttack(self, false, true, 0, 0, MissileType, MissileHeight);
DoAttack(self, false, true, 0, 0, MissileType, self->GetClass()->MissileHeight);
return 0;
}
@ -654,8 +654,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ComboAttack)
int MeleeDamage = self->GetClass()->MeleeDamage;
FSoundID MeleeSound = self->GetClass()->MeleeSound;
PClassActor *MissileType = PClass::FindActor(self->GetClass()->MissileName);
fixed_t MissileHeight = self->GetClass()->MissileHeight;
DoAttack(self, true, true, MeleeDamage, MeleeSound, MissileType, MissileHeight);
DoAttack(self, true, true, MeleeDamage, MeleeSound, MissileType, self->GetClass()->MissileHeight);
return 0;
}
@ -3364,7 +3363,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor)
PARAM_ACTION_PROLOGUE;
PARAM_STATE(jump);
if (self->_f_Z() <= self->floorz)
if (self->Z() <= self->floorz)
{
ACTION_RETURN_STATE(jump);
}
@ -4783,28 +4782,30 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
// of the spot.
if (flags & TF_SENSITIVEZ)
{
fixed_t posz = (flags & TF_USESPOTZ) ? spot->_f_Z() : spot->floorz;
if ((posz + ref->height > spot->_f_ceilingz()) || (posz < spot->floorz))
double posz = (flags & TF_USESPOTZ) ? spot->Z() : spot->floorz;
if ((posz + ref->_Height() > spot->ceilingz) || (posz < spot->floorz))
{
return numret;
}
}
fixedvec3 prev = ref->_f_Pos();
fixed_t aboveFloor = spot->_f_Z() - spot->floorz;
fixed_t finalz = spot->floorz + aboveFloor;
DVector3 prev = ref->Pos();
double aboveFloor = spot->Z() - spot->floorz;
double finalz = spot->floorz + aboveFloor;
if (spot->Z() + ref->_Height() > spot->ceilingz)
finalz = spot->_f_ceilingz() - ref->height;
else if (spot->_f_Z() < spot->floorz)
if (spot->Top() > spot->ceilingz)
finalz = spot->ceilingz - ref->_Height();
else if (spot->Z() < spot->floorz)
finalz = spot->floorz;
DVector3 tpos = spot->PosAtZ(finalz);
//Take precedence and cooperate with telefragging first.
bool tele_result = P_TeleportMove(ref, spot->_f_X(), spot->_f_Y(), finalz, !!(flags & TF_TELEFRAG));
bool tele_result = P_TeleportMove(ref, tpos, !!(flags & TF_TELEFRAG));
if (!tele_result && (flags & TF_FORCED))
{
//If for some reason the original move didn't work, regardless of telefrag, force it to move.
ref->SetOrigin(spot->_f_X(), spot->_f_Y(), finalz, false);
ref->SetOrigin(tpos, false);
tele_result = true;
}
@ -4829,17 +4830,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport)
if (!(flags & TF_NODESTFOG))
{
if (flags & TF_USEACTORFOG)
P_SpawnTeleportFog(ref, ref->_f_Pos(), false, true);
P_SpawnTeleportFog(ref, ref->Pos(), false, true);
else
{
fog2 = Spawn(fog_type, ref->_f_Pos(), ALLOW_REPLACE);
fog2 = Spawn(fog_type, ref->Pos(), ALLOW_REPLACE);
if (fog2 != NULL)
fog2->target = ref;
}
}
}
ref->_f_SetZ((flags & TF_USESPOTZ) ? spot->_f_Z() : ref->floorz, false);
ref->SetZ((flags & TF_USESPOTZ) ? spot->Z() : ref->floorz, false);
if (!(flags & TF_KEEPANGLE))
ref->Angles.Yaw = spot->Angles.Yaw;

View file

@ -623,7 +623,7 @@ void InitThingdef()
symt.AddSymbol(new PField(NAME_Angle, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Yaw)));
symt.AddSymbol(new PField(NAME_Args, array5, VARF_Native, myoffsetof(AActor,args)));
symt.AddSymbol(new PField(NAME_CeilingZ, TypeFloat64, VARF_Native, myoffsetof(AActor,ceilingz)));
symt.AddSymbol(new PField(NAME_FloorZ, TypeFixed, VARF_Native, myoffsetof(AActor,floorz)));
symt.AddSymbol(new PField(NAME_FloorZ, TypeFloat64, VARF_Native, myoffsetof(AActor,floorz)));
symt.AddSymbol(new PField(NAME_Health, TypeSInt32, VARF_Native, myoffsetof(AActor,health)));
symt.AddSymbol(new PField(NAME_Mass, TypeSInt32, VARF_Native, myoffsetof(AActor,Mass)));
symt.AddSymbol(new PField(NAME_Pitch, TypeFloat64, VARF_Native, myoffsetof(AActor,Angles.Pitch)));

View file

@ -993,7 +993,7 @@ DEFINE_PROPERTY(missiletype, S, Actor)
//==========================================================================
DEFINE_PROPERTY(missileheight, F, Actor)
{
PROP_FIXED_PARM(id, 0);
PROP_DOUBLE_PARM(id, 0);
assert(info->IsKindOf(RUNTIME_CLASS(PClassActor)));
static_cast<PClassActor *>(info)->MissileHeight = id;
}