Merge branch 'floatcvt' of https://github.com/rheit/zdoom into floatcvt

# Conflicts:
#	src/CMakeLists.txt
#	src/actor.h
This commit is contained in:
Christoph Oelckers 2016-03-21 01:34:39 +01:00
commit 48afdd7dcb
206 changed files with 8736 additions and 4731 deletions

View file

@ -164,7 +164,7 @@ if( MSVC )
string(REPLACE " /GR" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} )
else()
set( REL_LINKER_FLAGS "" )
set( ALL_C_FLAGS "" )
set( ALL_C_FLAGS "-ffp-contract=off" )
set( REL_C_FLAGS "" )
set( DEB_C_FLAGS "" )

View file

@ -1284,7 +1284,22 @@ add_executable( zdoom WIN32 MACOSX_BUNDLE
g_shared/sbar_mugshot.cpp
g_shared/shared_hud.cpp
g_shared/shared_sbar.cpp
oplsynth/fmopl.cpp
math/asin.c
math/atan.c
math/const.c
math/cosh.c
math/exp.c
math/isnan.c
math/log.c
math/log10.c
math/mtherr.c
math/polevl.c
math/sin.c
math/sinh.c
math/sqrt.c
math/tan.c
math/tanh.c
math/fastsin.cpp
resourcefiles/ancientzip.cpp
resourcefiles/file_7z.cpp
resourcefiles/file_grp.cpp
@ -1481,6 +1496,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\\Strife Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_strife/.+")
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("OpenGL Renderer" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/.+")
source_group("OpenGL Renderer\\Data" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/gl/data/.+")

View file

@ -25,6 +25,7 @@
// Basics.
#include "tables.h"
#include "templates.h"
// We need the thinker_t stuff.
#include "dthinker.h"
@ -533,6 +534,10 @@ enum EThingSpecialActivationType
THINGSPEC_Switch = 1<<10, // The thing is alternatively activated and deactivated when triggered
};
#define ONFLOORZ FIXED_MIN
#define ONCEILINGZ FIXED_MAX
#define FLOATRANDZ (FIXED_MAX-1)
class FDecalBase;
class AInventory;
@ -571,6 +576,7 @@ public:
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
const double MinVel = 1. / 65536;
// Map Object definition.
class AActor : public DThinker
@ -600,7 +606,7 @@ public:
// Adjusts the angle for deflection/reflection of incoming missiles
// Returns true if the missile should be allowed to explode anyway
bool AdjustReflectionAngle (AActor *thing, angle_t &angle);
bool AdjustReflectionAngle (AActor *thing, DAngle &angle);
// Returns true if this actor is within melee range of its target
bool CheckMeleeRange();
@ -763,7 +769,7 @@ public:
// Return starting health adjusted by skill level
int SpawnHealth() const;
int GetGibHealth() const;
fixed_t GetCameraHeight() const;
double GetCameraHeight() const;
inline bool isMissile(bool precise=true)
{
@ -782,9 +788,9 @@ public:
}
// These also set CF_INTERPVIEW for players.
void SetPitch(int p, bool interpolate, bool forceclamp = false);
void SetAngle(angle_t ang, bool interpolate);
void SetRoll(angle_t roll, bool interpolate);
void SetPitch(DAngle p, bool interpolate, bool forceclamp = false);
void SetAngle(DAngle ang, bool interpolate);
void SetRoll(DAngle roll, bool interpolate);
PClassActor *GetBloodType(int type = 0) const
{
@ -815,135 +821,225 @@ public:
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 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 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
// to distinguish between portal-aware and portal-unaware distance calculation.
fixed_t AproxDistance(AActor *other, bool absolute = false)
{
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
return P_AproxDistance(X() - otherpos.x, Y() - otherpos.y);
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return P_AproxDistance(_f_X() - otherpos.x, _f_Y() - otherpos.y);
}
fixed_t AproxDistance(AActor *other, fixed_t xadd, fixed_t yadd, bool absolute = false)
{
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
return P_AproxDistance(X() - otherpos.x + xadd, Y() - otherpos.y + yadd);
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return P_AproxDistance(_f_X() - otherpos.x + xadd, _f_Y() - otherpos.y + yadd);
}
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
fixed_t Distance2D(AActor *other, bool absolute = false)
double Distance2D(AActor *other, bool absolute = false)
{
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
return xs_RoundToInt(DVector2(X() - otherpos.x, Y() - otherpos.y).Length());
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return (DVector2(_f_X() - otherpos.x, _f_Y() - otherpos.y).Length())/FRACUNIT;
}
double Distance2D(double x, double y) const
{
return DVector2(X() - x, Y() - y).Length();
}
// a full 3D version of the above
fixed_t Distance3D(AActor *other, bool absolute = false)
{
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
return xs_RoundToInt(DVector3(X() - otherpos.x, Y() - otherpos.y, Z() - otherpos.z).Length());
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return xs_RoundToInt(DVector3(_f_X() - otherpos.x, _f_Y() - otherpos.y, _f_Z() - otherpos.z).Length());
}
angle_t AngleTo(AActor *other, bool absolute = false)
angle_t __f_AngleTo(AActor *other, bool absolute = false)
{
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
return R_PointToAngle2(X(), Y(), otherpos.x, otherpos.y);
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return R_PointToAngle2(_f_X(), _f_Y(), otherpos.x, otherpos.y);
}
angle_t 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);
}
fixedvec2 Vec2To(AActor *other) const
DAngle AngleTo(AActor *other, bool absolute = false)
{
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return VecToAngle(otherpos.x - _f_X(), otherpos.y - _f_Y());
}
DAngle AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const
{
fixedvec3 otherpos = absolute ? other->_f_Pos() : other->PosRelative(this);
return VecToAngle(otherpos.y + oxofs - _f_Y(), otherpos.x + oyofs - _f_X());
}
DAngle AngleTo(AActor *other, double oxofs, double oyofs, bool absolute = false) const
{
return FIXED2DBL(AngleTo(other, FLOAT2FIXED(oxofs), FLOAT2FIXED(oyofs), absolute));
}
fixedvec2 _f_Vec2To(AActor *other) const
{
fixedvec3 otherpos = other->PosRelative(this);
fixedvec2 ret = { otherpos.x - X(), otherpos.y - Y() };
fixedvec2 ret = { otherpos.x - _f_X(), otherpos.y - _f_Y() };
return ret;
}
fixedvec3 Vec3To(AActor *other) const
fixedvec3 _f_Vec3To(AActor *other) const
{
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;
}
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)
{
if (absolute)
{
fixedvec2 ret = { X() + dx, Y() + dy };
fixedvec2 ret = { _f_X() + dx, _f_Y() + dy };
return ret;
}
else return P_GetOffsetPosition(X(), Y(), dx, dy);
else return P_GetOffsetPosition(_f_X(), _f_Y(), dx, dy);
}
DVector2 Vec2Offset(double dx, double dy, bool absolute = false)
{
if (absolute)
{
return { X() + dx, Y() + dy };
}
else
{
fixedvec2 v = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(dx), FLOAT2FIXED(dy));
return{ FIXED2DBL(v.x), FIXED2DBL(v.y) };
}
}
DVector3 Vec2OffsetZ(double dx, double dy, double atz, bool absolute = false)
{
if (absolute)
{
return{ X() + dx, Y() + dy, atz };
}
else
{
fixedvec2 v = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(dx), FLOAT2FIXED(dy));
return{ FIXED2DBL(v.x), FIXED2DBL(v.y), atz };
}
}
fixedvec2 Vec2Angle(fixed_t length, angle_t angle, bool absolute = false)
{
if (absolute)
{
fixedvec2 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
fixedvec2 ret = { _f_X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
_f_Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
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)
{
if (absolute)
{
fixedvec3 ret = { X() + dx, Y() + dy, Z() + dz };
fixedvec3 ret = { _f_X() + dx, _f_Y() + dy, _f_Z() + dz };
return ret;
}
else
{
fixedvec2 op = P_GetOffsetPosition(X(), Y(), dx, dy);
fixedvec3 pos = { op.x, op.y, Z() + dz };
fixedvec2 op = P_GetOffsetPosition(_f_X(), _f_Y(), dx, dy);
fixedvec3 pos = { op.x, op.y, _f_Z() + dz };
return pos;
}
}
fixedvec3 Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false)
DVector3 Vec3Offset(double dx, double dy, double dz, bool absolute = false)
{
if (absolute)
{
fixedvec3 ret = { X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), Z() + dz };
return { X() + dx, Y() + dy, Z() + dz };
}
else
{
fixedvec2 v = P_GetOffsetPosition(_f_X(), _f_Y(), FLOAT2FIXED(dx), FLOAT2FIXED(dy));
return{ FIXED2DBL(v.x), FIXED2DBL(v.y), Z() + dz };
}
}
fixedvec3 _f_Vec3Angle(fixed_t length, angle_t angle, fixed_t dz, bool absolute = false)
{
if (absolute)
{
fixedvec3 ret = { _f_X() + FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
_f_Y() + FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]), _f_Z() + dz };
return ret;
}
else
{
fixedvec2 op = P_GetOffsetPosition(X(), Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
fixedvec3 pos = { op.x, op.y, Z() + dz };
fixedvec2 op = P_GetOffsetPosition(_f_X(), _f_Y(), FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]), FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]));
fixedvec3 pos = { op.x, op.y, _f_Z() + dz };
return pos;
}
}
DVector3 Vec3Angle(double length, DAngle angle, double dz, bool absolute = false)
{
if (absolute)
{
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()
{
return 1. / (1 << (accuracy * 5 / 100));
}
void ClearInterpolation();
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)
@ -951,6 +1047,11 @@ public:
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);
bool IsVisibleToPlayer() const;
@ -960,7 +1061,7 @@ public:
bool CanSeek(AActor *target) const;
fixed_t GetGravity() const;
double GetGravity() const;
bool IsSentient() const;
const char *GetTag(const char *def = NULL) const;
void SetTag(const char *def);
@ -973,10 +1074,32 @@ public:
AActor *snext, **sprev; // links in sector (if needed)
fixedvec3 __pos; // double underscores so that it won't get used by accident. Access to this should be exclusively through the designated access functions.
/*
angle_t angle;
fixed_t pitch;
angle_t roll; // This was fixed_t before, which is probably wrong
fixedvec3 vel;
*/
DRotator Angles;
DVector3 Vel;
double Speed;
double FloatSpeed;
// intentionally stange names so that searching for them is easier.
angle_t _f_angle() { return FLOAT2ANGLE(Angles.Yaw.Degrees); }
int _f_pitch() { return FLOAT2ANGLE(Angles.Pitch.Degrees); }
angle_t _f_roll() { return FLOAT2ANGLE(Angles.Roll.Degrees); }
fixed_t _f_velx() { return FLOAT2FIXED(Vel.X); }
fixed_t _f_vely() { return FLOAT2FIXED(Vel.Y); }
fixed_t _f_velz() { return FLOAT2FIXED(Vel.Z); }
fixed_t _f_speed() { return FLOAT2FIXED(Speed); }
fixed_t _f_floatspeed() { return FLOAT2FIXED(FloatSpeed); }
WORD sprite; // used to find patch_t and flip value
BYTE frame; // sprite frame to draw
fixed_t scaleX, scaleY; // Scaling values; FRACUNIT is normal size
DVector2 Scale; // Scaling values; 1 is normal size
FRenderStyle RenderStyle; // Style to draw this actor with
ActorRenderFlags renderflags; // Different rendering flags
FTextureID picnum; // Draw this instead of sprite if valid
@ -985,12 +1108,20 @@ public:
DWORD fillcolor; // Color to draw when STYLE_Shaded
// interaction info
fixed_t pitch;
angle_t roll; // This was fixed_t before, which is probably wrong
FBlockNode *BlockNode; // links in blocks (if needed)
struct sector_t *Sector;
subsector_t * subsector;
fixed_t floorz, ceilingz; // closest together of contacted secs
double floorz, ceilingz; // closest together of contacted secs
inline fixed_t _f_ceilingz()
{
return FLOAT2FIXED(ceilingz);
}
inline fixed_t _f_floorz()
{
return FLOAT2FIXED(floorz);
}
fixed_t dropoffz; // killough 11/98: the lowest floor over all contacted Sectors.
struct sector_t *floorsector;
@ -998,9 +1129,19 @@ public:
int floorterrain;
struct sector_t *ceilingsector;
FTextureID ceilingpic; // contacted sec ceilingpic
fixed_t radius, height; // for movement checking
fixed_t projectilepassheight; // height for clipping projectile movement against this actor
fixedvec3 vel;
double radius, Height; // for movement checking
inline fixed_t _f_radius() const
{
return FLOAT2FIXED(radius);
}
inline fixed_t _f_height() const
{
return FLOAT2FIXED(Height);
}
double projectilepassheight; // height for clipping projectile movement against this actor
SDWORD tics; // state tic counter
FState *state;
VMFunction *Damage; // For missiles and monster railgun
@ -1018,6 +1159,9 @@ public:
int special1; // Special info
int special2; // Special info
double specialf1; // With floats we cannot use the int versions for storing position or angle data without reverting to fixed point (which we do not want.)
double specialf2;
int weaponspecial; // Special info for weapons.
int health;
BYTE movedir; // 0-7
@ -1045,7 +1189,12 @@ public:
FNameNoInit Species; // For monster families
TObjPtr<AActor> tracer; // Thing being chased/attacked for tracers
TObjPtr<AActor> master; // Thing which spawned this one (prevents mutual attacks)
fixed_t floorclip; // value to use for floor clipping
double Floorclip; // value to use for floor clipping
fixed_t _f_floorclip()
{
return FLOAT2FIXED(Floorclip);
}
int tid; // thing identifier
int special; // special
int args[5]; // special arguments
@ -1068,7 +1217,7 @@ public:
fixed_t bouncefactor; // Strife's grenades use 50%, Hexen's Flechettes 70.
fixed_t wallbouncefactor; // The bounce factor for walls can be different.
int bouncecount; // Strife's grenades only bounce twice before exploding
fixed_t gravity; // [GRB] Gravity factor
double Gravity; // [GRB] Gravity factor
fixed_t Friction;
int FastChaseStrafeCount;
fixed_t pushfactor;
@ -1115,8 +1264,6 @@ public:
FSoundIDNoInit WallBounceSound;
FSoundIDNoInit CrushPainSound;
fixed_t Speed;
fixed_t FloatSpeed;
fixed_t MaxDropOffHeight, MaxStepHeight;
SDWORD Mass;
SWORD PainChance;
@ -1148,7 +1295,8 @@ public:
// [RH] Used to interpolate the view to get >35 FPS
fixed_t PrevX, PrevY, PrevZ;
angle_t PrevAngle;
//angle_t PrevAngle;
DRotator PrevAngles;
int PrevPortalGroup;
// ThingIDs
@ -1156,6 +1304,7 @@ public:
void AddToHash ();
void RemoveFromHash ();
private:
static AActor *TIDHash[128];
static inline int TIDHASH (int key) { return key & 127; }
@ -1200,23 +1349,40 @@ public:
bool HasSpecialDeathStates () const;
fixed_t X() const
fixed_t _f_X() const
{
return __pos.x;
}
fixed_t Y() const
fixed_t _f_Y() const
{
return __pos.y;
}
fixed_t Z() const
fixed_t _f_Z() const
{
return __pos.z;
}
fixedvec3 Pos() const
fixedvec3 _f_Pos() const
{
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(const AActor *other) const;
fixedvec3 PosRelative(sector_t *sec) const;
@ -1224,42 +1390,75 @@ public:
fixed_t SoundX() const
{
return X();
return _f_X();
}
fixed_t SoundY() const
{
return Y();
return _f_Y();
}
fixed_t SoundZ() const
{
return Z();
return _f_Z();
}
fixedvec3 InterpolatedPosition(fixed_t ticFrac) const
{
fixedvec3 ret;
ret.x = PrevX + FixedMul (ticFrac, X() - PrevX);
ret.y = PrevY + FixedMul (ticFrac, Y() - PrevY);
ret.z = PrevZ + FixedMul (ticFrac, Z() - PrevZ);
ret.x = PrevX + FixedMul (ticFrac, _f_X() - PrevX);
ret.y = PrevY + FixedMul (ticFrac, _f_Y() - PrevY);
ret.z = PrevZ + FixedMul (ticFrac, _f_Z() - PrevZ);
return ret;
}
fixedvec3 PosPlusZ(fixed_t zadd) const
{
fixedvec3 ret = { X(), Y(), Z() + zadd };
fixedvec3 ret = { _f_X(), _f_Y(), _f_Z() + zadd };
return ret;
}
fixed_t Top() const
DVector3 PosPlusZ(double zadd) const
{
return Z() + height;
return { X(), Y(), Z() + zadd };
}
void SetZ(fixed_t newz, bool moving = true)
DVector3 PosAtZ(double zadd) const
{
return{ X(), Y(), zadd };
}
fixed_t _f_Top() const
{
return _f_Z() + FLOAT2FIXED(Height);
}
void _f_SetZ(fixed_t newz, bool moving = true)
{
__pos.z = newz;
}
void AddZ(fixed_t newz, bool moving = true)
void _f_AddZ(fixed_t newz, bool moving = true)
{
__pos.z += newz;
}
double Top() const
{
return Z() + Height;
}
double Center() const
{
return Z() + Height/2;
}
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);
if (!moving) PrevZ = __pos.z;
}
// These are not for general use as they do not link the actor into the world!
void SetXY(fixed_t xx, fixed_t yy)
@ -1273,6 +1472,12 @@ public:
__pos.y = yy;
__pos.z = zz;
}
void SetXYZ(double xx, double yy, double zz)
{
__pos.x = FLOAT2FIXED(xx);
__pos.y = FLOAT2FIXED(yy);
__pos.z = FLOAT2FIXED(zz);
}
void SetXY(const fixedvec2 &npos)
{
__pos.x = npos.x;
@ -1284,6 +1489,87 @@ public:
__pos.y = npos.y;
__pos.z = npos.z;
}
void SetXYZ(const DVector3 &npos)
{
__pos.x = FLOAT2FIXED(npos.X);
__pos.y = FLOAT2FIXED(npos.Y);
__pos.z = FLOAT2FIXED(npos.Z);
}
double VelXYToSpeed() const
{
return DVector2(Vel.X, Vel.Y).Length();
}
double VelToSpeed() const
{
return Vel.Length();
}
void AngleFromVel()
{
Angles.Yaw = VecToAngle(Vel.X, Vel.Y);
}
void VelFromAngle()
{
Vel.X = Speed * Angles.Yaw.Cos();
Vel.Y = Speed * Angles.Yaw.Sin();
}
void VelFromAngle(double speed)
{
Vel.X = speed * Angles.Yaw.Cos();
Vel.Y = speed * Angles.Yaw.Sin();
}
void VelFromAngle(DAngle angle, double speed)
{
Vel.X = speed * angle.Cos();
Vel.Y = speed * angle.Sin();
}
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();
Vel.X = speed * cospitch * angle.Cos();
Vel.Y = speed * cospitch * angle.Sin();
Vel.Z = speed * -pitch.Sin();
}
void Vel3DFromAngle(DAngle pitch, double speed)
{
double cospitch = pitch.Cos();
Vel.X = speed * cospitch * Angles.Yaw.Cos();
Vel.Y = speed * cospitch * Angles.Yaw.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);
}
// begin of GZDoom specific additions
TArray<TObjPtr<AActor> > dynamiclights;
@ -1369,6 +1655,14 @@ inline AActor *Spawn (PClassActor *type, const fixedvec3 &pos, replace_t allowre
return AActor::StaticSpawn (type, pos.x, pos.y, pos.z, allowreplacement);
}
inline AActor *Spawn(PClassActor *type, const DVector3 &pos, replace_t allowreplacement)
{
fixed_t zz;
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ && pos.Z != FLOATRANDZ) zz = FLOAT2FIXED(pos.Z);
else zz = (int)pos.Z;
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, 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);
@ -1377,11 +1671,27 @@ inline AActor *Spawn (const char *type, const fixedvec3 &pos, replace_t allowrep
return Spawn (type, pos.x, pos.y, pos.z, allowreplacement);
}
inline AActor *Spawn(const char *type, const DVector3 &pos, replace_t allowreplacement)
{
fixed_t zz;
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ && pos.Z != FLOATRANDZ) zz = FLOAT2FIXED(pos.Z);
else zz = (int)pos.Z;
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement);
}
inline AActor *Spawn (FName classname, const fixedvec3 &pos, replace_t allowreplacement)
{
return Spawn (classname, pos.x, pos.y, pos.z, allowreplacement);
}
inline AActor *Spawn(FName type, const DVector3 &pos, replace_t allowreplacement)
{
fixed_t zz;
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ && pos.Z != FLOATRANDZ) zz = FLOAT2FIXED(pos.Z);
else zz = (int)pos.Z;
return Spawn(type, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement);
}
template<class T>
inline T *Spawn (fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
@ -1395,13 +1705,27 @@ 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));
}
inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
template<class T>
inline T *Spawn(const DVector3 &pos, replace_t allowreplacement)
{
fixed_t zz;
if (pos.Z != ONFLOORZ && pos.Z != ONCEILINGZ && pos.Z != FLOATRANDZ) zz = FLOAT2FIXED(pos.Z);
else zz = (int)pos.Z;
return static_cast<T *>(AActor::StaticSpawn(RUNTIME_TEMPLATE_CLASS(T), FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), zz, allowreplacement));
}
inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
{
fixedvec2 ret = { FixedMul(length, finecosine[angle >> ANGLETOFINESHIFT]),
FixedMul(length, finesine[angle >> ANGLETOFINESHIFT]) };
return ret;
}
inline fixedvec2 Vec2Angle(fixed_t length, DAngle angle)
{
return { xs_CRoundToInt(length * angle.Cos()), xs_CRoundToInt(length * angle.Sin()) };
}
void PrintMiscActorInfo(AActor * query);
AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch, ActorFlags actorMask, DWORD wallMask);
@ -1409,7 +1733,7 @@ AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch,
struct FTranslatedLineTarget
{
AActor *linetarget;
angle_t angleFromSource;
DAngle angleFromSource;
bool unlinked; // found by a trace that went through an unlinked portal.
};

View file

@ -648,7 +648,7 @@ CUSTOM_CVAR (Int, am_cheat, 0, 0)
#define AM_NUMMARKPOINTS 10
// player radius for automap checking
// player _f_radius() for automap checking
#define PLAYERRADIUS 16*MAPUNIT
// how much the automap moves window per tic in frame-buffer coordinates
@ -1012,8 +1012,8 @@ void AM_restoreScaleAndLoc ()
}
else
{
m_x = (players[consoleplayer].camera->X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[consoleplayer].camera->Y() >> FRACTOMAPBITS)- m_h/2;
m_x = (players[consoleplayer].camera->_f_X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[consoleplayer].camera->_f_Y() >> FRACTOMAPBITS)- m_h/2;
}
m_x2 = m_x + m_w;
m_y2 = m_y + m_h;
@ -1129,7 +1129,7 @@ static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty)
{
xs[i] -= pivotx;
ys[i] -= pivoty;
AM_rotate (&xs[i], &ys[i], ANG90 - players[consoleplayer].camera->angle);
AM_rotate (&xs[i], &ys[i], ANG90 - players[consoleplayer].camera->_f_angle());
if (i == 5)
break;
@ -1150,7 +1150,7 @@ static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty)
// ys[4] = rmax_y;
// else if (ys[4] < rmin_y)
// ys[4] = rmin_y;
AM_rotate (&xs[4], &ys[4], ANG270 - players[consoleplayer].camera->angle);
AM_rotate (&xs[4], &ys[4], ANG270 - players[consoleplayer].camera->_f_angle());
m_x = xs[4] + pivotx - m_w/2;
m_y = ys[4] + pivoty - m_h/2;
#endif
@ -1216,7 +1216,7 @@ void AM_changeWindowLoc ()
oincy = incy = Scale(m_paninc.y, SCREENHEIGHT, 200);
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
AM_rotate(&incx, &incy, players[consoleplayer].camera->angle - ANG90);
AM_rotate(&incx, &incy, players[consoleplayer].camera->_f_angle() - ANG90);
}
m_x += incx;
@ -1263,8 +1263,8 @@ void AM_initVariables ()
if (playeringame[pnum])
break;
assert(pnum >= 0 && pnum < MAXPLAYERS);
m_x = (players[pnum].camera->X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->Y() >> FRACTOMAPBITS) - m_h/2;
m_x = (players[pnum].camera->_f_X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->_f_Y() >> FRACTOMAPBITS) - m_h/2;
AM_changeWindowLoc();
// for saving & restoring
@ -1585,25 +1585,25 @@ void AM_doFollowPlayer ()
fixed_t sx, sy;
if (players[consoleplayer].camera != NULL &&
(f_oldloc.x != players[consoleplayer].camera->X() ||
f_oldloc.y != players[consoleplayer].camera->Y()))
(f_oldloc.x != players[consoleplayer].camera->_f_X() ||
f_oldloc.y != players[consoleplayer].camera->_f_Y()))
{
m_x = (players[consoleplayer].camera->X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[consoleplayer].camera->Y() >> FRACTOMAPBITS) - m_h/2;
m_x = (players[consoleplayer].camera->_f_X() >> FRACTOMAPBITS) - m_w/2;
m_y = (players[consoleplayer].camera->_f_Y() >> FRACTOMAPBITS) - m_h/2;
m_x2 = m_x + m_w;
m_y2 = m_y + m_h;
// do the parallax parchment scrolling.
sx = (players[consoleplayer].camera->X() - f_oldloc.x) >> FRACTOMAPBITS;
sy = (f_oldloc.y - players[consoleplayer].camera->Y()) >> FRACTOMAPBITS;
sx = (players[consoleplayer].camera->_f_X() - f_oldloc.x) >> FRACTOMAPBITS;
sy = (f_oldloc.y - players[consoleplayer].camera->_f_Y()) >> FRACTOMAPBITS;
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
AM_rotate (&sx, &sy, players[consoleplayer].camera->angle - ANG90);
AM_rotate (&sx, &sy, players[consoleplayer].camera->_f_angle() - ANG90);
}
AM_ScrollParchment (sx, sy);
f_oldloc.x = players[consoleplayer].camera->X();
f_oldloc.y = players[consoleplayer].camera->Y();
f_oldloc.x = players[consoleplayer].camera->_f_X();
f_oldloc.y = players[consoleplayer].camera->_f_Y();
}
}
@ -2042,7 +2042,7 @@ void AM_drawSubsectors()
// Apply the automap's rotation to the texture origin.
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
rotation += ANG90 - players[consoleplayer].camera->angle;
rotation += ANG90 - players[consoleplayer].camera->_f_angle();
AM_rotatePoint(&originpt.x, &originpt.y);
}
originx = f_x + ((originpt.x - m_x) * scale / float(1 << 24));
@ -2588,7 +2588,7 @@ void AM_rotatePoint (fixed_t *x, fixed_t *y)
fixed_t pivoty = m_y + m_h/2;
*x -= pivotx;
*y -= pivoty;
AM_rotate (x, y, ANG90 - players[consoleplayer].camera->angle);
AM_rotate (x, y, ANG90 - players[consoleplayer].camera->_f_angle());
*x += pivotx;
*y += pivoty;
}
@ -2668,7 +2668,7 @@ void AM_drawPlayers ()
mline_t *arrow;
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.y = pos.y >> FRACTOMAPBITS;
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
@ -2678,7 +2678,7 @@ void AM_drawPlayers ()
}
else
{
angle = players[consoleplayer].camera->angle;
angle = players[consoleplayer].camera->_f_angle();
}
if (am_cheat != 0 && CheatMapArrow.Size() > 0)
@ -2736,12 +2736,12 @@ void AM_drawPlayers ()
pt.x = pos.x >> FRACTOMAPBITS;
pt.y = pos.y >> FRACTOMAPBITS;
angle = p->mo->angle;
angle = p->mo->_f_angle();
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
AM_rotatePoint (&pt.x, &pt.y);
angle -= players[consoleplayer].camera->angle - ANG90;
angle -= players[consoleplayer].camera->_f_angle() - ANG90;
}
AM_drawLineCharacter(&MapArrow[0], MapArrow.Size(), 0, angle, color, pt.x, pt.y);
@ -2770,12 +2770,12 @@ void AM_drawKeys ()
p.x = pos.x >> FRACTOMAPBITS;
p.y = pos.y >> FRACTOMAPBITS;
angle = key->angle;
angle = key->_f_angle();
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
AM_rotatePoint (&p.x, &p.y);
angle += ANG90 - players[consoleplayer].camera->angle;
angle += ANG90 - players[consoleplayer].camera->_f_angle();
}
if (key->flags & MF_SPECIAL)
@ -2830,11 +2830,11 @@ void AM_drawThings ()
const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0);
frame = &SpriteFrames[spriteIndex];
angle_t angle = ANGLE_270 - t->angle;
angle_t angle = ANGLE_270 - t->_f_angle();
if (frame->Texture[0] != frame->Texture[1]) angle += (ANGLE_180 / 16);
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
angle += players[consoleplayer].camera->angle - ANGLE_90;
angle += players[consoleplayer].camera->_f_angle() - ANGLE_90;
}
rotation = angle >> 28;
@ -2844,8 +2844,8 @@ void AM_drawThings ()
if (texture == NULL) goto drawTriangle; // fall back to standard display if no sprite can be found.
const fixed_t spriteXScale = FixedMul(t->scaleX, 10 * scale_mtof);
const fixed_t spriteYScale = FixedMul(t->scaleY, 10 * scale_mtof);
const fixed_t spriteXScale = fixed_t(t->Scale.X * 10 * scale_mtof);
const fixed_t spriteYScale = fixed_t(t->Scale.Y * 10 * scale_mtof);
DrawMarker (texture, p.x, p.y, 0, !!(frame->Flip & (1 << rotation)),
spriteXScale, spriteYScale, t->Translation, FRACUNIT, 0, LegacyRenderStyles[STYLE_Normal]);
@ -2853,12 +2853,12 @@ void AM_drawThings ()
else
{
drawTriangle:
angle = t->angle;
angle = t->_f_angle();
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
AM_rotatePoint (&p.x, &p.y);
angle += ANG90 - players[consoleplayer].camera->angle;
angle += ANG90 - players[consoleplayer].camera->_f_angle();
}
color = AMColors[AMColors.ThingColor];
@ -2920,7 +2920,7 @@ void AM_drawThings ()
{ { -MAPUNIT, MAPUNIT }, { -MAPUNIT, -MAPUNIT } },
};
AM_drawLineCharacter (box, 4, t->radius >> FRACTOMAPBITS, angle - t->angle, color, p.x, p.y);
AM_drawLineCharacter (box, 4, t->_f_radius() >> FRACTOMAPBITS, angle - t->_f_angle(), color, p.x, p.y);
}
}
}
@ -3041,8 +3041,8 @@ void AM_drawAuthorMarkers ()
marked->subsector->flags & SSECF_DRAWN :
marked->Sector->MoreFlags & SECF_DRAWN)))
{
DrawMarker (tex, marked->X() >> FRACTOMAPBITS, marked->Y() >> FRACTOMAPBITS, 0,
flip, mark->scaleX, mark->scaleY, mark->Translation,
DrawMarker (tex, marked->_f_X() >> FRACTOMAPBITS, marked->_f_Y() >> FRACTOMAPBITS, 0,
flip, FLOAT2FIXED(mark->Scale.X), FLOAT2FIXED(mark->Scale.Y), mark->Translation,
mark->alpha, mark->fillcolor, mark->RenderStyle);
}
marked = mark->args[0] != 0 ? it.Next() : NULL;

View file

@ -36,7 +36,7 @@ bool DBot::Reachable (AActor *rtarget)
if ((rtarget->Sector->ceilingplane.ZatPoint (rtarget) -
rtarget->Sector->floorplane.ZatPoint (rtarget))
< player->mo->height) //Where rtarget is, player->mo can't be.
< player->mo->_f_height()) //Where rtarget is, player->mo can't be.
return false;
sector_t *last_s = player->mo->Sector;
@ -44,7 +44,7 @@ bool DBot::Reachable (AActor *rtarget)
fixed_t estimated_dist = player->mo->AproxDistance(rtarget);
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;
while ((in = it.Next()))
{
@ -58,8 +58,8 @@ bool DBot::Reachable (AActor *rtarget)
frac = in->frac - FixedDiv (4*FRACUNIT, MAX_TRAVERSE_DIST);
dist = FixedMul (frac, MAX_TRAVERSE_DIST);
hitx = it.Trace().x + FixedMul (player->mo->vel.x, frac);
hity = it.Trace().y + FixedMul (player->mo->vel.y, frac);
hitx = it.Trace().x + FixedMul (player->mo->_f_velx(), frac);
hity = it.Trace().y + FixedMul (player->mo->_f_vely(), frac);
if (in->isaline)
{
@ -79,7 +79,7 @@ bool DBot::Reachable (AActor *rtarget)
if (!bglobal.IsDangerous (s) && //Any nukage/lava?
(floorheight <= (last_z+MAXMOVEHEIGHT)
&& ((ceilingheight == floorheight && line->special)
|| (ceilingheight - floorheight) >= player->mo->height))) //Does it fit?
|| (ceilingheight - floorheight) >= player->mo->_f_height()))) //Does it fit?
{
last_z = floorheight;
last_s = s;
@ -127,7 +127,7 @@ bool DBot::Check_LOS (AActor *to, angle_t vangle)
if (vangle == 0)
return false; //Looker seems to be blind.
return absangle(player->mo->AngleTo(to) - player->mo->angle) <= vangle/2;
return absangle(player->mo->__f_AngleTo(to) - player->mo->_f_angle()) <= vangle/2;
}
//-------------------------------------
@ -170,7 +170,7 @@ void DBot::Dofire (ticcmd_t *cmd)
no_fire = true;
//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.
if (player->ReadyWeapon->WeaponFlags & WIF_MELEEWEAPON)
@ -192,7 +192,7 @@ void DBot::Dofire (ticcmd_t *cmd)
else
{
//*4 is for atmosphere, the chainsaws sounding and all..
no_fire = (dist > (MELEERANGE*4));
no_fire = (dist > (FLOAT2FIXED(MELEERANGE)*4));
}
}
else if (player->ReadyWeapon->WeaponFlags & WIF_BOT_BFG)
@ -212,7 +212,7 @@ void DBot::Dofire (ticcmd_t *cmd)
{
angle = an;
//have to be somewhat precise. to avoid suicide.
if (absangle(angle - player->mo->angle) < 12*ANGLE_1)
if (absangle(angle - player->mo->_f_angle()) < 12*ANGLE_1)
{
t_rocket = 9;
no_fire = false;
@ -222,16 +222,16 @@ void DBot::Dofire (ticcmd_t *cmd)
// prediction aiming
shootmissile:
dist = player->mo->AproxDistance (enemy);
m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->Speed;
bglobal.SetBodyAt (enemy->X() + enemy->vel.x*m*2, enemy->Y() + enemy->vel.y*m*2, enemy->Z(), 1);
angle = player->mo->AngleTo(bglobal.body1);
m = dist / GetDefaultByType (player->ReadyWeapon->ProjectileType)->_f_speed();
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);
if (Check_LOS (enemy, SHOOTFOV))
no_fire = false;
}
else
{
//Other weapons, mostly instant hit stuff.
angle = player->mo->AngleTo(enemy);
angle = player->mo->__f_AngleTo(enemy);
aiming_penalty = 0;
if (enemy->flags & MF_SHADOW)
aiming_penalty += (pr_botdofire()%25)+10;
@ -254,7 +254,7 @@ shootmissile:
angle -= m;
}
if (absangle(angle - player->mo->angle) < 4*ANGLE_1)
if (absangle(angle - player->mo->_f_angle()) < 4*ANGLE_1)
{
increase = !increase;
}
@ -456,7 +456,7 @@ void FCajunMaster::SetBodyAt (fixed_t x, fixed_t y, fixed_t z, int hostnum)
//
//Returns NULL if shouldn't fire
//else an angle (in degrees) are given
//This function assumes actor->player->angle
//This function assumes actor->player->_f_angle()
//has been set an is the main aiming angle.
@ -467,22 +467,16 @@ fixed_t FCajunMaster::FakeFire (AActor *source, AActor *dest, ticcmd_t *cmd)
th->target = source; // where it came from
float speed = (float)th->Speed;
fixedvec3 fixvel = source->Vec3To(dest);
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);
th->Vel = source->Vec3To(dest).Resized(th->Speed);
fixed_t dist = 0;
while (dist < SAFE_SELF_MISDIST)
{
dist += th->Speed;
th->Move(th->vel.x, th->vel.y, th->vel.z);
if (!CleanAhead (th, th->X(), th->Y(), cmd))
dist += th->_f_speed();
th->Move(th->_f_velx(), th->_f_vely(), th->_f_velz());
if (!CleanAhead (th, th->_f_X(), th->_f_Y(), cmd))
break;
}
th->Destroy ();
@ -496,9 +490,9 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
AActor *actor;
int m;
bglobal.SetBodyAt (player->mo->X() + FixedMul(player->mo->vel.x, 5*FRACUNIT),
player->mo->Y() + FixedMul(player->mo->vel.y, 5*FRACUNIT),
player->mo->Z() + (player->mo->height / 2), 2);
bglobal.SetBodyAt (player->mo->_f_X() + FixedMul(player->mo->_f_velx(), 5*FRACUNIT),
player->mo->_f_Y() + FixedMul(player->mo->_f_vely(), 5*FRACUNIT),
player->mo->_f_Z() + (player->mo->_f_height() / 2), 2);
actor = bglobal.body2;
@ -506,20 +500,20 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
if (dist < SAFE_SELF_MISDIST)
return 0;
//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)),
enemy->Y() + FixedMul(enemy->vel.y, (m+2*FRACUNIT)), ONFLOORZ, 1);
bglobal.SetBodyAt (enemy->_f_X() + FixedMul(enemy->_f_velx(), (m+2*FRACUNIT)),
enemy->_f_Y() + FixedMul(enemy->_f_vely(), (m+2*FRACUNIT)), ONFLOORZ, 1);
//try the predicted location
if (P_CheckSight (actor, bglobal.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile
{
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)
{
ang = actor->AngleTo(bglobal.body1);
ang = actor->__f_AngleTo(bglobal.body1);
return ang;
}
}
@ -529,7 +523,7 @@ angle_t DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
{
if (bglobal.FakeFire (player->mo, enemy, cmd) >= SAFE_SELF_MISDIST)
{
ang = player->mo->AngleTo(enemy);
ang = player->mo->__f_AngleTo(enemy);
return ang;
}
}

View file

@ -21,6 +21,7 @@
#include "d_player.h"
#include "p_spec.h"
#include "p_checkposition.h"
#include "math/cmath.h"
static FRandom pr_botopendoor ("BotOpenDoor");
static FRandom pr_bottrywalk ("BotTryWalk");
@ -38,7 +39,7 @@ void DBot::Roam (ticcmd_t *cmd)
if (Reachable(dest))
{ // Straight towards it.
angle = player->mo->AngleTo(dest);
angle = player->mo->__f_AngleTo(dest);
}
else if (player->mo->movedir < 8) // turn towards movement direction if not there yet
{
@ -70,8 +71,8 @@ bool DBot::Move (ticcmd_t *cmd)
if ((unsigned)player->mo->movedir >= 8)
I_Error ("Weird bot movedir!");
tryx = player->mo->X() + 8*xspeed[player->mo->movedir];
tryy = player->mo->Y() + 8*yspeed[player->mo->movedir];
tryx = player->mo->_f_X() + 8*xspeed[player->mo->movedir];
tryy = player->mo->_f_Y() + 8*yspeed[player->mo->movedir];
try_ok = bglobal.CleanAhead (player->mo, tryx, tryy, cmd);
@ -147,7 +148,7 @@ void DBot::NewChaseDir (ticcmd_t *cmd)
olddir = (dirtype_t)player->mo->movedir;
turnaround = opposite[olddir];
fixedvec2 delta = player->mo->Vec2To(dest);
fixedvec2 delta = player->mo->_f_Vec2To(dest);
if (delta.x > 10*FRACUNIT)
d[1] = DI_EAST;
@ -269,21 +270,21 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
if (!(thing->flags & MF_NOCLIP) )
{
fixed_t maxstep = thing->MaxStepHeight;
if (tm.ceilingz - tm.floorz < thing->height)
if (tm.ceilingz - tm.floorz < thing->Height)
return false; // doesn't fit
if (!(thing->flags&MF_MISSILE))
{
if(tm.floorz > (thing->Sector->floorplane.ZatPoint (x, y)+MAXMOVEHEIGHT)) //Too high wall
if(tm._f_floorz() > (thing->Sector->floorplane.ZatPoint (x, y)+MAXMOVEHEIGHT)) //Too high wall
return false;
//Jumpable
if(tm.floorz>(thing->Sector->floorplane.ZatPoint (x, y)+thing->MaxStepHeight))
if(tm._f_floorz()>(thing->Sector->floorplane.ZatPoint (x, y)+thing->MaxStepHeight))
cmd->ucmd.buttons |= BT_JUMP;
if ( !(thing->flags & MF_TELEPORT) &&
tm.ceilingz - thing->Z() < thing->height)
tm.ceilingz < thing->Top())
return false; // mobj must lower itself to fit
// jump out of water
@ -291,12 +292,12 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
// maxstep=37*FRACUNIT;
if ( !(thing->flags & MF_TELEPORT) &&
(tm.floorz - thing->Z() > maxstep ) )
(tm._f_floorz() - thing->_f_Z() > maxstep ) )
return false; // too big a step up
if ( !(thing->flags&(MF_DROPOFF|MF_FLOAT))
&& tm.floorz - tm.dropoffz > thing->MaxDropOffHeight )
&& tm._f_floorz() - tm.dropoffz > thing->MaxDropOffHeight )
return false; // don't stand over a dropoff
}
@ -304,13 +305,13 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
return true;
}
#define OKAYRANGE (5*ANGLE_1) //counts *2, when angle is in range, turning is not executed.
#define MAXTURN (15*ANGLE_1) //Max degrees turned in one tic. Lower is smother but may cause the bot not getting where it should = crash
#define OKAYRANGE (5) //counts *2, when angle is in range, turning is not executed.
#define MAXTURN (15) //Max degrees turned in one tic. Lower is smother but may cause the bot not getting where it should = crash
#define TURNSENS 3 //Higher is smoother but slower turn.
void DBot::TurnToAng ()
{
int maxturn = MAXTURN;
double maxturn = MAXTURN;
if (player->ReadyWeapon != NULL)
{
@ -330,16 +331,16 @@ void DBot::TurnToAng ()
maxturn = 3;
}
int distance = angle - player->mo->angle;
DAngle distance = deltaangle(player->mo->Angles.Yaw, ANGLE2DBL(angle));
if (abs (distance) < OKAYRANGE && !enemy)
if (fabs (distance) < OKAYRANGE && !enemy)
return;
distance /= TURNSENS;
if (abs (distance) > maxturn)
if (fabs (distance) > maxturn)
distance = distance < 0 ? -maxturn : maxturn;
player->mo->angle += distance;
player->mo->Angles.Yaw += distance;
}
void DBot::Pitch (AActor *target)
@ -347,9 +348,9 @@ void DBot::Pitch (AActor *target)
double aim;
double diff;
diff = target->Z() - player->mo->Z();
aim = atan(diff / (double)player->mo->AproxDistance(target));
player->mo->pitch = -(int)(aim * ANGLE_180/M_PI);
diff = target->_f_Z() - player->mo->_f_Z();
aim = g_atan(diff / (double)player->mo->AproxDistance(target));
player->mo->Angles.Pitch = ToDegrees(aim);
}
//Checks if a sector is dangerous.

