mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 20:43:15 +00:00
- floatified more of p_mobj.cpp
This commit is contained in:
parent
217414cb1c
commit
2fff7005ad
8 changed files with 106 additions and 226 deletions
120
src/actor.h
120
src/actor.h
|
@ -737,12 +737,7 @@ public:
|
|||
|
||||
inline bool IsNoClip2() const;
|
||||
void CheckPortalTransition(bool islinked);
|
||||
fixedvec3 _f_GetPortalTransition(fixed_t byoffset, sector_t **pSec = NULL);
|
||||
DVector3 GetPortalTransition(double byoffset, sector_t **pSec = NULL)
|
||||
{
|
||||
fixedvec3 pos = _f_GetPortalTransition(FLOAT2FIXED(byoffset), pSec);
|
||||
return{ FIXED2FLOAT(pos.x), FIXED2FLOAT(pos.y),FIXED2FLOAT(pos.z) };
|
||||
}
|
||||
DVector3 GetPortalTransition(double byoffset, sector_t **pSec = NULL);
|
||||
|
||||
// What species am I?
|
||||
virtual FName GetSpecies();
|
||||
|
@ -823,27 +818,6 @@ public:
|
|||
return bloodcls;
|
||||
}
|
||||
|
||||
fixed_t AproxDistance(fixed_t otherx, fixed_t othery)
|
||||
{
|
||||
return P_AproxDistance(_f_X() - otherx, _f_Y() - othery);
|
||||
}
|
||||
|
||||
// 'absolute' is reserved for a linked portal implementation which needs
|
||||
// to distinguish between portal-aware and portal-unaware distance calculation.
|
||||
fixed_t AproxDistance(AActor *other, bool absolute = false)
|
||||
{
|
||||
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this);
|
||||
return P_AproxDistance(_f_X() - otherpos.x, _f_Y() - otherpos.y);
|
||||
}
|
||||
|
||||
/*
|
||||
fixed_t AproxDistance(AActor *other, fixed_t xadd, fixed_t yadd, bool absolute = false)
|
||||
{
|
||||
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->_f_PosRelative(this);
|
||||
return P_AproxDistance(_f_X() - otherpos.x + xadd, _f_Y() - otherpos.y + yadd);
|
||||
}
|
||||
*/
|
||||
|
||||
double Distance2D(AActor *other, bool absolute = false)
|
||||
{
|
||||
DVector2 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
|
@ -887,20 +861,6 @@ public:
|
|||
return VecToAngle(otherpos - Pos() + DVector2(oxofs, oyofs));
|
||||
}
|
||||
|
||||
fixedvec2 _f_Vec2To(AActor *other) const
|
||||
{
|
||||
fixedvec3 otherpos = other->_f_PosRelative(this);
|
||||
fixedvec2 ret = { otherpos.x - _f_X(), otherpos.y - _f_Y() };
|
||||
return ret;
|
||||
}
|
||||
|
||||
fixedvec3 _f_Vec3To(AActor *other) const
|
||||
{
|
||||
fixedvec3 otherpos = other->_f_PosRelative(this);
|
||||
fixedvec3 ret = { otherpos.x - _f_X(), otherpos.y - _f_Y(), otherpos.z - _f_Z() };
|
||||
return ret;
|
||||
}
|
||||
|
||||
DVector2 Vec2To(AActor *other) const
|
||||
{
|
||||
return other->PosRelative(this) - Pos();
|
||||
|
@ -911,16 +871,6 @@ public:
|
|||
return other->PosRelative(this) - Pos();
|
||||
}
|
||||
|
||||
fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy, bool absolute = false)
|
||||
{
|
||||
if (absolute)
|
||||
{
|
||||
fixedvec2 ret = { _f_X() + dx, _f_Y() + dy };
|
||||
return ret;
|
||||
}
|
||||
else return P_GetOffsetPosition(_f_X(), _f_Y(), dx, dy);
|
||||
}
|
||||
|
||||
DVector2 Vec2Offset(double dx, double dy, bool absolute = false)
|
||||
{
|
||||
if (absolute)
|
||||
|
@ -929,8 +879,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
fixedvec2 v = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(dx), FLOAT2FIXED(dy));
|
||||
return{ FIXED2DBL(v.x), FIXED2DBL(v.y) };
|
||||
return P_GetOffsetPosition(X(), Y(), dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -943,22 +892,11 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
fixedvec2 v = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(dx), FLOAT2FIXED(dy));
|
||||
return{ FIXED2DBL(v.x), FIXED2DBL(v.y), atz };
|
||||
DVector2 v = P_GetOffsetPosition(X(), Y(), dx, dy);
|
||||
return DVector3(v, atz);
|
||||
}
|
||||
}
|
||||
|
||||
fixedvec2 Vec2Angle(fixed_t length, angle_t angle, bool absolute = false)
|
||||
{
|
||||
if (absolute)
|
||||
{
|
||||
fixedvec2 ret = { _f_X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
|
||||
_f_Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
|
||||
return ret;
|
||||
}
|
||||
else return P_GetOffsetPosition(_f_X(), _f_Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
|
||||
}
|
||||
|
||||
DVector2 Vec2Angle(double length, DAngle angle, bool absolute = false)
|
||||
{
|
||||
if (absolute)
|
||||
|
@ -967,8 +905,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
fixedvec2 op = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(length*angle.Cos()), FLOAT2FIXED(length*angle.Sin()));
|
||||
return{ FIXED2DBL(op.x), FIXED2DBL(op.y) };
|
||||
return P_GetOffsetPosition(X(), Y(), length*angle.Cos(), length*angle.Sin());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -995,8 +932,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
fixedvec2 v = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(dx), FLOAT2FIXED(dy));
|
||||
return{ FIXED2DBL(v.x), FIXED2DBL(v.y), Z() + dz };
|
||||
DVector2 v = P_GetOffsetPosition(X(), Y(), dx, dy);
|
||||
return DVector3(v, Z() + dz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1005,22 +942,6 @@ public:
|
|||
return Vec3Offset(ofs.X, ofs.Y, ofs.Z, absolute);
|
||||
}
|
||||
|
||||
fixedvec3 _f_Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false)
|
||||
{
|
||||
if (absolute)
|
||||
{
|
||||
fixedvec3 ret = { _f_X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
|
||||
_f_Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), _f_Z() + dz };
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixedvec2 op = P_GetOffsetPosition(_f_X(), _f_Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
|
||||
fixedvec3 pos = { op.x, op.y, _f_Z() + dz };
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
DVector3 Vec3Angle(double length, DAngle angle, double dz, bool absolute = false)
|
||||
{
|
||||
if (absolute)
|
||||
|
@ -1029,8 +950,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
fixedvec2 op = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(length*angle.Cos()), FLOAT2FIXED(length*angle.Sin()));
|
||||
return{ FIXED2DBL(op.x), FIXED2DBL(op.y), Z() + dz };
|
||||
DVector2 v = P_GetOffsetPosition(X(), Y(), length*angle.Cos(), length*angle.Sin());
|
||||
return DVector3(v, Z() + dz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,11 +962,6 @@ public:
|
|||
|
||||
void ClearInterpolation();
|
||||
|
||||
void Move(fixed_t dx, fixed_t dy, fixed_t dz)
|
||||
{
|
||||
SetOrigin(_f_X() + dx, _f_Y() + dy, _f_Z() + dz, true);
|
||||
}
|
||||
|
||||
void SetOrigin(const fixedvec3 & npos, bool moving)
|
||||
{
|
||||
SetOrigin(npos.x, npos.y, npos.z, moving);
|
||||
|
@ -1094,12 +1010,7 @@ public:
|
|||
// intentionally stange names so that searching for them is easier.
|
||||
angle_t _f_angle() { return FLOAT2ANGLE(Angles.Yaw.Degrees); }
|
||||
int _f_pitch() { return FLOAT2ANGLE(Angles.Pitch.Degrees); }
|
||||
angle_t _f_roll() { return FLOAT2ANGLE(Angles.Roll.Degrees); }
|
||||
fixed_t _f_velx() { return FLOAT2FIXED(Vel.X); }
|
||||
fixed_t _f_vely() { return FLOAT2FIXED(Vel.Y); }
|
||||
fixed_t _f_velz() { return FLOAT2FIXED(Vel.Z); }
|
||||
fixed_t _f_speed() { return FLOAT2FIXED(Speed); }
|
||||
fixed_t _f_floatspeed() { return FLOAT2FIXED(FloatSpeed); }
|
||||
|
||||
|
||||
WORD sprite; // used to find patch_t and flip value
|
||||
|
@ -1119,19 +1030,10 @@ public:
|
|||
double floorz, ceilingz; // closest together of contacted secs
|
||||
double dropoffz; // killough 11/98: the lowest floor over all contacted Sectors.
|
||||
|
||||
inline fixed_t _f_ceilingz()
|
||||
{
|
||||
return FLOAT2FIXED(ceilingz);
|
||||
}
|
||||
inline fixed_t _f_floorz()
|
||||
{
|
||||
return FLOAT2FIXED(floorz);
|
||||
}
|
||||
inline fixed_t _f_dropoffz()
|
||||
{
|
||||
return FLOAT2FIXED(dropoffz);
|
||||
}
|
||||
|
||||
|
||||
struct sector_t *floorsector;
|
||||
FTextureID floorpic; // contacted sec floorpic
|
||||
|
@ -1276,10 +1178,6 @@ public:
|
|||
double MaxDropOffHeight;
|
||||
double MaxStepHeight;
|
||||
|
||||
fixed_t _f_MaxStepHeight()
|
||||
{
|
||||
return FLOAT2FIXED(MaxStepHeight);
|
||||
}
|
||||
SDWORD Mass;
|
||||
SWORD PainChance;
|
||||
int PainThreshold;
|
||||
|
|
|
@ -377,7 +377,7 @@ struct level_info_t
|
|||
// [RH] These get zeroed every tic and are updated by thinkers.
|
||||
struct FSectorScrollValues
|
||||
{
|
||||
fixed_t ScrollX, ScrollY;
|
||||
DVector2 Scroll;
|
||||
};
|
||||
|
||||
struct FLevelLocals
|
||||
|
|
|
@ -45,18 +45,6 @@ struct FCheckPosition
|
|||
FromPMove = false;
|
||||
}
|
||||
|
||||
inline fixed_t _f_ceilingz()
|
||||
{
|
||||
return FLOAT2FIXED(ceilingz);
|
||||
}
|
||||
inline fixed_t _f_floorz()
|
||||
{
|
||||
return FLOAT2FIXED(floorz);
|
||||
}
|
||||
inline fixed_t _f_dropoffz()
|
||||
{
|
||||
return FLOAT2FIXED(dropoffz);
|
||||
}
|
||||
inline fixed_t _f_X()
|
||||
{
|
||||
return FLOAT2FIXED(pos.X);
|
||||
|
|
|
@ -1999,7 +1999,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LookEx)
|
|||
{
|
||||
if (self->flags & MF_AMBUSH)
|
||||
{
|
||||
dist = self->AproxDistance (self->target);
|
||||
dist = self->Distance2D (self->target);
|
||||
if (P_CheckSight (self, self->target, SF_SEEPASTBLOCKEVERYTHING) &&
|
||||
(!minseedist || dist > minseedist) &&
|
||||
(!maxseedist || dist < maxseedist))
|
||||
|
@ -2449,7 +2449,7 @@ void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *mele
|
|||
{
|
||||
actor->FastChaseStrafeCount = 0;
|
||||
actor->Vel.X = actor->Vel.Y = 0;
|
||||
fixed_t dist = actor->AproxDistance (actor->target);
|
||||
double dist = actor->Distance2D (actor->target);
|
||||
if (dist < CLASS_BOSS_STRAFE_RANGE)
|
||||
{
|
||||
if (pr_chase() < 100)
|
||||
|
|
164
src/p_mobj.cpp
164
src/p_mobj.cpp
|
@ -1396,7 +1396,7 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
|
|||
{
|
||||
// Find the nearest point on the line, and stick a decal there
|
||||
DVector3 linepos;
|
||||
double num, den, frac;
|
||||
double den, frac;
|
||||
|
||||
den = line->Delta().LengthSquared();
|
||||
if (den != 0)
|
||||
|
@ -2263,21 +2263,21 @@ explode:
|
|||
void P_MonsterFallingDamage (AActor *mo)
|
||||
{
|
||||
int damage;
|
||||
int vel;
|
||||
double vel;
|
||||
|
||||
if (!(level.flags2 & LEVEL2_MONSTERFALLINGDAMAGE))
|
||||
return;
|
||||
if (mo->floorsector->Flags & SECF_NOFALLINGDAMAGE)
|
||||
return;
|
||||
|
||||
vel = abs(mo->_f_velz());
|
||||
if (vel > 35*FRACUNIT)
|
||||
vel = fabs(mo->Vel.Z);
|
||||
if (vel > 35)
|
||||
{ // automatic death
|
||||
damage = TELEFRAG_DAMAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = ((vel - (23*FRACUNIT))*6)>>FRACBITS;
|
||||
damage = int((vel - 23)*6);
|
||||
}
|
||||
damage = TELEFRAG_DAMAGE; // always kill 'em
|
||||
P_DamageMobj (mo, NULL, NULL, damage, NAME_Falling);
|
||||
|
@ -2287,11 +2287,11 @@ void P_MonsterFallingDamage (AActor *mo)
|
|||
// P_ZMovement
|
||||
//
|
||||
|
||||
void P_ZMovement (AActor *mo, fixed_t oldfloorz)
|
||||
void P_ZMovement (AActor *mo, double oldfloorz)
|
||||
{
|
||||
fixed_t dist;
|
||||
fixed_t delta;
|
||||
fixed_t oldz = mo->_f_Z();
|
||||
double dist;
|
||||
double delta;
|
||||
double oldz = mo->Z();
|
||||
double grav = mo->GetGravity();
|
||||
|
||||
//
|
||||
|
@ -2317,7 +2317,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->Vel.Z == 0 && oldfloorz > mo->_f_floorz() && mo->_f_Z() == oldfloorz)
|
||||
if (mo->Vel.Z == 0 && oldfloorz > mo->floorz && mo->Z() == oldfloorz)
|
||||
{
|
||||
mo->Vel.Z -= grav + grav;
|
||||
}
|
||||
|
@ -2401,19 +2401,19 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
|
|||
{ // float down towards target if too close
|
||||
if (!(mo->flags & (MF_SKULLFLY | MF_INFLOAT)))
|
||||
{
|
||||
dist = mo->AproxDistance (mo->target);
|
||||
delta = (mo->target->_f_Z() + (mo->_f_height()>>1)) - mo->_f_Z();
|
||||
dist = mo->Distance2D (mo->target);
|
||||
delta = (mo->target->Center()) - mo->Z();
|
||||
if (delta < 0 && dist < -(delta*3))
|
||||
mo->_f_AddZ(-mo->_f_floatspeed());
|
||||
mo->AddZ(-mo->FloatSpeed);
|
||||
else if (delta > 0 && dist < (delta*3))
|
||||
mo->_f_AddZ(mo->_f_floatspeed());
|
||||
mo->AddZ(mo->FloatSpeed);
|
||||
}
|
||||
}
|
||||
if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->Z() > mo->floorz))
|
||||
{
|
||||
if (!mo->IsNoClip2())
|
||||
{
|
||||
mo->_f_AddZ(finesine[(FINEANGLES/80*level.maptime)&FINEMASK]/8);
|
||||
mo->AddZ(DAngle(360 / 80.f * level.maptime).Sin() / 8);
|
||||
}
|
||||
mo->Vel.Z *= FRICTION_FLY;
|
||||
}
|
||||
|
@ -2447,7 +2447,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
|
|||
{ // Hit the floor
|
||||
if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) &&
|
||||
mo->Sector->SecActTarget != NULL &&
|
||||
mo->Sector->floorplane.ZatPoint(mo) == mo->_f_floorz())
|
||||
mo->Sector->floorplane.ZatPointF(mo) == mo->floorz)
|
||||
{ // [RH] Let the sector do something to the actor
|
||||
mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitFloor);
|
||||
}
|
||||
|
@ -2488,25 +2488,25 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (mo->BounceFlags & BOUNCE_MBF && mo->_f_velz()) // check for MBF-like bounce on non-missiles
|
||||
else if (mo->BounceFlags & BOUNCE_MBF && mo->Vel.Z) // check for MBF-like bounce on non-missiles
|
||||
{
|
||||
mo->FloorBounceMissile(mo->floorsector->floorplane);
|
||||
}
|
||||
if (mo->flags3 & MF3_ISMONSTER) // Blasted mobj falling
|
||||
{
|
||||
if (mo->_f_velz() < -(23*FRACUNIT))
|
||||
if (mo->Vel.Z < -23)
|
||||
{
|
||||
P_MonsterFallingDamage (mo);
|
||||
}
|
||||
}
|
||||
mo->SetZ(mo->floorz);
|
||||
if (mo->_f_velz() < 0)
|
||||
if (mo->Vel.Z < 0)
|
||||
{
|
||||
const fixed_t minvel = -8*FRACUNIT; // landing speed from a jump with normal gravity
|
||||
const double minvel = -8; // landing speed from a jump with normal gravity
|
||||
|
||||
// Spawn splashes, etc.
|
||||
P_HitFloor (mo);
|
||||
if (mo->DamageType == NAME_Ice && mo->_f_velz() < minvel)
|
||||
if (mo->DamageType == NAME_Ice && mo->Vel.Z < minvel)
|
||||
{
|
||||
mo->tics = 1;
|
||||
mo->Vel.Zero();
|
||||
|
@ -2516,11 +2516,11 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
|
|||
mo->HitFloor ();
|
||||
if (mo->player)
|
||||
{
|
||||
if (mo->player->jumpTics < 0 || mo->_f_velz() < minvel)
|
||||
if (mo->player->jumpTics < 0 || mo->Vel.Z < minvel)
|
||||
{ // delay any jumping for a short while
|
||||
mo->player->jumpTics = 7;
|
||||
}
|
||||
if (mo->_f_velz() < minvel && !(mo->flags & MF_NOGRAVITY))
|
||||
if (mo->Vel.Z < minvel && !(mo->flags & MF_NOGRAVITY))
|
||||
{
|
||||
// Squat down.
|
||||
// Decrease viewheight for a moment after hitting the ground (hard),
|
||||
|
@ -2547,7 +2547,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
|
|||
{ // hit the ceiling
|
||||
if ((!mo->player || !(mo->player->cheats & CF_PREDICTING)) &&
|
||||
mo->Sector->SecActTarget != NULL &&
|
||||
mo->Sector->ceilingplane.ZatPoint(mo) == mo->_f_ceilingz())
|
||||
mo->Sector->ceilingplane.ZatPointF(mo) == mo->ceilingz)
|
||||
{ // [RH] Let the sector do something to the actor
|
||||
mo->Sector->SecActTarget->TriggerAction (mo, SECSPAC_HitCeiling);
|
||||
}
|
||||
|
@ -2584,7 +2584,7 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
|
|||
}
|
||||
}
|
||||
}
|
||||
P_CheckFakeFloorTriggers (mo, FIXED2DBL(oldz));
|
||||
P_CheckFakeFloorTriggers (mo, oldz);
|
||||
}
|
||||
|
||||
void P_CheckFakeFloorTriggers (AActor *mo, double oldz, bool oldz_has_viewheight)
|
||||
|
@ -3212,20 +3212,20 @@ void AActor::SetRoll(DAngle r, bool interpolate)
|
|||
}
|
||||
|
||||
|
||||
fixedvec3 AActor::_f_GetPortalTransition(fixed_t byoffset, sector_t **pSec)
|
||||
DVector3 AActor::GetPortalTransition(double byoffset, sector_t **pSec)
|
||||
{
|
||||
bool moved = false;
|
||||
sector_t *sec = Sector;
|
||||
double testz = Z() + FIXED2FLOAT(byoffset);
|
||||
fixedvec3 pos = _f_Pos();
|
||||
double testz = Z() + byoffset;
|
||||
DVector3 pos = Pos();
|
||||
|
||||
while (!sec->PortalBlocksMovement(sector_t::ceiling))
|
||||
{
|
||||
AActor *port = sec->SkyBoxes[sector_t::ceiling];
|
||||
if (testz > port->specialf1)
|
||||
{
|
||||
pos = _f_PosRelative(port->Sector);
|
||||
sec = P_PointInSector(pos.x, pos.y);
|
||||
pos = PosRelative(port->Sector);
|
||||
sec = P_PointInSector(pos);
|
||||
moved = true;
|
||||
}
|
||||
else break;
|
||||
|
@ -3237,8 +3237,8 @@ fixedvec3 AActor::_f_GetPortalTransition(fixed_t byoffset, sector_t **pSec)
|
|||
AActor *port = sec->SkyBoxes[sector_t::floor];
|
||||
if (testz <= port->specialf1)
|
||||
{
|
||||
pos = _f_PosRelative(port->Sector);
|
||||
sec = P_PointInSector(pos.x, pos.y);
|
||||
pos = PosRelative(port->Sector);
|
||||
sec = P_PointInSector(pos);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
@ -3294,8 +3294,7 @@ void AActor::CheckPortalTransition(bool islinked)
|
|||
void AActor::Tick ()
|
||||
{
|
||||
// [RH] Data for Heretic/Hexen scrolling sectors
|
||||
static const BYTE HexenScrollDirs[8] = { 64, 0, 192, 128, 96, 32, 224, 160 };
|
||||
static const BYTE HexenSpeedMuls[3] = { 5, 10, 25 };
|
||||
static const SBYTE HexenCompatSpeeds[] = {-25, 0, -10, -5, 0, 5, 10, 0, 25 };
|
||||
static const SBYTE HexenScrollies[24][2] =
|
||||
{
|
||||
{ 0, 1 }, { 0, 2 }, { 0, 4 },
|
||||
|
@ -3349,7 +3348,7 @@ void AActor::Tick ()
|
|||
|
||||
UnlinkFromWorld ();
|
||||
flags |= MF_NOBLOCKMAP;
|
||||
SetXYZ(Vec3Offset(_f_velx(), _f_vely(), _f_velz()));
|
||||
SetXYZ(Vec3Offset(Vel));
|
||||
CheckPortalTransition(false);
|
||||
LinkToWorld ();
|
||||
}
|
||||
|
@ -3434,7 +3433,7 @@ void AActor::Tick ()
|
|||
{
|
||||
if (health >0)
|
||||
{
|
||||
if (abs (_f_velz()) < FRACUNIT/4)
|
||||
if (fabs (Vel.Z) < 0.25)
|
||||
{
|
||||
Vel.Z = 0;
|
||||
flags4 &= ~MF4_VFRICTION;
|
||||
|
@ -3499,10 +3498,10 @@ void AActor::Tick ()
|
|||
}
|
||||
|
||||
// [RH] Consider carrying sectors here
|
||||
fixed_t cummx = 0, cummy = 0;
|
||||
DVector2 cumm(0, 0);
|
||||
if ((level.Scrolls != NULL || player != NULL) && !(flags & MF_NOCLIP) && !(flags & MF_NOSECTOR))
|
||||
{
|
||||
fixed_t height, waterheight; // killough 4/4/98: add waterheight
|
||||
double height, waterheight; // killough 4/4/98: add waterheight
|
||||
const msecnode_t *node;
|
||||
int countx, county;
|
||||
|
||||
|
@ -3519,17 +3518,16 @@ void AActor::Tick ()
|
|||
for (node = touching_sectorlist; node; node = node->m_tnext)
|
||||
{
|
||||
sector_t *sec = node->m_sector;
|
||||
fixed_t scrollx, scrolly;
|
||||
DVector2 scrollv;
|
||||
|
||||
if (level.Scrolls != NULL)
|
||||
{
|
||||
const FSectorScrollValues *scroll = &level.Scrolls[sec - sectors];
|
||||
scrollx = scroll->ScrollX;
|
||||
scrolly = scroll->ScrollY;
|
||||
scrollv = scroll->Scroll;
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollx = scrolly = 0;
|
||||
scrollv.Zero();
|
||||
}
|
||||
|
||||
if (player != NULL)
|
||||
|
@ -3542,16 +3540,15 @@ void AActor::Tick ()
|
|||
scrolltype -= Scroll_North_Slow;
|
||||
if (i_compatflags&COMPATF_RAVENSCROLL)
|
||||
{
|
||||
angle_t fineangle = HexenScrollDirs[scrolltype / 3] * 32;
|
||||
fixed_t carryspeed = DivScale32 (HexenSpeedMuls[scrolltype % 3], 32*_f_CARRYFACTOR);
|
||||
scrollx += FixedMul (carryspeed, finecosine[fineangle]);
|
||||
scrolly += FixedMul (carryspeed, finesine[fineangle]);
|
||||
scrollv.X -= HexenCompatSpeeds[HexenScrollies[scrolltype][0]+4] * (1. / (32 * CARRYFACTOR));
|
||||
scrollv.Y += HexenCompatSpeeds[HexenScrollies[scrolltype][1]+4] * (1. / (32 * CARRYFACTOR));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use speeds that actually match the scrolling textures!
|
||||
scrollx -= HexenScrollies[scrolltype][0] << (FRACBITS-1);
|
||||
scrolly += HexenScrollies[scrolltype][1] << (FRACBITS-1);
|
||||
scrollv.X -= HexenScrollies[scrolltype][0] * 0.5;
|
||||
scrollv.Y += HexenScrollies[scrolltype][1] * 0.5;
|
||||
}
|
||||
}
|
||||
else if (scrolltype >= Carry_East5 &&
|
||||
|
@ -3559,39 +3556,37 @@ void AActor::Tick ()
|
|||
{ // Heretic scroll special
|
||||
scrolltype -= Carry_East5;
|
||||
BYTE dir = HereticScrollDirs[scrolltype / 5];
|
||||
fixed_t carryspeed = DivScale32 (HereticSpeedMuls[scrolltype % 5], 32*_f_CARRYFACTOR);
|
||||
double carryspeed = HereticSpeedMuls[scrolltype % 5] * (1. / (32 * CARRYFACTOR));
|
||||
if (scrolltype<=Carry_East35 && !(i_compatflags&COMPATF_RAVENSCROLL))
|
||||
{
|
||||
// Use speeds that actually match the scrolling textures!
|
||||
carryspeed = (1 << ((scrolltype%5) + FRACBITS-1));
|
||||
carryspeed = (1 << ((scrolltype%5) - 1));
|
||||
}
|
||||
scrollx += carryspeed * ((dir & 3) - 1);
|
||||
scrolly += carryspeed * (((dir & 12) >> 2) - 1);
|
||||
scrollv.X += carryspeed * ((dir & 3) - 1);
|
||||
scrollv.Y += carryspeed * (((dir & 12) >> 2) - 1);
|
||||
}
|
||||
else if (scrolltype == dScroll_EastLavaDamage)
|
||||
{ // Special Heretic scroll special
|
||||
if (i_compatflags&COMPATF_RAVENSCROLL)
|
||||
{
|
||||
scrollx += DivScale32 (28, 32*_f_CARRYFACTOR);
|
||||
scrollv.X += 28. / (32*CARRYFACTOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use a speed that actually matches the scrolling texture!
|
||||
scrollx += DivScale32 (12, 32*_f_CARRYFACTOR);
|
||||
scrollv.X += 12. / (32 * CARRYFACTOR);
|
||||
}
|
||||
}
|
||||
else if (scrolltype == Scroll_StrifeCurrent)
|
||||
{ // Strife scroll special
|
||||
int anglespeed = tagManager.GetFirstSectorTag(sec) - 100;
|
||||
fixed_t carryspeed = DivScale32 (anglespeed % 10, 16*_f_CARRYFACTOR);
|
||||
angle_t fineangle = (anglespeed / 10) << (32-3);
|
||||
fineangle >>= ANGLETOFINESHIFT;
|
||||
scrollx += FixedMul (carryspeed, finecosine[fineangle]);
|
||||
scrolly += FixedMul (carryspeed, finesine[fineangle]);
|
||||
double carryspeed = (anglespeed % 10) / (16 * CARRYFACTOR);
|
||||
DAngle angle = ((anglespeed / 10) * 45.);
|
||||
scrollv += angle.ToVector(carryspeed);
|
||||
}
|
||||
}
|
||||
|
||||
if ((scrollx | scrolly) == 0)
|
||||
if (scrollv.isZero())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -3600,9 +3595,9 @@ void AActor::Tick ()
|
|||
{
|
||||
continue;
|
||||
}
|
||||
fixedvec3 pos = _f_PosRelative(sec);
|
||||
DVector3 pos = PosRelative(sec);
|
||||
height = sec->floorplane.ZatPoint (pos);
|
||||
if (_f_Z() > height)
|
||||
if (Z() > height)
|
||||
{
|
||||
if (heightsec == NULL)
|
||||
{
|
||||
|
@ -3610,16 +3605,15 @@ void AActor::Tick ()
|
|||
}
|
||||
|
||||
waterheight = heightsec->floorplane.ZatPoint (pos);
|
||||
if (waterheight > height && _f_Z() >= waterheight)
|
||||
if (waterheight > height && Z() >= waterheight)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
cummx += scrollx;
|
||||
cummy += scrolly;
|
||||
if (scrollx) countx++;
|
||||
if (scrolly) county++;
|
||||
cumm += scrollv;
|
||||
if (scrollv.X) countx++;
|
||||
if (scrollv.Y) county++;
|
||||
}
|
||||
|
||||
// Some levels designed with Boom in mind actually want things to accelerate
|
||||
|
@ -3629,11 +3623,11 @@ void AActor::Tick ()
|
|||
{
|
||||
if (countx > 1)
|
||||
{
|
||||
cummx /= countx;
|
||||
cumm.X /= countx;
|
||||
}
|
||||
if (county > 1)
|
||||
{
|
||||
cummy /= county;
|
||||
cumm.Y /= county;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3650,7 +3644,7 @@ void AActor::Tick ()
|
|||
floorplane = P_FindFloorPlane(floorsector, PosAtZ(floorz));
|
||||
|
||||
if (floorplane.c < STEEPSLOPE &&
|
||||
floorplane.ZatPoint (_f_PosRelative(floorsector)) <= _f_floorz())
|
||||
floorplane.ZatPoint (PosRelative(floorsector)) <= floorz)
|
||||
{
|
||||
const msecnode_t *node;
|
||||
bool dopush = true;
|
||||
|
@ -3689,7 +3683,7 @@ void AActor::Tick ()
|
|||
|
||||
// Handle X and Y velocities
|
||||
BlockingMobj = NULL;
|
||||
fixed_t oldfloorz = FLOAT2FIXED(P_XYMovement (this, DVector2(FIXED2DBL(cummx), FIXED2DBL(cummy))));
|
||||
double oldfloorz = P_XYMovement (this, cumm);
|
||||
if (ObjectFlags & OF_EuthanizeMe)
|
||||
{ // actor was destroyed
|
||||
return;
|
||||
|
@ -3755,7 +3749,7 @@ void AActor::Tick ()
|
|||
onmo->lastbump = level.maptime + TICRATE;
|
||||
}
|
||||
}
|
||||
if (_f_velz() != 0 && (BounceFlags & BOUNCE_Actors))
|
||||
if (Vel.Z != 0 && (BounceFlags & BOUNCE_Actors))
|
||||
{
|
||||
P_BounceActor(this, onmo, true);
|
||||
}
|
||||
|
@ -3902,15 +3896,15 @@ void AActor::CheckSectorTransition(sector_t *oldsec)
|
|||
if (Sector->SecActTarget != NULL)
|
||||
{
|
||||
int act = SECSPAC_Enter;
|
||||
if (_f_Z() <= Sector->floorplane.ZatPoint(this))
|
||||
if (Z() <= Sector->floorplane.ZatPointF(this))
|
||||
{
|
||||
act |= SECSPAC_HitFloor;
|
||||
}
|
||||
if (_f_Z() + _f_height() >= Sector->ceilingplane.ZatPoint(this))
|
||||
if (Top() >= Sector->ceilingplane.ZatPointF(this))
|
||||
{
|
||||
act |= SECSPAC_HitCeiling;
|
||||
}
|
||||
if (Sector->heightsec != NULL && _f_Z() == Sector->heightsec->floorplane.ZatPoint(this))
|
||||
if (Sector->heightsec != NULL && Z() == Sector->heightsec->floorplane.ZatPointF(this))
|
||||
{
|
||||
act |= SECSPAC_HitFakeFloor;
|
||||
}
|
||||
|
@ -5585,7 +5579,7 @@ bool P_HitFloor (AActor *thing)
|
|||
|
||||
// killough 11/98: touchy objects explode on impact
|
||||
// Allow very short drops to be safe, so that a touchy can be summoned without exploding.
|
||||
if (thing->flags6 & MF6_TOUCHY && ((thing->flags6 & MF6_ARMED) || thing->IsSentient()) && ((thing->_f_velz()) < (-5 * FRACUNIT)))
|
||||
if (thing->flags6 & MF6_TOUCHY && ((thing->flags6 & MF6_ARMED) || thing->IsSentient()) && thing->Vel.Z < -5)
|
||||
{
|
||||
thing->flags6 &= ~MF6_ARMED; // Disarm
|
||||
P_DamageMobj (thing, NULL, NULL, thing->health, NAME_Crush, DMG_FORCED); // kill object
|
||||
|
@ -5938,21 +5932,21 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassAct
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
angle_t an;
|
||||
fixed_t dist;
|
||||
fixed_t speed;
|
||||
fixed_t vz;
|
||||
DAngle an;
|
||||
double dist;
|
||||
double speed;
|
||||
double vz;
|
||||
|
||||
an = source->_f_angle();
|
||||
an = source->Angles.Yaw;
|
||||
|
||||
if (dest->flags & MF_SHADOW)
|
||||
{
|
||||
an += pr_spawnmissile.Random2() << 20;
|
||||
an += pr_spawnmissile.Random2() * (16. / 360.);
|
||||
}
|
||||
dist = source->AproxDistance (dest);
|
||||
speed = GetDefaultSpeed (type);
|
||||
dist = source->Distance2D (dest);
|
||||
speed = FIXED2DBL(GetDefaultSpeed (type));
|
||||
dist /= speed;
|
||||
vz = dist != 0 ? (dest->_f_Z() - source->_f_Z())/dist : speed;
|
||||
vz = dist != 0 ? (dest->Z() - source->Z())/dist : speed;
|
||||
return P_SpawnMissileAngleZSpeed (source, z, type, an, vz, speed);
|
||||
}
|
||||
|
||||
|
|
|
@ -899,10 +899,10 @@ sightcounts[0]++;
|
|||
res = s.P_SightPathTraverse ();
|
||||
if (!res)
|
||||
{
|
||||
fixed_t dist = t1->AproxDistance(t2);
|
||||
double dist = t1->Distance2D(t2);
|
||||
for (unsigned i = 0; i < portals.Size(); i++)
|
||||
{
|
||||
portals[i].frac += FixedDiv(FRACUNIT, dist);
|
||||
portals[i].frac += FLOAT2FIXED(1 / dist);
|
||||
s.init(t1, t2, NULL, &portals[i], flags);
|
||||
if (s.P_SightPathTraverse())
|
||||
{
|
||||
|
|
|
@ -1625,8 +1625,8 @@ void DScroller::Tick ()
|
|||
|
||||
// [RH] Don't actually carry anything here. That happens later.
|
||||
case sc_carry:
|
||||
level.Scrolls[m_Affectee].ScrollX += dx;
|
||||
level.Scrolls[m_Affectee].ScrollY += dy;
|
||||
level.Scrolls[m_Affectee].Scroll.X += FIXED2DBL(dx);
|
||||
level.Scrolls[m_Affectee].Scroll.Y += FIXED2DBL(dy);
|
||||
break;
|
||||
|
||||
case sc_carry_ceiling: // to be added later
|
||||
|
|
|
@ -2040,7 +2040,7 @@ void P_FallingDamage (AActor *actor)
|
|||
{
|
||||
int damagestyle;
|
||||
int damage;
|
||||
fixed_t vel;
|
||||
double vel;
|
||||
|
||||
damagestyle = ((level.flags >> 15) | (dmflags)) &
|
||||
(DF_FORCE_FALLINGZD | DF_FORCE_FALLINGHX);
|
||||
|
@ -2051,7 +2051,7 @@ void P_FallingDamage (AActor *actor)
|
|||
if (actor->floorsector->Flags & SECF_NOFALLINGDAMAGE)
|
||||
return;
|
||||
|
||||
vel = abs(actor->_f_velz());
|
||||
vel = fabs(actor->Vel.Z);
|
||||
|
||||
// Since Hexen falling damage is stronger than ZDoom's, it takes
|
||||
// precedence. ZDoom falling damage may not be as strong, but it
|
||||
|
@ -2060,19 +2060,19 @@ void P_FallingDamage (AActor *actor)
|
|||
switch (damagestyle)
|
||||
{
|
||||
case DF_FORCE_FALLINGHX: // Hexen falling damage
|
||||
if (vel <= 23*FRACUNIT)
|
||||
if (vel <= 23)
|
||||
{ // Not fast enough to hurt
|
||||
return;
|
||||
}
|
||||
if (vel >= 63*FRACUNIT)
|
||||
if (vel >= 63)
|
||||
{ // automatic death
|
||||
damage = 1000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = FixedMul (vel, 16*FRACUNIT/23);
|
||||
damage = ((FixedMul (vel, vel) / 10) >> FRACBITS) - 24;
|
||||
if (actor->_f_velz() > -39*FRACUNIT && damage > actor->health
|
||||
vel *= (16. / 23);
|
||||
damage = int((vel * vel) / 10 - 24);
|
||||
if (actor->Vel.Z > -39 && damage > actor->health
|
||||
&& actor->health != 1)
|
||||
{ // No-death threshold
|
||||
damage = actor->health-1;
|
||||
|
@ -2081,17 +2081,17 @@ void P_FallingDamage (AActor *actor)
|
|||
break;
|
||||
|
||||
case DF_FORCE_FALLINGZD: // ZDoom falling damage
|
||||
if (vel <= 19*FRACUNIT)
|
||||
if (vel <= 19)
|
||||
{ // Not fast enough to hurt
|
||||
return;
|
||||
}
|
||||
if (vel >= 84*FRACUNIT)
|
||||
if (vel >= 84)
|
||||
{ // automatic death
|
||||
damage = 1000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = ((MulScale23 (vel, vel*11) >> FRACBITS) - 30) / 2;
|
||||
damage = int((vel*vel*(11 / 128.) - 30) / 2);
|
||||
if (damage < 1)
|
||||
{
|
||||
damage = 1;
|
||||
|
@ -2100,7 +2100,7 @@ void P_FallingDamage (AActor *actor)
|
|||
break;
|
||||
|
||||
case DF_FORCE_FALLINGST: // Strife falling damage
|
||||
if (vel <= 20*FRACUNIT)
|
||||
if (vel <= 20)
|
||||
{ // Not fast enough to hurt
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue