- made AActor::floorclip a double.

This commit is contained in:
Christoph Oelckers 2016-03-20 23:42:27 +01:00
parent afa5f22b31
commit 289cdfbefd
26 changed files with 132 additions and 121 deletions

View File

@ -895,6 +895,11 @@ public:
return VecToAngle(otherpos.y + oxofs - _f_Y(), otherpos.x + oyofs - _f_X());
}
DAngle AngleTo(AActor *other, double oxofs, double oyofs, bool absolute = false) const
{
return FIXED2DBL(AngleTo(other, FLOAT2FIXED(oxofs), FLOAT2FIXED(oyofs), absolute));
}
fixedvec2 _f_Vec2To(AActor *other) const
{
fixedvec3 otherpos = other->PosRelative(this);
@ -1184,7 +1189,12 @@ public:
FNameNoInit Species; // For monster families
TObjPtr<AActor> tracer; // Thing being chased/attacked for tracers
TObjPtr<AActor> master; // Thing which spawned this one (prevents mutual attacks)
fixed_t floorclip; // value to use for floor clipping
double Floorclip; // value to use for floor clipping
fixed_t _f_floorclip()
{
return FLOAT2FIXED(Floorclip);
}
int tid; // thing identifier
int special; // special
int args[5]; // special arguments

View File

@ -70,7 +70,7 @@ IMPLEMENT_CLASS (AArtiTimeBomb)
bool AArtiTimeBomb::Use (bool pickup)
{
AActor *mo = Spawn("ActivatedTimeBomb",
Owner->Vec3Angle(24., Owner->Angles.Yaw, - FIXED2FLOAT(Owner->floorclip)), ALLOW_REPLACE);
Owner->Vec3Angle(24., Owner->Angles.Yaw, - Owner->Floorclip), ALLOW_REPLACE);
mo->target = Owner;
return true;
}

View File