View file

@ -20,6 +20,7 @@
#include "d_net.h"
#include "d_event.h"
#include "d_player.h"
#include "vectors.h"
static FRandom pr_botmove ("BotMove");
@ -39,20 +40,21 @@ void DBot::Think ()
if (teamplay || !deathmatch)
mate = Choose_Mate ();
angle_t oldyaw = player->mo->angle;
int oldpitch = player->mo->pitch;
AActor *actor = player->mo;
DAngle oldyaw = actor->Angles.Yaw;
DAngle oldpitch = actor->Angles.Pitch;
Set_enemy ();
ThinkForMove (cmd);
TurnToAng ();
cmd->ucmd.yaw = (short)((player->mo->angle - oldyaw) >> 16) / ticdup;
cmd->ucmd.pitch = (short)((oldpitch - player->mo->pitch) >> 16);
cmd->ucmd.yaw = (short)((actor->Angles.Yaw - oldyaw).Degrees * (65536 / 360.f)) / ticdup;
cmd->ucmd.pitch = (short)((oldpitch - actor->Angles.Pitch).Degrees * (65536 / 360.f));
if (cmd->ucmd.pitch == -32768)
cmd->ucmd.pitch = -32767;
cmd->ucmd.pitch /= ticdup;
player->mo->angle = oldyaw + (cmd->ucmd.yaw << 16) * ticdup;
player->mo->pitch = oldpitch - (cmd->ucmd.pitch << 16) * ticdup;
actor->Angles.Yaw = oldyaw + DAngle(cmd->ucmd.yaw * ticdup * (360 / 65536.f));
actor->Angles.Pitch = oldpitch - DAngle(cmd->ucmd.pitch * ticdup * (360 / 65536.f));
}
if (t_active) t_active--;
@ -85,22 +87,22 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
dist = dest ? player->mo->AproxDistance(dest) : 0;
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;
missile = NULL; //Probably ended its travel.
}
if (player->mo->pitch > 0)
player->mo->pitch -= 80;
else if (player->mo->pitch <= -60)
player->mo->pitch += 80;
if (player->mo->Angles.Pitch > 0)
player->mo->Angles.Pitch -= 80;
else if (player->mo->Angles.Pitch <= -60)
player->mo->Angles.Pitch += 80;
//HOW TO MOVE:
if (missile && (player->mo->AproxDistance(missile)<AVOID_DIST)) //try avoid missile got from P_Mobj.c thinking part.
{
Pitch (missile);
angle = player->mo->AngleTo(missile);
angle = player->mo->__f_AngleTo(missile);
cmd->ucmd.sidemove = sleft ? -SIDERUN : SIDERUN;
cmd->ucmd.forwardmove = -FORWARDRUN; //Back IS best.
@ -166,7 +168,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
sleft = !sleft;
}
angle = player->mo->AngleTo(enemy);
angle = player->mo->__f_AngleTo(enemy);
if (player->ReadyWeapon == NULL ||
player->mo->AproxDistance(enemy) >
@ -207,7 +209,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
goto roam;
}
angle = player->mo->AngleTo(mate);
angle = player->mo->__f_AngleTo(mate);
matedist = player->mo->AproxDistance(mate);
if (matedist > (FRIEND_DIST*2))
@ -242,7 +244,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
(pr_botmove()%100)>skill.isp) && player->ReadyWeapon != NULL && !(player->ReadyWeapon->WeaponFlags & WIF_WIMPY_WEAPON))
dest = enemy;//Dont let enemy kill the bot by supressive fire. So charge enemy.
else //hide while t_fight, but keep view at enemy.
angle = player->mo->AngleTo(enemy);
angle = player->mo->__f_AngleTo(enemy);
} //Just a monster, so kill it.
else
dest = enemy;
@ -304,8 +306,8 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
if (t_fight<(AFTERTICS/2))
player->mo->flags |= MF_DROPOFF;
oldx = player->mo->X();
oldy = player->mo->Y();
oldx = player->mo->_f_X();
oldy = player->mo->_f_Y();
}
//BOT_WhatToGet

View file

@ -875,7 +875,7 @@ CCMD(linetarget)
FTranslatedLineTarget t;
if (CheckCheatmode () || players[consoleplayer].mo == NULL) return;
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, &t, 0);
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->Angles.Yaw, MISSILERANGE, &t, 0.);
if (t.linetarget)
{
Printf("Target=%s, Health=%d, Spawnhealth=%d\n",
@ -892,8 +892,8 @@ CCMD(info)
FTranslatedLineTarget t;
if (CheckCheatmode () || players[consoleplayer].mo == NULL) return;
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE,
&t, 0, ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART);
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->Angles.Yaw, MISSILERANGE,
&t, 0., ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART);
if (t.linetarget)
{
Printf("Target=%s, Health=%d, Spawnhealth=%d\n",
@ -903,7 +903,7 @@ CCMD(info)
PrintMiscActorInfo(t.linetarget);
}
else Printf("No target found. Info cannot find actors that have "
"the NOBLOCKMAP flag or have height/radius of 0.\n");
"the NOBLOCKMAP flag or have height/_f_radius() of 0.\n");
}
typedef bool (*ActorTypeChecker) (AActor *);
@ -943,9 +943,8 @@ static void PrintFilteredActorList(const ActorTypeChecker IsActorType, const cha
{
if ((FilterClass == NULL || mo->IsA(FilterClass)) && IsActorType(mo))
{
Printf ("%s at (%d,%d,%d)\n",
mo->GetClass()->TypeName.GetChars(),
mo->X() >> FRACBITS, mo->Y() >> FRACBITS, mo->Z() >> FRACBITS);
Printf ("%s at (%f,%f,%f)\n",
mo->GetClass()->TypeName.GetChars(), mo->X(), mo->Y(), mo->Z());
}
}
}
@ -1087,7 +1086,7 @@ CCMD(currentpos)
if(mo)
{
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
FIXED2DBL(mo->X()), FIXED2DBL(mo->Y()), FIXED2DBL(mo->Z()), ANGLE2DBL(mo->angle), FIXED2DBL(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel);
mo->X(), mo->Y(), mo->Z(), mo->Angles.Yaw, mo->floorz, mo->Sector->sectornum, mo->Sector->lightlevel);
}
else
{

View file

@ -903,7 +903,7 @@ static int PatchThing (int thingy)
}
else if (linelen == 6 && stricmp (Line1, "Height") == 0)
{
info->height = val;
info->Height = FIXED2DBL(val);
info->projectilepassheight = 0; // needs to be disabled
hadHeight = true;
}
@ -915,11 +915,11 @@ static int PatchThing (int thingy)
{
if (stricmp (Line1, "Speed") == 0)
{
info->Speed = val;
info->Speed = val; // handle fixed point later.
}
else if (stricmp (Line1, "Width") == 0)
{
info->radius = val;
info->radius = FIXED2FLOAT(val);
}
else if (stricmp (Line1, "Alpha") == 0)
{
@ -928,7 +928,7 @@ static int PatchThing (int thingy)
}
else if (stricmp (Line1, "Scale") == 0)
{
info->scaleY = info->scaleX = clamp<fixed_t> (FLOAT2FIXED(atof (Line2)), 1, 256*FRACUNIT);
info->Scale.Y = info->Scale.X = clamp(atof (Line2), 1./65536, 256.);
}
else if (stricmp (Line1, "Decal") == 0)
{
@ -1215,7 +1215,7 @@ static int PatchThing (int thingy)
}
if (value[1] & 0x00000001)
{
info->gravity = FRACUNIT/4;
info->Gravity = 1./4;
value[1] &= ~0x00000001;
}
info->flags2 = ActorFlags2::FromInt (value[1]);
@ -1257,7 +1257,7 @@ static int PatchThing (int thingy)
!hadHeight &&
thingy <= (int)OrgHeights.Size() && thingy > 0)
{
info->height = OrgHeights[thingy - 1] * FRACUNIT;
info->Height = OrgHeights[thingy - 1];
info->projectilepassheight = 0;
}
// If the thing's shadow changed, change its fuzziness if not already specified
@ -1278,9 +1278,9 @@ static int PatchThing (int thingy)
}
// 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.
if (abs(info->Speed) < 256)
if (fabs(info->Speed) >= 256)
{
info->Speed <<= FRACBITS;
info->Speed /= FRACUNIT;
}
if (info->flags & MF_SPECIAL)
@ -1342,7 +1342,7 @@ static int PatchSound (int soundNum)
else CHECKKEY ("Zero/One", info->singularity)
else CHECKKEY ("Value", info->priority)
else CHECKKEY ("Zero 1", info->link)
else CHECKKEY ("Neg. One 1", info->pitch)
else CHECKKEY ("Neg. One 1", info->_f_pitch())
else CHECKKEY ("Neg. One 2", info->volume)
else CHECKKEY ("Zero 2", info->data)
else CHECKKEY ("Zero 3", info->usefulness)

View file

@ -2321,7 +2321,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
else
{
const AActor *def = GetDefaultByType (typeinfo);
fixedvec3 spawnpos = source->Vec3Angle(def->radius * 2 + source->radius, source->angle, 8 * FRACUNIT);
fixedvec3 spawnpos = source->_f_Vec3Angle(def->_f_radius() * 2 + source->_f_radius(), source->_f_angle(), 8 * FRACUNIT);
AActor *spawned = Spawn (typeinfo, spawnpos, ALLOW_REPLACE);
if (spawned != NULL)
@ -2348,7 +2348,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
}
if (type >= DEM_SUMMON2 && type <= DEM_SUMMONFOE2)
{
spawned->angle = source->angle - (ANGLE_1 * angle);
spawned->Angles.Yaw = source->Angles.Yaw - angle;
spawned->tid = tid;
spawned->special = special;
for(i = 0; i < 5; i++) {
@ -2366,16 +2366,16 @@ void Net_DoCommand (int type, BYTE **stream, int player)
{
FTraceResults trace;
angle_t ang = players[player].mo->angle >> ANGLETOFINESHIFT;
angle_t pitch = (angle_t)(players[player].mo->pitch) >> ANGLETOFINESHIFT;
angle_t ang = players[player].mo->_f_angle() >> ANGLETOFINESHIFT;
angle_t pitch = (angle_t)(players[player].mo->_f_pitch()) >> ANGLETOFINESHIFT;
fixed_t vx = FixedMul (finecosine[pitch], finecosine[ang]);
fixed_t vy = FixedMul (finecosine[pitch], finesine[ang]);
fixed_t vz = -finesine[pitch];
s = ReadString (stream);
if (Trace (players[player].mo->X(), players[player].mo->Y(),
players[player].mo->Top() - (players[player].mo->height>>2),
if (Trace (players[player].mo->_f_X(), players[player].mo->_f_Y(),
players[player].mo->_f_Top() - (players[player].mo->_f_height()>>2),
players[player].mo->Sector,
vx, vy, vz, 172*FRACUNIT, 0, ML_BLOCKEVERYTHING, players[player].mo,
trace, TRACE_NoSky))
@ -2656,8 +2656,8 @@ void Net_DoCommand (int type, BYTE **stream, int player)
break;
case DEM_SETPITCHLIMIT:
players[player].MinPitch = ReadByte(stream) * -ANGLE_1; // up
players[player].MaxPitch = ReadByte(stream) * ANGLE_1; // down
players[player].MinPitch = -(double)ReadByte(stream); // up
players[player].MaxPitch = (double)ReadByte(stream); // down
break;
case DEM_ADVANCEINTER:

View file

@ -114,7 +114,7 @@ public:
virtual void PlayIdle ();
virtual void PlayRunning ();
virtual void ThrowPoisonBag ();
virtual void TweakSpeeds (int &forwardmove, int &sidemove);
virtual void TweakSpeeds (double &forwardmove, double &sidemove);
virtual void MorphPlayerThink ();
virtual void ActivateMorphWeapon ();
AWeapon *PickNewWeapon (PClassAmmo *ammotype);
@ -149,12 +149,12 @@ public:
TObjPtr<AInventory> InvSel; // selected inventory item
// [GRB] Player class properties
fixed_t JumpZ;
double JumpZ;
fixed_t GruntSpeed;
fixed_t FallingScreamMinSpeed, FallingScreamMaxSpeed;
fixed_t ViewHeight;
fixed_t ForwardMove1, ForwardMove2;
fixed_t SideMove1, SideMove2;
double ForwardMove1, ForwardMove2;
double SideMove1, SideMove2;
FTextureID ScoreIcon;
int SpawnMask;
FNameNoInit MorphWeapon;
@ -292,7 +292,7 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
{
~userinfo_t();
int GetAimDist() const
double GetAimDist() const
{
if (dmflags2 & DF2_NOAUTOAIM)
{
@ -302,11 +302,11 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
float aim = *static_cast<FFloatCVar *>(*CheckKey(NAME_Autoaim));
if (aim > 35 || aim < 0)
{
return ANGLE_1*35;
return 35.;
}
else
{
return xs_RoundToInt(fabs(aim * ANGLE_1));
return aim;
}
}
const char *GetName() const
@ -329,13 +329,13 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
{
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
{
@ -405,13 +405,13 @@ public:
fixed_t viewz; // focal origin above r.z
fixed_t viewheight; // base height above floor for viewz
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)
// 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 avoids anomalies with such things as Boom ice and conveyors.
fixedvec2 vel;
DVector2 Vel;
bool centering;
BYTE turnticks;
@ -488,10 +488,10 @@ public:
FString LogText; // [RH] Log for Strife
int MinPitch; // Viewpitch limits (negative is up, positive is down)
int MaxPitch;
DAngle MinPitch; // Viewpitch limits (negative is up, positive is down)
DAngle MaxPitch;
fixed_t crouchfactor;
double crouchfactor;
fixed_t crouchoffset;
fixed_t crouchviewdelta;
@ -499,7 +499,7 @@ public:
// [CW] I moved these here for multiplayer conversation support.
TObjPtr<AActor> ConversationNPC, ConversationPC;
angle_t ConversationNPCAngle;
DAngle ConversationNPCAngle;
bool ConversationFaceTalker;
fixed_t GetDeltaViewHeight() const
@ -509,9 +509,9 @@ public:
void Uncrouch()
{
if (crouchfactor != FRACUNIT)
if (crouchfactor != 1)
{
crouchfactor = FRACUNIT;
crouchfactor = 1;
crouchoffset = 0;
crouchdir = 0;
crouching = 0;
@ -533,7 +533,7 @@ extern player_t players[MAXPLAYERS];
FArchive &operator<< (FArchive &arc, player_t *&p);
void P_CheckPlayerSprite(AActor *mo, int &spritenum, fixed_t &scalex, fixed_t &scaley);
void P_CheckPlayerSprite(AActor *mo, int &spritenum, DVector2 &scale);
inline void AActor::SetFriendPlayer(player_t *player)
{
@ -556,7 +556,7 @@ inline bool AActor::IsNoClip2() const
return false;
}
#define CROUCHSPEED (FRACUNIT/12)
#define CROUCHSPEED (1./12)
bool P_IsPlayerTotallyFrozen(const player_t *player);

View file

@ -26,6 +26,7 @@
// The most basic types we use, portability.
#include "doomtype.h"
#include "vectors.h"
// Some global defines, that configure the game.
#include "doomdef.h"
@ -357,11 +358,10 @@ struct FMapThing
int special;
int args[5];
int Conversation;
fixed_t gravity;
double Gravity;
fixed_t alpha;
DWORD fillcolor;
fixed_t scaleX;
fixed_t scaleY;
DVector2 Scale;
int health;
int score;
short pitch;

View file

@ -350,7 +350,7 @@ enum
{
BCOMPATF_SETSLOPEOVERFLOW = 1 << 0, // SetSlope things can overflow
BCOMPATF_RESETPLAYERSPEED = 1 << 1, // Set player speed to 1.0 when changing maps
BCOMPATF_VILEGHOSTS = 1 << 2, // Monsters' radius and height aren't restored properly when resurrected.
BCOMPATF_VILEGHOSTS = 1 << 2, // Monsters' _f_radius() and height aren't restored properly when resurrected.
BCOMPATF_BADTELEPORTERS = 1 << 3, // Ignore tags on Teleport specials
BCOMPATF_BADPORTALS = 1 << 4, // Restores the old unstable portal behavior
BCOMPATF_REBUILDNODES = 1 << 5, // Force node rebuild
@ -365,11 +365,14 @@ enum
// linedefs. More friction can create mud, sludge,
// 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 fORIG_FRICTION (ORIG_FRICTION/65536.)
#define ORIG_FRICTION_FACTOR 2048 // original value
#define fORIG_FRICTION_FACTOR (2048/65536.) // original value
#define FRICTION_LOW 0xf900
#define FRICTION_FLY 0xeb00
#define fFRICTION_FLY (0xeb00/65536.)
#define BLINKTHRESHOLD (4*32)

View file

@ -44,7 +44,6 @@
#include "tarray.h"
#include "name.h"
#include "zstring.h"
#include "vectors.h"
class PClassActor;
typedef TMap<int, PClassActor *> FClassMap;
@ -252,10 +251,13 @@ enum ESSType
SS_BGRA
};
#ifndef M_PI
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
// always use our own definition for consistency.
#ifdef M_PI
#undef M_PI
#endif
const double M_PI = 3.14159265358979323846; // matches value in gcc v2 math.h
template <typename T, size_t N>
char ( &_ArraySizeHelper( T (&array)[N] ))[N];

View file

@ -1532,3 +1532,21 @@ FArchive &operator<< (FArchive &arc, side_t *&side)
{
return arc.SerializePointer (sides, (BYTE **)&side, sizeof(*sides));
}
FArchive &operator<<(FArchive &arc, DAngle &ang)
{
arc << ang.Degrees;
return arc;
}
FArchive &operator<<(FArchive &arc, DVector3 &vec)
{
arc << vec.X << vec.Y << vec.Z;
return arc;
}
FArchive &operator<<(FArchive &arc, DVector2 &vec)
{
arc << vec.X << vec.Y;
return arc;
}

View file

@ -324,6 +324,10 @@ FArchive &operator<< (FArchive &arc, line_t *&line);
FArchive &operator<< (FArchive &arc, vertex_t *&vert);
FArchive &operator<< (FArchive &arc, side_t *&side);
FArchive &operator<<(FArchive &arc, DAngle &ang);
FArchive &operator<<(FArchive &arc, DVector3 &vec);
FArchive &operator<<(FArchive &arc, DVector2 &vec);
template<typename T, typename TT>

View file

@ -69,6 +69,7 @@
#include "farchive.h"
#include "p_setup.h"
#include "p_spec.h"
#include "math/cmath.h"
static FRandom pr_script("FScript");
@ -863,7 +864,7 @@ void FParser::SF_Spawn(void)
{
int x, y, z;
PClassActor *pclass;
angle_t angle = 0;
DAngle angle = 0.;
if (CheckArgs(3))
{
@ -889,7 +890,7 @@ void FParser::SF_Spawn(void)
if(t_argc >= 4)
{
angle = intvalue(t_argv[3]) * (SQWORD)ANG45 / 45;
angle = floatvalue(t_argv[3]);
}
t_return.type = svt_mobj;
@ -897,7 +898,7 @@ void FParser::SF_Spawn(void)
if (t_return.value.mobj)
{
t_return.value.mobj->angle = angle;
t_return.value.mobj->Angles.Yaw = angle;
if (!DFraggleThinker::ActiveThinker->nocheckposition)
{
@ -982,8 +983,7 @@ void FParser::SF_ObjX(void)
mo = Script->trigger;
}
t_return.type = svt_fixed; // haleyjd: SoM's fixed-point fix
t_return.value.f = mo ? mo->X() : 0; // null ptr check
t_return.setDouble(mo ? mo->X() : 0.);
}
//==========================================================================
@ -1005,8 +1005,7 @@ void FParser::SF_ObjY(void)
mo = Script->trigger;
}
t_return.type = svt_fixed; // haleyjd
t_return.value.f = mo ? mo->Y() : 0; // null ptr check
t_return.setDouble(mo ? mo->Y() : 0.);
}
//==========================================================================
@ -1028,8 +1027,7 @@ void FParser::SF_ObjZ(void)
mo = Script->trigger;
}
t_return.type = svt_fixed; // haleyjd
t_return.value.f = mo ? mo->Z() : 0; // null ptr check
t_return.setDouble(mo ? mo->Z() : 0.);
}
@ -1052,8 +1050,7 @@ void FParser::SF_ObjAngle(void)
mo = Script->trigger;
}
t_return.type = svt_fixed; // haleyjd: fixed-point -- SoM again :)
t_return.value.f = mo ? (fixed_t)AngleToFixed(mo->angle) : 0; // null ptr check
t_return.setDouble(mo ? mo->Angles.Yaw.Degrees : 0.);
}
@ -1257,10 +1254,9 @@ void FParser::SF_PushThing(void)
AActor * mo = actorvalue(t_argv[0]);
if(!mo) return;
angle_t angle = (angle_t)FixedToAngle(fixedvalue(t_argv[1]));
fixed_t force = fixedvalue(t_argv[2]);
P_ThrustMobj(mo, angle, force);
DAngle angle = floatvalue(t_argv[1]);
double force = floatvalue(t_argv[2]);
mo->Thrust(angle, force);
}
}
@ -1334,11 +1330,10 @@ void FParser::SF_MobjMomx(void)
if(t_argc > 1)
{
if(mo)
mo->vel.x = fixedvalue(t_argv[1]);
mo->Vel.X = floatvalue(t_argv[1]);
}
t_return.type = svt_fixed;
t_return.value.f = mo ? mo->vel.x : 0;
t_return.setDouble(mo ? mo->Vel.X : 0.);
}
}
@ -1357,12 +1352,11 @@ void FParser::SF_MobjMomy(void)
mo = actorvalue(t_argv[0]);
if(t_argc > 1)
{
if(mo)
mo->vel.y = fixedvalue(t_argv[1]);
if(mo)
mo->Vel.Y = floatvalue(t_argv[1]);
}
t_return.type = svt_fixed;
t_return.value.f = mo ? mo->vel.y : 0;
t_return.setDouble(mo ? mo->Vel.Y : 0.);
}
}
@ -1379,14 +1373,13 @@ void FParser::SF_MobjMomz(void)
if (CheckArgs(1))
{
mo = actorvalue(t_argv[0]);
if(t_argc > 1)
if (t_argc > 1)
{
if(mo)
mo->vel.z = fixedvalue(t_argv[1]);
if (mo)
mo->Vel.Z = floatvalue(t_argv[1]);
}
t_return.type = svt_fixed;
t_return.value.f = mo ? mo->vel.z : 0;
t_return.setDouble(mo ? mo->Vel.Z : 0.);
}
}
@ -1431,7 +1424,7 @@ void FParser::SF_PointToDist(void)
double y = floatvalue(t_argv[3]) - floatvalue(t_argv[1]);
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(sqrt(x*x+y*y));
t_return.value.f = FLOAT2FIXED(g_sqrt(x*x+y*y));
}
}
@ -1448,7 +1441,7 @@ void FParser::SF_PointToDist(void)
void FParser::SF_SetCamera(void)
{
angle_t angle;
DAngle angle;
player_t * player;
AActor * newcamera;
@ -1464,20 +1457,14 @@ void FParser::SF_SetCamera(void)
return; // nullptr check
}
angle = t_argc < 2 ? newcamera->angle : (fixed_t)FixedToAngle(fixedvalue(t_argv[1]));
angle = t_argc < 2 ? newcamera->Angles.Yaw : floatvalue(t_argv[1]);
newcamera->special1=newcamera->angle;
newcamera->special2=newcamera->Z();
newcamera->SetZ(t_argc < 3 ? (newcamera->Z() + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS));
newcamera->angle = angle;
if(t_argc < 4) newcamera->pitch = 0;
else
{
fixed_t pitch = fixedvalue(t_argv[3]);
if (pitch < -50 * FRACUNIT) pitch = -50 * FRACUNIT;
if (pitch > 50 * FRACUNIT) pitch = 50 * FRACUNIT;
newcamera->pitch = xs_CRoundToUInt((pitch / 65536.0f)*(ANGLE_45 / 45.0f)*(20.0f / 32.0f));
}
newcamera->specialf1 = newcamera->Angles.Yaw.Degrees;
newcamera->specialf2 = newcamera->Z();
newcamera->SetZ(t_argc < 3 ? newcamera->Z() + 41 : floatvalue(t_argv[2]));
newcamera->Angles.Yaw = angle;
if (t_argc < 4) newcamera->Angles.Pitch = 0.;
else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.);
player->camera=newcamera;
}
}
@ -1498,8 +1485,8 @@ void FParser::SF_ClearCamera(void)
if (cam)
{
player->camera=player->mo;
cam->angle=cam->special1;
cam->SetZ(cam->special2);
cam->Angles.Yaw = cam->specialf1;
cam->SetZ(cam->specialf2);
}
}
@ -3076,7 +3063,8 @@ void FParser::SF_MoveCamera(void)
fixed_t zdist, xydist, movespeed;
fixed_t xstep, ystep, zstep, targetheight;
angle_t anglespeed, anglestep, angledist, targetangle,
mobjangle, bigangle, smallangle;
bigangle, smallangle;
DAngle mobjangle;
// I have to use floats for the math where angles are divided
// by fixed values.
@ -3105,8 +3093,8 @@ void FParser::SF_MoveCamera(void)
anglespeed = (angle_t)FixedToAngle(fixedvalue(t_argv[5]));
// figure out how big one step will be
fixedvec2 dist = cam->Vec2To(target);
zdist = targetheight - cam->Z();
fixedvec2 dist = cam->_f_Vec2To(target);
zdist = targetheight - cam->_f_Z();
// Angle checking...
// 90
@ -3114,15 +3102,16 @@ void FParser::SF_MoveCamera(void)
//180--+--0
// Q2|Q3
// 270
angle_t camangle = cam->Angles.Yaw.BAMs();
quad1 = targetangle / ANG90;
quad2 = cam->angle / ANG90;
bigangle = targetangle > cam->angle ? targetangle : cam->angle;
smallangle = targetangle < cam->angle ? targetangle : cam->angle;
quad2 = camangle / ANG90;
bigangle = targetangle > camangle ? targetangle : camangle;
smallangle = targetangle < camangle ? targetangle : camangle;
if((quad1 > quad2 && quad1 - 1 == quad2) || (quad2 > quad1 && quad2 - 1 == quad1) ||
quad1 == quad2)
{
angledist = bigangle - smallangle;
angledir = targetangle > cam->angle ? 1 : -1;
angledir = targetangle > camangle ? 1 : -1;
}
else
{
@ -3144,19 +3133,19 @@ void FParser::SF_MoveCamera(void)
if(angledist > ANG180)
{
angledist = diff180;
angledir = targetangle > cam->angle ? -1 : 1;
angledir = targetangle > camangle ? -1 : 1;
}
else
angledir = targetangle > cam->angle ? 1 : -1;
angledir = targetangle > camangle ? 1 : -1;
}
}
// set step variables based on distance and speed
mobjangle = cam->AngleTo(target);
xydist = cam->Distance2D(target);
xydist = FLOAT2FIXED(cam->Distance2D(target, true));
xstep = FixedMul(finecosine[mobjangle >> ANGLETOFINESHIFT], movespeed);
ystep = FixedMul(finesine[mobjangle >> ANGLETOFINESHIFT], movespeed);
xstep = (fixed_t)(movespeed * mobjangle.Cos());
ystep = (fixed_t)(movespeed * mobjangle.Sin());
if(xydist && movespeed)
zstep = FixedDiv(zdist, FixedDiv(xydist, movespeed));
@ -3178,18 +3167,18 @@ void FParser::SF_MoveCamera(void)
anglestep = anglespeed;
if(abs(xstep) >= (abs(dist.x) - 1))
x = cam->X() + dist.x;
x = cam->_f_X() + dist.x;
else
{
x = cam->X() + xstep;
x = cam->_f_X() + xstep;
moved = 1;
}
if(abs(ystep) >= (abs(dist.y) - 1))
y = cam->Y() + dist.y;
y = cam->_f_Y() + dist.y;
else
{
y = cam->Y() + ystep;
y = cam->_f_Y() + ystep;
moved = 1;
}
@ -3197,34 +3186,34 @@ void FParser::SF_MoveCamera(void)
z = targetheight;
else
{
z = cam->Z() + zstep;
z = cam->_f_Z() + zstep;
moved = 1;
}
if(anglestep >= angledist)
cam->angle = targetangle;
cam->Angles.Yaw = ANGLE2DBL(targetangle);
else
{
if(angledir == 1)
{
cam->angle += anglestep;
cam->Angles.Yaw += ANGLE2DBL(anglestep);
moved = 1;
}
else if(angledir == -1)
{
cam->angle -= anglestep;
cam->Angles.Yaw -= ANGLE2DBL(anglestep);
moved = 1;
}
}
cam->radius=8;
cam->height=8;
if ((x != cam->X() || y != cam->Y()) && !P_TryMove(cam, x, y, true))
cam->radius = 1 / 8192.;
cam->Height = 1 / 8192.;
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);
return;
}
cam->SetZ(z);
cam->_f_SetZ(z);
t_return.type = svt_int;
t_return.value.i = moved;
@ -3419,8 +3408,8 @@ void FParser::SF_SetObjPosition()
mobj->SetOrigin(
fixedvalue(t_argv[1]),
(t_argc >= 3)? fixedvalue(t_argv[2]) : mobj->Y(),
(t_argc >= 4)? fixedvalue(t_argv[3]) : mobj->Z(), false);
(t_argc >= 3)? fixedvalue(t_argv[2]) : mobj->_f_Y(),
(t_argc >= 4)? fixedvalue(t_argv[3]) : mobj->_f_Z(), false);
}
}
@ -3751,7 +3740,7 @@ void FParser::SF_Resurrect()
return;
mo->SetState(state);
mo->height = mo->GetDefault()->height;
mo->Height = mo->GetDefault()->Height;
mo->radius = mo->GetDefault()->radius;
mo->flags = mo->GetDefault()->flags;
mo->flags2 = mo->GetDefault()->flags2;
@ -3772,14 +3761,15 @@ void FParser::SF_Resurrect()
void FParser::SF_LineAttack()
{
AActor *mo;
int damage, angle, slope;
int damage;
DAngle angle, slope;
if (CheckArgs(3))
{
mo = actorvalue(t_argv[0]);
damage = intvalue(t_argv[2]);
angle = (intvalue(t_argv[1]) * (ANG45 / 45));
angle = floatvalue(t_argv[1]);
slope = P_AimLineAttack(mo, angle, MISSILERANGE);
P_LineAttack(mo, angle, MISSILERANGE, slope, damage, NAME_Hitscan, NAME_BulletPuff);
@ -3830,7 +3820,7 @@ void FParser::SF_Sin()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(sin(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(g_sin(floatvalue(t_argv[0])));
}
}
@ -3840,7 +3830,7 @@ void FParser::SF_ASin()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(asin(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(g_asin(floatvalue(t_argv[0])));
}
}
@ -3850,7 +3840,7 @@ void FParser::SF_Cos()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(cos(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(g_cos(floatvalue(t_argv[0])));
}
}
@ -3860,7 +3850,7 @@ void FParser::SF_ACos()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(acos(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(g_acos(floatvalue(t_argv[0])));
}
}
@ -3870,7 +3860,8 @@ void FParser::SF_Tan()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(tan(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(
g_tan(floatvalue(t_argv[0])));
}
}
@ -3880,7 +3871,7 @@ void FParser::SF_ATan()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(atan(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(g_atan(floatvalue(t_argv[0])));
}
}
@ -3890,7 +3881,7 @@ void FParser::SF_Exp()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(exp(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(g_exp(floatvalue(t_argv[0])));
}
}
@ -3899,7 +3890,7 @@ void FParser::SF_Log()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(log(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(g_log(floatvalue(t_argv[0])));
}
}
@ -3909,7 +3900,7 @@ void FParser::SF_Sqrt()
if (CheckArgs(1))
{
t_return.type = svt_fixed;
t_return.value.f = FLOAT2FIXED(sqrt(floatvalue(t_argv[0])));
t_return.value.f = FLOAT2FIXED(g_sqrt(floatvalue(t_argv[0])));
}
}
@ -4043,7 +4034,7 @@ void FParser::SF_SetCorona(void)
break;
case 6:
lspr[num].dynamic_radius = fval;
lspr[num].dynamic_sqrradius = sqrt(lspr[num].dynamic_radius);
lspr[num].dynamic_sqrradius = g_sqrt(lspr[num].dynamic_radius);
break;
default:
CONS_Printf("Error in setcorona\n");
@ -4109,11 +4100,9 @@ void FParser::SF_MobjRadius(void)
if(t_argc > 1)
{
if(mo)
mo->radius = fixedvalue(t_argv[1]);
mo->radius = floatvalue(t_argv[1]);
}
t_return.type = svt_fixed;
t_return.value.f = mo ? mo->radius : 0;
t_return.setDouble(mo ? mo->radius : 0.);
}
}
@ -4134,11 +4123,9 @@ void FParser::SF_MobjHeight(void)
if(t_argc > 1)
{
if(mo)
mo->height = fixedvalue(t_argv[1]);
mo->Height = floatvalue(t_argv[1]);
}
t_return.type = svt_fixed;
t_return.value.f = mo ? mo->height : 0;
t_return.setDouble(mo ? mo->Height : 0.);
}
}
@ -4287,7 +4274,8 @@ void FParser::SF_SpawnShot2(void)
{
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM);
mo->target = source;
P_ThrustMobj(mo, mo->angle = source->angle, mo->Speed);
mo->Angles.Yaw = source->Angles.Yaw;
mo->Thrust();
if (!P_CheckMissileSpawn(mo, source->radius)) mo = NULL;
}
t_return.value.mobj = mo;

View file

@ -106,6 +106,24 @@ struct svalue_t
string = other.string;
value = other.value;
}
void setInt(int ip)
{
value.i = ip;
type = svt_int;
}
void setFixed(fixed_t fp)
{
value.f = fp;
type = svt_fixed;
}
void setDouble(double dp)
{
value.f = FLOAT2FIXED(dp);
type = svt_fixed;
}
};
int intvalue(const svalue_t & v);

View file

@ -13,7 +13,7 @@
// PIT_VileCheck
// Detect a corpse that could be raised.
//
void A_Fire(AActor *self, int height);
void A_Fire(AActor *self, double height);
//
@ -50,13 +50,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCrackle)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Fire)
{
PARAM_ACTION_PROLOGUE;
PARAM_FIXED_OPT(height) { height = 0; }
PARAM_FLOAT_OPT(height) { height = 0; }
A_Fire(self, height);
return 0;
}
void A_Fire(AActor *self, int height)
void A_Fire(AActor *self, double height)
{
AActor *dest;
@ -68,7 +68,7 @@ void A_Fire(AActor *self, int height)
if (!P_CheckSight (self->target, dest, 0) )
return;
fixedvec3 newpos = dest->Vec3Angle(24 * FRACUNIT, dest->angle, height);
DVector3 newpos = dest->Vec3Angle(24., dest->Angles.Yaw, height);
self->SetOrigin(newpos, true);
}
@ -116,7 +116,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
PARAM_INT_OPT (dmg) { dmg = 20; }
PARAM_INT_OPT (blastdmg) { blastdmg = 70; }
PARAM_INT_OPT (blastrad) { blastrad = 70; }
PARAM_FIXED_OPT (thrust) { thrust = FRACUNIT; }
PARAM_FLOAT_OPT (thrust) { thrust = 1; }
PARAM_NAME_OPT (dmgtype) { dmgtype = NAME_Fire; }
PARAM_INT_OPT (flags) { flags = 0; }
@ -147,14 +147,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
if (fire != NULL)
{
// move the fire between the vile and the player
fixedvec3 pos = target->Vec3Angle(-24 * FRACUNIT, self->angle, 0);
DVector3 pos = target->Vec3Angle(-24., self->Angles.Yaw, 0);
fire->SetOrigin (pos, true);
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);
}
if (!(target->flags7 & MF7_DONTTHRUST))
{
target->vel.z = Scale(thrust, 1000, target->Mass);
target->Vel.Z = thrust * 1000 / MAX(1, target->Mass);
}
return 0;
}

View file

@ -31,13 +31,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainPain)
return 0;
}
static void BrainishExplosion (fixed_t x, fixed_t y, fixed_t z)
static void BrainishExplosion (const DVector3 &pos)
{
AActor *boom = Spawn("Rocket", x, y, z, NO_REPLACE);
AActor *boom = Spawn("Rocket", pos, NO_REPLACE);
if (boom != NULL)
{
boom->DeathSound = "misc/brainexplode";
boom->vel.z = pr_brainscream() << 9;
boom->Vel.Z = pr_brainscream() /128.;
PClassActor *cls = PClass::FindActor("BossBrain");
if (cls != NULL)
@ -57,12 +57,11 @@ static void BrainishExplosion (fixed_t x, fixed_t y, fixed_t z)
DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
{
PARAM_ACTION_PROLOGUE;
fixed_t x;
for (x = self->X() - 196*FRACUNIT; x < self->X() + 320*FRACUNIT; x += 8*FRACUNIT)
for (double x = -196; x < +320; x += 8)
{
BrainishExplosion (x, self->Y() - 320*FRACUNIT,
128 + (pr_brainscream() << (FRACBITS + 1)));
// (1 / 512.) is actually what the original value of 128 did, even though it probably meant 128 map units.
BrainishExplosion(self->Vec2OffsetZ(x, -320, (1 / 512.) + pr_brainexplode() * 2));
}
S_Sound (self, CHAN_VOICE, "brain/death", 1, ATTN_NONE);
return 0;
@ -71,9 +70,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
DEFINE_ACTION_FUNCTION(AActor, A_BrainExplode)
{
PARAM_ACTION_PROLOGUE;
fixed_t x = self->X() + pr_brainexplode.Random2()*2048;
fixed_t z = 128 + pr_brainexplode()*2*FRACUNIT;
BrainishExplosion (x, self->Y(), z);
double x = pr_brainexplode.Random2() / 32.;
DVector3 pos = self->Vec2OffsetZ(x, 0, 1 / 512. + pr_brainexplode() * 2);
BrainishExplosion(pos);
return 0;
}
@ -144,17 +143,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BrainSpit)
spit->master = self;
// [RH] Do this correctly for any trajectory. Doom would divide by 0
// 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;
}
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
{
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
spit->special2 += level.maptime;

View file

@ -47,7 +47,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BarrelDestroy)
if (dmflags2 & DF2_BARRELS_RESPAWN)
{
self->height = self->GetDefault()->height;
self->Height = self->GetDefault()->Height;
self->renderflags |= RF_INVISIBLE;
self->flags &= ~MF_SOLID;
}

View file

@ -30,9 +30,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Punch)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
int damage;
int pitch;
DAngle pitch;
FTranslatedLineTarget t;
if (self->player != NULL)
@ -50,9 +50,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Punch)
if (self->FindInventory<APowerStrength>())
damage *= 10;
angle = self->angle;
angle += pr_punch.Random2() << 18;
angle = self->Angles.Yaw + pr_punch.Random2() * (5.625 / 256);
pitch = P_AimLineAttack (self, angle, MELEERANGE);
P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, LAF_ISMELEEATTACK, &t);
@ -61,7 +59,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Punch)
if (t.linetarget)
{
S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
self->angle = t.angleFromSource;
self->Angles.Yaw = t.angleFromSource;
}
return 0;
}
@ -123,15 +121,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
PARAM_INT_OPT (damage) { damage = 2; }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = NULL; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FIXED_OPT (range) { range = 0; }
PARAM_ANGLE_OPT(spread_xy) { spread_xy = 33554432; /*angle_t(2.8125 * (ANGLE_90 / 90.0));*/ } // The floating point expression does not get optimized away.
PARAM_ANGLE_OPT (spread_z) { spread_z = 0; }
PARAM_FIXED_OPT (lifesteal) { lifesteal = 0; }
PARAM_FLOAT_OPT (range) { range = 0; }
PARAM_DANGLE_OPT(spread_xy) { spread_xy = 2.8125; }
PARAM_DANGLE_OPT(spread_z) { spread_z = 0.; }
PARAM_FLOAT_OPT (lifesteal) { lifesteal = 0; }
PARAM_INT_OPT (lifestealmax) { lifestealmax = 0; }
PARAM_CLASS_OPT (armorbonustype, ABasicArmorBonus) { armorbonustype = NULL; }
angle_t angle;
angle_t slope;
DAngle angle;
DAngle slope;
player_t *player;
FTranslatedLineTarget t;
int actualdamage;
@ -154,12 +152,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
damage *= (pr_saw()%10+1);
}
if (range == 0)
{ // use meleerange + 1 so the puff doesn't skip the flash (i.e. plays all states)
range = MELEERANGE+1;
{
range = SAWRANGE;
}
angle = self->angle + (pr_saw.Random2() * (spread_xy / 255));
slope = P_AimLineAttack (self, angle, range, &t) + (pr_saw.Random2() * (spread_z / 255));
angle = self->Angles.Yaw + spread_xy * (pr_saw.Random2() / 255.);
slope = P_AimLineAttack (self, angle, range, &t) + spread_z * (pr_saw.Random2() / 255.);
AWeapon *weapon = self->player->ReadyWeapon;
if ((weapon != NULL) && !(flags & SF_NOUSEAMMO) && !(!t.linetarget && (flags & SF_NOUSEAMMOMISS)) && !(weapon->WeaponFlags & WIF_DEHAMMO) && ACTION_CALL_FROM_WEAPON())
@ -209,7 +207,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
{
assert(armorbonustype->IsDescendantOf (RUNTIME_CLASS(ABasicArmorBonus)));
ABasicArmorBonus *armorbonus = static_cast<ABasicArmorBonus *>(Spawn(armorbonustype, 0,0,0, NO_REPLACE));
armorbonus->SaveAmount *= (actualdamage * lifesteal) >> FRACBITS;
armorbonus->SaveAmount = int(armorbonus->SaveAmount * actualdamage * lifesteal);
armorbonus->MaxSaveAmount = lifestealmax <= 0 ? armorbonus->MaxSaveAmount : lifestealmax;
armorbonus->flags |= MF_DROPPED;
armorbonus->ClearCounters();
@ -223,7 +221,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
else
{
P_GiveBody (self, (actualdamage * lifesteal) >> FRACBITS, lifestealmax);
P_GiveBody (self, int(actualdamage * lifesteal), lifestealmax);
}
}
@ -232,20 +230,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
// turn to face target
if (!(flags & SF_NOTURN))
{
angle = t.angleFromSource;
if (angle - self->angle > ANG180)
DAngle anglediff = deltaangle(self->Angles.Yaw, t.angleFromSource);
if (anglediff < 0.0)
{
if (angle - self->angle < (angle_t)(-ANG90 / 20))
self->angle = angle + ANG90 / 21;
if (anglediff < -4.5)
self->Angles.Yaw = angle + 90.0 / 21;
else
self->angle -= ANG90 / 20;
self->Angles.Yaw -= 4.5;
}
else
{
if (angle - self->angle > ANG90 / 20)
self->angle = angle - ANG90 / 21;
if (anglediff > 4.5)
self->Angles.Yaw = angle - 90.0 / 21;
else
self->angle += ANG90 / 20;
self->Angles.Yaw += 4.5;
}
}
if (!(flags & SF_NOPULLIN))
@ -278,7 +277,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun)
}
player->mo->PlayAttacking2 ();
angle_t pitch = P_BulletSlope (self);
DAngle pitch = P_BulletSlope (self);
for (i = 0; i < 7; i++)
{
@ -295,7 +294,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2)
PARAM_ACTION_PROLOGUE;
int i;
angle_t angle;
DAngle angle;
int damage;
player_t *player;
@ -315,13 +314,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2)
player->mo->PlayAttacking2 ();
angle_t pitch = P_BulletSlope (self);
DAngle pitch = P_BulletSlope (self);
for (i=0 ; i<20 ; i++)
{
damage = 5*(pr_fireshotgun2()%3+1);
angle = self->angle;
angle += pr_fireshotgun2.Random2() << 19;
angle = self->Angles.Yaw + pr_fireshotgun2.Random2() * (11.25 / 256);
// Doom adjusts the bullet slope by shifting a random number [-255,255]
// left 5 places. At 2048 units away, this means the vertical position
@ -332,7 +330,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2)
P_LineAttack (self,
angle,
PLAYERMISSILERANGE,
pitch + (pr_fireshotgun2.Random2() * 332063), damage,
pitch + pr_fireshotgun2.Random2() * (7.097 / 256), damage,
NAME_Hitscan, NAME_BulletPuff);
}
return 0;
@ -501,10 +499,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireSTGrenade)
}
// Temporarily raise the pitch to send the grenade slightly upwards
fixed_t SavedPlayerPitch = self->pitch;
self->pitch -= (1152 << FRACBITS);
DAngle SavedPlayerPitch = self->Angles.Pitch;
self->Angles.Pitch -= 6.328125; //(1152 << F RACBITS);
P_SpawnPlayerMissile(self, grenade);
self->pitch = SavedPlayerPitch;
self->Angles.Pitch = SavedPlayerPitch;
return 0;
}
@ -619,7 +617,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBFG)
return 0;
}
P_SpawnPlayerMissile (self, 0, 0, 0, PClass::FindActor("BFGBall"), self->angle, NULL, NULL, !!(dmflags2 & DF2_NO_FREEAIMBFG));
P_SpawnPlayerMissile (self, 0, 0, 0, PClass::FindActor("BFGBall"), self->Angles.Yaw, NULL, NULL, !!(dmflags2 & DF2_NO_FREEAIMBFG));
return 0;
}
@ -632,25 +630,25 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT (spraytype, AActor) { spraytype = NULL; }
PARAM_INT_OPT (numrays) { numrays = 40; }
PARAM_INT_OPT (damagecnt) { damagecnt = 15; }
PARAM_ANGLE_OPT (angle) { angle = ANGLE_90; }
PARAM_FIXED_OPT (distance) { distance = 16*64*FRACUNIT; }
PARAM_ANGLE_OPT (vrange) { vrange = 32*ANGLE_1; }
PARAM_INT_OPT (numrays) { numrays = 0; }
PARAM_INT_OPT (damagecnt) { damagecnt = 0; }
PARAM_DANGLE_OPT(angle) { angle = 0.; }
PARAM_FLOAT_OPT (distance) { distance = 0; }
PARAM_DANGLE_OPT(vrange) { vrange = 0.; }
PARAM_INT_OPT (defdamage) { defdamage = 0; }
int i;
int j;
int damage;
angle_t an;
DAngle an;
FTranslatedLineTarget t;
if (spraytype == NULL) spraytype = PClass::FindActor("BFGExtra");
if (numrays <= 0) numrays = 40;
if (damagecnt <= 0) damagecnt = 15;
if (angle == 0) angle = ANG90;
if (distance <= 0) distance = 16 * 64 * FRACUNIT;
if (vrange == 0) vrange = ANGLE_1 * 32;
if (angle == 0) angle = 90.;
if (distance <= 0) distance = 16 * 64;
if (vrange == 0) vrange = 32.;
// [RH] Don't crash if no target
if (!self->target)
@ -659,14 +657,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
// offset angles from its attack angle
for (i = 0; i < numrays; i++)
{
an = self->angle - angle / 2 + angle / numrays*i;
an = self->Angles.Yaw - angle / 2 + angle / numrays*i;
// self->target is the originator (player) of the missile
P_AimLineAttack(self->target, an, distance, &t, vrange);
if (t.linetarget != NULL)
{
AActor *spray = Spawn(spraytype, t.linetarget->PosPlusZ(t.linetarget->height >> 2), ALLOW_REPLACE);
AActor *spray = Spawn(spraytype, t.linetarget->PosPlusZ(t.linetarget->Height / 4), ALLOW_REPLACE);
int dmgFlags = 0;
FName dmgType = NAME_BFGSplash;
@ -696,7 +694,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
damage = defdamage;
}
int newdam = P_DamageMobj(t.linetarget, self->target, self->target, damage, dmgType, dmgFlags|DMG_USEANGLE, t.angleFromSource);
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);
}
}
@ -749,16 +747,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireOldBFG)
self->player->extralight = 2;
// Save values temporarily
angle_t SavedPlayerAngle = self->angle;
fixed_t SavedPlayerPitch = self->pitch;
DAngle SavedPlayerAngle = self->Angles.Yaw;
DAngle SavedPlayerPitch = self->Angles.Pitch;
for (int i = 0; i < 2; i++) // Spawn two plasma balls in sequence
{
self->angle += ((pr_oldbfg()&127) - 64) * (ANG90/768);
self->pitch += ((pr_oldbfg()&127) - 64) * (ANG90/640);
self->Angles.Yaw += ((pr_oldbfg()&127) - 64) * (90./768);
self->Angles.Pitch += ((pr_oldbfg()&127) - 64) * (90./640);
mo = P_SpawnPlayerMissile (self, plasma[i]);
// Restore saved values
self->angle = SavedPlayerAngle;
self->pitch = SavedPlayerPitch;
self->Angles.Yaw = SavedPlayerAngle;
self->Angles.Pitch = SavedPlayerPitch;
}
if (doesautoaim && weapon != NULL)
{ // Restore autoaim setting

View file

@ -15,7 +15,7 @@
// firing three missiles in three different directions?
// Doesn't look like it.
//
#define FATSPREAD (ANG90/8)
#define FATSPREAD (90./8)
DEFINE_ACTION_FUNCTION(AActor, A_FatRaise)
{
@ -32,7 +32,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack1)
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
AActor *missile;
angle_t an;
if (!self->target)
return 0;
@ -41,16 +40,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack1)
A_FaceTarget (self);
// Change direction to ...
self->angle += FATSPREAD;
self->Angles.Yaw += FATSPREAD;
P_SpawnMissile (self, self->target, spawntype);
missile = P_SpawnMissile (self, self->target, spawntype);
if (missile != NULL)
{
missile->angle += FATSPREAD;
an = missile->angle >> ANGLETOFINESHIFT;
missile->vel.x = FixedMul (missile->Speed, finecosine[an]);
missile->vel.y = FixedMul (missile->Speed, finesine[an]);
missile->Angles.Yaw += FATSPREAD;
missile->VelFromAngle();
}
return 0;
}
@ -61,7 +58,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack2)
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
AActor *missile;
angle_t an;
if (!self->target)
return 0;
@ -70,16 +66,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack2)
A_FaceTarget (self);
// Now here choose opposite deviation.
self->angle -= FATSPREAD;
self->Angles.Yaw -= FATSPREAD;
P_SpawnMissile (self, self->target, spawntype);
missile = P_SpawnMissile (self, self->target, spawntype);
if (missile != NULL)
{
missile->angle -= FATSPREAD*2;
an = missile->angle >> ANGLETOFINESHIFT;
missile->vel.x = FixedMul (missile->Speed, finecosine[an]);
missile->vel.y = FixedMul (missile->Speed, finesine[an]);
missile->Angles.Yaw -= FATSPREAD*2;
missile->VelFromAngle();
}
return 0;
}
@ -90,7 +84,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3)
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
AActor *missile;
angle_t an;
if (!self->target)
return 0;
@ -102,19 +95,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3)
missile = P_SpawnMissile (self, self->target, spawntype);
if (missile != NULL)
{
missile->angle -= FATSPREAD/2;
an = missile->angle >> ANGLETOFINESHIFT;
missile->vel.x = FixedMul (missile->Speed, finecosine[an]);
missile->vel.y = FixedMul (missile->Speed, finesine[an]);
missile->Angles.Yaw -= FATSPREAD/2;
missile->VelFromAngle();
}
missile = P_SpawnMissile (self, self->target, spawntype);
if (missile != NULL)
{
missile->angle += FATSPREAD/2;
an = missile->angle >> ANGLETOFINESHIFT;
missile->vel.x = FixedMul (missile->Speed, finecosine[an]);
missile->vel.y = FixedMul (missile->Speed, finesine[an]);
missile->Angles.Yaw += FATSPREAD/2;
missile->VelFromAngle();
}
return 0;
}
@ -137,8 +126,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
PARAM_CLASS_OPT (spawntype, AActor) { spawntype = NULL; }
PARAM_INT_OPT (n) { n = 0; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FIXED_OPT (vrange) { vrange = 4*FRACUNIT; }
PARAM_FIXED_OPT (hrange) { hrange = FRACUNIT/2; }
PARAM_FLOAT_OPT (vrange) { vrange = 4; }
PARAM_FLOAT_OPT (hrange) { hrange = 0.5; }
int i, j;
@ -152,20 +141,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
}
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, (flags & MSF_DontHurt) ? 0 : RADF_HURTSOURCE);
P_CheckSplash(self, 128<<FRACBITS);
P_CheckSplash(self, 128.);
// Now launch mushroom cloud
AActor *target = Spawn("Mapspot", self->Pos(), NO_REPLACE); // We need something to aim at.
AActor *master = (flags & MSF_DontHurt) ? (AActor*)(self->target) : self;
target->height = self->height;
target->Height = self->Height;
for (i = -n; i <= n; i += 8)
{
for (j = -n; j <= n; j += 8)
{
AActor *mo;
target->SetXYZ(
self->X() + (i << FRACBITS), // Aim in many directions from source
self->Y() + (j << FRACBITS),
self->X() + i, // Aim in many directions from source
self->Y() + j,
self->Z() + (P_AproxDistance(i,j) * vrange)); // Aim up fairly high
if ((flags & MSF_Classic) || // Flag explicitely set, or no flags and compat options
(flags == 0 && (self->state->DefineFlags & SDF_DEHACKED) && (i_compatflags & COMPATF_MUSHROOM)))
@ -178,9 +167,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
}
if (mo != NULL)
{ // Slow it down a bit
mo->vel.x = FixedMul(mo->vel.x, hrange);
mo->vel.y = FixedMul(mo->vel.y, hrange);
mo->vel.z = FixedMul(mo->vel.z, hrange);
mo->Vel *= hrange;
mo->flags &= ~MF_NOGRAVITY; // Make debris fall under gravity
}
}

View file

@ -35,7 +35,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KeenDie)
}
}
EV_DoDoor (DDoor::doorOpen, NULL, NULL, doortag, 2*FRACUNIT, 0, 0, 0);
EV_DoDoor (DDoor::doorOpen, NULL, NULL, doortag, 2., 0, 0, 0);
return 0;
}

View file

@ -19,12 +19,9 @@
// Fly at the player like a missile.
//
void A_SkullAttack(AActor *self, fixed_t speed)
void A_SkullAttack(AActor *self, double speed)
{
AActor *dest;
angle_t an;
int dist;
if (!self->target)
return;
@ -33,21 +30,14 @@ void A_SkullAttack(AActor *self, fixed_t speed)
S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM);
A_FaceTarget (self);
an = self->angle >> ANGLETOFINESHIFT;
self->vel.x = FixedMul (speed, finecosine[an]);
self->vel.y = FixedMul (speed, finesine[an]);
dist = self->AproxDistance (dest);
dist = dist / speed;
if (dist < 1)
dist = 1;
self->vel.z = (dest->Z() + (dest->height>>1) - self->Z()) / dist;
self->VelFromAngle(speed);
self->Vel.Z = (dest->Center() - self->Z()) / self->DistanceBySpeed(dest, speed);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullAttack)
{
PARAM_ACTION_PROLOGUE;
PARAM_FIXED_OPT(speed) { speed = SKULLSPEED; }
PARAM_FLOAT_OPT(speed) { speed = SKULLSPEED; }
if (speed <= 0)
speed = SKULLSPEED;

View file

@ -10,8 +10,6 @@
#include "doomstat.h"
*/
DECLARE_ACTION(A_SkullAttack)
enum PA_Flags
{
PAF_NOSKULLATTACK = 1,
@ -23,21 +21,21 @@ enum PA_Flags
// A_PainShootSkull
// Spawn a lost soul and launch it at the target
//
void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int flags = 0, int limit = -1)
void A_PainShootSkull (AActor *self, DAngle Angle, PClassActor *spawntype, int flags = 0, int limit = -1)
{
AActor *other;
int prestep;
double prestep;
if (spawntype == NULL) spawntype = PClass::FindActor("LostSoul");
assert(spawntype != NULL);
if (self->DamageType == NAME_Massacre) return;
// [RH] check to make sure it's not too close to the ceiling
if (self->Top() + 8*FRACUNIT > self->ceilingz)
if (self->Top() + 8 > self->ceilingz)
{
if (self->flags & MF_FLOAT)
{
self->vel.z -= 2*FRACUNIT;
self->Vel.Z -= 2;
self->flags |= MF_INFLOAT;
self->flags4 |= MF4_VFRICTION;
}
@ -64,14 +62,13 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
}
// okay, there's room for another one
prestep = 4*FRACUNIT +
3*(self->radius + GetDefaultByType(spawntype)->radius)/2;
prestep = 4 + (self->radius + GetDefaultByType(spawntype)->radius) * 1.5;
// NOTE: The following code contains some advance work for line-to-line portals which is currenty inactive.
fixedvec2 dist = Vec2Angle(prestep, angle);
fixedvec3 pos = self->Vec3Offset(dist.x, dist.y, 8 * FRACUNIT, true);
fixedvec3 src = self->Pos();
DVector2 dist = Angle.ToVector(prestep);
DVector3 pos = self->Vec3Offset(dist.X, dist.Y, 8., true);
DVector3 src = self->Pos();
for (int i = 0; i < 2; i++)
{
@ -79,7 +76,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
// wall or an impassible line, or a "monsters can't cross" line.// |
// If it is, then we don't allow the spawn. // V
FBoundingBox box(MIN(src.x, pos.x), MIN(src.y, pos.y), MAX(src.x, pos.x), MAX(src.y, pos.y));
FBoundingBox box(MIN(src.X, pos.X), MIN(src.Y, pos.Y), MAX(src.X, pos.X), MAX(src.Y, pos.Y));
FBlockLinesIterator it(box);
line_t *ld;
bool inportal = false;
@ -88,8 +85,8 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
{
if (ld->isLinePortal() && i == 0)
{
if (P_PointOnLineSidePrecise(src.x, src.y, ld) == 0 &&
P_PointOnLineSidePrecise(pos.x, pos.y, ld) == 1)
if (P_PointOnLineSidePrecise(src, ld) == 0 &&
P_PointOnLineSidePrecise(pos, ld) == 1)
{
// crossed a portal line from front to back, we need to repeat the check on the other side as well.
inportal = true;
@ -98,12 +95,9 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
else if (!(ld->flags & ML_TWOSIDED) ||
(ld->flags & (ML_BLOCKING | ML_BLOCKMONSTERS | ML_BLOCKEVERYTHING)))
{
if (!(box.Left() > ld->bbox[BOXRIGHT] ||
box.Right() < ld->bbox[BOXLEFT] ||
box.Top() < ld->bbox[BOXBOTTOM] ||
box.Bottom() > ld->bbox[BOXTOP]))
if (box.inRange(ld))
{
if (P_PointOnLineSidePrecise(src.x, src.y, ld) != P_PointOnLineSidePrecise(pos.x, pos.y, ld))
if (P_PointOnLineSidePrecise(src, ld) != P_PointOnLineSidePrecise(pos, ld))
return; // line blocks trajectory // ^
}
}
@ -111,20 +105,19 @@ void A_PainShootSkull (AActor *self, angle_t angle, PClassActor *spawntype, int
if (!inportal) break;
// recalculate position and redo the check on the other side of the portal
pos = self->Vec3Offset(dist.x, dist.y, 8 * FRACUNIT);
src.x = pos.x - dist.x;
src.y = pos.y - dist.y;
pos = self->Vec3Offset(dist.X, dist.Y, 8.);
src.X = pos.X - dist.X;
src.Y = pos.Y - dist.Y;
}
other = Spawn (spawntype, pos.x, pos.y, pos.z, ALLOW_REPLACE);
other = Spawn (spawntype, pos, ALLOW_REPLACE);
// 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.
if ((other->Top() >
(other->Sector->HighestCeilingAt(other))) ||
(other->Z() < other->Sector->LowestFloorAt(other)))
if (other->Top() > other->Sector->HighestCeilingAt(other) ||
other->Z() < other->Sector->LowestFloorAt(other))
{
// kill it immediately
P_DamageMobj (other, self, self, TELEFRAG_DAMAGE, NAME_None);// ^
@ -160,13 +153,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainAttack)
return 0;
PARAM_CLASS_OPT (spawntype, AActor) { spawntype = NULL; }
PARAM_ANGLE_OPT (angle) { angle = 0; }
PARAM_DANGLE_OPT (angle) { angle = 0.; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_INT_OPT (limit) { limit = -1; }
if (!(flags & PAF_AIMFACING))
A_FaceTarget (self);
A_PainShootSkull (self, self->angle+angle, spawntype, flags, limit);
A_PainShootSkull (self, self->Angles.Yaw + angle, spawntype, flags, limit);
return 0;
}
@ -179,8 +172,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DualPainAttack)
return 0;
A_FaceTarget (self);
A_PainShootSkull (self, self->angle + ANG45, spawntype);
A_PainShootSkull (self, self->angle - ANG45, spawntype);
A_PainShootSkull (self, self->Angles.Yaw + 45., spawntype);
A_PainShootSkull (self, self->Angles.Yaw - 45., spawntype);
return 0;
}
@ -194,8 +187,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainDie)
self->flags &= ~MF_FRIENDLY;
}
A_Unblock(self, true);
A_PainShootSkull (self, self->angle + ANG90, spawntype);
A_PainShootSkull (self, self->angle + ANG180, spawntype);
A_PainShootSkull (self, self->angle + ANG270, spawntype);
A_PainShootSkull (self, self->Angles.Yaw + 90, spawntype);
A_PainShootSkull (self, self->Angles.Yaw + 180, spawntype);
A_PainShootSkull (self, self->Angles.Yaw + 270, spawntype);
return 0;
}

View file

@ -22,19 +22,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_PosAttack)
{
PARAM_ACTION_PROLOGUE;
int angle;
int damage;
int slope;
DAngle angle;
DAngle slope;
if (!self->target)
return 0;
A_FaceTarget (self);
angle = self->angle;
angle = self->Angles.Yaw;
slope = P_AimLineAttack (self, angle, MISSILERANGE);
S_Sound (self, CHAN_WEAPON, "grunt/attack", 1, ATTN_NORM);
angle += pr_posattack.Random2() << 20;
angle += pr_posattack.Random2() * (22.5 / 256);
damage = ((pr_posattack()%5)+1)*3;
P_LineAttack (self, angle, MISSILERANGE, slope, damage, NAME_Hitscan, NAME_BulletPuff);
return 0;
@ -43,16 +43,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_PosAttack)
static void A_SPosAttack2 (AActor *self)
{
int i;
int bangle;
int slope;
DAngle bangle;
DAngle slope;
A_FaceTarget (self);
bangle = self->angle;
bangle = self->Angles.Yaw;
slope = P_AimLineAttack (self, bangle, MISSILERANGE);
for (i=0 ; i<3 ; i++)
{
int angle = bangle + (pr_sposattack.Random2() << 20);
DAngle angle = bangle + pr_sposattack.Random2() * (22.5 / 256);
int damage = ((pr_sposattack()%5)+1)*3;
P_LineAttack(self, angle, MISSILERANGE, slope, damage, NAME_Hitscan, NAME_BulletPuff);
}
@ -88,10 +88,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CPosAttack)
{
PARAM_ACTION_PROLOGUE;
int angle;
int bangle;
DAngle angle;
DAngle bangle;
int damage;
int slope;
DAngle slope;
if (!self->target)
return 0;
@ -104,10 +104,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CPosAttack)
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
A_FaceTarget (self);
bangle = self->angle;
bangle = self->Angles.Yaw;
slope = P_AimLineAttack (self, bangle, MISSILERANGE);
angle = bangle + (pr_cposattack.Random2() << 20);
angle = bangle + pr_cposattack.Random2() * (22.5 / 256);
damage = ((pr_cposattack()%5)+1)*3;
P_LineAttack (self, angle, MISSILERANGE, slope, damage, NAME_Hitscan, NAME_BulletPuff);
return 0;

View file

