- replaced AActor::vel and player_t::Vel with a floating point version.

- Converted P_MovePlayer and all associated variables to floating point because this wasn't working well with a mixture between float and fixed.

Like the angle commit this has just been patched up to compile, the bulk of work is yet to be done.
This commit is contained in:
Christoph Oelckers 2016-03-20 00:54:18 +01:00
parent 51a98d0e5d
commit 51b05d331d
140 changed files with 2407 additions and 2404 deletions

View file

@ -1373,6 +1373,7 @@ source_group("Games\\Hexen Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR
source_group("Games\\Raven Shared" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_raven/.+") source_group("Games\\Raven Shared" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_raven/.+")
source_group("Games\\Strife Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_strife/.+") source_group("Games\\Strife Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_strife/.+")
source_group("Intermission" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/intermission/.+") source_group("Intermission" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/intermission/.+")
source_group("Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/math/.+")
source_group("Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/menu/.+") source_group("Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/menu/.+")
source_group("Render Core\\Render Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/r_.+\\.h$") source_group("Render Core\\Render Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/r_.+\\.h$")
source_group("Render Core\\Render Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/r_.+\\.cpp$") source_group("Render Core\\Render Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/r_.+\\.cpp$")

View file

@ -25,6 +25,7 @@
// Basics. // Basics.
#include "tables.h" #include "tables.h"
#include "templates.h"
// We need the thinker_t stuff. // We need the thinker_t stuff.
#include "dthinker.h" #include "dthinker.h"
@ -571,6 +572,7 @@ public:
fixed_t P_AproxDistance (fixed_t dx, fixed_t dy); // since we cannot include p_local here... fixed_t P_AproxDistance (fixed_t dx, fixed_t dy); // since we cannot include p_local here...
angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2); // same reason here with r_defs.h angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2); // same reason here with r_defs.h
const double MinVel = 1. / 65536;
// Map Object definition. // Map Object definition.
class AActor : public DThinker class AActor : public DThinker
@ -815,97 +817,109 @@ public:
fixed_t AproxDistance(fixed_t otherx, fixed_t othery) fixed_t AproxDistance(fixed_t otherx, fixed_t othery)
{ {
return P_AproxDistance(X() - otherx, Y() - othery); return P_AproxDistance(_f_X() - otherx, _f_Y() - othery);
} }
fixed_t __f_AngleTo(fixed_t otherx, fixed_t othery) fixed_t __f_AngleTo(fixed_t otherx, fixed_t othery)
{ {
return R_PointToAngle2(X(), Y(), otherx, othery); return R_PointToAngle2(_f_X(), _f_Y(), otherx, othery);
} }
fixed_t __f_AngleTo(fixedvec2 other) fixed_t __f_AngleTo(fixedvec2 other)
{ {
return R_PointToAngle2(X(), Y(), other.x, other.y); return R_PointToAngle2(_f_X(), _f_Y(), other.x, other.y);
} }
// 'absolute' is reserved for a linked portal implementation which needs // 'absolute' is reserved for a linked portal implementation which needs
// to distinguish between portal-aware and portal-unaware distance calculation. // to distinguish between portal-aware and portal-unaware distance calculation.
fixed_t AproxDistance(AActor *other, bool absolute = false) fixed_t AproxDistance(AActor *other, bool absolute = false)
{ {
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return P_AproxDistance(X() - otherpos.x, Y() - otherpos.y); 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) fixed_t AproxDistance(AActor *other, fixed_t xadd, fixed_t yadd, bool absolute = false)
{ {
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return P_AproxDistance(X() - otherpos.x + xadd, Y() - otherpos.y + yadd); return P_AproxDistance(_f_X() - otherpos.x + xadd, _f_Y() - otherpos.y + yadd);
} }
fixed_t AproxDistance3D(AActor *other, bool absolute = false) fixed_t AproxDistance3D(AActor *other, bool absolute = false)
{ {
return P_AproxDistance(AproxDistance(other), Z() - other->Z()); return P_AproxDistance(AproxDistance(other), _f_Z() - other->_f_Z());
} }
// more precise, but slower version, being used in a few places // more precise, but slower version, being used in a few places
double Distance2D(AActor *other, bool absolute = false) double Distance2D(AActor *other, bool absolute = false)
{ {
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return (DVector2(X() - otherpos.x, Y() - otherpos.y).Length())/FRACUNIT; return (DVector2(_f_X() - otherpos.x, _f_Y() - otherpos.y).Length())/FRACUNIT;
} }
// a full 3D version of the above // a full 3D version of the above
fixed_t Distance3D(AActor *other, bool absolute = false) fixed_t Distance3D(AActor *other, bool absolute = false)
{ {
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return xs_RoundToInt(DVector3(X() - otherpos.x, Y() - otherpos.y, Z() - otherpos.z).Length()); return xs_RoundToInt(DVector3(_f_X() - otherpos.x, _f_Y() - otherpos.y, _f_Z() - otherpos.z).Length());
} }
angle_t __f_AngleTo(AActor *other, bool absolute = false) angle_t __f_AngleTo(AActor *other, bool absolute = false)
{ {
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return R_PointToAngle2(X(), Y(), otherpos.x, otherpos.y); return R_PointToAngle2(_f_X(), _f_Y(), otherpos.x, otherpos.y);
} }
angle_t __f_AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const angle_t __f_AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const
{ {
return R_PointToAngle2(X(), Y(), other->X() + oxofs, other->Y() + oyofs); return R_PointToAngle2(_f_X(), _f_Y(), other->_f_X() + oxofs, other->_f_Y() + oyofs);
} }
DAngle AngleTo(AActor *other, bool absolute = false) DAngle AngleTo(AActor *other, bool absolute = false)
{ {
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return VecToAngle(otherpos.x - X(), otherpos.y - Y()); return VecToAngle(otherpos.x - _f_X(), otherpos.y - _f_Y());
} }
DAngle AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const DAngle AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const
{ {
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this); fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return VecToAngle(otherpos.y + oxofs - Y(), otherpos.x + oyofs - X()); return VecToAngle(otherpos.y + oxofs - _f_Y(), otherpos.x + oyofs - _f_X());
} }
fixedvec2 Vec2To(AActor *other) const fixedvec2 _f_Vec2To(AActor *other) const
{ {
fixedvec3 otherpos = other->PosRelative(this); fixedvec3 otherpos = other->PosRelative(this);
fixedvec2 ret = { otherpos.x - X(), otherpos.y - Y() }; fixedvec2 ret = { otherpos.x - _f_X(), otherpos.y - _f_Y() };
return ret; return ret;
} }
fixedvec3 Vec3To(AActor *other) const fixedvec3 _f_Vec3To(AActor *other) const
{ {
fixedvec3 otherpos = other->PosRelative(this); fixedvec3 otherpos = other->PosRelative(this);
fixedvec3 ret = { otherpos.x - X(), otherpos.y - Y(), otherpos.z - Z() }; fixedvec3 ret = { otherpos.x - _f_X(), otherpos.y - _f_Y(), otherpos.z - _f_Z() };
return ret; return ret;
} }
DVector2 Vec2To(AActor *other) const
{
fixedvec3 otherpos = other->PosRelative(this);
return{ FIXED2DBL(otherpos.x - _f_X()), FIXED2DBL(otherpos.y - _f_Y()) };
}
DVector3 Vec3To(AActor *other) const
{
fixedvec3 otherpos = other->PosRelative(this);
return { FIXED2DBL(otherpos.x - _f_X()), FIXED2DBL(otherpos.y - _f_Y()), FIXED2DBL(otherpos.z - _f_Z()) };
}
fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy, bool absolute = false) fixedvec2 Vec2Offset(fixed_t dx, fixed_t dy, bool absolute = false)
{ {
if (absolute) if (absolute)
{ {
fixedvec2 ret = { X() + dx, Y() + dy }; fixedvec2 ret = { _f_X() + dx, _f_Y() + dy };
return ret; return ret;
} }
else return P_GetOffsetPosition(X(), Y(), dx, dy); else return P_GetOffsetPosition(_f_X(), _f_Y(), dx, dy);
} }
@ -913,44 +927,57 @@ public:
{ {
if (absolute) if (absolute)
{ {
fixedvec2 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), fixedvec2 ret = { _f_X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) }; _f_Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
return ret; return ret;
} }
else return P_GetOffsetPosition(X(), Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); else return P_GetOffsetPosition(_f_X(), _f_Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
} }
fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false) fixedvec3 Vec3Offset(fixed_t dx, fixed_t dy, fixed_t dz, bool absolute = false)
{ {
if (absolute) if (absolute)
{ {
fixedvec3 ret = { X() + dx, Y() + dy, Z() + dz }; fixedvec3 ret = { _f_X() + dx, _f_Y() + dy, _f_Z() + dz };
return ret; return ret;
} }
else else
{ {
fixedvec2 op = P_GetOffsetPosition(X(), Y(), dx, dy); fixedvec2 op = P_GetOffsetPosition(_f_X(), _f_Y(), dx, dy);
fixedvec3 pos = { op.x, op.y, Z() + dz }; fixedvec3 pos = { op.x, op.y, _f_Z() + dz };
return pos; return pos;
} }
} }
fixedvec3 Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false) fixedvec3 _f_Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false)
{ {
if (absolute) if (absolute)
{ {
fixedvec3 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), fixedvec3 ret = { _f_X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), Z() + dz }; _f_Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), _f_Z() + dz };
return ret; return ret;
} }
else else
{ {
fixedvec2 op = P_GetOffsetPosition(X(), Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT])); fixedvec2 op = P_GetOffsetPosition(_f_X(), _f_Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
fixedvec3 pos = { op.x, op.y, Z() + dz }; fixedvec3 pos = { op.x, op.y, _f_Z() + dz };
return pos; return pos;
} }
} }
DVector3 Vec3Angle(double length, DAngle angle, double dz, bool absolute = false)
{
if (absolute)
{
return{ X() + length * angle.Cos(), Y() + length * angle.Sin(), Z() + dz };
}
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 };
}
}
double AccuracyFactor() double AccuracyFactor()
{ {
return 1. / (1 << (accuracy * 5 / 100)); return 1. / (1 << (accuracy * 5 / 100));
@ -960,7 +987,7 @@ public:
void Move(fixed_t dx, fixed_t dy, fixed_t dz) void Move(fixed_t dx, fixed_t dy, fixed_t dz)
{ {
SetOrigin(X() + dx, Y() + dy, Z() + dz, true); SetOrigin(_f_X() + dx, _f_Y() + dy, _f_Z() + dz, true);
} }
void SetOrigin(const fixedvec3 & npos, bool moving) void SetOrigin(const fixedvec3 & npos, bool moving)
@ -968,6 +995,11 @@ public:
SetOrigin(npos.x, npos.y, npos.z, moving); SetOrigin(npos.x, npos.y, npos.z, moving);
} }
void SetOrigin(const DVector3 & npos, bool moving)
{
SetOrigin(FLOAT2FIXED(npos.X), FLOAT2FIXED(npos.Y), FLOAT2FIXED(npos.Z), moving);
}
inline void SetFriendPlayer(player_t *player); inline void SetFriendPlayer(player_t *player);
bool IsVisibleToPlayer() const; bool IsVisibleToPlayer() const;
@ -977,7 +1009,7 @@ public:
bool CanSeek(AActor *target) const; bool CanSeek(AActor *target) const;
fixed_t GetGravity() const; double GetGravity() const;
bool IsSentient() const; bool IsSentient() const;
const char *GetTag(const char *def = NULL) const; const char *GetTag(const char *def = NULL) const;
void SetTag(const char *def); void SetTag(const char *def);
@ -994,14 +1026,23 @@ public:
angle_t angle; angle_t angle;
fixed_t pitch; fixed_t pitch;
angle_t roll; // This was fixed_t before, which is probably wrong angle_t roll; // This was fixed_t before, which is probably wrong
fixedvec3 vel;
*/ */
DRotator Angles; DRotator Angles;
DVector3 Vel;
double Speed;
double FloatSpeed;
// intentionally stange names so that searching for them is easier. // intentionally stange names so that searching for them is easier.
angle_t _f_angle() { return FLOAT2ANGLE(Angles.Yaw.Degrees); } angle_t _f_angle() { return FLOAT2ANGLE(Angles.Yaw.Degrees); }
int _f_pitch() { return FLOAT2ANGLE(Angles.Pitch.Degrees); } int _f_pitch() { return FLOAT2ANGLE(Angles.Pitch.Degrees); }
angle_t _f_roll() { return FLOAT2ANGLE(Angles.Roll.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 WORD sprite; // used to find patch_t and flip value
@ -1028,7 +1069,6 @@ public:
FTextureID ceilingpic; // contacted sec ceilingpic FTextureID ceilingpic; // contacted sec ceilingpic
fixed_t radius, height; // for movement checking fixed_t radius, height; // for movement checking
fixed_t projectilepassheight; // height for clipping projectile movement against this actor fixed_t projectilepassheight; // height for clipping projectile movement against this actor
fixedvec3 vel;
SDWORD tics; // state tic counter SDWORD tics; // state tic counter
FState *state; FState *state;
VMFunction *Damage; // For missiles and monster railgun VMFunction *Damage; // For missiles and monster railgun
@ -1143,8 +1183,6 @@ public:
FSoundIDNoInit WallBounceSound; FSoundIDNoInit WallBounceSound;
FSoundIDNoInit CrushPainSound; FSoundIDNoInit CrushPainSound;
fixed_t Speed;
fixed_t FloatSpeed;
fixed_t MaxDropOffHeight, MaxStepHeight; fixed_t MaxDropOffHeight, MaxStepHeight;
SDWORD Mass; SDWORD Mass;
SWORD PainChance; SWORD PainChance;
@ -1229,23 +1267,40 @@ public:
bool HasSpecialDeathStates () const; bool HasSpecialDeathStates () const;
fixed_t X() const fixed_t _f_X() const
{ {
return __pos.x; return __pos.x;
} }
fixed_t Y() const fixed_t _f_Y() const
{ {
return __pos.y; return __pos.y;
} }
fixed_t Z() const fixed_t _f_Z() const
{ {
return __pos.z; return __pos.z;
} }
fixedvec3 Pos() const fixedvec3 _f_Pos() const
{ {
return __pos; return __pos;
} }
double X() const
{
return FIXED2DBL(__pos.x);
}
double Y() const
{
return FIXED2DBL(__pos.y);
}
double Z() const
{
return FIXED2DBL(__pos.z);
}
DVector3 Pos() const
{
return DVector3(X(), Y(), Z());
}
fixedvec3 PosRelative(int grp) const; fixedvec3 PosRelative(int grp) const;
fixedvec3 PosRelative(const AActor *other) const; fixedvec3 PosRelative(const AActor *other) const;
fixedvec3 PosRelative(sector_t *sec) const; fixedvec3 PosRelative(sector_t *sec) const;
@ -1253,42 +1308,74 @@ public:
fixed_t SoundX() const fixed_t SoundX() const
{ {
return X(); return _f_X();
} }
fixed_t SoundY() const fixed_t SoundY() const
{ {
return Y(); return _f_Y();
} }
fixed_t SoundZ() const fixed_t SoundZ() const
{ {
return Z(); return _f_Z();
} }
fixedvec3 InterpolatedPosition(fixed_t ticFrac) const fixedvec3 InterpolatedPosition(fixed_t ticFrac) const
{ {
fixedvec3 ret; fixedvec3 ret;
ret.x = PrevX + FixedMul (ticFrac, X() - PrevX); ret.x = PrevX + FixedMul (ticFrac, _f_X() - PrevX);
ret.y = PrevY + FixedMul (ticFrac, Y() - PrevY); ret.y = PrevY + FixedMul (ticFrac, _f_Y() - PrevY);
ret.z = PrevZ + FixedMul (ticFrac, Z() - PrevZ); ret.z = PrevZ + FixedMul (ticFrac, _f_Z() - PrevZ);
return ret; return ret;
} }
fixedvec3 PosPlusZ(fixed_t zadd) const fixedvec3 PosPlusZ(fixed_t zadd) const
{ {
fixedvec3 ret = { X(), Y(), Z() + zadd }; fixedvec3 ret = { _f_X(), _f_Y(), _f_Z() + zadd };
return ret; return ret;
} }
fixed_t Top() const fixed_t _f_Top() const
{ {
return Z() + height; return _f_Z() + height;
} }
void SetZ(fixed_t newz, bool moving = true) void _f_SetZ(fixed_t newz, bool moving = true)
{ {
__pos.z = newz; __pos.z = newz;
} }
void AddZ(fixed_t newz, bool moving = true) void _f_AddZ(fixed_t newz, bool moving = true)
{ {
__pos.z += newz; __pos.z += newz;
} }
double Top() const
{
return Z() + FIXED2DBL(height);
}
double Center() const
{
return Z() + FIXED2DBL(height/2);
}
double _Height() const
{
return FIXED2DBL(height);
}
double _Radius() const
{
return FIXED2DBL(radius);
}
double _pushfactor() const
{
return FIXED2DBL(pushfactor);
}
double _bouncefactor() const
{
return FIXED2DBL(bouncefactor);
}
void SetZ(double newz, bool moving = true)
{
__pos.z = FLOAT2FIXED(newz);
}
void AddZ(double newz, bool moving = true)
{
__pos.z += FLOAT2FIXED(newz);
}
// These are not for general use as they do not link the actor into the world! // These are not for general use as they do not link the actor into the world!
void SetXY(fixed_t xx, fixed_t yy) void SetXY(fixed_t xx, fixed_t yy)
@ -1314,53 +1401,78 @@ public:
__pos.z = npos.z; __pos.z = npos.z;
} }
fixed_t VelXYToSpeed() const double VelXYToSpeed() const
{ {
return xs_CRoundToInt(sqrt((double)vel.x * vel.x + (double)vel.y*vel.y)); return DVector2(Vel.X, Vel.Y).Length();
} }
fixed_t VelToSpeed() const double VelToSpeed() const
{ {
return xs_CRoundToInt(sqrt((double)vel.x * vel.x + (double)vel.y*vel.y + (double)vel.z*vel.z)); return Vel.Length();
} }
void AngleFromVel() void AngleFromVel()
{ {
Angles.Yaw = VecToAngle(vel.x, vel.y); Angles.Yaw = VecToAngle(Vel.X, Vel.Y);
} }
void VelFromAngle() void VelFromAngle()
{ {
vel.x = xs_CRoundToInt(Speed * Angles.Yaw.Cos()); Vel.X = Speed * Angles.Yaw.Cos();
vel.y = xs_CRoundToInt(Speed * Angles.Yaw.Sin()); Vel.Y = Speed * Angles.Yaw.Sin();
} }
void VelFromAngle(fixed_t speed) void VelFromAngle(double speed)
{ {
vel.x = xs_CRoundToInt(speed * Angles.Yaw.Cos()); Vel.X = speed * Angles.Yaw.Cos();
vel.y = xs_CRoundToInt(speed * Angles.Yaw.Sin()); Vel.Y = speed * Angles.Yaw.Sin();
} }
void VelFromAngle(DAngle angle, fixed_t speed) void VelFromAngle(DAngle angle, double speed)
{ {
vel.x = xs_CRoundToInt(speed * angle.Cos()); Vel.X = speed * angle.Cos();
vel.y = xs_CRoundToInt(speed * angle.Sin()); Vel.Y = speed * angle.Sin();
} }
void Vel3DFromAngle(DAngle angle, DAngle pitch, fixed_t speed) void Thrust()
{
Vel.X += Speed * Angles.Yaw.Cos();
Vel.Y += Speed * Angles.Yaw.Sin();
}
void Thrust(double speed)
{
Vel.X += speed * Angles.Yaw.Cos();
Vel.Y += speed * Angles.Yaw.Sin();
}
void Thrust(DAngle angle, double speed)
{
Vel.X += speed * angle.Cos();
Vel.Y += speed * angle.Sin();
}
void Vel3DFromAngle(DAngle angle, DAngle pitch, double speed)
{ {
double cospitch = pitch.Cos(); double cospitch = pitch.Cos();
vel.x = xs_CRoundToInt(speed * cospitch * angle.Cos()); Vel.X = speed * cospitch * angle.Cos();
vel.y = xs_CRoundToInt(speed * cospitch * angle.Sin()); Vel.Y = speed * cospitch * angle.Sin();
vel.z = xs_CRoundToInt(speed * -pitch.Sin()); Vel.Z = speed * -pitch.Sin();
} }
void Vel3DFromAngle(DAngle pitch, fixed_t speed) void Vel3DFromAngle(DAngle pitch, double speed)
{ {
double cospitch = pitch.Cos(); double cospitch = pitch.Cos();
vel.x = xs_CRoundToInt(speed * cospitch * Angles.Yaw.Cos()); Vel.X = speed * cospitch * Angles.Yaw.Cos();
vel.y = xs_CRoundToInt(speed * cospitch * Angles.Yaw.Sin()); Vel.Y = speed * cospitch * Angles.Yaw.Sin();
vel.z = xs_CRoundToInt(speed * -pitch.Sin()); Vel.Z = speed * -pitch.Sin();
}
// This is used by many vertical velocity calculations.
// Better have it in one place, if something needs to be changed about the formula.
double DistanceBySpeed(AActor *dest, double speed)
{
return MAX(1., Distance2D(dest) / speed);
} }
}; };
@ -1440,6 +1552,11 @@ inline AActor *Spawn (PClassActor *type, const fixedvec3 &pos, replace_t allowre
return AActor::StaticSpawn (type, pos.x, pos.y, pos.z, allowreplacement); return AActor::StaticSpawn (type, pos.x, pos.y, pos.z, allowreplacement);
} }
inline AActor *Spawn(PClassActor *type, const DVector3 &pos, replace_t allowreplacement)
{
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), allowreplacement);
}
AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement); AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);
AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement); AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);
@ -1448,11 +1565,21 @@ inline AActor *Spawn (const char *type, const fixedvec3 &pos, replace_t allowrep
return Spawn (type, pos.x, pos.y, pos.z, allowreplacement); return Spawn (type, pos.x, pos.y, pos.z, allowreplacement);
} }
inline AActor *Spawn(const char *type, const DVector3 &pos, replace_t allowreplacement)
{
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), allowreplacement);
}
inline AActor *Spawn (FName classname, const fixedvec3 &pos, replace_t allowreplacement) inline AActor *Spawn (FName classname, const fixedvec3 &pos, replace_t allowreplacement)
{ {
return Spawn (classname, pos.x, pos.y, pos.z, allowreplacement); return Spawn (classname, pos.x, pos.y, pos.z, allowreplacement);
} }
inline AActor *Spawn(FName type, const DVector3 &pos, replace_t allowreplacement)
{
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), allowreplacement);
}
template<class T> template<class T>
inline T *Spawn (fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement) inline T *Spawn (fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
@ -1466,7 +1593,13 @@ inline T *Spawn (const fixedvec3 &pos, replace_t allowreplacement)
return static_cast<T *>(AActor::StaticSpawn (RUNTIME_TEMPLATE_CLASS(T), pos.x, pos.y, pos.z, allowreplacement)); return static_cast<T *>(AActor::StaticSpawn (RUNTIME_TEMPLATE_CLASS(T), pos.x, pos.y, pos.z, allowreplacement));
} }
inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle) template<class T>
inline T *Spawn(const DVector3 &pos, replace_t allowreplacement)
{
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), allowreplacement));
}
inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
{ {
fixedvec2 ret = { FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), fixedvec2 ret = { FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) }; FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };

View file

@ -1012,8 +1012,8 @@ void AM_restoreScaleAndLoc ()
} }
else else
{ {
m_x = (players[consoleplayer].camera->X() >> FRACTOMAPBITS) - m_w/2; m_x = (players[consoleplayer].camera->_f_X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[consoleplayer].camera->Y() >> FRACTOMAPBITS)- m_h/2; m_y = (players[consoleplayer].camera->_f_Y() >> FRACTOMAPBITS)- m_h/2;
} }
m_x2 = m_x + m_w; m_x2 = m_x + m_w;
m_y2 = m_y + m_h; m_y2 = m_y + m_h;
@ -1263,8 +1263,8 @@ void AM_initVariables ()
if (playeringame[pnum]) if (playeringame[pnum])
break; break;
assert(pnum >= 0 && pnum < MAXPLAYERS); assert(pnum >= 0 && pnum < MAXPLAYERS);
m_x = (players[pnum].camera->X() >> FRACTOMAPBITS) - m_w/2; m_x = (players[pnum].camera->_f_X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->Y() >> FRACTOMAPBITS) - m_h/2; m_y = (players[pnum].camera->_f_Y() >> FRACTOMAPBITS) - m_h/2;
AM_changeWindowLoc(); AM_changeWindowLoc();
// for saving & restoring // for saving & restoring
@ -1585,25 +1585,25 @@ void AM_doFollowPlayer ()
fixed_t sx, sy; fixed_t sx, sy;
if (players[consoleplayer].camera != NULL && if (players[consoleplayer].camera != NULL &&
(f_oldloc.x != players[consoleplayer].camera->X() || (f_oldloc.x != players[consoleplayer].camera->_f_X() ||
f_oldloc.y != players[consoleplayer].camera->Y())) f_oldloc.y != players[consoleplayer].camera->_f_Y()))
{ {
m_x = (players[consoleplayer].camera->X() >> FRACTOMAPBITS) - m_w/2; m_x = (players[consoleplayer].camera->_f_X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[consoleplayer].camera->Y() >> FRACTOMAPBITS) - m_h/2; m_y = (players[consoleplayer].camera->_f_Y() >> FRACTOMAPBITS) - m_h/2;
m_x2 = m_x + m_w; m_x2 = m_x + m_w;
m_y2 = m_y + m_h; m_y2 = m_y + m_h;
// do the parallax parchment scrolling. // do the parallax parchment scrolling.
sx = (players[consoleplayer].camera->X() - f_oldloc.x) >> FRACTOMAPBITS; sx = (players[consoleplayer].camera->_f_X() - f_oldloc.x) >> FRACTOMAPBITS;
sy = (f_oldloc.y - players[consoleplayer].camera->Y()) >> FRACTOMAPBITS; sy = (f_oldloc.y - players[consoleplayer].camera->_f_Y()) >> FRACTOMAPBITS;
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
AM_rotate (&sx, &sy, players[consoleplayer].camera->_f_angle() - ANG90); AM_rotate (&sx, &sy, players[consoleplayer].camera->_f_angle() - ANG90);
} }
AM_ScrollParchment (sx, sy); AM_ScrollParchment (sx, sy);
f_oldloc.x = players[consoleplayer].camera->X(); f_oldloc.x = players[consoleplayer].camera->_f_X();
f_oldloc.y = players[consoleplayer].camera->Y(); f_oldloc.y = players[consoleplayer].camera->_f_Y();
} }
} }
@ -2668,7 +2668,7 @@ void AM_drawPlayers ()
mline_t *arrow; mline_t *arrow;
int numarrowlines; int numarrowlines;
fixedvec2 pos = am_portaloverlay? players[consoleplayer].camera->GetPortalTransition(players[consoleplayer].viewheight) : (fixedvec2)players[consoleplayer].camera->Pos(); fixedvec2 pos = am_portaloverlay? players[consoleplayer].camera->GetPortalTransition(players[consoleplayer].viewheight) : (fixedvec2)players[consoleplayer].camera->_f_Pos();
pt.x = pos.x >> FRACTOMAPBITS; pt.x = pos.x >> FRACTOMAPBITS;
pt.y = pos.y >> FRACTOMAPBITS; pt.y = pos.y >> FRACTOMAPBITS;
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
@ -3041,7 +3041,7 @@ void AM_drawAuthorMarkers ()
marked->subsector->flags & SSECF_DRAWN : marked->subsector->flags & SSECF_DRAWN :
marked->Sector->MoreFlags & SECF_DRAWN))) marked->Sector->MoreFlags & SECF_DRAWN)))
{ {
DrawMarker (tex, marked->X() >> FRACTOMAPBITS, marked->Y() >> FRACTOMAPBITS, 0, DrawMarker (tex, marked->_f_X() >> FRACTOMAPBITS, marked->_f_Y() >> FRACTOMAPBITS, 0,
flip, mark->scaleX, mark->scaleY, mark->Translation, flip, mark->scaleX, mark->scaleY, mark->Translation,
mark->alpha, mark->fillcolor, mark->RenderStyle); mark->alpha, mark->fillcolor, mark->RenderStyle);
} }

View file