@ -401,7 +401,7 @@ void FireMacePL1B (AActor *actor)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
ball = Spawn("MaceFX2", actor->PosPlusZ(28*FRACUNIT - actor->floorclip), ALLOW_REPLACE);
ball = Spawn("MaceFX2", actor->PosPlusZ(28 - actor->Floorclip), ALLOW_REPLACE);
ball->Vel.Z = 2 - player->mo->Angles.Pitch.TanClamped();
ball->target = actor;
ball->Angles.Yaw = actor->Angles.Yaw;
@ -1052,10 +1052,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
{ // Fudge rain frequency
return 0;
}
fixedvec2 pos = self->Vec2Offset(
((pr_storm()&127) - 64) * FRACUNIT,
((pr_storm()&127) - 64) * FRACUNIT);
mo = Spawn<ARainPillar> (pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE);
double xo = ((pr_storm() & 127) - 64);
double yo = ((pr_storm() & 127) - 64);
DVector3 pos = self->Vec2OffsetZ(xo, yo, ONCEILINGZ);
mo = Spawn<ARainPillar> (pos, ALLOW_REPLACE);
// We used bouncecount to store the 3D floor index in A_HideInCeiling
if (!mo) return 0;
if (mo->Sector->PortalGroup != self->Sector->PortalGroup)
@ -1064,16 +1064,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
mo->Destroy();
return 0;
}
fixed_t newz;
if (self->bouncecount >= 0 && (unsigned)self->bouncecount < self->Sector->e->XFloor.ffloors.Size())
newz = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPoint(mo);// - 40 * FRACUNIT;
pos.Z = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPointF(mo);// - 40 * FRACUNIT;
else
newz = self->Sector->ceilingplane.ZatPoint(mo);
int moceiling = P_Find3DFloor(NULL, pos.x, pos.y, newz, false, false, newz);
if (moceiling >= 0)
mo->_f_SetZ(newz - mo->_f_height(), false);
mo->Translation = multiplayer ?
TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0;
pos.Z = self->Sector->ceilingplane.ZatPointF(mo);
int moceiling = P_Find3DFloor(NULL, pos, false, false, pos.Z);
if (moceiling >= 0) mo->SetZ(pos.Z - mo->Height);
mo->Translation = multiplayer ? TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0;
mo->target = self->target;
mo->Vel.X = MinVel; // Force collision detection
mo->Vel.Z = -mo->Speed;
@ -1117,15 +1114,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
PARAM_ACTION_PROLOGUE;
// We use bouncecount to store the 3D floor index
fixed_t foo;
for (unsigned int i=0; i< self->Sector->e->XFloor.ffloors.Size(); i++)
double foo;
for (int i = self->Sector->e->XFloor.ffloors.Size() - 1; i >= 0; i--)
{
F3DFloor * rover = self->Sector->e->XFloor.ffloors[i];
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if ((foo = rover->bottom.plane->ZatPoint(self)) >= (self->_f_Top()))
if ((foo = rover->bottom.plane->ZatPointF(self)) >= self->Top())
{
self->_f_SetZ(foo + 4*FRACUNIT, false);
self->SetZ(foo + 4, false);
self->bouncecount = i;
return 0;
}
@ -1320,7 +1317,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
slope = -self->Angles.Pitch.TanClamped();
double xo = pr_fp2.Random2() / 128.;
double yo = pr_fp2.Random2() / 128.;
DVector3 pos = self->Vec3Offset(xo, yo, 26 + slope - FIXED2FLOAT(self->floorclip));
DVector3 pos = self->Vec3Offset(xo, yo, 26 + slope - self->Floorclip);
slope += 0.1;
mo = Spawn("PhoenixFX2", pos, ALLOW_REPLACE);

View File

@ -26,7 +26,7 @@ void BlastActor (AActor *victim, fixed_t strength, double speed, AActor *Owner,
{
DAngle angle;
AActor *mo;
fixedvec3 pos;
DVector3 pos;
if (!victim->SpecialBlastHandling (Owner, strength))
{
@ -41,9 +41,9 @@ void BlastActor (AActor *victim, fixed_t strength, double speed, AActor *Owner,
// Spawn blast puff
angle -= 180.;
pos = victim->Vec3Offset(
fixed_t((victim->_f_radius() + FRACUNIT) * angle.Cos()),
fixed_t((victim->_f_radius() + FRACUNIT) * angle.Sin()),
-victim->floorclip + (victim->_f_height()>>1));
(victim->radius + 1) * angle.Cos(),
(victim->radius + 1) * angle.Sin(),
(victim->Height / 2) - victim->Floorclip);
mo = Spawn (blasteffect, pos, ALLOW_REPLACE);
if (mo)
{

View File

@ -43,9 +43,9 @@ bool AArtiPoisonBag1::Use (bool pickup)
AActor *mo;
mo = Spawn("PoisonBag", Owner->Vec3Offset(
16*finecosine[angle],
24*finesine[angle],
-Owner->floorclip+8*FRACUNIT), ALLOW_REPLACE);
16 * Owner->Angles.Yaw.Cos(),
24 * Owner->Angles.Yaw.Sin(),
-Owner->Floorclip + 8), ALLOW_REPLACE);
if (mo)
{
mo->target = Owner;
@ -71,9 +71,9 @@ bool AArtiPoisonBag2::Use (bool pickup)
AActor *mo;
mo = Spawn("FireBomb", Owner->Vec3Offset(
16*finecosine[angle],
24*finesine[angle],
-Owner->floorclip+8*FRACUNIT), ALLOW_REPLACE);
16 * Owner->Angles.Yaw.Cos(),
24 * Owner->Angles.Yaw.Sin(),
-Owner->Floorclip + 8), ALLOW_REPLACE);
if (mo)
{
mo->target = Owner;
@ -97,7 +97,7 @@ bool AArtiPoisonBag3::Use (bool pickup)
{
AActor *mo;
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->_f_floorclip()+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
if (mo)
{
mo->Angles.Yaw = Owner->Angles.Yaw + (((pr_poisonbag() & 7) - 4) * (360./256.));

View File

@ -242,7 +242,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
self->args[4] = SORCBALL_INITIAL_SPEED; // Initial orbit speed
self->special1 = ANGLE_1;
fixedvec3 pos = self->PosPlusZ(-self->floorclip + self->_f_height());
DVector3 pos = self->PosPlusZ(-self->Floorclip + self->Height);
mo = Spawn("SorcBall1", pos, NO_REPLACE);
if (mo)
@ -378,7 +378,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
fixedvec3 pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
-parent->floorclip + parent->_f_height());
-parent->_f_floorclip() + parent->_f_height());
actor->SetOrigin (pos, true);
actor->floorz = parent->floorz;
actor->ceilingz = parent->ceilingz;
@ -551,7 +551,7 @@ void ASorcBall2::CastSorcererSpell ()
AActor *parent = target;
AActor *mo;
mo = Spawn("SorcFX2", PosPlusZ(-parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT), ALLOW_REPLACE);
mo = Spawn("SorcFX2", PosPlusZ(-parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT), ALLOW_REPLACE);
parent->flags2 |= MF2_REFLECTIVE|MF2_INVULNERABLE;
parent->args[0] = SORC_DEFENSE_TIME;
if (mo) mo->target = parent;
@ -714,7 +714,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnFizzle)
AActor *mo;
int ix;
fixedvec3 pos = self->_f_Vec3Angle(dist, self->_f_angle(), -self->floorclip + (self->_f_height() >> 1));
fixedvec3 pos = self->_f_Vec3Angle(dist, self->_f_angle(), -self->_f_floorclip() + (self->_f_height() >> 1));
for (ix=0; ix<5; ix++)
{
mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE);
@ -839,7 +839,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT);
parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT);
pos.z += FixedMul(15*FRACUNIT,finecosine[angle]);
// Spawn trailer
Spawn("SorcFX2T1", pos, ALLOW_REPLACE);
@ -851,7 +851,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT);
parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT);
pos.z += FixedMul(20*FRACUNIT,finesine[angle]);
// Spawn trailer
Spawn("SorcFX2T1", pos, ALLOW_REPLACE);