@ -28,27 +28,26 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkelMissile)
return 0;
A_FaceTarget (self);
self->AddZ(16*FRACUNIT);
missile = P_SpawnMissile (self, self->target, PClass::FindActor("RevenantTracer"));
self->AddZ(-16*FRACUNIT);
self->AddZ(16.);
missile = P_SpawnMissile(self, self->target, PClass::FindActor("RevenantTracer"));
self->AddZ(-16.);
if (missile != NULL)
{
missile->SetOrigin(missile->Vec3Offset(missile->vel.x, missile->vel.y, 0), false);
missile->SetOrigin(missile->Vec3Offset(missile->Vel.X, missile->Vel.Y, 0.), false);
missile->tracer = self->target;
}
return 0;
}
#define TRACEANGLE (0xc000000)
#define TRACEANGLE (16.875)
DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
{
PARAM_ACTION_PROLOGUE;
angle_t exact;
fixed_t dist;
fixed_t slope;
double dist;
double slope;
AActor *dest;
AActor *smoke;
@ -65,11 +64,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
return 0;
// spawn a puff of smoke behind the rocket
P_SpawnPuff (self, PClass::FindActor(NAME_BulletPuff), self->Pos(), self->angle, self->angle, 3);
P_SpawnPuff (self, PClass::FindActor(NAME_BulletPuff), self->Pos(), self->Angles.Yaw, self->Angles.Yaw, 3);
smoke = Spawn ("RevenantTracerSmoke", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE);
smoke = Spawn ("RevenantTracerSmoke", self->Vec3Offset(-self->Vel.X, -self->Vel.Y, 0.), ALLOW_REPLACE);
smoke->vel.z = FRACUNIT;
smoke->Vel.Z = 1.;
smoke->tics -= pr_tracer()&3;
if (smoke->tics < 1)
smoke->tics = 1;
@ -81,49 +80,42 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
return 0;
// change angle
exact = self->AngleTo(dest);
DAngle exact = self->AngleTo(dest);
DAngle diff = deltaangle(self->Angles.Yaw, exact);
if (exact != self->angle)
if (diff < 0)
{
if (exact - self->angle > 0x80000000)
{
self->angle -= TRACEANGLE;
if (exact - self->angle < 0x80000000)
self->angle = exact;
}
else
{
self->angle += TRACEANGLE;
if (exact - self->angle > 0x80000000)
self->angle = exact;
}
self->Angles.Yaw -= TRACEANGLE;
if (deltaangle(self->Angles.Yaw, exact) > 0)
self->Angles.Yaw = exact;
}
exact = self->angle>>ANGLETOFINESHIFT;
self->vel.x = FixedMul (self->Speed, finecosine[exact]);
self->vel.y = FixedMul (self->Speed, finesine[exact]);
else if (diff > 0)
{
self->Angles.Yaw += TRACEANGLE;
if (deltaangle(self->Angles.Yaw, exact) < 0.)
self->Angles.Yaw = exact;
}
self->VelFromAngle();
if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{
// change slope
dist = self->AproxDistance (dest) / self->Speed;
dist = self->DistanceBySpeed(dest, self->Speed);
if (dist < 1)
dist = 1;
if (dest->height >= 56*FRACUNIT)
if (dest->Height >= 56.)
{
slope = (dest->Z()+40*FRACUNIT - self->Z()) / dist;
slope = (dest->Z() + 40. - self->Z()) / dist;
}
else
{
slope = (dest->Z() + self->height*2/3 - self->Z()) / dist;
slope = (dest->Z() + self->Height*(2./3) - self->Z()) / dist;
}
if (slope < self->vel.z)
self->vel.z -= FRACUNIT/8;
if (slope < self->Vel.Z)
self->Vel.Z -= 1. / 8;
else
self->vel.z += FRACUNIT/8;
self->Vel.Z += 1. / 8;
}
return 0;
}

View file

@ -275,14 +275,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
A_FaceTarget (self);
if (self->CheckMeleeRange ())
{
angle_t angle;
DAngle angle;
FTranslatedLineTarget t;
damage *= (pr_m_saw()%10+1);
angle = self->angle + (pr_m_saw.Random2() << 18);
angle = self->Angles.Yaw + pr_m_saw.Random2() * (5.625 / 256);
P_LineAttack (self, angle, MELEERANGE+1,
P_AimLineAttack (self, angle, MELEERANGE+1), damage,
P_LineAttack (self, angle, SAWRANGE,
P_AimLineAttack (self, angle, SAWRANGE), damage,
NAME_Melee, pufftype, false, &t);
if (!t.linetarget)
@ -294,19 +294,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
// turn to face target
angle = t.angleFromSource;
if (angle - self->angle > ANG180)
DAngle anglediff = deltaangle(self->Angles.Yaw, angle);
if (anglediff < 0.0)
{
if (angle - self->angle < (angle_t)(-ANG90/20))
self->angle = angle + ANG90/21;
if (anglediff < -4.5)
self->Angles.Yaw = angle + 90.0 / 21;
else
self->angle -= ANG90/20;
self->Angles.Yaw -= 4.5;
}
else
{
if (angle - self->angle > ANG90/20)
self->angle = angle - ANG90/21;
if (anglediff > 4.5)
self->Angles.Yaw = angle - 90.0 / 21;
else
self->angle += ANG90/20;
self->Angles.Yaw += 4.5;
}
}
else
@ -325,9 +327,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
static void MarinePunch(AActor *self, int damagemul)
{
angle_t angle;
DAngle angle;
int damage;
int pitch;
DAngle pitch;
FTranslatedLineTarget t;
if (self->target == NULL)
@ -336,7 +338,7 @@ static void MarinePunch(AActor *self, int damagemul)
damage = ((pr_m_punch()%10+1) << 1) * damagemul;
A_FaceTarget (self);
angle = self->angle + (pr_m_punch.Random2() << 18);
angle = self->Angles.Yaw + pr_m_punch.Random2() * (5.625 / 256);
pitch = P_AimLineAttack (self, angle, MELEERANGE);
P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, true, &t);
@ -344,7 +346,7 @@ static void MarinePunch(AActor *self, int damagemul)
if (t.linetarget)
{
S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
self->angle = t.angleFromSource;
self->Angles.Yaw = t.angleFromSource;
}
}
@ -363,17 +365,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Punch)
//
//============================================================================
void P_GunShot2 (AActor *mo, bool accurate, int pitch, PClassActor *pufftype)
void P_GunShot2 (AActor *mo, bool accurate, DAngle pitch, PClassActor *pufftype)
{
angle_t angle;
DAngle angle;
int damage;
damage = 5*(pr_m_gunshot()%3+1);
angle = mo->angle;
angle = mo->Angles.Yaw;
if (!accurate)
{
angle += pr_m_gunshot.Random2 () << 18;
angle += pr_m_gunshot.Random2() * (5.625 / 256);
}
P_LineAttack (mo, angle, MISSILERANGE, pitch, damage, NAME_Hitscan, pufftype);
@ -395,7 +397,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FirePistol)
S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE),
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE),
PClass::FindActor(NAME_BulletPuff));
return 0;
}
@ -410,14 +412,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun)
{
PARAM_ACTION_PROLOGUE;
int pitch;
DAngle pitch;
if (self->target == NULL)
return 0;
S_Sound (self, CHAN_WEAPON, "weapons/shotgf", 1, ATTN_NORM);
A_FaceTarget (self);
pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
pitch = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE);
for (int i = 0; i < 7; ++i)
{
P_GunShot2 (self, false, pitch, PClass::FindActor(NAME_BulletPuff));
@ -457,21 +459,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun2)
{
PARAM_ACTION_PROLOGUE;
int pitch;
DAngle pitch;
if (self->target == NULL)
return 0;
S_Sound (self, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM);
A_FaceTarget (self);
pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
pitch = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE);
for (int i = 0; i < 20; ++i)
{
int damage = 5*(pr_m_fireshotgun2()%3+1);
angle_t angle = self->angle + (pr_m_fireshotgun2.Random2() << 19);
DAngle angle = self->Angles.Yaw + pr_m_fireshotgun2.Random2() * (11.25 / 256);
P_LineAttack (self, angle, MISSILERANGE,
pitch + (pr_m_fireshotgun2.Random2() * 332063), damage,
pitch + pr_m_fireshotgun2.Random2() * (7.097 / 256), damage,
NAME_Hitscan, NAME_BulletPuff);
}
self->special1 = level.maptime;
@ -494,7 +496,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FireCGun)
S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE),
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE),
PClass::FindActor(NAME_BulletPuff));
return 0;
}
@ -647,13 +649,11 @@ void AScriptedMarine::SetSprite (PClassActor *source)
{ // A valid actor class wasn't passed, so use the standard sprite
SpriteOverride = sprite = GetClass()->OwnedStates[0].sprite;
// Copy the standard scaling
scaleX = GetDefault()->scaleX;
scaleY = GetDefault()->scaleY;
Scale = GetDefault()->Scale;
}
else
{ // Use the same sprite and scaling the passed class spawns with
SpriteOverride = sprite = GetDefaultByType (source)->SpawnState->sprite;
scaleX = GetDefaultByType(source)->scaleX;
scaleY = GetDefaultByType(source)->scaleY;
Scale = GetDefaultByType(source)->Scale;
}
}

View file

@ -1182,8 +1182,8 @@ void G_Ticker ()
}
if (players[i].mo)
{
DWORD sum = rngsum + players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z()
+ players[i].mo->angle + players[i].mo->pitch;
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();
sum ^= players[i].health;
consistancy[i][buf] = sum;
}
@ -1443,13 +1443,13 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
if (!players[playernum].mo)
{ // first spawn of level, before corpses
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 true;
}
oldz = players[playernum].mo->Z(); // [RH] Need to save corpse's z-height
players[playernum].mo->SetZ(z); // [RH] Checks are now full 3-D
oldz = players[playernum].mo->_f_Z(); // [RH] Need to save corpse's z-height
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
// 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;
i = P_CheckPosition(players[playernum].mo, x, y);
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)
return false;
@ -1645,8 +1645,8 @@ static void G_QueueBody (AActor *body)
const AActor *const defaultActor = body->GetDefault();
const FPlayerSkin &skin = skins[skinidx];
body->scaleX = Scale(body->scaleX, skin.ScaleX, defaultActor->scaleX);
body->scaleY = Scale(body->scaleY, skin.ScaleY, defaultActor->scaleY);
body->Scale.X *= skin.Scale.X / defaultActor->Scale.X;
body->Scale.Y *= skin.Scale.Y / defaultActor->Scale.Y;
}
bodyqueslot++;

View file

@ -41,13 +41,13 @@ void AChickenPlayer::MorphPlayerThink ()
{
return;
}
if (!(vel.x | vel.y) && pr_chickenplayerthink () < 160)
if (Vel.X == 0 && Vel.Y == 0 && pr_chickenplayerthink () < 160)
{ // Twitch view angle
angle += pr_chickenplayerthink.Random2 () << 19;
Angles.Yaw += pr_chickenplayerthink.Random2() * (360. / 256. / 32.);
}
if ((Z() <= floorz) && (pr_chickenplayerthink() < 32))
{ // Jump and noise
vel.z += JumpZ;
Vel.Z += JumpZ;
FState * painstate = FindState(NAME_Pain);
if (painstate != NULL) SetState (painstate);
@ -105,11 +105,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_Feathers)
}
for (i = 0; i < count; i++)
{
mo = Spawn("Feather", self->PosPlusZ(20*FRACUNIT), NO_REPLACE);
mo = Spawn("Feather", self->PosPlusZ(20.), NO_REPLACE);
mo->target = self;
mo->vel.x = pr_feathers.Random2() << 8;
mo->vel.y = pr_feathers.Random2() << 8;
mo->vel.z = FRACUNIT + (pr_feathers() << 9);
mo->Vel.X = pr_feathers.Random2() / 256.;
mo->Vel.Y = pr_feathers.Random2() / 256.;
mo->Vel.Z = 1. + pr_feathers() / 128.;
mo->SetState (mo->SpawnState + (pr_feathers()&7));
}
return 0;
@ -125,8 +125,7 @@ void P_UpdateBeak (AActor *self)
{
if (self->player != NULL)
{
self->player->psprites[ps_weapon].sy = WEAPONTOP +
(self->player->chickenPeck << (FRACBITS-1));
self->player->psprites[ps_weapon].sy = WEAPONTOP + self->player->chickenPeck / 2;
}
}
@ -172,9 +171,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL1)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
int damage;
int slope;
DAngle slope;
player_t *player;
FTranslatedLineTarget t;
@ -184,12 +183,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL1)
}
damage = 1 + (pr_beakatkpl1()&3);
angle = player->mo->angle;
angle = player->mo->Angles.Yaw;
slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t);
if (t.linetarget)
{
player->mo->angle = t.angleFromSource;
player->mo->Angles.Yaw = t.angleFromSource;
}
P_PlayPeck (player->mo);
player->chickenPeck = 12;
@ -207,9 +206,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
int damage;
int slope;
DAngle slope;
player_t *player;
FTranslatedLineTarget t;
@ -219,12 +218,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2)
}
damage = pr_beakatkpl2.HitDice (4);
angle = player->mo->angle;
angle = player->mo->Angles.Yaw;
slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t);
if (t.linetarget)
{
player->mo->angle = t.angleFromSource;
player->mo->Angles.Yaw = t.angleFromSource;
}
P_PlayPeck (player->mo);
player->chickenPeck = 12;

View file

@ -67,8 +67,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
PARAM_ACTION_PROLOGUE;
AActor *mo;
fixed_t vz;
angle_t angle;
DAngle angle;
if (!self->target)
{
@ -86,17 +85,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
PClassActor *fx = PClass::FindActor("SorcererFX1");
if (self->health > (self->SpawnHealth()/3)*2)
{ // Spit one fireball
P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT, self->target, fx );
P_SpawnMissileZ (self, self->Z() + 48, self->target, fx );
}
else
{ // Spit three fireballs
mo = P_SpawnMissileZ (self, self->Z() + 48*FRACUNIT, self->target, fx);
mo = P_SpawnMissileZ (self, self->Z() + 48, self->target, fx);
if (mo != NULL)
{
vz = mo->vel.z;
angle = mo->angle;
P_SpawnMissileAngleZ (self, self->Z() + 48*FRACUNIT, fx, angle-ANGLE_1*3, vz);
P_SpawnMissileAngleZ (self, self->Z() + 48*FRACUNIT, fx, angle+ANGLE_1*3, vz);
angle = mo->Angles.Yaw;
P_SpawnMissileAngleZ(self, self->Z() + 48, fx, angle - 3, mo->Vel.Z);
P_SpawnMissileAngleZ(self, self->Z() + 48, fx, angle + 3, mo->Vel.Z);
}
if (self->health < self->SpawnHealth()/3)
{ // Maybe attack again
@ -130,7 +128,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcererRise)
mo = Spawn("Sorcerer2", self->Pos(), ALLOW_REPLACE);
mo->Translation = self->Translation;
mo->SetState (mo->FindState("Rise"));
mo->angle = self->angle;
mo->Angles.Yaw = self->Angles.Yaw;
mo->CopyFriendliness (self, true);
return 0;
}
@ -143,31 +141,27 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcererRise)
void P_DSparilTeleport (AActor *actor)
{
fixed_t prevX;
fixed_t prevY;
fixed_t prevZ;
DVector3 prev;
AActor *mo;
AActor *spot;
DSpotState *state = DSpotState::GetSpotState();
if (state == NULL) return;
spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->X(), actor->Y(), 128*FRACUNIT, 0);
spot = state->GetSpotWithMinMaxDistance(PClass::FindClass("BossSpot"), actor->X(), actor->Y(), 128, 0);
if (spot == NULL) return;
prevX = actor->X();
prevY = actor->Y();
prevZ = actor->Z();
prev = actor->Pos();
if (P_TeleportMove (actor, spot->Pos(), false))
{
mo = Spawn("Sorcerer2Telefade", prevX, prevY, prevZ, ALLOW_REPLACE);
mo = Spawn("Sorcerer2Telefade", prev, ALLOW_REPLACE);
if (mo) mo->Translation = actor->Translation;
S_Sound (mo, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->SetState (actor->FindState("Teleport"));
S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->SetZ(actor->floorz, false);
actor->angle = spot->angle;
actor->vel.x = actor->vel.y = actor->vel.z = 0;
actor->SetZ(actor->floorz);
actor->Angles.Yaw = spot->Angles.Yaw;
actor->Vel.Zero();
}
}
@ -230,8 +224,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr2Attack)
PClassActor *fx = PClass::FindActor("Sorcerer2FX2");
if (fx)
{
P_SpawnMissileAngle (self, fx, self->angle-ANG45, FRACUNIT/2);
P_SpawnMissileAngle (self, fx, self->angle+ANG45, FRACUNIT/2);
P_SpawnMissileAngle(self, fx, self->Angles.Yaw - 45, 0.5);
P_SpawnMissileAngle(self, fx, self->Angles.Yaw + 45, 0.5);
}
}
else
@ -257,9 +251,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_BlueSpark)
for (i = 0; i < 2; i++)
{
mo = Spawn("Sorcerer2FXSpark", self->Pos(), ALLOW_REPLACE);
mo->vel.x = pr_bluespark.Random2() << 9;
mo->vel.y = pr_bluespark.Random2() << 9;
mo->vel.z = FRACUNIT + (pr_bluespark()<<8);
mo->Vel.X = pr_bluespark.Random2() / 128.;
mo->Vel.Y = pr_bluespark.Random2() / 128.;
mo->Vel.Z = 1. + pr_bluespark() / 256.;
}
return 0;
}
@ -279,7 +273,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
mo = Spawn("Wizard", self->Pos(), ALLOW_REPLACE);
if (mo != NULL)
{
mo->AddZ(-mo->GetDefault()->height / 2, false);
mo->AddZ(-mo->GetDefault()->Height / 2, false);
if (!P_TestMobjLocation (mo))
{ // Didn't fit
mo->ClearCounters();
@ -289,7 +283,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
{ // [RH] Make the new wizards inherit D'Sparil's target
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->flags &= ~MF_MISSILE;
mo->master = self->target;

View file

@ -49,12 +49,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
{
PARAM_ACTION_PROLOGUE;
self->AddZ(32*FRACUNIT, false);
self->PrevZ = self->Z(); // no interpolation!
self->AddZ(32, false);
self->RenderStyle = STYLE_Add;
self->alpha = FRACUNIT;
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
P_CheckSplash(self, 128<<FRACBITS);
P_CheckSplash(self, 128);
return 0;
}
@ -70,9 +69,8 @@ IMPLEMENT_CLASS (AArtiTimeBomb)
bool AArtiTimeBomb::Use (bool pickup)
{
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
AActor *mo = Spawn("ActivatedTimeBomb",
Owner->Vec3Angle(24*FRACUNIT, Owner->angle, - Owner->floorclip), ALLOW_REPLACE);
Owner->Vec3Angle(24., Owner->Angles.Yaw, - Owner->Floorclip), ALLOW_REPLACE);
mo->target = Owner;
return true;
}

View file

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

View file

@ -59,11 +59,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PodPain)
}
for (count = chance > 240 ? 2 : 1; count; count--)
{
goo = Spawn(gootype, self->PosPlusZ(48*FRACUNIT), ALLOW_REPLACE);
goo = Spawn(gootype, self->PosPlusZ(48.), ALLOW_REPLACE);
goo->target = self;
goo->vel.x = pr_podpain.Random2() << 9;
goo->vel.y = pr_podpain.Random2() << 9;
goo->vel.z = FRACUNIT/2 + (pr_podpain() << 9);
goo->Vel.X = pr_podpain.Random2() / 128.;
goo->Vel.Y = pr_podpain.Random2() / 128.;
goo->Vel.Z = 0.5 + pr_podpain() / 128.;
}
return 0;
}
@ -104,23 +104,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MakePod)
PARAM_CLASS_OPT(podtype, AActor) { podtype = PClass::FindActor("Pod"); }
AActor *mo;
fixed_t x;
fixed_t y;
if (self->special1 == MAX_GEN_PODS)
{ // Too many generated pods
return 0;
}
x = self->X();
y = self->Y();
mo = Spawn(podtype, x, y, ONFLOORZ, ALLOW_REPLACE);
if (!P_CheckPosition (mo, x, y))
mo = Spawn(podtype, self->PosAtZ(ONFLOORZ), ALLOW_REPLACE);
if (!P_CheckPosition (mo, mo->Pos()))
{ // Didn't fit
mo->Destroy ();
return 0;
}
mo->SetState (mo->FindState("Grow"));
P_ThrustMobj (mo, pr_makepod()<<24, (fixed_t)(4.5*FRACUNIT));
mo->Thrust(pr_makepod() * (360. / 256), 4.5);
S_Sound (mo, CHAN_BODY, self->AttackSound, 1, ATTN_IDLE);
self->special1++; // Increment generated pod count
mo->master = self; // Link the generator to the pod
@ -139,7 +135,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AccTeleGlitter)
if (++self->health > 35)
{
self->vel.z += self->vel.z/2;
self->Vel.Z *= 1.5;
}
return 0;
}
@ -172,19 +168,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast)
int i;
int count;
AActor *blast;
angle_t angle;
count = 1 + (pr_blast() % 3);
for (i = 0; i < count; i++)
{
blast = Spawn("VolcanoBlast", self->PosPlusZ(44*FRACUNIT), ALLOW_REPLACE);
blast->target = self;
angle = pr_blast () << 24;
blast->angle = angle;
angle >>= ANGLETOFINESHIFT;
blast->vel.x = FixedMul (1*FRACUNIT, finecosine[angle]);
blast->vel.y = FixedMul (1*FRACUNIT, finesine[angle]);
blast->vel.z = (FRACUNIT*5/2) + (pr_blast() << 10);
blast->Angles.Yaw = pr_blast() * (360 / 256.f);
blast->VelFromAngle(1.);
blast->Vel.Z = 2.5 + pr_blast() / 64.;
S_Sound (blast, CHAN_BODY, "world/volcano/shoot", 1, ATTN_NORM);
P_CheckMissileSpawn (blast, self->radius);
}
@ -203,26 +195,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
unsigned int i;
AActor *tiny;
angle_t angle;
if (self->Z() <= self->floorz)
{
self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT;
self->AddZ(28*FRACUNIT);
//self->vel.z = 3*FRACUNIT;
self->Gravity = 1;
self->AddZ(28);
//self->Vel.Z = 3;
}
P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, RADF_HURTSOURCE);
for (i = 0; i < 4; i++)
{
tiny = Spawn("VolcanoTBlast", self->Pos(), ALLOW_REPLACE);
tiny->target = self;
angle = i*ANG90;
tiny->angle = angle;
angle >>= ANGLETOFINESHIFT;
tiny->vel.x = FixedMul (FRACUNIT*7/10, finecosine[angle]);
tiny->vel.y = FixedMul (FRACUNIT*7/10, finesine[angle]);
tiny->vel.z = FRACUNIT + (pr_volcimpact() << 9);
tiny->Angles.Yaw = 90.*i;
tiny->VelFromAngle(0.7);
tiny->Vel.Z = 1. + pr_volcimpact() / 128.;
P_CheckMissileSpawn (tiny, self->radius);
}
return 0;

View file

@ -63,8 +63,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
int slope;
DAngle angle;
DAngle slope;
player_t *player;
FTranslatedLineTarget t;
@ -86,15 +86,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack)
{
puff = PClass::FindActor(NAME_BulletPuff); // just to be sure
}
angle = self->angle;
angle += pr_sap.Random2() << 18;
angle = self->Angles.Yaw + pr_sap.Random2() * (5.625 / 256);
slope = P_AimLineAttack (self, angle, MELEERANGE);
P_LineAttack (self, angle, MELEERANGE, slope, damage, NAME_Melee, puff, true, &t);
if (t.linetarget)
{
//S_StartSound(player->mo, sfx_stfhit);
// turn to face target
self->angle = t.angleFromSource;
self->Angles.Yaw = t.angleFromSource;
}
return 0;
}
@ -110,7 +109,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL1)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
int damage;
player_t *player;
@ -122,18 +121,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL1)
AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
if (!weapon->DepleteAmmo(weapon->bAltFire))
return 0;
}
angle_t pitch = P_BulletSlope(self);
damage = 7+(pr_fgw()&7);
angle = self->angle;
DAngle pitch = P_BulletSlope(self);
damage = 7 + (pr_fgw() & 7);
angle = self->Angles.Yaw;
if (player->refire)
{
angle += pr_fgw.Random2() << 18;
angle += pr_fgw.Random2() * (5.625 / 256);
}
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "GoldWandPuff1");
S_Sound (self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
P_LineAttack(self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "GoldWandPuff1");
S_Sound(self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
return 0;
}
@ -148,9 +147,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2)
PARAM_ACTION_PROLOGUE;
int i;
angle_t angle;
DAngle angle;
int damage;
fixed_t vz;
double vz;
player_t *player;
if (NULL == (player = self->player))
@ -164,17 +163,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
angle_t pitch = P_BulletSlope(self);
vz = FixedMul (GetDefaultByName("GoldWandFX2")->Speed,
finetangent[FINEANGLES/4-((signed)pitch>>ANGLETOFINESHIFT)]);
P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->angle-(ANG45/8), vz);
P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->angle+(ANG45/8), vz);
angle = self->angle-(ANG45/8);
DAngle pitch = P_BulletSlope(self);
vz = -GetDefaultByName("GoldWandFX2")->Speed * pitch.TanClamped();
P_SpawnMissileAngle(self, PClass::FindActor("GoldWandFX2"), self->Angles.Yaw - (45. / 8), vz);
P_SpawnMissileAngle(self, PClass::FindActor("GoldWandFX2"), self->Angles.Yaw + (45. / 8), vz);
angle = self->Angles.Yaw - (45. / 8);
for(i = 0; i < 5; i++)
{
damage = 1+(pr_fgw2()&7);
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "GoldWandPuff2");
angle += ((ANG45/8)*2)/4;
angle += ((45. / 8) * 2) / 4;
}
S_Sound (self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM);
return 0;
@ -204,8 +203,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL1)
return 0;
}
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX1"));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->angle-(ANG45/10));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->angle+(ANG45/10));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->Angles.Yaw - 4.5);
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->Angles.Yaw + 4.5);
return 0;
}
@ -233,10 +232,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL2)
return 0;
}
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"), self->angle-(ANG45/10));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"), self->angle+(ANG45/10));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->angle-(ANG45/5));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->angle+(ANG45/5));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"), self->Angles.Yaw - 4.5);
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"), self->Angles.Yaw + 4.5);
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->Angles.Yaw - 9.);
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->Angles.Yaw + 9.);
return 0;
}
@ -250,11 +249,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle Angle;
int damage;
int slope;
DAngle slope;
int randVal;
fixed_t dist;
double dist;
player_t *player;
PClassActor *pufftype;
FTranslatedLineTarget t;
@ -273,25 +272,25 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2) * FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT;
angle = self->angle;
player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2);
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3);
Angle = self->Angles.Yaw;
if (power)
{
damage = pr_gatk.HitDice (2);
dist = 4*MELEERANGE;
angle += pr_gatk.Random2() << 17;
Angle += pr_gatk.Random2() * (2.8125 / 256);
pufftype = PClass::FindActor("GauntletPuff2");
}
else
{
damage = pr_gatk.HitDice (2);
dist = MELEERANGE+1;
angle += pr_gatk.Random2() << 18;
dist = SAWRANGE;
Angle += pr_gatk.Random2() * (5.625 / 256);
pufftype = PClass::FindActor("GauntletPuff1");
}
slope = P_AimLineAttack (self, angle, dist);
P_LineAttack (self, angle, dist, slope, damage, NAME_Melee, pufftype, false, &t, &actualdamage);
slope = P_AimLineAttack (self, Angle, dist);
P_LineAttack (self, Angle, dist, slope, damage, NAME_Melee, pufftype, false, &t, &actualdamage);
if (!t.linetarget)
{
if (pr_gatk() > 64)
@ -324,20 +323,22 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
S_Sound (self, CHAN_AUTO, "weapons/gauntletshit", 1, ATTN_NORM);
}
// turn to face target
angle = t.angleFromSource;
if (angle-self->angle > ANG180)
DAngle angle = t.angleFromSource;
DAngle anglediff = deltaangle(self->Angles.Yaw, angle);
if (anglediff < 0.0)
{
if ((int)(angle-self->angle) < -ANG90/20)
self->angle = angle+ANG90/21;
if (anglediff < -4.5)
self->Angles.Yaw = angle + 90.0 / 21;
else
self->angle -= ANG90/20;
self->Angles.Yaw -= 4.5;
}
else
{
if (angle-self->angle > ANG90/20)
self->angle = angle-ANG90/21;
if (anglediff > 4.5)
self->Angles.Yaw = angle - 90.0 / 21;
else
self->angle += ANG90/20;
self->Angles.Yaw += 4.5;
}
self->flags |= MF_JUSTATTACKED;
return 0;
@ -387,7 +388,6 @@ int AMaceFX4::DoSpecialDamage (AActor *target, int damage, FName damagetype)
void FireMacePL1B (AActor *actor)
{
AActor *ball;
angle_t angle;
player_t *player;
if (NULL == (player = actor->player))
@ -401,16 +401,13 @@ void FireMacePL1B (AActor *actor)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
ball = Spawn("MaceFX2", actor->PosPlusZ(28*FRACUNIT - actor->floorclip), ALLOW_REPLACE);
ball->vel.z = 2*FRACUNIT+/*((player->lookdir)<<(FRACBITS-5))*/
finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
angle = actor->angle;
ball = Spawn("MaceFX2", actor->PosPlusZ(28 - actor->Floorclip), ALLOW_REPLACE);
ball->Vel.Z = 2 - player->mo->Angles.Pitch.TanClamped();
ball->target = actor;
ball->angle = angle;
ball->AddZ(2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)]);
angle >>= ANGLETOFINESHIFT;
ball->vel.x = (actor->vel.x>>1) + FixedMul(ball->Speed, finecosine[angle]);
ball->vel.y = (actor->vel.y>>1) + FixedMul(ball->Speed, finesine[angle]);
ball->Angles.Yaw = actor->Angles.Yaw;
ball->AddZ(ball->Vel.Z);
ball->VelFromAngle();
ball->Vel += actor->Vel.XY()/2;
S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM);
P_CheckMissileSpawn (ball, actor->radius);
}
@ -435,19 +432,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL1)
if (pr_maceatk() < 28)
{
FireMacePL1B (self);
FireMacePL1B(self);
return 0;
}
AWeapon *weapon = player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
if (!weapon->DepleteAmmo(weapon->bAltFire))
return 0;
}
player->psprites[ps_weapon].sx = ((pr_maceatk()&3)-2)*FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT;
ball = P_SpawnPlayerMissile (self, PClass::FindActor("MaceFX1"),
self->angle+(((pr_maceatk()&7)-4)<<24));
player->psprites[ps_weapon].sx = ((pr_maceatk() & 3) - 2);
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_maceatk() & 3);
ball = P_SpawnPlayerMissile(self, PClass::FindActor("MaceFX1"), self->Angles.Yaw + (((pr_maceatk() & 7) - 4) * (360. / 256)));
if (ball)
{
ball->special1 = 16; // tics till dropoff
@ -476,21 +472,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_MacePL1Check)
}
self->special1 = 0;
self->flags &= ~MF_NOGRAVITY;
self->gravity = FRACUNIT/8;
self->Gravity = 1. / 8;;
// [RH] Avoid some precision loss by scaling the velocity directly
#if 0
// This is the original code, for reference.
angle_t angle = self->angle>>ANGLETOFINESHIFT;
self->vel.x = FixedMul(7*FRACUNIT, finecosine[angle]);
self->vel.y = FixedMul(7*FRACUNIT, finesine[angle]);
a.ngle_t angle = self->angle>>ANGLETOF.INESHIFT;
self->velx = F.ixedMul(7*F.RACUNIT, f.inecosine[angle]);
self->vely = F.ixedMul(7*F.RACUNIT, f.inesine[angle]);
#else
double velscale = sqrt ((double)self->vel.x * (double)self->vel.x +
(double)self->vel.y * (double)self->vel.y);
velscale = 458752 / velscale;
self->vel.x = (int)(self->vel.x * velscale);
self->vel.y = (int)(self->vel.y * velscale);
double velscale = 7 / self->Vel.XY().Length();
self->Vel.X *= velscale;
self->Vel.Y *= velscale;
#endif
self->vel.z -= self->vel.z >> 1;
self->Vel.Z *= 0.5;
return 0;
}
@ -507,16 +501,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact)
if ((self->health != MAGIC_JUNK) && (self->flags & MF_INBOUNCE))
{ // Bounce
self->health = MAGIC_JUNK;
self->vel.z = (self->vel.z * 192) >> 8;
self->Vel.Z *= 0.75;
self->BounceFlags = BOUNCE_None;
self->SetState (self->SpawnState);
S_Sound (self, CHAN_BODY, "weapons/macebounce", 1, ATTN_NORM);
}
else
{ // Explode
self->vel.x = self->vel.y = self->vel.z = 0;
self->Vel.Zero();
self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT;
self->Gravity = 1;
S_Sound (self, CHAN_BODY, "weapons/macehit", 1, ATTN_NORM);
}
return 0;
@ -533,7 +527,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
PARAM_ACTION_PROLOGUE;
AActor *tiny;
angle_t angle;
if ((self->Z() <= self->floorz) && P_HitFloor (self))
{ // Landed in some sort of liquid
@ -542,42 +535,36 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
}
if (self->flags & MF_INBOUNCE)
{
if (self->vel.z < 2*FRACUNIT)
if (self->Vel.Z < 2)
{
goto boom;
}
// Bounce
self->vel.z = (self->vel.z * 192) >> 8;
self->Vel.Z *= 0.75;
self->SetState (self->SpawnState);
tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE);
angle = self->angle+ANG90;
tiny->target = self->target;
tiny->angle = angle;
angle >>= ANGLETOFINESHIFT;
tiny->vel.x = (self->vel.x>>1) + FixedMul(self->vel.z-FRACUNIT, finecosine[angle]);
tiny->vel.y = (self->vel.y>>1) + FixedMul(self->vel.z-FRACUNIT, finesine[angle]);
tiny->vel.z = self->vel.z;
tiny->Angles.Yaw = self->Angles.Yaw + 90.;
tiny->VelFromAngle(self->Vel.Z - 1.);
tiny->Vel += { self->Vel.X * .5, self->Vel.Y * .5, self->Vel.Z };
P_CheckMissileSpawn (tiny, self->radius);
tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE);
angle = self->angle-ANG90;
tiny->target = self->target;
tiny->angle = angle;
angle >>= ANGLETOFINESHIFT;
tiny->vel.x = (self->vel.x>>1) + FixedMul(self->vel.z-FRACUNIT, finecosine[angle]);
tiny->vel.y = (self->vel.y>>1) + FixedMul(self->vel.z-FRACUNIT, finesine[angle]);
tiny->vel.z = self->vel.z;
tiny->Angles.Yaw = self->Angles.Yaw - 90.;
tiny->VelFromAngle(self->Vel.Z - 1.);
tiny->Vel += { self->Vel.X * .5, self->Vel.Y * .5, self->Vel.Z };
P_CheckMissileSpawn (tiny, self->radius);
}
else
{ // Explode
boom:
self->vel.x = self->vel.y = self->vel.z = 0;
self->Vel.Zero();
self->flags |= MF_NOGRAVITY;
self->BounceFlags = BOUNCE_None;
self->gravity = FRACUNIT;
self->Gravity = 1;
}
return 0;
}
@ -607,13 +594,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL2)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
mo = P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AMaceFX4), self->angle, &t);
mo = P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AMaceFX4), self->Angles.Yaw, &t);
if (mo)
{
mo->vel.x += self->vel.x;
mo->vel.y += self->vel.y;
mo->vel.z = 2*FRACUNIT+
clamp<fixed_t>(finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT);
mo->Vel += self->Vel.XY();
mo->Vel.Z = 2 - player->mo->Angles.Pitch.TanClamped();
if (t.linetarget && !t.unlinked)
{
mo->tracer = t.linetarget;
@ -635,7 +620,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
int i;
AActor *target;
angle_t angle = 0;
DAngle angle = 0.;
bool newAngle;
FTranslatedLineTarget t;
@ -646,7 +631,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
}
if (self->flags & MF_INBOUNCE)
{
if (self->vel.z < 2*FRACUNIT)
if (self->Vel.Z < 2)
{
goto boom;
}
@ -668,10 +653,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
}
else
{ // Find new target
angle = 0;
angle = 0.;
for (i = 0; i < 16; i++)
{
P_AimLineAttack (self, angle, 10*64*FRACUNIT, &t, 0, ALF_NOFRIENDS|ALF_PORTALRESTRICT, NULL, self->target);
P_AimLineAttack (self, angle, 640., &t, 0., ALF_NOFRIENDS|ALF_PORTALRESTRICT, NULL, self->target);
if (t.linetarget && self->target != t.linetarget)
{
self->tracer = t.linetarget;
@ -679,15 +664,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
newAngle = true;
break;
}
angle += ANGLE_45/2;
angle += 22.5;
}
}
if (newAngle)
{
self->angle = angle;
angle >>= ANGLETOFINESHIFT;
self->vel.x = FixedMul (self->Speed, finecosine[angle]);
self->vel.y = FixedMul (self->Speed, finesine[angle]);
self->Angles.Yaw = angle;
self->VelFromAngle();
}
self->SetState (self->SpawnState);
S_Sound (self, CHAN_BODY, "weapons/macestop", 1, ATTN_NORM);
@ -695,9 +678,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
else
{ // Explode
boom:
self->vel.x = self->vel.y = self->vel.z = 0;
self->Vel.Zero();
self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT;
self->Gravity = 1;
S_Sound (self, CHAN_BODY, "weapons/maceexplode", 1, ATTN_NORM);
}
return 0;
@ -737,7 +720,7 @@ void ABlasterFX1::Effect ()
{
if (pr_bfx1t() < 64)
{
Spawn("BlasterSmoke", X(), Y(), MAX<fixed_t> (Z() - 8 * FRACUNIT, floorz), ALLOW_REPLACE);
Spawn("BlasterSmoke", PosAtZ(MAX(Z() - 8., floorz)), ALLOW_REPLACE);
}
}
@ -778,7 +761,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
int damage;
player_t *player;
@ -793,12 +776,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
angle_t pitch = P_BulletSlope(self);
DAngle pitch = P_BulletSlope(self);
damage = pr_fb1.HitDice (4);
angle = self->angle;
angle = self->Angles.Yaw;
if (player->refire)
{
angle += pr_fb1.Random2() << 18;
angle += pr_fb1.Random2() * (5.625 / 256);
}
P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, "BlasterPuff");
S_Sound (self, CHAN_WEAPON, "weapons/blastershoot", 1, ATTN_NORM);
@ -816,18 +799,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers)
PARAM_ACTION_PROLOGUE;
unsigned int i;
angle_t angle;
DAngle angle;
AActor *ripper;
for(i = 0; i < 8; i++)
{
ripper = Spawn<ARipper> (self->Pos(), ALLOW_REPLACE);
angle = i*ANG45;
angle = i*45.;
ripper->target = self->target;
ripper->angle = angle;
angle >>= ANGLETOFINESHIFT;
ripper->vel.x = FixedMul (ripper->Speed, finecosine[angle]);
ripper->vel.y = FixedMul (ripper->Speed, finesine[angle]);
ripper->Angles.Yaw = angle;
ripper->VelFromAngle();
P_CheckMissileSpawn (ripper, self->radius);
}
return 0;
@ -955,7 +936,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL2)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AHornRodFX2), self->angle, &t, &MissileActor);
P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AHornRodFX2), self->Angles.Yaw, &t, &MissileActor);
// Use MissileActor instead of the return value from
// P_SpawnPlayerMissile because we need to give info to the mobj
// even if it exploded immediately.
@ -1071,10 +1052,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
{ // Fudge rain frequency
return 0;
}
fixedvec2 pos = self->Vec2Offset(
((pr_storm()&127) - 64) * FRACUNIT,
((pr_storm()&127) - 64) * FRACUNIT);
mo = Spawn<ARainPillar> (pos.x, pos.y, ONCEILINGZ, ALLOW_REPLACE);
double xo = ((pr_storm() & 127) - 64);
double yo = ((pr_storm() & 127) - 64);
DVector3 pos = self->Vec2OffsetZ(xo, yo, ONCEILINGZ);
mo = Spawn<ARainPillar> (pos, ALLOW_REPLACE);
// We used bouncecount to store the 3D floor index in A_HideInCeiling
if (!mo) return 0;
if (mo->Sector->PortalGroup != self->Sector->PortalGroup)
@ -1083,19 +1064,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
mo->Destroy();
return 0;
}
fixed_t newz;
if (self->bouncecount >= 0 && (unsigned)self->bouncecount < self->Sector->e->XFloor.ffloors.Size())
newz = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPoint(mo);// - 40 * FRACUNIT;
pos.Z = self->Sector->e->XFloor.ffloors[self->bouncecount]->bottom.plane->ZatPointF(mo);
else
newz = self->Sector->ceilingplane.ZatPoint(mo);
int moceiling = P_Find3DFloor(NULL, pos.x, pos.y, newz, false, false, newz);
if (moceiling >= 0)
mo->SetZ(newz - mo->height, false);
mo->Translation = multiplayer ?
TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0;
pos.Z = self->Sector->ceilingplane.ZatPointF(mo);
int moceiling = P_Find3DFloor(NULL, pos, false, false, pos.Z);
if (moceiling >= 0) mo->SetZ(pos.Z - mo->Height);
mo->Translation = multiplayer ? TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0;
mo->target = self->target;
mo->vel.x = 1; // Force collision detection
mo->vel.z = -mo->Speed;
mo->Vel.X = MinVel; // Force collision detection
mo->Vel.Z = -mo->Speed;
mo->special2 = self->special2; // Transfer player number
P_CheckMissileSpawn (mo, self->radius);
if (self->special1 != -1 && !S_IsActorPlayingSomething (self, CHAN_BODY, -1))
@ -1136,21 +1114,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling)
PARAM_ACTION_PROLOGUE;
// We use bouncecount to store the 3D floor index
fixed_t foo;
for (unsigned int i=0; i< self->Sector->e->XFloor.ffloors.Size(); i++)
double foo;
for (int i = self->Sector->e->XFloor.ffloors.Size() - 1; i >= 0; i--)
{
F3DFloor * rover = self->Sector->e->XFloor.ffloors[i];
if(!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if ((foo = rover->bottom.plane->ZatPoint(self)) >= (self->Top()))
if (!(rover->flags & FF_SOLID) || !(rover->flags & FF_EXISTS)) continue;
if ((foo = rover->bottom.plane->ZatPointF(self)) >= self->Top())
{
self->SetZ(foo + 4*FRACUNIT, false);
self->SetZ(foo + 4, false);
self->bouncecount = i;
return 0;
}
}
self->bouncecount = -1;
self->SetZ(self->ceilingz + 4*FRACUNIT, false);
self->SetZ(self->ceilingz + 4, false);
return 0;
}
@ -1237,7 +1215,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL1)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
player_t *player;
if (NULL == (player = self->player))
@ -1252,10 +1229,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL1)
return 0;
}
P_SpawnPlayerMissile (self, RUNTIME_CLASS(APhoenixFX1));
angle = self->angle + ANG180;
angle >>= ANGLETOFINESHIFT;
self->vel.x += FixedMul (4*FRACUNIT, finecosine[angle]);
self->vel.y += FixedMul (4*FRACUNIT, finesine[angle]);
self->Thrust(self->Angles.Yaw + 180, 4);
return 0;
}
@ -1270,22 +1244,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_PhoenixPuff)
PARAM_ACTION_PROLOGUE;
AActor *puff;
angle_t angle;
DAngle angle;
//[RH] Heretic never sets the target for seeking
//P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10);
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->angle + ANG90;
angle >>= ANGLETOFINESHIFT;
puff->vel.x = FixedMul (FRACUNIT*13/10, finecosine[angle]);
puff->vel.y = FixedMul (FRACUNIT*13/10, finesine[angle]);
puff->vel.z = 0;
angle = self->Angles.Yaw + 90;
puff->Vel = DVector3(angle.ToVector(1.3), 0);
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->angle - ANG90;
angle >>= ANGLETOFINESHIFT;
puff->vel.x = FixedMul (FRACUNIT*13/10, finecosine[angle]);
puff->vel.y = FixedMul (FRACUNIT*13/10, finesine[angle]);
puff->vel.z = 0;
angle = self->Angles.Yaw - 90;
puff->Vel = DVector3(angle.ToVector(1.3), 0);
return 0;
}
@ -1323,9 +1292,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
PARAM_ACTION_PROLOGUE;
AActor *mo;
angle_t angle;
fixed_t slope;
double slope;
FSoundID soundid;
player_t *player;
APhoenixRod *flamethrower;
@ -1345,20 +1313,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
S_StopSound (self, CHAN_WEAPON);
return 0;
}
angle = self->angle;
fixed_t xo = (pr_fp2.Random2() << 9);
fixed_t yo = (pr_fp2.Random2() << 9);
fixedvec3 pos = self->Vec3Offset(xo, yo,
26*FRACUNIT + finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] - self->floorclip);
slope = -self->Angles.Pitch.TanClamped();
double xo = pr_fp2.Random2() / 128.;
double yo = pr_fp2.Random2() / 128.;
DVector3 pos = self->Vec3Offset(xo, yo, 26 + slope - self->Floorclip);
slope = finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10);
slope += 0.1;
mo = Spawn("PhoenixFX2", pos, ALLOW_REPLACE);
mo->target = self;
mo->angle = angle;
mo->vel.x = self->vel.x + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]);
mo->vel.y = self->vel.y + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]);
mo->vel.z = FixedMul (mo->Speed, slope);
mo->Angles.Yaw = self->Angles.Yaw;
mo->VelFromAngle();
mo->Vel += self->Vel.XY();
mo->Vel.Z = mo->Speed * slope;
if (!player->refire || !S_IsActorPlayingSomething (self, CHAN_WEAPON, -1))
{
S_Sound (self, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM);
@ -1403,7 +1370,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlameEnd)
{
PARAM_ACTION_PROLOGUE;
self->vel.z += FRACUNIT*3/2;
self->Vel.Z += 1.5;
return 0;
}
@ -1417,7 +1384,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FloatPuff)
{
PARAM_ACTION_PROLOGUE;
self->vel.z += FRACUNIT*18/10;
self->Vel.Z += 1.8;
return 0;
}