@ -44,7 +44,7 @@ bool DBot::Reachable (AActor *rtarget)
fixed_t estimated_dist = player->mo->AproxDistance(rtarget); fixed_t estimated_dist = player->mo->AproxDistance(rtarget);
bool reachable = true; bool reachable = true;
FPathTraverse it(player->mo->X()+player->mo->vel.x, player->mo->Y()+player->mo->vel.y, rtarget->X(), rtarget->Y(), PT_ADDLINES|PT_ADDTHINGS); FPathTraverse it(player->mo->_f_X()+player->mo->_f_velx(), player->mo->_f_Y()+player->mo->_f_vely(), rtarget->_f_X(), rtarget->_f_Y(), PT_ADDLINES|PT_ADDTHINGS);
intercept_t *in; intercept_t *in;
while ((in = it.Next())) while ((in = it.Next()))
{ {
@ -58,8 +58,8 @@ bool DBot::Reachable (AActor *rtarget)
frac = in->frac - FixedDiv (4*FRACUNIT, MAX_TRAVERSE_DIST); frac = in->frac - FixedDiv (4*FRACUNIT, MAX_TRAVERSE_DIST);
dist = FixedMul (frac, MAX_TRAVERSE_DIST); dist = FixedMul (frac, MAX_TRAVERSE_DIST);
hitx = it.Trace().x + FixedMul (player->mo->vel.x, frac); hitx = it.Trace().x + FixedMul (player->mo->_f_velx(), frac);
hity = it.Trace().y + FixedMul (player->mo->vel.y, frac); hity = it.Trace().y + FixedMul (player->mo->_f_vely(), frac);
if (in->isaline) if (in->isaline)
{ {
@ -170,7 +170,7 @@ void DBot::Dofire (ticcmd_t *cmd)
no_fire = true; no_fire = true;
//Distance to enemy. //Distance to enemy.
dist = player->mo->AproxDistance(enemy, player->mo->vel.x - enemy->vel.x, player->mo->vel.y - enemy->vel.y); dist = player->mo->AproxDistance(enemy, player->mo->_f_velx() - enemy->_f_velx(), player->mo->_f_vely() - enemy->_f_vely());
//FIRE EACH TYPE OF WEAPON DIFFERENT: Here should all the different weapons go. //FIRE EACH TYPE OF WEAPON DIFFERENT: Here should all the different weapons go.
if (player->ReadyWeapon->WeaponFlags & WIF_MELEEWEAPON) if (player->ReadyWeapon->WeaponFlags & WIF_MELEEWEAPON)
@ -222,8 +222,8 @@ void DBot::Dofire (ticcmd_t *cmd)
// prediction aiming // prediction aiming
shootmissile: shootmissile:
dist = player->mo->AproxDistance (enemy); dist = player->mo->AproxDistance (enemy);
m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->Speed; m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->_f_speed();
bglobal.SetBodyAt (enemy->X() + enemy->vel.x*m*2, enemy->Y() + enemy->vel.y*m*2, enemy->Z(), 1); bglobal.SetBodyAt (enemy->_f_X() + enemy->_f_velx()*m*2, enemy->_f_Y() + enemy->_f_vely()*m*2, enemy->_f_Z(), 1);
angle = player->mo->__f_AngleTo(bglobal.body1); angle = player->mo->__f_AngleTo(bglobal.body1);
if (Check_LOS (enemy, SHOOTFOV)) if (Check_LOS (enemy, SHOOTFOV))
no_fire = false; no_fire = false;
@ -467,22 +467,16 @@ fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
th->target = source; // where it came from th->target = source; // where it came from
float speed = (float)th->Speed;
fixedvec3 fixvel = source->Vec3To(dest); th->Vel = source->Vec3To(dest).Resized(th->Speed);
DVector3 velocity(fixvel.x, fixvel.y, fixvel.z);
velocity.MakeUnit();
th->vel.x = FLOAT2FIXED(velocity[0] * speed);
th->vel.y = FLOAT2FIXED(velocity[1] * speed);
th->vel.z = FLOAT2FIXED(velocity[2] * speed);
fixed_t dist = 0; fixed_t dist = 0;
while (dist < SAFE_SELF_MISDIST) while (dist < SAFE_SELF_MISDIST)
{ {
dist += th->Speed; dist += th->_f_speed();
th->Move(th->vel.x, th->vel.y, th->vel.z); th->Move(th->_f_velx(), th->_f_vely(), th->_f_velz());
if (!CleanAhead (th, th->X(), th->Y(), cmd)) if (!CleanAhead (th, th->_f_X(), th->_f_Y(), cmd))
break; break;
} }
th->Destroy (); th->Destroy ();
@ -496,9 +490,9 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
AActor *actor; AActor *actor;
int m; int m;
bglobal.SetBodyAt (player->mo->X() + FixedMul(player->mo->vel.x, 5*FRACUNIT), bglobal.SetBodyAt (player->mo->_f_X() + FixedMul(player->mo->_f_velx(), 5*FRACUNIT),
player->mo->Y() + FixedMul(player->mo->vel.y, 5*FRACUNIT), player->mo->_f_Y() + FixedMul(player->mo->_f_vely(), 5*FRACUNIT),
player->mo->Z() + (player->mo->height / 2), 2); player->mo->_f_Z() + (player->mo->height / 2), 2);
actor = bglobal.body2; actor = bglobal.body2;
@ -506,16 +500,16 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
if (dist < SAFE_SELF_MISDIST) if (dist < SAFE_SELF_MISDIST)
return 0; return 0;
//Predict. //Predict.
m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->Speed); m = (((dist+1)/FRACUNIT) / GetDefaultByName("Rocket")->_f_speed());
bglobal.SetBodyAt (enemy->X() + FixedMul(enemy->vel.x, (m+2*FRACUNIT)), bglobal.SetBodyAt (enemy->_f_X() + FixedMul(enemy->_f_velx(), (m+2*FRACUNIT)),
enemy->Y() + FixedMul(enemy->vel.y, (m+2*FRACUNIT)), ONFLOORZ, 1); enemy->_f_Y() + FixedMul(enemy->_f_vely(), (m+2*FRACUNIT)), ONFLOORZ, 1);
//try the predicted location //try the predicted location
if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile
{ {
FCheckPosition tm; FCheckPosition tm;
if (bglobal.SafeCheckPosition (player->mo, actor->X(), actor->Y(), tm)) if (bglobal.SafeCheckPosition (player->mo, actor->_f_X(), actor->_f_Y(), tm))
{ {
if (bglobal.FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST) if (bglobal.FakeFire (actor, bglobal.body1, cmd) >= SAFE_SELF_MISDIST)
{ {

View file

@ -71,8 +71,8 @@ bool DBot::Move (ticcmd_t *cmd)
if ((unsigned)player->mo->movedir >= 8) if ((unsigned)player->mo->movedir >= 8)
I_Error ("Weird bot movedir!"); I_Error ("Weird bot movedir!");
tryx = player->mo->X() + 8*xspeed[player->mo->movedir]; tryx = player->mo->_f_X() + 8*xspeed[player->mo->movedir];
tryy = player->mo->Y() + 8*yspeed[player->mo->movedir]; tryy = player->mo->_f_Y() + 8*yspeed[player->mo->movedir];
try_ok = bglobal.CleanAhead (player->mo, tryx, tryy, cmd); try_ok = bglobal.CleanAhead (player->mo, tryx, tryy, cmd);
@ -148,7 +148,7 @@ void DBot::NewChaseDir (ticcmd_t *cmd)
olddir = (dirtype_t)player->mo->movedir; olddir = (dirtype_t)player->mo->movedir;
turnaround = opposite[olddir]; turnaround = opposite[olddir];
fixedvec2 delta = player->mo->Vec2To(dest); fixedvec2 delta = player->mo->_f_Vec2To(dest);
if (delta.x > 10*FRACUNIT) if (delta.x > 10*FRACUNIT)
d[1] = DI_EAST; d[1] = DI_EAST;
@ -284,7 +284,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
if ( !(thing->flags & MF_TELEPORT) && if ( !(thing->flags & MF_TELEPORT) &&
tm.ceilingz - thing->Z() < thing->height) tm.ceilingz - thing->_f_Z() < thing->height)
return false; // mobj must lower itself to fit return false; // mobj must lower itself to fit
// jump out of water // jump out of water
@ -292,7 +292,7 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
// maxstep=37*FRACUNIT; // maxstep=37*FRACUNIT;
if ( !(thing->flags & MF_TELEPORT) && if ( !(thing->flags & MF_TELEPORT) &&
(tm.floorz - thing->Z() > maxstep ) ) (tm.floorz - thing->_f_Z() > maxstep ) )
return false; // too big a step up return false; // too big a step up
@ -348,7 +348,7 @@ void DBot::Pitch (AActor *target)
double aim; double aim;
double diff; double diff;
diff = target->Z() - player->mo->Z(); diff = target->_f_Z() - player->mo->_f_Z();
aim = g_atan(diff / (double)player->mo->AproxDistance(target)); aim = g_atan(diff / (double)player->mo->AproxDistance(target));
player->mo->Angles.Pitch = ToDegrees(aim); player->mo->Angles.Pitch = ToDegrees(aim);
} }

View file

@ -87,7 +87,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
dist = dest ? player->mo->AproxDistance(dest) : 0; dist = dest ? player->mo->AproxDistance(dest) : 0;
if (missile && if (missile &&
((!missile->vel.x || !missile->vel.y) || !Check_LOS(missile, SHOOTFOV*3/2))) ((!missile->_f_velx() || !missile->_f_vely()) || !Check_LOS(missile, SHOOTFOV*3/2)))
{ {
sleft = !sleft; sleft = !sleft;
missile = NULL; //Probably ended its travel. missile = NULL; //Probably ended its travel.
@ -306,8 +306,8 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
if (t_fight<(AFTERTICS/2)) if (t_fight<(AFTERTICS/2))
player->mo->flags |= MF_DROPOFF; player->mo->flags |= MF_DROPOFF;
oldx = player->mo->X(); oldx = player->mo->_f_X();
oldy = player->mo->Y(); oldy = player->mo->_f_Y();
} }
//BOT_WhatToGet //BOT_WhatToGet

View file

@ -943,9 +943,8 @@ static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const cha
{ {
if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo)) if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo))
{ {
Printf ("%s at (%d,%d,%d)\n", Printf ("%s at (%f,%f,%f)\n",
mo->GetClass()->TypeName.GetChars(), mo->GetClass()->TypeName.GetChars(), mo->X(), mo->Y(), mo->Z());
mo->X() >> FRACBITS, mo->Y() >> FRACBITS, mo->Z() >> FRACBITS);
} }
} }
} }
@ -1087,7 +1086,7 @@ CCMD(currentpos)
if(mo) if(mo)
{ {
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n", Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
FIXED2DBL(mo->X()), FIXED2DBL(mo->Y()), FIXED2DBL(mo->Z()), ANGLE2DBL(mo->_f_angle()), FIXED2DBL(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel); mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw, FIXED2DBL(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel);
} }
else else
{ {

View file

@ -915,7 +915,7 @@ static int PatchThing (int thingy)
{ {
if (stricmp (Line1, "Speed") == 0) if (stricmp (Line1, "Speed") == 0)
{ {
info->Speed = val; info->Speed = val; // handle fixed point later.
} }
else if (stricmp (Line1, "Width") == 0) else if (stricmp (Line1, "Width") == 0)
{ {
@ -1278,9 +1278,9 @@ static int PatchThing (int thingy)
} }
// If this thing's speed is really low (i.e. meant to be a monster), // If this thing's speed is really low (i.e. meant to be a monster),
// bump it up, because all speeds are fixed point now. // bump it up, because all speeds are fixed point now.
if (abs(info->Speed) < 256) if (fabs(info->Speed) >= 256)
{ {
info->Speed <<= FRACBITS; info->Speed /= FRACUNIT;
} }
if (info->flags & MF_SPECIAL) if (info->flags & MF_SPECIAL)

View file

@ -2321,7 +2321,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
else else
{ {
const AActor *def = GetDefaultByType (typeinfo); const AActor *def = GetDefaultByType (typeinfo);
fixedvec3 spawnpos = source->Vec3Angle(def->radius * 2 + source->radius, source->_f_angle(), 8 * FRACUNIT); fixedvec3 spawnpos = source->_f_Vec3Angle(def->radius * 2 + source->radius, source->_f_angle(), 8 * FRACUNIT);
AActor *spawned = Spawn (typeinfo, spawnpos, ALLOW_REPLACE); AActor *spawned = Spawn (typeinfo, spawnpos, ALLOW_REPLACE);
if (spawned != NULL) if (spawned != NULL)
@ -2374,8 +2374,8 @@ void Net_DoCommand (int type, BYTE **stream, int player)
s = ReadString (stream); s = ReadString (stream);
if (Trace (players[player].mo->X(), players[player].mo->Y(), if (Trace (players[player].mo->_f_X(), players[player].mo->_f_Y(),
players[player].mo->Top() - (players[player].mo->height>>2), players[player].mo->_f_Top() - (players[player].mo->height>>2),
players[player].mo->Sector, players[player].mo->Sector,
vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, players[player].mo, vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, players[player].mo,
trace, TRACE_NoSky)) trace, TRACE_NoSky))

View file

@ -114,7 +114,7 @@ public:
virtual void PlayIdle (); virtual void PlayIdle ();
virtual void PlayRunning (); virtual void PlayRunning ();
virtual void ThrowPoisonBag (); virtual void ThrowPoisonBag ();
virtual void TweakSpeeds (int &forwardmove, int &sidemove); virtual void TweakSpeeds (double &forwardmove, double &sidemove);
virtual void MorphPlayerThink (); virtual void MorphPlayerThink ();
virtual void ActivateMorphWeapon (); virtual void ActivateMorphWeapon ();
AWeapon *PickNewWeapon (PClassAmmo *ammotype); AWeapon *PickNewWeapon (PClassAmmo *ammotype);
@ -149,12 +149,12 @@ public:
TObjPtr<AInventory> InvSel; // selected inventory item TObjPtr<AInventory> InvSel; // selected inventory item
// [GRB] Player class properties // [GRB] Player class properties
fixed_t JumpZ; double JumpZ;
fixed_t GruntSpeed; fixed_t GruntSpeed;
fixed_t FallingScreamMinSpeed, FallingScreamMaxSpeed; fixed_t FallingScreamMinSpeed, FallingScreamMaxSpeed;
fixed_t ViewHeight; fixed_t ViewHeight;
fixed_t ForwardMove1, ForwardMove2; double ForwardMove1, ForwardMove2;
fixed_t SideMove1, SideMove2; double SideMove1, SideMove2;
FTextureID ScoreIcon; FTextureID ScoreIcon;
int SpawnMask; int SpawnMask;
FNameNoInit MorphWeapon; FNameNoInit MorphWeapon;
@ -329,13 +329,13 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
{ {
return *static_cast<FBoolCVar *>(*CheckKey(NAME_NeverSwitchOnPickup)); return *static_cast<FBoolCVar *>(*CheckKey(NAME_NeverSwitchOnPickup));
} }
fixed_t GetMoveBob() const double GetMoveBob() const
{ {
return FLOAT2FIXED(*static_cast<FFloatCVar *>(*CheckKey(NAME_MoveBob))); return *static_cast<FFloatCVar *>(*CheckKey(NAME_MoveBob));
} }
fixed_t GetStillBob() const double GetStillBob() const
{ {
return FLOAT2FIXED(*static_cast<FFloatCVar *>(*CheckKey(NAME_StillBob))); return *static_cast<FFloatCVar *>(*CheckKey(NAME_StillBob));
} }
int GetPlayerClassNum() const int GetPlayerClassNum() const
{ {
@ -405,13 +405,13 @@ public:
fixed_t viewz; // focal origin above r.z fixed_t viewz; // focal origin above r.z
fixed_t viewheight; // base height above floor for viewz fixed_t viewheight; // base height above floor for viewz
fixed_t deltaviewheight; // squat speed. fixed_t deltaviewheight; // squat speed.
fixed_t bob; // bounded/scaled total velocity double bob; // bounded/scaled total velocity
// killough 10/98: used for realistic bobbing (i.e. not simply overall speed) // killough 10/98: used for realistic bobbing (i.e. not simply overall speed)
// mo->vel.x and mo->vel.y represent true velocity experienced by player. // mo->velx and mo->vely represent true velocity experienced by player.
// This only represents the thrust that the player applies himself. // This only represents the thrust that the player applies himself.
// This avoids anomalies with such things as Boom ice and conveyors. // This avoids anomalies with such things as Boom ice and conveyors.
fixedvec2 vel; DVector2 Vel;
bool centering; bool centering;
BYTE turnticks; BYTE turnticks;
@ -491,7 +491,7 @@ public:
DAngle MinPitch; // Viewpitch limits (negative is up, positive is down) DAngle MinPitch; // Viewpitch limits (negative is up, positive is down)
DAngle MaxPitch; DAngle MaxPitch;
fixed_t crouchfactor; double crouchfactor;
fixed_t crouchoffset; fixed_t crouchoffset;
fixed_t crouchviewdelta; fixed_t crouchviewdelta;
@ -509,9 +509,9 @@ public:
void Uncrouch() void Uncrouch()
{ {
if (crouchfactor != FRACUNIT) if (crouchfactor != 1)
{ {
crouchfactor = FRACUNIT; crouchfactor = 1;
crouchoffset = 0; crouchoffset = 0;
crouchdir = 0; crouchdir = 0;
crouching = 0; crouching = 0;
@ -556,7 +556,7 @@ inline bool AActor::IsNoClip2() const
return false; return false;
} }
#define CROUCHSPEED (FRACUNIT/12) #define CROUCHSPEED (1./12)
bool P_IsPlayerTotallyFrozen(const player_t *player); bool P_IsPlayerTotallyFrozen(const player_t *player);

View file

@ -365,11 +365,14 @@ enum
// linedefs. More friction can create mud, sludge, // linedefs. More friction can create mud, sludge,
// magnetized floors, etc. Less friction can create ice. // magnetized floors, etc. Less friction can create ice.
#define MORE_FRICTION_VELOCITY 15000 // mud factor based on velocity #define MORE_FRICTION_VELOCITY (15000/65536.) // mud factor based on velocity
#define ORIG_FRICTION 0xE800 // original value #define ORIG_FRICTION 0xE800 // original value
#define fORIG_FRICTION (ORIG_FRICTION/65536.)
#define ORIG_FRICTION_FACTOR 2048 // original value #define ORIG_FRICTION_FACTOR 2048 // original value
#define fORIG_FRICTION_FACTOR (2048/65536.) // original value
#define FRICTION_LOW 0xf900 #define FRICTION_LOW 0xf900
#define FRICTION_FLY 0xeb00 #define FRICTION_FLY 0xeb00
#define fFRICTION_FLY (0xeb00/65536.)
#define BLINKTHRESHOLD (4*32) #define BLINKTHRESHOLD (4*32)

View file

@ -1535,15 +1535,18 @@ FArchive &operator<< (FArchive &arc, side_t *&side)
FArchive &operator<<(FArchive &arc, DAngle &ang) FArchive &operator<<(FArchive &arc, DAngle &ang)
{ {
if (SaveVersion >= 4534) arc << ang.Degrees;
{ return arc;
arc << ang.Degrees; }
}
else FArchive &operator<<(FArchive &arc, DVector3 &vec)
{ {
angle_t an; arc << vec.X << vec.Y << vec.Z;
arc << an; return arc;
ang.Degrees = ANGLE2DBL(an); }
}
FArchive &operator<<(FArchive &arc, DVector2 &vec)
{
arc << vec.X << vec.Y;
return arc; return arc;
} }

View file

@ -325,6 +325,8 @@ FArchive &operator<< (FArchive &arc, vertex_t *&vert);
FArchive &operator<< (FArchive &arc, side_t *&side); FArchive &operator<< (FArchive &arc, side_t *&side);
FArchive &operator<<(FArchive &arc, DAngle &ang); FArchive &operator<<(FArchive &arc, DAngle &ang);
FArchive &operator<<(FArchive &arc, DVector3 &vec);
FArchive &operator<<(FArchive &arc, DVector2 &vec);

View file

@ -983,8 +983,7 @@ void FParser::SF_ObjX(void)
mo = Script->trigger; mo = Script->trigger;
} }
t_return.type = svt_fixed; // haleyjd: SoM's fixed-point fix t_return.setDouble(mo ? mo->X() : 0.);
t_return.value.f = mo ? mo->X() : 0; // null ptr check
} }
//========================================================================== //==========================================================================
@ -1006,8 +1005,7 @@ void FParser::SF_ObjY(void)
mo = Script->trigger; mo = Script->trigger;
} }
t_return.type = svt_fixed; // haleyjd t_return.setDouble(mo ? mo->Y() : 0.);
t_return.value.f = mo ? mo->Y() : 0; // null ptr check
} }
//========================================================================== //==========================================================================
@ -1029,8 +1027,7 @@ void FParser::SF_ObjZ(void)
mo = Script->trigger; mo = Script->trigger;
} }
t_return.type = svt_fixed; // haleyjd t_return.setDouble(mo ? mo->Z() : 0.);
t_return.value.f = mo ? mo->Z() : 0; // null ptr check
} }
@ -1334,11 +1331,10 @@ void FParser::SF_MobjMomx(void)
if(t_argc > 1) if(t_argc > 1)
{ {
if(mo) if(mo)
mo->vel.x = fixedvalue(t_argv[1]); mo->Vel.X = floatvalue(t_argv[1]);
} }
t_return.type = svt_fixed; t_return.setDouble(mo ? mo->Vel.X : 0.);
t_return.value.f = mo ? mo->vel.x : 0;
} }
} }
@ -1357,12 +1353,11 @@ void FParser::SF_MobjMomy(void)
mo = actorvalue(t_argv[0]); mo = actorvalue(t_argv[0]);
if(t_argc > 1) if(t_argc > 1)
{ {
if(mo) if(mo)
mo->vel.y = fixedvalue(t_argv[1]); mo->Vel.Y = floatvalue(t_argv[1]);
} }
t_return.type = svt_fixed; t_return.setDouble(mo ? mo->Vel.Y : 0.);
t_return.value.f = mo ? mo->vel.y : 0;
} }
} }
@ -1379,14 +1374,13 @@ void FParser::SF_MobjMomz(void)
if (CheckArgs(1)) if (CheckArgs(1))
{ {
mo = actorvalue(t_argv[0]); mo = actorvalue(t_argv[0]);
if(t_argc > 1) if (t_argc > 1)
{ {
if(mo) if (mo)
mo->vel.z = fixedvalue(t_argv[1]); mo->Vel.Z = floatvalue(t_argv[1]);
} }
t_return.type = svt_fixed; t_return.setDouble(mo ? mo->Vel.Z : 0.);
t_return.value.f = mo ? mo->vel.z : 0;
} }
} }
@ -1467,8 +1461,8 @@ void FParser::SF_SetCamera(void)
angle = t_argc < 2 ? newcamera->Angles.Yaw : floatvalue(t_argv[1]); angle = t_argc < 2 ? newcamera->Angles.Yaw : floatvalue(t_argv[1]);
newcamera->special1 = newcamera->Angles.Yaw.BAMs(); newcamera->special1 = newcamera->Angles.Yaw.BAMs();
newcamera->special2=newcamera->Z(); newcamera->special2=newcamera->_f_Z();
newcamera->SetZ(t_argc < 3 ? (newcamera->Z() + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS)); newcamera->_f_SetZ(t_argc < 3 ? (newcamera->_f_Z() + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS));
newcamera->Angles.Yaw = angle; newcamera->Angles.Yaw = angle;
if (t_argc < 4) newcamera->Angles.Pitch = 0.; if (t_argc < 4) newcamera->Angles.Pitch = 0.;
else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.); else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.);
@ -1493,7 +1487,7 @@ void FParser::SF_ClearCamera(void)
{ {
player->camera=player->mo; player->camera=player->mo;
cam->Angles.Yaw = ANGLE2DBL(cam->special1); cam->Angles.Yaw = ANGLE2DBL(cam->special1);
cam->SetZ(cam->special2); cam->_f_SetZ(cam->special2);
} }
} }
@ -3100,8 +3094,8 @@ void FParser::SF_MoveCamera(void)
anglespeed = (angle_t)FixedToAngle(fixedvalue(t_argv[5])); anglespeed = (angle_t)FixedToAngle(fixedvalue(t_argv[5]));
// figure out how big one step will be // figure out how big one step will be
fixedvec2 dist = cam->Vec2To(target); fixedvec2 dist = cam->_f_Vec2To(target);
zdist = targetheight - cam->Z(); zdist = targetheight - cam->_f_Z();
// Angle checking... // Angle checking...
// 90 // 90
@ -3174,18 +3168,18 @@ void FParser::SF_MoveCamera(void)
anglestep = anglespeed; anglestep = anglespeed;
if(abs(xstep) >= (abs(dist.x) - 1)) if(abs(xstep) >= (abs(dist.x) - 1))
x = cam->X() + dist.x; x = cam->_f_X() + dist.x;
else else
{ {
x = cam->X() + xstep; x = cam->_f_X() + xstep;
moved = 1; moved = 1;
} }
if(abs(ystep) >= (abs(dist.y) - 1)) if(abs(ystep) >= (abs(dist.y) - 1))
y = cam->Y() + dist.y; y = cam->_f_Y() + dist.y;
else else
{ {
y = cam->Y() + ystep; y = cam->_f_Y() + ystep;
moved = 1; moved = 1;
} }
@ -3193,7 +3187,7 @@ void FParser::SF_MoveCamera(void)
z = targetheight; z = targetheight;
else else
{ {
z = cam->Z() + zstep; z = cam->_f_Z() + zstep;
moved = 1; moved = 1;
} }
@ -3215,12 +3209,12 @@ void FParser::SF_MoveCamera(void)
cam->radius=8; cam->radius=8;
cam->height=8; cam->height=8;
if ((x != cam->X() || y != cam->Y()) && !P_TryMove(cam, x, y, true)) if ((x != cam->_f_X() || y != cam->_f_Y()) && !P_TryMove(cam, x, y, true))
{ {
Printf("Illegal camera move to (%f, %f)\n", x/65536.f, y/65536.f); Printf("Illegal camera move to (%f, %f)\n", x/65536.f, y/65536.f);
return; return;
} }
cam->SetZ(z); cam->_f_SetZ(z);
t_return.type = svt_int; t_return.type = svt_int;
t_return.value.i = moved; t_return.value.i = moved;
@ -3415,8 +3409,8 @@ void FParser::SF_SetObjPosition()
mobj->SetOrigin( mobj->SetOrigin(
fixedvalue(t_argv[1]), fixedvalue(t_argv[1]),
(t_argc >= 3)? fixedvalue(t_argv[2]) : mobj->Y(), (t_argc >= 3)? fixedvalue(t_argv[2]) : mobj->_f_Y(),
(t_argc >= 4)? fixedvalue(t_argv[3]) : mobj->Z(), false); (t_argc >= 4)? fixedvalue(t_argv[3]) : mobj->_f_Z(), false);
} }
} }
@ -4285,7 +4279,8 @@ void FParser::SF_SpawnShot2(void)
{ {
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM); S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM);
mo->target = source; mo->target = source;
P_ThrustMobj(mo, (mo->Angles.Yaw = source->Angles.Yaw), mo->Speed); mo->Angles.Yaw = source->Angles.Yaw;
mo->Thrust();
if (!P_CheckMissileSpawn(mo, source->radius)) mo = NULL; if (!P_CheckMissileSpawn(mo, source->radius)) mo = NULL;
} }
t_return.value.mobj = mo; t_return.value.mobj = mo;

View file

@ -68,7 +68,7 @@ void A_Fire(AActor *self, int height)
if (!P_CheckSight (self->target, dest, 0) ) if (!P_CheckSight (self->target, dest, 0) )
return; return;
fixedvec3 newpos = dest->Vec3Angle(24 * FRACUNIT, dest->_f_angle(), height); DVector3 newpos = dest->Vec3Angle(24., dest->Angles.Yaw, height);
self->SetOrigin(newpos, true); self->SetOrigin(newpos, true);
} }
@ -147,14 +147,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
if (fire != NULL) if (fire != NULL)
{ {
// move the fire between the vile and the player // move the fire between the vile and the player
fixedvec3 pos = target->Vec3Angle(-24 * FRACUNIT, self->_f_angle(), 0); DVector3 pos = target->Vec3Angle(-24., self->Angles.Yaw, 0);
fire->SetOrigin (pos, true); fire->SetOrigin (pos, true);
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0); P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);
} }
if (!(target->flags7 & MF7_DONTTHRUST)) if (!(target->flags7 & MF7_DONTTHRUST))
{ {
target->vel.z = Scale(thrust, 1000, target->Mass); target->Vel.Z = FIXED2FLOAT(Scale(thrust, 1000, target->Mass));
} }
return 0; return 0;
} }

View file

@ -37,7 +37,7 @@ static void BrainishExplosion (fixed_t x, fixed_t y, fixed_t z)
if (boom != NULL) if (boom != NULL)
{ {
boom->DeathSound = "misc/brainexplode"; boom->DeathSound = "misc/brainexplode";
boom->vel.z = pr_brainscream() << 9; boom->Vel.Z = pr_brainscream() /128.;
PClassActor *cls = PClass::FindActor("BossBrain"); PClassActor *cls = PClass::FindActor("BossBrain");
if (cls != NULL) if (cls != NULL)
@ -59,9 +59,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
fixed_t x; fixed_t x;
for (x = self->X() - 196*FRACUNIT; x < self->X() + 320*FRACUNIT; x += 8*FRACUNIT) for (x = self->_f_X() - 196*FRACUNIT; x < self->_f_X() + 320*FRACUNIT; x += 8*FRACUNIT)
{ {
BrainishExplosion (x, self->Y() - 320*FRACUNIT, BrainishExplosion (x, self->_f_Y() - 320*FRACUNIT,
128 + (pr_brainscream() << (FRACBITS + 1))); 128 + (pr_brainscream() << (FRACBITS + 1)));
} }
S_Sound (self, CHAN_VOICE, "brain/death", 1, ATTN_NONE); S_Sound (self, CHAN_VOICE, "brain/death", 1, ATTN_NONE);
@ -71,9 +71,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
DEFINE_ACTION_FUNCTION(AActor, A_BrainExplode) DEFINE_ACTION_FUNCTION(AActor, A_BrainExplode)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
fixed_t x = self->X() + pr_brainexplode.Random2()*2048; fixed_t x = self->_f_X() + pr_brainexplode.Random2()*2048;
fixed_t z = 128 + pr_brainexplode()*2*FRACUNIT; fixed_t z = 128 + pr_brainexplode()*2*FRACUNIT;
BrainishExplosion (x, self->Y(), z); BrainishExplosion (x, self->_f_Y(), z);
return 0; return 0;
} }
@ -144,17 +144,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BrainSpit)
spit->master = self; spit->master = self;
// [RH] Do this correctly for any trajectory. Doom would divide by 0 // [RH] Do this correctly for any trajectory. Doom would divide by 0
// if the target had the same y coordinate as the spitter. // if the target had the same y coordinate as the spitter.
if ((spit->vel.x | spit->vel.y) == 0) if (spit->Vel.X == 0 && spit->Vel.Y == 0)
{ {
spit->special2 = 0; spit->special2 = 0;
} }
else if (abs(spit->vel.y) > abs(spit->vel.x)) else if (fabs(spit->Vel.X) > fabs(spit->Vel.Y))
{ {
spit->special2 = (targ->Y() - self->Y()) / spit->vel.y; spit->special2 = int((targ->Y() - self->Y()) / spit->Vel.Y);
} }
else else
{ {
spit->special2 = (targ->X() - self->X()) / spit->vel.x; spit->special2 = int((targ->X() - self->X()) / spit->Vel.X);
} }
// [GZ] Calculates when the projectile will have reached destination // [GZ] Calculates when the projectile will have reached destination
spit->special2 += level.maptime; spit->special2 += level.maptime;
@ -286,7 +286,7 @@ static void SpawnFly(AActor *self, PClassActor *spawntype, FSoundID sound)
if (!(newmobj->ObjectFlags & OF_EuthanizeMe)) if (!(newmobj->ObjectFlags & OF_EuthanizeMe))
{ {
// telefrag anything in this spot // telefrag anything in this spot
P_TeleportMove (newmobj, newmobj->Pos(), true); P_TeleportMove (newmobj, newmobj->_f_Pos(), true);
} }
newmobj->flags4 |= MF4_BOSSSPAWNED; newmobj->flags4 |= MF4_BOSSSPAWNED;
} }

View file

@ -694,7 +694,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
damage = defdamage; damage = defdamage;
} }
int newdam = P_DamageMobj(t.linetarget, self->target, self->target, damage, dmgType, dmgFlags|DMG_USEANGLE, FLOAT2ANGLE(t.angleFromSource.Degrees)); int newdam = P_DamageMobj(t.linetarget, self->target, self->target, damage, dmgType, dmgFlags|DMG_USEANGLE, t.angleFromSource.Degrees);
P_TraceBleed(newdam > 0 ? newdam : damage, &t, self); P_TraceBleed(newdam > 0 ? newdam : damage, &t, self);
} }
} }

View file

@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
PARAM_INT_OPT (n) { n = 0; } PARAM_INT_OPT (n) { n = 0; }
PARAM_INT_OPT (flags) { flags = 0; } PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FIXED_OPT (vrange) { vrange = 4*FRACUNIT; } PARAM_FIXED_OPT (vrange) { vrange = 4*FRACUNIT; }
PARAM_FIXED_OPT (hrange) { hrange = FRACUNIT/2; } PARAM_FLOAT_OPT (hrange) { hrange = 0.5; }
int i, j; int i, j;
@ -153,9 +153,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
{ {
AActor *mo; AActor *mo;
target->SetXYZ( target->SetXYZ(
self->X() + (i << FRACBITS), // Aim in many directions from source self->_f_X() + (i << FRACBITS), // Aim in many directions from source
self->Y() + (j << FRACBITS), self->_f_Y() + (j << FRACBITS),
self->Z() + (P_AproxDistance(i,j) * vrange)); // Aim up fairly high self->_f_Z() + (P_AproxDistance(i,j) * vrange)); // Aim up fairly high
if ((flags & MSF_Classic) || // Flag explicitely set, or no flags and compat options if ((flags & MSF_Classic) || // Flag explicitely set, or no flags and compat options
(flags == 0 && (self->state->DefineFlags & SDF_DEHACKED) && (i_compatflags & COMPATF_MUSHROOM))) (flags == 0 && (self->state->DefineFlags & SDF_DEHACKED) && (i_compatflags & COMPATF_MUSHROOM)))
{ // Use old function for MBF compatibility { // Use old function for MBF compatibility
@ -167,9 +167,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
} }
if (mo != NULL) if (mo != NULL)
{ // Slow it down a bit { // Slow it down a bit
mo->vel.x = FixedMul(mo->vel.x, hrange); mo->Vel *= hrange;
mo->vel.y = FixedMul(mo->vel.y, hrange);
mo->vel.z = FixedMul(mo->vel.z, hrange);
mo->flags &= ~MF_NOGRAVITY; // Make debris fall under gravity mo->flags &= ~MF_NOGRAVITY; // Make debris fall under gravity
} }
} }

View file

@ -19,11 +19,9 @@
// Fly at the player like a missile. // Fly at the player like a missile.
// //
void A_SkullAttack(AActor *self, fixed_t speed) void A_SkullAttack(AActor *self, double speed)
{ {
AActor *dest; AActor *dest;
int dist;
if (!self->target) if (!self->target)
return; return;
@ -33,18 +31,13 @@ void A_SkullAttack(AActor *self, fixed_t speed)
S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
self->VelFromAngle(speed); self->VelFromAngle(speed);
dist = self->AproxDistance (dest); self->Vel.Z = (dest->Center() - self->Z()) / self->DistanceBySpeed(dest, speed);
dist = dist / speed;
if (dist < 1)
dist = 1;
self->vel.z = (dest->Z() + (dest->height>>1) - self->Z()) / dist;
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullAttack)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
PARAM_FIXED_OPT(speed) { speed = SKULLSPEED; } PARAM_FLOAT_OPT(speed) { speed = SKULLSPEED; }
if (speed <= 0) if (speed <= 0)
speed = SKULLSPEED; speed = SKULLSPEED;

View file

@ -31,11 +31,11 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
if (self->DamageType == NAME_Massacre) return; if (self->DamageType == NAME_Massacre) return;
// [RH] check to make sure it's not too close to the ceiling // [RH] check to make sure it's not too close to the ceiling
if (self->Top() + 8*FRACUNIT > self->ceilingz) if (self->_f_Top() + 8*FRACUNIT > self->ceilingz)
{ {
if (self->flags & MF_FLOAT) if (self->flags & MF_FLOAT)
{ {
self->vel.z -= 2*FRACUNIT; self->Vel.Z -= 2;
self->flags |= MF_INFLOAT; self->flags |= MF_INFLOAT;
self->flags4 |= MF4_VFRICTION; self->flags4 |= MF4_VFRICTION;
} }
@ -69,7 +69,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
fixedvec2 dist = Vec2Angle(prestep, angle); fixedvec2 dist = Vec2Angle(prestep, angle);
fixedvec3 pos = self->Vec3Offset(dist.x, dist.y, 8 * FRACUNIT, true); fixedvec3 pos = self->Vec3Offset(dist.x, dist.y, 8 * FRACUNIT, true);
fixedvec3 src = self->Pos(); fixedvec3 src = self->_f_Pos();
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
@ -120,9 +120,9 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
// Check to see if the new Lost Soul's z value is above the // Check to see if the new Lost Soul's z value is above the
// ceiling of its new sector, or below the floor. If so, kill it. // ceiling of its new sector, or below the floor. If so, kill it.
if ((other->Top() > if ((other->_f_Top() >
(other->Sector->HighestCeilingAt(other))) || (other->Sector->HighestCeilingAt(other))) ||
(other->Z() < other->Sector->LowestFloorAt(other))) (other->_f_Z() < other->Sector->LowestFloorAt(other)))
{ {
// kill it immediately // kill it immediately
P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);// ^ P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);// ^
@ -131,7 +131,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
// Check for movements. // Check for movements.
if (!P_CheckPosition (other, other->Pos())) if (!P_CheckPosition (other, other->_f_Pos()))
{ {
// kill it immediately // kill it immediately
P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None); P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);

View file

@ -28,12 +28,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkelMissile)
return 0; return 0;
A_FaceTarget (self); A_FaceTarget (self);
missile = P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT, missile = P_SpawnMissileZ (self, self->_f_Z() + 48*FRACUNIT,
self->target, PClass::FindActor("RevenantTracer")); self->target, PClass::FindActor("RevenantTracer"));
if (missile != NULL) if (missile != NULL)
{ {
missile->SetOrigin(missile->Vec3Offset(missile->vel.x, missile->vel.y, 0), false); missile->SetOrigin(missile->Vec3Offset(missile->_f_velx(), missile->_f_vely(), 0), false);
missile->tracer = self->target; missile->tracer = self->target;
} }
return 0; return 0;
@ -45,8 +45,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
fixed_t dist; double dist;
fixed_t slope; double slope;
AActor *dest; AActor *dest;
AActor *smoke; AActor *smoke;
@ -63,11 +63,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
return 0; return 0;
// spawn a puff of smoke behind the rocket // spawn a puff of smoke behind the rocket
P_SpawnPuff (self, PClass::FindActor(NAME_BulletPuff), self->Pos(), self->_f_angle(), self->_f_angle(), 3); P_SpawnPuff (self, PClass::FindActor(NAME_BulletPuff), self->_f_Pos(), self->_f_angle(), self->_f_angle(), 3);
smoke = Spawn ("RevenantTracerSmoke", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE); smoke = Spawn ("RevenantTracerSmoke", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), 0), ALLOW_REPLACE);
smoke->vel.z = FRACUNIT; smoke->Vel.Z = 1.;
smoke->tics -= pr_tracer()&3; smoke->tics -= pr_tracer()&3;
if (smoke->tics < 1) if (smoke->tics < 1)
smoke->tics = 1; smoke->tics = 1;
@ -100,24 +100,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{ {
// change slope // change slope
dist = self->AproxDistance (dest) / self->Speed; dist = self->DistanceBySpeed(dest, self->Speed);
if (dist < 1) if (dest->_Height() >= 56.)
dist = 1;
if (dest->height >= 56*FRACUNIT)
{ {
slope = (dest->Z()+40*FRACUNIT - self->Z()) / dist; slope = (dest->Z() + 40. - self->Z()) / dist;
} }
else else
{ {
slope = (dest->Z() + self->height*2/3 - self->Z()) / dist; slope = (dest->Z() + self->_Height()*(2./3) - self->Z()) / dist;
} }
if (slope < self->vel.z) if (slope < self->Vel.Z)
self->vel.z -= FRACUNIT/8; self->Vel.Z -= 1. / 8;
else else
self->vel.z += FRACUNIT/8; self->Vel.Z += 1. / 8;
} }
return 0; return 0;
} }

View file

@ -1182,7 +1182,7 @@ void G_Ticker ()
} }
if (players[i].mo) if (players[i].mo)
{ {
DWORD sum = rngsum + players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z() DWORD sum = rngsum + players[i].mo->_f_X() + players[i].mo->_f_Y() + players[i].mo->_f_Z()
+ players[i].mo->_f_angle() + players[i].mo->_f_pitch(); + players[i].mo->_f_angle() + players[i].mo->_f_pitch();
sum ^= players[i].health; sum ^= players[i].health;
consistancy[i][buf] = sum; consistancy[i][buf] = sum;
@ -1443,13 +1443,13 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
if (!players[playernum].mo) if (!players[playernum].mo)
{ // first spawn of level, before corpses { // first spawn of level, before corpses
for (i = 0; i < playernum; i++) for (i = 0; i < playernum; i++)
if (players[i].mo && players[i].mo->X() == x && players[i].mo->Y() == y) if (players[i].mo && players[i].mo->_f_X() == x && players[i].mo->_f_Y() == y)
return false; return false;
return true; return true;
} }
oldz = players[playernum].mo->Z(); // [RH] Need to save corpse's z-height oldz = players[playernum].mo->_f_Z(); // [RH] Need to save corpse's z-height
players[playernum].mo->SetZ(z); // [RH] Checks are now full 3-D players[playernum].mo->_f_SetZ(z); // [RH] Checks are now full 3-D
// killough 4/2/98: fix bug where P_CheckPosition() uses a non-solid // killough 4/2/98: fix bug where P_CheckPosition() uses a non-solid
// corpse to detect collisions with other players in DM starts // corpse to detect collisions with other players in DM starts
@ -1461,7 +1461,7 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
players[playernum].mo->flags |= MF_SOLID; players[playernum].mo->flags |= MF_SOLID;
i = P_CheckPosition(players[playernum].mo, x, y); i = P_CheckPosition(players[playernum].mo, x, y);
players[playernum].mo->flags &= ~MF_SOLID; players[playernum].mo->flags &= ~MF_SOLID;
players[playernum].mo->SetZ(oldz); // [RH] Restore corpse's height players[playernum].mo->_f_SetZ(oldz); // [RH] Restore corpse's height
if (!i) if (!i)
return false; return false;

View file

@ -41,13 +41,13 @@ void AChickenPlayer::MorphPlayerThink ()
{ {
return; return;
} }
if (!(vel.x | vel.y) && pr_chickenplayerthink () < 160) if (Vel.X == 0 && Vel.Y == 0 && pr_chickenplayerthink () < 160)
{ // Twitch view angle { // Twitch view angle
Angles.Yaw += pr_chickenplayerthink.Random2() * (360. / 256. / 32.); Angles.Yaw += pr_chickenplayerthink.Random2() * (360. / 256. / 32.);
} }
if ((Z() <= floorz) && (pr_chickenplayerthink() < 32)) if ((_f_Z() <= floorz) && (pr_chickenplayerthink() < 32))
{ // Jump and noise { // Jump and noise
vel.z += JumpZ; Vel.Z += JumpZ;
FState * painstate = FindState(NAME_Pain); FState * painstate = FindState(NAME_Pain);
if (painstate != NULL) SetState (painstate); if (painstate != NULL) SetState (painstate);
@ -107,9 +107,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Feathers)
{ {
mo = Spawn("Feather", self->PosPlusZ(20*FRACUNIT), NO_REPLACE); mo = Spawn("Feather", self->PosPlusZ(20*FRACUNIT), NO_REPLACE);
mo->target = self; mo->target = self;
mo->vel.x = pr_feathers.Random2() << 8; mo->Vel.X = pr_feathers.Random2() / 256.;
mo->vel.y = pr_feathers.Random2() << 8; mo->Vel.Y = pr_feathers.Random2() / 256.;
mo->vel.z = FRACUNIT + (pr_feathers() << 9); mo->Vel.Z = 1. + pr_feathers() / 128.;
mo->SetState (mo->SpawnState + (pr_feathers()&7)); mo->SetState (mo->SpawnState + (pr_feathers()&7));
} }
return 0; return 0;

View file

@ -86,17 +86,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
PClassActor *fx = PClass::FindActor("SorcererFX1"); PClassActor *fx = PClass::FindActor("SorcererFX1");
if (self->health > (self->SpawnHealth()/3)*2) if (self->health > (self->SpawnHealth()/3)*2)
{ // Spit one fireball { // Spit one fireball
P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT, self->target, fx ); P_SpawnMissileZ (self, self->_f_Z() + 48*FRACUNIT, self->target, fx );
} }
else else
{ // Spit three fireballs { // Spit three fireballs
mo = P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT, self->target, fx); mo = P_SpawnMissileZ (self, self->_f_Z() + 48*FRACUNIT, self->target, fx);
if (mo != NULL) if (mo != NULL)
{ {
vz = mo->vel.z; vz = mo->_f_velz();
angle = mo->_f_angle(); angle = mo->_f_angle();
P_SpawnMissileAngleZ (self, self->Z() + 48*FRACUNIT, fx, angle-ANGLE_1*3, vz); P_SpawnMissileAngleZ (self, self->_f_Z() + 48*FRACUNIT, fx, angle-ANGLE_1*3, vz);
P_SpawnMissileAngleZ (self, self->Z() + 48*FRACUNIT, fx, angle+ANGLE_1*3, vz); P_SpawnMissileAngleZ (self, self->_f_Z() + 48*FRACUNIT, fx, angle+ANGLE_1*3, vz);
} }
if (self->health < self->SpawnHealth()/3) if (self->health < self->SpawnHealth()/3)
{ // Maybe attack again { // Maybe attack again
@ -152,22 +152,22 @@ void P_DSparilTeleport (AActor *actor)
DSpotState *state = DSpotState::GetSpotState(); DSpotState *state = DSpotState::GetSpotState();
if (state == NULL) return; if (state == NULL) return;
spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->X(), actor->Y(), 128*FRACUNIT, 0); spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->_f_X(), actor->_f_Y(), 128*FRACUNIT, 0);
if (spot == NULL) return; if (spot == NULL) return;
prevX = actor->X(); prevX = actor->_f_X();
prevY = actor->Y(); prevY = actor->_f_Y();
prevZ = actor->Z(); prevZ = actor->_f_Z();
if (P_TeleportMove (actor, spot->Pos(), false)) if (P_TeleportMove (actor, spot->_f_Pos(), false))
{ {
mo = Spawn("Sorcerer2Telefade", prevX, prevY, prevZ, ALLOW_REPLACE); mo = Spawn("Sorcerer2Telefade", prevX, prevY, prevZ, ALLOW_REPLACE);
if (mo) mo->Translation = actor->Translation; if (mo) mo->Translation = actor->Translation;
S_Sound (mo, CHAN_BODY, "misc/teleport", 1, ATTN_NORM); S_Sound (mo, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->SetState (actor->FindState("Teleport")); actor->SetState (actor->FindState("Teleport"));
S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM); S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->SetZ(actor->floorz, false); actor->_f_SetZ(actor->floorz, false);
actor->Angles.Yaw = spot->Angles.Yaw; actor->Angles.Yaw = spot->Angles.Yaw;
actor->vel.x = actor->vel.y = actor->vel.z = 0; actor->Vel.Zero();
} }
} }
@ -257,9 +257,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BlueSpark)
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
mo = Spawn("Sorcerer2FXSpark", self->Pos(), ALLOW_REPLACE); mo = Spawn("Sorcerer2FXSpark", self->Pos(), ALLOW_REPLACE);
mo->vel.x = pr_bluespark.Random2() << 9; mo->Vel.X = pr_bluespark.Random2() / 128.;
mo->vel.y = pr_bluespark.Random2() << 9; mo->Vel.Y = pr_bluespark.Random2() / 128.;
mo->vel.z = FRACUNIT + (pr_bluespark()<<8); mo->Vel.Z = 1. + pr_bluespark() / 256.;
} }
return 0; return 0;
} }
@ -279,7 +279,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
mo = Spawn("Wizard", self->Pos(), ALLOW_REPLACE); mo = Spawn("Wizard", self->Pos(), ALLOW_REPLACE);
if (mo != NULL) if (mo != NULL)
{ {
mo->AddZ(-mo->GetDefault()->height / 2, false); mo->_f_AddZ(-mo->GetDefault()->height / 2, false);
if (!P_TestMobjLocation (mo)) if (!P_TestMobjLocation (mo))
{ // Didn't fit { // Didn't fit
mo->ClearCounters(); mo->ClearCounters();
@ -289,7 +289,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
{ // [RH] Make the new wizards inherit D'Sparil's target { // [RH] Make the new wizards inherit D'Sparil's target
mo->CopyFriendliness (self->target, true); mo->CopyFriendliness (self->target, true);
self->vel.x = self->vel.y = self->vel.z = 0; self->Vel.Zero();
self->SetState (self->FindState(NAME_Death)); self->SetState (self->FindState(NAME_Death));
self->flags &= ~MF_MISSILE; self->flags &= ~MF_MISSILE;
mo->master = self->target; mo->master = self->target;

View file

@ -49,8 +49,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->AddZ(32*FRACUNIT, false); self->_f_AddZ(32*FRACUNIT, false);
self->PrevZ = self->Z(); // no interpolation! self->PrevZ = self->_f_Z(); // no interpolation!
self->RenderStyle = STYLE_Add; self->RenderStyle = STYLE_Add;
self->alpha = FRACUNIT; self->alpha = FRACUNIT;
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE); P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
@ -72,7 +72,7 @@ bool AArtiTimeBomb::Use (bool pickup)
{ {
angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT; angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo = Spawn("ActivatedTimeBomb", AActor *mo = Spawn("ActivatedTimeBomb",
Owner->Vec3Angle(24*FRACUNIT, Owner->_f_angle(), - Owner->floorclip), ALLOW_REPLACE); Owner->_f_Vec3Angle(24*FRACUNIT, Owner->_f_angle(), - Owner->floorclip), ALLOW_REPLACE);
mo->target = Owner; mo->target = Owner;
return true; return true;
} }

View file

@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ImpMsAttack)
self->SetState (self->SeeState); self->SetState (self->SeeState);
return 0; return 0;
} }
A_SkullAttack(self, 12 * FRACUNIT); A_SkullAttack(self, 12.);
return 0; return 0;
} }
@ -47,14 +47,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_ImpExplode)
self->flags &= ~MF_NOGRAVITY; self->flags &= ~MF_NOGRAVITY;
chunk = Spawn("HereticImpChunk1", self->Pos(), ALLOW_REPLACE); chunk = Spawn("HereticImpChunk1", self->Pos(), ALLOW_REPLACE);
chunk->vel.x = pr_imp.Random2 () << 10; chunk->Vel.X = pr_imp.Random2() / 64.;
chunk->vel.y = pr_imp.Random2 () << 10; chunk->Vel.Y = pr_imp.Random2() / 64.;
chunk->vel.z = 9*FRACUNIT; chunk->Vel.Z = 9;
chunk = Spawn("HereticImpChunk2", self->Pos(), ALLOW_REPLACE); chunk = Spawn("HereticImpChunk2", self->Pos(), ALLOW_REPLACE);
chunk->vel.x = pr_imp.Random2 () << 10; chunk->Vel.X = pr_imp.Random2() / 64.;
chunk->vel.y = pr_imp.Random2 () << 10; chunk->Vel.Y = pr_imp.Random2() / 64.;
chunk->vel.z = 9*FRACUNIT; chunk->Vel.Z = 9;
if (self->special1 == 666) if (self->special1 == 666)
{ // Extreme death crash { // Extreme death crash
self->SetState (self->FindState("XCrash")); self->SetState (self->FindState("XCrash"));

View file

@ -61,9 +61,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PodPain)
{ {
goo = Spawn(gootype, self->PosPlusZ(48*FRACUNIT), ALLOW_REPLACE); goo = Spawn(gootype, self->PosPlusZ(48*FRACUNIT), ALLOW_REPLACE);
goo->target = self; goo->target = self;
goo->vel.x = pr_podpain.Random2() << 9; goo->Vel.X = pr_podpain.Random2() / 128.;
goo->vel.y = pr_podpain.Random2() << 9; goo->Vel.Y = pr_podpain.Random2() / 128.;
goo->vel.z = FRACUNIT/2 + (pr_podpain() << 9); goo->Vel.Z = 0.5 + pr_podpain() / 128.;
} }
return 0; return 0;
} }
@ -111,8 +111,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MakePod)
{ // Too many generated pods { // Too many generated pods
return 0; return 0;
} }
x = self->X(); x = self->_f_X();
y = self->Y(); y = self->_f_Y();
mo = Spawn(podtype, x, y, ONFLOORZ, ALLOW_REPLACE); mo = Spawn(podtype, x, y, ONFLOORZ, ALLOW_REPLACE);
if (!P_CheckPosition (mo, x, y)) if (!P_CheckPosition (mo, x, y))
{ // Didn't fit { // Didn't fit
@ -139,7 +139,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AccTeleGlitter)
if (++self->health > 35) if (++self->health > 35)
{ {
self->vel.z += self->vel.z/2; self->Vel.Z *= 1.5;
} }
return 0; return 0;
} }
@ -179,8 +179,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast)
blast = Spawn("VolcanoBlast", self->PosPlusZ(44*FRACUNIT), ALLOW_REPLACE); blast = Spawn("VolcanoBlast", self->PosPlusZ(44*FRACUNIT), ALLOW_REPLACE);
blast->target = self; blast->target = self;
blast->Angles.Yaw = pr_blast() * (360 / 256.f); blast->Angles.Yaw = pr_blast() * (360 / 256.f);
blast->VelFromAngle(1 * FRACUNIT); blast->VelFromAngle(1.);
blast->vel.z = (FRACUNIT*5/2) + (pr_blast() << 10); blast->Vel.Z = 2.5 + pr_blast() / 64.;
S_Sound (blast, CHAN_BODY, "world/volcano/shoot", 1, ATTN_NORM); S_Sound (blast, CHAN_BODY, "world/volcano/shoot", 1, ATTN_NORM);
P_CheckMissileSpawn (blast, self->radius); P_CheckMissileSpawn (blast, self->radius);
} }
@ -200,12 +200,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
unsigned int i; unsigned int i;
AActor *tiny; AActor *tiny;
if (self->Z() <= self->floorz) if (self->_f_Z() <= self->floorz)
{ {
self->flags |= MF_NOGRAVITY; self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT; self->gravity = FRACUNIT;
self->AddZ(28*FRACUNIT); self->_f_AddZ(28*FRACUNIT);
//self->vel.z = 3*FRACUNIT; //self->Vel.Z = 3*FRACUNIT;
} }
P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, RADF_HURTSOURCE); P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, RADF_HURTSOURCE);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -213,8 +213,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
tiny = Spawn("VolcanoTBlast", self->Pos(), ALLOW_REPLACE); tiny = Spawn("VolcanoTBlast", self->Pos(), ALLOW_REPLACE);
tiny->target = self; tiny->target = self;
tiny->Angles.Yaw = 90.*i; tiny->Angles.Yaw = 90.*i;
tiny->VelFromAngle(FRACUNIT * 7 / 10); tiny->VelFromAngle(0.7);
tiny->vel.z = FRACUNIT + (pr_volcimpact() << 9); tiny->Vel.Z = 1. + pr_volcimpact() / 128.;
P_CheckMissileSpawn (tiny, self->radius); P_CheckMissileSpawn (tiny, self->radius);
} }
return 0; return 0;

View file

@ -166,7 +166,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2)
DAngle pitch = P_BulletSlope(self); DAngle pitch = P_BulletSlope(self);
//momz = GetDefault<AGoldWandFX2>()->Speed * tan(-bulletpitch); //momz = GetDefault<AGoldWandFX2>()->Speed * tan(-bulletpitch);
vz = fixed_t(GetDefaultByName("GoldWandFX2")->Speed * (-pitch).Tan()); vz = fixed_t(GetDefaultByName("GoldWandFX2")->_f_speed() * -pitch.TanClamped());
P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->_f_angle()-(ANG45/8), vz); P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->_f_angle()-(ANG45/8), vz);
P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->_f_angle()+(ANG45/8), vz); P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->_f_angle()+(ANG45/8), vz);
angle = self->Angles.Yaw - (45. / 8); angle = self->Angles.Yaw - (45. / 8);
@ -403,13 +403,12 @@ void FireMacePL1B (AActor *actor)
return; return;
} }
ball = Spawn("MaceFX2", actor->PosPlusZ(28*FRACUNIT - actor->floorclip), ALLOW_REPLACE); ball = Spawn("MaceFX2", actor->PosPlusZ(28*FRACUNIT - actor->floorclip), ALLOW_REPLACE);
ball->vel.z = FLOAT2FIXED(2 - actor->Angles.Pitch.Tan()); ball->Vel.Z = 2 - player->mo->Angles.Pitch.TanClamped();
ball->target = actor; ball->target = actor;
ball->Angles.Yaw = actor->Angles.Yaw; ball->Angles.Yaw = actor->Angles.Yaw;
ball->AddZ(ball->vel.z); ball->_f_AddZ(ball->_f_velz());
ball->VelFromAngle(); ball->VelFromAngle();
ball->vel.x += (actor->vel.x>>1); ball->Vel += actor->Vel.XY()/2;
ball->vel.y += (actor->vel.y>>1);
S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM); S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM);
P_CheckMissileSpawn (ball, actor->radius); P_CheckMissileSpawn (ball, actor->radius);
} }
@ -482,13 +481,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_MacePL1Check)
self->vel.x = FixedMul(7*FRACUNIT, finecosine[angle]); self->vel.x = FixedMul(7*FRACUNIT, finecosine[angle]);
self->vel.y = FixedMul(7*FRACUNIT, finesine[angle]); self->vel.y = FixedMul(7*FRACUNIT, finesine[angle]);
#else #else
double velscale = g_sqrt ((double)self->vel.x * (double)self->vel.x + double velscale = 7 / self->Vel.XY().Length();
(double)self->vel.y * (double)self->vel.y); self->Vel.X *= velscale;
velscale = 458752 / velscale; self->Vel.Y *= velscale;
self->vel.x = (int)(self->vel.x * velscale);
self->vel.y = (int)(self->vel.y * velscale);
#endif #endif
self->vel.z -= self->vel.z >> 1; self->Vel.Z *= 0.5;
return 0; return 0;
} }
@ -505,14 +502,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact)
if ((self->health != MAGIC_JUNK) && (self->flags & MF_INBOUNCE)) if ((self->health != MAGIC_JUNK) && (self->flags & MF_INBOUNCE))
{ // Bounce { // Bounce
self->health = MAGIC_JUNK; self->health = MAGIC_JUNK;
self->vel.z = (self->vel.z * 192) >> 8; self->Vel.Z *= 0.75;
self->BounceFlags = BOUNCE_None; self->BounceFlags = BOUNCE_None;
self->SetState (self->SpawnState); self->SetState (self->SpawnState);
S_Sound (self, CHAN_BODY, "weapons/macebounce", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "weapons/macebounce", 1, ATTN_NORM);
} }
else else
{ // Explode { // Explode
self->vel.x = self->vel.y = self->vel.z = 0; self->Vel.Zero();
self->flags |= MF_NOGRAVITY; self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT; self->gravity = FRACUNIT;
S_Sound (self, CHAN_BODY, "weapons/macehit", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "weapons/macehit", 1, ATTN_NORM);
@ -532,44 +529,40 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
AActor *tiny; AActor *tiny;
if ((self->Z() <= self->floorz) && P_HitFloor (self)) if ((self->_f_Z() <= self->floorz) && P_HitFloor (self))
{ // Landed in some sort of liquid { // Landed in some sort of liquid
self->Destroy (); self->Destroy ();
return 0; return 0;
} }
if (self->flags & MF_INBOUNCE) if (self->flags & MF_INBOUNCE)
{ {
if (self->vel.z < 2*FRACUNIT) if (self->Vel.Z < 2)
{ {
goto boom; goto boom;
} }
// Bounce // Bounce
self->vel.z = (self->vel.z * 192) >> 8; self->Vel.Z *= 0.75;
self->SetState (self->SpawnState); self->SetState (self->SpawnState);
tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE); tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE);
tiny->target = self->target; tiny->target = self->target;
tiny->Angles.Yaw = self->Angles.Yaw + 90.; tiny->Angles.Yaw = self->Angles.Yaw + 90.;
tiny->VelFromAngle(self->vel.z - FRACUNIT); tiny->VelFromAngle(self->Vel.Z - 1.);
tiny->vel.x += (self->vel.x >> 1); tiny->Vel += { self->Vel.X * .5, self->Vel.Y * .5, self->Vel.Z };
tiny->vel.y += (self->vel.y >> 1);
tiny->vel.z = self->vel.z;
P_CheckMissileSpawn (tiny, self->radius); P_CheckMissileSpawn (tiny, self->radius);
tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE); tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE);
tiny->target = self->target; tiny->target = self->target;
tiny->Angles.Yaw = self->Angles.Yaw - 90.; tiny->Angles.Yaw = self->Angles.Yaw - 90.;
tiny->VelFromAngle(self->vel.z - FRACUNIT); tiny->VelFromAngle(self->Vel.Z - 1.);
tiny->vel.x += (self->vel.x >> 1); tiny->Vel += { self->Vel.X * .5, self->Vel.Y * .5, self->Vel.Z };
tiny->vel.y += (self->vel.y >> 1);
tiny->vel.z = self->vel.z;
P_CheckMissileSpawn (tiny, self->radius); P_CheckMissileSpawn (tiny, self->radius);
} }
else else
{ // Explode { // Explode
boom: boom:
self->vel.x = self->vel.y = self->vel.z = 0; self->Vel.Zero();
self->flags |= MF_NOGRAVITY; self->flags |= MF_NOGRAVITY;
self->BounceFlags = BOUNCE_None; self->BounceFlags = BOUNCE_None;
self->gravity = FRACUNIT; self->gravity = FRACUNIT;
@ -605,10 +598,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL2)
mo = P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AMaceFX4), self->Angles.Yaw, &t); mo = P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AMaceFX4), self->Angles.Yaw, &t);
if (mo) if (mo)
{ {
mo->vel.x += self->vel.x; mo->Vel += self->Vel.XY();
mo->vel.y += self->vel.y; mo->Vel.Z = 2 - player->mo->Angles.Pitch.TanClamped();
mo->vel.z = 2*FRACUNIT+
clamp<fixed_t>(finetangent[FINEANGLES/4-(self->_f_pitch()>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT);
if (t.linetarget && !t.unlinked) if (t.linetarget && !t.unlinked)
{ {
mo->tracer = t.linetarget; mo->tracer = t.linetarget;
@ -634,14 +625,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
bool newAngle; bool newAngle;
FTranslatedLineTarget t; FTranslatedLineTarget t;
if ((self->Z() <= self->floorz) && P_HitFloor (self)) if ((self->_f_Z() <= self->floorz) && P_HitFloor (self))
{ // Landed in some sort of liquid { // Landed in some sort of liquid
self->Destroy (); self->Destroy ();
return 0; return 0;
} }
if (self->flags & MF_INBOUNCE) if (self->flags & MF_INBOUNCE)
{ {
if (self->vel.z < 2*FRACUNIT) if (self->Vel.Z < 2)
{ {
goto boom; goto boom;
} }
@ -688,7 +679,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
else else
{ // Explode { // Explode
boom: boom:
self->vel.x = self->vel.y = self->vel.z = 0; self->Vel.Zero();
self->flags |= MF_NOGRAVITY; self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT; self->gravity = FRACUNIT;
S_Sound (self, CHAN_BODY, "weapons/maceexplode", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "weapons/maceexplode", 1, ATTN_NORM);
@ -730,7 +721,7 @@ void ABlasterFX1::Effect ()
{ {
if (pr_bfx1t() < 64) if (pr_bfx1t() < 64)
{ {
Spawn("BlasterSmoke", X(), Y(), MAX<fixed_t> (Z() - 8 * FRACUNIT, floorz), ALLOW_REPLACE); Spawn("BlasterSmoke", _f_X(), _f_Y(), MAX<fixed_t> (_f_Z() - 8 * FRACUNIT, floorz), ALLOW_REPLACE);
} }
} }
@ -1081,12 +1072,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
newz = self->Sector->ceilingplane.ZatPoint(mo); newz = self->Sector->ceilingplane.ZatPoint(mo);
int moceiling = P_Find3DFloor(NULL, pos.x, pos.y, newz, false, false, newz); int moceiling = P_Find3DFloor(NULL, pos.x, pos.y, newz, false, false, newz);
if (moceiling >= 0) if (moceiling >= 0)
mo->SetZ(newz - mo->height, false); mo->_f_SetZ(newz - mo->height, false);
mo->Translation = multiplayer ? mo->Translation = multiplayer ?
TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0; TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0;
mo->target = self->target; mo->target = self->target;
mo->vel.x = 1; // Force collision detection mo->Vel.X = MinVel; // Force collision detection
mo->vel.z = -mo->Speed; mo->Vel.Z = -mo->Speed;
mo->special2 = self->special2; // Transfer player number mo->special2 = self->special2; // Transfer player number
P_CheckMissileSpawn (mo, self->radius); P_CheckMissileSpawn (mo, self->radius);
if (self->special1 != -1 && !S_IsActorPlayingSomething (self, CHAN_BODY, -1)) if (self->special1 != -1 && !S_IsActorPlayingSomething (self, CHAN_BODY, -1))
@ -1105,7 +1096,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
DEFINE_ACTION_FUNCTION(AActor, A_RainImpact) DEFINE_ACTION_FUNCTION(AActor, A_RainImpact)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
if (self->Z() > self->floorz) if (self->_f_Z() > self->floorz)
{ {
self->SetState (self->FindState("NotFloor")); self->SetState (self->FindState("NotFloor"));
} }
@ -1133,15 +1124,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
F3DFloor * rover = self->Sector->e->XFloor.ffloors[i]; F3DFloor * rover = self->Sector->e->XFloor.ffloors[i];
if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue; if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if ((foo = rover->bottom.plane->ZatPoint(self)) >= (self->Top())) if ((foo = rover->bottom.plane->ZatPoint(self)) >= (self->_f_Top()))
{ {
self->SetZ(foo + 4*FRACUNIT, false); self->_f_SetZ(foo + 4*FRACUNIT, false);
self->bouncecount = i; self->bouncecount = i;
return 0; return 0;
} }
} }
self->bouncecount = -1; self->bouncecount = -1;
self->SetZ(self->ceilingz + 4*FRACUNIT, false); self->_f_SetZ(self->ceilingz + 4*FRACUNIT, false);
return 0; return 0;
} }
@ -1228,7 +1219,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL1)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
angle_t angle;
player_t *player; player_t *player;
if (NULL == (player = self->player)) if (NULL == (player = self->player))
@ -1243,10 +1233,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL1)
return 0; return 0;
} }
P_SpawnPlayerMissile (self, RUNTIME_CLASS(APhoenixFX1)); P_SpawnPlayerMissile (self, RUNTIME_CLASS(APhoenixFX1));
angle = self->_f_angle() + ANG180; self->Thrust(self->Angles.Yaw + 180, 4);
angle >>= ANGLETOFINESHIFT;
self->vel.x += FixedMul (4*FRACUNIT, finecosine[angle]);
self->vel.y += FixedMul (4*FRACUNIT, finesine[angle]);
return 0; return 0;
} }
@ -1261,22 +1248,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_PhoenixPuff)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *puff; AActor *puff;
angle_t angle; DAngle angle;
//[RH] Heretic never sets the target for seeking //[RH] Heretic never sets the target for seeking
//P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10); //P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10);
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE); puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->_f_angle() + ANG90; angle = self->Angles.Yaw + 90;
angle >>= ANGLETOFINESHIFT; puff->Vel = DVector3(angle.ToVector(1.3), 0);
puff->vel.x = FixedMul (FRACUNIT*13/10, finecosine[angle]);
puff->vel.y = FixedMul (FRACUNIT*13/10, finesine[angle]);
puff->vel.z = 0;
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE); puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->_f_angle() - ANG90; angle = self->Angles.Yaw - 90;
angle >>= ANGLETOFINESHIFT; puff->Vel = DVector3(angle.ToVector(1.3), 0);
puff->vel.x = FixedMul (FRACUNIT*13/10, finecosine[angle]);
puff->vel.y = FixedMul (FRACUNIT*13/10, finesine[angle]);
puff->vel.z = 0;
return 0; return 0;
} }
@ -1315,7 +1297,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
AActor *mo; AActor *mo;
fixed_t slope; double slope;
FSoundID soundid; FSoundID soundid;
player_t *player; player_t *player;
APhoenixRod *flamethrower; APhoenixRod *flamethrower;
@ -1336,20 +1318,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
return 0; return 0;
} }
slope = FLOAT2FIXED(-self->Angles.Pitch.Tan()); slope = -self->Angles.Pitch.TanClamped();
fixed_t xo = (pr_fp2.Random2() << 9); fixed_t xo = (pr_fp2.Random2() << 9);
fixed_t yo = (pr_fp2.Random2() << 9); fixed_t yo = (pr_fp2.Random2() << 9);
fixedvec3 pos = self->Vec3Offset(xo, yo, fixedvec3 pos = self->Vec3Offset(xo, yo,
26*FRACUNIT + slope - self->floorclip); 26*FRACUNIT + FLOAT2FIXED(slope) - self->floorclip);
slope += (FRACUNIT/10); slope += 0.1;
mo = Spawn("PhoenixFX2", pos, ALLOW_REPLACE); mo = Spawn("PhoenixFX2", pos, ALLOW_REPLACE);
mo->target = self; mo->target = self;
mo->Angles.Yaw = self->Angles.Yaw; mo->Angles.Yaw = self->Angles.Yaw;
mo->VelFromAngle(); mo->VelFromAngle();
mo->vel.x += self->vel.x; mo->Vel += self->Vel.XY();
mo->vel.y += self->vel.y; mo->Vel.Z = mo->Speed * slope;
mo->vel.z = FixedMul (mo->Speed, slope);
if (!player->refire || !S_IsActorPlayingSomething (self, CHAN_WEAPON, -1)) if (!player->refire || !S_IsActorPlayingSomething (self, CHAN_WEAPON, -1))
{ {
S_Sound (self, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
@ -1394,7 +1375,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlameEnd)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->vel.z += FRACUNIT*3/2; self->Vel.Z += 1.5;
return 0; return 0;
} }
@ -1408,7 +1389,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FloatPuff)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->vel.z += FRACUNIT*18/10; self->Vel.Z += 1.8;
return 0; return 0;
} }