View File

@ -335,7 +335,7 @@ void KoraxFire (AActor *actor, PClassActor *type, int arm)
fixedvec3 pos = actor->Vec3Offset(
extension[arm] * finecosine[ang],
extension[arm] * finesine[ang],
-actor->floorclip + armheight[arm]);
-actor->_f_floorclip() + armheight[arm]);
P_SpawnKoraxMissile (pos.x, pos.y, pos.z, actor, actor->target, type);
}
@ -505,7 +505,7 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
DAngle an;
int dist;
z -= source->floorclip;
z -= source->_f_floorclip();
th = Spawn (type, x, y, z, ALLOW_REPLACE);
th->target = source; // Originator
an = th->AngleTo(dest);

View File

@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentUnHide)
PARAM_ACTION_PROLOGUE;
self->renderflags &= ~RF_INVISIBLE;
self->floorclip = 24*FRACUNIT;
self->Floorclip = 24;
return 0;
}
@ -43,7 +43,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentHide)
PARAM_ACTION_PROLOGUE;
self->renderflags |= RF_INVISIBLE;
self->floorclip = 0;
self->Floorclip = 0;
return 0;
}
@ -58,7 +58,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentRaiseHump)
{
PARAM_ACTION_PROLOGUE;
self->floorclip -= 4*FRACUNIT;
self->Floorclip -= 4;
return 0;
}
@ -72,7 +72,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentLowerHump)
{
PARAM_ACTION_PROLOGUE;
self->floorclip += 4*FRACUNIT;
self->Floorclip += 4;
return 0;
}
@ -236,7 +236,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentSpawnGibs)
{
mo->Vel.X = (pr_serpentgibs() - 128) / 1024.f;
mo->Vel.Y = (pr_serpentgibs() - 128) / 1024.f;
mo->floorclip = 6*FRACUNIT;
mo->Floorclip = 6;
}
}
return 0;
@ -252,7 +252,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FloatGib)
{
PARAM_ACTION_PROLOGUE;
self->floorclip -= FRACUNIT;
self->Floorclip -= 1;
return 0;
}
@ -266,7 +266,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SinkGib)
{
PARAM_ACTION_PROLOGUE;
self->floorclip += FRACUNIT;
self->Floorclip += 1;;
return 0;
}

View File