View file

@ -30,9 +30,9 @@ int AWhirlwind::DoSpecialDamage (AActor *target, int damage, FName damagetype)
if (!(target->flags7 & MF7_DONTTHRUST))
{
target->angle += pr_foo.Random2() << 20;
target->vel.x += pr_foo.Random2() << 10;
target->vel.y += pr_foo.Random2() << 10;
target->Angles.Yaw += pr_foo.Random2() * (360 / 4096.);
target->Vel.X += pr_foo.Random2() / 64.;
target->Vel.Y += pr_foo.Random2() / 64.;
}
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;
}
target->vel.z += randVal << 11;
if (target->vel.z > 12*FRACUNIT)
target->Vel.Z += randVal / 32.;
if (target->Vel.Z > 12)
{
target->vel.z = 12*FRACUNIT;
target->Vel.Z = 12;
}
}
if (!(level.time & 7))
@ -73,7 +73,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
int randAttack;
static const int atkResolve1[] = { 50, 150 };
static const int atkResolve2[] = { 150, 200 };
int dist;
// Ice ball (close 20% : far 60%)
// Fire column (close 40% : far 20%)
@ -93,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
P_TraceBleed (newdam > 0 ? newdam : damage, target, self);
return 0;
}
dist = self->AproxDistance (target) > 8*64*FRACUNIT;
int dist = self->Distance2D(target) > 8 * 64;
randAttack = pr_atk ();
if (randAttack < atkResolve1[dist])
{ // Ice ball
@ -114,10 +113,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
S_Sound (self, CHAN_BODY, "ironlich/attack1", 1, ATTN_NORM);
}
fire->target = baseFire->target;
fire->angle = baseFire->angle;
fire->vel.x = baseFire->vel.x;
fire->vel.y = baseFire->vel.y;
fire->vel.z = baseFire->vel.z;
fire->Angles.Yaw = baseFire->Angles.Yaw;
fire->Vel = baseFire->Vel;
fire->Damage = NULL;
fire->health = (i+1) * 2;
P_CheckMissileSpawn (fire, self->radius);
@ -129,7 +126,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
mo = P_SpawnMissile (self, target, RUNTIME_CLASS(AWhirlwind));
if (mo != NULL)
{
mo->AddZ(-32*FRACUNIT, false);
mo->AddZ(-32);
mo->tracer = target;
mo->health = 20*TICRATE; // Duration
S_Sound (self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
@ -151,21 +148,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_WhirlwindSeek)
self->health -= 3;
if (self->health < 0)
{
self->vel.x = self->vel.y = self->vel.z = 0;
self->SetState (self->FindState(NAME_Death));
self->Vel.Zero();
self->SetState(self->FindState(NAME_Death));
self->flags &= ~MF_MISSILE;
return 0;
}
if ((self->threshold -= 3) < 0)
{
self->threshold = 58 + (pr_seek() & 31);
S_Sound (self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
S_Sound(self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
}
if (self->tracer && self->tracer->flags&MF_SHADOW)
{
return 0;
}
P_SeekerMissile (self, ANGLE_1*10, ANGLE_1*30);
P_SeekerMissile(self, ANGLE_1 * 10, ANGLE_1 * 30);
return 0;
}
@ -180,19 +177,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
PARAM_ACTION_PROLOGUE;
unsigned int i;
angle_t angle;
AActor *shard;
for (i = 0; i < 8; i++)
{
shard = Spawn("HeadFX2", self->Pos(), ALLOW_REPLACE);
angle = i*ANG45;
shard->target = self->target;
shard->angle = angle;
angle >>= ANGLETOFINESHIFT;
shard->vel.x = FixedMul (shard->Speed, finecosine[angle]);
shard->vel.y = FixedMul (shard->Speed, finesine[angle]);
shard->vel.z = -FRACUNIT*6/10;
shard->Angles.Yaw = i*45.;
shard->VelFromAngle();
shard->Vel.Z = -.6;
P_CheckMissileSpawn (shard, self->radius);
}
return 0;
@ -209,7 +202,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow)
PARAM_ACTION_PROLOGUE;
self->health--;
self->AddZ(9*FRACUNIT);
self->AddZ(9.);
if (self->health == 0)
{
self->Damage = self->GetDefault()->Damage;

View file

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

View file

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

View file

@ -47,7 +47,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatSpawn)
delta = self->args[1];
if (delta==0) delta=1;
angle = self->angle + (((pr_batspawn()%delta)-(delta>>1))<<24);
angle = self->_f_angle() + (((pr_batspawn()%delta)-(delta>>1))<<24);
mo = P_SpawnMissileAngle (self, PClass::FindActor("Bat"), angle, 0);
if (mo)
{
@ -64,7 +64,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
{
PARAM_ACTION_PROLOGUE;
angle_t newangle;
DAngle newangle;
if (self->special2 < 0)
{
@ -74,17 +74,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
if (pr_batmove()<128)
{
newangle = self->angle + ANGLE_1*self->args[4];
newangle = self->Angles.Yaw + self->args[4];
}
else
{
newangle = self->angle - ANGLE_1*self->args[4];
newangle = self->Angles.Yaw - self->args[4];
}
// Adjust velocity vector to new direction
newangle >>= ANGLETOFINESHIFT;
self->vel.x = FixedMul (self->Speed, finecosine[newangle]);
self->vel.y = FixedMul (self->Speed, finesine[newangle]);
self->VelFromAngle(newangle, self->Speed);
if (pr_batmove()<15)
{
@ -92,7 +90,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
}
// 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;
return 0;
}

View file

@ -118,15 +118,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopDoBlur)
self->special1 = (pr_doblur() & 3) + 3; // Random number of blurs
if (pr_doblur() < 120)
{
P_ThrustMobj (self, self->angle + ANG90, 11*FRACUNIT);
self->Thrust(self->Angles.Yaw + 90, 11);
}
else if (pr_doblur() > 125)
{
P_ThrustMobj (self, self->angle - ANG90, 11*FRACUNIT);
self->Thrust(self->Angles.Yaw - 90, 11);
}
else
{ // Thrust forward
P_ThrustMobj (self, self->angle, 11*FRACUNIT);
self->Thrust(11);
}
S_Sound (self, CHAN_BODY, "BishopBlur", 1, ATTN_NORM);
return 0;
@ -146,8 +146,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
if (!--self->special1)
{
self->vel.x = 0;
self->vel.y = 0;
self->Vel.X = self->Vel.Y = 0;
if (pr_sblur() > 96)
{
self->SetState (self->SeeState);
@ -160,7 +159,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
mo = Spawn ("BishopBlur", self->Pos(), ALLOW_REPLACE);
if (mo)
{
mo->angle = self->angle;
mo->Angles.Yaw = self->Angles.Yaw;
}
return 0;
}
@ -175,10 +174,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopChase)
{
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;
newz += finesine[self->special2 << BOBTOFINESHIFT] * 4;
self->SetZ(newz);
self->_f_SetZ(newz);
return 0;
}
@ -197,7 +196,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPuff)
mo = Spawn ("BishopPuff", self->PosPlusZ(40*FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->vel.z = FRACUNIT/2;
mo->Vel.Z = -.5;
}
return 0;
}
@ -225,7 +224,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur)
mo = Spawn ("BishopPainBlur", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->angle = self->angle;
mo->Angles.Yaw = self->Angles.Yaw;
}
return 0;
}

View file

@ -22,11 +22,11 @@
//
//==========================================================================
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;
fixedvec3 pos;
DVector3 pos;
if (!victim->SpecialBlastHandling (Owner, strength))
{
@ -34,35 +34,33 @@ void BlastActor (AActor *victim, fixed_t strength, fixed_t speed, AActor *Owner,
}
angle = Owner->AngleTo(victim);
angle >>= ANGLETOFINESHIFT;
victim->vel.x = FixedMul (speed, finecosine[angle]);
victim->vel.y = FixedMul (speed, finesine[angle]);
DVector2 move = angle.ToVector(speed);
victim->Vel.X = move.X;
victim->Vel.Y = move.Y;
// Spawn blast puff
ang = victim->AngleTo(Owner);
ang >>= ANGLETOFINESHIFT;
angle -= 180.;
pos = victim->Vec3Offset(
FixedMul (victim->radius+FRACUNIT, finecosine[ang]),
FixedMul (victim->radius+FRACUNIT, finesine[ang]),
-victim->floorclip + (victim->height>>1));
(victim->radius + 1) * angle.Cos(),
(victim->radius + 1) * angle.Sin(),
(victim->Height / 2) - victim->Floorclip);
mo = Spawn (blasteffect, pos, ALLOW_REPLACE);
if (mo)
{
mo->vel.x = victim->vel.x;
mo->vel.y = victim->vel.y;
mo->Vel.X = victim->Vel.X;
mo->Vel.Y = victim->Vel.Y;
}
if (victim->flags & MF_MISSILE)
{
// [RH] Floor and ceiling huggers should not be blasted vertically.
if (!(victim->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{
victim->vel.z = 8*FRACUNIT;
mo->vel.z = victim->vel.z;
mo->Vel.Z = victim->Vel.Z = 8;
}
}
else
{
victim->vel.z = (1000 / victim->Mass) << FRACBITS;
victim->Vel.Z = 1000. / victim->Mass;
}
if (victim->player)
{
@ -100,14 +98,13 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast)
PARAM_ACTION_PROLOGUE;
PARAM_INT_OPT (blastflags) { blastflags = 0; }
PARAM_FIXED_OPT (strength) { strength = 255*FRACUNIT; }
PARAM_FIXED_OPT (radius) { radius = 255*FRACUNIT; }
PARAM_FIXED_OPT (speed) { speed = 20*FRACUNIT; }
PARAM_FLOAT_OPT (radius) { radius = 255; }
PARAM_FLOAT_OPT (speed) { speed = 20; }
PARAM_CLASS_OPT (blasteffect, AActor) { blasteffect = PClass::FindActor("BlastEffect"); }
PARAM_SOUND_OPT (blastsound) { blastsound = "BlastRadius"; }
AActor *mo;
TThinkerIterator<AActor> iterator;
fixed_t dist;
if (self->player && (blastflags & BF_USEAMMO) && ACTION_CALL_FROM_WEAPON())
{
@ -146,8 +143,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast)
{ // Must be monster, player, missile, touchy or vulnerable
continue;
}
dist = self->AproxDistance (mo);
if (dist > radius)
if (self->Distance2D(mo) > radius)
{ // Out of range
continue;
}

View file

@ -13,9 +13,9 @@
#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 FLAMEROTSPEED = 2*FRACUNIT;
const double FLAMEROTSPEED = 2.;
static FRandom pr_missile ("CFlameMissile");
@ -43,20 +43,18 @@ void ACFlameMissile::BeginPlay ()
void ACFlameMissile::Effect ()
{
fixed_t newz;
if (!--special1)
{
special1 = 4;
newz = Z()-12*FRACUNIT;
double newz = Z()-12;
if (newz < floorz)
{
newz = floorz;
}
AActor *mo = Spawn ("CFlameFloor", X(), Y(), newz, ALLOW_REPLACE);
AActor *mo = Spawn ("CFlameFloor", PosAtZ(newz), ALLOW_REPLACE);
if (mo)
{
mo->angle = angle;
mo->Angles.Yaw = Angles.Yaw;
}
}
}
@ -99,9 +97,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlamePuff)
PARAM_ACTION_PROLOGUE;
self->renderflags &= ~RF_INVISIBLE;
self->vel.x = 0;
self->vel.y = 0;
self->vel.z = 0;
self->Vel.Zero();
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
return 0;
}
@ -117,7 +113,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
PARAM_ACTION_PROLOGUE;
int i;
int an, an90;
DAngle an;
fixed_t dist;
AActor *mo;
@ -126,33 +122,32 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
AActor *BlockingMobj = self->BlockingMobj;
if (BlockingMobj && BlockingMobj->flags&MF_SHOOTABLE)
{ // Hit something, so spawn the flame circle around the thing
dist = BlockingMobj->radius+18*FRACUNIT;
dist = BlockingMobj->_f_radius()+18*FRACUNIT;
for (i = 0; i < 4; i++)
{
an = (i*ANG45)>>ANGLETOFINESHIFT;
an90 = (i*ANG45+ANG90)>>ANGLETOFINESHIFT;
an = i*45.;
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
FixedMul(dist, finecosine[an]),
FixedMul(dist, finesine[an]),
xs_CRoundToInt(an.Cos()*dist), xs_CRoundToInt(an.Sin()*dist),
5*FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->angle = an<<ANGLETOFINESHIFT;
mo->Angles.Yaw = an;
mo->target = self->target;
mo->vel.x = mo->special1 = FixedMul(FLAMESPEED, finecosine[an]);
mo->vel.y = mo->special2 = FixedMul(FLAMESPEED, finesine[an]);
mo->VelFromAngle(FLAMESPEED);
mo->specialf1 = mo->Vel.X;
mo->specialf2 = mo->Vel.Y;
mo->tics -= pr_missile()&3;
}
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
-FixedMul(dist, finecosine[an]),
-FixedMul(dist, finesine[an]),
-xs_CRoundToInt(an.Cos()*dist), -xs_CRoundToInt(an.Sin()*dist),
5*FRACUNIT), ALLOW_REPLACE);
if(mo)
{
mo->angle = ANG180+(an<<ANGLETOFINESHIFT);
mo->Angles.Yaw = an + 180.;
mo->target = self->target;
mo->vel.x = mo->special1 = FixedMul(-FLAMESPEED, finecosine[an]);
mo->vel.y = mo->special2 = FixedMul(-FLAMESPEED, finesine[an]);
mo->VelFromAngle(-FLAMESPEED);
mo->specialf1 = mo->Vel.X;
mo->specialf2 = mo->Vel.Y;
mo->tics -= pr_missile()&3;
}
}
@ -171,11 +166,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameRotate)
{
PARAM_ACTION_PROLOGUE;
int an;
DAngle an = self->Angles.Yaw + 90.;
self->VelFromAngle(an, FLAMEROTSPEED);
self->Vel += DVector2(self->specialf1, self->specialf2);
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
self->vel.x = self->special1+FixedMul(FLAMEROTSPEED, finecosine[an]);
self->vel.y = self->special2+FixedMul(FLAMEROTSPEED, finesine[an]);
self->angle += ANG90/15;
self->Angles.Yaw += 6.;
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);
break;
}
mo->SetZ(self->Z());
mo->angle = self->angle+(ANGLE_45+ANGLE_45/2)-ANGLE_45*j;
P_ThrustMobj(mo, mo->angle, mo->Speed);
mo->_f_SetZ(self->_f_Z());
mo->Angles.Yaw = self->Angles.Yaw + 67.5 - 45.*j;
mo->Thrust();
mo->target = self->target;
mo->args[0] = 10; // initial turn value
mo->args[1] = 0; // initial look angle
@ -225,7 +225,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
AActor *missile = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindActor("HolyMissile"), self->angle, &t);
AActor *missile = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindActor("HolyMissile"), self->Angles.Yaw, &t);
if (missile != NULL && !t.unlinked)
{
missile->tracer = t.linetarget;
@ -274,26 +274,26 @@ static void CHolyTailFollow (AActor *actor, fixed_t dist)
child = actor->tracer;
if (child)
{
an = actor->AngleTo(child) >> ANGLETOFINESHIFT;
an = actor->__f_AngleTo(child) >> ANGLETOFINESHIFT;
oldDistance = child->AproxDistance (actor);
if (P_TryMove (child, actor->X()+FixedMul(dist, finecosine[an]),
actor->Y()+FixedMul(dist, finesine[an]), true))
if (P_TryMove (child, actor->_f_X()+FixedMul(dist, finecosine[an]),
actor->_f_Y()+FixedMul(dist, finesine[an]), true))
{
newDistance = child->AproxDistance (actor)-FRACUNIT;
if (oldDistance < FRACUNIT)
{
if (child->Z() < actor->Z())
{
child->SetZ(actor->Z()-dist);
child->_f_SetZ(actor->_f_Z()-dist);
}
else
{
child->SetZ(actor->Z()+dist);
child->_f_SetZ(actor->_f_Z()+dist);
}
}
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
{
if (P_TryMove (self,
parent->X() - 14*finecosine[parent->angle>>ANGLETOFINESHIFT],
parent->Y() - 14*finesine[parent->angle>>ANGLETOFINESHIFT], true))
parent->_f_X() - 14*finecosine[parent->_f_angle()>>ANGLETOFINESHIFT],
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);
}
@ -377,12 +377,11 @@ static void CHolyFindTarget (AActor *actor)
// Similar to P_SeekerMissile, but seeks to a random Z on the target
//============================================================================
static void CHolySeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
static void CHolySeekerMissile (AActor *actor, DAngle thresh, DAngle turnMax)
{
int dir;
int dist;
angle_t delta;
angle_t angle;
DAngle delta;
AActor *target;
fixed_t newZ;
fixed_t deltaZ;
@ -404,7 +403,7 @@ static void CHolySeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
dir = P_FaceMobj (actor, target, &delta);
if (delta > thresh)
{
delta >>= 1;
delta /= 2;
if (delta > turnMax)
{
delta = turnMax;
@ -412,21 +411,20 @@ static void CHolySeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
}
if (dir)
{ // Turn clockwise
actor->angle += delta;
actor->Angles.Yaw += delta;
}
else
{ // Turn counter clockwise
actor->angle -= delta;
actor->Angles.Yaw -= delta;
}
angle = actor->angle>>ANGLETOFINESHIFT;
actor->vel.x = FixedMul (actor->Speed, finecosine[angle]);
actor->vel.y = FixedMul (actor->Speed, finesine[angle]);
actor->VelFromAngle();
if (!(level.time&15)
|| actor->Z() > target->Top()
|| actor->Top() < target->Z())
{
newZ = target->Z()+((pr_holyseeker()*target->height)>>8);
deltaZ = newZ - actor->Z();
newZ = target->_f_Z()+((pr_holyseeker()*target->_f_height())>>8);
deltaZ = newZ - actor->_f_Z();
if (abs(deltaZ) > 15*FRACUNIT)
{
if (deltaZ > 0)
@ -439,12 +437,12 @@ static void CHolySeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
}
}
dist = actor->AproxDistance (target);
dist = dist / actor->Speed;
dist = dist / actor->_f_speed();
if (dist < 1)
{
dist = 1;
}
actor->vel.z = deltaZ / dist;
actor->Vel.Z = FIXED2DBL(deltaZ / dist);
}
return;
}
@ -463,18 +461,18 @@ void CHolyWeave (AActor *actor, FRandom &pr_random)
weaveXY = actor->special2 >> 16;
weaveZ = actor->special2 & FINEMASK;
angle = (actor->angle + ANG90) >> ANGLETOFINESHIFT;
newX = actor->X() - FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY = actor->Y() - FixedMul(finesine[angle], finesine[weaveXY] * 32);
angle = (actor->_f_angle() + ANG90) >> ANGLETOFINESHIFT;
newX = actor->_f_X() - FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY = actor->_f_Y() - FixedMul(finesine[angle], finesine[weaveXY] * 32);
weaveXY = (weaveXY + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
newX += FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY += FixedMul(finesine[angle], finesine[weaveXY] * 32);
P_TryMove(actor, newX, newY, true);
newZ = actor->Z();
newZ = actor->_f_Z();
newZ -= finesine[weaveZ] * 16;
weaveZ = (weaveZ + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
newZ += finesine[weaveZ] * 16;
actor->SetZ(newZ);
actor->_f_SetZ(newZ);
actor->special2 = weaveZ + (weaveXY << 16);
}
@ -491,17 +489,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolySeek)
self->health--;
if (self->health <= 0)
{
self->vel.x >>= 2;
self->vel.y >>= 2;
self->vel.z = 0;
self->Vel.X /= 4;
self->Vel.Y /= 4;
self->Vel.Z = 0;
self->SetState (self->FindState(NAME_Death));
self->tics -= pr_holyseek()&3;
return 0;
}
if (self->tracer)
{
CHolySeekerMissile (self, self->args[0]*ANGLE_1,
self->args[0]*ANGLE_1*2);
CHolySeekerMissile (self, (double)self->args[0], self->args[0]*2.);
if (!((level.time+7)&15))
{
self->args[0] = 5+(pr_holyseek()/20);
@ -546,7 +543,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClericAttack)
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
S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
return 0;

View file

@ -17,9 +17,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
int damage;
int slope;
DAngle slope;
int i;
player_t *player;
FTranslatedLineTarget t;
@ -36,7 +36,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
{
for (int j = 1; j >= -1; j -= 2)
{
angle = player->mo->angle + j*i*(ANG45 / 16);
angle = player->mo->Angles.Yaw + j*i*(45. / 16);
slope = P_AimLineAttack(player->mo, angle, 2 * MELEERANGE, &t);
if (t.linetarget)
{
@ -52,7 +52,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
// didn't find any creatures, so try to strike any walls
player->mo->weaponspecial = 0;
angle = player->mo->angle;
angle = player->mo->Angles.Yaw;
slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, hammertime);
macedone:

View file

@ -51,8 +51,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
APlayerPawn *pmo;
int damage;
int newLife, max;
angle_t angle;
int slope;
DAngle angle;
DAngle slope;
int i;
player_t *player;
FTranslatedLineTarget t;
@ -72,14 +72,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
{
for (int j = 1; j >= -1; j -= 2)
{
angle = pmo->angle + j*i*(ANG45 / 16);
slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &t, 0, ALF_CHECK3D);
angle = pmo->Angles.Yaw + j*i*(45. / 16);
slope = P_AimLineAttack(pmo, angle, 1.5 * MELEERANGE, &t, 0., ALF_CHECK3D);
if (t.linetarget)
{
P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &t);
P_LineAttack(pmo, angle, 1.5 * MELEERANGE, slope, damage, NAME_Melee, puff, false, &t);
if (t.linetarget != NULL)
{
pmo->angle = t.angleFromSource;
pmo->Angles.Yaw = t.angleFromSource;
if (((t.linetarget->player && (!t.linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || t.linetarget->flags3&MF3_ISMONSTER)
&& (!(t.linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE))))
{
@ -131,12 +131,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle-(ANG45/15));
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->Angles.Yaw - 3.0);
if (mo)
{
mo->WeaveIndexXY = 32;
}
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle+(ANG45/15));
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->Angles.Yaw + 3.0);
if (mo)
{
mo->WeaveIndexXY = 0;

View file

@ -22,12 +22,11 @@ DECLARE_ACTION(A_DragonFlight)
//
//============================================================================
static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
static void DragonSeek (AActor *actor, DAngle thresh, DAngle turnMax)
{
int dir;
int dist;
angle_t delta;
angle_t angle;
double dist;
DAngle delta;
AActor *target;
int i;
angle_t bestAngle;
@ -42,7 +41,7 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
dir = P_FaceMobj (actor, target, &delta);
if (delta > thresh)
{
delta >>= 1;
delta /= 2;
if (delta > turnMax)
{
delta = turnMax;
@ -50,30 +49,25 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
}
if (dir)
{ // Turn clockwise
actor->angle += delta;
actor->Angles.Yaw += delta;
}
else
{ // Turn counter clockwise
actor->angle -= delta;
actor->Angles.Yaw -= delta;
}
angle = actor->angle>>ANGLETOFINESHIFT;
actor->vel.x = FixedMul (actor->Speed, finecosine[angle]);
actor->vel.y = FixedMul (actor->Speed, finesine[angle]);
dist = actor->AproxDistance (target) / actor->Speed;
actor->VelFromAngle();
dist = actor->DistanceBySpeed(target, actor->Speed);
if (actor->Top() < target->Z() ||
target->Top() < actor->Z())
{
if (dist < 1)
{
dist = 1;
}
actor->vel.z = (target->Z() - actor->Z())/dist;
actor->Vel.Z = (target->Z() - actor->Z()) / dist;
}
if (target->flags&MF_SHOOTABLE && pr_dragonseek() < 64)
{ // attack the destination mobj if it's attackable
AActor *oldTarget;
if (absangle(actor->angle - actor->AngleTo(target)) < ANGLE_45/2)
if (absangle(actor->_f_angle() - actor->__f_AngleTo(target)) < ANGLE_45/2)
{
oldTarget = actor->target;
actor->target = target;
@ -98,7 +92,7 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
{
AActor *bestActor = NULL;
bestAngle = ANGLE_MAX;
angleToTarget = actor->AngleTo(actor->target);
angleToTarget = actor->__f_AngleTo(actor->target);
for (i = 0; i < 5; i++)
{
if (!target->args[i])
@ -111,7 +105,7 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
{
continue;
}
angleToSpot = actor->AngleTo(mo);
angleToSpot = actor->__f_AngleTo(mo);
if (absangle(angleToSpot-angleToTarget) < bestAngle)
{
bestAngle = absangle(angleToSpot-angleToTarget);
@ -184,7 +178,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
angle_t angle;
DragonSeek (self, 4*ANGLE_1, 8*ANGLE_1);
DragonSeek (self, 4., 8.);
if (self->target)
{
if(!(self->target->flags&MF_SHOOTABLE))
@ -192,15 +186,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
self->target = NULL;
return 0;
}
angle = self->AngleTo(self->target);
if (absangle(self->angle-angle) < ANGLE_45/2 && self->CheckMeleeRange())
angle = self->__f_AngleTo(self->target);
if (absangle(self->_f_angle()-angle) < ANGLE_45/2 && self->CheckMeleeRange())
{
int damage = pr_dragonflight.HitDice (8);
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
}
else if (absangle(self->angle-angle) <= ANGLE_1*20)
else if (absangle(self->_f_angle()-angle) <= ANGLE_1*20)
{
self->SetState (self->MissileState);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);

View file

@ -13,7 +13,7 @@
#include "thingdef/thingdef.h"
*/
#define AXERANGE ((fixed_t)(2.25*MELEERANGE))
#define AXERANGE (2.25 * MELEERANGE)
static FRandom pr_axeatk ("FAxeAtk");
@ -199,10 +199,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
fixed_t power;
DAngle angle;
int power;
int damage;
int slope;
DAngle slope;
int i;
int useMana;
player_t *player;
@ -223,7 +223,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
if (player->ReadyWeapon->Ammo1->Amount > 0)
{
damage <<= 1;
power = 6*FRACUNIT;
power = 6;
pufftype = PClass::FindActor ("AxePuffGlow");
useMana = 1;
}
@ -236,7 +236,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
{
for (int j = 1; j >= -1; j -= 2)
{
angle = pmo->angle + j*i*(ANG45 / 16);
angle = pmo->Angles.Yaw + j*i*(45. / 16);
slope = P_AimLineAttack(pmo, angle, AXERANGE, &t);
if (t.linetarget)
{
@ -245,7 +245,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
{
if (t.linetarget->flags3&MF3_ISMONSTER || t.linetarget->player)
{
P_ThrustMobj(t.linetarget, t.angleFromSource, power);
t.linetarget->Thrust(t.angleFromSource, power);
}
AdjustPlayerAngle(pmo, &t);
useMana++;
@ -257,7 +257,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
// didn't find any creatures, so try to strike any walls
pmo->weaponspecial = 0;
angle = pmo->angle;
angle = pmo->Angles.Yaw;
slope = P_AimLineAttack (pmo, angle, MELEERANGE);
P_LineAttack (pmo, angle, MELEERANGE, slope, damage, NAME_Melee, pufftype, true);

View file

@ -13,7 +13,7 @@
#include "thingdef/thingdef.h"
*/
const fixed_t HAMMER_RANGE = MELEERANGE+MELEERANGE/2;
const double HAMMER_RANGE = 1.5 * MELEERANGE;
static FRandom pr_hammeratk ("FHammerAtk");
@ -27,10 +27,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
int damage;
fixed_t power;
int slope;
DAngle slope;
int i;
player_t *player;
FTranslatedLineTarget t;
@ -43,46 +42,32 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
AActor *pmo=player->mo;
damage = 60+(pr_hammeratk()&63);
power = 10*FRACUNIT;
hammertime = PClass::FindActor("HammerPuff");
for (i = 0; i < 16; i++)
{
angle = pmo->angle + i*(ANG45/32);
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &t, 0, ALF_CHECK3D);
if (t.linetarget != NULL)
for (int j = 1; j >= -1; j -= 2)
{
P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true, &t);
angle = pmo->Angles.Yaw + j*i*(45. / 32);
slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &t, 0., ALF_CHECK3D);
if (t.linetarget != NULL)
{
AdjustPlayerAngle(pmo, &t);
if (t.linetarget->flags3 & MF3_ISMONSTER || t.linetarget->player)
P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true, &t);
if (t.linetarget != NULL)
{
P_ThrustMobj(t.linetarget, t.angleFromSource, power);
AdjustPlayerAngle(pmo, &t);
if (t.linetarget->flags3 & MF3_ISMONSTER || t.linetarget->player)
{
t.linetarget->Thrust(t.angleFromSource, 10);
}
pmo->weaponspecial = false; // Don't throw a hammer
goto hammerdone;
}
pmo->weaponspecial = false; // Don't throw a hammer
goto hammerdone;
}
}
angle = pmo->angle-i*(ANG45/32);
slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &t, 0, ALF_CHECK3D);
if (t.linetarget != NULL)
{
P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true, &t);
if (t.linetarget != NULL)
{
AdjustPlayerAngle(pmo, &t);
if (t.linetarget->flags3 & MF3_ISMONSTER || t.linetarget->player)
{
P_ThrustMobj(t.linetarget, t.angleFromSource, power);
}
pmo->weaponspecial = false; // Don't throw a hammer
goto hammerdone;
}
}
}
// didn't find any targets in meleerange, so set to throw out a hammer
angle = pmo->angle;
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, NULL, 0, ALF_CHECK3D);
angle = pmo->Angles.Yaw;
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, NULL, 0., ALF_CHECK3D);
if (P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true) != NULL)
{
pmo->weaponspecial = false;

View file

@ -23,29 +23,25 @@ static FRandom pr_fpatk ("FPunchAttack");
//
//============================================================================
#define MAX_ANGLE_ADJUST (5*ANGLE_1)
#define MAX_ANGLE_ADJUST (5.)
void AdjustPlayerAngle (AActor *pmo, FTranslatedLineTarget *t)
{
angle_t angle;
int difference;
angle = pmo->AngleTo(t->linetarget);
difference = (int)angle - (int)pmo->angle;
if (abs(difference) > MAX_ANGLE_ADJUST)
DAngle difference = deltaangle(pmo->Angles.Yaw, pmo->AngleTo(t->linetarget));
if (fabs(difference) > MAX_ANGLE_ADJUST)
{
if (difference > 0)
{
pmo->angle += MAX_ANGLE_ADJUST;
pmo->Angles.Yaw += MAX_ANGLE_ADJUST;
}
else
{
pmo->angle -= MAX_ANGLE_ADJUST;
pmo->Angles.Yaw -= MAX_ANGLE_ADJUST;
}
}
else
{
pmo->angle = angle;
pmo->Angles.Yaw = t->angleFromSource;
}
}
@ -57,11 +53,11 @@ void AdjustPlayerAngle (AActor *pmo, FTranslatedLineTarget *t)
//
//============================================================================
static bool TryPunch(APlayerPawn *pmo, angle_t angle, int damage, fixed_t power)
static bool TryPunch(APlayerPawn *pmo, DAngle angle, int damage, int power)
{
PClassActor *pufftype;
FTranslatedLineTarget t;
int slope;
DAngle slope;
slope = P_AimLineAttack (pmo, angle, 2*MELEERANGE, &t);
if (t.linetarget != NULL)
@ -82,7 +78,7 @@ static bool TryPunch(APlayerPawn *pmo, angle_t angle, int damage, fixed_t power)
if (t.linetarget->player != NULL ||
(t.linetarget->Mass != INT_MAX && (t.linetarget->flags3 & MF3_ISMONSTER)))
{
P_ThrustMobj (t.linetarget, t.angleFromSource, power);
t.linetarget->Thrust(t.angleFromSource, power);
}
AdjustPlayerAngle (pmo, &t);
return true;
@ -102,7 +98,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
PARAM_ACTION_PROLOGUE;
int damage;
fixed_t power;
int i;
player_t *player;
@ -113,11 +108,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
APlayerPawn *pmo = player->mo;
damage = 40+(pr_fpatk()&15);
power = 2*FRACUNIT;
for (i = 0; i < 16; i++)
{
if (TryPunch(pmo, pmo->angle + i*(ANG45/16), damage, power) ||
TryPunch(pmo, pmo->angle - i*(ANG45/16), damage, power))
if (TryPunch(pmo, pmo->Angles.Yaw + i*(45./16), damage, 2) ||
TryPunch(pmo, pmo->Angles.Yaw - i*(45./16), damage, 2))
{ // hit something
if (pmo->weaponspecial >= 3)
{
@ -131,7 +125,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
// didn't find any creatures, so try to strike any walls
pmo->weaponspecial = 0;
int slope = P_AimLineAttack (pmo, pmo->angle, MELEERANGE);
P_LineAttack (pmo, pmo->angle, MELEERANGE, slope, damage, NAME_Melee, PClass::FindActor("PunchPuff"), true);
DAngle slope = P_AimLineAttack (pmo, pmo->Angles.Yaw, MELEERANGE);
P_LineAttack (pmo, pmo->Angles.Yaw, MELEERANGE, slope, damage, NAME_Melee, PClass::FindActor("PunchPuff"), true);
return 0;
}

View file

@ -31,19 +31,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces)
PARAM_CLASS(p2, 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;
if (cls)
{
AActor *piece = Spawn (cls, self->Pos(), ALLOW_REPLACE);
AActor *piece = Spawn (cls, self->_f_Pos(), ALLOW_REPLACE);
if (piece != NULL)
{
piece->vel.x = self->vel.x + finecosine[fineang];
piece->vel.y = self->vel.y + finesine[fineang];
piece->vel.z = self->vel.z;
piece->Vel = self->Vel + DAngle(i*120.).ToVector(1);
piece->flags |= MF_DROPPED;
fineang += FINEANGLES/3;
j = (j == 0) ? (pr_quietusdrop() & 1) + 1 : 3-j;
}
}
@ -95,11 +92,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FSwordAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
P_SpawnPlayerMissile (self, 0, 0, -10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle+ANGLE_45/4);
P_SpawnPlayerMissile (self, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle+ANGLE_45/8);
P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->angle);
P_SpawnPlayerMissile (self, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle-ANGLE_45/8);
P_SpawnPlayerMissile (self, 0, 0, 10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle-ANGLE_45/4);
P_SpawnPlayerMissile (self, 0, 0, -10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./4));
P_SpawnPlayerMissile (self, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./8));
P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw);
P_SpawnPlayerMissile (self, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./8));
P_SpawnPlayerMissile (self, 0, 0, 10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./4));
S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
return 0;
}
@ -138,7 +135,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FighterAttack)
if (!self->target) return 0;
angle_t angle = self->angle;
angle_t angle = self->_f_angle();
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/4, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/8, 0);

View file

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

View file

@ -39,13 +39,13 @@ IMPLEMENT_CLASS (AArtiPoisonBag1)
bool AArtiPoisonBag1::Use (bool pickup)
{
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo;
mo = Spawn ("PoisonBag", Owner->Vec3Offset(
16*finecosine[angle],
24*finesine[angle],
-Owner->floorclip+8*FRACUNIT), ALLOW_REPLACE);
mo = Spawn("PoisonBag", Owner->Vec3Offset(
16 * Owner->Angles.Yaw.Cos(),
24 * Owner->Angles.Yaw.Sin(),
-Owner->Floorclip + 8), ALLOW_REPLACE);
if (mo)
{
mo->target = Owner;
@ -67,13 +67,13 @@ IMPLEMENT_CLASS (AArtiPoisonBag2)
bool AArtiPoisonBag2::Use (bool pickup)
{
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo;
mo = Spawn ("FireBomb", Owner->Vec3Offset(
16*finecosine[angle],
24*finesine[angle],
-Owner->floorclip+8*FRACUNIT), ALLOW_REPLACE);
mo = Spawn("FireBomb", Owner->Vec3Offset(
16 * Owner->Angles.Yaw.Cos(),
24 * Owner->Angles.Yaw.Sin(),
-Owner->Floorclip + 8), ALLOW_REPLACE);
if (mo)
{
mo->target = Owner;
@ -97,15 +97,15 @@ bool AArtiPoisonBag3::Use (bool pickup)
{
AActor *mo;
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->_f_floorclip()+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
if (mo)
{
mo->angle = Owner->angle + (((pr_poisonbag()&7) - 4) << 24);
mo->Angles.Yaw = Owner->Angles.Yaw + (((pr_poisonbag() & 7) - 4) * (360./256.));
/* Original flight code from Hexen
* mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4));
* mo->z += player->lookdir<<(FRACBITS-4);
* P_ThrustMobj(mo, mo->angle, mo->info->speed);
* P_ThrustMobj(mo, mo->_f_angle(), mo->info->speed);
* mo->momx += player->mo->momx>>1;
* mo->momy += player->mo->momy>>1;
*/
@ -114,16 +114,16 @@ bool AArtiPoisonBag3::Use (bool pickup)
// 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
// speed we fire at accordingly.
angle_t orgpitch = angle_t(-Owner->pitch) >> ANGLETOFINESHIFT;
angle_t modpitch = angle_t(0xDC00000 - Owner->pitch) >> ANGLETOFINESHIFT;
angle_t angle = mo->angle >> ANGLETOFINESHIFT;
fixed_t speed = fixed_t(sqrt((double)mo->Speed*mo->Speed + (4.0*65536*4*65536)));
fixed_t xyscale = FixedMul(speed, finecosine[modpitch]);
DAngle orgpitch = -Owner->Angles.Pitch;
DAngle modpitch = clamp<DAngle>(-Owner->Angles.Pitch + 20, -89., 89.);
DAngle angle = mo->Angles.Yaw;
double speed = DVector2(mo->Speed, 4.).Length();
double xyscale = speed * modpitch.Cos();
mo->vel.z = FixedMul(speed, finesine[modpitch]);
mo->vel.x = FixedMul(xyscale, finecosine[angle]) + (Owner->vel.x >> 1);
mo->vel.y = FixedMul(xyscale, finesine[angle]) + (Owner->vel.y >> 1);
mo->AddZ(FixedMul(mo->Speed, finesine[orgpitch]));
mo->Vel.Z = speed * modpitch.Sin();
mo->Vel.X = xyscale * angle.Cos() + Owner->Vel.X / 2;
mo->Vel.Y = xyscale * angle.Sin() + Owner->Vel.Y / 2;
mo->AddZ(mo->Speed * orgpitch.Sin());
mo->target = Owner;
mo->tics -= pr_poisonbag()&3;
@ -306,7 +306,7 @@ IMPLEMENT_CLASS (APoisonCloud)
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);
special2 = 0;
}
@ -419,7 +419,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, RADF_HURTSOURCE);
bobIndex = self->special2;
self->AddZ(finesine[bobIndex << BOBTOFINESHIFT] >> 1);
self->_f_AddZ(finesine[bobIndex << BOBTOFINESHIFT] >> 1);
self->special2 = (bobIndex + 1) & 63;
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
//if (abs(self->vel.x) < FRACUNIT*3/2 && abs(self->vel.y) < FRACUNIT*3/2
// && self->vel.z < 2*FRACUNIT)
if (self->vel.z < 2*FRACUNIT &&
TMulScale32 (self->vel.x, self->vel.x, self->vel.y, self->vel.y, self->vel.z, self->vel.z)
< (3*3)/(2*2))
if (self->Vel.Z < 2 && self->Vel.LengthSquared() < (9./4.))
{
self->SetState (self->SpawnState + 6);
self->SetZ(self->floorz);
self->vel.z = 0;
self->Vel.Z = 0;
self->BounceFlags = BOUNCE_None;
self->flags &= ~MF_MISSILE;
}

View file

@ -84,26 +84,26 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlyBuzz)
return 0;
}
angle_t ang = self->AngleTo(targ);
self->angle = ang;
self->Angles.Yaw = self->AngleTo(targ);
self->args[0]++;
angle_t ang = self->__f_AngleTo(targ);
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);
return 0;
}
if (self->args[0] & 2)
{
self->vel.x += (pr_fly() - 128) << BOBTOFINESHIFT;
self->vel.y += (pr_fly() - 128) << BOBTOFINESHIFT;
self->Vel.X += (pr_fly() - 128) / 512.;
self->Vel.Y += (pr_fly() - 128) / 512.;
}
int zrand = pr_fly();
if (targ->Z() + 5*FRACUNIT < self->Z() && zrand > 150)
if (targ->Z() + 5. < self->Z() && zrand > 150)
{
zrand = -zrand;
}
self->vel.z = zrand << BOBTOFINESHIFT;
self->Vel.Z = zrand / 512.;
if (pr_fly() < 40)
{
S_Sound(self, CHAN_VOICE, self->ActiveSound, 0.5f, ATTN_STATIC);

View file

@ -51,7 +51,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn)
{
delta = self->args[1];
if (delta==0) delta=1;
mo->angle = self->angle + (((pr_fogspawn()%delta)-(delta>>1))<<24);
mo->Angles.Yaw = self->Angles.Yaw + (((pr_fogspawn() % delta) - (delta >> 1)) * (360 / 256.));
mo->target = self;
if (self->args[0] < 1) self->args[0] = 1;
mo->args[0] = (pr_fogspawn() % (self->args[0]))+1; // Random speed
@ -73,7 +73,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
PARAM_ACTION_PROLOGUE;
int speed = self->args[0]<<FRACBITS;
angle_t angle;
int weaveindex;
if (!self->args[4])
@ -90,13 +89,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
if ((self->args[3] % 4) == 0)
{
weaveindex = self->special2;
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 4);
self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 4);
self->special2 = (weaveindex + 1) & 63;
}
angle = self->angle>>ANGLETOFINESHIFT;
self->vel.x = FixedMul(speed, finecosine[angle]);
self->vel.y = FixedMul(speed, finesine[angle]);
self->VelFromAngle(speed);
return 0;
}