View file

@ -31,8 +31,8 @@ int AWhirlwind::DoSpecialDamage (AActor *target, int damage, FName damagetype)
if (!(target->flags7 & MF7_DONTTHRUST)) if (!(target->flags7 & MF7_DONTTHRUST))
{ {
target->Angles.Yaw += pr_foo.Random2() * (360 / 4096.); target->Angles.Yaw += pr_foo.Random2() * (360 / 4096.);
target->vel.x += pr_foo.Random2() << 10; target->Vel.X += pr_foo.Random2() / 64.;
target->vel.y += pr_foo.Random2() << 10; target->Vel.Y += pr_foo.Random2() / 64.;
} }
if ((level.time & 16) && !(target->flags2 & MF2_BOSS) && !(target->flags7 & MF7_DONTTHRUST)) if ((level.time & 16) && !(target->flags2 & MF2_BOSS) && !(target->flags7 & MF7_DONTTHRUST))
@ -42,10 +42,10 @@ int AWhirlwind::DoSpecialDamage (AActor *target, int damage, FName damagetype)
{ {
randVal = 160; randVal = 160;
} }
target->vel.z += randVal << 11; target->Vel.Z += randVal / 32.;
if (target->vel.z > 12*FRACUNIT) if (target->Vel.Z > 12)
{ {
target->vel.z = 12*FRACUNIT; target->Vel.Z = 12;
} }
} }
if (!(level.time & 7)) if (!(level.time & 7))
@ -115,7 +115,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
} }
fire->target = baseFire->target; fire->target = baseFire->target;
fire->Angles.Yaw = baseFire->Angles.Yaw; fire->Angles.Yaw = baseFire->Angles.Yaw;
fire->vel = baseFire->vel; fire->Vel = baseFire->Vel;
fire->Damage = NULL; fire->Damage = NULL;
fire->health = (i+1) * 2; fire->health = (i+1) * 2;
P_CheckMissileSpawn (fire, self->radius); P_CheckMissileSpawn (fire, self->radius);
@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
mo = P_SpawnMissile (self, target, RUNTIME_CLASS(AWhirlwind)); mo = P_SpawnMissile (self, target, RUNTIME_CLASS(AWhirlwind));
if (mo != NULL) if (mo != NULL)
{ {
mo->AddZ(-32*FRACUNIT, false); mo->_f_AddZ(-32*FRACUNIT, false);
mo->tracer = target; mo->tracer = target;
mo->health = 20*TICRATE; // Duration mo->health = 20*TICRATE; // Duration
S_Sound (self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
@ -149,7 +149,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WhirlwindSeek)
self->health -= 3; self->health -= 3;
if (self->health < 0) if (self->health < 0)
{ {
self->vel.x = self->vel.y = self->vel.z = 0; self->Vel.Zero();
self->SetState (self->FindState(NAME_Death)); self->SetState (self->FindState(NAME_Death));
self->flags &= ~MF_MISSILE; self->flags &= ~MF_MISSILE;
return 0; return 0;
@ -186,7 +186,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
shard->target = self->target; shard->target = self->target;
shard->Angles.Yaw = i*45.; shard->Angles.Yaw = i*45.;
shard->VelFromAngle(); shard->VelFromAngle();
shard->vel.z = -FRACUNIT*6/10; shard->Vel.Z = -.6;
P_CheckMissileSpawn (shard, self->radius); P_CheckMissileSpawn (shard, self->radius);
} }
return 0; return 0;
@ -203,7 +203,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->health--; self->health--;
self->AddZ(9*FRACUNIT); self->_f_AddZ(9*FRACUNIT);
if (self->health == 0) if (self->health == 0)
{ {
self->Damage = self->GetDefault()->Damage; self->Damage = self->GetDefault()->Damage;

View file

@ -28,8 +28,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
fixed_t xo = (pr_dripblood.Random2() << 11); fixed_t xo = (pr_dripblood.Random2() << 11);
fixed_t yo = (pr_dripblood.Random2() << 11); fixed_t yo = (pr_dripblood.Random2() << 11);
mo = Spawn ("Blood", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE); mo = Spawn ("Blood", self->Vec3Offset(xo, yo, 0), ALLOW_REPLACE);
mo->vel.x = pr_dripblood.Random2 () << 10; mo->Vel.X = pr_dripblood.Random2 () / 64.;
mo->vel.y = pr_dripblood.Random2 () << 10; mo->Vel.Y = pr_dripblood.Random2() / 64.;
mo->gravity = FRACUNIT/8; mo->gravity = FRACUNIT/8;
return 0; return 0;
} }
@ -60,11 +60,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_KnightAttack)
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
if (self->flags & MF_SHADOW || pr_knightatk () < 40) if (self->flags & MF_SHADOW || pr_knightatk () < 40)
{ // Red axe { // Red axe
P_SpawnMissileZ (self, self->Z() + 36*FRACUNIT, self->target, PClass::FindActor("RedAxe")); P_SpawnMissileZ (self, self->_f_Z() + 36*FRACUNIT, self->target, PClass::FindActor("RedAxe"));
return 0; return 0;
} }
// Green axe // Green axe
P_SpawnMissileZ (self, self->Z() + 36*FRACUNIT, self->target, PClass::FindActor("KnightAxe")); P_SpawnMissileZ (self, self->_f_Z() + 36*FRACUNIT, self->target, PClass::FindActor("KnightAxe"));
return 0; return 0;
} }

View file

@ -88,8 +88,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_WizAtk3)
mo = P_SpawnMissile (self, self->target, fx); mo = P_SpawnMissile (self, self->target, fx);
if (mo != NULL) if (mo != NULL)
{ {
P_SpawnMissileAngle(self, fx, mo->_f_angle()-(ANG45/8), mo->vel.z); P_SpawnMissileAngle(self, fx, mo->_f_angle()-(ANG45/8), mo->_f_velz());
P_SpawnMissileAngle(self, fx, mo->_f_angle()+(ANG45/8), mo->vel.z); P_SpawnMissileAngle(self, fx, mo->_f_angle()+(ANG45/8), mo->_f_velz());
} }
return 0; return 0;
} }

View file

@ -64,7 +64,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
angle_t newangle; DAngle newangle;
if (self->special2 < 0) if (self->special2 < 0)
{ {
@ -74,17 +74,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
if (pr_batmove()<128) if (pr_batmove()<128)
{ {
newangle = self->_f_angle() + ANGLE_1*self->args[4]; newangle = self->Angles.Yaw + self->args[4];
} }
else else
{ {
newangle = self->_f_angle() - ANGLE_1*self->args[4]; newangle = self->Angles.Yaw - self->args[4];
} }
// Adjust velocity vector to new direction // Adjust velocity vector to new direction
newangle >>= ANGLETOFINESHIFT; self->VelFromAngle(newangle, self->Speed);
self->vel.x = FixedMul (self->Speed, finecosine[newangle]);
self->vel.y = FixedMul (self->Speed, finesine[newangle]);
if (pr_batmove()<15) if (pr_batmove()<15)
{ {
@ -92,7 +90,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
} }
// Handle Z movement // Handle Z movement
self->SetZ(self->target->Z() + 16*finesine[self->args[0] << BOBTOFINESHIFT]); self->SetZ(self->target->Z() + 16 * g_sin(BOBTORAD(self->args[0])));
self->args[0] = (self->args[0]+3)&63; self->args[0] = (self->args[0]+3)&63;
return 0; return 0;
} }

View file

@ -146,8 +146,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
if (!--self->special1) if (!--self->special1)
{ {
self->vel.x = 0; self->Vel.X = self->Vel.Y = 0;
self->vel.y = 0;
if (pr_sblur() > 96) if (pr_sblur() > 96)
{ {
self->SetState (self->SeeState); self->SetState (self->SeeState);
@ -175,10 +174,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopChase)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
fixed_t newz = self->Z() - finesine[self->special2 << BOBTOFINESHIFT] * 4; fixed_t newz = self->_f_Z() - finesine[self->special2 << BOBTOFINESHIFT] * 4;
self->special2 = (self->special2 + 4) & 63; self->special2 = (self->special2 + 4) & 63;
newz += finesine[self->special2 << BOBTOFINESHIFT] * 4; newz += finesine[self->special2 << BOBTOFINESHIFT] * 4;
self->SetZ(newz); self->_f_SetZ(newz);
return 0; return 0;
} }
@ -197,7 +196,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPuff)
mo = Spawn ("BishopPuff", self->PosPlusZ(40*FRACUNIT), ALLOW_REPLACE); mo = Spawn ("BishopPuff", self->PosPlusZ(40*FRACUNIT), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->vel.z = FRACUNIT/2; mo->Vel.Z = -.5;
} }
return 0; return 0;
} }

View file

@ -22,9 +22,9 @@
// //
//========================================================================== //==========================================================================
void BlastActor (AActor *victim, fixed_t strength, fixed_t speed, AActor *Owner, PClassActor *blasteffect, bool dontdamage) void BlastActor (AActor *victim, fixed_t strength, double speed, AActor *Owner, PClassActor *blasteffect, bool dontdamage)
{ {
angle_t angle,ang; DAngle angle;
AActor *mo; AActor *mo;
fixedvec3 pos; fixedvec3 pos;
@ -33,36 +33,34 @@ void BlastActor (AActor *victim, fixed_t strength, fixed_t speed, AActor *Owner,
return; return;
} }
angle = Owner->__f_AngleTo(victim); angle = Owner->AngleTo(victim);
angle >>= ANGLETOFINESHIFT; DVector2 move = angle.ToVector(speed);
victim->vel.x = FixedMul (speed, finecosine[angle]); victim->Vel.X = move.X;
victim->vel.y = FixedMul (speed, finesine[angle]); victim->Vel.Y = move.Y;
// Spawn blast puff // Spawn blast puff
ang = victim->__f_AngleTo(Owner); angle -= 180.;
ang >>= ANGLETOFINESHIFT;
pos = victim->Vec3Offset( pos = victim->Vec3Offset(
FixedMul (victim->radius+FRACUNIT, finecosine[ang]), fixed_t((victim->radius + FRACUNIT) * angle.Cos()),
FixedMul (victim->radius+FRACUNIT, finesine[ang]), fixed_t((victim->radius + FRACUNIT) * angle.Sin()),
-victim->floorclip + (victim->height>>1)); -victim->floorclip + (victim->height>>1));
mo = Spawn (blasteffect, pos, ALLOW_REPLACE); mo = Spawn (blasteffect, pos, ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->vel.x = victim->vel.x; mo->Vel.X = victim->Vel.X;
mo->vel.y = victim->vel.y; mo->Vel.Y = victim->Vel.Y;
} }
if (victim->flags & MF_MISSILE) if (victim->flags & MF_MISSILE)
{ {
// [RH] Floor and ceiling huggers should not be blasted vertically. // [RH] Floor and ceiling huggers should not be blasted vertically.
if (!(victim->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) if (!(victim->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{ {
victim->vel.z = 8*FRACUNIT; mo->Vel.Z = victim->Vel.Z = 8;
mo->vel.z = victim->vel.z;
} }
} }
else else
{ {
victim->vel.z = (1000 / victim->Mass) << FRACBITS; victim->Vel.Z = 1000. / victim->Mass;
} }
if (victim->player) if (victim->player)
{ {
@ -101,7 +99,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast)
PARAM_INT_OPT (blastflags) { blastflags = 0; } PARAM_INT_OPT (blastflags) { blastflags = 0; }
PARAM_FIXED_OPT (strength) { strength = 255*FRACUNIT; } PARAM_FIXED_OPT (strength) { strength = 255*FRACUNIT; }
PARAM_FIXED_OPT (radius) { radius = 255*FRACUNIT; } PARAM_FIXED_OPT (radius) { radius = 255*FRACUNIT; }
PARAM_FIXED_OPT (speed) { speed = 20*FRACUNIT; } PARAM_FLOAT_OPT (speed) { speed = 20; }
PARAM_CLASS_OPT (blasteffect, AActor) { blasteffect = PClass::FindActor("BlastEffect"); } PARAM_CLASS_OPT (blasteffect, AActor) { blasteffect = PClass::FindActor("BlastEffect"); }
PARAM_SOUND_OPT (blastsound) { blastsound = "BlastRadius"; } PARAM_SOUND_OPT (blastsound) { blastsound = "BlastRadius"; }

View file

@ -13,9 +13,9 @@
#include "thingdef/thingdef.h" #include "thingdef/thingdef.h"
*/ */
const fixed_t FLAMESPEED = fixed_t(0.45*FRACUNIT); const double FLAMESPEED = 0.45;
const fixed_t CFLAMERANGE = 12*64*FRACUNIT; const fixed_t CFLAMERANGE = 12*64*FRACUNIT;
const fixed_t FLAMEROTSPEED = 2*FRACUNIT; const double FLAMEROTSPEED = 2.;
static FRandom pr_missile ("CFlameMissile"); static FRandom pr_missile ("CFlameMissile");
@ -48,12 +48,12 @@ void ACFlameMissile::Effect ()
if (!--special1) if (!--special1)
{ {
special1 = 4; special1 = 4;
newz = Z()-12*FRACUNIT; newz = _f_Z()-12*FRACUNIT;
if (newz < floorz) if (newz < floorz)
{ {
newz = floorz; newz = floorz;
} }
AActor *mo = Spawn ("CFlameFloor", X(), Y(), newz, ALLOW_REPLACE); AActor *mo = Spawn ("CFlameFloor", _f_X(), _f_Y(), newz, ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->Angles.Yaw = Angles.Yaw; mo->Angles.Yaw = Angles.Yaw;
@ -99,9 +99,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlamePuff)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->renderflags &= ~RF_INVISIBLE; self->renderflags &= ~RF_INVISIBLE;
self->vel.x = 0; self->Vel.Zero();
self->vel.y = 0;
self->vel.z = 0;
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
return 0; return 0;
} }
@ -138,8 +136,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
mo->Angles.Yaw = an; mo->Angles.Yaw = an;
mo->target = self->target; mo->target = self->target;
mo->VelFromAngle(FLAMESPEED); mo->VelFromAngle(FLAMESPEED);
mo->special1 = mo->vel.x; mo->special1 = FLOAT2FIXED(mo->Vel.X);
mo->special2 = mo->vel.y; mo->special2 = FLOAT2FIXED(mo->Vel.Y);
mo->tics -= pr_missile()&3; mo->tics -= pr_missile()&3;
} }
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset( mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
@ -150,8 +148,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
mo->Angles.Yaw = an + 180.; mo->Angles.Yaw = an + 180.;
mo->target = self->target; mo->target = self->target;
mo->VelFromAngle(-FLAMESPEED); mo->VelFromAngle(-FLAMESPEED);
mo->special1 = mo->vel.x; mo->special1 = FLOAT2FIXED(mo->Vel.X);
mo->special2 = mo->vel.y; mo->special2 = FLOAT2FIXED(mo->Vel.Y);
mo->tics -= pr_missile()&3; mo->tics -= pr_missile()&3;
} }
} }
@ -172,8 +170,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameRotate)
DAngle an = self->Angles.Yaw + 90.; DAngle an = self->Angles.Yaw + 90.;
self->VelFromAngle(an, FLAMEROTSPEED); self->VelFromAngle(an, FLAMEROTSPEED);
self->vel.x += self->special1; self->Vel += DVector2(FIXED2DBL(self->special1), FIXED2DBL(self->special2));
self->vel.y += self->special2;
self->Angles.Yaw += 6.; self->Angles.Yaw += 6.;
return 0; return 0;

View file

@ -159,9 +159,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
mo->special2 = ((FINEANGLES/2 + i) << 16) + FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT); mo->special2 = ((FINEANGLES/2 + i) << 16) + FINEANGLES/2 + pr_holyatk2(8 << BOBTOFINESHIFT);
break; break;
} }
mo->SetZ(self->Z()); mo->_f_SetZ(self->_f_Z());
mo->Angles.Yaw = self->Angles.Yaw + 67.5 - 45.*j; mo->Angles.Yaw = self->Angles.Yaw + 67.5 - 45.*j;
P_ThrustMobj(mo, mo->_f_angle(), mo->Speed); P_ThrustMobj(mo, mo->_f_angle(), mo->_f_speed());
mo->target = self->target; mo->target = self->target;
mo->args[0] = 10; // initial turn value mo->args[0] = 10; // initial turn value
mo->args[1] = 0; // initial look angle mo->args[1] = 0; // initial look angle
@ -276,24 +276,24 @@ static void CHolyTailFollow (AActor *actor, fixed_t dist)
{ {
an = actor->__f_AngleTo(child) >> ANGLETOFINESHIFT; an = actor->__f_AngleTo(child) >> ANGLETOFINESHIFT;
oldDistance = child->AproxDistance (actor); oldDistance = child->AproxDistance (actor);
if (P_TryMove (child, actor->X()+FixedMul(dist, finecosine[an]), if (P_TryMove (child, actor->_f_X()+FixedMul(dist, finecosine[an]),
actor->Y()+FixedMul(dist, finesine[an]), true)) actor->_f_Y()+FixedMul(dist, finesine[an]), true))
{ {
newDistance = child->AproxDistance (actor)-FRACUNIT; newDistance = child->AproxDistance (actor)-FRACUNIT;
if (oldDistance < FRACUNIT) if (oldDistance < FRACUNIT)
{ {
if (child->Z() < actor->Z()) if (child->Z() < actor->Z())
{ {
child->SetZ(actor->Z()-dist); child->_f_SetZ(actor->_f_Z()-dist);
} }
else else
{ {
child->SetZ(actor->Z()+dist); child->_f_SetZ(actor->_f_Z()+dist);
} }
} }
else else
{ {
child->SetZ(actor->Z() + Scale (newDistance, child->Z()-actor->Z(), oldDistance)); child->_f_SetZ(actor->_f_Z() + Scale (newDistance, child->_f_Z()-actor->_f_Z(), oldDistance));
} }
} }
} }
@ -342,10 +342,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyTail)
else else
{ {
if (P_TryMove (self, if (P_TryMove (self,
parent->X() - 14*finecosine[parent->_f_angle()>>ANGLETOFINESHIFT], parent->_f_X() - 14*finecosine[parent->_f_angle()>>ANGLETOFINESHIFT],
parent->Y() - 14*finesine[parent->_f_angle()>>ANGLETOFINESHIFT], true)) parent->_f_Y() - 14*finesine[parent->_f_angle()>>ANGLETOFINESHIFT], true))
{ {
self->SetZ(parent->Z()-5*FRACUNIT); self->_f_SetZ(parent->_f_Z()-5*FRACUNIT);
} }
CHolyTailFollow (self, 10*FRACUNIT); CHolyTailFollow (self, 10*FRACUNIT);
} }
@ -423,8 +423,8 @@ static void CHolySeekerMissile (AActor *actor, DAngle thresh, DAngle turnMax)
|| actor->Z() > target->Top() || actor->Z() > target->Top()
|| actor->Top() < target->Z()) || actor->Top() < target->Z())
{ {
newZ = target->Z()+((pr_holyseeker()*target->height)>>8); newZ = target->_f_Z()+((pr_holyseeker()*target->height)>>8);
deltaZ = newZ - actor->Z(); deltaZ = newZ - actor->_f_Z();
if (abs(deltaZ) > 15*FRACUNIT) if (abs(deltaZ) > 15*FRACUNIT)
{ {
if (deltaZ > 0) if (deltaZ > 0)
@ -437,12 +437,12 @@ static void CHolySeekerMissile (AActor *actor, DAngle thresh, DAngle turnMax)
} }
} }
dist = actor->AproxDistance (target); dist = actor->AproxDistance (target);
dist = dist / actor->Speed; dist = dist / actor->_f_speed();
if (dist < 1) if (dist < 1)
{ {
dist = 1; dist = 1;
} }
actor->vel.z = deltaZ / dist; actor->Vel.Z = FIXED2DBL(deltaZ / dist);
} }
return; return;
} }
@ -462,17 +462,17 @@ void CHolyWeave (AActor *actor, FRandom &pr_random)
weaveXY = actor->special2 >> 16; weaveXY = actor->special2 >> 16;
weaveZ = actor->special2 & FINEMASK; weaveZ = actor->special2 & FINEMASK;
angle = (actor->_f_angle() + ANG90) >> ANGLETOFINESHIFT; angle = (actor->_f_angle() + ANG90) >> ANGLETOFINESHIFT;
newX = actor->X() - FixedMul(finecosine[angle], finesine[weaveXY] * 32); newX = actor->_f_X() - FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY = actor->Y() - FixedMul(finesine[angle], finesine[weaveXY] * 32); newY = actor->_f_Y() - FixedMul(finesine[angle], finesine[weaveXY] * 32);
weaveXY = (weaveXY + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK; weaveXY = (weaveXY + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
newX += FixedMul(finecosine[angle], finesine[weaveXY] * 32); newX += FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY += FixedMul(finesine[angle], finesine[weaveXY] * 32); newY += FixedMul(finesine[angle], finesine[weaveXY] * 32);
P_TryMove(actor, newX, newY, true); P_TryMove(actor, newX, newY, true);
newZ = actor->Z(); newZ = actor->_f_Z();
newZ -= finesine[weaveZ] * 16; newZ -= finesine[weaveZ] * 16;
weaveZ = (weaveZ + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK; weaveZ = (weaveZ + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
newZ += finesine[weaveZ] * 16; newZ += finesine[weaveZ] * 16;
actor->SetZ(newZ); actor->_f_SetZ(newZ);
actor->special2 = weaveZ + (weaveXY << 16); actor->special2 = weaveZ + (weaveXY << 16);
} }
@ -489,9 +489,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolySeek)
self->health--; self->health--;
if (self->health <= 0) if (self->health <= 0)
{ {
self->vel.x >>= 2; self->Vel.X /= 4;
self->vel.y >>= 2; self->Vel.Y /= 4;
self->vel.z = 0; self->Vel.Z = 0;
self->SetState (self->FindState(NAME_Death)); self->SetState (self->FindState(NAME_Death));
self->tics -= pr_holyseek()&3; self->tics -= pr_holyseek()&3;
return 0; return 0;
@ -543,7 +543,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClericAttack)
if (!self->target) return 0; if (!self->target) return 0;
AActor * missile = P_SpawnMissileZ (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor ("HolyMissile")); AActor * missile = P_SpawnMissileZ (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor ("HolyMissile"));
if (missile != NULL) missile->tracer = NULL; // No initial target if (missile != NULL) missile->tracer = NULL; // No initial target
S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
return 0; return 0;

View file

@ -25,7 +25,7 @@ DECLARE_ACTION(A_DragonFlight)
static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax) static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax)
{ {
int dir; int dir;
int dist; double dist;
DAngle delta; DAngle delta;
AActor *target; AActor *target;
int i; int i;
@ -57,15 +57,11 @@ static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax)
} }
actor->VelFromAngle(); actor->VelFromAngle();
dist = actor->AproxDistance (target) / actor->Speed; dist = actor->DistanceBySpeed(target, actor->Speed);
if (actor->Top() < target->Z() || if (actor->Top() < target->Z() ||
target->Top() < actor->Z()) target->Top() < actor->Z())
{ {
if (dist < 1) actor->Vel.Z = (target->Z() - actor->Z()) / dist;
{
dist = 1;
}
actor->vel.z = (target->Z() - actor->Z())/dist;
} }
if (target->flags&MF_SHOOTABLE && pr_dragonseek() < 64) if (target->flags&MF_SHOOTABLE && pr_dragonseek() < 64)
{ // attack the destination mobj if it's attackable { // attack the destination mobj if it's attackable
@ -306,7 +302,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonCheckCrash)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
if (self->Z() <= self->floorz) if (self->_f_Z() <= self->floorz)
{ {
self->SetState (self->FindState ("Crash")); self->SetState (self->FindState ("Crash"));
} }

View file

@ -31,19 +31,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces)
PARAM_CLASS(p2, AActor); PARAM_CLASS(p2, AActor);
PARAM_CLASS(p3, AActor); PARAM_CLASS(p3, AActor);
for (int i = 0, j = 0, fineang = 0; i < 3; ++i) for (int i = 0, j = 0; i < 3; ++i)
{ {
PClassActor *cls = j == 0 ? p1 : j == 1 ? p2 : p3; PClassActor *cls = j == 0 ? p1 : j == 1 ? p2 : p3;
if (cls) if (cls)
{ {
AActor *piece = Spawn (cls, self->Pos(), ALLOW_REPLACE); AActor *piece = Spawn (cls, self->_f_Pos(), ALLOW_REPLACE);
if (piece != NULL) if (piece != NULL)
{ {
piece->vel.x = self->vel.x + finecosine[fineang]; piece->Vel = self->Vel + DAngle(i*120.).ToVector(1);
piece->vel.y = self->vel.y + finesine[fineang];
piece->vel.z = self->vel.z;
piece->flags |= MF_DROPPED; piece->flags |= MF_DROPPED;
fineang += FINEANGLES/3;
j = (j == 0) ? (pr_quietusdrop() & 1) + 1 : 3-j; j = (j == 0) ? (pr_quietusdrop() & 1) + 1 : 3-j;
} }
} }

View file

@ -61,9 +61,9 @@ void A_FiredSpawnRock (AActor *actor)
if (mo) if (mo)
{ {
mo->target = actor; mo->target = actor;
mo->vel.x = (pr_firedemonrock() - 128) <<10; mo->Vel.X = (pr_firedemonrock() - 128) / 64.;
mo->vel.y = (pr_firedemonrock() - 128) <<10; mo->Vel.Y = (pr_firedemonrock() - 128) / 64.;
mo->vel.z = (pr_firedemonrock() << 10); mo->Vel.Z = (pr_firedemonrock() / 64.);
mo->special1 = 2; // Number bounces mo->special1 = 2; // Number bounces
} }
@ -101,10 +101,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SmBounce)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
// give some more velocity (x,y,&z) // give some more velocity (x,y,&z)
self->SetZ(self->floorz + FRACUNIT); self->_f_SetZ(self->floorz + FRACUNIT);
self->vel.z = (2*FRACUNIT) + (pr_smbounce() << 10); self->Vel.Z = 2. + pr_smbounce() / 64.;
self->vel.x = pr_smbounce()%3<<FRACBITS; self->Vel.X = pr_smbounce() % 3;
self->vel.y = pr_smbounce()%3<<FRACBITS; self->Vel.Y = pr_smbounce() % 3;
return 0; return 0;
} }
@ -137,20 +137,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
int weaveindex = self->special1; int weaveindex = self->special1;
AActor *target = self->target; AActor *target = self->target;
angle_t ang; DAngle ang;
fixed_t dist; fixed_t dist;
if (self->reactiontime) self->reactiontime--; if (self->reactiontime) self->reactiontime--;
if (self->threshold) self->threshold--; if (self->threshold) self->threshold--;
// Float up and down // Float up and down
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8); self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->special1 = (weaveindex + 2) & 63; self->special1 = (weaveindex + 2) & 63;
// Ensure it stays above certain height // Ensure it stays above certain height
if (self->Z() < self->floorz + (64*FRACUNIT)) if (self->_f_Z() < self->floorz + (64*FRACUNIT))
{ {
self->AddZ(2*FRACUNIT); self->_f_AddZ(2*FRACUNIT);
} }
if(!self->target || !(self->target->flags&MF_SHOOTABLE)) if(!self->target || !(self->target->flags&MF_SHOOTABLE))
@ -167,20 +167,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
else else
{ {
self->special2 = 0; self->special2 = 0;
self->vel.x = self->vel.y = 0; self->Vel.X = self->Vel.Y = 0;
dist = self->AproxDistance (target); dist = self->AproxDistance (target);
if (dist < FIREDEMON_ATTACK_RANGE) if (dist < FIREDEMON_ATTACK_RANGE)
{ {
if (pr_firedemonchase() < 30) if (pr_firedemonchase() < 30)
{ {
ang = self->__f_AngleTo(target); ang = self->AngleTo(target);
if (pr_firedemonchase() < 128) if (pr_firedemonchase() < 128)
ang += ANGLE_90; ang += 90;
else else
ang -= ANGLE_90; ang -= 90;
ang >>= ANGLETOFINESHIFT; self->Thrust(ang, 8);
self->vel.x = finecosine[ang] << 3; //FixedMul (8*FRACUNIT, finecosine[ang]);
self->vel.y = finesine[ang] << 3; //FixedMul (8*FRACUNIT, finesine[ang]);
self->special2 = 3; // strafe time self->special2 = 3; // strafe time
} }
} }
@ -235,16 +233,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_FiredSplotch)
mo = Spawn ("FireDemonSplotch1", self->Pos(), ALLOW_REPLACE); mo = Spawn ("FireDemonSplotch1", self->Pos(), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->vel.x = (pr_firedemonsplotch() - 128) << 11; mo->Vel.X = (pr_firedemonsplotch() - 128) / 32.;
mo->vel.y = (pr_firedemonsplotch() - 128) << 11; mo->Vel.Y = (pr_firedemonsplotch() - 128) / 32.;
mo->vel.z = (pr_firedemonsplotch() << 10) + FRACUNIT*3; mo->Vel.Z = (pr_firedemonsplotch() / 64.) + 3;
} }
mo = Spawn ("FireDemonSplotch2", self->Pos(), ALLOW_REPLACE); mo = Spawn ("FireDemonSplotch2", self->Pos(), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->vel.x = (pr_firedemonsplotch() - 128) << 11; mo->Vel.X = (pr_firedemonsplotch() - 128) / 32.;
mo->vel.y = (pr_firedemonsplotch() - 128) << 11; mo->Vel.Y = (pr_firedemonsplotch() - 128) / 32.;
mo->vel.z = (pr_firedemonsplotch() << 10) + FRACUNIT*3; mo->Vel.Z = (pr_firedemonsplotch() / 64.) + 3;
} }
return 0; return 0;
} }

View file

@ -114,16 +114,16 @@ bool AArtiPoisonBag3::Use (bool pickup)
// is as set by the projectile. To accommodate this with a proper trajectory, we // is as set by the projectile. To accommodate this with a proper trajectory, we
// aim the projectile ~20 degrees higher than we're looking at and increase the // aim the projectile ~20 degrees higher than we're looking at and increase the
// speed we fire at accordingly. // speed we fire at accordingly.
angle_t orgpitch = angle_t(-Owner->_f_pitch()) >> ANGLETOFINESHIFT; DAngle orgpitch = -Owner->Angles.Pitch;
angle_t modpitch = angle_t(0xDC00000 - Owner->_f_pitch()) >> ANGLETOFINESHIFT; DAngle modpitch = clamp<DAngle>(-Owner->Angles.Pitch + 20, -89., 89.);
angle_t angle = mo->_f_angle() >> ANGLETOFINESHIFT; DAngle angle = mo->Angles.Yaw;
fixed_t speed = fixed_t(g_sqrt((double)mo->Speed*mo->Speed + (4.0*65536*4*65536))); double speed = DVector2(mo->Speed, 4.).Length();
fixed_t xyscale = FixedMul(speed, finecosine[modpitch]); double xyscale = speed * modpitch.Cos();
mo->vel.z = FixedMul(speed, finesine[modpitch]); mo->Vel.Z = speed * modpitch.Sin();
mo->vel.x = FixedMul(xyscale, finecosine[angle]) + (Owner->vel.x >> 1); mo->Vel.X = xyscale * angle.Cos() + Owner->Vel.X / 2;
mo->vel.y = FixedMul(xyscale, finesine[angle]) + (Owner->vel.y >> 1); mo->Vel.Y = xyscale * angle.Sin() + Owner->Vel.Y / 2;
mo->AddZ(FixedMul(mo->Speed, finesine[orgpitch])); mo->AddZ(mo->Speed * orgpitch.Sin());
mo->target = Owner; mo->target = Owner;
mo->tics -= pr_poisonbag()&3; mo->tics -= pr_poisonbag()&3;
@ -306,7 +306,7 @@ IMPLEMENT_CLASS (APoisonCloud)
void APoisonCloud::BeginPlay () void APoisonCloud::BeginPlay ()
{ {
vel.x = 1; // missile objects must move to impact other objects Vel.X = MinVel; // missile objects must move to impact other objects
special1 = 24+(pr_poisoncloud()&7); special1 = 24+(pr_poisoncloud()&7);
special2 = 0; special2 = 0;
} }
@ -419,7 +419,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE); P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE);
bobIndex = self->special2; bobIndex = self->special2;
self->AddZ(finesine[bobIndex << BOBTOFINESHIFT] >> 1); self->_f_AddZ(finesine[bobIndex << BOBTOFINESHIFT] >> 1);
self->special2 = (bobIndex + 1) & 63; self->special2 = (bobIndex + 1) & 63;
return 0; return 0;
} }
@ -454,13 +454,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2)
// [RH] Check using actual velocity, although the vel.z < 2 check still stands // [RH] Check using actual velocity, although the vel.z < 2 check still stands
//if (abs(self->vel.x) < FRACUNIT*3/2 && abs(self->vel.y) < FRACUNIT*3/2 //if (abs(self->vel.x) < FRACUNIT*3/2 && abs(self->vel.y) < FRACUNIT*3/2
// && self->vel.z < 2*FRACUNIT) // && self->vel.z < 2*FRACUNIT)
if (self->vel.z < 2*FRACUNIT && if (self->Vel.Z < 2 && self->Vel.LengthSquared() < (9./4.))
TMulScale32 (self->vel.x, self->vel.x, self->vel.y, self->vel.y, self->vel.z, self->vel.z)
< (3*3)/(2*2))
{ {
self->SetState (self->SpawnState + 6); self->SetState (self->SpawnState + 6);
self->SetZ(self->floorz); self->_f_SetZ(self->floorz);
self->vel.z = 0; self->Vel.Z = 0;
self->BounceFlags = BOUNCE_None; self->BounceFlags = BOUNCE_None;
self->flags &= ~MF_MISSILE; self->flags &= ~MF_MISSILE;
} }

View file

@ -88,22 +88,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlyBuzz)
self->args[0]++; self->args[0]++;
angle_t ang = self->__f_AngleTo(targ); angle_t ang = self->__f_AngleTo(targ);
ang >>= ANGLETOFINESHIFT; ang >>= ANGLETOFINESHIFT;
if (!P_TryMove(self, self->X() + 6 * finecosine[ang], self->Y() + 6 * finesine[ang], true)) if (!P_TryMove(self, self->_f_X() + 6 * finecosine[ang], self->_f_Y() + 6 * finesine[ang], true))
{ {
self->SetIdle(true); self->SetIdle(true);
return 0; return 0;
} }
if (self->args[0] & 2) if (self->args[0] & 2)
{ {
self->vel.x += (pr_fly() - 128) << BOBTOFINESHIFT; self->Vel.X += (pr_fly() - 128) / 512.;
self->vel.y += (pr_fly() - 128) << BOBTOFINESHIFT; self->Vel.Y += (pr_fly() - 128) / 512.;
} }
int zrand = pr_fly(); int zrand = pr_fly();
if (targ->Z() + 5*FRACUNIT < self->Z() && zrand > 150) if (targ->Z() + 5. < self->Z() && zrand > 150)
{ {
zrand = -zrand; zrand = -zrand;
} }
self->vel.z = zrand << BOBTOFINESHIFT; self->Vel.Z = zrand / 512.;
if (pr_fly() < 40) if (pr_fly() < 40)
{ {
S_Sound(self, CHAN_VOICE, self->ActiveSound, 0.5f, ATTN_STATIC); S_Sound(self, CHAN_VOICE, self->ActiveSound, 0.5f, ATTN_STATIC);

View file

@ -89,7 +89,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
if ((self->args[3] % 4) == 0) if ((self->args[3] % 4) == 0)
{ {
weaveindex = self->special2; weaveindex = self->special2;
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 4); self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 4);
self->special2 = (weaveindex + 1) & 63; self->special2 = (weaveindex + 1) & 63;
} }

View file

@ -658,7 +658,7 @@ void A_SorcOffense2(AActor *actor)
int delta, index; int delta, index;
AActor *parent = actor->target; AActor *parent = actor->target;
AActor *dest = parent->target; AActor *dest = parent->target;
int dist; double dist;
// [RH] If no enemy, then don't try to shoot. // [RH] If no enemy, then don't try to shoot.
if (dest == NULL) if (dest == NULL)
@ -675,9 +675,8 @@ void A_SorcOffense2(AActor *actor)
if (mo) if (mo)
{ {
mo->special2 = 35*5/2; // 5 seconds mo->special2 = 35*5/2; // 5 seconds
dist = mo->AproxDistance(dest) / mo->Speed; dist = mo->DistanceBySpeed(dest, mo->Speed);
if(dist < 1) dist = 1; mo->Vel.Z = (dest->Z() - mo->Z()) / dist;
mo->vel.z = (dest->Z() - mo->Z()) / dist;
} }
} }
@ -710,21 +709,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnFizzle)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
fixed_t dist = 5*FRACUNIT; fixed_t dist = 5*FRACUNIT;
fixed_t speed = self->Speed; int speed = (int)self->Speed;
angle_t rangle; DAngle rangle;
AActor *mo; AActor *mo;
int ix; int ix;
fixedvec3 pos = self->Vec3Angle(dist, self->_f_angle(), -self->floorclip + (self->height >> 1)); fixedvec3 pos = self->_f_Vec3Angle(dist, self->_f_angle(), -self->floorclip + (self->height >> 1));
for (ix=0; ix<5; ix++) for (ix=0; ix<5; ix++)
{ {
mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE); mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE);
if (mo) if (mo)
{ {
rangle = (self->_f_angle() >> ANGLETOFINESHIFT) + ((pr_heresiarch()%5) << 1); rangle = self->Angles.Yaw + (pr_heresiarch() % 5) * (4096 / 360.);
mo->vel.x = FixedMul(pr_heresiarch()%speed, finecosine[rangle]); mo->Vel.X = (pr_heresiarch() % speed) * rangle.Cos();
mo->vel.y = FixedMul(pr_heresiarch()%speed, finesine[rangle]); mo->Vel.Y = (pr_heresiarch() % speed) * rangle.Sin();
mo->vel.z = FRACUNIT*2; mo->Vel.Z = 2;
} }
} }
return 0; return 0;
@ -944,9 +943,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallPop)
S_Sound (self, CHAN_BODY, "SorcererBallPop", 1, ATTN_NONE); S_Sound (self, CHAN_BODY, "SorcererBallPop", 1, ATTN_NONE);
self->flags &= ~MF_NOGRAVITY; self->flags &= ~MF_NOGRAVITY;
self->gravity = FRACUNIT/8; self->gravity = FRACUNIT/8;
self->vel.x = ((pr_heresiarch()%10)-5) << FRACBITS;
self->vel.y = ((pr_heresiarch()%10)-5) << FRACBITS; self->Vel.X = ((pr_heresiarch()%10)-5);
self->vel.z = (2+(pr_heresiarch()%3)) << FRACBITS; self->Vel.Y = ((pr_heresiarch()%10)-5);
self->Vel.Z = (2+(pr_heresiarch()%3));
self->special2 = 4*FRACUNIT; // Initial bounce factor self->special2 = 4*FRACUNIT; // Initial bounce factor
self->args[4] = BOUNCE_TIME_UNIT; // Bounce time unit self->args[4] = BOUNCE_TIME_UNIT; // Bounce time unit
self->args[3] = 5; // Bounce time in seconds self->args[3] = 5; // Bounce time in seconds

View file

@ -66,9 +66,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryExplode)
if (mo) if (mo)
{ {
mo->SetState (mo->SpawnState + (pr_pottery()%5)); mo->SetState (mo->SpawnState + (pr_pottery()%5));
mo->vel.z = ((pr_pottery()&7)+5)*(3*FRACUNIT/4); mo->Vel.X = pr_pottery.Random2() / 64.;
mo->vel.x = (pr_pottery.Random2())<<(FRACBITS-6); mo->Vel.Y = pr_pottery.Random2() / 64.;
mo->vel.y = (pr_pottery.Random2())<<(FRACBITS-6); mo->Vel.Z = ((pr_pottery() & 7) + 5) * 0.75;
} }
} }
S_Sound (mo, CHAN_BODY, "PotteryExplode", 1, ATTN_NORM); S_Sound (mo, CHAN_BODY, "PotteryExplode", 1, ATTN_NORM);
@ -141,7 +141,7 @@ IMPLEMENT_CLASS (AZCorpseLynchedNoHeart)
void AZCorpseLynchedNoHeart::PostBeginPlay () void AZCorpseLynchedNoHeart::PostBeginPlay ()
{ {
Super::PostBeginPlay (); Super::PostBeginPlay ();
Spawn ("BloodPool", X(), Y(), floorz, ALLOW_REPLACE); Spawn ("BloodPool", _f_X(), _f_Y(), floorz, ALLOW_REPLACE);
} }
//============================================================================ //============================================================================
@ -180,19 +180,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_CorpseExplode)
if (mo) if (mo)
{ {
mo->SetState (mo->SpawnState + (pr_foo()%3)); mo->SetState (mo->SpawnState + (pr_foo()%3));
mo->vel.z = ((pr_foo()&7)+5)*(3*FRACUNIT/4); mo->Vel.X = pr_foo.Random2() / 64.;
mo->vel.x = pr_foo.Random2()<<(FRACBITS-6); mo->Vel.Y = pr_foo.Random2() / 64.;
mo->vel.y = pr_foo.Random2()<<(FRACBITS-6); mo->Vel.Z = ((pr_foo() & 7) + 5) * 0.75;
} }
} }
// Spawn a skull // Spawn a skull
mo = Spawn ("CorpseBit", self->Pos(), ALLOW_REPLACE); mo = Spawn ("CorpseBit", self->_f_Pos(), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->SetState (mo->SpawnState + 3); mo->SetState (mo->SpawnState + 3);
mo->vel.z = ((pr_foo()&7)+5)*(3*FRACUNIT/4); mo->Vel.X = pr_foo.Random2() / 64.;
mo->vel.x = pr_foo.Random2()<<(FRACBITS-6); mo->Vel.Y = pr_foo.Random2() / 64.;
mo->vel.y = pr_foo.Random2()<<(FRACBITS-6); mo->Vel.Z = ((pr_foo() & 7) + 5) * 0.75;
} }
S_Sound (self, CHAN_BODY, self->DeathSound, 1, ATTN_IDLE); S_Sound (self, CHAN_BODY, self->DeathSound, 1, ATTN_IDLE);
self->Destroy (); self->Destroy ();
@ -242,7 +242,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafThrust)
if (pr_leafthrust() <= 96) if (pr_leafthrust() <= 96)
{ {
self->vel.z += (pr_leafthrust()<<9)+FRACUNIT; self->Vel.Z += pr_leafthrust() / 128. + 1;
} }
return 0; return 0;
} }
@ -266,14 +266,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafCheck)
angle_t ang = self->target ? self->target->_f_angle() : self->_f_angle(); angle_t ang = self->target ? self->target->_f_angle() : self->_f_angle();
if (pr_leafcheck() > 64) if (pr_leafcheck() > 64)
{ {
if (!self->vel.x && !self->vel.y) if (self->Vel.X == 0 && self->Vel.Y == 0)
{ {
P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+FRACUNIT); P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+FRACUNIT);
} }
return 0; return 0;
} }
self->SetState (self->SpawnState + 7); self->SetState (self->SpawnState + 7);
self->vel.z = (pr_leafcheck()<<9)+FRACUNIT; self->Vel.Z = pr_leafcheck() / 128. + 1;
P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+2*FRACUNIT); P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+2*FRACUNIT);
self->flags |= MF_MISSILE; self->flags |= MF_MISSILE;
return 0; return 0;
@ -315,9 +315,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode)
if (mo) if (mo)
{ {
mo->SetState (mo->SpawnState + i); mo->SetState (mo->SpawnState + i);
mo->vel.z = ((pr_soaexplode()&7)+5)*FRACUNIT; mo->Vel.X = pr_soaexplode.Random2() / 64.;
mo->vel.x = pr_soaexplode.Random2()<<(FRACBITS-6); mo->Vel.Y = pr_soaexplode.Random2() / 64.;
mo->vel.y = pr_soaexplode.Random2()<<(FRACBITS-6); mo->Vel.Z = (pr_soaexplode() & 7) + 5;
} }
} }
// Spawn an item? // Spawn an item?

View file

@ -71,9 +71,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
60 * FRACUNIT), ALLOW_REPLACE); 60 * FRACUNIT), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->vel.x = self->vel.x; mo->Vel = self->Vel;
mo->vel.y = self->vel.y;
mo->vel.z = self->vel.z;
mo->target = self; mo->target = self;
} }
} }
@ -94,8 +92,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
{ {
return 0; return 0;
} }
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->_f_angle()+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX")); P_SpawnMissileXYZ(self->_f_Vec3Angle(self->radius>>1, self->_f_angle()+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->_f_angle()-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX")); P_SpawnMissileXYZ(self->_f_Vec3Angle(self->radius>>1, self->_f_angle()-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
return 0; return 0;
} }
@ -110,9 +108,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->vel.x = 0; self->Vel.Zero();
self->vel.y = 0;
self->vel.z = 0;
self->height = self->GetDefault()->height; self->height = self->GetDefault()->height;
CALL_ACTION(A_FreezeDeathChunks, self); CALL_ACTION(A_FreezeDeathChunks, self);
return 0; return 0;
@ -133,7 +129,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
mo = P_SpawnMissileAngleZ (self, self->Z()+3*FRACUNIT, mo = P_SpawnMissileAngleZ (self, self->_f_Z()+3*FRACUNIT,
PClass::FindActor("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT)); PClass::FindActor("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT));
if (mo) if (mo)
{ {

View file

@ -99,7 +99,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
spot = iterator.Next (); spot = iterator.Next ();
if (spot != NULL) if (spot != NULL)
{ {
P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG); P_Teleport (self, spot->_f_X(), spot->_f_Y(), ONFLOORZ, spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG);
} }
P_StartScript (self, NULL, 249, NULL, NULL, 0, 0); P_StartScript (self, NULL, 249, NULL, NULL, 0, 0);
@ -141,7 +141,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
self->tracer = spot; self->tracer = spot;
if (spot) if (spot)
{ {
P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG); P_Teleport (self, spot->_f_X(), spot->_f_Y(), ONFLOORZ, spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG);
} }
} }
} }
@ -388,11 +388,11 @@ static void A_KSpiritSeeker (AActor *actor, DAngle thresh, DAngle turnMax)
actor->VelFromAngle(); actor->VelFromAngle();
if (!(level.time&15) if (!(level.time&15)
|| actor->Z() > target->Z()+(target->GetDefault()->height) || actor->_f_Z() > target->_f_Z()+(target->GetDefault()->height)
|| actor->Top() < target->Z()) || actor->_f_Top() < target->_f_Z())
{ {
newZ = target->Z()+((pr_kspiritseek()*target->GetDefault()->height)>>8); newZ = target->_f_Z()+((pr_kspiritseek()*target->GetDefault()->height)>>8);
deltaZ = newZ-actor->Z(); deltaZ = newZ-actor->_f_Z();
if (abs(deltaZ) > 15*FRACUNIT) if (abs(deltaZ) > 15*FRACUNIT)
{ {
if(deltaZ > 0) if(deltaZ > 0)
@ -404,12 +404,12 @@ static void A_KSpiritSeeker (AActor *actor, DAngle thresh, DAngle turnMax)
deltaZ = -15*FRACUNIT; deltaZ = -15*FRACUNIT;
} }
} }
dist = actor->AproxDistance (target) / actor->Speed; dist = actor->AproxDistance (target) / actor->_f_speed();
if (dist < 1) if (dist < 1)
{ {
dist = 1; dist = 1;
} }
actor->vel.z = deltaZ/dist; actor->Vel.Z = FIXED2DBL(deltaZ/dist);
} }
return; return;
} }
@ -476,11 +476,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_KBoltRaise)
fixed_t z; fixed_t z;
// Spawn a child upward // Spawn a child upward
z = self->Z() + KORAX_BOLT_HEIGHT; z = self->_f_Z() + KORAX_BOLT_HEIGHT;
if ((z + KORAX_BOLT_HEIGHT) < self->ceilingz) if ((z + KORAX_BOLT_HEIGHT) < self->ceilingz)
{ {
mo = Spawn("KoraxBolt", self->X(), self->Y(), z, ALLOW_REPLACE); mo = Spawn("KoraxBolt", self->_f_X(), self->_f_Y(), z, ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->special1 = KORAX_BOLT_LIFETIME; mo->special1 = KORAX_BOLT_LIFETIME;
@ -516,11 +516,11 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
} }
th->Angles.Yaw = an; th->Angles.Yaw = an;
th->VelFromAngle(); th->VelFromAngle();
dist = dest->AproxDistance (th) / th->Speed; dist = dest->AproxDistance (th) / th->_f_speed();
if (dist < 1) if (dist < 1)
{ {
dist = 1; dist = 1;
} }
th->vel.z = (dest->Z()-z+(30*FRACUNIT))/dist; th->Vel.Z = FIXED2DBL((dest->_f_Z()-z+(30*FRACUNIT))/dist);
return (P_CheckMissileSpawn(th, source->radius) ? th : NULL); return (P_CheckMissileSpawn(th, source->radius) ? th : NULL);
} }

View file

@ -82,7 +82,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireConePL1)
slope = P_AimLineAttack (self, angle, MELEERANGE, &t, 0., ALF_CHECK3D); slope = P_AimLineAttack (self, angle, MELEERANGE, &t, 0., ALF_CHECK3D);
if (t.linetarget) if (t.linetarget)
{ {
P_DamageMobj (t.linetarget, self, self, damage, NAME_Ice, DMG_USEANGLE, FLOAT2ANGLE(t.angleFromSource.Degrees)); P_DamageMobj (t.linetarget, self, self, damage, NAME_Ice, DMG_USEANGLE, t.angleFromSource.Degrees);
conedone = true; conedone = true;
break; break;
} }
@ -128,35 +128,35 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
// every so many calls, spawn a new missile in its set directions // every so many calls, spawn a new missile in its set directions
if (spawndir & SHARDSPAWN_LEFT) if (spawndir & SHARDSPAWN_LEFT)
{ {
mo = P_SpawnMissileAngleZSpeed (self, self->Z(), RUNTIME_CLASS(AFrostMissile), self->_f_angle()+(ANG45/9), mo = P_SpawnMissileAngleZSpeed (self, self->_f_Z(), RUNTIME_CLASS(AFrostMissile), self->_f_angle()+(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target); 0, (20+2*spermcount)<<FRACBITS, self->target);
if (mo) if (mo)
{ {
mo->special1 = SHARDSPAWN_LEFT; mo->special1 = SHARDSPAWN_LEFT;
mo->special2 = spermcount; mo->special2 = spermcount;
mo->vel.z = self->vel.z; mo->Vel.Z = self->Vel.Z;
mo->args[0] = (spermcount==3)?2:0; mo->args[0] = (spermcount==3)?2:0;
} }
} }
if (spawndir & SHARDSPAWN_RIGHT) if (spawndir & SHARDSPAWN_RIGHT)
{ {
mo = P_SpawnMissileAngleZSpeed (self, self->Z(), RUNTIME_CLASS(AFrostMissile), self->_f_angle()-(ANG45/9), mo = P_SpawnMissileAngleZSpeed (self, self->_f_Z(), RUNTIME_CLASS(AFrostMissile), self->_f_angle()-(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target); 0, (20+2*spermcount)<<FRACBITS, self->target);
if (mo) if (mo)
{ {
mo->special1 = SHARDSPAWN_RIGHT; mo->special1 = SHARDSPAWN_RIGHT;
mo->special2 = spermcount; mo->special2 = spermcount;
mo->vel.z = self->vel.z; mo->Vel.Z = self->Vel.Z;
mo->args[0] = (spermcount==3)?2:0; mo->args[0] = (spermcount==3)?2:0;
} }
} }
if (spawndir & SHARDSPAWN_UP) if (spawndir & SHARDSPAWN_UP)
{ {
mo = P_SpawnMissileAngleZSpeed (self, self->Z()+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->_f_angle(), mo = P_SpawnMissileAngleZSpeed (self, self->_f_Z()+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->_f_angle(),
0, (15+2*spermcount)<<FRACBITS, self->target); 0, (15+2*spermcount)<<FRACBITS, self->target);
if (mo) if (mo)
{ {
mo->vel.z = self->vel.z; mo->Vel.Z = self->Vel.Z;
if (spermcount & 1) // Every other reproduction if (spermcount & 1) // Every other reproduction
mo->special1 = SHARDSPAWN_UP | SHARDSPAWN_LEFT | SHARDSPAWN_RIGHT; mo->special1 = SHARDSPAWN_UP | SHARDSPAWN_LEFT | SHARDSPAWN_RIGHT;
else else
@ -167,11 +167,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
} }
if (spawndir & SHARDSPAWN_DOWN) if (spawndir & SHARDSPAWN_DOWN)
{ {
mo = P_SpawnMissileAngleZSpeed (self, self->Z()-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->_f_angle(), mo = P_SpawnMissileAngleZSpeed (self, self->_f_Z()-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->_f_angle(),
0, (15+2*spermcount)<<FRACBITS, self->target); 0, (15+2*spermcount)<<FRACBITS, self->target);
if (mo) if (mo)
{ {
mo->vel.z = self->vel.z; mo->Vel.Z = self->Vel.Z;
if (spermcount & 1) // Every other reproduction if (spermcount & 1) // Every other reproduction
mo->special1 = SHARDSPAWN_DOWN | SHARDSPAWN_LEFT | SHARDSPAWN_RIGHT; mo->special1 = SHARDSPAWN_DOWN | SHARDSPAWN_LEFT | SHARDSPAWN_RIGHT;
else else

View file

@ -42,8 +42,8 @@ int ALightning::SpecialMissileHit (AActor *thing)
{ {
if (thing->Mass != INT_MAX) if (thing->Mass != INT_MAX)
{ {
thing->vel.x += vel.x>>4; thing->Vel.X += Vel.X / 16;
thing->vel.y += vel.y>>4; thing->Vel.Y += Vel.Y / 16;
} }
if ((!thing->player && !(thing->flags2&MF2_BOSS)) if ((!thing->player && !(thing->flags2&MF2_BOSS))
|| !(level.time&1)) || !(level.time&1))
@ -156,12 +156,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
{ {
return 0; return 0;
} }
self->SetZ(self->floorz); self->_f_SetZ(self->floorz);
target = self->lastenemy->tracer; target = self->lastenemy->tracer;
} }
else if (self->flags3 & MF3_CEILINGHUGGER) else if (self->flags3 & MF3_CEILINGHUGGER)
{ {
self->SetZ(self->ceilingz-self->height); self->_f_SetZ(self->ceilingz-self->height);
target = self->tracer; target = self->tracer;
} }
if (self->flags3 & MF3_FLOORHUGGER) if (self->flags3 & MF3_FLOORHUGGER)
@ -196,9 +196,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
else else
{ {
self->Angles.Yaw = self->AngleTo(target); self->Angles.Yaw = self->AngleTo(target);
self->vel.x = 0; self->Vel.X = self->Vel.Y = 0;
self->vel.y = 0; P_ThrustMobj (self, self->Angles.Yaw, self->_f_speed()>>1);
P_ThrustMobj (self, self->Angles.Yaw, self->Speed>>1);
} }
} }
return 0; return 0;
@ -247,16 +246,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
if (mo) if (mo)
{ {
mo->lastenemy = self; mo->lastenemy = self;
mo->vel.x = self->vel.x; mo->Vel.X = self->Vel.X;
mo->vel.y = self->vel.y; mo->Vel.Y = self->Vel.Y;
mo->target = self->target; mo->target = self->target;
if (self->flags3 & MF3_FLOORHUGGER) if (self->flags3 & MF3_FLOORHUGGER)
{ {
mo->vel.z = 20*FRACUNIT; mo->Vel.Z = 20;
} }
else else
{ {
mo->vel.z = -20*FRACUNIT; mo->Vel.Z = -20;
} }
} }
if ((self->flags3 & MF3_FLOORHUGGER) && pr_zapf() < 160) if ((self->flags3 & MF3_FLOORHUGGER) && pr_zapf() < 160)
@ -328,8 +327,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ZapMimic)
} }
else else
{ {
self->vel.x = mo->vel.x; self->Vel.X = mo->Vel.X;
self->vel.y = mo->vel.y; self->Vel.Y = mo->Vel.Y;
} }
} }
return 0; return 0;
@ -356,7 +355,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LastZap)
if (mo) if (mo)
{ {
mo->SetState (mo->FindState (NAME_Death)); mo->SetState (mo->FindState (NAME_Death));
mo->vel.z = 40*FRACUNIT; mo->Vel.Z = 40;
mo->Damage = NULL; mo->Damage = NULL;
} }
return 0; return 0;

View file

@ -144,8 +144,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack)
P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &t, 32.); P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &t, 32.);
if (t.linetarget == NULL) if (t.linetarget == NULL)
{ {
BlockCheckLine.x = self->X(); BlockCheckLine.x = self->_f_X();
BlockCheckLine.y = self->Y(); BlockCheckLine.y = self->_f_Y();
BlockCheckLine.dx = FLOAT2FIXED(-angle.Sin()); BlockCheckLine.dx = FLOAT2FIXED(-angle.Sin());
BlockCheckLine.dy = FLOAT2FIXED(-angle.Cos()); BlockCheckLine.dy = FLOAT2FIXED(-angle.Cos());
t.linetarget = P_BlockmapSearch (self, 10, FrontBlockCheck); t.linetarget = P_BlockmapSearch (self, 10, FrontBlockCheck);
@ -213,7 +213,7 @@ static AActor *FrontBlockCheck (AActor *mo, int index, void *)
{ {
if (link->Me != mo) if (link->Me != mo)
{ {
if (P_PointOnDivlineSide (link->Me->X(), link->Me->Y(), &BlockCheckLine) == 0 && if (P_PointOnDivlineSide (link->Me->_f_X(), link->Me->_f_Y(), &BlockCheckLine) == 0 &&
mo->IsOkayToAttack (link->Me)) mo->IsOkayToAttack (link->Me))
{ {
return link->Me; return link->Me;
@ -233,7 +233,7 @@ void MStaffSpawn2 (AActor *actor, angle_t angle)
{ {
AActor *mo; AActor *mo;
mo = P_SpawnMissileAngleZ (actor, actor->Z()+40*FRACUNIT, mo = P_SpawnMissileAngleZ (actor, actor->_f_Z()+40*FRACUNIT,
RUNTIME_CLASS(AMageStaffFX2), angle, 0); RUNTIME_CLASS(AMageStaffFX2), angle, 0);
if (mo) if (mo)
{ {

View file

@ -35,7 +35,7 @@ void APigPlayer::MorphPlayerThink ()
{ {
return; return;
} }
if(!(vel.x | vel.y) && pr_pigplayerthink() < 64) if(Vel.X == 0 && Vel.Y == 0 && pr_pigplayerthink() < 64)
{ // Snout sniff { // Snout sniff
if (player->ReadyWeapon != NULL) if (player->ReadyWeapon != NULL)
{ {
@ -99,9 +99,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_PigPain)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
CALL_ACTION(A_Pain, self); CALL_ACTION(A_Pain, self);
if (self->Z() <= self->floorz) if (self->_f_Z() <= self->floorz)
{ {
self->vel.z = FRACUNIT*7/2; self->Vel.Z = 3.5;
} }
return 0; return 0;
} }

View file

@ -236,8 +236,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentSpawnGibs)
self->floorz+FRACUNIT, ALLOW_REPLACE); self->floorz+FRACUNIT, ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->vel.x = (pr_serpentgibs()-128)<<6; mo->Vel.X = (pr_serpentgibs() - 128) / 1024.f;
mo->vel.y = (pr_serpentgibs()-128)<<6; mo->Vel.Y = (pr_serpentgibs() - 128) / 1024.f;
mo->floorclip = 6*FRACUNIT; mo->floorclip = 6*FRACUNIT;
} }
} }
@ -296,7 +296,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentHeadCheck)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
if (self->Z() <= self->floorz) if (self->_f_Z() <= self->floorz)
{ {
if (Terrains[P_GetThingFloorType(self)].IsLiquid) if (Terrains[P_GetThingFloorType(self)].IsLiquid)
{ {

View file

@ -161,7 +161,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale)
while (it.Next(&cres)) while (it.Next(&cres))
{ {
fixed_t blockdist = self->radius + cres.thing->radius; fixed_t blockdist = self->radius + cres.thing->radius;
if (abs(cres.thing->X() - cres.position.x) >= blockdist || abs(cres.thing->Y() - cres.position.y) >= blockdist) if (abs(cres.thing->_f_X() - cres.position.x) >= blockdist || abs(cres.thing->_f_Y() - cres.position.y) >= blockdist)
continue; continue;
// Q: Make this z-aware for everything? It never was before. // Q: Make this z-aware for everything? It never was before.

View file

@ -36,7 +36,7 @@ bool AArtiDarkServant::Use (bool pickup)
{ {
mo->target = Owner; mo->target = Owner;
mo->tracer = Owner; mo->tracer = Owner;
mo->vel.z = 5*FRACUNIT; mo->Vel.Z = 5;
} }
return true; return true;
} }
@ -59,7 +59,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Summon)
if (P_TestMobjLocation(mo) == false || !self->tracer) if (P_TestMobjLocation(mo) == false || !self->tracer)
{ // Didn't fit - change back to artifact { // Didn't fit - change back to artifact
mo->Destroy (); mo->Destroy ();
AActor *arti = Spawn<AArtiDarkServant> (self->Pos(), ALLOW_REPLACE); AActor *arti = Spawn<AArtiDarkServant> (self->_f_Pos(), ALLOW_REPLACE);
if (arti) arti->flags |= MF_DROPPED; if (arti) arti->flags |= MF_DROPPED;
return 0; return 0;
} }

View file

@ -57,9 +57,7 @@ static void TeloSpawn (AActor *source, const char *type)
fx->special1 = TELEPORT_LIFE; // Lifetime countdown fx->special1 = TELEPORT_LIFE; // Lifetime countdown
fx->Angles.Yaw = source->Angles.Yaw; fx->Angles.Yaw = source->Angles.Yaw;
fx->target = source->target; fx->target = source->target;
fx->vel.x = source->vel.x >> 1; fx->Vel = source->Vel / 2;
fx->vel.y = source->vel.y >> 1;
fx->vel.z = source->vel.z >> 1;
} }
} }

View file

@ -31,12 +31,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithInit)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->AddZ(48<<FRACBITS); self->_f_AddZ(48<<FRACBITS);
// [RH] Make sure the wraith didn't go into the ceiling // [RH] Make sure the wraith didn't go into the ceiling
if (self->Top() > self->ceilingz) if (self->_f_Top() > self->ceilingz)
{ {
self->SetZ(self->ceilingz - self->height); self->_f_SetZ(self->ceilingz - self->height);
} }
self->special1 = 0; // index into floatbob self->special1 = 0; // index into floatbob
@ -119,7 +119,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX2)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *mo; AActor *mo;
angle_t angle; DAngle angle;
int i; int i;
for (i = 2; i; --i) for (i = 2; i; --i)
@ -127,19 +127,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX2)
mo = Spawn ("WraithFX2", self->Pos(), ALLOW_REPLACE); mo = Spawn ("WraithFX2", self->Pos(), ALLOW_REPLACE);
if(mo) if(mo)
{ {
if (pr_wraithfx2 ()<128) angle = pr_wraithfx2() * (360 / 1024.f);
if (pr_wraithfx2() >= 128)
{ {
angle = self->_f_angle()+(pr_wraithfx2()<<22); angle = -angle;
} }
else angle += self->Angles.Yaw;
{ mo->Vel.X = ((pr_wraithfx2() << 7) + 1) * angle.Cos();
angle = self->_f_angle()-(pr_wraithfx2()<<22); mo->Vel.Y = ((pr_wraithfx2() << 7) + 1) * angle.Sin();
} mo->Vel.Z = 0;
mo->vel.z = 0;
mo->vel.x = FixedMul((pr_wraithfx2()<<7)+FRACUNIT,
finecosine[angle>>ANGLETOFINESHIFT]);
mo->vel.y = FixedMul((pr_wraithfx2()<<7)+FRACUNIT,
finesine[angle>>ANGLETOFINESHIFT]);
mo->target = self; mo->target = self;
mo->floorclip = 10*FRACUNIT; mo->floorclip = 10*FRACUNIT;
} }
@ -255,7 +251,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithChase)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
int weaveindex = self->special1; int weaveindex = self->special1;
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8); self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->special1 = (weaveindex + 2) & 63; self->special1 = (weaveindex + 2) & 63;
// if (self->floorclip > 0) // if (self->floorclip > 0)
// { // {

View file

@ -1228,7 +1228,7 @@ void G_FinishTravel ()
{ {
Printf(TEXTCOLOR_RED "No player %d start to travel to!\n", pnum + 1); Printf(TEXTCOLOR_RED "No player %d start to travel to!\n", pnum + 1);
// Move to the coordinates this player had when they left the level. // Move to the coordinates this player had when they left the level.
pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z()); pawn->SetXYZ(pawndup->_f_X(), pawndup->_f_Y(), pawndup->_f_Z());
} }
} }
oldpawn = pawndup; oldpawn = pawndup;
@ -1242,10 +1242,8 @@ void G_FinishTravel ()
{ {
pawn->Angles = pawndup->Angles; pawn->Angles = pawndup->Angles;
} }
pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z()); pawn->SetXYZ(pawndup->_f_X(), pawndup->_f_Y(), pawndup->_f_Z());
pawn->vel.x = pawndup->vel.x; pawn->Vel = pawndup->Vel;
pawn->vel.y = pawndup->vel.y;
pawn->vel.z = pawndup->vel.z;
pawn->Sector = pawndup->Sector; pawn->Sector = pawndup->Sector;
pawn->floorz = pawndup->floorz; pawn->floorz = pawndup->floorz;
pawn->ceilingz = pawndup->ceilingz; pawn->ceilingz = pawndup->ceilingz;
@ -1315,7 +1313,7 @@ void G_InitLevelLocals ()
NormalLight.ChangeColor (PalEntry (255, 255, 255), 0); NormalLight.ChangeColor (PalEntry (255, 255, 255), 0);
level.gravity = sv_gravity * 35/TICRATE; level.gravity = sv_gravity * 35/TICRATE;
level.aircontrol = (fixed_t)(sv_aircontrol * 65536.f); level.aircontrol = sv_aircontrol;
level.teamdamage = teamdamage; level.teamdamage = teamdamage;
level.flags = 0; level.flags = 0;
level.flags2 = 0; level.flags2 = 0;
@ -1356,7 +1354,7 @@ void G_InitLevelLocals ()
} }
if (info->aircontrol != 0.f) if (info->aircontrol != 0.f)
{ {
level.aircontrol = (fixed_t)(info->aircontrol * 65536.f); level.aircontrol = info->aircontrol;
} }
if (info->teamdamage != 0.f) if (info->teamdamage != 0.f)
{ {
@ -1461,15 +1459,14 @@ FString CalcMapName (int episode, int level)
void G_AirControlChanged () void G_AirControlChanged ()
{ {
if (level.aircontrol <= 256) if (level.aircontrol <= 1/256.)
{ {
level.airfriction = FRACUNIT; level.airfriction = 1.;
} }
else else
{ {
// Friction is inversely proportional to the amount of control // Friction is inversely proportional to the amount of control
float fric = ((float)level.aircontrol/65536.f) * -0.0941f + 1.0004f; level.airfriction = level.aircontrol * -0.0941 + 1.0004;
level.airfriction = (fixed_t)(fric * 65536.f);
} }
} }

View file

@ -304,8 +304,8 @@ struct level_info_t
DWORD outsidefog; DWORD outsidefog;
int cdtrack; int cdtrack;
unsigned int cdid; unsigned int cdid;
float gravity; double gravity;
float aircontrol; double aircontrol;
int WarpTrans; int WarpTrans;
int airsupply; int airsupply;
DWORD compatflags, compatflags2; DWORD compatflags, compatflags2;
@ -429,9 +429,9 @@ struct FLevelLocals
int total_monsters; int total_monsters;
int killed_monsters; int killed_monsters;
float gravity; double gravity;
fixed_t aircontrol; double aircontrol;
fixed_t airfriction; double airfriction;
int airsupply; int airsupply;
int DefaultEnvironment; // Default sound environment. int DefaultEnvironment; // Default sound environment.

View file

@ -989,14 +989,14 @@ DEFINE_MAP_OPTION(gravity, true)
{ {
parse.ParseAssign(); parse.ParseAssign();
parse.sc.MustGetFloat(); parse.sc.MustGetFloat();
info->gravity = float(parse.sc.Float); info->gravity = parse.sc.Float;
} }
DEFINE_MAP_OPTION(aircontrol, true) DEFINE_MAP_OPTION(aircontrol, true)
{ {
parse.ParseAssign(); parse.ParseAssign();
parse.sc.MustGetFloat(); parse.sc.MustGetFloat();
info->aircontrol = float(parse.sc.Float); info->aircontrol = parse.sc.Float;
} }
DEFINE_MAP_OPTION(airsupply, true) DEFINE_MAP_OPTION(airsupply, true)

View file

@ -175,14 +175,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk1)
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#define MNTR_CHARGE_SPEED (13*FRACUNIT) #define MNTR_CHARGE_SPEED (13.)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide) DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER); bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
angle_t angle;
AActor *target; AActor *target;
int dist; int dist;
@ -210,12 +209,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
self->flags2 |= MF2_INVULNERABLE; self->flags2 |= MF2_INVULNERABLE;
} }
A_FaceTarget (self); A_FaceTarget (self);
angle = self->_f_angle()>>ANGLETOFINESHIFT; self->VelFromAngle(MNTR_CHARGE_SPEED);
self->vel.x = FixedMul (MNTR_CHARGE_SPEED, finecosine[angle]);
self->vel.y = FixedMul (MNTR_CHARGE_SPEED, finesine[angle]);
self->special1 = TICRATE/2; // Charge duration self->special1 = TICRATE/2; // Charge duration
} }
else if (target->Z() == target->floorz else if (target->_f_Z() == target->floorz
&& dist < 9*64*FRACUNIT && dist < 9*64*FRACUNIT
&& pr_minotaurdecide() < (friendly ? 100 : 220)) && pr_minotaurdecide() < (friendly ? 100 : 220))
{ // Floor fire attack { // Floor fire attack
@ -260,7 +257,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurCharge)
type = PClass::FindActor("PunchPuff"); type = PClass::FindActor("PunchPuff");
} }
puff = Spawn (type, self->Pos(), ALLOW_REPLACE); puff = Spawn (type, self->Pos(), ALLOW_REPLACE);
puff->vel.z = 2*FRACUNIT; puff->Vel.Z = 2;
self->special1--; self->special1--;
} }
else else
@ -303,7 +300,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self); P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
return 0; return 0;
} }
z = self->Z() + 40*FRACUNIT; z = self->_f_Z() + 40*FRACUNIT;
PClassActor *fx = PClass::FindActor("MinotaurFX1"); PClassActor *fx = PClass::FindActor("MinotaurFX1");
if (fx) if (fx)
{ {
@ -311,7 +308,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
if (mo != NULL) if (mo != NULL)
{ {
// S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM); // S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
vz = mo->vel.z; vz = mo->_f_velz();
angle = mo->_f_angle(); angle = mo->_f_angle();
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/8), vz); P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/8), vz); P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/8), vz);
@ -392,13 +389,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
AActor *mo; AActor *mo;
self->SetZ(self->floorz); self->_f_SetZ(self->floorz);
fixedvec2 pos = self->Vec2Offset( fixedvec2 pos = self->Vec2Offset(
(pr_fire.Random2 () << 10), (pr_fire.Random2 () << 10),
(pr_fire.Random2 () << 10)); (pr_fire.Random2 () << 10));
mo = Spawn("MinotaurFX3", pos.x, pos.y, self->floorz, ALLOW_REPLACE); mo = Spawn("MinotaurFX3", pos.x, pos.y, self->floorz, ALLOW_REPLACE);
mo->target = self->target; mo->target = self->target;
mo->vel.x = 1; // Force block checking mo->Vel.X = MinVel; // Force block checking
P_CheckMissileSpawn (mo, self->radius); P_CheckMissileSpawn (mo, self->radius);
return 0; return 0;
} }
@ -411,18 +408,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
void P_MinotaurSlam (AActor *source, AActor *target) void P_MinotaurSlam (AActor *source, AActor *target)
{ {
angle_t angle; DAngle angle;
fixed_t thrust; double thrust;
int damage; int damage;
angle = source->__f_AngleTo(target); angle = source->AngleTo(target);
angle >>= ANGLETOFINESHIFT; thrust = 16 + pr_minotaurslam() / 64.;
thrust = 16*FRACUNIT+(pr_minotaurslam()<<10); target->VelFromAngle(angle, thrust);
target->vel.x += FixedMul (thrust, finecosine[angle]);
target->vel.y += FixedMul (thrust, finesine[angle]);
damage = pr_minotaurslam.HitDice (static_cast<AMinotaur *>(source) ? 4 : 6); damage = pr_minotaurslam.HitDice (static_cast<AMinotaur *>(source) ? 4 : 6);
int newdam = P_DamageMobj (target, NULL, NULL, damage, NAME_Melee); int newdam = P_DamageMobj (target, NULL, NULL, damage, NAME_Melee);
P_TraceBleed (newdam > 0 ? newdam : damage, target, angle, 0); P_TraceBleed (newdam > 0 ? newdam : damage, target, angle, 0.);
if (target->player) if (target->player)
{ {
target->reactiontime = 14+(pr_minotaurslam()&7); target->reactiontime = 14+(pr_minotaurslam()&7);

View file

@ -274,12 +274,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
int numChunks; int numChunks;
AActor *mo; AActor *mo;
if ((self->vel.x || self->vel.y || self->vel.z) && !(self->flags6 & MF6_SHATTERING)) if (!self->Vel.isZero() && !(self->flags6 & MF6_SHATTERING))
{ {
self->tics = 3*TICRATE; self->tics = 3*TICRATE;
return 0; return 0;
} }
self->vel.x = self->vel.y = self->vel.z = 0; self->Vel.Zero();
S_Sound (self, CHAN_BODY, "misc/icebreak", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "misc/icebreak", 1, ATTN_NORM);
// [RH] In Hexen, this creates a random number of shards (range [24,56]) // [RH] In Hexen, this creates a random number of shards (range [24,56])
@ -297,10 +297,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
mo = Spawn("IceChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); mo = Spawn("IceChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->SetState (mo->SpawnState + (pr_freeze()%3)); mo->SetState (mo->SpawnState + (pr_freeze()%3));
mo->vel.z = FixedDiv(mo->Z() - self->Z(), self->height)<<2; mo->Vel.X = pr_freeze.Random2() / 128.;
mo->vel.x = pr_freeze.Random2 () << (FRACBITS-7); mo->Vel.Y = pr_freeze.Random2() / 128.;
mo->vel.y = pr_freeze.Random2 () << (FRACBITS-7); mo->Vel.Z = (mo->Z() - self->Z()) / self->_Height() * 4;
CALL_ACTION(A_IceSetTics, mo); // set a random tic wait CALL_ACTION(A_IceSetTics, mo); // set a random tic wait
mo->RenderStyle = self->RenderStyle; mo->RenderStyle = self->RenderStyle;
mo->alpha = self->alpha; mo->alpha = self->alpha;
@ -311,9 +311,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
AActor *head = Spawn("IceChunkHead", self->PosPlusZ(self->player->mo->ViewHeight), ALLOW_REPLACE); AActor *head = Spawn("IceChunkHead", self->PosPlusZ(self->player->mo->ViewHeight), ALLOW_REPLACE);
if (head != NULL) if (head != NULL)
{ {
head->vel.z = FixedDiv(head->Z() - self->Z(), self->height)<<2; head->Vel.X = pr_freeze.Random2() / 128.;
head->vel.x = pr_freeze.Random2 () << (FRACBITS-7); head->Vel.Y = pr_freeze.Random2() / 128.;
head->vel.y = pr_freeze.Random2 () << (FRACBITS-7); head->Vel.Z = (mo->Z() - self->Z()) / self->_Height() * 4;
head->health = self->health; head->health = self->health;
head->Angles.Yaw = self->Angles.Yaw; head->Angles.Yaw = self->Angles.Yaw;
if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn))) if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn)))

View file

@ -979,11 +979,11 @@ void APowerFlight::InitEffect ()
Super::InitEffect(); Super::InitEffect();
Owner->flags2 |= MF2_FLY; Owner->flags2 |= MF2_FLY;
Owner->flags |= MF_NOGRAVITY; Owner->flags |= MF_NOGRAVITY;
if (Owner->Z() <= Owner->floorz) if (Owner->_f_Z() <= Owner->floorz)
{ {
Owner->vel.z = 4*FRACUNIT; // thrust the player in the air a bit Owner->Vel.Z = 4;; // thrust the player in the air a bit
} }
if (Owner->vel.z <= -35*FRACUNIT) if (Owner->Vel.Z <= -35)
{ // stop falling scream { // stop falling scream
S_StopSound (Owner, CHAN_VOICE); S_StopSound (Owner, CHAN_VOICE);
} }
@ -1026,7 +1026,7 @@ void APowerFlight::EndEffect ()
if (!(Owner->flags7 & MF7_FLYCHEAT)) if (!(Owner->flags7 & MF7_FLYCHEAT))
{ {
if (Owner->Z() != Owner->floorz) if (Owner->_f_Z() != Owner->floorz)
{ {
Owner->player->centering = true; Owner->player->centering = true;
} }
@ -1220,10 +1220,10 @@ void APowerSpeed::Serialize(FArchive &arc)
// //
//=========================================================================== //===========================================================================
fixed_t APowerSpeed ::GetSpeedFactor () double APowerSpeed ::GetSpeedFactor ()
{ {
if (Inventory != NULL) if (Inventory != NULL)
return FixedMul(Speed, Inventory->GetSpeedFactor()); return Speed * Inventory->GetSpeedFactor();
else else
return Speed; return Speed;
} }
@ -1261,10 +1261,10 @@ void APowerSpeed::DoEffect ()
} }
} }
if (P_AproxDistance (Owner->vel.x, Owner->vel.y) <= 12*FRACUNIT) if (P_AproxDistance (Owner->_f_velx(), Owner->_f_vely()) <= 12*FRACUNIT)
return; return;
AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->Pos(), NO_REPLACE); AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->_f_Pos(), NO_REPLACE);
if (speedMo) if (speedMo)
{ {
speedMo->Angles.Yaw = Owner->Angles.Yaw; speedMo->Angles.Yaw = Owner->Angles.Yaw;

View file

@ -158,7 +158,7 @@ class APowerSpeed : public APowerup
protected: protected:
void DoEffect (); void DoEffect ();
void Serialize(FArchive &arc); void Serialize(FArchive &arc);
fixed_t GetSpeedFactor(); double GetSpeedFactor();
public: public:
int SpeedFlags; int SpeedFlags;
}; };

View file

@ -112,7 +112,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100); if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100);
self->Angles.Yaw += rotationspeed; self->Angles.Yaw += rotationspeed;
self->SetOrigin(self->target->Vec3Angle(rotationradius*FRACUNIT, self->_f_angle(), 0), true); self->SetOrigin(self->target->Vec3Angle(rotationradius*FRACUNIT, self->Angles.Yaw, 0), true);
self->floorz = self->target->floorz; self->floorz = self->target->floorz;
self->ceilingz = self->target->ceilingz; self->ceilingz = self->target->ceilingz;
return 0; return 0;

View file

@ -173,9 +173,9 @@ void AAimingCamera::Tick ()
} }
if (MaxPitchChange != 0) if (MaxPitchChange != 0)
{ // Aim camera's pitch; use floats for precision { // Aim camera's pitch; use floats for precision
fixedvec2 fv3 = tracer->Vec2To(this); fixedvec2 fv3 = tracer->_f_Vec2To(this);
DVector2 vect(fv3.x, fv3.y); DVector2 vect(fv3.x, fv3.y);
double dz = Z() - tracer->Z() - tracer->height/2; double dz = _f_Z() - tracer->_f_Z() - tracer->height/2;
double dist = vect.Length(); double dist = vect.Length();
DAngle desiredPitch = dist != 0.f ? VecToAngle(dist, dz) : 0.; DAngle desiredPitch = dist != 0.f ? VecToAngle(dist, dz) : 0.;
DAngle diff = deltaangle(Angles.Pitch, desiredPitch); DAngle diff = deltaangle(Angles.Pitch, desiredPitch);

View file

@ -15,7 +15,7 @@ public:
{ {
if (!Super::FloorBounceMissile (plane)) if (!Super::FloorBounceMissile (plane))
{ {
if (abs (vel.z) < (FRACUNIT/2)) if (fabs (Vel.Z) < 0.5)
{ {
Destroy (); Destroy ();
} }
@ -35,7 +35,7 @@ void P_SpawnDirt (AActor *actor, fixed_t radius)
AActor *mo; AActor *mo;
fixed_t zo = (pr_dirt() << 9) + FRACUNIT; fixed_t zo = (pr_dirt() << 9) + FRACUNIT;
fixedvec3 pos = actor->Vec3Angle(radius, pr_dirt() << 24, zo); fixedvec3 pos = actor->_f_Vec3Angle(radius, pr_dirt() << 24, zo);
char fmt[8]; char fmt[8];
mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6); mysnprintf(fmt, countof(fmt), "Dirt%d", 1 + pr_dirt()%6);
@ -45,7 +45,7 @@ void P_SpawnDirt (AActor *actor, fixed_t radius)
mo = Spawn (dtype, pos, ALLOW_REPLACE); mo = Spawn (dtype, pos, ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->vel.z = pr_dirt()<<10; mo->Vel.Z = pr_dirt() / 64.;
} }
} }
} }

View file

@ -92,7 +92,7 @@ DBaseDecal::DBaseDecal (int statnum, fixed_t z)
DBaseDecal::DBaseDecal (const AActor *basis) DBaseDecal::DBaseDecal (const AActor *basis)
: DThinker(STAT_DECAL), : DThinker(STAT_DECAL),
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->Z()), ScaleX(basis->scaleX), ScaleY(basis->scaleY), WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->_f_Z()), ScaleX(basis->scaleX), ScaleY(basis->scaleY),
Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum), Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle) RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle)
{ {
@ -820,22 +820,22 @@ void ADecal::BeginPlay ()
{ {
if (!tpl->PicNum.Exists()) if (!tpl->PicNum.Exists())
{ {
Printf("Decal actor at (%d,%d) does not have a valid texture\n", X()>>FRACBITS, Y()>>FRACBITS); Printf("Decal actor at (%f,%f) does not have a valid texture\n", X(), Y());
} }
else else
{ {
// Look for a wall within 64 units behind the actor. If none can be // Look for a wall within 64 units behind the actor. If none can be
// found, then no decal is created, and this actor is destroyed // found, then no decal is created, and this actor is destroyed
// without effectively doing anything. // without effectively doing anything.
if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), Z(), FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_180, 64*FRACUNIT, true)) if (NULL == ShootDecal(tpl, this, Sector, _f_X(), _f_Y(), _f_Z(), FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_180, 64*FRACUNIT, true))
{ {
DPrintf ("Could not find a wall to stick decal to at (%d,%d)\n", X()>>FRACBITS, Y()>>FRACBITS); DPrintf ("Could not find a wall to stick decal to at (%f,%f)\n", X(), Y());
} }
} }
} }
else else
{ {
DPrintf ("Decal actor at (%d,%d) does not have a good template\n", X()>>FRACBITS, Y()>>FRACBITS); DPrintf ("Decal actor at (%f,%f) does not have a good template\n", X(), Y());
} }
// This actor doesn't need to stick around anymore. // This actor doesn't need to stick around anymore.
Destroy(); Destroy();

View file

@ -28,7 +28,7 @@ void AFastProjectile::Tick ()
int changexy; int changexy;
ClearInterpolation(); ClearInterpolation();
fixed_t oldz = Z(); fixed_t oldz = _f_Z();
if (!(flags5 & MF5_NOTIMEFREEZE)) if (!(flags5 & MF5_NOTIMEFREEZE))
{ {
@ -47,7 +47,7 @@ void AFastProjectile::Tick ()
int count = 8; int count = 8;
if (radius > 0) if (radius > 0)
{ {
while ( ((abs(vel.x) >> shift) > radius) || ((abs(vel.y) >> shift) > radius)) while ( ((abs(_f_velx()) >> shift) > radius) || ((abs(_f_vely()) >> shift) > radius))
{ {
// we need to take smaller steps. // we need to take smaller steps.
shift++; shift++;
@ -56,11 +56,11 @@ void AFastProjectile::Tick ()
} }
// Handle movement // Handle movement
if (vel.x || vel.y || (Z() != floorz) || vel.z) if (Vel.X != 0 || Vel.Y != 0 || (_f_Z() != floorz) || _f_velz())
{ {
xfrac = vel.x >> shift; xfrac = _f_velx() >> shift;
yfrac = vel.y >> shift; yfrac = _f_vely() >> shift;
zfrac = vel.z >> shift; zfrac = _f_velz() >> shift;
changexy = xfrac || yfrac; changexy = xfrac || yfrac;
int ripcount = count >> 3; int ripcount = count >> 3;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -72,14 +72,14 @@ void AFastProjectile::Tick ()
tm.LastRipped.Clear(); // [RH] Do rip damage each step, like Hexen tm.LastRipped.Clear(); // [RH] Do rip damage each step, like Hexen
} }
if (!P_TryMove (this, X() + xfrac,Y() + yfrac, true, NULL, tm)) if (!P_TryMove (this, _f_X() + xfrac,_f_Y() + yfrac, true, NULL, tm))
{ // Blocked move { // Blocked move
if (!(flags3 & MF3_SKYEXPLODE)) if (!(flags3 & MF3_SKYEXPLODE))
{ {
if (tm.ceilingline && if (tm.ceilingline &&
tm.ceilingline->backsector && tm.ceilingline->backsector &&
tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum && tm.ceilingline->backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(PosRelative(tm.ceilingline))) _f_Z() >= tm.ceilingline->backsector->ceilingplane.ZatPoint(PosRelative(tm.ceilingline)))
{ {
// Hack to prevent missiles exploding against the sky. // Hack to prevent missiles exploding against the sky.
// Does not handle sky floors. // Does not handle sky floors.
@ -98,10 +98,10 @@ void AFastProjectile::Tick ()
return; return;
} }
} }
AddZ(zfrac); _f_AddZ(zfrac);
UpdateWaterLevel (oldz); UpdateWaterLevel (oldz);
oldz = Z(); oldz = _f_Z();
if (Z() <= floorz) if (_f_Z() <= floorz)
{ // Hit the floor { // Hit the floor
if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE)) if (floorpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
@ -112,12 +112,12 @@ void AFastProjectile::Tick ()
return; return;
} }
SetZ(floorz); _f_SetZ(floorz);
P_HitFloor (this); P_HitFloor (this);
P_ExplodeMissile (this, NULL, NULL); P_ExplodeMissile (this, NULL, NULL);
return; return;
} }
if (Top() > ceilingz) if (_f_Top() > ceilingz)
{ // Hit the ceiling { // Hit the ceiling
if (ceilingpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE)) if (ceilingpic == skyflatnum && !(flags3 & MF3_SKYEXPLODE))
@ -126,7 +126,7 @@ void AFastProjectile::Tick ()
return; return;
} }
SetZ(ceilingz - height); _f_SetZ(ceilingz - height);
P_ExplodeMissile (this, NULL, NULL); P_ExplodeMissile (this, NULL, NULL);
return; return;
} }
@ -161,7 +161,7 @@ void AFastProjectile::Effect()
FName name = GetClass()->MissileName; FName name = GetClass()->MissileName;
if (name != NAME_None) if (name != NAME_None)
{ {
fixed_t hitz = Z()-8*FRACUNIT; fixed_t hitz = _f_Z()-8*FRACUNIT;
if (hitz < floorz) if (hitz < floorz)
{ {
@ -173,7 +173,7 @@ void AFastProjectile::Effect()
PClassActor *trail = PClass::FindActor(name); PClassActor *trail = PClass::FindActor(name);
if (trail != NULL) if (trail != NULL)
{ {
AActor *act = Spawn (trail, X(), Y(), hitz, ALLOW_REPLACE); AActor *act = Spawn (trail, _f_X(), _f_Y(), hitz, ALLOW_REPLACE);
if (act != NULL) if (act != NULL)
{ {
act->Angles.Yaw = Angles.Yaw; act->Angles.Yaw = Angles.Yaw;

View file

@ -120,7 +120,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
p->MorphExitFlash = (exit_flash) ? exit_flash : RUNTIME_CLASS(ATeleportFog); p->MorphExitFlash = (exit_flash) ? exit_flash : RUNTIME_CLASS(ATeleportFog);
p->health = morphed->health; p->health = morphed->health;
p->mo = morphed; p->mo = morphed;
p->vel.x = p->vel.y = 0; p->Vel.X = p->Vel.Y = 0;
morphed->ObtainInventory (actor); morphed->ObtainInventory (actor);
// Remove all armor // Remove all armor
for (item = morphed->Inventory; item != NULL; ) for (item = morphed->Inventory; item != NULL; )
@ -227,11 +227,9 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
mo->player = player; mo->player = player;
mo->reactiontime = 18; mo->reactiontime = 18;
mo->flags = ActorFlags::FromInt (pmo->special2) & ~MF_JUSTHIT; mo->flags = ActorFlags::FromInt (pmo->special2) & ~MF_JUSTHIT;
mo->vel.x = 0; mo->Vel.X = mo->Vel.Y = 0;
mo->vel.y = 0; player->Vel.Zero();
player->vel.x = 0; mo->Vel.Z = pmo->Vel.Z;
player->vel.y = 0;
mo->vel.z = pmo->vel.z;
if (!(pmo->special2 & MF_JUSTHIT)) if (!(pmo->special2 & MF_JUSTHIT))
{ {
mo->renderflags &= ~RF_INVISIBLE; mo->renderflags &= ~RF_INVISIBLE;
@ -461,9 +459,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
if (!(beast->FlagsSave & MF_JUSTHIT)) if (!(beast->FlagsSave & MF_JUSTHIT))
actor->renderflags &= ~RF_INVISIBLE; actor->renderflags &= ~RF_INVISIBLE;
actor->health = actor->SpawnHealth(); actor->health = actor->SpawnHealth();
actor->vel.x = beast->vel.x; actor->Vel = beast->Vel;
actor->vel.y = beast->vel.y;
actor->vel.z = beast->vel.z;
actor->tid = beast->tid; actor->tid = beast->tid;
actor->special = beast->special; actor->special = beast->special;
actor->Score = beast->Score; actor->Score = beast->Score;

View file

@ -298,7 +298,7 @@ void APathFollower::Tick ()
if (CurrNode->args[2]) if (CurrNode->args[2])
{ {
HoldTime = level.time + CurrNode->args[2] * TICRATE / 8; HoldTime = level.time + CurrNode->args[2] * TICRATE / 8;
SetXYZ(CurrNode->X(), CurrNode->Y(), CurrNode->Z()); SetXYZ(CurrNode->_f_X(), CurrNode->_f_Y(), CurrNode->_f_Z());
} }
} }
@ -356,9 +356,9 @@ bool APathFollower::Interpolate ()
if ((args[2] & 8) && Time > 0.f) if ((args[2] & 8) && Time > 0.f)
{ {
dx = X(); dx = _f_X();
dy = Y(); dy = _f_Y();
dz = Z(); dz = _f_Z();
} }
if (CurrNode->Next==NULL) return false; if (CurrNode->Next==NULL) return false;
@ -367,20 +367,20 @@ bool APathFollower::Interpolate ()
fixed_t x, y, z; fixed_t x, y, z;
if (args[2] & 1) if (args[2] & 1)
{ // linear { // linear
x = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->X()), FIXED2DBL(CurrNode->Next->X()))); x = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_X()), FIXED2DBL(CurrNode->Next->_f_X())));
y = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->Y()), FIXED2DBL(CurrNode->Next->Y()))); y = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_Y()), FIXED2DBL(CurrNode->Next->_f_Y())));
z = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->Z()), FIXED2DBL(CurrNode->Next->Z()))); z = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_Z()), FIXED2DBL(CurrNode->Next->_f_Z())));
} }
else else
{ // spline { // spline
if (CurrNode->Next->Next==NULL) return false; if (CurrNode->Next->Next==NULL) return false;
x = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->X()), FIXED2DBL(CurrNode->X()), x = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_X()), FIXED2DBL(CurrNode->_f_X()),
FIXED2DBL(CurrNode->Next->X()), FIXED2DBL(CurrNode->Next->Next->X()))); FIXED2DBL(CurrNode->Next->_f_X()), FIXED2DBL(CurrNode->Next->Next->_f_X())));
y = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->Y()), FIXED2DBL(CurrNode->Y()), y = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_Y()), FIXED2DBL(CurrNode->_f_Y()),
FIXED2DBL(CurrNode->Next->Y()), FIXED2DBL(CurrNode->Next->Next->Y()))); FIXED2DBL(CurrNode->Next->_f_Y()), FIXED2DBL(CurrNode->Next->Next->_f_Y())));
z = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->Z()), FIXED2DBL(CurrNode->Z()), z = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_Z()), FIXED2DBL(CurrNode->_f_Z()),
FIXED2DBL(CurrNode->Next->Z()), FIXED2DBL(CurrNode->Next->Next->Z()))); FIXED2DBL(CurrNode->Next->_f_Z()), FIXED2DBL(CurrNode->Next->Next->_f_Z())));
} }
SetXYZ(x, y, z); SetXYZ(x, y, z);
LinkToWorld (); LinkToWorld ();
@ -391,9 +391,9 @@ bool APathFollower::Interpolate ()
{ {
if (args[2] & 1) if (args[2] & 1)
{ // linear { // linear
dx = CurrNode->Next->X() - CurrNode->X(); dx = CurrNode->Next->_f_X() - CurrNode->_f_X();
dy = CurrNode->Next->Y() - CurrNode->Y(); dy = CurrNode->Next->_f_Y() - CurrNode->_f_Y();
dz = CurrNode->Next->Z() - CurrNode->Z(); dz = CurrNode->Next->_f_Z() - CurrNode->_f_Z();
} }
else if (Time > 0.f) else if (Time > 0.f)
{ // spline { // spline
@ -517,11 +517,11 @@ bool AActorMover::Interpolate ()
if (Super::Interpolate ()) if (Super::Interpolate ())
{ {
fixed_t savedz = tracer->Z(); fixed_t savedz = tracer->_f_Z();
tracer->SetZ(Z()); tracer->_f_SetZ(_f_Z());
if (!P_TryMove (tracer, X(), Y(), true)) if (!P_TryMove (tracer, _f_X(), _f_Y(), true))
{ {
tracer->SetZ(savedz); tracer->_f_SetZ(savedz);
return false; return false;
} }
@ -637,9 +637,9 @@ bool AMovingCamera::Interpolate ()
if (args[2] & 4) if (args[2] & 4)
{ // Also aim camera's pitch; use floats for precision { // Also aim camera's pitch; use floats for precision
double dx = FIXED2DBL(X() - tracer->X()); double dx = FIXED2DBL(_f_X() - tracer->_f_X());
double dy = FIXED2DBL(Y() - tracer->Y()); double dy = FIXED2DBL(_f_Y() - tracer->_f_Y());
double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2); double dz = FIXED2DBL(_f_Z() - tracer->_f_Z() - tracer->height/2);
double dist = g_sqrt (dx*dx + dy*dy); double dist = g_sqrt (dx*dx + dy*dy);
Angles.Pitch = dist != 0.f ? VecToAngle(dist, dz) : 0.; Angles.Pitch = dist != 0.f ? VecToAngle(dist, dz) : 0.;
} }

View file

@ -421,12 +421,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
self->UnlinkFromWorld(); self->UnlinkFromWorld();
self->SetXY(_x, _y); self->SetXY(_x, _y);
self->LinkToWorld(true); self->LinkToWorld(true);
self->SetZ(self->Sector->floorplane.ZatPoint(_x, _y)); self->_f_SetZ(self->Sector->floorplane.ZatPoint(_x, _y));
P_FindFloorCeiling(self, FFCF_ONLYSPAWNPOS | FFCF_NOPORTALS); // no portal checks here so that things get spawned in this sector. P_FindFloorCeiling(self, FFCF_ONLYSPAWNPOS | FFCF_NOPORTALS); // no portal checks here so that things get spawned in this sector.
if (self->flags & MF_SPAWNCEILING) if (self->flags & MF_SPAWNCEILING)
{ {
self->SetZ(self->ceilingz - self->height - self->SpawnPoint[2]); self->_f_SetZ(self->ceilingz - self->height - self->SpawnPoint[2]);
} }
else if (self->flags2 & MF2_SPAWNFLOAT) else if (self->flags2 & MF2_SPAWNFLOAT)
{ {
@ -434,27 +434,27 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
if (space > 48*FRACUNIT) if (space > 48*FRACUNIT)
{ {
space -= 40*FRACUNIT; space -= 40*FRACUNIT;
self->SetZ(((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT); self->_f_SetZ(((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT);
} }
else else
{ {
self->SetZ(self->floorz); self->_f_SetZ(self->floorz);
} }
} }
else else
{ {
self->SetZ(self->SpawnPoint[2] + self->floorz); self->_f_SetZ(self->SpawnPoint[2] + self->floorz);
} }
// Redo floor/ceiling check, in case of 3D floors and portals // Redo floor/ceiling check, in case of 3D floors and portals
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT); P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
if (self->Z() < self->floorz) if (self->_f_Z() < self->floorz)
{ // Do not reappear under the floor, even if that's where we were for the { // Do not reappear under the floor, even if that's where we were for the
// initial spawn. // initial spawn.
self->SetZ(self->floorz); self->_f_SetZ(self->floorz);
} }
if ((self->flags & MF_SOLID) && (self->Top() > self->ceilingz)) if ((self->flags & MF_SOLID) && (self->_f_Top() > self->ceilingz))
{ // Do the same for the ceiling. { // Do the same for the ceiling.
self->SetZ(self->ceilingz - self->height); self->_f_SetZ(self->ceilingz - self->height);
} }
// Do not interpolate from the position the actor was at when it was // Do not interpolate from the position the actor was at when it was
// picked up, in case that is different from where it is now. // picked up, in case that is different from where it is now.
@ -790,7 +790,7 @@ AInventory *AInventory::CreateTossable ()
flags &= ~(MF_SPECIAL|MF_SOLID); flags &= ~(MF_SPECIAL|MF_SOLID);
return this; return this;
} }
copy = static_cast<AInventory *>(Spawn (GetClass(), Owner->Pos(), NO_REPLACE)); copy = static_cast<AInventory *>(Spawn (GetClass(), Owner->_f_Pos(), NO_REPLACE));
if (copy != NULL) if (copy != NULL)
{ {
copy->MaxAmount = MaxAmount; copy->MaxAmount = MaxAmount;
@ -902,7 +902,7 @@ void AInventory::ModifyDamage (int damage, FName damageType, int &newdamage, boo
// //
//=========================================================================== //===========================================================================
fixed_t AInventory::GetSpeedFactor () double AInventory::GetSpeedFactor ()
{ {
if (Inventory != NULL) if (Inventory != NULL)
{ {
@ -910,7 +910,7 @@ fixed_t AInventory::GetSpeedFactor ()
} }
else else
{ {
return FRACUNIT; return 1.;
} }
} }
@ -1354,7 +1354,7 @@ bool AInventory::DoRespawn ()
if (spot != NULL) if (spot != NULL)
{ {
SetOrigin (spot->Pos(), false); SetOrigin (spot->Pos(), false);
SetZ(floorz); _f_SetZ(floorz);
} }
} }
return true; return true;

View file

@ -207,7 +207,7 @@ public:
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage); virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive); virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive);
virtual fixed_t GetSpeedFactor(); virtual double GetSpeedFactor();
virtual bool GetNoTeleportFreeze(); virtual bool GetNoTeleportFreeze();
virtual int AlterWeaponSprite (visstyle_t *vis); virtual int AlterWeaponSprite (visstyle_t *vis);

View file

@ -133,25 +133,22 @@ void DEarthquake::Tick ()
dist = m_Spot->AproxDistance (victim, true); dist = m_Spot->AproxDistance (victim, true);
// Check if in damage radius // Check if in damage radius
if (dist < m_DamageRadius && victim->Z() <= victim->floorz) if (dist < m_DamageRadius && victim->_f_Z() <= victim->floorz)
{ {
if (pr_quake() < 50) if (pr_quake() < 50)
{ {
P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), NAME_None); P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), NAME_None);
} }
// Thrust player around // Thrust player around
angle_t an = victim->_f_angle() + ANGLE_1*pr_quake(); DAngle an = victim->Angles.Yaw + pr_quake();
if (m_IntensityX == m_IntensityY) if (m_IntensityX == m_IntensityY)
{ // Thrust in a circle { // Thrust in a circle
P_ThrustMobj (victim, an, m_IntensityX << (FRACBITS-1)); P_ThrustMobj (victim, an, m_IntensityX << (FRACBITS-1));
} }
else else
{ // Thrust in an ellipse { // Thrust in an ellipse
an >>= ANGLETOFINESHIFT; victim->Vel.X += FIXED2DBL(m_IntensityX) * an.Cos() * 0.5;
// So this is actually completely wrong, but it ought to be good victim->Vel.Y += FIXED2DBL(m_IntensityY) * an.Sin() * 0.5;
// enough. Otherwise, I'd have to use tangents and square roots.
victim->vel.x += FixedMul(m_IntensityX << (FRACBITS-1), finecosine[an]);
victim->vel.y += FixedMul(m_IntensityY << (FRACBITS-1), finesine[an]);
} }
} }
} }

View file

@ -114,7 +114,7 @@ class ARandomSpawner : public AActor
{ {
Species = cls->TypeName; Species = cls->TypeName;
AActor *defmobj = GetDefaultByType(cls); AActor *defmobj = GetDefaultByType(cls);
this->Speed = defmobj->Speed; this->Speed = defmobj->Speed;
this->flags |= (defmobj->flags & MF_MISSILE); this->flags |= (defmobj->flags & MF_MISSILE);
this->flags2 |= (defmobj->flags2 & MF2_SEEKERMISSILE); this->flags2 |= (defmobj->flags2 & MF2_SEEKERMISSILE);
this->flags4 |= (defmobj->flags4 & MF4_SPECTRAL); this->flags4 |= (defmobj->flags4 & MF4_SPECTRAL);
@ -151,7 +151,7 @@ class ARandomSpawner : public AActor
{ {
tracer = target->target; tracer = target->target;
} }
newmobj = P_SpawnMissileXYZ(Pos(), target, target->target, cls, false); newmobj = P_SpawnMissileXYZ(_f_Pos(), target, target->target, cls, false);
} }
else else
{ {
@ -176,9 +176,7 @@ class ARandomSpawner : public AActor
newmobj->SpawnFlags = SpawnFlags; newmobj->SpawnFlags = SpawnFlags;
newmobj->tid = tid; newmobj->tid = tid;
newmobj->AddToHash(); newmobj->AddToHash();
newmobj->vel.x = vel.x; newmobj->Vel = Vel;
newmobj->vel.y = vel.y;
newmobj->vel.z = vel.z;
newmobj->master = master; // For things such as DamageMaster/DamageChildren, transfer mastery. newmobj->master = master; // For things such as DamageMaster/DamageChildren, transfer mastery.
newmobj->target = target; newmobj->target = target;
newmobj->tracer = tracer; newmobj->tracer = tracer;
@ -190,7 +188,7 @@ class ARandomSpawner : public AActor
// Handle special altitude flags // Handle special altitude flags
if (newmobj->flags & MF_SPAWNCEILING) if (newmobj->flags & MF_SPAWNCEILING)
{ {
newmobj->SetZ(newmobj->ceilingz - newmobj->height - SpawnPoint[2]); newmobj->_f_SetZ(newmobj->ceilingz - newmobj->height - SpawnPoint[2]);
} }
else if (newmobj->flags2 & MF2_SPAWNFLOAT) else if (newmobj->flags2 & MF2_SPAWNFLOAT)
{ {
@ -198,9 +196,9 @@ class ARandomSpawner : public AActor
if (space > 48*FRACUNIT) if (space > 48*FRACUNIT)
{ {
space -= 40*FRACUNIT; space -= 40*FRACUNIT;
newmobj->SetZ(MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT); newmobj->_f_SetZ(MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT);
} }
newmobj->AddZ(SpawnPoint[2]); newmobj->_f_AddZ(SpawnPoint[2]);
} }
if (newmobj->flags & MF_MISSILE) if (newmobj->flags & MF_MISSILE)
P_CheckMissileSpawn(newmobj, 0); P_CheckMissileSpawn(newmobj, 0);

View file

@ -50,6 +50,6 @@ IMPLEMENT_CLASS (ASpark)
void ASpark::Activate (AActor *activator) void ASpark::Activate (AActor *activator)
{ {
Super::Activate (activator); Super::Activate (activator);
P_DrawSplash (args[0] ? args[0] : 32, X(), Y(), Z(), FLOAT2ANGLE(Angles.Yaw.Degrees), 1); P_DrawSplash (args[0] ? args[0] : 32, _f_X(), _f_Y(), _f_Z(), FLOAT2ANGLE(Angles.Yaw.Degrees), 1);
S_Sound (this, CHAN_AUTO, "world/spark", 1, ATTN_STATIC); S_Sound (this, CHAN_AUTO, "world/spark", 1, ATTN_STATIC);
} }

View file

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

View file

@ -338,7 +338,6 @@ bool FMugShot::SetState(const char *state_name, bool wait_till_done, bool reset)
CVAR(Bool,st_oldouch,false,CVAR_ARCHIVE) CVAR(Bool,st_oldouch,false,CVAR_ARCHIVE)
int FMugShot::UpdateState(player_t *player, StateFlags stateflags) int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
{ {
int i;
FString full_state_name; FString full_state_name;
if (player->health > 0) if (player->health > 0)

View file

@ -828,9 +828,9 @@ static void DrawCoordinates(player_t * CPlayer)
if (!map_point_coordinates || !automapactive) if (!map_point_coordinates || !automapactive)
{ {
x=CPlayer->mo->X(); x=CPlayer->mo->_f_X();
y=CPlayer->mo->Y(); y=CPlayer->mo->_f_Y();
z=CPlayer->mo->Z(); z=CPlayer->mo->_f_Z();
} }
else else
{ {

View file

@ -1286,7 +1286,7 @@ void DBaseStatusBar::Draw (EHudState state)
y -= height * 2; y -= height * 2;
} }
fixedvec3 pos = CPlayer->mo->Pos(); fixedvec3 pos = CPlayer->mo->_f_Pos();
for (i = 2, value = &pos.z; i >= 0; y -= height, --value, --i) for (i = 2, value = &pos.z; i >= 0; y -= height, --value, --i)
{ {
mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS); mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS);

View file

@ -29,12 +29,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall)
int t; int t;
t = pr_spectrechunk() & 15; t = pr_spectrechunk() & 15;
foo->vel.x = (t - (pr_spectrechunk() & 7)) << FRACBITS; foo->Vel.X = (t - (pr_spectrechunk() & 7));
t = pr_spectrechunk() & 15; t = pr_spectrechunk() & 15;
foo->vel.y = (t - (pr_spectrechunk() & 7)) << FRACBITS; foo->Vel.Y = (t - (pr_spectrechunk() & 7));
foo->vel.z = (pr_spectrechunk() & 15) << FRACBITS; foo->Vel.Z = (pr_spectrechunk() & 15);
} }
return 0; return 0;
} }
@ -50,12 +50,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge)
int t; int t;
t = pr_spectrechunk() & 7; t = pr_spectrechunk() & 7;
foo->vel.x = (t - (pr_spectrechunk() & 15)) << FRACBITS; foo->Vel.X = (t - (pr_spectrechunk() & 15));
t = pr_spectrechunk() & 7; t = pr_spectrechunk() & 7;
foo->vel.y = (t - (pr_spectrechunk() & 15)) << FRACBITS; foo->Vel.Y = (t - (pr_spectrechunk() & 15));
foo->vel.z = (pr_spectrechunk() & 7) << FRACBITS; foo->Vel.Z = (pr_spectrechunk() & 7);
} }
return 0; return 0;
} }
@ -69,7 +69,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack)
AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE); AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE);
foo->vel.z = -12*FRACUNIT; foo->Vel.Z = -12;
foo->target = self; foo->target = self;
foo->FriendPlayer = 0; foo->FriendPlayer = 0;
foo->tracer = self->target; foo->tracer = self->target;

View file

@ -29,18 +29,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
{ {
A_FaceTarget (self); A_FaceTarget (self);
self->Angles.Yaw -= 180./16; self->Angles.Yaw -= 180./16;
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile")); P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
} }
else else
{ {
if (P_CheckMissileRange (self)) if (P_CheckMissileRange (self))
{ {
A_FaceTarget (self); A_FaceTarget (self);
P_SpawnMissileZAimed (self, self->Z() + 56*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile")); P_SpawnMissileZAimed (self, self->_f_Z() + 56*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw -= 45./32; self->Angles.Yaw -= 45./32;
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile")); P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw += 45./16; self->Angles.Yaw += 45./16;
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile")); P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw -= 45./16; self->Angles.Yaw -= 45./16;
self->reactiontime += 15; self->reactiontime += 15;
} }
@ -54,10 +54,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->Angles.Yaw += 90./16; self->Angles.Yaw += 90./16;
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile")); AActor *misl = P_SpawnMissileZAimed (self, self->_f_Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
if (misl != NULL) if (misl != NULL)
{ {
misl->vel.z += FRACUNIT; misl->Vel.Z += 1;
} }
return 0; return 0;
} }
@ -67,10 +67,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->Angles.Yaw -= 90./16; self->Angles.Yaw -= 90./16;
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile")); AActor *misl = P_SpawnMissileZAimed (self, self->_f_Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
if (misl != NULL) if (misl != NULL)
{ {
misl->vel.z += FRACUNIT; misl->Vel.Z += 1;
} }
return 0; return 0;
} }

View file

@ -83,7 +83,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity)
{ {
entity->Angles.Yaw = self->Angles.Yaw; entity->Angles.Yaw = self->Angles.Yaw;
entity->CopyFriendliness(self, true); entity->CopyFriendliness(self, true);
entity->vel.z = 5*FRACUNIT; entity->Vel.Z = 5;
entity->tracer = self; entity->tracer = self;
} }
return 0; return 0;
@ -94,39 +94,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *second; AActor *second;
fixed_t secondRadius = GetDefaultByName("EntitySecond")->radius * 2; double secondRadius = FIXED2DBL(GetDefaultByName("EntitySecond")->radius * 2);
angle_t an;
static const double turns[3] = { 0, 90, -90 };
const double velmul[3] = { 4.8828125f, secondRadius*4, secondRadius*4 };
AActor *spot = self->tracer; AActor *spot = self->tracer;
if (spot == NULL) spot = self; if (spot == NULL) spot = self;
fixedvec3 pos = spot->Vec3Angle(secondRadius, self->_f_angle(), self->tracer? 70*FRACUNIT : 0); for (int i = 0; i < 3; i++)
{
an = self->_f_angle() >> ANGLETOFINESHIFT; DAngle an = self->Angles.Yaw + turns[i];
second = Spawn("EntitySecond", pos, ALLOW_REPLACE); DVector3 pos = spot->Vec3Angle(secondRadius, an, self->tracer ? 70. : 0.);
second->CopyFriendliness(self, true);
//second->target = self->target;
A_FaceTarget (second);
an = second->_f_angle() >> ANGLETOFINESHIFT;
second->vel.x += FixedMul (finecosine[an], 320000);
second->vel.y += FixedMul (finesine[an], 320000);
pos = spot->Vec3Angle(secondRadius, self->_f_angle() + ANGLE_90, self->tracer? 70*FRACUNIT : 0); second = Spawn("EntitySecond", pos, ALLOW_REPLACE);
an = (self->_f_angle() + ANGLE_90) >> ANGLETOFINESHIFT; second->CopyFriendliness(self, true);
second = Spawn("EntitySecond", pos, ALLOW_REPLACE); A_FaceTarget(second);
second->CopyFriendliness(self, true); second->VelFromAngle(an, velmul[i]);
//second->target = self->target; }
second->vel.x = FixedMul (secondRadius, finecosine[an]) << 2;
second->vel.y = FixedMul (secondRadius, finesine[an]) << 2;
A_FaceTarget (second);
pos = spot->Vec3Angle(secondRadius, self->_f_angle() - ANGLE_90, self->tracer? 70*FRACUNIT : 0);
an = (self->_f_angle() - ANGLE_90) >> ANGLETOFINESHIFT;
second = Spawn("EntitySecond", pos, ALLOW_REPLACE);
second->CopyFriendliness(self, true);
//second->target = self->target;
second->vel.x = FixedMul (secondRadius, finecosine[an]) << 2;
second->vel.y = FixedMul (secondRadius, finesine[an]) << 2;
A_FaceTarget (second);
return 0; return 0;
} }

View file

@ -42,7 +42,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide)
} }
if (self->target->Z() != self->Z()) if (self->target->Z() != self->Z())
{ {
if (self->Top() + 54*FRACUNIT < self->ceilingz) if (self->_f_Top() + 54*FRACUNIT < self->ceilingz)
{ {
self->SetState (self->FindState("Jump")); self->SetState (self->FindState("Jump"));
} }
@ -61,20 +61,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
A_FaceTarget (self); A_FaceTarget (self);
self->AddZ(32*FRACUNIT); self->_f_AddZ(32*FRACUNIT);
self->Angles.Yaw -= 45./32; self->Angles.Yaw -= 45./32;
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot")); proj = P_SpawnMissileZAimed (self, self->_f_Z(), self->target, PClass::FindActor("InquisitorShot"));
if (proj != NULL) if (proj != NULL)
{ {
proj->vel.z += 9*FRACUNIT; proj->Vel.Z += 9;
} }
self->Angles.Yaw += 45./16; self->Angles.Yaw += 45./16;
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot")); proj = P_SpawnMissileZAimed (self, self->_f_Z(), self->target, PClass::FindActor("InquisitorShot"));
if (proj != NULL) if (proj != NULL)
{ {
proj->vel.z += 16*FRACUNIT; proj->Vel.Z += 16;
} }
self->AddZ(-32*FRACUNIT); self->_f_AddZ(-32*FRACUNIT);
return 0; return 0;
} }
@ -82,27 +82,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
fixed_t dist; double dist;
fixed_t speed; double speed;
angle_t an;
if (self->target == NULL) if (self->target == NULL)
return 0; return 0;
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM); S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
self->AddZ(64*FRACUNIT); self->_f_AddZ(64*FRACUNIT);
A_FaceTarget (self); A_FaceTarget (self);
an = self->_f_angle() >> ANGLETOFINESHIFT; speed = self->Speed * (2./3);
speed = self->Speed * 2/3; self->VelFromAngle(speed);
self->vel.x += FixedMul (speed, finecosine[an]); dist = self->DistanceBySpeed(self->target, speed);
self->vel.y += FixedMul (speed, finesine[an]); self->Vel.Z = (self->target->Z() - self->Z()) / dist;
dist = self->AproxDistance (self->target);
dist /= speed;
if (dist < 1)
{
dist = 1;
}
self->vel.z = (self->target->Z() - self->Z()) / dist;
self->reactiontime = 60; self->reactiontime = 60;
self->flags |= MF_NOGRAVITY; self->flags |= MF_NOGRAVITY;
return 0; return 0;
@ -114,9 +106,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
self->reactiontime--; self->reactiontime--;
if (self->reactiontime < 0 || if (self->reactiontime < 0 ||
self->vel.x == 0 || self->Vel.X == 0 ||
self->vel.y == 0 || self->Vel.Y == 0 ||
self->Z() <= self->floorz) self->_f_Z() <= self->floorz)
{ {
self->SetState (self->SeeState); self->SetState (self->SeeState);
self->reactiontime = 0; self->reactiontime = 0;
@ -138,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.); foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.);
foo->VelFromAngle(foo->Speed / 8); foo->VelFromAngle(foo->Speed / 8);
foo->vel.z = pr_inq() << 10; foo->Vel.Z = pr_inq() / 64.;
return 0; return 0;
} }

View file

@ -24,15 +24,9 @@ int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype)
if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST)) if (victim != NULL && target != NULL && !(victim->flags7 & MF7_DONTTHRUST))
{ {
fixedvec3 fixthrust = victim->Vec3To(target); DVector3 thrust = victim->Vec3To(target);
DVector3 thrust(fixthrust.x, fixthrust.y, fixthrust.z); thrust.MakeResize(255. * 50 / MAX<int>(victim->Mass, 1));
victim->Vel += thrust;
thrust.MakeUnit();
thrust *= double((255*50*FRACUNIT) / (victim->Mass ? victim->Mass : 1));
victim->vel.x += fixed_t(thrust.X);
victim->vel.y += fixed_t(thrust.Y);
victim->vel.z += fixed_t(thrust.Z);
} }
return damage; return damage;
} }
@ -43,7 +37,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain)
S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM);
Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE); Spawn("LoreShot2", self->Pos(), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-(self->vel.x >> 1), -(self->vel.y >> 1), -(self->vel.z >> 1)), ALLOW_REPLACE); Spawn("LoreShot2", self->Vec3Offset(-(self->_f_velx() >> 1), -(self->_f_vely() >> 1), -(self->_f_velz() >> 1)), ALLOW_REPLACE);
Spawn("LoreShot2", self->Vec3Offset(-self->vel.x, -self->vel.y, -self->vel.z), ALLOW_REPLACE); Spawn("LoreShot2", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), -self->_f_velz()), ALLOW_REPLACE);
return 0; return 0;
} }

View file

@ -109,7 +109,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning)
if (self->target == NULL) if (self->target == NULL)
return 0; return 0;
spot = Spawn("SpectralLightningSpot", self->target->X(), self->target->Y(), self->target->floorz, ALLOW_REPLACE); spot = Spawn("SpectralLightningSpot", self->target->_f_X(), self->target->_f_Y(), self->target->floorz, ALLOW_REPLACE);
if (spot != NULL) if (spot != NULL)
{ {
spot->threshold = 25; spot->threshold = 25;
@ -135,7 +135,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase)
{ {
foo->Angles.Yaw = self->Angles.Yaw + 180. + pr_prog.Random2() * (360. / 1024.); foo->Angles.Yaw = self->Angles.Yaw + 180. + pr_prog.Random2() * (360. / 1024.);
foo->VelFromAngle(); foo->VelFromAngle();
foo->vel.z = pr_prog() << 9; foo->Vel.Z = pr_prog() / 128.;
} }
return 0; return 0;
} }

View file

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

View file

@ -17,7 +17,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
if (self->flags & MF_INFLOAT) if (self->flags & MF_INFLOAT)
{ {
self->vel.z = 0; self->Vel.Z = 0;
return 0; return 0;
} }
if (self->threshold != 0) if (self->threshold != 0)
@ -29,15 +29,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
{ {
minz = maxz; minz = maxz;
} }
if (minz < self->Z()) if (minz < self->_f_Z())
{ {
self->vel.z -= FRACUNIT; self->Vel.Z -= 1;
} }
else else
{ {
self->vel.z += FRACUNIT; self->Vel.Z += 1;
} }
self->reactiontime = (minz >= self->Z()) ? 4 : 0; self->reactiontime = (minz >= self->_f_Z()) ? 4 : 0;
return 0; return 0;
} }
@ -53,24 +53,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
return 0; return 0;
} }
missile = P_SpawnMissileZAimed (self, self->Z() + 32*FRACUNIT, self->target, PClass::FindActor("SentinelFX2")); missile = P_SpawnMissileZAimed (self, self->_f_Z() + 32*FRACUNIT, self->target, PClass::FindActor("SentinelFX2"));
if (missile != NULL && (missile->vel.x | missile->vel.y) != 0) if (missile != NULL && (missile->Vel.X != 0 || missile->Vel.Y != 0))
{ {
for (int i = 8; i > 1; --i) for (int i = 8; i > 1; --i)
{ {
trail = Spawn("SentinelFX1", trail = Spawn("SentinelFX1",
self->Vec3Angle(missile->radius*i, missile->_f_angle(), (missile->vel.z / 4 * i)), ALLOW_REPLACE); self->_f_Vec3Angle(missile->radius*i, missile->_f_angle(), (missile->_f_velz() / 4 * i)), ALLOW_REPLACE);
if (trail != NULL) if (trail != NULL)
{ {
trail->target = self; trail->target = self;
trail->vel.x = missile->vel.x; trail->Vel = missile->Vel;
trail->vel.y = missile->vel.y;
trail->vel.z = missile->vel.z;
P_CheckMissileSpawn (trail, self->radius); P_CheckMissileSpawn (trail, self->radius);
} }
} }
missile->AddZ(missile->vel.z >> 2); missile->_f_AddZ(missile->_f_velz() >> 2);
} }
return 0; return 0;
} }

View file

@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE); AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), 0), ALLOW_REPLACE);
foo->Angles.Yaw = self->Angles.Yaw; foo->Angles.Yaw = self->Angles.Yaw;
foo->FriendPlayer = self->FriendPlayer; foo->FriendPlayer = self->FriendPlayer;
@ -63,8 +63,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
if (self->threshold != 0) if (self->threshold != 0)
--self->threshold; --self->threshold;
self->vel.x += pr_zap5.Random2(3) << FRACBITS; self->Vel.X += pr_zap5.Random2(3);
self->vel.y += pr_zap5.Random2(3) << FRACBITS; self->Vel.Y += pr_zap5.Random2(3);
fixedvec2 pos = self->Vec2Offset( fixedvec2 pos = self->Vec2Offset(
pr_zap5.Random2(3) * FRACUNIT * 50, pr_zap5.Random2(3) * FRACUNIT * 50,
@ -74,13 +74,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
PClass::FindActor(NAME_SpectralLightningV1), pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE); PClass::FindActor(NAME_SpectralLightningV1), pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE);
flash->target = self->target; flash->target = self->target;
flash->vel.z = -18*FRACUNIT; flash->Vel.Z = -18*FRACUNIT;
flash->FriendPlayer = self->FriendPlayer; flash->FriendPlayer = self->FriendPlayer;
flash = Spawn(NAME_SpectralLightningV2, self->X(), self->Y(), ONCEILINGZ, ALLOW_REPLACE); flash = Spawn(NAME_SpectralLightningV2, self->_f_X(), self->_f_Y(), ONCEILINGZ, ALLOW_REPLACE);
flash->target = self->target; flash->target = self->target;
flash->vel.z = -18*FRACUNIT; flash->Vel.Z = -18 * FRACUNIT;
flash->FriendPlayer = self->FriendPlayer; flash->FriendPlayer = self->FriendPlayer;
return 0; return 0;
} }
@ -123,7 +123,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{ {
// change slope // change slope
dist = self->AproxDistance (dest) / self->Speed; dist = self->AproxDistance (dest) / self->_f_speed();
if (dist < 1) if (dist < 1)
{ {
@ -131,19 +131,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
} }
if (dest->height >= 56*FRACUNIT) if (dest->height >= 56*FRACUNIT)
{ {
slope = (dest->Z()+40*FRACUNIT - self->Z()) / dist; slope = (dest->_f_Z()+40*FRACUNIT - self->_f_Z()) / dist;
} }
else else
{ {
slope = (dest->Z() + self->height*2/3 - self->Z()) / dist; slope = (dest->_f_Z() + self->height*2/3 - self->_f_Z()) / dist;
} }
if (slope < self->vel.z) if (slope < self->_f_velz())
{ {
self->vel.z -= FRACUNIT/8; self->Vel.Z -= 1 / 8.;
} }
else else
{ {
self->vel.z += FRACUNIT/8; self->Vel.Z += 1 / 8.;
} }
} }
return 0; return 0;

View file

@ -19,7 +19,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_StalkerChaseDecide)
{ {
self->SetState (self->FindState("SeeFloor")); self->SetState (self->FindState("SeeFloor"));
} }
else if (self->ceilingz > self->Top()) else if (self->ceilingz > self->_f_Top())
{ {
self->SetState (self->FindState("Drop")); self->SetState (self->FindState("Drop"));
} }

View file

@ -600,7 +600,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossGib)
const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat"; const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat";
AActor *gib = Spawn (gibtype, self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); AActor *gib = Spawn (gibtype, self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
int speed;
if (gib == NULL) if (gib == NULL)
{ {
@ -608,9 +607,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossGib)
} }
gib->Angles.Yaw = pr_gibtosser() * (360 / 256.f); gib->Angles.Yaw = pr_gibtosser() * (360 / 256.f);
speed = pr_gibtosser() & 15; gib->VelFromAngle(pr_gibtosser() & 15);
gib->VelFromAngle(speed); gib->Vel.Z = pr_gibtosser() & 15;
gib->vel.z = (pr_gibtosser() & 15) << FRACBITS;
return 0; return 0;
} }
@ -656,7 +654,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
sector_t *sec = self->Sector; sector_t *sec = self->Sector;
if (self->Z() == sec->floorplane.ZatPoint(self) && sec->PortalBlocksMovement(sector_t::floor)) if (self->_f_Z() == sec->floorplane.ZatPoint(self) && sec->PortalBlocksMovement(sector_t::floor))
{ {
if (sec->special == Damage_InstantDeath) if (sec->special == Damage_InstantDeath)
{ {
@ -665,11 +663,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
else if (sec->special == Scroll_StrifeCurrent) else if (sec->special == Scroll_StrifeCurrent)
{ {
int anglespeed = tagManager.GetFirstSectorTag(sec) - 100; int anglespeed = tagManager.GetFirstSectorTag(sec) - 100;
fixed_t speed = (anglespeed % 10) << (FRACBITS - 4); double speed = (anglespeed % 10) / 16.;
angle_t finean = (anglespeed / 10) << (32-3); DAngle an = (anglespeed / 10) * (360 / 8.);
finean >>= ANGLETOFINESHIFT; self->VelFromAngle(an, speed);
self->vel.x += FixedMul (speed, finecosine[finean]);
self->vel.y += FixedMul (speed, finesine[finean]);
} }
} }
return 0; return 0;
@ -719,7 +715,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DropFire)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *drop = Spawn("FireDroplet", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); AActor *drop = Spawn("FireDroplet", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
drop->vel.z = -FRACUNIT; drop->Vel.Z = -FRACUNIT;
P_RadiusAttack (self, self, 64, 64, NAME_Fire, 0); P_RadiusAttack (self, self, 64, 64, NAME_Fire, 0);
return 0; return 0;
} }

View file