@ -82,7 +82,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustInitUp)
self->special2 = 5; // Raise speed
self->args[0] = 1; // Mark as up
self->floorclip = 0;
self->Floorclip = 0;
self->flags = MF_SOLID;
self->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
self->special1 = 0L;
@ -95,7 +95,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustInitDn)
self->special2 = 5; // Raise speed
self->args[0] = 0; // Mark as down
self->floorclip = self->GetDefault()->_f_height();
self->Floorclip = self->GetDefault()->Height;
self->flags = 0;
self->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
self->renderflags = RF_INVISIBLE;
@ -111,7 +111,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustRaise)
AThrustFloor *actor = static_cast<AThrustFloor *>(self);
if (A_RaiseMobj (actor, self->special2*FRACUNIT))
if (A_RaiseMobj (actor, self->special2))
{ // Reached it's target height
actor->args[0] = 1;
if (actor->args[1])
@ -121,7 +121,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustRaise)
}
// Lose the dirt clump
if ((actor->floorclip < actor->_f_height()) && actor->DirtClump)
if ((actor->Floorclip < actor->Height) && actor->DirtClump)
{
actor->DirtClump->Destroy ();
actor->DirtClump = NULL;
@ -138,7 +138,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustLower)
{
PARAM_ACTION_PROLOGUE;
if (A_SinkMobj (self, 6*FRACUNIT))
if (A_SinkMobj (self, 6))
{
self->args[0] = 0;
if (self->args[1])

View File

@ -57,7 +57,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithRaiseInit)
self->flags2 &= ~MF2_NONSHOOTABLE;
self->flags3 &= ~MF3_DONTBLAST;
self->flags |= MF_SHOOTABLE|MF_SOLID;
self->floorclip = self->_f_height();
self->Floorclip = self->Height;
return 0;
}
@ -137,7 +137,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX2)
mo->Vel.Y = ((pr_wraithfx2() << 7) + 1) * angle.Sin();
mo->Vel.Z = 0;
mo->target = self;
mo->floorclip = 10*FRACUNIT;
mo->Floorclip = 10;
}
}
return 0;
@ -253,7 +253,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithChase)
int weaveindex = self->special1;
self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->special1 = (weaveindex + 2) & 63;
// if (self->floorclip > 0)
// if (self->Floorclip > 0)
// {
// P_SetMobjState(self, S_WRAITH_RAISE2);
// return;

View File

@ -1253,7 +1253,7 @@ void G_FinishTravel ()
pawn->floorterrain = pawndup->floorterrain;
pawn->ceilingsector = pawndup->ceilingsector;
pawn->ceilingpic = pawndup->ceilingpic;
pawn->floorclip = pawndup->floorclip;
pawn->Floorclip = pawndup->Floorclip;
pawn->waterlevel = pawndup->waterlevel;
}
else

View File

@ -355,7 +355,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk3)
}
else
{
if (self->floorclip > 0 && (i_compatflags & COMPATF_MINOTAUR))
if (self->Floorclip > 0 && (i_compatflags & COMPATF_MINOTAUR))
{
// only play the sound.
S_Sound (self, CHAN_WEAPON, "minotaur/fx2hit", 1, ATTN_NORM);

View File

@ -142,7 +142,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_UnSetFloorClip)
PARAM_ACTION_PROLOGUE;
self->flags2 &= ~MF2_FLOORCLIP;
self->floorclip = 0;
self->Floorclip = 0;
return 0;
}

View File

@ -1261,10 +1261,10 @@ void APowerSpeed::DoEffect ()
}
}
if (P_AproxDistance (Owner->_f_velx(), Owner->_f_vely()) <= 12*FRACUNIT)
if (Owner->Vel.LengthSquared() <= 12*12)
return;
AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->_f_Pos(), NO_REPLACE);
AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->Pos(), NO_REPLACE);
if (speedMo)
{
speedMo->Angles.Yaw = Owner->Angles.Yaw;
@ -1272,7 +1272,7 @@ void APowerSpeed::DoEffect ()
speedMo->target = Owner;
speedMo->sprite = Owner->sprite;
speedMo->frame = Owner->frame;
speedMo->floorclip = Owner->floorclip;
speedMo->Floorclip = Owner->Floorclip;
// [BC] Also get the scale from the owner.
speedMo->Scale = Owner->Scale;

View File

@ -147,6 +147,13 @@ inline int P_Find3DFloor(sector_t * sec, const fixedvec3 &pos, bool above, bool
{
return P_Find3DFloor(sec, pos.x, pos.y, pos.z, above, floor, cmpz);
}
inline int P_Find3DFloor(sector_t * sec, const DVector3 &pos, bool above, bool floor, double &cmpz)
{
fixed_t fr = FLOAT2FIXED(cmpz);
int ret = P_Find3DFloor(sec, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), above, floor, fr);
cmpz = FIXED2DBL(fr);
return ret;
}
#endif

View File

@ -4769,7 +4769,7 @@ static bool DoSpawnDecal(AActor *actor, const FDecalTemplate *tpl, int flags, an
angle += actor->_f_angle();
}
return NULL != ShootDecal(tpl, actor, actor->Sector, actor->_f_X(), actor->_f_Y(),
actor->_f_Z() + (actor->_f_height()>>1) - actor->floorclip + actor->GetBobOffset() + zofs,
actor->_f_Z() + (actor->_f_height()>>1) - actor->_f_floorclip() + actor->GetBobOffset() + zofs,
angle, distance, !!(flags & SDF_PERMANENT));
}

View File

@ -2998,14 +2998,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
if (t.linetarget == NULL)
{
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
fixedvec2 pos = self->_f_Vec2To(self->target);
DVector2 xydiff(pos.x, pos.y);
double zdiff = (self->target->_f_Z() + (self->target->_f_height()>>1)) - (self->_f_Z() + (self->_f_height()>>1) - self->floorclip);
DVector2 xydiff = self->Vec2To(self->target);
double zdiff = self->target->Center() - self->Center() - self->Floorclip;
self->Angles.Pitch = -VecToAngle(xydiff.Length(), zdiff);
}
// Let the aim trail behind the player
self->Angles.Yaw = self->AngleTo(self->target, -self->target->_f_velx() * 3, -self->target->_f_vely() * 3);
self->Angles.Yaw = self->AngleTo(self->target, -self->target->Vel.X * 3, -self->target->Vel.Y * 3);
if (self->target->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE))
{
@ -3481,11 +3480,11 @@ int P_Massacre ()
// Sink a mobj incrementally into the floor
//
bool A_SinkMobj (AActor *actor, fixed_t speed)
bool A_SinkMobj (AActor *actor, double speed)
{
if (actor->floorclip < actor->_f_height())
if (actor->Floorclip < actor->Height)
{
actor->floorclip += speed;
actor->Floorclip += speed;
return false;
}
return true;
@ -3496,17 +3495,17 @@ bool A_SinkMobj (AActor *actor, fixed_t speed)
// Raise a mobj incrementally from the floor to
//
bool A_RaiseMobj (AActor *actor, fixed_t speed)
bool A_RaiseMobj (AActor *actor, double speed)
{
bool done = true;
// Raise a mobj from the ground
if (actor->floorclip > 0)
if (actor->Floorclip > 0)
{
actor->floorclip -= speed;
if (actor->floorclip <= 0)
actor->Floorclip -= speed;
if (actor->Floorclip <= 0)
{
actor->floorclip = 0;
actor->Floorclip = 0;
done = true;
}
else

View File

@ -75,8 +75,8 @@ void A_Chase(VMFrameStack *stack, AActor *self);
void A_FaceTarget(AActor *actor);
void A_Face(AActor *self, AActor *other, angle_t max_turn = 0, angle_t max_pitch = ANGLE_270, angle_t ang_offset = 0, angle_t pitch_offset = 0, int flags = 0, fixed_t z_add = 0);
bool A_RaiseMobj (AActor *, fixed_t speed);
bool A_SinkMobj (AActor *, fixed_t speed);
bool A_RaiseMobj (AActor *, double speed);
bool A_SinkMobj (AActor *, double speed);
bool CheckBossDeath (AActor *);
int P_Massacre ();

View File

@ -4027,7 +4027,7 @@ struct aim_t
DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLineTarget *pLineTarget, DAngle vrange,
int flags, AActor *target, AActor *friender)
{
fixed_t shootz = t1->_f_Z() + (t1->_f_height() >> 1) - t1->floorclip;
fixed_t shootz = t1->_f_Z() + (t1->_f_height() >> 1) - t1->_f_floorclip();
if (t1->player != NULL)
{
shootz += fixed_t(t1->player->mo->AttackZOffset * t1->player->crouchfactor);
@ -4172,7 +4172,7 @@ AActor *P_LineAttack(AActor *t1, DAngle angle, double distance,
vy = FLOAT2FIXED(pc * angle.Sin());
vz = FLOAT2FIXED(-pitch.Sin());
shootz = t1->_f_Z() - t1->floorclip + (t1->_f_height() >> 1);
shootz = t1->_f_Z() - t1->_f_floorclip() + (t1->_f_height() >> 1);
if (t1->player != NULL)
{
shootz += fixed_t(t1->player->mo->AttackZOffset * t1->player->crouchfactor);
@ -4434,7 +4434,7 @@ AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch,
vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = -finesine[pitch];
shootz = t1->_f_Z() - t1->floorclip + (t1->_f_height() >> 1);
shootz = t1->_f_Z() - t1->_f_floorclip() + (t1->_f_height() >> 1);
if (t1->player != NULL)
{
shootz += fixed_t(t1->player->mo->AttackZOffset * t1->player->crouchfactor);
@ -4705,7 +4705,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = finesine[pitch];
shootz = source->_f_Z() - source->floorclip + (source->_f_height() >> 1) + offset_z;
shootz = source->_f_Z() - source->_f_floorclip() + (source->_f_height() >> 1) + offset_z;
if (!(railflags & RAF_CENTERZ))
{
@ -4874,7 +4874,7 @@ void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camera
vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = finesine[pitch];
sz = t1->_f_Z() - t1->floorclip + t1->_f_height() + (fixed_t)(clamp<double>(chase_height, -1000, 1000) * FRACUNIT);
sz = t1->_f_Z() - t1->_f_floorclip() + t1->_f_height() + (fixed_t)(clamp<double>(chase_height, -1000, 1000) * FRACUNIT);
if (Trace(t1->_f_X(), t1->_f_Y(), sz, t1->Sector,
vx, vy, vz, distance, 0, 0, NULL, trace) &&

View File

@ -320,7 +320,7 @@ void AActor::Serialize(FArchive &arc)
}
arc << skillrespawncount
<< tracer
<< floorclip
<< Floorclip
<< tid
<< special;
if (P_IsACSSpecial(special))
@ -4278,7 +4278,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t
}
else
{
actor->floorclip = 0;
actor->Floorclip = 0;
}
actor->UpdateWaterLevel (actor->_f_Z(), false);
if (!SpawningMapThing)
@ -4519,12 +4519,12 @@ void AActor::AdjustFloorClip ()
return;
}
fixed_t oldclip = floorclip;
fixed_t shallowestclip = FIXED_MAX;
double oldclip = _f_floorclip();
double shallowestclip = INT_MAX;
const msecnode_t *m;
// possibly standing on a 3D-floor
if (Sector->e->XFloor.ffloors.Size() && _f_Z() > Sector->floorplane.ZatPoint(this)) floorclip = 0;
if (Sector->e->XFloor.ffloors.Size() && Z() > Sector->floorplane.ZatPointF(this)) Floorclip = 0;
// [RH] clip based on shallowest floor player is standing on
// If the sector has a deep water effect, then let that effect
@ -4535,24 +4535,24 @@ void AActor::AdjustFloorClip ()
sector_t *hsec = m->m_sector->GetHeightSec();
if (hsec == NULL && m->m_sector->floorplane.ZatPoint (pos) == _f_Z())
{
fixed_t clip = Terrains[m->m_sector->GetTerrain(sector_t::floor)].FootClip;
double clip = Terrains[m->m_sector->GetTerrain(sector_t::floor)].FootClip;
if (clip < shallowestclip)
{
shallowestclip = clip;
}
}
}
if (shallowestclip == FIXED_MAX)
if (shallowestclip == INT_MAX)
{
floorclip = 0;
Floorclip = 0;
}
else
{
floorclip = shallowestclip;
Floorclip = shallowestclip;
}
if (player && player->mo == this && oldclip != floorclip)
if (player && player->mo == this && oldclip != Floorclip)
{
player->viewheight -= oldclip - floorclip;
player->viewheight -= FLOAT2FIXED(oldclip - Floorclip);
player->deltaviewheight = player->GetDeltaViewHeight();
}
}
@ -5637,7 +5637,7 @@ foundone:
if (smallsplash && splash->SmallSplash)
{
mo = Spawn (splash->SmallSplash, x, y, z, ALLOW_REPLACE);
if (mo) mo->floorclip += splash->SmallSplashClip;
if (mo) mo->Floorclip += FIXED2DBL(splash->SmallSplashClip);
}
else
{
@ -5928,7 +5928,7 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
if (z != ONFLOORZ && z != ONCEILINGZ)
{
z -= source->floorclip;
z -= source->_f_floorclip();
}
AActor *th = Spawn (type, x, y, z, ALLOW_REPLACE);
@ -6094,7 +6094,7 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
if (z != ONFLOORZ && z != ONCEILINGZ)
{
z -= source->floorclip;
z -= source->_f_floorclip();
}
mo = Spawn (type, source->_f_X(), source->_f_Y(), z, ALLOW_REPLACE);
@ -6196,7 +6196,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
if (z != ONFLOORZ && z != ONCEILINGZ)
{
// Doom spawns missiles 4 units lower than hitscan attacks for players.
z += source->_f_Z() + (source->_f_height()>>1) - source->floorclip;
z += source->_f_Z() + (source->_f_height()>>1) - source->_f_floorclip();
if (source->player != NULL) // Considering this is for player missiles, it better not be NULL.
{
z += fixed_t ((source->player->mo->AttackZOffset - 4*FRACUNIT) * source->player->crouchfactor);

View File

@ -213,7 +213,7 @@ static FGenericParse TerrainParser[] =
{ GEN_Int, {myoffsetof(FTerrainDef, DamageAmount)} },
{ GEN_Custom, {(size_t)ParseDamage} },
{ GEN_Int, {myoffsetof(FTerrainDef, DamageTimeMask)} },
{ GEN_Fixed, {myoffsetof(FTerrainDef, FootClip)} },
{ GEN_Double, {myoffsetof(FTerrainDef, FootClip)} },
{ GEN_Float, {myoffsetof(FTerrainDef, StepVolume)} },
{ GEN_Time, {myoffsetof(FTerrainDef, WalkStepTics)} },
{ GEN_Time, {myoffsetof(FTerrainDef, RunStepTics)} },

View File

@ -107,7 +107,7 @@ struct FTerrainDef
int DamageAmount;
FName DamageMOD;
int DamageTimeMask;
fixed_t FootClip;
double FootClip;
float StepVolume;
int WalkStepTics;
int RunStepTics;

View File

@ -232,7 +232,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
}
else if (z != ONFLOORZ)
{
z -= spot->floorclip;
z -= spot->_f_floorclip();
}
mobj = Spawn (kind, spot->_f_X(), spot->_f_Y(), z, ALLOW_REPLACE);

View File

@ -1906,10 +1906,10 @@ void P_CalcHeight (player_t *player)
bob = 0;
}
player->viewz = player->mo->_f_Z() + player->viewheight + FLOAT2FIXED(bob);
if (player->mo->floorclip && player->playerstate != PST_DEAD
if (player->mo->Floorclip && player->playerstate != PST_DEAD
&& player->mo->Z() <= player->mo->floorz)
{
player->viewz -= player->mo->floorclip;
player->viewz -= player->mo->_f_floorclip();
}
if (player->viewz > player->mo->_f_ceilingz() - 4*FRACUNIT)
{

View File

@ -920,7 +920,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
{
xscale = FixedMul(spritescaleX, voxel->Scale);
yscale = FixedMul(spritescaleY, voxel->Scale);
gzt = fz + MulScale8(yscale, voxel->Voxel->Mips[0].PivotZ) - thing->floorclip;
gzt = fz + MulScale8(yscale, voxel->Voxel->Mips[0].PivotZ) - FLOAT2FIXED(thing->Floorclip);
gzb = fz + MulScale8(yscale, voxel->Voxel->Mips[0].PivotZ - (voxel->Voxel->Mips[0].SizeZ << 8));
if (gzt <= gzb)
return;
@ -996,8 +996,8 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
vis->xscale = xscale;
vis->yscale = Scale(InvZtoScale, yscale, tz << 4);
vis->idepth = (unsigned)DivScale32(1, tz) >> 1; // tz is 20.12, so idepth ought to be 12.20, but signed math makes it 13.19
vis->floorclip = FixedDiv (thing->floorclip, yscale);
vis->texturemid = (tex->TopOffset << FRACBITS) - FixedDiv (viewz - fz + thing->floorclip, yscale);
vis->floorclip = FixedDiv (FLOAT2FIXED(thing->Floorclip), yscale);
vis->texturemid = (tex->TopOffset << FRACBITS) - FixedDiv (viewz - fz + FLOAT2FIXED(thing->Floorclip), yscale);
vis->x1 = x1 < WindowLeft ? WindowLeft : x1;
vis->x2 = x2 > WindowRight ? WindowRight : x2;
vis->angle = thing->_f_angle();
@ -1026,9 +1026,9 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor
vis->x1 = WindowLeft;
vis->x2 = WindowRight;
vis->idepth = (unsigned)DivScale32(1, MAX(tz, MINZ)) >> 1;
vis->floorclip = thing->floorclip;
vis->floorclip = FLOAT2FIXED(thing->Floorclip);
fz -= thing->floorclip;
fz -= FLOAT2FIXED(thing->Floorclip);
vis->angle = thing->_f_angle() + voxel->AngleOffset;

View File

@ -1892,7 +1892,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
FTranslatedLineTarget t;
fixedvec3 savedpos = self->_f_Pos();
DVector3 savedpos = self->Pos();
DAngle saved_angle = self->Angles.Yaw;
DAngle saved_pitch = self->Angles.Pitch;
@ -1917,16 +1917,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
if (t.linetarget == NULL && aim)
{
// We probably won't hit the target, but aim at it anyway so we don't look stupid.
fixedvec2 pos = self->_f_Vec2To(self->target);
DVector2 xydiff(pos.x, pos.y);
double zdiff = (self->target->_f_Z() + (self->target->_f_height()>>1)) -
(self->_f_Z() + (self->_f_height()>>1) - self->floorclip);
DVector2 xydiff = self->Vec2To(self->target);
double zdiff = self->target->Center() - self->Center() - self->Floorclip;
self->Angles.Pitch = VecToAngle(xydiff.Length(), zdiff);
}
// Let the aim trail behind the player
if (aim)
{
saved_angle = self->Angles.Yaw = self->AngleTo(self->target, -self->target->_f_velx() * 3, -self->target->_f_vely() * 3);
saved_angle = self->Angles.Yaw = self->AngleTo(self->target, -self->target->Vel.X * 3, -self->target->Vel.Y * 3);
if (aim == CRF_AIMDIRECT)
{
@ -1936,7 +1934,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
FLOAT2FIXED(spawnofs_xy * self->Angles.Yaw.Cos()),
FLOAT2FIXED(spawnofs_xy * self->Angles.Yaw.Sin())));
spawnofs_xy = 0;
self->Angles.Yaw = self->AngleTo(self->target,- self->target->_f_velx() * 3, -self->target->_f_vely() * 3);
self->Angles.Yaw = self->AngleTo(self->target,- self->target->Vel.X * 3, -self->target->Vel.Y * 3);
}
if (self->target->flags & MF_SHADOW)
@ -2418,7 +2416,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
}
}
AActor *mo = Spawn( missile, self->_f_Vec3Angle(distance, self->_f_angle(), -self->floorclip + self->GetBobOffset() + zheight), ALLOW_REPLACE);
AActor *mo = Spawn( missile, self->_f_Vec3Angle(distance, self->_f_angle(), -self->_f_floorclip() + self->GetBobOffset() + zheight), ALLOW_REPLACE);
int flags = (transfer_translation ? SIXF_TRANSFERTRANSLATION : 0) + (useammo ? SIXF_SETMASTER : 0);
ACTION_RETURN_BOOL(InitSpawnedItem(self, mo, flags)); // for an inventory item's use state
@ -2488,7 +2486,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx)
xvel = newxvel;
}
AActor *mo = Spawn(missile, pos.x, pos.y, self->_f_Z() - self->floorclip + self->GetBobOffset() + zofs, ALLOW_REPLACE);
AActor *mo = Spawn(missile, pos.x, pos.y, self->_f_Z() - self->_f_floorclip() + self->GetBobOffset() + zofs, ALLOW_REPLACE);
bool res = InitSpawnedItem(self, mo, flags);
if (res)
{
@ -2546,7 +2544,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade)
AActor *bo;
bo = Spawn(missile,
self->PosPlusZ(-self->floorclip + self->GetBobOffset() + zheight + 35*FRACUNIT + (self->player? self->player->crouchoffset : 0)),
self->PosPlusZ(-self->_f_floorclip() + self->GetBobOffset() + zheight + 35*FRACUNIT + (self->player? self->player->crouchoffset : 0)),
ALLOW_REPLACE);
if (bo)
{
@ -3730,7 +3728,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF)
offsetwidth = FixedMul(self->_f_radius(), offsetwidth);
}
pos = self->PosPlusZ(offsetheight - self->floorclip);
pos = self->PosPlusZ(offsetheight - self->_f_floorclip());
if (!(flags & CLOFF_FROMBASE))
{ // default to hitscan origin