View file

@ -242,7 +242,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
self->args[4] = SORCBALL_INITIAL_SPEED; // Initial orbit speed
self->special1 = ANGLE_1;
fixedvec3 pos = self->PosPlusZ(-self->floorclip + self->height);
DVector3 pos = self->PosPlusZ(-self->Floorclip + self->Height);
mo = Spawn("SorcBall1", pos, NO_REPLACE);
if (mo)
@ -279,7 +279,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
angle_t angle, baseangle;
int mode = self->target->args[3];
AHeresiarch *parent = barrier_cast<AHeresiarch *>(self->target);
int dist = parent->radius - (self->radius<<1);
int dist = parent->_f_radius() - (self->_f_radius()<<1);
angle_t prevangle = self->special1;
if (!self->IsKindOf (RUNTIME_CLASS(ASorcBall)))
@ -296,7 +296,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
baseangle = (angle_t)parent->special1;
angle = baseangle + actor->AngleOffset;
actor->angle = angle;
actor->Angles.Yaw = ANGLE2FLOAT(angle);
angle >>= ANGLETOFINESHIFT;
switch (mode)
@ -318,13 +318,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
case SORC_STOPPING: // Balls stopping
if ((parent->StopBall == actor->GetClass()) &&
(parent->args[1] > SORCBALL_SPEED_ROTATIONS) &&
(absangle(angle - (parent->angle>>ANGLETOFINESHIFT)) < (30<<5)))
(absangle(angle - (parent->_f_angle()>>ANGLETOFINESHIFT)) < (30<<5)))
{
// Can stop now
actor->target->args[3] = SORC_FIRESPELL;
actor->target->args[4] = 0;
// Set angle so self angle == sorcerer angle
parent->special1 = (int)(parent->angle - actor->AngleOffset);
parent->special1 = (int)(parent->_f_angle() - actor->AngleOffset);
}
else
{
@ -378,7 +378,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
fixedvec3 pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
-parent->floorclip + parent->height);
-parent->_f_floorclip() + parent->_f_height());
actor->SetOrigin (pos, true);
actor->floorz = parent->floorz;
actor->ceilingz = parent->ceilingz;
@ -551,7 +551,7 @@ void ASorcBall2::CastSorcererSpell ()
AActor *parent = target;
AActor *mo;
mo = Spawn("SorcFX2", PosPlusZ(-parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT), ALLOW_REPLACE);
mo = Spawn("SorcFX2", PosPlusZ(-parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT), ALLOW_REPLACE);
parent->flags2 |= MF2_REFLECTIVE|MF2_INVULNERABLE;
parent->args[0] = SORC_DEFENSE_TIME;
if (mo) mo->target = parent;
@ -573,8 +573,8 @@ void ASorcBall3::CastSorcererSpell ()
angle_t ang1, ang2;
AActor *parent = target;
ang1 = angle - ANGLE_45;
ang2 = angle + ANGLE_45;
ang1 = FLOAT2ANGLE(Angles.Yaw.Degrees) - ANGLE_45;
ang2 = FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_45;
PClassActor *cls = PClass::FindActor("SorcFX3");
if (health < (SpawnHealth()/3))
{ // Spawn 2 at a time
@ -622,8 +622,8 @@ void ASorcBall1::CastSorcererSpell ()
angle_t ang1, ang2;
AActor *parent = target;
ang1 = angle + ANGLE_1*70;
ang2 = angle - ANGLE_1*70;
ang1 = FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_1*70;
ang2 = FLOAT2ANGLE(Angles.Yaw.Degrees) - ANGLE_1*70;
PClassActor *cls = PClass::FindActor("SorcFX1");
mo = P_SpawnMissileAngle (parent, cls, ang1, 0);
if (mo)
@ -658,7 +658,7 @@ void A_SorcOffense2(AActor *actor)
int delta, index;
AActor *parent = actor->target;
AActor *dest = parent->target;
int dist;
double dist;
// [RH] If no enemy, then don't try to shoot.
if (dest == NULL)
@ -670,14 +670,13 @@ void A_SorcOffense2(AActor *actor)
actor->args[4] = (actor->args[4] + 15) & 255;
delta = (finesine[index])*SORCFX4_SPREAD_ANGLE;
delta = (delta>>FRACBITS)*ANGLE_1;
ang1 = actor->angle + delta;
ang1 = actor->_f_angle() + delta;
mo = P_SpawnMissileAngle(parent, PClass::FindActor("SorcFX4"), ang1, 0);
if (mo)
{
mo->special2 = 35*5/2; // 5 seconds
dist = mo->AproxDistance(dest) / mo->Speed;
if(dist < 1) dist = 1;
mo->vel.z = (dest->Z() - mo->Z()) / dist;
dist = mo->DistanceBySpeed(dest, mo->Speed);
mo->Vel.Z = (dest->Z() - mo->Z()) / dist;
}
}
@ -710,21 +709,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnFizzle)
{
PARAM_ACTION_PROLOGUE;
fixed_t dist = 5*FRACUNIT;
fixed_t speed = self->Speed >> FRACBITS;
angle_t rangle;
int speed = (int)self->Speed;
DAngle rangle;
AActor *mo;
int ix;
fixedvec3 pos = self->Vec3Angle(dist, self->angle, -self->floorclip + (self->height >> 1));
fixedvec3 pos = self->_f_Vec3Angle(dist, self->_f_angle(), -self->_f_floorclip() + (self->_f_height() >> 1));
for (ix=0; ix<5; ix++)
{
mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE);
if (mo)
{
rangle = (self->angle >> ANGLETOFINESHIFT) + ((pr_heresiarch()%5) << 1);
mo->vel.x = FixedMul(pr_heresiarch()%speed, finecosine[rangle]);
mo->vel.y = FixedMul(pr_heresiarch()%speed, finesine[rangle]);
mo->vel.z = FRACUNIT*2;
rangle = self->Angles.Yaw + (pr_heresiarch() % 5) * (4096 / 360.);
mo->Vel.X = (pr_heresiarch() % speed) * rangle.Cos();
mo->Vel.Y = (pr_heresiarch() % speed) * rangle.Sin();
mo->Vel.Z = 2;
}
}
return 0;
@ -776,7 +775,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
{
mo->target = self->target;
mo->args[0] = 0; // CW
mo->special1 = self->angle; // Set angle
mo->special1 = self->_f_angle(); // Set angle
mo->SetState (mo->FindState("Orbit"));
}
mo = Spawn(self->GetClass(), self->Pos(), NO_REPLACE);
@ -784,7 +783,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
{
mo->target = self->target;
mo->args[0] = 1; // CCW
mo->special1 = self->angle; // Set angle
mo->special1 = self->_f_angle(); // Set angle
mo->SetState (mo->FindState("Orbit"));
}
self->Destroy ();
@ -814,7 +813,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
return 0;
}
fixed_t dist = parent->radius;
fixed_t dist = parent->_f_radius();
if ((parent->health <= 0) || // Sorcerer is dead
(!parent->args[0])) // Time expired
@ -840,7 +839,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT);
parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT);
pos.z += FixedMul(15*FRACUNIT,finecosine[angle]);
// Spawn trailer
Spawn("SorcFX2T1", pos, ALLOW_REPLACE);
@ -852,7 +851,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
pos = parent->Vec3Offset(
FixedMul(dist, finecosine[angle]),
FixedMul(dist, finesine[angle]),
parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT);
parent->_f_floorclip() + SORC_DEFENSE_HEIGHT*FRACUNIT);
pos.z += FixedMul(20*FRACUNIT,finesine[angle]);
// Spawn trailer
Spawn("SorcFX2T1", pos, ALLOW_REPLACE);
@ -943,10 +942,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallPop)
S_Sound (self, CHAN_BODY, "SorcererBallPop", 1, ATTN_NONE);
self->flags &= ~MF_NOGRAVITY;
self->gravity = FRACUNIT/8;
self->vel.x = ((pr_heresiarch()%10)-5) << FRACBITS;
self->vel.y = ((pr_heresiarch()%10)-5) << FRACBITS;
self->vel.z = (2+(pr_heresiarch()%3)) << FRACBITS;
self->Gravity = 1. / 8;;
self->Vel.X = ((pr_heresiarch()%10)-5);
self->Vel.Y = ((pr_heresiarch()%10)-5);
self->Vel.Z = (2+(pr_heresiarch()%3));
self->special2 = 4*FRACUNIT; // Initial bounce factor
self->args[4] = BOUNCE_TIME_UNIT; // Bounce time unit
self->args[3] = 5; // Bounce time in seconds

View file

@ -66,9 +66,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryExplode)
if (mo)
{
mo->SetState (mo->SpawnState + (pr_pottery()%5));
mo->vel.z = ((pr_pottery()&7)+5)*(3*FRACUNIT/4);
mo->vel.x = (pr_pottery.Random2())<<(FRACBITS-6);
mo->vel.y = (pr_pottery.Random2())<<(FRACBITS-6);
mo->Vel.X = pr_pottery.Random2() / 64.;
mo->Vel.Y = pr_pottery.Random2() / 64.;
mo->Vel.Z = ((pr_pottery() & 7) + 5) * 0.75;
}
}
S_Sound (mo, CHAN_BODY, "PotteryExplode", 1, ATTN_NORM);
@ -117,7 +117,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryCheck)
if (playeringame[i])
{
AActor *pmo = players[i].mo;
if (P_CheckSight (self, pmo) && (absangle(pmo->AngleTo(self) - pmo->angle) <= ANGLE_45))
if (P_CheckSight (self, pmo) && (absangle(pmo->__f_AngleTo(self) - pmo->_f_angle()) <= ANGLE_45))
{ // Previous state (pottery bit waiting state)
self->SetState (self->state - 1);
return 0;
@ -141,7 +141,7 @@ IMPLEMENT_CLASS (AZCorpseLynchedNoHeart)
void AZCorpseLynchedNoHeart::PostBeginPlay ()
{
Super::PostBeginPlay ();
Spawn ("BloodPool", X(), Y(), floorz, ALLOW_REPLACE);
Spawn ("BloodPool", PosAtZ(floorz), ALLOW_REPLACE);
}
//============================================================================
@ -156,7 +156,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CorpseBloodDrip)
if (pr_drip() <= 128)
{
Spawn ("CorpseBloodDrip", self->PosPlusZ(self->height/2), ALLOW_REPLACE);
Spawn ("CorpseBloodDrip", self->PosPlusZ(self->_f_height()/2), ALLOW_REPLACE);
}
return 0;
}
@ -180,19 +180,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_CorpseExplode)
if (mo)
{
mo->SetState (mo->SpawnState + (pr_foo()%3));
mo->vel.z = ((pr_foo()&7)+5)*(3*FRACUNIT/4);
mo->vel.x = pr_foo.Random2()<<(FRACBITS-6);
mo->vel.y = pr_foo.Random2()<<(FRACBITS-6);
mo->Vel.X = pr_foo.Random2() / 64.;
mo->Vel.Y = pr_foo.Random2() / 64.;
mo->Vel.Z = ((pr_foo() & 7) + 5) * 0.75;
}
}
// Spawn a skull
mo = Spawn ("CorpseBit", self->Pos(), ALLOW_REPLACE);
mo = Spawn ("CorpseBit", self->_f_Pos(), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + 3);
mo->vel.z = ((pr_foo()&7)+5)*(3*FRACUNIT/4);
mo->vel.x = pr_foo.Random2()<<(FRACBITS-6);
mo->vel.y = pr_foo.Random2()<<(FRACBITS-6);
mo->Vel.X = pr_foo.Random2() / 64.;
mo->Vel.Y = pr_foo.Random2() / 64.;
mo->Vel.Z = ((pr_foo() & 7) + 5) * 0.75;
}
S_Sound (self, CHAN_BODY, self->DeathSound, 1, ATTN_IDLE);
self->Destroy ();
@ -222,7 +222,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn)
if (mo)
{
P_ThrustMobj (mo, self->angle, (pr_leaf()<<9)+3*FRACUNIT);
mo->Thrust(pr_leaf() / 128. + 3);
mo->target = self;
mo->special1 = 0;
}
@ -242,7 +242,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafThrust)
if (pr_leafthrust() <= 96)
{
self->vel.z += (pr_leafthrust()<<9)+FRACUNIT;
self->Vel.Z += pr_leafthrust() / 128. + 1;
}
return 0;
}
@ -263,18 +263,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafCheck)
self->SetState (NULL);
return 0;
}
angle_t ang = self->target ? self->target->angle : self->angle;
DAngle ang = self->target ? self->target->Angles.Yaw : self->Angles.Yaw;
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);
self->Thrust(ang, pr_leafcheck() / 128. + 1);
}
return 0;
}
self->SetState (self->SpawnState + 7);
self->vel.z = (pr_leafcheck()<<9)+FRACUNIT;
P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+2*FRACUNIT);
self->Vel.Z = pr_leafcheck() / 128. + 1;
self->Thrust(ang, pr_leafcheck() / 128. + 2);
self->flags |= MF_MISSILE;
return 0;
}
@ -310,14 +310,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode)
{
fixed_t xo = ((pr_soaexplode() - 128) << 12);
fixed_t yo = ((pr_soaexplode() - 128) << 12);
fixed_t zo = (pr_soaexplode()*self->height / 256);
fixed_t zo = (pr_soaexplode()*self->_f_height() / 256);
mo = Spawn ("ZArmorChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + i);
mo->vel.z = ((pr_soaexplode()&7)+5)*FRACUNIT;
mo->vel.x = pr_soaexplode.Random2()<<(FRACBITS-6);
mo->vel.y = pr_soaexplode.Random2()<<(FRACBITS-6);
mo->Vel.X = pr_soaexplode.Random2() / 64.;
mo->Vel.Y = pr_soaexplode.Random2() / 64.;
mo->Vel.Z = (pr_soaexplode() & 7) + 5;
}
}
// Spawn an item?
@ -365,7 +365,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BellReset1)
PARAM_ACTION_PROLOGUE;
self->flags |= MF_NOGRAVITY;
self->height <<= 2;
self->Height *= 4;
if (self->special)
{ // Initiate death action
P_ExecuteSpecial(self->special, NULL, NULL, false, self->args[0],

View file

@ -34,8 +34,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook)
CALL_ACTION(A_Look, self);
if (pr_iceguylook() < 64)
{
dist = ((pr_iceguylook()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
dist = ((pr_iceguylook()-128)*self->_f_radius())>>7;
an = (self->_f_angle()+ANG90)>>ANGLETOFINESHIFT;
Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]),
@ -62,8 +62,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
A_Chase (stack, self);
if (pr_iceguychase() < 128)
{
dist = ((pr_iceguychase()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
dist = ((pr_iceguychase()-128)*self->_f_radius())>>7;
an = (self->_f_angle()+ANG90)>>ANGLETOFINESHIFT;
mo = Spawn(WispTypes[pr_iceguychase() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]),
@ -71,9 +71,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
60 * FRACUNIT), ALLOW_REPLACE);
if (mo)
{
mo->vel.x = self->vel.x;
mo->vel.y = self->vel.y;
mo->vel.z = self->vel.z;
mo->Vel = self->Vel;
mo->target = self;
}
}
@ -94,8 +92,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
{
return 0;
}
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->angle+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
P_SpawnMissileXYZ(self->Vec3Angle(self->radius>>1, self->angle-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
P_SpawnMissileXYZ(self->_f_Vec3Angle(self->_f_radius()>>1, self->_f_angle()+ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
P_SpawnMissileXYZ(self->_f_Vec3Angle(self->_f_radius()>>1, self->_f_angle()-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
return 0;
}
@ -110,10 +108,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie)
{
PARAM_ACTION_PROLOGUE;
self->vel.x = 0;
self->vel.y = 0;
self->vel.z = 0;
self->height = self->GetDefault()->height;
self->Vel.Zero();
self->Height = self->GetDefault()->Height;
CALL_ACTION(A_FreezeDeathChunks, self);
return 0;
}
@ -133,7 +129,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
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));
if (mo)
{

View file

@ -48,7 +48,7 @@ const int KORAX_ARM4_HEIGHT = 104*FRACUNIT;
const int KORAX_ARM5_HEIGHT = 86*FRACUNIT;
const int KORAX_ARM6_HEIGHT = 53*FRACUNIT;
const int KORAX_BOLT_HEIGHT = 48*FRACUNIT;
const double KORAX_BOLT_HEIGHT = 48.;
const int KORAX_BOLT_LIFETIME = 3;
@ -99,7 +99,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
spot = iterator.Next ();
if (spot != NULL)
{
P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, 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);
@ -141,7 +141,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
self->tracer = spot;
if (spot)
{
P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, TELF_SOURCEFOG | TELF_DESTFOG);
P_Teleport (self, spot->_f_X(), spot->_f_Y(), ONFLOORZ, spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG);
}
}
}
@ -273,7 +273,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxCommand)
S_Sound (self, CHAN_VOICE, "KoraxCommand", 1, ATTN_NORM);
// Shoot stream of lightning to ceiling
ang = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
ang = (self->_f_angle() - ANGLE_90) >> ANGLETOFINESHIFT;
fixedvec3 pos = self->Vec3Offset(
KORAX_COMMAND_OFFSET * finecosine[ang],
KORAX_COMMAND_OFFSET * finesine[ang],
@ -331,11 +331,11 @@ void KoraxFire (AActor *actor, PClassActor *type, int arm)
angle_t ang;
ang = (actor->angle + (arm < 3 ? -KORAX_DELTAANGLE : KORAX_DELTAANGLE)) >> ANGLETOFINESHIFT;
ang = (actor->_f_angle() + (arm < 3 ? -KORAX_DELTAANGLE : KORAX_DELTAANGLE)) >> ANGLETOFINESHIFT;
fixedvec3 pos = actor->Vec3Offset(
extension[arm] * finecosine[ang],
extension[arm] * finesine[ang],
-actor->floorclip + armheight[arm]);
-actor->_f_floorclip() + armheight[arm]);
P_SpawnKoraxMissile (pos.x, pos.y, pos.z, actor, actor->target, type);
}
@ -354,12 +354,11 @@ void CHolyWeave (AActor *actor, FRandom &pr_random);
//
//============================================================================
void A_KSpiritSeeker (AActor *actor, angle_t thresh, angle_t turnMax)
static void A_KSpiritSeeker (AActor *actor, DAngle thresh, DAngle turnMax)
{
int dir;
int dist;
angle_t delta;
angle_t angle;
DAngle delta;
AActor *target;
fixed_t newZ;
fixed_t deltaZ;
@ -372,7 +371,7 @@ void A_KSpiritSeeker (AActor *actor, angle_t thresh, angle_t turnMax)
dir = P_FaceMobj (actor, target, &delta);
if (delta > thresh)
{
delta >>= 1;
delta /= 2;
if(delta > turnMax)
{
delta = turnMax;
@ -380,22 +379,20 @@ void A_KSpiritSeeker (AActor *actor, angle_t thresh, angle_t turnMax)
}
if(dir)
{ // Turn clockwise
actor->angle += delta;
actor->Angles.Yaw += delta;
}
else
{ // Turn counter clockwise
actor->angle -= delta;
actor->Angles.Yaw -= delta;
}
angle = actor->angle>>ANGLETOFINESHIFT;
actor->vel.x = FixedMul (actor->Speed, finecosine[angle]);
actor->vel.y = FixedMul (actor->Speed, finesine[angle]);
actor->VelFromAngle();
if (!(level.time&15)
|| actor->Z() > target->Z()+(target->GetDefault()->height)
|| actor->Top() < target->Z())
|| actor->_f_Z() > target->_f_Z()+(target->GetDefault()->_f_height())
|| actor->_f_Top() < target->_f_Z())
{
newZ = target->Z()+((pr_kspiritseek()*target->GetDefault()->height)>>8);
deltaZ = newZ-actor->Z();
newZ = target->_f_Z()+((pr_kspiritseek()*target->GetDefault()->_f_height())>>8);
deltaZ = newZ-actor->_f_Z();
if (abs(deltaZ) > 15*FRACUNIT)
{
if(deltaZ > 0)
@ -407,12 +404,12 @@ void A_KSpiritSeeker (AActor *actor, angle_t thresh, angle_t turnMax)
deltaZ = -15*FRACUNIT;
}
}
dist = actor->AproxDistance (target) / actor->Speed;
dist = actor->AproxDistance (target) / actor->_f_speed();
if (dist < 1)
{
dist = 1;
}
actor->vel.z = deltaZ/dist;
actor->Vel.Z = FIXED2DBL(deltaZ/dist);
}
return;
}
@ -436,8 +433,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KSpiritRoam)
{
if (self->tracer)
{
A_KSpiritSeeker (self, self->args[0]*ANGLE_1,
self->args[0]*ANGLE_1*2);
A_KSpiritSeeker(self, (double)self->args[0], self->args[0] * 2.);
}
CHolyWeave(self, pr_kspiritweave);
if (pr_kspiritroam()<50)
@ -477,14 +473,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_KBoltRaise)
PARAM_ACTION_PROLOGUE;
AActor *mo;
fixed_t z;
// Spawn a child upward
z = self->Z() + KORAX_BOLT_HEIGHT;
double z = self->Z() + KORAX_BOLT_HEIGHT;
if ((z + KORAX_BOLT_HEIGHT) < self->ceilingz)
{
mo = Spawn("KoraxBolt", self->X(), self->Y(), z, ALLOW_REPLACE);
mo = Spawn("KoraxBolt", self->PosAtZ(z), ALLOW_REPLACE);
if (mo)
{
mo->special1 = KORAX_BOLT_LIFETIME;
@ -507,26 +502,24 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, PClassActor *type)
{
AActor *th;
angle_t an;
DAngle an;
int dist;
z -= source->floorclip;
z -= source->_f_floorclip();
th = Spawn (type, x, y, z, ALLOW_REPLACE);
th->target = source; // Originator
an = th->AngleTo(dest);
if (dest->flags & MF_SHADOW)
{ // Invisible target
an += pr_kmissile.Random2()<<21;
an += pr_kmissile.Random2() * (45/256.);
}
th->angle = an;
an >>= ANGLETOFINESHIFT;
th->vel.x = FixedMul (th->Speed, finecosine[an]);
th->vel.y = FixedMul (th->Speed, finesine[an]);
dist = dest->AproxDistance (th) / th->Speed;
th->Angles.Yaw = an;
th->VelFromAngle();
dist = dest->AproxDistance (th) / th->_f_speed();
if (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);
}

View file

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

View file

@ -14,7 +14,7 @@
#include "g_level.h"
*/
#define ZAGSPEED FRACUNIT
#define ZAGSPEED 1.
static FRandom pr_lightningready ("LightningReady");
static FRandom pr_lightningclip ("LightningClip");
@ -42,8 +42,8 @@ int ALightning::SpecialMissileHit (AActor *thing)
{
if (thing->Mass != INT_MAX)
{
thing->vel.x += vel.x>>4;
thing->vel.y += vel.y>>4;
thing->Vel.X += Vel.X / 16;
thing->Vel.Y += Vel.Y / 16;
}
if ((!thing->player && !(thing->flags2&MF2_BOSS))
|| !(level.time&1))
@ -161,7 +161,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
}
else if (self->flags3 & MF3_CEILINGHUGGER)
{
self->SetZ(self->ceilingz-self->height);
self->SetZ(self->ceilingz - self->Height);
target = self->tracer;
}
if (self->flags3 & MF3_FLOORHUGGER)
@ -170,19 +170,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
zigZag = pr_lightningclip();
if((zigZag > 128 && self->special1 < 2) || self->special1 < -2)
{
P_ThrustMobj(self, self->angle+ANG90, ZAGSPEED);
self->Thrust(self->Angles.Yaw + 90, ZAGSPEED);
if(cMo)
{
P_ThrustMobj(cMo, self->angle+ANG90, ZAGSPEED);
cMo->Thrust(self->Angles.Yaw + 90, ZAGSPEED);
}
self->special1++;
}
else
{
P_ThrustMobj(self, self->angle-ANG90, ZAGSPEED);
self->Thrust(self->Angles.Yaw - 90, ZAGSPEED);
if(cMo)
{
P_ThrustMobj(cMo, cMo->angle-ANG90, ZAGSPEED);
cMo->Thrust(self->Angles.Yaw - 90, ZAGSPEED);
}
self->special1--;
}
@ -195,10 +195,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
}
else
{
self->angle = self->AngleTo(target);
self->vel.x = 0;
self->vel.y = 0;
P_ThrustMobj (self, self->angle, self->Speed>>1);
self->Angles.Yaw = self->AngleTo(target);
self->VelFromAngle(self->Speed / 2);
}
}
return 0;
@ -240,23 +238,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
{
deltaZ = -10*FRACUNIT;
}
fixed_t xo = ((pr_zap() - 128)*self->radius / 256);
fixed_t yo = ((pr_zap() - 128)*self->radius / 256);
fixed_t xo = ((pr_zap() - 128)*self->_f_radius() / 256);
fixed_t yo = ((pr_zap() - 128)*self->_f_radius() / 256);
mo = Spawn(lightning, self->Vec3Offset(xo, yo, deltaZ), ALLOW_REPLACE);
if (mo)
{
mo->lastenemy = self;
mo->vel.x = self->vel.x;
mo->vel.y = self->vel.y;
mo->Vel.X = self->Vel.X;
mo->Vel.Y = self->Vel.Y;
mo->target = self->target;
if (self->flags3 & MF3_FLOORHUGGER)
{
mo->vel.z = 20*FRACUNIT;
mo->Vel.Z = 20;
}
else
{
mo->vel.z = -20*FRACUNIT;
mo->Vel.Z = -20;
}
}
if ((self->flags3 & MF3_FLOORHUGGER) && pr_zapf() < 160)
@ -328,8 +326,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ZapMimic)
}
else
{
self->vel.x = mo->vel.x;
self->vel.y = mo->vel.y;
self->Vel.X = mo->Vel.X;
self->Vel.Y = mo->Vel.Y;
}
}
return 0;
@ -356,7 +354,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LastZap)
if (mo)
{
mo->SetState (mo->FindState (NAME_Death));
mo->vel.z = 40*FRACUNIT;
mo->Vel.Z = 40;
mo->Damage = NULL;
}
return 0;