@ -379,11 +379,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight)
AActor *trail; AActor *trail;
S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM);
P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->Pos(), self->_f_angle() - ANGLE_180, 2, PF_HITTHING); P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->_f_Pos(), self->_f_angle() - ANGLE_180, 2, PF_HITTHING);
trail = Spawn("RocketTrail", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE); trail = Spawn("RocketTrail", self->Vec3Offset(-self->_f_velx(), -self->_f_vely(), 0), ALLOW_REPLACE);
if (trail != NULL) if (trail != NULL)
{ {
trail->vel.z = FRACUNIT; trail->Vel.Z = 1;
} }
return 0; return 0;
} }
@ -401,7 +401,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlameDie)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->flags |= MF_NOGRAVITY; self->flags |= MF_NOGRAVITY;
self->vel.z = (pr_flamedie() & 3) << FRACBITS; self->Vel.Z = pr_flamedie() & 3;
return 0; return 0;
} }
@ -432,7 +432,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireFlamer)
self = P_SpawnPlayerMissile (self, PClass::FindActor("FlameMissile")); self = P_SpawnPlayerMissile (self, PClass::FindActor("FlameMissile"));
if (self != NULL) if (self != NULL)
{ {
self->vel.z += 5*FRACUNIT; self->Vel.Z += 5;
} }
return 0; return 0;
} }
@ -551,10 +551,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
self->Angles.Yaw += 180.; self->Angles.Yaw += 180.;
// If the torpedo hit the ceiling, it should still spawn the wave // If the torpedo hit the ceiling, it should still spawn the wave
savedz = self->Z(); savedz = self->_f_Z();
if (wavedef && self->ceilingz - self->Z() < wavedef->height) if (wavedef && self->ceilingz - self->_f_Z() < wavedef->height)
{ {
self->SetZ(self->ceilingz - wavedef->height); self->_f_SetZ(self->ceilingz - wavedef->height);
} }
for (int i = 0; i < 80; ++i) for (int i = 0; i < 80; ++i)
@ -562,13 +562,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
self->Angles.Yaw += 4.5; self->Angles.Yaw += 4.5;
P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target); P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target);
} }
self->SetZ(savedz); self->_f_SetZ(savedz);
return 0; return 0;
} }
AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target) AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
{ {
AActor *other = Spawn (type, source->Pos(), ALLOW_REPLACE); AActor *other = Spawn (type, source->_f_Pos(), ALLOW_REPLACE);
if (other == NULL) if (other == NULL)
{ {
@ -594,7 +594,7 @@ AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
if (P_CheckMissileSpawn (other, source->radius)) if (P_CheckMissileSpawn (other, source->radius))
{ {
DAngle pitch = P_AimLineAttack (source, source->Angles.Yaw, 1024.); DAngle pitch = P_AimLineAttack (source, source->Angles.Yaw, 1024.);
other->vel.z = fixed_t(-other->Speed * pitch.Cos()); other->Vel.Z = -other->Speed * pitch.Cos();
return other; return other;
} }
return NULL; return NULL;
@ -630,9 +630,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
self->vel.z -= 8*FRACUNIT; self->Vel.Z -= 8;
self->vel.x += (pr_phburn.Random2 (3)) << FRACBITS; self->Vel.X += (pr_phburn.Random2 (3));
self->vel.y += (pr_phburn.Random2 (3)) << FRACBITS; self->Vel.Y += (pr_phburn.Random2 (3));
S_Sound (self, CHAN_VOICE, "world/largefire", 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, "world/largefire", 1, ATTN_NORM);
// Only the main fire spawns more. // Only the main fire spawns more.
@ -662,20 +662,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
sector_t * sector = P_PointInSector(pos.x, pos.y); sector_t * sector = P_PointInSector(pos.x, pos.y);
// The sector's floor is too high so spawn the flame elsewhere. // The sector's floor is too high so spawn the flame elsewhere.
if (sector->floorplane.ZatPoint(pos.x, pos.y) > self->Z() + self->MaxStepHeight) if (sector->floorplane.ZatPoint(pos.x, pos.y) > self->_f_Z() + self->MaxStepHeight)
{ {
pos.x = self->X(); pos.x = self->_f_X();
pos.y = self->Y(); pos.y = self->_f_Y();
} }
AActor *drop = Spawn<APhosphorousFire> ( AActor *drop = Spawn<APhosphorousFire> (
pos.x, pos.y, pos.x, pos.y,
self->Z() + 4*FRACUNIT, ALLOW_REPLACE); self->_f_Z() + 4*FRACUNIT, ALLOW_REPLACE);
if (drop != NULL) if (drop != NULL)
{ {
drop->vel.x = self->vel.x + ((pr_phburn.Random2 (7)) << FRACBITS); drop->Vel.X = self->Vel.X + pr_phburn.Random2 (7);
drop->vel.y = self->vel.y + ((pr_phburn.Random2 (7)) << FRACBITS); drop->Vel.Y = self->Vel.Y + pr_phburn.Random2 (7);
drop->vel.z = self->vel.z - FRACUNIT; drop->Vel.Z = self->Vel.Z - 1;
drop->reactiontime = (pr_phburn() & 3) + 2; drop->reactiontime = (pr_phburn() & 3) + 2;
drop->flags |= MF_DROPPED; drop->flags |= MF_DROPPED;
} }
@ -715,9 +715,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
if (grenadetype != NULL) if (grenadetype != NULL)
{ {
self->AddZ(32*FRACUNIT); self->_f_AddZ(32*FRACUNIT);
grenade = P_SpawnSubMissile (self, grenadetype, self); grenade = P_SpawnSubMissile (self, grenadetype, self);
self->AddZ(-32*FRACUNIT); self->_f_AddZ(-32*FRACUNIT);
if (grenade == NULL) if (grenade == NULL)
return 0; return 0;
@ -726,7 +726,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
S_Sound (grenade, CHAN_VOICE, grenade->SeeSound, 1, ATTN_NORM); S_Sound (grenade, CHAN_VOICE, grenade->SeeSound, 1, ATTN_NORM);
} }
grenade->vel.z = FixedMul (finetangent[FINEANGLES/4-(self->_f_pitch()>>ANGLETOFINESHIFT)], grenade->Speed) + 8*FRACUNIT; grenade->Vel.Z = (-self->Angles.Pitch.TanClamped()) * grenade->Speed + 8;
fixedvec2 offset; fixedvec2 offset;
@ -741,7 +741,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
offset.y += FixedMul (finesine[an], 15*FRACUNIT); offset.y += FixedMul (finesine[an], 15*FRACUNIT);
fixedvec2 newpos = grenade->Vec2Offset(offset.x, offset.y); fixedvec2 newpos = grenade->Vec2Offset(offset.x, offset.y);
grenade->SetOrigin(newpos.x, newpos.y, grenade->Z(), false); grenade->SetOrigin(newpos.x, newpos.y, grenade->_f_Z(), false);
} }
return 0; return 0;
} }
@ -987,7 +987,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
P_BulletSlope (self, &t, ALF_PORTALRESTRICT); P_BulletSlope (self, &t, ALF_PORTALRESTRICT);
if (t.linetarget != NULL) if (t.linetarget != NULL)
{ {
spot = Spawn("SpectralLightningSpot", t.linetarget->X(), t.linetarget->Y(), t.linetarget->floorz, ALLOW_REPLACE); spot = Spawn("SpectralLightningSpot", t.linetarget->_f_X(), t.linetarget->_f_Y(), t.linetarget->floorz, ALLOW_REPLACE);
if (spot != NULL) if (spot != NULL)
{ {
spot->tracer = t.linetarget; spot->tracer = t.linetarget;
@ -995,11 +995,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
} }
else else
{ {
spot = Spawn("SpectralLightningSpot", self->Pos(), ALLOW_REPLACE); spot = Spawn("SpectralLightningSpot", self->_f_Pos(), ALLOW_REPLACE);
if (spot != NULL) if (spot != NULL)
{ {
spot->vel.x += 28 * finecosine[self->_f_angle() >> ANGLETOFINESHIFT]; spot->VelFromAngle(self->Angles.Yaw, 28.);
spot->vel.y += 28 * finesine[self->_f_angle() >> ANGLETOFINESHIFT];
} }
} }
if (spot != NULL) if (spot != NULL)
@ -1059,7 +1058,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3)
spot = P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall1"), self); spot = P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall1"), self);
if (spot != NULL) if (spot != NULL)
{ {
spot->SetZ(self->Z() + 32*FRACUNIT); spot->_f_SetZ(self->_f_Z() + 32*FRACUNIT);
} }
} }
self->Angles.Yaw -= 90.; self->Angles.Yaw -= 90.;
@ -1100,8 +1099,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4)
spot = P_SpawnPlayerMissile (self, PClass::FindActor("SpectralLightningBigV1")); spot = P_SpawnPlayerMissile (self, PClass::FindActor("SpectralLightningBigV1"));
if (spot != NULL) if (spot != NULL)
{ {
spot->vel.x += FixedMul (spot->Speed, finecosine[self->_f_angle() >> ANGLETOFINESHIFT]); spot->VelFromAngle(self->Angles.Yaw, spot->Speed);
spot->vel.y += FixedMul (spot->Speed, finesine[self->_f_angle() >> ANGLETOFINESHIFT]);
} }
} }
return 0; return 0;

View file

@ -112,9 +112,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
if (foo != NULL) if (foo != NULL)
{ {
int t = pr_lightout() & 15; int t = pr_lightout() & 15;
foo->vel.x = (t - (pr_lightout() & 7)) << FRACBITS; foo->Vel.X = t - (pr_lightout() & 7);
foo->vel.y = (pr_lightout.Random2() & 7) << FRACBITS; foo->Vel.Y = pr_lightout.Random2() & 7;
foo->vel.z = (7 + (pr_lightout() & 3)) << FRACBITS; foo->Vel.Z = 7 + (pr_lightout() & 3);
} }
} }
return 0; return 0;

View file

@ -229,7 +229,7 @@ PClassActor::PClassActor()
GibHealth = INT_MIN; GibHealth = INT_MIN;
WoundHealth = 6; WoundHealth = 6;
PoisonDamage = 0; PoisonDamage = 0;
FastSpeed = FIXED_MIN; FastSpeed = -1.;
RDFactor = FRACUNIT; RDFactor = FRACUNIT;
CameraHeight = FIXED_MIN; CameraHeight = FIXED_MIN;

View file

@ -248,7 +248,7 @@ public:
int GibHealth; // Negative health below which this monster dies an extreme death int GibHealth; // Negative health below which this monster dies an extreme death
int WoundHealth; // Health needed to enter wound state int WoundHealth; // Health needed to enter wound state
int PoisonDamage; // Amount of poison damage int PoisonDamage; // Amount of poison damage
fixed_t FastSpeed; // Speed in fast mode double FastSpeed; // speed in fast mode
fixed_t RDFactor; // Radius damage factor fixed_t RDFactor; // Radius damage factor
fixed_t CameraHeight; // Height of camera when used as such fixed_t CameraHeight; // Height of camera when used as such
FSoundID HowlSound; // Sound being played when electrocuted or poisoned FSoundID HowlSound; // Sound being played when electrocuted or poisoned

View file

@ -138,7 +138,7 @@ void cht_DoCheat (player_t *player, int cheat)
player->cheats &= ~CF_NOCLIP; player->cheats &= ~CF_NOCLIP;
msg = GStrings("STSTR_NCOFF"); msg = GStrings("STSTR_NCOFF");
} }
if (player->mo->vel.x == 0) player->mo->vel.x = 1; // force some lateral movement so that internal variables are up to date if (player->mo->Vel.X == 0) player->mo->Vel.X = MinVel; // force some lateral movement so that internal variables are up to date
break; break;
case CHT_NOVELOCITY: case CHT_NOVELOCITY:
@ -583,7 +583,7 @@ void GiveSpawner (player_t *player, PClassInventory *type, int amount)
} }
AInventory *item = static_cast<AInventory *> AInventory *item = static_cast<AInventory *>
(Spawn (type, player->mo->X(), player->mo->Y(), player->mo->Z(), NO_REPLACE)); (Spawn (type, player->mo->Pos(), NO_REPLACE));
if (item != NULL) if (item != NULL)
{ {
if (amount > 0) if (amount > 0)

View file

@ -53,7 +53,7 @@ __forceinline double FFastTrig::sinq1(unsigned bangle)
{ {
unsigned int index = bangle >> BITSHIFT; unsigned int index = bangle >> BITSHIFT;
if ((bangle &= (REMAINDER - 1)) == 0) // This is to avoid precision problems at 180° if ((bangle &= (REMAINDER)) == 0) // This is to avoid precision problems at 180°
{ {
return double(sinetable[index]); return double(sinetable[index]);
} }

View file

@ -337,13 +337,13 @@ void P_PlayerOnSpecial3DFloor(player_t* player)
if(rover->flags & FF_SOLID) if(rover->flags & FF_SOLID)
{ {
// Player must be on top of the floor to be affected... // Player must be on top of the floor to be affected...
if(player->mo->Z() != rover->top.plane->ZatPoint(player->mo)) continue; if(player->mo->_f_Z() != rover->top.plane->ZatPoint(player->mo)) continue;
} }
else else
{ {
//Water and DEATH FOG!!! heh //Water and DEATH FOG!!! heh
if (player->mo->Z() > rover->top.plane->ZatPoint(player->mo) || if (player->mo->_f_Z() > rover->top.plane->ZatPoint(player->mo) ||
player->mo->Top() < rover->bottom.plane->ZatPoint(player->mo)) player->mo->_f_Top() < rover->bottom.plane->ZatPoint(player->mo))
continue; continue;
} }
@ -759,7 +759,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
{ {
fixed_t thingbot, thingtop; fixed_t thingbot, thingtop;
thingbot = thing->Z(); thingbot = thing->_f_Z();
thingtop = thingbot + (thing->height==0? 1:thing->height); thingtop = thingbot + (thing->height==0? 1:thing->height);
extsector_t::xfloor *xf[2] = {&linedef->frontsector->e->XFloor, &linedef->backsector->e->XFloor}; extsector_t::xfloor *xf[2] = {&linedef->frontsector->e->XFloor, &linedef->backsector->e->XFloor};
@ -803,7 +803,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
lowestceilingsec = j == 0 ? linedef->frontsector : linedef->backsector; lowestceilingsec = j == 0 ? linedef->frontsector : linedef->backsector;
} }
if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->Z() >= ff_top)) if(ff_top > highestfloor && delta1 < delta2 && (!restrict || thing->_f_Z() >= ff_top))
{ {
highestfloor = ff_top; highestfloor = ff_top;
highestfloorpic = *rover->top.texture; highestfloorpic = *rover->top.texture;
@ -811,7 +811,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
highestfloorsec = j == 0 ? linedef->frontsector : linedef->backsector; highestfloorsec = j == 0 ? linedef->frontsector : linedef->backsector;
highestfloorplanes[j] = rover->top.plane; highestfloorplanes[j] = rover->top.plane;
} }
if(ff_top > lowestfloor[j] && ff_top <= thing->Z() + thing->MaxStepHeight) lowestfloor[j] = ff_top; if(ff_top > lowestfloor[j] && ff_top <= thing->_f_Z() + thing->MaxStepHeight) lowestfloor[j] = ff_top;
} }
} }

View file

@ -278,7 +278,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
open.abovemidtex = false; open.abovemidtex = false;
if (P_GetMidTexturePosition(linedef, 0, &tt, &tb)) if (P_GetMidTexturePosition(linedef, 0, &tt, &tb))
{ {
if (thing->Z() + (thing->height/2) < (tt + tb)/2) if (thing->_f_Z() + (thing->height/2) < (tt + tb)/2)
{ {
if (tb < open.top) if (tb < open.top)
{ {
@ -288,7 +288,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
} }
else else
{ {
if (tt > open.bottom && (!restrict || thing->Z() >= tt)) if (tt > open.bottom && (!restrict || thing->_f_Z() >= tt))
{ {
open.bottom = tt; open.bottom = tt;
open.abovemidtex = true; open.abovemidtex = true;
@ -299,7 +299,7 @@ bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, FLineOpening &
} }
// returns true if it touches the midtexture // returns true if it touches the midtexture
return (abs(thing->Z() - tt) <= thing->MaxStepHeight); return (abs(thing->_f_Z() - tt) <= thing->MaxStepHeight);
} }
} }
return false; return false;

View file

@ -3487,12 +3487,12 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool forc
while ( (aspot = iterator.Next ()) ) while ( (aspot = iterator.Next ()) )
{ {
spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, angle, force); spawned += DoSpawn (type, aspot->_f_X(), aspot->_f_Y(), aspot->_f_Z(), tid, angle, force);
} }
} }
else if (activator != NULL) else if (activator != NULL)
{ {
spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, angle, force); spawned += DoSpawn (type, activator->_f_X(), activator->_f_Y(), activator->_f_Z(), tid, angle, force);
} }
return spawned; return spawned;
} }
@ -3508,12 +3508,12 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force)
while ( (aspot = iterator.Next ()) ) while ( (aspot = iterator.Next ()) )
{ {
spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, aspot->_f_angle() >> 24, force); spawned += DoSpawn (type, aspot->_f_X(), aspot->_f_Y(), aspot->_f_Z(), tid, aspot->_f_angle() >> 24, force);
} }
} }
else if (activator != NULL) else if (activator != NULL)
{ {
spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, activator->_f_angle() >> 24, force); spawned += DoSpawn (type, activator->_f_X(), activator->_f_Y(), activator->_f_Z(), tid, activator->_f_angle() >> 24, force);
} }
return spawned; return spawned;
} }
@ -3805,7 +3805,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
break; break;
case APROP_Speed: case APROP_Speed:
actor->Speed = value; actor->Speed = FIXED2DBL(value);
break; break;
case APROP_Damage: case APROP_Damage:
@ -3849,7 +3849,7 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
case APROP_JumpZ: case APROP_JumpZ:
if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn)))
static_cast<APlayerPawn *>(actor)->JumpZ = value; static_cast<APlayerPawn *>(actor)->JumpZ = FIXED2DBL(value);
break; // [GRB] break; // [GRB]
case APROP_ChaseGoal: case APROP_ChaseGoal:
@ -4005,7 +4005,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
switch (property) switch (property)
{ {
case APROP_Health: return actor->health; case APROP_Health: return actor->health;
case APROP_Speed: return actor->Speed; case APROP_Speed: return FLOAT2FIXED(actor->Speed);
case APROP_Damage: return actor->GetMissileDamage(0,1); case APROP_Damage: return actor->GetMissileDamage(0,1);
case APROP_DamageFactor:return actor->DamageFactor; case APROP_DamageFactor:return actor->DamageFactor;
case APROP_DamageMultiplier: return actor->DamageMultiply; case APROP_DamageMultiplier: return actor->DamageMultiply;
@ -4041,7 +4041,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_JumpZ: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) case APROP_JumpZ: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn)))
{ {
return static_cast<APlayerPawn *>(actor)->JumpZ; // [GRB] return FLOAT2FIXED(static_cast<APlayerPawn *>(actor)->JumpZ); // [GRB]
} }
else else
{ {
@ -4184,12 +4184,12 @@ bool DLevelScript::DoCheckActorTexture(int tid, AActor *activator, int string, b
if (floor) if (floor)
{ {
actor->Sector->NextLowestFloorAt(actor->X(), actor->Y(), actor->Z(), 0, actor->MaxStepHeight, &resultsec, &resffloor); actor->Sector->NextLowestFloorAt(actor->_f_X(), actor->_f_Y(), actor->_f_Z(), 0, actor->MaxStepHeight, &resultsec, &resffloor);
secpic = resffloor ? *resffloor->top.texture : resultsec->planes[sector_t::floor].Texture; secpic = resffloor ? *resffloor->top.texture : resultsec->planes[sector_t::floor].Texture;
} }
else else
{ {
actor->Sector->NextHighestCeilingAt(actor->X(), actor->Y(), actor->Z(), actor->Top(), 0, &resultsec, &resffloor); actor->Sector->NextHighestCeilingAt(actor->_f_X(), actor->_f_Y(), actor->_f_Z(), actor->_f_Top(), 0, &resultsec, &resffloor);
secpic = resffloor ? *resffloor->bottom.texture : resultsec->planes[sector_t::ceiling].Texture; secpic = resffloor ? *resffloor->bottom.texture : resultsec->planes[sector_t::ceiling].Texture;
} }
return tex == TexMan[secpic]; return tex == TexMan[secpic];
@ -4738,8 +4738,8 @@ static bool DoSpawnDecal(AActor *actor, const FDecalTemplate *tpl, int flags, an
{ {
angle += actor->_f_angle(); angle += actor->_f_angle();
} }
return NULL != ShootDecal(tpl, actor, actor->Sector, actor->X(), actor->Y(), return NULL != ShootDecal(tpl, actor, actor->Sector, actor->_f_X(), actor->_f_Y(),
actor->Z() + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs, actor->_f_Z() + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs,
angle, distance, !!(flags & SDF_PERMANENT)); angle, distance, !!(flags & SDF_PERMANENT));
} }
@ -4900,15 +4900,15 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
case ACSF_GetActorVelX: case ACSF_GetActorVelX:
actor = SingleActorFromTID(args[0], activator); actor = SingleActorFromTID(args[0], activator);
return actor != NULL? actor->vel.x : 0; return actor != NULL? FLOAT2FIXED(actor->Vel.X) : 0;
case ACSF_GetActorVelY: case ACSF_GetActorVelY:
actor = SingleActorFromTID(args[0], activator); actor = SingleActorFromTID(args[0], activator);
return actor != NULL? actor->vel.y : 0; return actor != NULL? FLOAT2FIXED(actor->Vel.Y) : 0;
case ACSF_GetActorVelZ: case ACSF_GetActorVelZ:
actor = SingleActorFromTID(args[0], activator); actor = SingleActorFromTID(args[0], activator);
return actor != NULL? actor->vel.z : 0; return actor != NULL? FLOAT2FIXED(actor->Vel.Z) : 0;
case ACSF_SetPointer: case ACSF_SetPointer:
if (activator) if (activator)
@ -5078,20 +5078,23 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
return (CheckActorProperty(args[0], args[1], args[2])); return (CheckActorProperty(args[0], args[1], args[2]));
case ACSF_SetActorVelocity: case ACSF_SetActorVelocity:
if (args[0] == 0) {
{ DVector3 vel(FIXED2DBL(args[1]), FIXED2DBL(args[2]), FIXED2DBL(args[3]));
P_Thing_SetVelocity(activator, args[1], args[2], args[3], !!args[4], !!args[5]); if (args[0] == 0)
} {
else P_Thing_SetVelocity(activator, vel, !!args[4], !!args[5]);
{ }
TActorIterator<AActor> iterator (args[0]); else
{
while ( (actor = iterator.Next ()) ) TActorIterator<AActor> iterator(args[0]);
{
P_Thing_SetVelocity(actor, args[1], args[2], args[3], !!args[4], !!args[5]); while ((actor = iterator.Next()))
} {
} P_Thing_SetVelocity(actor, vel, !!args[4], !!args[5]);
return 0; }
}
return 0;
}
case ACSF_SetUserVariable: case ACSF_SetUserVariable:
{ {
@ -8349,23 +8352,23 @@ scriptwait:
break; break;
case PCD_SETGRAVITY: case PCD_SETGRAVITY:
level.gravity = (float)STACK(1) / 65536.f; level.gravity = FIXED2DBL(STACK(1));
sp--; sp--;
break; break;
case PCD_SETGRAVITYDIRECT: case PCD_SETGRAVITYDIRECT:
level.gravity = (float)uallong(pc[0]) / 65536.f; level.gravity = FIXED2DBL(uallong(pc[0]));
pc++; pc++;
break; break;
case PCD_SETAIRCONTROL: case PCD_SETAIRCONTROL:
level.aircontrol = STACK(1); level.aircontrol = FIXED2DBL(STACK(1));
sp--; sp--;
G_AirControlChanged (); G_AirControlChanged ();
break; break;
case PCD_SETAIRCONTROLDIRECT: case PCD_SETAIRCONTROLDIRECT:
level.aircontrol = uallong(pc[0]); level.aircontrol = FIXED2DBL(uallong(pc[0]));
pc++; pc++;
G_AirControlChanged (); G_AirControlChanged ();
break; break;
@ -8663,11 +8666,11 @@ scriptwait:
} }
else if (pcd == PCD_GETACTORZ) else if (pcd == PCD_GETACTORZ)
{ {
STACK(1) = actor->Z() + actor->GetBobOffset(); STACK(1) = actor->_f_Z() + actor->GetBobOffset();
} }
else else
{ {
STACK(1) = pcd == PCD_GETACTORX ? actor->X() : pcd == PCD_GETACTORY ? actor->Y() : actor->Z(); STACK(1) = pcd == PCD_GETACTORX ? actor->_f_X() : pcd == PCD_GETACTORY ? actor->_f_Y() : actor->_f_Z();
} }
} }
break; break;
@ -9224,8 +9227,8 @@ scriptwait:
case PLAYERINFO_COLOR: STACK(2) = userinfo->GetColor(); break; case PLAYERINFO_COLOR: STACK(2) = userinfo->GetColor(); break;
case PLAYERINFO_GENDER: STACK(2) = userinfo->GetGender(); break; case PLAYERINFO_GENDER: STACK(2) = userinfo->GetGender(); break;
case PLAYERINFO_NEVERSWITCH: STACK(2) = userinfo->GetNeverSwitch(); break; case PLAYERINFO_NEVERSWITCH: STACK(2) = userinfo->GetNeverSwitch(); break;
case PLAYERINFO_MOVEBOB: STACK(2) = userinfo->GetMoveBob(); break; case PLAYERINFO_MOVEBOB: STACK(2) = FLOAT2FIXED(userinfo->GetMoveBob()); break;
case PLAYERINFO_STILLBOB: STACK(2) = userinfo->GetStillBob(); break; case PLAYERINFO_STILLBOB: STACK(2) = FLOAT2FIXED(userinfo->GetStillBob()); break;
case PLAYERINFO_PLAYERCLASS: STACK(2) = userinfo->GetPlayerClassNum(); break; case PLAYERINFO_PLAYERCLASS: STACK(2) = userinfo->GetPlayerClassNum(); break;
case PLAYERINFO_DESIREDFOV: STACK(2) = (int)pl->DesiredFOV; break; case PLAYERINFO_DESIREDFOV: STACK(2) = (int)pl->DesiredFOV; break;
case PLAYERINFO_FOV: STACK(2) = (int)pl->FOV; break; case PLAYERINFO_FOV: STACK(2) = (int)pl->FOV; break;

View file

@ -1091,8 +1091,8 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
return; return;
} }
pc->vel.x = pc->vel.y = 0; // Stop moving pc->Vel.Zero();
pc->player->vel.x = pc->player->vel.y = 0; pc->player->Vel.Zero();
static_cast<APlayerPawn*>(pc)->PlayIdle (); static_cast<APlayerPawn*>(pc)->PlayIdle ();
pc->player->ConversationPC = pc; pc->player->ConversationPC = pc;

View file

@ -431,17 +431,7 @@ static void MakeFountain (AActor *actor, int color1, int color2)
void P_RunEffect (AActor *actor, int effects) void P_RunEffect (AActor *actor, int effects)
{ {
angle_t moveangle; DAngle moveangle = actor->Vel.Angle();
// 512 is the limit below which R_PointToAngle2 does no longer returns usable values.
if (abs(actor->vel.x) > 512 || abs(actor->vel.y) > 512)
{
moveangle = R_PointToAngle2(0,0,actor->vel.x,actor->vel.y);
}
else
{
moveangle = actor->_f_angle();
}
particle_t *particle; particle_t *particle;
int i; int i;
@ -449,28 +439,26 @@ void P_RunEffect (AActor *actor, int effects)
if ((effects & FX_ROCKET) && (cl_rockettrails & 1)) if ((effects & FX_ROCKET) && (cl_rockettrails & 1))
{ {
// Rocket trail // Rocket trail
double backx = -actor->_Radius() * 2 * moveangle.Cos();
double backy = -actor->_Radius() * 2 * moveangle.Sin();
double backz = actor->_Height() * ((2. / 3) - actor->Vel.Z / 8);
DAngle an = moveangle + 90.;
fixed_t backx = - FixedMul (finecosine[(moveangle)>>ANGLETOFINESHIFT], actor->radius*2);
fixed_t backy = - FixedMul (finesine[(moveangle)>>ANGLETOFINESHIFT], actor->radius*2);
fixed_t backz = - (actor->height>>3) * (actor->vel.z>>16) + (2*actor->height)/3;
angle_t an = (moveangle + ANG90) >> ANGLETOFINESHIFT;
int speed; int speed;
particle = JitterParticle (3 + (M_Random() & 31)); particle = JitterParticle (3 + (M_Random() & 31));
if (particle) { if (particle) {
fixed_t pathdist = M_Random()<<8; fixed_t pathdist = M_Random()<<8;
fixedvec3 pos = actor->Vec3Offset( fixedvec3 pos = actor->Vec3Offset(
backx - FixedMul(actor->vel.x, pathdist), FLOAT2FIXED(backx) - fixed_t(actor->Vel.X * pathdist),
backy - FixedMul(actor->vel.y, pathdist), FLOAT2FIXED(backy) - fixed_t(actor->Vel.Y * pathdist),
backz - FixedMul(actor->vel.z, pathdist)); FLOAT2FIXED(backz) - fixed_t(actor->Vel.Z * pathdist));
particle->x = pos.x; particle->x = pos.x;
particle->y = pos.y; particle->y = pos.y;
particle->z = pos.z; particle->z = pos.z;
speed = (M_Random () - 128) * (FRACUNIT/200); speed = (M_Random () - 128) * (FRACUNIT/200);
particle->vel.x += FixedMul (speed, finecosine[an]); particle->vel.x += fixed_t(speed * an.Cos());
particle->vel.y += FixedMul (speed, finesine[an]); particle->vel.y += fixed_t(speed * an.Sin());
particle->vel.z -= FRACUNIT/36; particle->vel.z -= FRACUNIT/36;
particle->accz -= FRACUNIT/20; particle->accz -= FRACUNIT/20;
particle->color = yellow; particle->color = yellow;
@ -481,15 +469,15 @@ void P_RunEffect (AActor *actor, int effects)
if (particle) { if (particle) {
fixed_t pathdist = M_Random()<<8; fixed_t pathdist = M_Random()<<8;
fixedvec3 pos = actor->Vec3Offset( fixedvec3 pos = actor->Vec3Offset(
backx - FixedMul(actor->vel.x, pathdist), FLOAT2FIXED(backx) - fixed_t(actor->Vel.X * pathdist),
backy - FixedMul(actor->vel.y, pathdist), FLOAT2FIXED(backy) - fixed_t(actor->Vel.Y * pathdist),
backz - FixedMul(actor->vel.z, pathdist) + (M_Random() << 10)); FLOAT2FIXED(backz) - fixed_t(actor->Vel.Z * pathdist) + (M_Random() << 10));
particle->x = pos.x; particle->x = pos.x;
particle->y = pos.y; particle->y = pos.y;
particle->z = pos.z; particle->z = pos.z;
speed = (M_Random () - 128) * (FRACUNIT/200); speed = (M_Random () - 128) * (FRACUNIT/200);
particle->vel.x += FixedMul (speed, finecosine[an]); particle->vel.x += fixed_t(speed * an.Cos());
particle->vel.y += FixedMul (speed, finesine[an]); particle->vel.y += fixed_t(speed * an.Sin());
particle->vel.z += FRACUNIT/80; particle->vel.z += FRACUNIT/80;
particle->accz += FRACUNIT/40; particle->accz += FRACUNIT/40;
if (M_Random () & 7) if (M_Random () & 7)
@ -505,11 +493,11 @@ void P_RunEffect (AActor *actor, int effects)
{ {
// Grenade trail // Grenade trail
fixedvec3 pos = actor->Vec3Angle(-actor->radius * 2, moveangle, fixedvec3 pos = actor->_f_Vec3Angle(-actor->radius * 2, moveangle.BAMs(),
-(actor->height >> 3) * (actor->vel.z >> 16) + (2 * actor->height) / 3); fixed_t(-(actor->height >> 3) * (actor->Vel.Z) + (2 * actor->height) / 3));
P_DrawSplash2 (6, pos.x, pos.y, pos.z, P_DrawSplash2 (6, pos.x, pos.y, pos.z,
moveangle + ANG180, 2, 2); moveangle.BAMs() + ANG180, 2, 2);
} }
if (effects & FX_FOUNTAINMASK) if (effects & FX_FOUNTAINMASK)
{ {
@ -685,8 +673,8 @@ void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end,
double r; double r;
double dirz; double dirz;
if (abs(mo->X() - FLOAT2FIXED(start.X)) < 20 * FRACUNIT if (fabs(mo->X() - start.X) < 20
&& (mo->Y() - FLOAT2FIXED(start.Y)) < 20 * FRACUNIT) && fabs(mo->Y() - start.Y) < 20)
{ // This player (probably) fired the railgun { // This player (probably) fired the railgun
S_Sound (mo, CHAN_WEAPON, sound, 1, ATTN_NORM); S_Sound (mo, CHAN_WEAPON, sound, 1, ATTN_NORM);
} }
@ -696,7 +684,7 @@ void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end,
// Only consider sound in 2D (for now, anyway) // Only consider sound in 2D (for now, anyway)
// [BB] You have to divide by lengthsquared here, not multiply with it. // [BB] You have to divide by lengthsquared here, not multiply with it.
r = ((start.Y - FIXED2DBL(mo->Y())) * (-dir.Y) - (start.X - FIXED2DBL(mo->X())) * (dir.X)) / lengthsquared; r = ((start.Y - mo->Y()) * (-dir.Y) - (start.X - mo->X()) * (dir.X)) / lengthsquared;
r = clamp<double>(r, 0., 1.); r = clamp<double>(r, 0., 1.);
dirz = dir.Z; dirz = dir.Z;

Some files were not shown because too many files have changed in this diff Show more