View file

@ -97,13 +97,12 @@ bool AMageStaffFX2::SpecialBlastHandling (AActor *source, fixed_t strength)
//
//============================================================================
void MStaffSpawn (AActor *pmo, angle_t angle, AActor *alttarget)
void MStaffSpawn (AActor *pmo, DAngle angle, AActor *alttarget)
{
AActor *mo;
FTranslatedLineTarget t;
mo = P_SpawnPlayerMissile (pmo, 0, 0, 8*FRACUNIT,
RUNTIME_CLASS(AMageStaffFX2), angle, &t);
mo = P_SpawnPlayerMissile (pmo, 0, 0, 8*FRACUNIT, RUNTIME_CLASS(AMageStaffFX2), angle, &t);
if (mo)
{
mo->target = pmo;
@ -124,7 +123,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
player_t *player;
FTranslatedLineTarget t;
@ -139,21 +138,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
angle = self->angle;
angle = self->Angles.Yaw;
// [RH] Let's try and actually track what the player aimed at
P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &t, ANGLE_1*32);
P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &t, 32.);
if (t.linetarget == NULL)
{
BlockCheckLine.x = self->X();
BlockCheckLine.y = self->Y();
BlockCheckLine.dx = -finesine[angle >> ANGLETOFINESHIFT];
BlockCheckLine.dy = -finecosine[angle >> ANGLETOFINESHIFT];
BlockCheckLine.x = self->_f_X();
BlockCheckLine.y = self->_f_Y();
BlockCheckLine.dx = FLOAT2FIXED(-angle.Sin());
BlockCheckLine.dy = FLOAT2FIXED(-angle.Cos());
t.linetarget = P_BlockmapSearch (self, 10, FrontBlockCheck);
}
MStaffSpawn (self, angle, t.linetarget);
MStaffSpawn (self, angle-ANGLE_1*5, t.linetarget);
MStaffSpawn (self, angle+ANGLE_1*5, t.linetarget);
MStaffSpawn (self, angle-5, t.linetarget);
MStaffSpawn (self, angle+5, t.linetarget);
S_Sound (self, CHAN_WEAPON, "MageStaffFire", 1, ATTN_NORM);
weapon->MStaffCount = 3;
return 0;
@ -214,7 +213,7 @@ static AActor *FrontBlockCheck (AActor *mo, int index, void *)
{
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))
{
return link->Me;
@ -234,7 +233,7 @@ void MStaffSpawn2 (AActor *actor, angle_t angle)
{
AActor *mo;
mo = P_SpawnMissileAngleZ (actor, actor->Z()+40*FRACUNIT,
mo = P_SpawnMissileAngleZ (actor, actor->_f_Z()+40*FRACUNIT,
RUNTIME_CLASS(AMageStaffFX2), angle, 0);
if (mo)
{
@ -258,7 +257,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MageAttack)
return 0;
}
angle_t angle;
angle = self->angle;
angle = self->_f_angle();
MStaffSpawn2 (self, angle);
MStaffSpawn2 (self, angle-ANGLE_1*5);
MStaffSpawn2 (self, angle+ANGLE_1*5);

View file

@ -35,7 +35,7 @@ void APigPlayer::MorphPlayerThink ()
{
return;
}
if(!(vel.x | vel.y) && pr_pigplayerthink() < 64)
if(Vel.X == 0 && Vel.Y == 0 && pr_pigplayerthink() < 64)
{ // Snout sniff
if (player->ReadyWeapon != NULL)
{
@ -60,9 +60,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack)
{
PARAM_ACTION_PROLOGUE;
angle_t angle;
DAngle angle;
int damage;
int slope;
DAngle slope;
player_t *player;
AActor *puff;
FTranslatedLineTarget t;
@ -73,7 +73,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack)
}
damage = 3+(pr_snoutattack()&3);
angle = player->mo->angle;
angle = player->mo->Angles.Yaw;
slope = P_AimLineAttack(player->mo, angle, MELEERANGE);
puff = P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "SnoutPuff", true, &t);
S_Sound(player->mo, CHAN_VOICE, "PigActive", 1, ATTN_NORM);
@ -101,7 +101,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PigPain)
CALL_ACTION(A_Pain, self);
if (self->Z() <= self->floorz)
{
self->vel.z = FRACUNIT*7/2;
self->Vel.Z = 3.5;
}
return 0;
}

View file

@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentUnHide)
PARAM_ACTION_PROLOGUE;
self->renderflags &= ~RF_INVISIBLE;
self->floorclip = 24*FRACUNIT;
self->Floorclip = 24;
return 0;
}
@ -43,7 +43,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentHide)
PARAM_ACTION_PROLOGUE;
self->renderflags |= RF_INVISIBLE;
self->floorclip = 0;
self->Floorclip = 0;
return 0;
}
@ -58,7 +58,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentRaiseHump)
{
PARAM_ACTION_PROLOGUE;
self->floorclip -= 4*FRACUNIT;
self->Floorclip -= 4;
return 0;
}
@ -72,7 +72,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentLowerHump)
{
PARAM_ACTION_PROLOGUE;
self->floorclip += 4*FRACUNIT;
self->Floorclip += 4;
return 0;
}
@ -228,17 +228,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentSpawnGibs)
for (int i = countof(GibTypes)-1; i >= 0; --i)
{
fixedvec2 pos = self->Vec2Offset(
((pr_serpentgibs() - 128) << 12),
((pr_serpentgibs() - 128) << 12));
double x = (pr_serpentgibs() - 128) / 16.;
double y = (pr_serpentgibs() - 128) / 16.;
mo = Spawn (GibTypes[i], pos.x, pos.y,
self->floorz+FRACUNIT, ALLOW_REPLACE);
mo = Spawn (GibTypes[i], self->Vec2OffsetZ(x, y, self->floorz + 1), ALLOW_REPLACE);
if (mo)
{
mo->vel.x = (pr_serpentgibs()-128)<<6;
mo->vel.y = (pr_serpentgibs()-128)<<6;
mo->floorclip = 6*FRACUNIT;
mo->Vel.X = (pr_serpentgibs() - 128) / 1024.f;
mo->Vel.Y = (pr_serpentgibs() - 128) / 1024.f;
mo->Floorclip = 6;
}
}
return 0;
@ -254,7 +252,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FloatGib)
{
PARAM_ACTION_PROLOGUE;
self->floorclip -= FRACUNIT;
self->Floorclip -= 1;
return 0;
}
@ -268,7 +266,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SinkGib)
{
PARAM_ACTION_PROLOGUE;
self->floorclip += FRACUNIT;
self->Floorclip += 1;;
return 0;
}

View file

@ -82,7 +82,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustInitUp)
self->special2 = 5; // Raise speed
self->args[0] = 1; // Mark as up
self->floorclip = 0;
self->Floorclip = 0;
self->flags = MF_SOLID;
self->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
self->special1 = 0L;
@ -95,7 +95,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustInitDn)
self->special2 = 5; // Raise speed
self->args[0] = 0; // Mark as down
self->floorclip = self->GetDefault()->height;
self->Floorclip = self->GetDefault()->Height;
self->flags = 0;
self->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
self->renderflags = RF_INVISIBLE;
@ -111,7 +111,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustRaise)
AThrustFloor *actor = static_cast<AThrustFloor *>(self);
if (A_RaiseMobj (actor, self->special2*FRACUNIT))
if (A_RaiseMobj (actor, self->special2))
{ // Reached it's target height
actor->args[0] = 1;
if (actor->args[1])
@ -121,7 +121,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustRaise)
}
// Lose the dirt clump
if ((actor->floorclip < actor->height) && actor->DirtClump)
if ((actor->Floorclip < actor->Height) && actor->DirtClump)
{
actor->DirtClump->Destroy ();
actor->DirtClump = NULL;
@ -138,7 +138,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustLower)
{
PARAM_ACTION_PROLOGUE;
if (A_SinkMobj (self, 6*FRACUNIT))
if (A_SinkMobj (self, 6))
{
self->args[0] = 0;
if (self->args[1])
@ -160,8 +160,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale)
FMultiBlockThingsIterator::CheckResult cres;
while (it.Next(&cres))
{
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)
fixed_t blockdist = self->_f_radius() + cres.thing->_f_radius();
if (abs(cres.thing->_f_X() - cres.position.x) >= blockdist || abs(cres.thing->_f_Y() - cres.position.y) >= blockdist)
continue;
// 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->tracer = Owner;
mo->vel.z = 5*FRACUNIT;
mo->Vel.Z = 5;
}
return true;
}
@ -59,7 +59,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Summon)
if (P_TestMobjLocation(mo) == false || !self->tracer)
{ // Didn't fit - change back to artifact
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;
return 0;
}

View file

@ -55,11 +55,9 @@ static void TeloSpawn (AActor *source, const char *type)
if (fx)
{
fx->special1 = TELEPORT_LIFE; // Lifetime countdown
fx->angle = source->angle;
fx->Angles.Yaw = source->Angles.Yaw;
fx->target = source->target;
fx->vel.x = source->vel.x >> 1;
fx->vel.y = source->vel.y >> 1;
fx->vel.z = source->vel.z >> 1;
fx->Vel = source->Vel / 2;
}
}
@ -167,13 +165,11 @@ int ATelOtherFX1::DoSpecialDamage (AActor *target, int damage, FName damagetype)
void P_TeleportToPlayerStarts (AActor *victim)
{
fixed_t destX,destY;
angle_t destAngle;
FPlayerStart *start = G_PickPlayerStart(0, PPS_FORCERANDOM | PPS_NOBLOCKINGCHECK);
destX = start->x;
destY = start->y;
destAngle = ANG45 * (start->angle/45);
P_Teleport (victim, destX, destY, ONFLOORZ, destAngle, TELF_SOURCEFOG | TELF_DESTFOG);
P_Teleport (victim, destX, destY, ONFLOORZ, (double)start->angle, TELF_SOURCEFOG | TELF_DESTFOG);
}
//===========================================================================
@ -186,7 +182,6 @@ void P_TeleportToDeathmatchStarts (AActor *victim)
{
unsigned int i, selections;
fixed_t destX,destY;
angle_t destAngle;
selections = deathmatchstarts.Size ();
if (selections > 0)
@ -194,8 +189,7 @@ void P_TeleportToDeathmatchStarts (AActor *victim)
i = pr_teledm() % selections;
destX = deathmatchstarts[i].x;
destY = deathmatchstarts[i].y;
destAngle = ANG45 * (deathmatchstarts[i].angle/45);
P_Teleport (victim, destX, destY, ONFLOORZ, destAngle, TELF_SOURCEFOG | TELF_DESTFOG);
P_Teleport (victim, destX, destY, ONFLOORZ, (double)deathmatchstarts[i].angle, TELF_SOURCEFOG | TELF_DESTFOG);
}
else
{

View file

@ -31,12 +31,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithInit)
{
PARAM_ACTION_PROLOGUE;
self->AddZ(48<<FRACBITS);
self->AddZ(48);
// [RH] Make sure the wraith didn't go into the ceiling
if (self->Top() > self->ceilingz)
{
self->SetZ(self->ceilingz - self->height);
self->SetZ(self->ceilingz - self->Height);
}
self->special1 = 0; // index into floatbob
@ -57,7 +57,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithRaiseInit)
self->flags2 &= ~MF2_NONSHOOTABLE;
self->flags3 &= ~MF3_DONTBLAST;
self->flags |= MF_SHOOTABLE|MF_SOLID;
self->floorclip = self->height;
self->Floorclip = self->Height;
return 0;
}
@ -119,7 +119,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX2)
PARAM_ACTION_PROLOGUE;
AActor *mo;
angle_t angle;
DAngle angle;
int i;
for (i = 2; i; --i)
@ -127,21 +127,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX2)
mo = Spawn ("WraithFX2", self->Pos(), ALLOW_REPLACE);
if(mo)
{
if (pr_wraithfx2 ()<128)
angle = pr_wraithfx2() * (360 / 1024.f);
if (pr_wraithfx2() >= 128)
{
angle = self->angle+(pr_wraithfx2()<<22);
angle = -angle;
}
else
{
angle = self->angle-(pr_wraithfx2()<<22);
}
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]);
angle += self->Angles.Yaw;
mo->Vel.X = ((pr_wraithfx2() << 7) + 1) * angle.Cos();
mo->Vel.Y = ((pr_wraithfx2() << 7) + 1) * angle.Sin();
mo->Vel.Z = 0;
mo->target = self;
mo->floorclip = 10*FRACUNIT;
mo->Floorclip = 10;
}
}
return 0;
@ -255,9 +251,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithChase)
PARAM_ACTION_PROLOGUE;
int weaveindex = self->special1;
self->AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->_f_AddZ(finesine[weaveindex << BOBTOFINESHIFT] * 8);
self->special1 = (weaveindex + 2) & 63;
// if (self->floorclip > 0)
// if (self->Floorclip > 0)
// {
// P_SetMobjState(self, S_WRAITH_RAISE2);
// return;

View file

@ -1228,7 +1228,7 @@ void G_FinishTravel ()
{
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.
pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z());
pawn->SetXYZ(pawndup->_f_X(), pawndup->_f_Y(), pawndup->_f_Z());
}
}
oldpawn = pawndup;
@ -1240,13 +1240,10 @@ void G_FinishTravel ()
{
if (!(changeflags & CHANGELEVEL_KEEPFACING))
{
pawn->angle = pawndup->angle;
pawn->pitch = pawndup->pitch;
pawn->Angles = pawndup->Angles;
}
pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z());
pawn->vel.x = pawndup->vel.x;
pawn->vel.y = pawndup->vel.y;
pawn->vel.z = pawndup->vel.z;
pawn->SetXYZ(pawndup->Pos());
pawn->Vel = pawndup->Vel;
pawn->Sector = pawndup->Sector;
pawn->floorz = pawndup->floorz;
pawn->ceilingz = pawndup->ceilingz;
@ -1256,7 +1253,7 @@ void G_FinishTravel ()
pawn->floorterrain = pawndup->floorterrain;
pawn->ceilingsector = pawndup->ceilingsector;
pawn->ceilingpic = pawndup->ceilingpic;
pawn->floorclip = pawndup->floorclip;
pawn->Floorclip = pawndup->Floorclip;
pawn->waterlevel = pawndup->waterlevel;
}
else
@ -1316,7 +1313,7 @@ void G_InitLevelLocals ()
NormalLight.ChangeColor (PalEntry (255, 255, 255), 0);
level.gravity = sv_gravity * 35/TICRATE;
level.aircontrol = (fixed_t)(sv_aircontrol * 65536.f);
level.aircontrol = sv_aircontrol;
level.teamdamage = teamdamage;
level.flags = 0;
level.flags2 = 0;
@ -1357,7 +1354,7 @@ void G_InitLevelLocals ()
}
if (info->aircontrol != 0.f)
{
level.aircontrol = (fixed_t)(info->aircontrol * 65536.f);
level.aircontrol = info->aircontrol;
}
if (info->teamdamage != 0.f)
{
@ -1462,15 +1459,14 @@ FString CalcMapName (int episode, int level)
void G_AirControlChanged ()
{
if (level.aircontrol <= 256)
if (level.aircontrol <= 1/256.)
{
level.airfriction = FRACUNIT;
level.airfriction = 1.;
}
else
{
// Friction is inversely proportional to the amount of control
float fric = ((float)level.aircontrol/65536.f) * -0.0941f + 1.0004f;
level.airfriction = (fixed_t)(fric * 65536.f);
level.airfriction = level.aircontrol * -0.0941 + 1.0004;
}
}

View file

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

View file

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

View file

@ -29,7 +29,7 @@ bool AArtiTeleport::Use (bool pickup)
{
fixed_t destX;
fixed_t destY;
angle_t destAngle;
int destAngle;
if (deathmatch)
{
@ -37,16 +37,16 @@ bool AArtiTeleport::Use (bool pickup)
unsigned int i = pr_tele() % selections;
destX = deathmatchstarts[i].x;
destY = deathmatchstarts[i].y;
destAngle = ANG45 * (deathmatchstarts[i].angle/45);
destAngle = deathmatchstarts[i].angle;
}
else
{
FPlayerStart *start = G_PickPlayerStart(int(Owner->player - players));
destX = start->x;
destY = start->y;
destAngle = ANG45 * (start->angle/45);
destAngle = start->angle;
}
P_Teleport (Owner, destX, destY, ONFLOORZ, destAngle, TELF_SOURCEFOG | TELF_DESTFOG);
P_Teleport (Owner, destX, destY, ONFLOORZ, (double)destAngle, TELF_SOURCEFOG | TELF_DESTFOG);
bool canlaugh = true;
if (Owner->player->morphTics && (Owner->player->MorphStyle & MORPH_UNDOBYCHAOSDEVICE))
{ // Teleporting away will undo any morph effects (pig)

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)
{
PARAM_ACTION_PROLOGUE;
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
angle_t angle;
AActor *target;
int dist;
@ -210,9 +209,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
self->flags2 |= MF2_INVULNERABLE;
}
A_FaceTarget (self);
angle = self->angle>>ANGLETOFINESHIFT;
self->vel.x = FixedMul (MNTR_CHARGE_SPEED, finecosine[angle]);
self->vel.y = FixedMul (MNTR_CHARGE_SPEED, finesine[angle]);
self->VelFromAngle(MNTR_CHARGE_SPEED);
self->special1 = TICRATE/2; // Charge duration
}
else if (target->Z() == target->floorz
@ -260,7 +257,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurCharge)
type = PClass::FindActor("PunchPuff");
}
puff = Spawn (type, self->Pos(), ALLOW_REPLACE);
puff->vel.z = 2*FRACUNIT;
puff->Vel.Z = 2;
self->special1--;
}
else
@ -303,7 +300,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
return 0;
}
z = self->Z() + 40*FRACUNIT;
z = self->_f_Z() + 40*FRACUNIT;
PClassActor *fx = PClass::FindActor("MinotaurFX1");
if (fx)
{
@ -311,8 +308,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
if (mo != NULL)
{
// S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
vz = mo->vel.z;
angle = mo->angle;
vz = mo->_f_velz();
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/16), vz);
@ -358,7 +355,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk3)
}
else
{
if (self->floorclip > 0 && (i_compatflags & COMPATF_MINOTAUR))
if (self->Floorclip > 0 && (i_compatflags & COMPATF_MINOTAUR))
{
// only play the sound.
S_Sound (self, CHAN_WEAPON, "minotaur/fx2hit", 1, ATTN_NORM);
@ -393,12 +390,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
AActor *mo;
self->SetZ(self->floorz);
fixedvec2 pos = self->Vec2Offset(
(pr_fire.Random2 () << 10),
(pr_fire.Random2 () << 10));
mo = Spawn("MinotaurFX3", pos.x, pos.y, self->floorz, ALLOW_REPLACE);
double x = pr_fire.Random2() / 64.;
double y = pr_fire.Random2() / 64.;
mo = Spawn("MinotaurFX3", self->Vec2OffsetZ(x, y, self->floorz), ALLOW_REPLACE);
mo->target = self->target;
mo->vel.x = 1; // Force block checking
mo->Vel.X = MinVel; // Force block checking
P_CheckMissileSpawn (mo, self->radius);
return 0;
}
@ -411,18 +408,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
void P_MinotaurSlam (AActor *source, AActor *target)
{
angle_t angle;
fixed_t thrust;
DAngle angle;
double thrust;
int damage;
angle = source->AngleTo(target);
angle >>= ANGLETOFINESHIFT;
thrust = 16*FRACUNIT+(pr_minotaurslam()<<10);
target->vel.x += FixedMul (thrust, finecosine[angle]);
target->vel.y += FixedMul (thrust, finesine[angle]);
thrust = 16 + pr_minotaurslam() / 64.;
target->VelFromAngle(angle, thrust);
damage = pr_minotaurslam.HitDice (static_cast<AMinotaur *>(source) ? 4 : 6);
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)
{
target->reactiontime = 14+(pr_minotaurslam()&7);

View file

@ -142,7 +142,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_UnSetFloorClip)
PARAM_ACTION_PROLOGUE;
self->flags2 &= ~MF2_FLOORCLIP;
self->floorclip = 0;
self->Floorclip = 0;
return 0;
}
@ -189,7 +189,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath)
self->flags |= MF_SOLID|MF_SHOOTABLE|MF_NOBLOOD|MF_ICECORPSE;
self->flags2 |= MF2_PUSHABLE|MF2_TELESTOMP|MF2_PASSMOBJ|MF2_SLIDE;
self->flags3 |= MF3_CRASHED;
self->height = self->GetDefault()->height;
self->Height = self->GetDefault()->Height;
// Remove fuzz effects from frozen actors.
if (self->RenderStyle.BlendOp >= STYLEOP_Fuzz && self->RenderStyle.BlendOp <= STYLEOP_FuzzOrRevSub)
{
@ -274,33 +274,33 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
int numChunks;
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;
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);
// [RH] In Hexen, this creates a random number of shards (range [24,56])
// with no relation to the size of the self shattering. I think it should
// base the number of shards on the size of the dead thing, so bigger
// things break up into more shards than smaller things.
// An actor with radius 20 and height 64 creates ~40 chunks.
numChunks = MAX<int> (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32);
// An actor with _f_radius() 20 and height 64 creates ~40 chunks.
numChunks = MAX<int> (4, (self->_f_radius()>>FRACBITS)*(self->_f_height()>>FRACBITS)/32);
i = (pr_freeze.Random2()) % (numChunks/4);
for (i = MAX (24, numChunks + i); i >= 0; i--)
{
fixed_t xo = (((pr_freeze() - 128)*self->radius) >> 7);
fixed_t yo = (((pr_freeze() - 128)*self->radius) >> 7);
fixed_t zo = (pr_freeze()*self->height / 255);
fixed_t xo = (((pr_freeze() - 128)*self->_f_radius()) >> 7);
fixed_t yo = (((pr_freeze() - 128)*self->_f_radius()) >> 7);
fixed_t zo = (pr_freeze()*self->_f_height() / 255);
mo = Spawn("IceChunk", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->SpawnState + (pr_freeze()%3));
mo->vel.z = FixedDiv(mo->Z() - self->Z(), self->height)<<2;
mo->vel.x = pr_freeze.Random2 () << (FRACBITS-7);
mo->vel.y = pr_freeze.Random2 () << (FRACBITS-7);
mo->SetState (mo->SpawnState + (pr_freeze()%3));
mo->Vel.X = pr_freeze.Random2() / 128.;
mo->Vel.Y = pr_freeze.Random2() / 128.;
mo->Vel.Z = (mo->Z() - self->Z()) / self->Height * 4;
CALL_ACTION(A_IceSetTics, mo); // set a random tic wait
mo->RenderStyle = self->RenderStyle;
mo->alpha = self->alpha;
@ -311,11 +311,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
AActor *head = Spawn("IceChunkHead", self->PosPlusZ(self->player->mo->ViewHeight), ALLOW_REPLACE);
if (head != NULL)
{
head->vel.z = FixedDiv(head->Z() - self->Z(), self->height)<<2;
head->vel.x = pr_freeze.Random2 () << (FRACBITS-7);
head->vel.y = pr_freeze.Random2 () << (FRACBITS-7);
head->Vel.X = pr_freeze.Random2() / 128.;
head->Vel.Y = pr_freeze.Random2() / 128.;
head->Vel.Z = (mo->Z() - self->Z()) / self->Height * 4;
head->health = self->health;
head->angle = self->angle;
head->Angles.Yaw = self->Angles.Yaw;
if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
{
head->player = self->player;
@ -323,7 +324,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
self->player = NULL;
head->ObtainInventory (self);
}
head->pitch = 0;
head->Angles.Pitch = 0.;
head->RenderStyle = self->RenderStyle;
head->alpha = self->alpha;
if (head->player->camera == self)
@ -611,7 +612,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Gravity)
PARAM_ACTION_PROLOGUE;
self->flags &= ~MF_NOGRAVITY;
self->gravity = FRACUNIT;
self->Gravity = 1;
return 0;
}
@ -626,7 +627,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LowGravity)
PARAM_ACTION_PROLOGUE;
self->flags &= ~MF_NOGRAVITY;
self->gravity = FRACUNIT/8;
self->Gravity = 1. / 8;;
return 0;
}
@ -636,34 +637,33 @@ DEFINE_ACTION_FUNCTION(AActor, A_LowGravity)
//
//===========================================================================
void FaceMovementDirection (AActor *actor)
void FaceMovementDirection(AActor *actor)
{
switch (actor->movedir)
{
case DI_EAST:
actor->angle = 0<<24;
actor->Angles.Yaw = 0.;
break;
case DI_NORTHEAST:
actor->angle = 32<<24;
actor->Angles.Yaw = 45.;
break;
case DI_NORTH:
actor->angle = 64<<24;
actor->Angles.Yaw = 90.;
break;
case DI_NORTHWEST:
actor->angle = 96<<24;
actor->Angles.Yaw = 135.;
break;
case DI_WEST:
actor->angle = 128<<24;
actor->Angles.Yaw = 180.;
break;
case DI_SOUTHWEST:
actor->angle = 160<<24;
actor->Angles.Yaw = 225.;
break;
case DI_SOUTH:
actor->angle = 192<<24;
actor->Angles.Yaw = 270.;
break;
case DI_SOUTHEAST:
actor->angle = 224<<24;
actor->Angles.Yaw = 315.;
break;
}
}

View file

@ -520,9 +520,9 @@ void AHexenArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
// -O1 optimizer bug work around. Only needed for
// GCC 4.2.1 on OS X for 10.4/10.5 tools compatibility.
volatile fixed_t tmp = 300;
Slots[i] -= Scale (damage, SlotsIncrement[i], tmp);
Slots[i] -= ::Scale (damage, SlotsIncrement[i], tmp);
#else
Slots[i] -= Scale (damage, SlotsIncrement[i], 300);
Slots[i] -= ::Scale (damage, SlotsIncrement[i], 300);
#endif
if (Slots[i] < 2*FRACUNIT)
{
@ -535,7 +535,7 @@ void AHexenArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
}
}
}
int saved = Scale (damage, savedPercent, 100*FRACUNIT);
int saved = ::Scale (damage, savedPercent, 100*FRACUNIT);
if (saved > savedPercent >> (FRACBITS-1))
{
saved = savedPercent >> (FRACBITS-1);

View file

@ -981,9 +981,9 @@ void APowerFlight::InitEffect ()
Owner->flags |= MF_NOGRAVITY;
if (Owner->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
S_StopSound (Owner, CHAN_VOICE);
}
@ -1220,10 +1220,10 @@ void APowerSpeed::Serialize(FArchive &arc)
//
//===========================================================================
fixed_t APowerSpeed ::GetSpeedFactor ()
double APowerSpeed ::GetSpeedFactor ()
{
if (Inventory != NULL)
return FixedMul(Speed, Inventory->GetSpeedFactor());
return Speed * Inventory->GetSpeedFactor();
else
return Speed;
}
@ -1261,22 +1261,21 @@ void APowerSpeed::DoEffect ()
}
}
if (P_AproxDistance (Owner->vel.x, Owner->vel.y) <= 12*FRACUNIT)
if (Owner->Vel.LengthSquared() <= 12*12)
return;
AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->Pos(), NO_REPLACE);
if (speedMo)
{
speedMo->angle = Owner->angle;
speedMo->Angles.Yaw = Owner->Angles.Yaw;
speedMo->Translation = Owner->Translation;
speedMo->target = Owner;
speedMo->sprite = Owner->sprite;
speedMo->frame = Owner->frame;
speedMo->floorclip = Owner->floorclip;
speedMo->Floorclip = Owner->Floorclip;
// [BC] Also get the scale from the owner.
speedMo->scaleX = Owner->scaleX;
speedMo->scaleY = Owner->scaleY;
speedMo->Scale = Owner->Scale;
if (Owner == players[consoleplayer].camera &&
!(Owner->player->cheats & CF_CHASECAM))
@ -1317,10 +1316,10 @@ void APowerTargeter::InitEffect ()
P_SetPsprite (player, ps_targetright, state + 2);
}
player->psprites[ps_targetcenter].sx = (160-3)*FRACUNIT;
player->psprites[ps_targetcenter].sx = (160-3);
player->psprites[ps_targetcenter].sy =
player->psprites[ps_targetleft].sy =
player->psprites[ps_targetright].sy = (100-3)*FRACUNIT;
player->psprites[ps_targetright].sy = (100-3);
PositionAccuracy ();
}
@ -1383,8 +1382,8 @@ void APowerTargeter::PositionAccuracy ()
if (player != NULL)
{
player->psprites[ps_targetleft].sx = (160-3)*FRACUNIT - ((100 - player->mo->accuracy) << FRACBITS);
player->psprites[ps_targetright].sx = (160-3)*FRACUNIT + ((100 - player->mo->accuracy) << FRACBITS);
player->psprites[ps_targetleft].sx = (160-3) - ((100 - player->mo->accuracy));
player->psprites[ps_targetright].sx = (160-3)+ ((100 - player->mo->accuracy));
}
}

View file

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

View file

@ -9,7 +9,7 @@ static FRandom pr_orbit ("Orbit");
// Custom bridge --------------------------------------------------------
/*
args[0]: Bridge radius, in mapunits
args[0]: Bridge _f_radius(), in mapunits
args[1]: Bridge height, in mapunits
args[2]: Amount of bridge balls (if 0: Doom bridge)
args[3]: Rotation speed of bridge balls, in byte angle per seconds, sorta:
@ -28,8 +28,8 @@ static FRandom pr_orbit ("Orbit");
233: -30° / seconds
244: -15° / seconds
This value only matters if args[2] is not zero.
args[4]: Rotation radius of bridge balls, in bridge radius %.
If 0, use Hexen default: ORBIT_RADIUS, regardless of bridge radius.
args[4]: Rotation _f_radius() of bridge balls, in bridge _f_radius() %.
If 0, use Hexen default: ORBIT_RADIUS, regardless of bridge _f_radius().
This value only matters if args[2] is not zero.
*/
@ -48,13 +48,13 @@ void ACustomBridge::BeginPlay ()
if (args[2]) // Hexen bridge if there are balls
{
SetState(SeeState);
radius = args[0] ? args[0] << FRACBITS : 32 * FRACUNIT;
height = args[1] ? args[1] << FRACBITS : 2 * FRACUNIT;
radius = args[0] ? args[0] : 32;
Height = args[1] ? args[1] : 2;
}
else // No balls? Then a Doom bridge.
{
radius = args[0] ? args[0] << FRACBITS : 36 * FRACUNIT;
height = args[1] ? args[1] << FRACBITS : 4 * FRACUNIT;
radius = args[0] ? args[0] : 36;
Height = args[1] ? args[1] : 4;
RenderStyle = STYLE_Normal;
}
}
@ -101,18 +101,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
}
// Set default values
// Every five tics, Hexen moved the ball 3/256th of a revolution.
int rotationspeed = ANGLE_45/32*3/5;
int rotationradius = ORBIT_RADIUS * FRACUNIT;
DAngle rotationspeed = 45./32*3/5;
int rotationradius = ORBIT_RADIUS;
// If the bridge is custom, set non-default values if any.
// Set angular speed; 1--128: counterclockwise rotation ~=1--180°; 129--255: clockwise rotation ~= 180--1°
if (self->target->args[3] > 128) rotationspeed = ANGLE_45/32 * (self->target->args[3]-256) / TICRATE;
else if (self->target->args[3] > 0) rotationspeed = ANGLE_45/32 * (self->target->args[3]) / TICRATE;
// Set rotation radius
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100);
if (self->target->args[3] > 128) rotationspeed = 45./32 * (self->target->args[3]-256) / TICRATE;
else if (self->target->args[3] > 0) rotationspeed = 45./32 * (self->target->args[3]) / TICRATE;
// Set rotation _f_radius()
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->_f_radius()) / 100);
self->angle += rotationspeed;
self->SetOrigin(self->target->Vec3Angle(rotationradius, self->angle, 0), true);
self->Angles.Yaw += rotationspeed;
self->SetOrigin(self->target->Vec3Angle(rotationradius*FRACUNIT, self->Angles.Yaw, 0), true);
self->floorz = self->target->floorz;
self->ceilingz = self->target->ceilingz;
return 0;
@ -124,7 +124,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT(balltype, AActor) { balltype = NULL; }
angle_t startangle;
AActor *ball;
if (balltype == NULL)
@ -132,7 +131,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
balltype = PClass::FindActor("BridgeBall");
}
startangle = pr_orbit() << 24;
DAngle startangle = pr_orbit() * (360./256.);
// Spawn triad into world -- may be more than a triad now.
int ballcount = self->args[2]==0 ? 3 : self->args[2];
@ -140,7 +139,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
for (int i = 0; i < ballcount; i++)
{
ball = Spawn(balltype, self->Pos(), ALLOW_REPLACE);
ball->angle = startangle + (ANGLE_45/32) * (256/ballcount) * i;
ball->Angles.Yaw = startangle + (45./32) * (256/ballcount) * i;
ball->target = self;
CALL_ACTION(A_BridgeOrbit, ball);
}
@ -163,8 +162,8 @@ void AInvisibleBridge::BeginPlay ()
{
Super::BeginPlay ();
if (args[0])
radius = args[0] << FRACBITS;
radius = args[0];
if (args[1])
height = args[1] << FRACBITS;
Height = args[1];
}

View file

@ -37,6 +37,7 @@
#include "a_sharedglobal.h"
#include "p_local.h"
#include "farchive.h"
#include "math/cmath.h"
/*
== SecurityCamera
@ -56,10 +57,10 @@ public:
void Serialize (FArchive &arc);
protected:
angle_t Center;
angle_t Acc;
angle_t Delta;
angle_t Range;
DAngle Center;
DAngle Acc;
DAngle Delta;
DAngle Range;
};
IMPLEMENT_CLASS (ASecurityCamera)
@ -73,29 +74,25 @@ void ASecurityCamera::Serialize (FArchive &arc)
void ASecurityCamera::PostBeginPlay ()
{
Super::PostBeginPlay ();
Center = angle;
Center = Angles.Yaw;
if (args[2])
Delta = ANGLE_MAX / (args[2] * TICRATE / 8);
Delta = 360. / (args[2] * TICRATE / 8);
else
Delta = 0;
Delta = 0.;
if (args[1])
Delta /= 2;
Acc = 0;
pitch = (signed int)((char)args[0]) * ANGLE_1;
if (pitch <= -ANGLE_90)
pitch = -ANGLE_90 + ANGLE_1;
else if (pitch >= ANGLE_90)
pitch = ANGLE_90 - ANGLE_1;
Range = FLOAT2ANGLE(args[1]);
Acc = 0.;
Angles.Pitch = (double)clamp<int>((signed char)args[0], -89, 89);
Range = (double)args[1];
}
void ASecurityCamera::Tick ()
{
Acc += Delta;
if (Range)
angle = Center + FixedMul (Range, finesine[Acc >> ANGLETOFINESHIFT]);
else if (Delta)
angle = Acc;
if (Range != 0)
Angles.Yaw = Center + Range * Acc.Sin();
else if (Delta != 0)
Angles.Yaw = Acc;
}
/*
@ -119,7 +116,7 @@ public:
void Serialize (FArchive &arc);
protected:
int MaxPitchChange;
DAngle MaxPitchChange;
};
IMPLEMENT_CLASS (AAimingCamera)
@ -136,7 +133,7 @@ void AAimingCamera::PostBeginPlay ()
args[2] = 0;
Super::PostBeginPlay ();
MaxPitchChange = FLOAT2ANGLE(changepitch * TICRATE);
MaxPitchChange = double(changepitch / TICRATE);
Range /= TICRATE;
TActorIterator<AActor> iterator (args[3]);
@ -160,7 +157,7 @@ void AAimingCamera::Tick ()
}
if (tracer != NULL)
{
angle_t delta;
DAngle delta;
int dir = P_FaceMobj (this, tracer, &delta);
if (delta > Range)
{
@ -168,31 +165,31 @@ void AAimingCamera::Tick ()
}
if (dir)
{
angle += delta;
Angles.Yaw += delta;
}
else
{
angle -= delta;
Angles.Yaw -= delta;
}
if (MaxPitchChange)
if (MaxPitchChange != 0)
{ // 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);
double dz = Z() - tracer->Z() - tracer->height/2;
double dz = _f_Z() - tracer->_f_Z() - tracer->_f_height()/2;
double dist = vect.Length();
double ang = dist != 0.f ? atan2 (dz, dist) : 0;
int desiredpitch = (int)RAD2ANGLE(ang);
if (abs (desiredpitch - pitch) < MaxPitchChange)
DAngle desiredPitch = dist != 0.f ? VecToAngle(dist, dz) : 0.;
DAngle diff = deltaangle(Angles.Pitch, desiredPitch);
if (fabs (diff) < MaxPitchChange)
{
pitch = desiredpitch;
Angles.Pitch = desiredPitch;
}
else if (desiredpitch < pitch)
else if (diff < 0)
{
pitch -= MaxPitchChange;
Angles.Pitch -= MaxPitchChange;
}
else
{
pitch += MaxPitchChange;
Angles.Pitch += MaxPitchChange;
}
}
}

View file

@ -15,7 +15,7 @@ public:
{
if (!Super::FloorBounceMissile (plane))
{
if (abs (vel.z) < (FRACUNIT/2))
if (fabs (Vel.Z) < 0.5)
{
Destroy ();
}
@ -29,13 +29,13 @@ IMPLEMENT_CLASS(AGlassShard)
// Dirt stuff
void P_SpawnDirt (AActor *actor, fixed_t radius)
void P_SpawnDirt (AActor *actor, double radius)
{
PClassActor *dtype = NULL;
AActor *mo;
fixed_t zo = (pr_dirt() << 9) + FRACUNIT;
fixedvec3 pos = actor->Vec3Angle(radius, pr_dirt() << 24, zo);
double zo = pr_dirt() / 128. + 1;
DVector3 pos = actor->Vec3Angle(radius, pr_dirt() * (360./256), zo);
char fmt[8];
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);
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)
: 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(FLOAT2FIXED(basis->Scale.X)), ScaleY(FLOAT2FIXED(basis->Scale.Y)),
Alpha(basis->alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle)
{
@ -414,7 +414,7 @@ static void GetWallStuff (side_t *wall, vertex_t *&v1, fixed_t &ldx, fixed_t &ld
static fixed_t Length (fixed_t dx, fixed_t dy)
{
return (fixed_t)sqrt ((double)dx*(double)dx+(double)dy*(double)dy);
return (fixed_t)g_sqrt ((double)dx*(double)dx+(double)dy*(double)dy);
}
static side_t *NextWall (const side_t *wall)
@ -820,22 +820,22 @@ void ADecal::BeginPlay ()
{
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
{
// 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
// without effectively doing anything.
if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), Z(), angle + 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
{
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.
Destroy();

View file

@ -28,7 +28,7 @@ void AFastProjectile::Tick ()
int changexy;
ClearInterpolation();
fixed_t oldz = Z();
fixed_t oldz = _f_Z();
if (!(flags5 & MF5_NOTIMEFREEZE))
{
@ -45,9 +45,9 @@ void AFastProjectile::Tick ()
int shift = 3;
int count = 8;
if (radius > 0)
if (_f_radius() > 0)
{
while ( ((abs(vel.x) >> shift) > radius) || ((abs(vel.y) >> shift) > radius))
while ( ((abs(_f_velx()) >> shift) > _f_radius()) || ((abs(_f_vely()) >> shift) > _f_radius()))
{
// we need to take smaller steps.
shift++;
@ -56,11 +56,11 @@ void AFastProjectile::Tick ()
}
// Handle movement
if (vel.x || vel.y || (Z() != floorz) || vel.z)
if (!Vel.isZero() || (Z() != floorz))
{
xfrac = vel.x >> shift;
yfrac = vel.y >> shift;
zfrac = vel.z >> shift;
xfrac = _f_velx() >> shift;
yfrac = _f_vely() >> shift;
zfrac = _f_velz() >> shift;
changexy = xfrac || yfrac;
int ripcount = count >> 3;
for (i = 0; i < count; i++)
@ -72,14 +72,14 @@ void AFastProjectile::Tick ()
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
if (!(flags3 & MF3_SKYEXPLODE))
{
if (tm.ceilingline &&
tm.ceilingline->backsector &&
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.
// Does not handle sky floors.
@ -98,9 +98,9 @@ void AFastProjectile::Tick ()
return;
}
}
AddZ(zfrac);
_f_AddZ(zfrac);
UpdateWaterLevel (oldz);
oldz = Z();
oldz = _f_Z();
if (Z() <= floorz)
{ // Hit the floor
@ -126,7 +126,7 @@ void AFastProjectile::Tick ()
return;
}
SetZ(ceilingz - height);
SetZ(ceilingz - Height);
P_ExplodeMissile (this, NULL, NULL);
return;
}
@ -156,28 +156,25 @@ void AFastProjectile::Tick ()
void AFastProjectile::Effect()
{
//if (pr_smoke() < 128) // [RH] I think it looks better if it's consistent
FName name = GetClass()->MissileName;
if (name != NAME_None)
{
FName name = GetClass()->MissileName;
if (name != NAME_None)
{
fixed_t hitz = Z()-8*FRACUNIT;
double hitz = Z()-8;
if (hitz < floorz)
{
hitz = floorz;
}
// Do not clip this offset to the floor.
hitz += GetClass()->MissileHeight;
if (hitz < floorz)
{
hitz = floorz;
}
// Do not clip this offset to the floor.
hitz += GetClass()->MissileHeight;
PClassActor *trail = PClass::FindActor(name);
if (trail != NULL)
PClassActor *trail = PClass::FindActor(name);
if (trail != NULL)
{
AActor *act = Spawn (trail, PosAtZ(hitz), ALLOW_REPLACE);
if (act != NULL)
{
AActor *act = Spawn (trail, X(), Y(), hitz, ALLOW_REPLACE);
if (act != NULL)
{
act->angle = this->angle;
}
act->Angles.Yaw = Angles.Yaw;
}
}
}

View file

@ -40,22 +40,20 @@
class AHateTarget : public AActor
{
DECLARE_CLASS (AHateTarget, AActor)
DECLARE_CLASS(AHateTarget, AActor)
public:
void BeginPlay ();
int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype);
void BeginPlay();
int TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype);
};
IMPLEMENT_CLASS (AHateTarget)
IMPLEMENT_CLASS(AHateTarget)
void AHateTarget::BeginPlay ()
void AHateTarget::BeginPlay()
{
Super::BeginPlay ();
if (angle != 0)
Super::BeginPlay();
if (SpawnAngle != 0)
{ // Each degree translates into 10 units of health
health = Scale (angle >> 1, 1800, 0x40000000);
// Round to the nearest 10 because of inaccuracy above
health = (health + 5) / 10 * 10;
health = SpawnAngle * 10;
}
else
{
@ -64,7 +62,7 @@ void AHateTarget::BeginPlay ()
}
}
int AHateTarget::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype)
int AHateTarget::TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype)
{
if (special2 != 0)
{

View file

@ -88,7 +88,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
actor->RemoveFromHash ();
actor->tid = 0;
}
morphed->angle = actor->angle;
morphed->Angles.Yaw = actor->Angles.Yaw;
morphed->target = actor->target;
morphed->tracer = actor;
morphed->Score = actor->Score;
@ -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->health = morphed->health;
p->mo = morphed;
p->vel.x = p->vel.y = 0;
p->Vel.X = p->Vel.Y = 0;
morphed->ObtainInventory (actor);
// Remove all armor
for (item = morphed->Inventory; item != NULL; )
@ -223,15 +223,13 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
mo->tid = pmo->tid;
mo->AddToHash ();
}
mo->angle = pmo->angle;
mo->Angles.Yaw = pmo->Angles.Yaw;
mo->player = player;
mo->reactiontime = 18;
mo->flags = ActorFlags::FromInt (pmo->special2) & ~MF_JUSTHIT;
mo->vel.x = 0;
mo->vel.y = 0;
player->vel.x = 0;
player->vel.y = 0;
mo->vel.z = pmo->vel.z;
mo->Vel.X = mo->Vel.Y = 0;
player->Vel.Zero();
mo->Vel.Z = pmo->Vel.Z;
if (!(pmo->special2 & MF_JUSTHIT))
{
mo->renderflags &= ~RF_INVISIBLE;
@ -307,7 +305,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
}
}
angle = mo->angle >> ANGLETOFINESHIFT;
angle = mo->_f_angle() >> ANGLETOFINESHIFT;
AActor *eflash = NULL;
if (exit_flash != NULL)
{
@ -385,7 +383,7 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st
morphed = static_cast<AMorphedMonster *>(Spawn (spawntype, actor->Pos(), NO_REPLACE));
DObject::StaticPointerSubstitution (actor, morphed);
morphed->tid = actor->tid;
morphed->angle = actor->angle;
morphed->Angles.Yaw = actor->Angles.Yaw;
morphed->UnmorphedMe = actor;
morphed->alpha = actor->alpha;
morphed->RenderStyle = actor->RenderStyle;
@ -450,7 +448,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
beast->UnmorphTime = level.time + 5*TICRATE; // Next try in 5 seconds
return false;
}
actor->angle = beast->angle;
actor->Angles.Yaw = beast->Angles.Yaw;
actor->target = beast->target;
actor->FriendPlayer = beast->FriendPlayer;
actor->flags = beast->FlagsSave & ~MF_JUSTHIT;
@ -461,9 +459,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
if (!(beast->FlagsSave & MF_JUSTHIT))
actor->renderflags &= ~RF_INVISIBLE;
actor->health = actor->SpawnHealth();
actor->vel.x = beast->vel.x;
actor->vel.y = beast->vel.y;
actor->vel.z = beast->vel.z;
actor->Vel = beast->Vel;
actor->tid = beast->tid;
actor->special = beast->special;
actor->Score = beast->Score;

View file

@ -102,11 +102,7 @@ void AInterpolationPoint::FormChain ()
if (Next == NULL && (args[3] | args[4]))
Printf ("Can't find target for camera node %d\n", tid);
pitch = (signed int)((char)args[0]) * ANGLE_1;
if (pitch <= -ANGLE_90)
pitch = -ANGLE_90 + ANGLE_1;
else if (pitch >= ANGLE_90)
pitch = ANGLE_90 - ANGLE_1;
Angles.Pitch = (double)clamp<int>((signed char)args[0], -89, 89);
if (Next != NULL)
Next->FormChain ();
@ -302,7 +298,7 @@ void APathFollower::Tick ()
if (CurrNode->args[2])
{
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());
}
}
@ -360,9 +356,9 @@ bool APathFollower::Interpolate ()
if ((args[2] & 8) && Time > 0.f)
{
dx = X();
dy = Y();
dz = Z();
dx = _f_X();
dy = _f_Y();
dz = _f_Z();
}
if (CurrNode->Next==NULL) return false;
@ -371,20 +367,20 @@ bool APathFollower::Interpolate ()
fixed_t x, y, z;
if (args[2] & 1)
{ // linear
x = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->X()), FIXED2DBL(CurrNode->Next->X())));
y = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->Y()), FIXED2DBL(CurrNode->Next->Y())));
z = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->Z()), FIXED2DBL(CurrNode->Next->Z())));
x = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_X()), FIXED2DBL(CurrNode->Next->_f_X())));
y = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_Y()), FIXED2DBL(CurrNode->Next->_f_Y())));
z = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->_f_Z()), FIXED2DBL(CurrNode->Next->_f_Z())));
}
else
{ // spline
if (CurrNode->Next->Next==NULL) return false;
x = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->X()), FIXED2DBL(CurrNode->X()),
FIXED2DBL(CurrNode->Next->X()), FIXED2DBL(CurrNode->Next->Next->X())));
y = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->Y()), FIXED2DBL(CurrNode->Y()),
FIXED2DBL(CurrNode->Next->Y()), FIXED2DBL(CurrNode->Next->Next->Y())));
z = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->Z()), FIXED2DBL(CurrNode->Z()),
FIXED2DBL(CurrNode->Next->Z()), FIXED2DBL(CurrNode->Next->Next->Z())));
x = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_X()), FIXED2DBL(CurrNode->_f_X()),
FIXED2DBL(CurrNode->Next->_f_X()), FIXED2DBL(CurrNode->Next->Next->_f_X())));
y = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_Y()), FIXED2DBL(CurrNode->_f_Y()),
FIXED2DBL(CurrNode->Next->_f_Y()), FIXED2DBL(CurrNode->Next->Next->_f_Y())));
z = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->_f_Z()), FIXED2DBL(CurrNode->_f_Z()),
FIXED2DBL(CurrNode->Next->_f_Z()), FIXED2DBL(CurrNode->Next->Next->_f_Z())));
}
SetXYZ(x, y, z);
LinkToWorld ();
@ -395,9 +391,9 @@ bool APathFollower::Interpolate ()
{
if (args[2] & 1)
{ // linear
dx = CurrNode->Next->X() - CurrNode->X();
dy = CurrNode->Next->Y() - CurrNode->Y();
dz = CurrNode->Next->Z() - CurrNode->Z();
dx = CurrNode->Next->_f_X() - CurrNode->_f_X();
dy = CurrNode->Next->_f_Y() - CurrNode->_f_Y();
dz = CurrNode->Next->_f_Z() - CurrNode->_f_Z();
}
else if (Time > 0.f)
{ // spline
@ -426,66 +422,38 @@ bool APathFollower::Interpolate ()
}
if (args[2] & 2)
{ // adjust yaw
angle = R_PointToAngle2 (0, 0, dx, dy);
Angles.Yaw = VecToAngle(dx, dy);
}
if (args[2] & 4)
{ // adjust pitch; use floats for precision
double fdx = FIXED2DBL(dx);
double fdy = FIXED2DBL(dy);
double fdz = FIXED2DBL(-dz);
double dist = sqrt (fdx*fdx + fdy*fdy);
double ang = dist != 0.f ? atan2 (fdz, dist) : 0;
pitch = (fixed_t)RAD2ANGLE(ang);
double dist = g_sqrt (fdx*fdx + fdy*fdy);
Angles.Pitch = dist != 0.f ? VecToAngle(dist, fdz) : 0.;
}
}
else
{
if (args[2] & 2)
{ // interpolate angle
double angle1 = (double)CurrNode->angle;
double angle2 = (double)CurrNode->Next->angle;
if (angle2 - angle1 <= -2147483648.f)
{
double lerped = Lerp (angle1, angle2 + 4294967296.f);
if (lerped >= 4294967296.f)
{
angle = xs_CRoundToUInt(lerped - 4294967296.f);
}
else
{
angle = xs_CRoundToUInt(lerped);
}
}
else if (angle2 - angle1 >= 2147483648.f)
{
double lerped = Lerp (angle1, angle2 - 4294967296.f);
if (lerped < 0.f)
{
angle = xs_CRoundToUInt(lerped + 4294967296.f);
}
else
{
angle = xs_CRoundToUInt(lerped);
}
}
else
{
angle = xs_CRoundToUInt(Lerp (angle1, angle2));
}
DAngle angle1 = CurrNode->Angles.Yaw.Normalized180();
DAngle angle2 = angle1 + deltaangle(angle1, CurrNode->Next->Angles.Yaw);
Angles.Yaw = Lerp(angle1.Degrees, angle2.Degrees);
}
if (args[2] & 1)
{ // linear
if (args[2] & 4)
{ // interpolate pitch
pitch = FLOAT2FIXED(Lerp (FIXED2DBL(CurrNode->pitch), FIXED2DBL(CurrNode->Next->pitch)));
Angles.Pitch = Lerp(CurrNode->Angles.Pitch.Degrees, CurrNode->Next->Angles.Pitch.Degrees);
}
}
else
{ // spline
if (args[2] & 4)
{ // interpolate pitch
pitch = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->pitch), FIXED2DBL(CurrNode->pitch),
FIXED2DBL(CurrNode->Next->pitch), FIXED2DBL(CurrNode->Next->Next->pitch)));
Angles.Pitch = Splerp(PrevNode->Angles.Pitch.Degrees, CurrNode->Angles.Pitch.Degrees,
CurrNode->Next->Angles.Pitch.Degrees, CurrNode->Next->Next->Angles.Pitch.Degrees);
}
}
}
@ -549,18 +517,18 @@ bool AActorMover::Interpolate ()
if (Super::Interpolate ())
{
fixed_t savedz = tracer->Z();
tracer->SetZ(Z());
if (!P_TryMove (tracer, X(), Y(), true))
fixed_t savedz = tracer->_f_Z();
tracer->_f_SetZ(_f_Z());
if (!P_TryMove (tracer, _f_X(), _f_Y(), true))
{
tracer->SetZ(savedz);
tracer->_f_SetZ(savedz);
return false;
}
if (args[2] & 2)
tracer->angle = angle;
tracer->Angles.Yaw = Angles.Yaw;
if (args[2] & 4)
tracer->pitch = pitch;
tracer->Angles.Pitch = Angles.Pitch;
return true;
}
@ -665,16 +633,15 @@ bool AMovingCamera::Interpolate ()
if (Super::Interpolate ())
{
angle = AngleTo(tracer, true);
Angles.Yaw = AngleTo(tracer, true);
if (args[2] & 4)
{ // Also aim camera's pitch; use floats for precision
double dx = FIXED2DBL(X() - tracer->X());
double dy = FIXED2DBL(Y() - tracer->Y());
double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2);
double dist = sqrt (dx*dx + dy*dy);
double ang = dist != 0.f ? atan2 (dz, dist) : 0;
pitch = RAD2ANGLE(ang);
double dx = FIXED2DBL(_f_X() - tracer->_f_X());
double dy = FIXED2DBL(_f_Y() - tracer->_f_Y());
double dz = FIXED2DBL(_f_Z() - tracer->_f_Z() - tracer->_f_height()/2);
double dist = g_sqrt (dx*dx + dy*dy);
Angles.Pitch = dist != 0.f ? VecToAngle(dist, dz) : 0.;
}
return true;

View file

@ -421,20 +421,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
self->UnlinkFromWorld();
self->SetXY(_x, _y);
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.
if (self->flags & MF_SPAWNCEILING)
{
self->SetZ(self->ceilingz - self->height - self->SpawnPoint[2]);
self->_f_SetZ(self->_f_ceilingz() - self->_f_height() - self->SpawnPoint[2]);
}
else if (self->flags2 & MF2_SPAWNFLOAT)
{
fixed_t space = self->ceilingz - self->height - self->floorz;
if (space > 48*FRACUNIT)
double space = self->ceilingz - self->Height - self->floorz;
if (space > 48)
{
space -= 40*FRACUNIT;
self->SetZ(((space * pr_restore())>>8) + self->floorz + 40*FRACUNIT);
space -= 40;
self->SetZ((space * pr_restore()) / 256. + self->floorz + 40);
}
else
{
@ -443,7 +443,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
}
else
{
self->SetZ(self->SpawnPoint[2] + self->floorz);
self->_f_SetZ(self->SpawnPoint[2] + self->_f_floorz());
}
// Redo floor/ceiling check, in case of 3D floors and portals
P_FindFloorCeiling(self, FFCF_SAMESECTOR | FFCF_ONLY3DFLOORS | FFCF_3DRESTRICT);
@ -454,7 +454,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
}
if ((self->flags & MF_SOLID) && (self->Top() > self->ceilingz))
{ // Do the same for the ceiling.
self->SetZ(self->ceilingz - self->height);
self->SetZ(self->ceilingz - self->Height);
}
// 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.
@ -790,7 +790,7 @@ AInventory *AInventory::CreateTossable ()
flags &= ~(MF_SPECIAL|MF_SOLID);
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)
{
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)
{
@ -910,7 +910,7 @@ fixed_t AInventory::GetSpeedFactor ()
}
else
{
return FRACUNIT;
return 1.;
}
}
@ -1354,7 +1354,7 @@ bool AInventory::DoRespawn ()
if (spot != NULL)
{
SetOrigin (spot->Pos(), false);
SetZ(floorz);
_f_SetZ(_f_floorz());
}
}
return true;

View file

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

View file

@ -132,7 +132,7 @@ void DEarthquake::Tick ()
fixed_t dist;
dist = m_Spot->AproxDistance (victim, true);
// Check if in damage radius
// Check if in damage _f_radius()
if (dist < m_DamageRadius && victim->Z() <= victim->floorz)
{
if (pr_quake() < 50)
@ -140,19 +140,9 @@ void DEarthquake::Tick ()
P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), NAME_None);
}
// Thrust player around
angle_t an = victim->angle + ANGLE_1*pr_quake();
if (m_IntensityX == m_IntensityY)
{ // Thrust in a circle
P_ThrustMobj (victim, an, m_IntensityX/2);
}
else
{ // Thrust in an ellipse
an >>= ANGLETOFINESHIFT;
// So this is actually completely wrong, but it ought to be good
// enough. Otherwise, I'd have to use tangents and square roots.
victim->vel.x += FixedMul(m_IntensityX/2, finecosine[an]);
victim->vel.y += FixedMul(m_IntensityY/2, finesine[an]);
}
DAngle an = victim->Angles.Yaw + pr_quake();
victim->Vel.X += FIXED2DBL(m_IntensityX) * an.Cos() * 0.5;
victim->Vel.Y += FIXED2DBL(m_IntensityY) * an.Sin() * 0.5;
}
}
}
@ -175,7 +165,7 @@ fixed_t DEarthquake::GetModWave(double waveMultiplier) const
//Named waveMultiplier because that's as the name implies: adds more waves per second.
double time = m_Countdown - FIXED2DBL(r_TicFrac);
return FLOAT2FIXED(sin(waveMultiplier * time * (M_PI * 2 / TICRATE)));
return FLOAT2FIXED(g_sin(waveMultiplier * time * (M_PI * 2 / TICRATE)));
}
//==========================================================================

View file

@ -114,7 +114,7 @@ class ARandomSpawner : public AActor
{
Species = cls->TypeName;
AActor *defmobj = GetDefaultByType(cls);
this->Speed = defmobj->Speed;
this->Speed = defmobj->Speed;
this->flags |= (defmobj->flags & MF_MISSILE);
this->flags2 |= (defmobj->flags2 & MF2_SEEKERMISSILE);
this->flags4 |= (defmobj->flags4 & MF4_SPECTRAL);
@ -151,7 +151,7 @@ class ARandomSpawner : public AActor
{
tracer = target->target;
}
newmobj = P_SpawnMissileXYZ(Pos(), target, target->target, cls, false);
newmobj = P_SpawnMissileXYZ(_f_Pos(), target, target->target, cls, false);
}
else
{
@ -160,7 +160,8 @@ class ARandomSpawner : public AActor
if (newmobj != NULL)
{
// copy everything relevant
newmobj->SpawnAngle = newmobj->angle = angle;
newmobj->SpawnAngle = SpawnAngle;
newmobj->Angles = Angles;
newmobj->SpawnPoint[2] = SpawnPoint[2];
newmobj->special = special;
newmobj->args[0] = args[0];
@ -175,9 +176,7 @@ class ARandomSpawner : public AActor
newmobj->SpawnFlags = SpawnFlags;
newmobj->tid = tid;
newmobj->AddToHash();
newmobj->vel.x = vel.x;
newmobj->vel.y = vel.y;
newmobj->vel.z = vel.z;
newmobj->Vel = Vel;
newmobj->master = master; // For things such as DamageMaster/DamageChildren, transfer mastery.
newmobj->target = target;
newmobj->tracer = tracer;
@ -189,17 +188,17 @@ class ARandomSpawner : public AActor
// Handle special altitude flags
if (newmobj->flags & MF_SPAWNCEILING)
{
newmobj->SetZ(newmobj->ceilingz - newmobj->height - SpawnPoint[2]);
newmobj->_f_SetZ(newmobj->_f_ceilingz() - newmobj->_f_height() - SpawnPoint[2]);
}
else if (newmobj->flags2 & MF2_SPAWNFLOAT)
{
fixed_t space = newmobj->ceilingz - newmobj->height - newmobj->floorz;
if (space > 48*FRACUNIT)
double space = newmobj->ceilingz - newmobj->Height - newmobj->floorz;
if (space > 48)
{
space -= 40*FRACUNIT;
newmobj->SetZ(MulScale8 (space, pr_randomspawn()) + newmobj->floorz + 40*FRACUNIT);
space -= 40;
newmobj->SetZ((space * pr_randomspawn()) / 256. + newmobj->floorz + 40);
}
newmobj->AddZ(SpawnPoint[2]);
newmobj->_f_AddZ(SpawnPoint[2]);
}
if (newmobj->flags & MF_MISSILE)
P_CheckMissileSpawn(newmobj, 0);

View file

@ -9,7 +9,7 @@ struct vertex_t;
struct side_t;
struct F3DFloor;
void P_SpawnDirt (AActor *actor, fixed_t radius);
void P_SpawnDirt (AActor *actor, double radius);
class DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *sec, fixed_t x, fixed_t y, fixed_t z, angle_t angle, fixed_t tracedist, bool permanent);
class DBaseDecal : public DThinker

View file

@ -50,6 +50,6 @@ IMPLEMENT_CLASS (ASpark)
void ASpark::Activate (AActor *activator)
{
Super::Activate (activator);
P_DrawSplash (args[0] ? args[0] : 32, X(), Y(), Z(), angle, 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);
}

View file

@ -149,17 +149,17 @@ struct FSpotList
//
//----------------------------------------------------------------------------
ASpecialSpot *GetSpotWithMinMaxDistance(fixed_t x, fixed_t y, fixed_t mindist, fixed_t maxdist)
ASpecialSpot *GetSpotWithMinMaxDistance(double x, double y, double mindist, double maxdist)
{
if (Spots.Size() == 0) return NULL;
int i = pr_spot() % Spots.Size();
int initial = i;
fixed_t distance;
double distance;
while (true)
{
distance = Spots[i]->AproxDistance(x, y);
distance = Spots[i]->Distance2D(x, y);
if ((distance >= mindist) && ((maxdist == 0) || (distance <= maxdist))) break;
@ -337,7 +337,7 @@ ASpecialSpot *DSpotState::GetNextInList(const PClass *type, int skipcounter)
//
//----------------------------------------------------------------------------
ASpecialSpot *DSpotState::GetSpotWithMinMaxDistance(const PClass *type, fixed_t x, fixed_t y, fixed_t mindist, fixed_t maxdist)
ASpecialSpot *DSpotState::GetSpotWithMinMaxDistance(const PClass *type, double x, double y, double mindist, double maxdist)
{
FSpotList *list = FindSpotList(type);
if (list != NULL) return list->GetSpotWithMinMaxDistance(x, y, mindist, maxdist);

View file

@ -36,7 +36,7 @@ public:
bool RemoveSpot(ASpecialSpot *spot);
void Serialize(FArchive &arc);
ASpecialSpot *GetNextInList(const PClass *type, int skipcounter);
ASpecialSpot *GetSpotWithMinMaxDistance(const PClass *type, fixed_t x, fixed_t y, fixed_t mindist, fixed_t maxdist);
ASpecialSpot *GetSpotWithMinMaxDistance(const PClass *type, double x, double y, double mindist, double maxdist);
ASpecialSpot *GetRandomSpot(const PClass *type, bool onlyonce = false);
};

View file

@ -338,9 +338,6 @@ bool FMugShot::SetState(const char *state_name, bool wait_till_done, bool reset)
CVAR(Bool,st_oldouch,false,CVAR_ARCHIVE)
int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
{
int i;
angle_t badguyangle;
angle_t diffang;
FString full_state_name;
if (player->health > 0)
@ -366,25 +363,14 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
if (player->mo != NULL)
{
// The next 12 lines are from the Doom statusbar code.
badguyangle = player->mo->AngleTo(player->attacker);
if (badguyangle > player->mo->angle)
{
// whether right or left
diffang = badguyangle - player->mo->angle;
i = diffang > ANG180;
}
else
{
// whether left or right
diffang = player->mo->angle - badguyangle;
i = diffang <= ANG180;
} // confusing, aint it?
if (i && diffang >= ANG45)
{
DAngle badguyangle = player->mo->AngleTo(player->attacker);
DAngle diffang = deltaangle(player->mo->Angles.Yaw, badguyangle);
if (diffang > 45.)
{ // turn face right
damage_angle = 0;
}
else if (!i && diffang >= ANG45)
{
else if (diffang < -45.)
{ // turn face left
damage_angle = 2;
}
}

View file

@ -310,8 +310,8 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
if (applyscale)
{
spawnScaleX = FIXED2DBL(item->scaleX);
spawnScaleY = FIXED2DBL(item->scaleY);
spawnScaleX = item->Scale.X;
spawnScaleY = item->Scale.Y;
}
texture = TexMan[icon];

View file

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

View file

@ -1286,7 +1286,7 @@ void DBaseStatusBar::Draw (EHudState state)
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)
{
mysnprintf (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS);

View file

@ -29,12 +29,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall)
int t;
t = pr_spectrechunk() & 15;
foo->vel.x = (t - (pr_spectrechunk() & 7)) << FRACBITS;
foo->Vel.X = (t - (pr_spectrechunk() & 7));
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;
}
@ -50,12 +50,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge)
int t;
t = pr_spectrechunk() & 7;
foo->vel.x = (t - (pr_spectrechunk() & 15)) << FRACBITS;
foo->Vel.X = (t - (pr_spectrechunk() & 15));
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;
}
@ -69,18 +69,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack)
AActor *foo = Spawn("SpectralLightningV2", self->PosPlusZ(32*FRACUNIT), ALLOW_REPLACE);
foo->vel.z = -12*FRACUNIT;
foo->Vel.Z = -12;
foo->target = self;
foo->FriendPlayer = 0;
foo->tracer = self->target;
self->angle -= ANGLE_180 / 20 * 10;
self->Angles.Yaw -= 90.;
for (int i = 0; i < 20; ++i)
{
self->angle += ANGLE_180 / 20;
self->Angles.Yaw += 9.;
P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall2"), self);
}
self->angle -= ANGLE_180 / 20 * 10;
self->Angles.Yaw -= 90.;
return 0;
}

View file

@ -28,20 +28,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
if (CrusaderCheckRange (self))
{
A_FaceTarget (self);
self->angle -= ANGLE_180/16;
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
self->Angles.Yaw -= 180./16;
P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
}
else
{
if (P_CheckMissileRange (self))
{
A_FaceTarget (self);
P_SpawnMissileZAimed (self, self->Z() + 56*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->angle -= ANGLE_45/32;
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->angle += ANGLE_45/16;
P_SpawnMissileZAimed (self, self->Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->angle -= ANGLE_45/16;
P_SpawnMissileZAimed (self, self->_f_Z() + 56*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw -= 45./32;
P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw += 45./16;
P_SpawnMissileZAimed (self, self->_f_Z() + 40*FRACUNIT, self->target, PClass::FindActor("CrusaderMissile"));
self->Angles.Yaw -= 45./16;
self->reactiontime += 15;
}
self->SetState (self->SeeState);
@ -53,11 +53,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
{
PARAM_ACTION_PROLOGUE;
self->angle += ANGLE_90/16;
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
self->Angles.Yaw += 90./16;
AActor *misl = P_SpawnMissileZAimed (self, self->_f_Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
if (misl != NULL)
{
misl->vel.z += FRACUNIT;
misl->Vel.Z += 1;
}
return 0;
}
@ -66,11 +66,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight)
{
PARAM_ACTION_PROLOGUE;
self->angle -= ANGLE_90/16;
AActor *misl = P_SpawnMissileZAimed (self, self->Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
self->Angles.Yaw -= 90./16;
AActor *misl = P_SpawnMissileZAimed (self, self->_f_Z() + 48*FRACUNIT, self->target, PClass::FindActor("FastFlameMissile"));
if (misl != NULL)
{
misl->vel.z += FRACUNIT;
misl->Vel.Z += 1;
}
return 0;
}

View file

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

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