- first stage of converting actor angles to float complete

Patched up everything so that it compiles without errors again. This only addresses code related to some compile error. A large portion of the angle code still uses angle_t and converts back and forth.
This commit is contained in:
Christoph Oelckers 2016-03-16 12:41:26 +01:00
parent c64eee5b15
commit 671291227e
112 changed files with 1132 additions and 1232 deletions

View file

@ -600,7 +600,7 @@ public:
// Adjusts the angle for deflection/reflection of incoming missiles // Adjusts the angle for deflection/reflection of incoming missiles
// Returns true if the missile should be allowed to explode anyway // 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 // Returns true if this actor is within melee range of its target
bool CheckMeleeRange(); bool CheckMeleeRange();
@ -782,9 +782,9 @@ public:
} }
// These also set CF_INTERPVIEW for players. // These also set CF_INTERPVIEW for players.
void SetPitch(int p, bool interpolate, bool forceclamp = false); void SetPitch(DAngle p, bool interpolate, bool forceclamp = false);
void SetAngle(angle_t ang, bool interpolate); void SetAngle(DAngle ang, bool interpolate);
void SetRoll(angle_t roll, bool interpolate); void SetRoll(DAngle roll, bool interpolate);
PClassActor *GetBloodType(int type = 0) const PClassActor *GetBloodType(int type = 0) const
{ {
@ -872,6 +872,18 @@ public:
return R_PointToAngle2(X(), Y(), other->X() + oxofs, other->Y() + oyofs); return R_PointToAngle2(X(), Y(), other->X() + oxofs, other->Y() + oyofs);
} }
DAngle _f_AngleTo(AActor *other, bool absolute = false)
{
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
return g_atan2(otherpos.y - Y(), otherpos.x - X());
}
DAngle _f_AngleTo(AActor *other, fixed_t oxofs, fixed_t oyofs, bool absolute = false) const
{
fixedvec3 otherpos = absolute ? other->Pos() : other->PosRelative(this);
return g_atan2(otherpos.y + oxofs - Y(), otherpos.x + oyofs - X());
}
fixedvec2 Vec2To(AActor *other) const fixedvec2 Vec2To(AActor *other) const
{ {
fixedvec3 otherpos = other->PosRelative(this); fixedvec3 otherpos = other->PosRelative(this);
@ -973,7 +985,20 @@ public:
AActor *snext, **sprev; // links in sector (if needed) 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. 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; angle_t angle;
fixed_t pitch;
angle_t roll; // This was fixed_t before, which is probably wrong
*/
DRotator Angles;
// 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); }
WORD sprite; // used to find patch_t and flip value WORD sprite; // used to find patch_t and flip value
BYTE frame; // sprite frame to draw BYTE frame; // sprite frame to draw
fixed_t scaleX, scaleY; // Scaling values; FRACUNIT is normal size fixed_t scaleX, scaleY; // Scaling values; FRACUNIT is normal size
@ -985,8 +1010,6 @@ public:
DWORD fillcolor; // Color to draw when STYLE_Shaded DWORD fillcolor; // Color to draw when STYLE_Shaded
// interaction info // interaction info
fixed_t pitch;
angle_t roll; // This was fixed_t before, which is probably wrong
FBlockNode *BlockNode; // links in blocks (if needed) FBlockNode *BlockNode; // links in blocks (if needed)
struct sector_t *Sector; struct sector_t *Sector;
subsector_t * subsector; subsector_t * subsector;
@ -1148,7 +1171,8 @@ public:
// [RH] Used to interpolate the view to get >35 FPS // [RH] Used to interpolate the view to get >35 FPS
fixed_t PrevX, PrevY, PrevZ; fixed_t PrevX, PrevY, PrevZ;
angle_t PrevAngle; //angle_t PrevAngle;
DRotator PrevAngles;
int PrevPortalGroup; int PrevPortalGroup;
// ThingIDs // ThingIDs
@ -1284,6 +1308,56 @@ public:
__pos.y = npos.y; __pos.y = npos.y;
__pos.z = npos.z; __pos.z = npos.z;
} }
fixed_t VelXYToSpeed() const
{
return xs_CRoundToInt(sqrt((double)vel.x * vel.x + (double)vel.y*vel.y));
}
fixed_t VelToSpeed() const
{
return xs_CRoundToInt(sqrt((double)vel.x * vel.x + (double)vel.y*vel.y + (double)vel.z*vel.z));
}
void AngleFromVel()
{
Angles.Yaw = vectoyaw(DVector2(vel.x, vel.y));
}
void VelFromAngle()
{
vel.x = xs_CRoundToInt(Speed * Angles.Yaw.Cos());
vel.y = xs_CRoundToInt(Speed * Angles.Yaw.Sin());
}
void VelFromAngle(fixed_t speed)
{
vel.x = xs_CRoundToInt(speed * Angles.Yaw.Cos());
vel.y = xs_CRoundToInt(speed * Angles.Yaw.Sin());
}
void VelFromAngle(DAngle angle, fixed_t speed)
{
vel.x = xs_CRoundToInt(speed * angle.Cos());
vel.y = xs_CRoundToInt(speed * angle.Sin());
}
void Vel3DFromAngle(DAngle angle, DAngle pitch, fixed_t speed)
{
double cospitch = pitch.Cos();
vel.x = xs_CRoundToInt(speed * cospitch * angle.Cos());
vel.y = xs_CRoundToInt(speed * cospitch * angle.Sin());
vel.z = xs_CRoundToInt(speed * -pitch.Sin());
}
void Vel3DFromAngle(DAngle pitch, fixed_t speed)
{
double cospitch = pitch.Cos();
vel.x = xs_CRoundToInt(speed * cospitch * Angles.Yaw.Cos());
vel.y = xs_CRoundToInt(speed * cospitch * Angles.Yaw.Sin());
vel.z = xs_CRoundToInt(speed * -pitch.Sin());
}
}; };
class FActorIterator class FActorIterator
@ -1394,6 +1468,11 @@ inline fixedvec2 Vec2Angle(fixed_t length, angle_t angle)
return ret; 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); void PrintMiscActorInfo(AActor * query);
AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch, ActorFlags actorMask, DWORD wallMask); AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch, ActorFlags actorMask, DWORD wallMask);
@ -1401,7 +1480,7 @@ AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch,
struct FTranslatedLineTarget struct FTranslatedLineTarget
{ {
AActor *linetarget; AActor *linetarget;
angle_t angleFromSource; DAngle angleFromSource;
bool unlinked; // found by a trace that went through an unlinked portal. bool unlinked; // found by a trace that went through an unlinked portal.
}; };

View file

@ -1129,7 +1129,7 @@ static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty)
{ {
xs[i] -= pivotx; xs[i] -= pivotx;
ys[i] -= pivoty; 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) if (i == 5)
break; break;
@ -1150,7 +1150,7 @@ static void AM_ClipRotatedExtents (fixed_t pivotx, fixed_t pivoty)
// ys[4] = rmax_y; // ys[4] = rmax_y;
// else if (ys[4] < rmin_y) // else if (ys[4] < rmin_y)
// 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_x = xs[4] + pivotx - m_w/2;
m_y = ys[4] + pivoty - m_h/2; m_y = ys[4] + pivoty - m_h/2;
#endif #endif
@ -1216,7 +1216,7 @@ void AM_changeWindowLoc ()
oincy = incy = Scale(m_paninc.y, SCREENHEIGHT, 200); oincy = incy = Scale(m_paninc.y, SCREENHEIGHT, 200);
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) 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; m_x += incx;
@ -1598,7 +1598,7 @@ void AM_doFollowPlayer ()
sy = (f_oldloc.y - players[consoleplayer].camera->Y()) >> FRACTOMAPBITS; sy = (f_oldloc.y - players[consoleplayer].camera->Y()) >> FRACTOMAPBITS;
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
AM_rotate (&sx, &sy, players[consoleplayer].camera->angle - ANG90); AM_rotate (&sx, &sy, players[consoleplayer].camera->_f_angle() - ANG90);
} }
AM_ScrollParchment (sx, sy); AM_ScrollParchment (sx, sy);
@ -2042,7 +2042,7 @@ void AM_drawSubsectors()
// Apply the automap's rotation to the texture origin. // Apply the automap's rotation to the texture origin.
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) 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); AM_rotatePoint(&originpt.x, &originpt.y);
} }
originx = f_x + ((originpt.x - m_x) * scale / float(1 << 24)); 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; fixed_t pivoty = m_y + m_h/2;
*x -= pivotx; *x -= pivotx;
*y -= pivoty; *y -= pivoty;
AM_rotate (x, y, ANG90 - players[consoleplayer].camera->angle); AM_rotate (x, y, ANG90 - players[consoleplayer].camera->_f_angle());
*x += pivotx; *x += pivotx;
*y += pivoty; *y += pivoty;
} }
@ -2678,7 +2678,7 @@ void AM_drawPlayers ()
} }
else else
{ {
angle = players[consoleplayer].camera->angle; angle = players[consoleplayer].camera->_f_angle();
} }
if (am_cheat != 0 && CheatMapArrow.Size() > 0) if (am_cheat != 0 && CheatMapArrow.Size() > 0)
@ -2736,12 +2736,12 @@ void AM_drawPlayers ()
pt.x = pos.x >> FRACTOMAPBITS; pt.x = pos.x >> FRACTOMAPBITS;
pt.y = pos.y >> FRACTOMAPBITS; pt.y = pos.y >> FRACTOMAPBITS;
angle = p->mo->angle; angle = p->mo->_f_angle();
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
AM_rotatePoint (&pt.x, &pt.y); 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); 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.x = pos.x >> FRACTOMAPBITS;
p.y = pos.y >> FRACTOMAPBITS; p.y = pos.y >> FRACTOMAPBITS;
angle = key->angle; angle = key->_f_angle();
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
AM_rotatePoint (&p.x, &p.y); AM_rotatePoint (&p.x, &p.y);
angle += ANG90 - players[consoleplayer].camera->angle; angle += ANG90 - players[consoleplayer].camera->_f_angle();
} }
if (key->flags & MF_SPECIAL) if (key->flags & MF_SPECIAL)
@ -2830,11 +2830,11 @@ void AM_drawThings ()
const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0); const size_t spriteIndex = sprite.spriteframes + (show > 1 ? t->frame : 0);
frame = &SpriteFrames[spriteIndex]; 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 (frame->Texture[0] != frame->Texture[1]) angle += (ANGLE_180 / 16);
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) 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; rotation = angle >> 28;
@ -2853,12 +2853,12 @@ void AM_drawThings ()
else else
{ {
drawTriangle: drawTriangle:
angle = t->angle; angle = t->_f_angle();
if (am_rotate == 1 || (am_rotate == 2 && viewactive)) if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{ {
AM_rotatePoint (&p.x, &p.y); AM_rotatePoint (&p.x, &p.y);
angle += ANG90 - players[consoleplayer].camera->angle; angle += ANG90 - players[consoleplayer].camera->_f_angle();
} }
color = AMColors[AMColors.ThingColor]; color = AMColors[AMColors.ThingColor];
@ -2920,7 +2920,7 @@ void AM_drawThings ()
{ { -MAPUNIT, MAPUNIT }, { -MAPUNIT, -MAPUNIT } }, { { -MAPUNIT, MAPUNIT }, { -MAPUNIT, -MAPUNIT } },
}; };
AM_drawLineCharacter (box, 4, t->radius >> FRACTOMAPBITS, angle - t->angle, color, p.x, p.y); AM_drawLineCharacter (box, 4, t->radius >> FRACTOMAPBITS, angle - t->_f_angle(), color, p.x, p.y);
} }
} }
} }

View file

@ -127,7 +127,7 @@ bool DBot::Check_LOS (AActor *to, angle_t vangle)
if (vangle == 0) if (vangle == 0)
return false; //Looker seems to be blind. return false; //Looker seems to be blind.
return absangle(player->mo->AngleTo(to) - player->mo->angle) <= vangle/2; return absangle(player->mo->AngleTo(to) - player->mo->_f_angle()) <= vangle/2;
} }
//------------------------------------- //-------------------------------------
@ -212,7 +212,7 @@ void DBot::Dofire (ticcmd_t *cmd)
{ {
angle = an; angle = an;
//have to be somewhat precise. to avoid suicide. //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; t_rocket = 9;
no_fire = false; no_fire = false;
@ -254,7 +254,7 @@ shootmissile:
angle -= m; angle -= m;
} }
if (absangle(angle - player->mo->angle) < 4*ANGLE_1) if (absangle(angle - player->mo->_f_angle()) < 4*ANGLE_1)
{ {
increase = !increase; 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 //Returns NULL if shouldn't fire
//else an angle (in degrees) are given //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. //has been set an is the main aiming angle.

View file

@ -305,13 +305,13 @@ bool FCajunMaster::CleanAhead (AActor *thing, fixed_t x, fixed_t y, ticcmd_t *cm
return true; return true;
} }
#define OKAYRANGE (5*ANGLE_1) //counts *2, when angle is in range, turning is not executed. #define OKAYRANGE (5) //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 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. #define TURNSENS 3 //Higher is smoother but slower turn.
void DBot::TurnToAng () void DBot::TurnToAng ()
{ {
int maxturn = MAXTURN; double maxturn = MAXTURN;
if (player->ReadyWeapon != NULL) if (player->ReadyWeapon != NULL)
{ {
@ -331,16 +331,16 @@ void DBot::TurnToAng ()
maxturn = 3; 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; return;
distance /= TURNSENS; distance /= TURNSENS;
if (abs (distance) > maxturn) if (fabs (distance) > maxturn)
distance = distance < 0 ? -maxturn : maxturn; distance = distance < 0 ? -maxturn : maxturn;
player->mo->angle += distance; player->mo->Angles.Yaw += distance;
} }
void DBot::Pitch (AActor *target) void DBot::Pitch (AActor *target)
@ -350,7 +350,7 @@ void DBot::Pitch (AActor *target)
diff = target->Z() - player->mo->Z(); diff = target->Z() - player->mo->Z();
aim = g_atan(diff / (double)player->mo->AproxDistance(target)); aim = g_atan(diff / (double)player->mo->AproxDistance(target));
player->mo->pitch = -(int)(aim * ANGLE_180/M_PI); player->mo->Angles.Pitch = ToDegrees(aim);
} }
//Checks if a sector is dangerous. //Checks if a sector is dangerous.

View file

@ -20,6 +20,7 @@
#include "d_net.h" #include "d_net.h"
#include "d_event.h" #include "d_event.h"
#include "d_player.h" #include "d_player.h"
#include "vectors.h"
static FRandom pr_botmove ("BotMove"); static FRandom pr_botmove ("BotMove");
@ -39,20 +40,21 @@ void DBot::Think ()
if (teamplay || !deathmatch) if (teamplay || !deathmatch)
mate = Choose_Mate (); mate = Choose_Mate ();
angle_t oldyaw = player->mo->angle; AActor *actor = player->mo;
int oldpitch = player->mo->pitch; DAngle oldyaw = actor->Angles.Yaw;
DAngle oldpitch = actor->Angles.Pitch;
Set_enemy (); Set_enemy ();
ThinkForMove (cmd); ThinkForMove (cmd);
TurnToAng (); TurnToAng ();
cmd->ucmd.yaw = (short)((player->mo->angle - oldyaw) >> 16) / ticdup; cmd->ucmd.yaw = (short)((actor->Angles.Yaw - oldyaw).Degrees * (65536 / 360.f)) / ticdup;
cmd->ucmd.pitch = (short)((oldpitch - player->mo->pitch) >> 16); cmd->ucmd.pitch = (short)((oldpitch - actor->Angles.Pitch).Degrees * (65536 / 360.f));
if (cmd->ucmd.pitch == -32768) if (cmd->ucmd.pitch == -32768)
cmd->ucmd.pitch = -32767; cmd->ucmd.pitch = -32767;
cmd->ucmd.pitch /= ticdup; cmd->ucmd.pitch /= ticdup;
player->mo->angle = oldyaw + (cmd->ucmd.yaw << 16) * ticdup; actor->Angles.Yaw = oldyaw + DAngle(cmd->ucmd.yaw * ticdup * (360 / 65536.f));
player->mo->pitch = oldpitch - (cmd->ucmd.pitch << 16) * ticdup; actor->Angles.Pitch = oldpitch - DAngle(cmd->ucmd.pitch * ticdup * (360 / 65536.f));
} }
if (t_active) t_active--; if (t_active) t_active--;
@ -91,10 +93,10 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
missile = NULL; //Probably ended its travel. missile = NULL; //Probably ended its travel.
} }
if (player->mo->pitch > 0) if (player->mo->Angles.Pitch > 0)
player->mo->pitch -= 80; player->mo->Angles.Pitch -= 80;
else if (player->mo->pitch <= -60) else if (player->mo->Angles.Pitch <= -60)
player->mo->pitch += 80; player->mo->Angles.Pitch += 80;
//HOW TO MOVE: //HOW TO MOVE:
if (missile && (player->mo->AproxDistance(missile)<AVOID_DIST)) //try avoid missile got from P_Mobj.c thinking part. if (missile && (player->mo->AproxDistance(missile)<AVOID_DIST)) //try avoid missile got from P_Mobj.c thinking part.

View file

@ -875,7 +875,7 @@ CCMD(linetarget)
FTranslatedLineTarget t; FTranslatedLineTarget t;
if (CheckCheatmode () || players[consoleplayer].mo == NULL) return; 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->_f_angle(),MISSILERANGE, &t, 0);
if (t.linetarget) if (t.linetarget)
{ {
Printf("Target=%s, Health=%d, Spawnhealth=%d\n", Printf("Target=%s, Health=%d, Spawnhealth=%d\n",
@ -892,7 +892,7 @@ CCMD(info)
FTranslatedLineTarget t; FTranslatedLineTarget t;
if (CheckCheatmode () || players[consoleplayer].mo == NULL) return; if (CheckCheatmode () || players[consoleplayer].mo == NULL) return;
P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->angle,MISSILERANGE, P_AimLineAttack(players[consoleplayer].mo,players[consoleplayer].mo->_f_angle(),MISSILERANGE,
&t, 0, ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART); &t, 0, ALF_CHECKNONSHOOTABLE|ALF_FORCENOSMART);
if (t.linetarget) if (t.linetarget)
{ {
@ -1087,7 +1087,7 @@ CCMD(currentpos)
if(mo) if(mo)
{ {
Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n", Printf("Current player position: (%1.3f,%1.3f,%1.3f), angle: %1.3f, floorheight: %1.3f, sector:%d, lightlevel: %d\n",
FIXED2DBL(mo->X()), FIXED2DBL(mo->Y()), FIXED2DBL(mo->Z()), ANGLE2DBL(mo->angle), FIXED2DBL(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel); FIXED2DBL(mo->X()), FIXED2DBL(mo->Y()), FIXED2DBL(mo->Z()), ANGLE2DBL(mo->_f_angle()), FIXED2DBL(mo->floorz), mo->Sector->sectornum, mo->Sector->lightlevel);
} }
else else
{ {

View file

@ -1342,7 +1342,7 @@ static int PatchSound (int soundNum)
else CHECKKEY ("Zero/One", info->singularity) else CHECKKEY ("Zero/One", info->singularity)
else CHECKKEY ("Value", info->priority) else CHECKKEY ("Value", info->priority)
else CHECKKEY ("Zero 1", info->link) 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 ("Neg. One 2", info->volume)
else CHECKKEY ("Zero 2", info->data) else CHECKKEY ("Zero 2", info->data)
else CHECKKEY ("Zero 3", info->usefulness) else CHECKKEY ("Zero 3", info->usefulness)

View file

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

View file

@ -488,8 +488,8 @@ public:
FString LogText; // [RH] Log for Strife FString LogText; // [RH] Log for Strife
int MinPitch; // Viewpitch limits (negative is up, positive is down) DAngle MinPitch; // Viewpitch limits (negative is up, positive is down)
int MaxPitch; DAngle MaxPitch;
fixed_t crouchfactor; fixed_t crouchfactor;
fixed_t crouchoffset; fixed_t crouchoffset;
@ -499,7 +499,7 @@ public:
// [CW] I moved these here for multiplayer conversation support. // [CW] I moved these here for multiplayer conversation support.
TObjPtr<AActor> ConversationNPC, ConversationPC; TObjPtr<AActor> ConversationNPC, ConversationPC;
angle_t ConversationNPCAngle; DAngle ConversationNPCAngle;
bool ConversationFaceTalker; bool ConversationFaceTalker;
fixed_t GetDeltaViewHeight() const fixed_t GetDeltaViewHeight() const

View file

@ -1532,3 +1532,18 @@ FArchive &operator<< (FArchive &arc, side_t *&side)
{ {
return arc.SerializePointer (sides, (BYTE **)&side, sizeof(*sides)); return arc.SerializePointer (sides, (BYTE **)&side, sizeof(*sides));
} }
FArchive &operator<<(FArchive &arc, DAngle &ang)
{
if (SaveVersion >= 4534)
{
arc << ang.Degrees;
}
else
{
angle_t an;
arc << an;
ang.Degrees = ANGLE2DBL(an);
}
return arc;
}

View file

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

View file

@ -864,7 +864,7 @@ void FParser::SF_Spawn(void)
{ {
int x, y, z; int x, y, z;
PClassActor *pclass; PClassActor *pclass;
angle_t angle = 0; DAngle angle = 0;
if (CheckArgs(3)) if (CheckArgs(3))
{ {
@ -890,7 +890,7 @@ void FParser::SF_Spawn(void)
if(t_argc >= 4) if(t_argc >= 4)
{ {
angle = intvalue(t_argv[3]) * (SQWORD)ANG45 / 45; angle = floatvalue(t_argv[3]);
} }
t_return.type = svt_mobj; t_return.type = svt_mobj;
@ -898,7 +898,7 @@ void FParser::SF_Spawn(void)
if (t_return.value.mobj) if (t_return.value.mobj)
{ {
t_return.value.mobj->angle = angle; t_return.value.mobj->Angles.Yaw = angle;
if (!DFraggleThinker::ActiveThinker->nocheckposition) if (!DFraggleThinker::ActiveThinker->nocheckposition)
{ {
@ -1054,7 +1054,7 @@ void FParser::SF_ObjAngle(void)
} }
t_return.type = svt_fixed; // haleyjd: fixed-point -- SoM again :) 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.value.f = mo ? (fixed_t)AngleToFixed(mo->_f_angle()) : 0; // null ptr check
} }
@ -1449,7 +1449,7 @@ void FParser::SF_PointToDist(void)
void FParser::SF_SetCamera(void) void FParser::SF_SetCamera(void)
{ {
angle_t angle; DAngle angle;
player_t * player; player_t * player;
AActor * newcamera; AActor * newcamera;
@ -1465,20 +1465,14 @@ void FParser::SF_SetCamera(void)
return; // nullptr check 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->special1 = newcamera->Angles.Yaw.BAMs();
newcamera->special2=newcamera->Z(); newcamera->special2=newcamera->Z();
newcamera->SetZ(t_argc < 3 ? (newcamera->Z() + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS)); newcamera->SetZ(t_argc < 3 ? (newcamera->Z() + (41 << FRACBITS)) : (intvalue(t_argv[2]) << FRACBITS));
newcamera->angle = angle; newcamera->Angles.Yaw = angle;
if(t_argc < 4) newcamera->pitch = 0; if (t_argc < 4) newcamera->Angles.Pitch = 0;
else else newcamera->Angles.Pitch = clamp(floatvalue(t_argv[3]), -50., 50.) * (20. / 32.);
{
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));
}
player->camera=newcamera; player->camera=newcamera;
} }
} }
@ -1499,7 +1493,7 @@ void FParser::SF_ClearCamera(void)
if (cam) if (cam)
{ {
player->camera=player->mo; player->camera=player->mo;
cam->angle=cam->special1; cam->Angles.Yaw = ANGLE2DBL(cam->special1);
cam->SetZ(cam->special2); cam->SetZ(cam->special2);
} }
@ -3115,15 +3109,16 @@ void FParser::SF_MoveCamera(void)
//180--+--0 //180--+--0
// Q2|Q3 // Q2|Q3
// 270 // 270
angle_t camangle = cam->Angles.Yaw.BAMs();
quad1 = targetangle / ANG90; quad1 = targetangle / ANG90;
quad2 = cam->angle / ANG90; quad2 = camangle / ANG90;
bigangle = targetangle > cam->angle ? targetangle : cam->angle; bigangle = targetangle > camangle ? targetangle : camangle;
smallangle = targetangle < cam->angle ? targetangle : cam->angle; smallangle = targetangle < camangle ? targetangle : camangle;
if((quad1 > quad2 && quad1 - 1 == quad2) || (quad2 > quad1 && quad2 - 1 == quad1) || if((quad1 > quad2 && quad1 - 1 == quad2) || (quad2 > quad1 && quad2 - 1 == quad1) ||
quad1 == quad2) quad1 == quad2)
{ {
angledist = bigangle - smallangle; angledist = bigangle - smallangle;
angledir = targetangle > cam->angle ? 1 : -1; angledir = targetangle > cam->_f_angle() ? 1 : -1;
} }
else else
{ {
@ -3145,10 +3140,10 @@ void FParser::SF_MoveCamera(void)
if(angledist > ANG180) if(angledist > ANG180)
{ {
angledist = diff180; angledist = diff180;
angledir = targetangle > cam->angle ? -1 : 1; angledir = targetangle > camangle ? -1 : 1;
} }
else else
angledir = targetangle > cam->angle ? 1 : -1; angledir = targetangle > camangle ? 1 : -1;
} }
} }
@ -3203,17 +3198,17 @@ void FParser::SF_MoveCamera(void)
} }
if(anglestep >= angledist) if(anglestep >= angledist)
cam->angle = targetangle; cam->Angles.Yaw = ANGLE2DBL(targetangle);
else else
{ {
if(angledir == 1) if(angledir == 1)
{ {
cam->angle += anglestep; cam->Angles.Yaw += ANGLE2DBL(anglestep);
moved = 1; moved = 1;
} }
else if(angledir == -1) else if(angledir == -1)
{ {
cam->angle -= anglestep; cam->Angles.Yaw -= ANGLE2DBL(anglestep);
moved = 1; moved = 1;
} }
} }
@ -4288,7 +4283,7 @@ void FParser::SF_SpawnShot2(void)
{ {
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM); S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_NORM);
mo->target = source; mo->target = source;
P_ThrustMobj(mo, mo->angle = source->angle, mo->Speed); P_ThrustMobj(mo, (mo->Angles.Yaw = source->Angles.Yaw), mo->Speed);
if (!P_CheckMissileSpawn(mo, source->radius)) mo = NULL; if (!P_CheckMissileSpawn(mo, source->radius)) mo = NULL;
} }
t_return.value.mobj = mo; t_return.value.mobj = mo;

View file

@ -68,7 +68,7 @@ void A_Fire(AActor *self, int height)
if (!P_CheckSight (self->target, dest, 0) ) if (!P_CheckSight (self->target, dest, 0) )
return; return;
fixedvec3 newpos = dest->Vec3Angle(24 * FRACUNIT, dest->angle, height); fixedvec3 newpos = dest->Vec3Angle(24 * FRACUNIT, dest->_f_angle(), height);
self->SetOrigin(newpos, true); self->SetOrigin(newpos, true);
} }
@ -147,7 +147,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
if (fire != NULL) if (fire != NULL)
{ {
// move the fire between the vile and the player // move the fire between the vile and the player
fixedvec3 pos = target->Vec3Angle(-24 * FRACUNIT, self->angle, 0); fixedvec3 pos = target->Vec3Angle(-24 * FRACUNIT, self->_f_angle(), 0);
fire->SetOrigin (pos, true); fire->SetOrigin (pos, true);
P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0); P_RadiusAttack (fire, self, blastdmg, blastrad, dmgtype, 0);

View file

@ -50,7 +50,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Punch)
if (self->FindInventory<APowerStrength>()) if (self->FindInventory<APowerStrength>())
damage *= 10; damage *= 10;
angle = self->angle; angle = self->_f_angle();
angle += pr_punch.Random2() << 18; angle += pr_punch.Random2() << 18;
pitch = P_AimLineAttack (self, angle, MELEERANGE); pitch = P_AimLineAttack (self, angle, MELEERANGE);
@ -61,7 +61,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Punch)
if (t.linetarget) if (t.linetarget)
{ {
S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
self->angle = t.angleFromSource; self->Angles.Yaw = t.angleFromSource;
} }
return 0; return 0;
} }
@ -158,7 +158,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
range = MELEERANGE+1; range = MELEERANGE+1;
} }
angle = self->angle + (pr_saw.Random2() * (spread_xy / 255)); angle = self->_f_angle() + (pr_saw.Random2() * (spread_xy / 255));
slope = P_AimLineAttack (self, angle, range, &t) + (pr_saw.Random2() * (spread_z / 255)); slope = P_AimLineAttack (self, angle, range, &t) + (pr_saw.Random2() * (spread_z / 255));
AWeapon *weapon = self->player->ReadyWeapon; AWeapon *weapon = self->player->ReadyWeapon;
@ -232,20 +232,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
// turn to face target // turn to face target
if (!(flags & SF_NOTURN)) if (!(flags & SF_NOTURN))
{ {
angle = t.angleFromSource; DAngle anglediff = deltaangle(self->Angles.Yaw, t.angleFromSource);
if (angle - self->angle > ANG180)
if (anglediff < 0.0)
{ {
if (angle - self->angle < (angle_t)(-ANG90 / 20)) if (anglediff < -4.5)
self->angle = angle + ANG90 / 21; self->Angles.Yaw = angle + 90.0 / 21;
else else
self->angle -= ANG90 / 20; self->Angles.Yaw -= 4.5;
} }
else else
{ {
if (angle - self->angle > ANG90 / 20) if (anglediff > 4.5)
self->angle = angle - ANG90 / 21; self->Angles.Yaw = angle - 90.0 / 21;
else else
self->angle += ANG90 / 20; self->Angles.Yaw += 4.5;
} }
} }
if (!(flags & SF_NOPULLIN)) if (!(flags & SF_NOPULLIN))
@ -320,7 +321,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2)
for (i=0 ; i<20 ; i++) for (i=0 ; i<20 ; i++)
{ {
damage = 5*(pr_fireshotgun2()%3+1); damage = 5*(pr_fireshotgun2()%3+1);
angle = self->angle; angle = self->_f_angle();
angle += pr_fireshotgun2.Random2() << 19; angle += pr_fireshotgun2.Random2() << 19;
// Doom adjusts the bullet slope by shifting a random number [-255,255] // Doom adjusts the bullet slope by shifting a random number [-255,255]
@ -501,10 +502,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireSTGrenade)
} }
// Temporarily raise the pitch to send the grenade slightly upwards // Temporarily raise the pitch to send the grenade slightly upwards
fixed_t SavedPlayerPitch = self->pitch; DAngle SavedPlayerPitch = self->Angles.Pitch;
self->pitch -= (1152 << FRACBITS); self->Angles.Pitch -= 6.328125; //(1152 << FRACBITS);
P_SpawnPlayerMissile(self, grenade); P_SpawnPlayerMissile(self, grenade);
self->pitch = SavedPlayerPitch; self->Angles.Pitch = SavedPlayerPitch;
return 0; return 0;
} }
@ -619,7 +620,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBFG)
return 0; 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->_f_angle(), NULL, NULL, !!(dmflags2 & DF2_NO_FREEAIMBFG));
return 0; return 0;
} }
@ -659,7 +660,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
// offset angles from its attack angle // offset angles from its attack angle
for (i = 0; i < numrays; i++) for (i = 0; i < numrays; i++)
{ {
an = self->angle - angle / 2 + angle / numrays*i; an = self->_f_angle() - angle / 2 + angle / numrays*i;
// self->target is the originator (player) of the missile // self->target is the originator (player) of the missile
P_AimLineAttack(self->target, an, distance, &t, vrange); P_AimLineAttack(self->target, an, distance, &t, vrange);
@ -696,7 +697,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
damage = defdamage; damage = defdamage;
} }
int newdam = P_DamageMobj(t.linetarget, self->target, self->target, damage, dmgType, dmgFlags|DMG_USEANGLE, t.angleFromSource); int newdam = P_DamageMobj(t.linetarget, self->target, self->target, damage, dmgType, dmgFlags|DMG_USEANGLE, FLOAT2ANGLE(t.angleFromSource.Degrees));
P_TraceBleed(newdam > 0 ? newdam : damage, &t, self); P_TraceBleed(newdam > 0 ? newdam : damage, &t, self);
} }
} }
@ -749,16 +750,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireOldBFG)
self->player->extralight = 2; self->player->extralight = 2;
// Save values temporarily // Save values temporarily
angle_t SavedPlayerAngle = self->angle; DAngle SavedPlayerAngle = self->Angles.Yaw;
fixed_t SavedPlayerPitch = self->pitch; DAngle SavedPlayerPitch = self->Angles.Pitch;
for (int i = 0; i < 2; i++) // Spawn two plasma balls in sequence for (int i = 0; i < 2; i++) // Spawn two plasma balls in sequence
{ {
self->angle += ((pr_oldbfg()&127) - 64) * (ANG90/768); self->Angles.Yaw += ((pr_oldbfg()&127) - 64) * (90./768);
self->pitch += ((pr_oldbfg()&127) - 64) * (ANG90/640); self->Angles.Pitch += ((pr_oldbfg()&127) - 64) * (90./640);
mo = P_SpawnPlayerMissile (self, plasma[i]); mo = P_SpawnPlayerMissile (self, plasma[i]);
// Restore saved values // Restore saved values
self->angle = SavedPlayerAngle; self->Angles.Yaw = SavedPlayerAngle;
self->pitch = SavedPlayerPitch; self->Angles.Pitch = SavedPlayerPitch;
} }
if (doesautoaim && weapon != NULL) if (doesautoaim && weapon != NULL)
{ // Restore autoaim setting { // Restore autoaim setting

View file

@ -15,7 +15,7 @@
// firing three missiles in three different directions? // firing three missiles in three different directions?
// Doesn't look like it. // Doesn't look like it.
// //
#define FATSPREAD (ANG90/8) #define FATSPREAD (90./8)
DEFINE_ACTION_FUNCTION(AActor, A_FatRaise) DEFINE_ACTION_FUNCTION(AActor, A_FatRaise)
{ {
@ -32,7 +32,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack1)
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; } PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
AActor *missile; AActor *missile;
angle_t an;
if (!self->target) if (!self->target)
return 0; return 0;
@ -41,16 +40,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack1)
A_FaceTarget (self); A_FaceTarget (self);
// Change direction to ... // Change direction to ...
self->angle += FATSPREAD; self->Angles.Yaw += FATSPREAD;
P_SpawnMissile (self, self->target, spawntype); P_SpawnMissile (self, self->target, spawntype);
missile = P_SpawnMissile (self, self->target, spawntype); missile = P_SpawnMissile (self, self->target, spawntype);
if (missile != NULL) if (missile != NULL)
{ {
missile->angle += FATSPREAD; missile->Angles.Yaw += FATSPREAD;
an = missile->angle >> ANGLETOFINESHIFT; missile->VelFromAngle();
missile->vel.x = FixedMul (missile->Speed, finecosine[an]);
missile->vel.y = FixedMul (missile->Speed, finesine[an]);
} }
return 0; return 0;
} }
@ -61,7 +58,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack2)
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; } PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
AActor *missile; AActor *missile;
angle_t an;
if (!self->target) if (!self->target)
return 0; return 0;
@ -70,16 +66,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack2)
A_FaceTarget (self); A_FaceTarget (self);
// Now here choose opposite deviation. // Now here choose opposite deviation.
self->angle -= FATSPREAD; self->Angles.Yaw -= FATSPREAD;
P_SpawnMissile (self, self->target, spawntype); P_SpawnMissile (self, self->target, spawntype);
missile = P_SpawnMissile (self, self->target, spawntype); missile = P_SpawnMissile (self, self->target, spawntype);
if (missile != NULL) if (missile != NULL)
{ {
missile->angle -= FATSPREAD*2; missile->Angles.Yaw -= FATSPREAD*2;
an = missile->angle >> ANGLETOFINESHIFT; missile->VelFromAngle();
missile->vel.x = FixedMul (missile->Speed, finecosine[an]);
missile->vel.y = FixedMul (missile->Speed, finesine[an]);
} }
return 0; return 0;
} }
@ -90,7 +84,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3)
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; } PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
AActor *missile; AActor *missile;
angle_t an;
if (!self->target) if (!self->target)
return 0; return 0;
@ -102,19 +95,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3)
missile = P_SpawnMissile (self, self->target, spawntype); missile = P_SpawnMissile (self, self->target, spawntype);
if (missile != NULL) if (missile != NULL)
{ {
missile->angle -= FATSPREAD/2; missile->Angles.Yaw -= FATSPREAD/2;
an = missile->angle >> ANGLETOFINESHIFT; missile->VelFromAngle();
missile->vel.x = FixedMul (missile->Speed, finecosine[an]);
missile->vel.y = FixedMul (missile->Speed, finesine[an]);
} }
missile = P_SpawnMissile (self, self->target, spawntype); missile = P_SpawnMissile (self, self->target, spawntype);
if (missile != NULL) if (missile != NULL)
{ {
missile->angle += FATSPREAD/2; missile->Angles.Yaw += FATSPREAD/2;
an = missile->angle >> ANGLETOFINESHIFT; missile->VelFromAngle();
missile->vel.x = FixedMul (missile->Speed, finecosine[an]);
missile->vel.y = FixedMul (missile->Speed, finesine[an]);
} }
return 0; return 0;
} }

View file

@ -33,7 +33,7 @@ void A_SkullAttack(AActor *self, fixed_t speed)
S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, self->AttackSound, 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
an = self->angle >> ANGLETOFINESHIFT; an = self->_f_angle() >> ANGLETOFINESHIFT;
self->vel.x = FixedMul (speed, finecosine[an]); self->vel.x = FixedMul (speed, finecosine[an]);
self->vel.y = FixedMul (speed, finesine[an]); self->vel.y = FixedMul (speed, finesine[an]);
dist = self->AproxDistance (dest); dist = self->AproxDistance (dest);

View file

@ -166,7 +166,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainAttack)
if (!(flags & PAF_AIMFACING)) if (!(flags & PAF_AIMFACING))
A_FaceTarget (self); A_FaceTarget (self);
A_PainShootSkull (self, self->angle+angle, spawntype, flags, limit); A_PainShootSkull (self, self->_f_angle()+angle, spawntype, flags, limit);
return 0; return 0;
} }
@ -179,8 +179,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DualPainAttack)
return 0; return 0;
A_FaceTarget (self); A_FaceTarget (self);
A_PainShootSkull (self, self->angle + ANG45, spawntype); A_PainShootSkull (self, self->_f_angle() + ANG45, spawntype);
A_PainShootSkull (self, self->angle - ANG45, spawntype); A_PainShootSkull (self, self->_f_angle() - ANG45, spawntype);
return 0; return 0;
} }
@ -194,8 +194,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainDie)
self->flags &= ~MF_FRIENDLY; self->flags &= ~MF_FRIENDLY;
} }
A_Unblock(self, true); A_Unblock(self, true);
A_PainShootSkull (self, self->angle + ANG90, spawntype); A_PainShootSkull (self, self->_f_angle() + ANG90, spawntype);
A_PainShootSkull (self, self->angle + ANG180, spawntype); A_PainShootSkull (self, self->_f_angle() + ANG180, spawntype);
A_PainShootSkull (self, self->angle + ANG270, spawntype); A_PainShootSkull (self, self->_f_angle() + ANG270, spawntype);
return 0; return 0;
} }

View file

@ -30,7 +30,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PosAttack)
return 0; return 0;
A_FaceTarget (self); A_FaceTarget (self);
angle = self->angle; angle = self->_f_angle();
slope = P_AimLineAttack (self, angle, MISSILERANGE); slope = P_AimLineAttack (self, angle, MISSILERANGE);
S_Sound (self, CHAN_WEAPON, "grunt/attack", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "grunt/attack", 1, ATTN_NORM);
@ -47,7 +47,7 @@ static void A_SPosAttack2 (AActor *self)
int slope; int slope;
A_FaceTarget (self); A_FaceTarget (self);
bangle = self->angle; bangle = self->_f_angle();
slope = P_AimLineAttack (self, bangle, MISSILERANGE); slope = P_AimLineAttack (self, bangle, MISSILERANGE);
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
@ -104,7 +104,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CPosAttack)
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
bangle = self->angle; bangle = self->_f_angle();
slope = P_AimLineAttack (self, bangle, MISSILERANGE); slope = P_AimLineAttack (self, bangle, MISSILERANGE);
angle = bangle + (pr_cposattack.Random2() << 20); angle = bangle + (pr_cposattack.Random2() << 20);

View file

@ -39,13 +39,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkelMissile)
return 0; return 0;
} }
#define TRACEANGLE (0xc000000) #define TRACEANGLE (16.875)
DEFINE_ACTION_FUNCTION(AActor, A_Tracer) DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
angle_t exact;
fixed_t dist; fixed_t dist;
fixed_t slope; fixed_t slope;
AActor *dest; AActor *dest;
@ -64,7 +63,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
return 0; return 0;
// spawn a puff of smoke behind the rocket // spawn a puff of smoke behind the rocket
P_SpawnPuff (self, PClass::FindActor(NAME_BulletPuff), self->Pos(), self->angle, self->angle, 3); P_SpawnPuff (self, PClass::FindActor(NAME_BulletPuff), self->Pos(), self->_f_angle(), self->_f_angle(), 3);
smoke = Spawn ("RevenantTracerSmoke", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE); smoke = Spawn ("RevenantTracerSmoke", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE);
@ -80,27 +79,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
return 0; return 0;
// change angle // change angle
exact = self->AngleTo(dest); DAngle exact = self->_f_AngleTo(dest);
DAngle diff = deltaangle(self->Angles.Yaw, exact);
if (exact != self->angle) if (diff < 0)
{ {
if (exact - self->angle > 0x80000000) self->Angles.Yaw -= TRACEANGLE;
{ if (deltaangle(self->Angles.Yaw, exact) > 0)
self->angle -= TRACEANGLE; self->Angles.Yaw = exact;
if (exact - self->angle < 0x80000000)
self->angle = exact;
}
else
{
self->angle += TRACEANGLE;
if (exact - self->angle > 0x80000000)
self->angle = exact;
}
} }
else if (diff > 0)
exact = self->angle>>ANGLETOFINESHIFT; {
self->vel.x = FixedMul (self->Speed, finecosine[exact]); self->Angles.Yaw += TRACEANGLE;
self->vel.y = FixedMul (self->Speed, finesine[exact]); if (deltaangle(self->Angles.Yaw, exact) < 0.)
self->Angles.Yaw = exact;
}
self->VelFromAngle();
if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{ {

View file

@ -275,14 +275,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
A_FaceTarget (self); A_FaceTarget (self);
if (self->CheckMeleeRange ()) if (self->CheckMeleeRange ())
{ {
angle_t angle; angle_t Angle;
FTranslatedLineTarget t; FTranslatedLineTarget t;
damage *= (pr_m_saw()%10+1); damage *= (pr_m_saw()%10+1);
angle = self->angle + (pr_m_saw.Random2() << 18); Angle = self->_f_angle() + (pr_m_saw.Random2() << 18);
P_LineAttack (self, angle, MELEERANGE+1, P_LineAttack (self, Angle, MELEERANGE+1,
P_AimLineAttack (self, angle, MELEERANGE+1), damage, P_AimLineAttack (self, Angle, MELEERANGE+1), damage,
NAME_Melee, pufftype, false, &t); NAME_Melee, pufftype, false, &t);
if (!t.linetarget) if (!t.linetarget)
@ -293,20 +293,22 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM);
// turn to face target // turn to face target
angle = t.angleFromSource; DAngle 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)) if (anglediff < -4.5)
self->angle = angle + ANG90/21; self->Angles.Yaw = angle + 90.0 / 21;
else else
self->angle -= ANG90/20; self->Angles.Yaw -= 4.5;
} }
else else
{ {
if (angle - self->angle > ANG90/20) if (anglediff > 4.5)
self->angle = angle - ANG90/21; self->Angles.Yaw = angle - 90.0 / 21;
else else
self->angle += ANG90/20; self->Angles.Yaw += 4.5;
} }
} }
else else
@ -336,7 +338,7 @@ static void MarinePunch(AActor *self, int damagemul)
damage = ((pr_m_punch()%10+1) << 1) * damagemul; damage = ((pr_m_punch()%10+1) << 1) * damagemul;
A_FaceTarget (self); A_FaceTarget (self);
angle = self->angle + (pr_m_punch.Random2() << 18); angle = self->_f_angle() + (pr_m_punch.Random2() << 18);
pitch = P_AimLineAttack (self, angle, MELEERANGE); pitch = P_AimLineAttack (self, angle, MELEERANGE);
P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, true, &t); 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) if (t.linetarget)
{ {
S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
self->angle = t.angleFromSource; self->Angles.Yaw = t.angleFromSource;
} }
} }
@ -369,7 +371,7 @@ void P_GunShot2 (AActor *mo, bool accurate, int pitch, PClassActor *pufftype)
int damage; int damage;
damage = 5*(pr_m_gunshot()%3+1); damage = 5*(pr_m_gunshot()%3+1);
angle = mo->angle; angle = mo->_f_angle();
if (!accurate) if (!accurate)
{ {
@ -395,7 +397,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FirePistol)
S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE), P_GunShot2 (self, accurate, P_AimLineAttack (self, self->_f_angle(), MISSILERANGE),
PClass::FindActor(NAME_BulletPuff)); PClass::FindActor(NAME_BulletPuff));
return 0; return 0;
} }
@ -417,7 +419,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun)
S_Sound (self, CHAN_WEAPON, "weapons/shotgf", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "weapons/shotgf", 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
pitch = P_AimLineAttack (self, self->angle, MISSILERANGE); pitch = P_AimLineAttack (self, self->_f_angle(), MISSILERANGE);
for (int i = 0; i < 7; ++i) for (int i = 0; i < 7; ++i)
{ {
P_GunShot2 (self, false, pitch, PClass::FindActor(NAME_BulletPuff)); P_GunShot2 (self, false, pitch, PClass::FindActor(NAME_BulletPuff));
@ -464,11 +466,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun2)
S_Sound (self, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
pitch = P_AimLineAttack (self, self->angle, MISSILERANGE); pitch = P_AimLineAttack (self, self->_f_angle(), MISSILERANGE);
for (int i = 0; i < 20; ++i) for (int i = 0; i < 20; ++i)
{ {
int damage = 5*(pr_m_fireshotgun2()%3+1); int damage = 5*(pr_m_fireshotgun2()%3+1);
angle_t angle = self->angle + (pr_m_fireshotgun2.Random2() << 19); angle_t angle = self->_f_angle() + (pr_m_fireshotgun2.Random2() << 19);
P_LineAttack (self, angle, MISSILERANGE, P_LineAttack (self, angle, MISSILERANGE,
pitch + (pr_m_fireshotgun2.Random2() * 332063), damage, pitch + (pr_m_fireshotgun2.Random2() * 332063), damage,
@ -494,7 +496,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FireCGun)
S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE), P_GunShot2 (self, accurate, P_AimLineAttack (self, self->_f_angle(), MISSILERANGE),
PClass::FindActor(NAME_BulletPuff)); PClass::FindActor(NAME_BulletPuff));
return 0; return 0;
} }

View file

@ -1183,7 +1183,7 @@ void G_Ticker ()
if (players[i].mo) if (players[i].mo)
{ {
DWORD sum = rngsum + players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z() DWORD sum = rngsum + players[i].mo->X() + players[i].mo->Y() + players[i].mo->Z()
+ players[i].mo->angle + players[i].mo->pitch; + players[i].mo->_f_angle() + players[i].mo->_f_pitch();
sum ^= players[i].health; sum ^= players[i].health;
consistancy[i][buf] = sum; consistancy[i][buf] = sum;
} }

View file

@ -43,7 +43,7 @@ void AChickenPlayer::MorphPlayerThink ()
} }
if (!(vel.x | vel.y) && pr_chickenplayerthink () < 160) if (!(vel.x | vel.y) && pr_chickenplayerthink () < 160)
{ // Twitch view angle { // Twitch view angle
angle += pr_chickenplayerthink.Random2 () << 19; Angles.Yaw += pr_chickenplayerthink.Random2() * (360. / 256. / 32.);
} }
if ((Z() <= floorz) && (pr_chickenplayerthink() < 32)) if ((Z() <= floorz) && (pr_chickenplayerthink() < 32))
{ // Jump and noise { // Jump and noise
@ -184,12 +184,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL1)
} }
damage = 1 + (pr_beakatkpl1()&3); damage = 1 + (pr_beakatkpl1()&3);
angle = player->mo->angle; angle = player->mo->_f_angle();
slope = P_AimLineAttack (player->mo, angle, MELEERANGE); slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t); P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t);
if (t.linetarget) if (t.linetarget)
{ {
player->mo->angle = t.angleFromSource; player->mo->Angles.Yaw = t.angleFromSource;
} }
P_PlayPeck (player->mo); P_PlayPeck (player->mo);
player->chickenPeck = 12; player->chickenPeck = 12;
@ -219,12 +219,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2)
} }
damage = pr_beakatkpl2.HitDice (4); damage = pr_beakatkpl2.HitDice (4);
angle = player->mo->angle; angle = player->mo->_f_angle();
slope = P_AimLineAttack (player->mo, angle, MELEERANGE); slope = P_AimLineAttack (player->mo, angle, MELEERANGE);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t); P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "BeakPuff", true, &t);
if (t.linetarget) if (t.linetarget)
{ {
player->mo->angle = t.angleFromSource; player->mo->Angles.Yaw = t.angleFromSource;
} }
P_PlayPeck (player->mo); P_PlayPeck (player->mo);
player->chickenPeck = 12; player->chickenPeck = 12;

View file

@ -94,7 +94,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
if (mo != NULL) if (mo != NULL)
{ {
vz = mo->vel.z; vz = mo->vel.z;
angle = mo->angle; angle = mo->_f_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);
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);
} }
@ -130,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcererRise)
mo = Spawn("Sorcerer2", self->Pos(), ALLOW_REPLACE); mo = Spawn("Sorcerer2", self->Pos(), ALLOW_REPLACE);
mo->Translation = self->Translation; mo->Translation = self->Translation;
mo->SetState (mo->FindState("Rise")); mo->SetState (mo->FindState("Rise"));
mo->angle = self->angle; mo->Angles.Yaw = self->Angles.Yaw;
mo->CopyFriendliness (self, true); mo->CopyFriendliness (self, true);
return 0; return 0;
} }
@ -166,7 +166,7 @@ void P_DSparilTeleport (AActor *actor)
actor->SetState (actor->FindState("Teleport")); actor->SetState (actor->FindState("Teleport"));
S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM); S_Sound (actor, CHAN_BODY, "misc/teleport", 1, ATTN_NORM);
actor->SetZ(actor->floorz, false); actor->SetZ(actor->floorz, false);
actor->angle = spot->angle; actor->Angles.Yaw = spot->Angles.Yaw;
actor->vel.x = actor->vel.y = actor->vel.z = 0; actor->vel.x = actor->vel.y = actor->vel.z = 0;
} }
} }
@ -230,8 +230,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Srcr2Attack)
PClassActor *fx = PClass::FindActor("Sorcerer2FX2"); PClassActor *fx = PClass::FindActor("Sorcerer2FX2");
if (fx) if (fx)
{ {
P_SpawnMissileAngle (self, fx, self->angle-ANG45, FRACUNIT/2); P_SpawnMissileAngle (self, fx, self->_f_angle()-ANG45, FRACUNIT/2);
P_SpawnMissileAngle (self, fx, self->angle+ANG45, FRACUNIT/2); P_SpawnMissileAngle (self, fx, self->_f_angle()+ANG45, FRACUNIT/2);
} }
} }
else else

View file

@ -70,9 +70,9 @@ IMPLEMENT_CLASS (AArtiTimeBomb)
bool AArtiTimeBomb::Use (bool pickup) bool AArtiTimeBomb::Use (bool pickup)
{ {
angle_t angle = Owner->angle >> ANGLETOFINESHIFT; angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo = Spawn("ActivatedTimeBomb", AActor *mo = Spawn("ActivatedTimeBomb",
Owner->Vec3Angle(24*FRACUNIT, Owner->angle, - Owner->floorclip), ALLOW_REPLACE); Owner->Vec3Angle(24*FRACUNIT, Owner->_f_angle(), - Owner->floorclip), ALLOW_REPLACE);
mo->target = Owner; mo->target = Owner;
return true; return true;
} }

View file

@ -172,18 +172,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast)
int i; int i;
int count; int count;
AActor *blast; AActor *blast;
angle_t angle;
count = 1 + (pr_blast() % 3); count = 1 + (pr_blast() % 3);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
blast = Spawn("VolcanoBlast", self->PosPlusZ(44*FRACUNIT), ALLOW_REPLACE); blast = Spawn("VolcanoBlast", self->PosPlusZ(44*FRACUNIT), ALLOW_REPLACE);
blast->target = self; blast->target = self;
angle = pr_blast () << 24; blast->Angles.Yaw = pr_blast() * (360 / 256.f);
blast->angle = angle; blast->VelFromAngle(1 * FRACUNIT);
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->vel.z = (FRACUNIT*5/2) + (pr_blast() << 10);
S_Sound (blast, CHAN_BODY, "world/volcano/shoot", 1, ATTN_NORM); S_Sound (blast, CHAN_BODY, "world/volcano/shoot", 1, ATTN_NORM);
P_CheckMissileSpawn (blast, self->radius); P_CheckMissileSpawn (blast, self->radius);
@ -203,7 +199,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
unsigned int i; unsigned int i;
AActor *tiny; AActor *tiny;
angle_t angle;
if (self->Z() <= self->floorz) if (self->Z() <= self->floorz)
{ {
@ -217,11 +212,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
{ {
tiny = Spawn("VolcanoTBlast", self->Pos(), ALLOW_REPLACE); tiny = Spawn("VolcanoTBlast", self->Pos(), ALLOW_REPLACE);
tiny->target = self; tiny->target = self;
angle = i*ANG90; tiny->Angles.Yaw = 90.*i;
tiny->angle = angle; tiny->VelFromAngle(FRACUNIT * 7 / 10);
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->vel.z = FRACUNIT + (pr_volcimpact() << 9);
P_CheckMissileSpawn (tiny, self->radius); P_CheckMissileSpawn (tiny, self->radius);
} }

View file

@ -86,7 +86,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack)
{ {
puff = PClass::FindActor(NAME_BulletPuff); // just to be sure puff = PClass::FindActor(NAME_BulletPuff); // just to be sure
} }
angle = self->angle; angle = self->_f_angle();
angle += pr_sap.Random2() << 18; angle += pr_sap.Random2() << 18;
slope = P_AimLineAttack (self, angle, MELEERANGE); slope = P_AimLineAttack (self, angle, MELEERANGE);
P_LineAttack (self, angle, MELEERANGE, slope, damage, NAME_Melee, puff, true, &t); P_LineAttack (self, angle, MELEERANGE, slope, damage, NAME_Melee, puff, true, &t);
@ -94,7 +94,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack)
{ {
//S_StartSound(player->mo, sfx_stfhit); //S_StartSound(player->mo, sfx_stfhit);
// turn to face target // turn to face target
self->angle = t.angleFromSource; self->Angles.Yaw = t.angleFromSource;
} }
return 0; return 0;
} }
@ -127,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL1)
} }
angle_t pitch = P_BulletSlope(self); angle_t pitch = P_BulletSlope(self);
damage = 7+(pr_fgw()&7); damage = 7+(pr_fgw()&7);
angle = self->angle; angle = self->_f_angle();
if (player->refire) if (player->refire)
{ {
angle += pr_fgw.Random2() << 18; angle += pr_fgw.Random2() << 18;
@ -167,9 +167,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2)
angle_t pitch = P_BulletSlope(self); angle_t pitch = P_BulletSlope(self);
vz = FixedMul (GetDefaultByName("GoldWandFX2")->Speed, vz = FixedMul (GetDefaultByName("GoldWandFX2")->Speed,
finetangent[FINEANGLES/4-((signed)pitch>>ANGLETOFINESHIFT)]); finetangent[FINEANGLES/4-((signed)pitch>>ANGLETOFINESHIFT)]);
P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->angle-(ANG45/8), vz); P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->_f_angle()-(ANG45/8), vz);
P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->angle+(ANG45/8), vz); P_SpawnMissileAngle (self, PClass::FindActor("GoldWandFX2"), self->_f_angle()+(ANG45/8), vz);
angle = self->angle-(ANG45/8); angle = self->_f_angle()-(ANG45/8);
for(i = 0; i < 5; i++) for(i = 0; i < 5; i++)
{ {
damage = 1+(pr_fgw2()&7); damage = 1+(pr_fgw2()&7);
@ -204,8 +204,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL1)
return 0; return 0;
} }
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX1")); P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX1"));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->angle-(ANG45/10)); P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->_f_angle()-(ANG45/10));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->angle+(ANG45/10)); P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->_f_angle()+(ANG45/10));
return 0; return 0;
} }
@ -233,10 +233,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL2)
return 0; return 0;
} }
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2")); P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"), self->angle-(ANG45/10)); P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"), self->_f_angle()-(ANG45/10));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"), self->angle+(ANG45/10)); P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX2"), self->_f_angle()+(ANG45/10));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->angle-(ANG45/5)); P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->_f_angle()-(ANG45/5));
P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->angle+(ANG45/5)); P_SpawnPlayerMissile (self, PClass::FindActor("CrossbowFX3"), self->_f_angle()+(ANG45/5));
return 0; return 0;
} }
@ -250,7 +250,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
angle_t angle; angle_t Angle;
int damage; int damage;
int slope; int slope;
int randVal; int randVal;
@ -275,23 +275,23 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
} }
player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2) * FRACUNIT; player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2) * FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT; player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT;
angle = self->angle; Angle = self->_f_angle();
if (power) if (power)
{ {
damage = pr_gatk.HitDice (2); damage = pr_gatk.HitDice (2);
dist = 4*MELEERANGE; dist = 4*MELEERANGE;
angle += pr_gatk.Random2() << 17; Angle += pr_gatk.Random2() << 17;
pufftype = PClass::FindActor("GauntletPuff2"); pufftype = PClass::FindActor("GauntletPuff2");
} }
else else
{ {
damage = pr_gatk.HitDice (2); damage = pr_gatk.HitDice (2);
dist = MELEERANGE+1; dist = MELEERANGE+1;
angle += pr_gatk.Random2() << 18; Angle += pr_gatk.Random2() << 18;
pufftype = PClass::FindActor("GauntletPuff1"); pufftype = PClass::FindActor("GauntletPuff1");
} }
slope = P_AimLineAttack (self, angle, dist); slope = P_AimLineAttack (self, Angle, dist);
P_LineAttack (self, angle, dist, slope, damage, NAME_Melee, pufftype, false, &t, &actualdamage); P_LineAttack (self, Angle, dist, slope, damage, NAME_Melee, pufftype, false, &t, &actualdamage);
if (!t.linetarget) if (!t.linetarget)
{ {
if (pr_gatk() > 64) if (pr_gatk() > 64)
@ -324,20 +324,22 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
S_Sound (self, CHAN_AUTO, "weapons/gauntletshit", 1, ATTN_NORM); S_Sound (self, CHAN_AUTO, "weapons/gauntletshit", 1, ATTN_NORM);
} }
// turn to face target // turn to face target
angle = t.angleFromSource; DAngle angle = t.angleFromSource;
if (angle-self->angle > ANG180) DAngle anglediff = deltaangle(self->Angles.Yaw, angle);
if (anglediff < 0.0)
{ {
if ((int)(angle-self->angle) < -ANG90/20) if (anglediff < -4.5)
self->angle = angle+ANG90/21; self->Angles.Yaw = angle + 90.0 / 21;
else else
self->angle -= ANG90/20; self->Angles.Yaw -= 4.5;
} }
else else
{ {
if (angle-self->angle > ANG90/20) if (anglediff > 4.5)
self->angle = angle-ANG90/21; self->Angles.Yaw = angle - 90.0 / 21;
else else
self->angle += ANG90/20; self->Angles.Yaw += 4.5;
} }
self->flags |= MF_JUSTATTACKED; self->flags |= MF_JUSTATTACKED;
return 0; return 0;
@ -387,7 +389,6 @@ int AMaceFX4::DoSpecialDamage (AActor *target, int damage, FName damagetype)
void FireMacePL1B (AActor *actor) void FireMacePL1B (AActor *actor)
{ {
AActor *ball; AActor *ball;
angle_t angle;
player_t *player; player_t *player;
if (NULL == (player = actor->player)) if (NULL == (player = actor->player))
@ -402,15 +403,13 @@ void FireMacePL1B (AActor *actor)
return; return;
} }
ball = Spawn("MaceFX2", actor->PosPlusZ(28*FRACUNIT - actor->floorclip), ALLOW_REPLACE); ball = Spawn("MaceFX2", actor->PosPlusZ(28*FRACUNIT - actor->floorclip), ALLOW_REPLACE);
ball->vel.z = 2*FRACUNIT+/*((player->lookdir)<<(FRACBITS-5))*/ ball->vel.z = FLOAT2FIXED(2 + g_tan(-actor->Angles.Pitch.Degrees));
finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)];
angle = actor->angle;
ball->target = actor; ball->target = actor;
ball->angle = angle; ball->Angles.Yaw = actor->Angles.Yaw;
ball->AddZ(2*finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)]); ball->AddZ(ball->vel.z);
angle >>= ANGLETOFINESHIFT; ball->VelFromAngle();
ball->vel.x = (actor->vel.x>>1) + FixedMul(ball->Speed, finecosine[angle]); ball->vel.x += (actor->vel.x>>1);
ball->vel.y = (actor->vel.y>>1) + FixedMul(ball->Speed, finesine[angle]); ball->vel.y += (actor->vel.y>>1);
S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM); S_Sound (ball, CHAN_BODY, "weapons/maceshoot", 1, ATTN_NORM);
P_CheckMissileSpawn (ball, actor->radius); P_CheckMissileSpawn (ball, actor->radius);
} }
@ -447,7 +446,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL1)
player->psprites[ps_weapon].sx = ((pr_maceatk()&3)-2)*FRACUNIT; player->psprites[ps_weapon].sx = ((pr_maceatk()&3)-2)*FRACUNIT;
player->psprites[ps_weapon].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT; player->psprites[ps_weapon].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT;
ball = P_SpawnPlayerMissile (self, PClass::FindActor("MaceFX1"), ball = P_SpawnPlayerMissile (self, PClass::FindActor("MaceFX1"),
self->angle+(((pr_maceatk()&7)-4)<<24)); self->_f_angle()+(((pr_maceatk()&7)-4)<<24));
if (ball) if (ball)
{ {
ball->special1 = 16; // tics till dropoff ball->special1 = 16; // tics till dropoff
@ -480,7 +479,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MacePL1Check)
// [RH] Avoid some precision loss by scaling the velocity directly // [RH] Avoid some precision loss by scaling the velocity directly
#if 0 #if 0
// This is the original code, for reference. // This is the original code, for reference.
angle_t angle = self->angle>>ANGLETOFINESHIFT; angle_t angle = self->_f_angle()>>ANGLETOFINESHIFT;
self->vel.x = FixedMul(7*FRACUNIT, finecosine[angle]); self->vel.x = FixedMul(7*FRACUNIT, finecosine[angle]);
self->vel.y = FixedMul(7*FRACUNIT, finesine[angle]); self->vel.y = FixedMul(7*FRACUNIT, finesine[angle]);
#else #else
@ -533,7 +532,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *tiny; AActor *tiny;
angle_t angle;
if ((self->Z() <= self->floorz) && P_HitFloor (self)) if ((self->Z() <= self->floorz) && P_HitFloor (self))
{ // Landed in some sort of liquid { // Landed in some sort of liquid
@ -552,22 +550,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2)
self->SetState (self->SpawnState); self->SetState (self->SpawnState);
tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE); tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE);
angle = self->angle+ANG90;
tiny->target = self->target; tiny->target = self->target;
tiny->angle = angle; tiny->Angles.Yaw = self->Angles.Yaw + 90.;
angle >>= ANGLETOFINESHIFT; tiny->VelFromAngle(self->vel.z - FRACUNIT);
tiny->vel.x = (self->vel.x>>1) + FixedMul(self->vel.z-FRACUNIT, finecosine[angle]); tiny->vel.x += (self->vel.x >> 1);
tiny->vel.y = (self->vel.y>>1) + FixedMul(self->vel.z-FRACUNIT, finesine[angle]); tiny->vel.y += (self->vel.y >> 1);
tiny->vel.z = self->vel.z; tiny->vel.z = self->vel.z;
P_CheckMissileSpawn (tiny, self->radius); P_CheckMissileSpawn (tiny, self->radius);
tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE); tiny = Spawn("MaceFX3", self->Pos(), ALLOW_REPLACE);
angle = self->angle-ANG90;
tiny->target = self->target; tiny->target = self->target;
tiny->angle = angle; tiny->Angles.Yaw = self->Angles.Yaw - 90.;
angle >>= ANGLETOFINESHIFT; tiny->VelFromAngle(self->vel.z - FRACUNIT);
tiny->vel.x = (self->vel.x>>1) + FixedMul(self->vel.z-FRACUNIT, finecosine[angle]); tiny->vel.x += (self->vel.x >> 1);
tiny->vel.y = (self->vel.y>>1) + FixedMul(self->vel.z-FRACUNIT, finesine[angle]); tiny->vel.y += (self->vel.y >> 1);
tiny->vel.z = self->vel.z; tiny->vel.z = self->vel.z;
P_CheckMissileSpawn (tiny, self->radius); P_CheckMissileSpawn (tiny, self->radius);
} }
@ -607,13 +603,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL2)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0; 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->_f_angle(), &t);
if (mo) if (mo)
{ {
mo->vel.x += self->vel.x; mo->vel.x += self->vel.x;
mo->vel.y += self->vel.y; mo->vel.y += self->vel.y;
mo->vel.z = 2*FRACUNIT+ mo->vel.z = 2*FRACUNIT+
clamp<fixed_t>(finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT); clamp<fixed_t>(finetangent[FINEANGLES/4-(self->_f_pitch()>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT);
if (t.linetarget && !t.unlinked) if (t.linetarget && !t.unlinked)
{ {
mo->tracer = t.linetarget; mo->tracer = t.linetarget;
@ -635,7 +631,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
int i; int i;
AActor *target; AActor *target;
angle_t angle = 0; DAngle angle = 0;
bool newAngle; bool newAngle;
FTranslatedLineTarget t; FTranslatedLineTarget t;
@ -662,7 +658,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
} }
else else
{ // Seek { // Seek
angle = self->AngleTo(target); angle = self->_f_AngleTo(target);
newAngle = true; newAngle = true;
} }
} }
@ -671,7 +667,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
angle = 0; angle = 0;
for (i = 0; i < 16; i++) 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, FLOAT2ANGLE(angle.Degrees), 10*64*FRACUNIT, &t, 0, ALF_NOFRIENDS|ALF_PORTALRESTRICT, NULL, self->target);
if (t.linetarget && self->target != t.linetarget) if (t.linetarget && self->target != t.linetarget)
{ {
self->tracer = t.linetarget; self->tracer = t.linetarget;
@ -679,15 +675,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact)
newAngle = true; newAngle = true;
break; break;
} }
angle += ANGLE_45/2; angle += 22.5;
} }
} }
if (newAngle) if (newAngle)
{ {
self->angle = angle; self->Angles.Yaw = angle;
angle >>= ANGLETOFINESHIFT; self->VelFromAngle();
self->vel.x = FixedMul (self->Speed, finecosine[angle]);
self->vel.y = FixedMul (self->Speed, finesine[angle]);
} }
self->SetState (self->SpawnState); self->SetState (self->SpawnState);
S_Sound (self, CHAN_BODY, "weapons/macestop", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "weapons/macestop", 1, ATTN_NORM);
@ -795,7 +789,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1)
} }
angle_t pitch = P_BulletSlope(self); angle_t pitch = P_BulletSlope(self);
damage = pr_fb1.HitDice (4); damage = pr_fb1.HitDice (4);
angle = self->angle; angle = self->_f_angle();
if (player->refire) if (player->refire)
{ {
angle += pr_fb1.Random2() << 18; angle += pr_fb1.Random2() << 18;
@ -816,18 +810,16 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
unsigned int i; unsigned int i;
angle_t angle; DAngle angle;
AActor *ripper; AActor *ripper;
for(i = 0; i < 8; i++) for(i = 0; i < 8; i++)
{ {
ripper = Spawn<ARipper> (self->Pos(), ALLOW_REPLACE); ripper = Spawn<ARipper> (self->Pos(), ALLOW_REPLACE);
angle = i*ANG45; angle = i*45.;
ripper->target = self->target; ripper->target = self->target;
ripper->angle = angle; ripper->Angles.Yaw = angle;
angle >>= ANGLETOFINESHIFT; ripper->VelFromAngle();
ripper->vel.x = FixedMul (ripper->Speed, finecosine[angle]);
ripper->vel.y = FixedMul (ripper->Speed, finesine[angle]);
P_CheckMissileSpawn (ripper, self->radius); P_CheckMissileSpawn (ripper, self->radius);
} }
return 0; return 0;
@ -955,7 +947,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL2)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0; 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->_f_angle(), &t, &MissileActor);
// Use MissileActor instead of the return value from // Use MissileActor instead of the return value from
// P_SpawnPlayerMissile because we need to give info to the mobj // P_SpawnPlayerMissile because we need to give info to the mobj
// even if it exploded immediately. // even if it exploded immediately.
@ -1252,7 +1244,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL1)
return 0; return 0;
} }
P_SpawnPlayerMissile (self, RUNTIME_CLASS(APhoenixFX1)); P_SpawnPlayerMissile (self, RUNTIME_CLASS(APhoenixFX1));
angle = self->angle + ANG180; angle = self->_f_angle() + ANG180;
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
self->vel.x += FixedMul (4*FRACUNIT, finecosine[angle]); self->vel.x += FixedMul (4*FRACUNIT, finecosine[angle]);
self->vel.y += FixedMul (4*FRACUNIT, finesine[angle]); self->vel.y += FixedMul (4*FRACUNIT, finesine[angle]);
@ -1275,13 +1267,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_PhoenixPuff)
//[RH] Heretic never sets the target for seeking //[RH] Heretic never sets the target for seeking
//P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10); //P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10);
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE); puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->angle + ANG90; angle = self->_f_angle() + ANG90;
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
puff->vel.x = FixedMul (FRACUNIT*13/10, finecosine[angle]); puff->vel.x = FixedMul (FRACUNIT*13/10, finecosine[angle]);
puff->vel.y = FixedMul (FRACUNIT*13/10, finesine[angle]); puff->vel.y = FixedMul (FRACUNIT*13/10, finesine[angle]);
puff->vel.z = 0; puff->vel.z = 0;
puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE); puff = Spawn("PhoenixPuff", self->Pos(), ALLOW_REPLACE);
angle = self->angle - ANG90; angle = self->_f_angle() - ANG90;
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
puff->vel.x = FixedMul (FRACUNIT*13/10, finecosine[angle]); puff->vel.x = FixedMul (FRACUNIT*13/10, finecosine[angle]);
puff->vel.y = FixedMul (FRACUNIT*13/10, finesine[angle]); puff->vel.y = FixedMul (FRACUNIT*13/10, finesine[angle]);
@ -1323,7 +1315,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *mo; AActor *mo;
angle_t angle;
fixed_t slope; fixed_t slope;
FSoundID soundid; FSoundID soundid;
@ -1345,19 +1336,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
S_StopSound (self, CHAN_WEAPON); S_StopSound (self, CHAN_WEAPON);
return 0; return 0;
} }
angle = self->angle;
slope = FLOAT2FIXED(g_tan(-self->Angles.Pitch.Degrees));
fixed_t xo = (pr_fp2.Random2() << 9); fixed_t xo = (pr_fp2.Random2() << 9);
fixed_t yo = (pr_fp2.Random2() << 9); fixed_t yo = (pr_fp2.Random2() << 9);
fixedvec3 pos = self->Vec3Offset(xo, yo, fixedvec3 pos = self->Vec3Offset(xo, yo,
26*FRACUNIT + finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] - self->floorclip); 26*FRACUNIT + slope - self->floorclip);
slope = finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10); slope += (FRACUNIT/10);
mo = Spawn("PhoenixFX2", pos, ALLOW_REPLACE); mo = Spawn("PhoenixFX2", pos, ALLOW_REPLACE);
mo->target = self; mo->target = self;
mo->angle = angle; mo->Angles.Yaw = self->Angles.Yaw;
mo->vel.x = self->vel.x + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]); mo->VelFromAngle();
mo->vel.y = self->vel.y + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]); mo->vel.x += self->vel.x;
mo->vel.y += self->vel.y;
mo->vel.z = FixedMul (mo->Speed, slope); mo->vel.z = FixedMul (mo->Speed, slope);
if (!player->refire || !S_IsActorPlayingSomething (self, CHAN_WEAPON, -1)) if (!player->refire || !S_IsActorPlayingSomething (self, CHAN_WEAPON, -1))
{ {

View file

@ -30,7 +30,7 @@ int AWhirlwind::DoSpecialDamage (AActor *target, int damage, FName damagetype)
if (!(target->flags7 & MF7_DONTTHRUST)) if (!(target->flags7 & MF7_DONTTHRUST))
{ {
target->angle += pr_foo.Random2() << 20; target->Angles.Yaw += pr_foo.Random2() * (360 / 4096.);
target->vel.x += pr_foo.Random2() << 10; target->vel.x += pr_foo.Random2() << 10;
target->vel.y += pr_foo.Random2() << 10; target->vel.y += pr_foo.Random2() << 10;
} }
@ -114,10 +114,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
S_Sound (self, CHAN_BODY, "ironlich/attack1", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "ironlich/attack1", 1, ATTN_NORM);
} }
fire->target = baseFire->target; fire->target = baseFire->target;
fire->angle = baseFire->angle; fire->Angles.Yaw = baseFire->Angles.Yaw;
fire->vel.x = baseFire->vel.x; fire->vel = baseFire->vel;
fire->vel.y = baseFire->vel.y;
fire->vel.z = baseFire->vel.z;
fire->Damage = NULL; fire->Damage = NULL;
fire->health = (i+1) * 2; fire->health = (i+1) * 2;
P_CheckMissileSpawn (fire, self->radius); P_CheckMissileSpawn (fire, self->radius);
@ -180,18 +178,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
unsigned int i; unsigned int i;
angle_t angle;
AActor *shard; AActor *shard;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
shard = Spawn("HeadFX2", self->Pos(), ALLOW_REPLACE); shard = Spawn("HeadFX2", self->Pos(), ALLOW_REPLACE);
angle = i*ANG45;
shard->target = self->target; shard->target = self->target;
shard->angle = angle; shard->Angles.Yaw = i*45.;
angle >>= ANGLETOFINESHIFT; shard->VelFromAngle();
shard->vel.x = FixedMul (shard->Speed, finecosine[angle]);
shard->vel.y = FixedMul (shard->Speed, finesine[angle]);
shard->vel.z = -FRACUNIT*6/10; shard->vel.z = -FRACUNIT*6/10;
P_CheckMissileSpawn (shard, self->radius); P_CheckMissileSpawn (shard, self->radius);
} }

View file

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

View file

@ -47,7 +47,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatSpawn)
delta = self->args[1]; delta = self->args[1];
if (delta==0) delta=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); mo = P_SpawnMissileAngle (self, PClass::FindActor("Bat"), angle, 0);
if (mo) if (mo)
{ {
@ -74,11 +74,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
if (pr_batmove()<128) if (pr_batmove()<128)
{ {
newangle = self->angle + ANGLE_1*self->args[4]; newangle = self->_f_angle() + ANGLE_1*self->args[4];
} }
else else
{ {
newangle = self->angle - ANGLE_1*self->args[4]; newangle = self->_f_angle() - ANGLE_1*self->args[4];
} }
// Adjust velocity vector to new direction // Adjust velocity vector to new direction

View file

@ -118,15 +118,15 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopDoBlur)
self->special1 = (pr_doblur() & 3) + 3; // Random number of blurs self->special1 = (pr_doblur() & 3) + 3; // Random number of blurs
if (pr_doblur() < 120) if (pr_doblur() < 120)
{ {
P_ThrustMobj (self, self->angle + ANG90, 11*FRACUNIT); P_ThrustMobj (self, self->_f_angle() + ANG90, 11*FRACUNIT);
} }
else if (pr_doblur() > 125) else if (pr_doblur() > 125)
{ {
P_ThrustMobj (self, self->angle - ANG90, 11*FRACUNIT); P_ThrustMobj (self, self->_f_angle() - ANG90, 11*FRACUNIT);
} }
else else
{ // Thrust forward { // Thrust forward
P_ThrustMobj (self, self->angle, 11*FRACUNIT); P_ThrustMobj (self, self->_f_angle(), 11*FRACUNIT);
} }
S_Sound (self, CHAN_BODY, "BishopBlur", 1, ATTN_NORM); S_Sound (self, CHAN_BODY, "BishopBlur", 1, ATTN_NORM);
return 0; return 0;
@ -160,7 +160,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
mo = Spawn ("BishopBlur", self->Pos(), ALLOW_REPLACE); mo = Spawn ("BishopBlur", self->Pos(), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->angle = self->angle; mo->Angles.Yaw = self->Angles.Yaw;
} }
return 0; return 0;
} }
@ -225,7 +225,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur)
mo = Spawn ("BishopPainBlur", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); mo = Spawn ("BishopPainBlur", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->angle = self->angle; mo->Angles.Yaw = self->Angles.Yaw;
} }
return 0; return 0;
} }

View file

@ -56,7 +56,7 @@ void ACFlameMissile::Effect ()
AActor *mo = Spawn ("CFlameFloor", X(), Y(), newz, ALLOW_REPLACE); AActor *mo = Spawn ("CFlameFloor", X(), Y(), newz, ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->angle = angle; mo->Angles.Yaw = Angles.Yaw;
} }
} }
} }
@ -117,7 +117,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
int i; int i;
int an, an90; DAngle an;
fixed_t dist; fixed_t dist;
AActor *mo; AActor *mo;
@ -129,30 +129,29 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
dist = BlockingMobj->radius+18*FRACUNIT; dist = BlockingMobj->radius+18*FRACUNIT;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
an = (i*ANG45)>>ANGLETOFINESHIFT; an = i*45.;
an90 = (i*ANG45+ANG90)>>ANGLETOFINESHIFT;
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset( mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
FixedMul(dist, finecosine[an]), xs_CRoundToInt(an.Cos()*dist), xs_CRoundToInt(an.Sin()*dist),
FixedMul(dist, finesine[an]),
5*FRACUNIT), ALLOW_REPLACE); 5*FRACUNIT), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->angle = an<<ANGLETOFINESHIFT; mo->Angles.Yaw = an;
mo->target = self->target; mo->target = self->target;
mo->vel.x = mo->special1 = FixedMul(FLAMESPEED, finecosine[an]); mo->VelFromAngle(FLAMESPEED);
mo->vel.y = mo->special2 = FixedMul(FLAMESPEED, finesine[an]); mo->special1 = mo->vel.x;
mo->special2 = mo->vel.y;
mo->tics -= pr_missile()&3; mo->tics -= pr_missile()&3;
} }
mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset( mo = Spawn ("CircleFlame", BlockingMobj->Vec3Offset(
-FixedMul(dist, finecosine[an]), -xs_CRoundToInt(an.Cos()*dist), -xs_CRoundToInt(an.Sin()*dist),
-FixedMul(dist, finesine[an]),
5*FRACUNIT), ALLOW_REPLACE); 5*FRACUNIT), ALLOW_REPLACE);
if(mo) if(mo)
{ {
mo->angle = ANG180+(an<<ANGLETOFINESHIFT); mo->Angles.Yaw = an + 180.;
mo->target = self->target; mo->target = self->target;
mo->vel.x = mo->special1 = FixedMul(-FLAMESPEED, finecosine[an]); mo->VelFromAngle(-FLAMESPEED);
mo->vel.y = mo->special2 = FixedMul(-FLAMESPEED, finesine[an]); mo->special1 = mo->vel.x;
mo->special2 = mo->vel.y;
mo->tics -= pr_missile()&3; mo->tics -= pr_missile()&3;
} }
} }
@ -171,11 +170,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameRotate)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
int an; DAngle an = self->Angles.Yaw + 90.;
self->VelFromAngle(an, FLAMEROTSPEED);
self->vel.x += self->special1;
self->vel.y += self->special2;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT; self->Angles.Yaw += 6.;
self->vel.x = self->special1+FixedMul(FLAMEROTSPEED, finecosine[an]);
self->vel.y = self->special2+FixedMul(FLAMEROTSPEED, finesine[an]);
self->angle += ANG90/15;
return 0; return 0;
} }

View file

@ -160,8 +160,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
break; break;
} }
mo->SetZ(self->Z()); mo->SetZ(self->Z());
mo->angle = self->angle+(ANGLE_45+ANGLE_45/2)-ANGLE_45*j; mo->Angles.Yaw = self->Angles.Yaw + 67.5 - 45.*j;
P_ThrustMobj(mo, mo->angle, mo->Speed); P_ThrustMobj(mo, mo->_f_angle(), mo->Speed);
mo->target = self->target; mo->target = self->target;
mo->args[0] = 10; // initial turn value mo->args[0] = 10; // initial turn value
mo->args[1] = 0; // initial look angle mo->args[1] = 0; // initial look angle
@ -225,7 +225,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0; 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->_f_angle(), &t);
if (missile != NULL && !t.unlinked) if (missile != NULL && !t.unlinked)
{ {
missile->tracer = t.linetarget; missile->tracer = t.linetarget;
@ -342,8 +342,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyTail)
else else
{ {
if (P_TryMove (self, if (P_TryMove (self,
parent->X() - 14*finecosine[parent->angle>>ANGLETOFINESHIFT], parent->X() - 14*finecosine[parent->_f_angle()>>ANGLETOFINESHIFT],
parent->Y() - 14*finesine[parent->angle>>ANGLETOFINESHIFT], true)) parent->Y() - 14*finesine[parent->_f_angle()>>ANGLETOFINESHIFT], true))
{ {
self->SetZ(parent->Z()-5*FRACUNIT); self->SetZ(parent->Z()-5*FRACUNIT);
} }
@ -377,12 +377,11 @@ static void CHolyFindTarget (AActor *actor)
// Similar to P_SeekerMissile, but seeks to a random Z on the target // 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 dir;
int dist; int dist;
angle_t delta; DAngle delta;
angle_t angle;
AActor *target; AActor *target;
fixed_t newZ; fixed_t newZ;
fixed_t deltaZ; fixed_t deltaZ;
@ -404,7 +403,7 @@ static void CHolySeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
dir = P_FaceMobj (actor, target, &delta); dir = P_FaceMobj (actor, target, &delta);
if (delta > thresh) if (delta > thresh)
{ {
delta >>= 1; delta /= 2;
if (delta > turnMax) if (delta > turnMax)
{ {
delta = turnMax; delta = turnMax;
@ -412,15 +411,14 @@ static void CHolySeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
} }
if (dir) if (dir)
{ // Turn clockwise { // Turn clockwise
actor->angle += delta; actor->Angles.Yaw += delta;
} }
else else
{ // Turn counter clockwise { // Turn counter clockwise
actor->angle -= delta; actor->Angles.Yaw -= delta;
} }
angle = actor->angle>>ANGLETOFINESHIFT; actor->VelFromAngle();
actor->vel.x = FixedMul (actor->Speed, finecosine[angle]);
actor->vel.y = FixedMul (actor->Speed, finesine[angle]);
if (!(level.time&15) if (!(level.time&15)
|| actor->Z() > target->Top() || actor->Z() > target->Top()
|| actor->Top() < target->Z()) || actor->Top() < target->Z())
@ -463,7 +461,7 @@ void CHolyWeave (AActor *actor, FRandom &pr_random)
weaveXY = actor->special2 >> 16; weaveXY = actor->special2 >> 16;
weaveZ = actor->special2 & FINEMASK; weaveZ = actor->special2 & FINEMASK;
angle = (actor->angle + ANG90) >> ANGLETOFINESHIFT; angle = (actor->_f_angle() + ANG90) >> ANGLETOFINESHIFT;
newX = actor->X() - FixedMul(finecosine[angle], finesine[weaveXY] * 32); newX = actor->X() - FixedMul(finecosine[angle], finesine[weaveXY] * 32);
newY = actor->Y() - FixedMul(finesine[angle], finesine[weaveXY] * 32); newY = actor->Y() - FixedMul(finesine[angle], finesine[weaveXY] * 32);
weaveXY = (weaveXY + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK; weaveXY = (weaveXY + pr_random(5 << BOBTOFINESHIFT)) & FINEMASK;
@ -500,8 +498,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolySeek)
} }
if (self->tracer) if (self->tracer)
{ {
CHolySeekerMissile (self, self->args[0]*ANGLE_1, CHolySeekerMissile (self, self->args[0], self->args[0]*2);
self->args[0]*ANGLE_1*2);
if (!((level.time+7)&15)) if (!((level.time+7)&15))
{ {
self->args[0] = 5+(pr_holyseek()/20); self->args[0] = 5+(pr_holyseek()/20);

View file

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

View file

@ -72,14 +72,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
{ {
for (int j = 1; j >= -1; j -= 2) for (int j = 1; j >= -1; j -= 2)
{ {
angle = pmo->angle + j*i*(ANG45 / 16); angle = pmo->_f_angle() + j*i*(ANG45 / 16);
slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &t, 0, ALF_CHECK3D); slope = P_AimLineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), &t, 0, ALF_CHECK3D);
if (t.linetarget) if (t.linetarget)
{ {
P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &t); P_LineAttack(pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, puff, false, &t);
if (t.linetarget != NULL) 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) if (((t.linetarget->player && (!t.linetarget->IsTeammate(pmo) || level.teamdamage != 0)) || t.linetarget->flags3&MF3_ISMONSTER)
&& (!(t.linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE)))) && (!(t.linetarget->flags2&(MF2_DORMANT | MF2_INVULNERABLE))))
{ {
@ -131,12 +131,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0; return 0;
} }
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle-(ANG45/15)); mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->_f_angle()-(ANG45/15));
if (mo) if (mo)
{ {
mo->WeaveIndexXY = 32; mo->WeaveIndexXY = 32;
} }
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle+(ANG45/15)); mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->_f_angle()+(ANG45/15));
if (mo) if (mo)
{ {
mo->WeaveIndexXY = 0; 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 dir;
int dist; int dist;
angle_t delta; DAngle delta;
angle_t angle;
AActor *target; AActor *target;
int i; int i;
angle_t bestAngle; angle_t bestAngle;
@ -42,7 +41,7 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
dir = P_FaceMobj (actor, target, &delta); dir = P_FaceMobj (actor, target, &delta);
if (delta > thresh) if (delta > thresh)
{ {
delta >>= 1; delta /= 2;
if (delta > turnMax) if (delta > turnMax)
{ {
delta = turnMax; delta = turnMax;
@ -50,15 +49,14 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
} }
if (dir) if (dir)
{ // Turn clockwise { // Turn clockwise
actor->angle += delta; actor->Angles.Yaw += delta;
} }
else else
{ // Turn counter clockwise { // Turn counter clockwise
actor->angle -= delta; actor->Angles.Yaw -= delta;
} }
angle = actor->angle>>ANGLETOFINESHIFT; actor->VelFromAngle();
actor->vel.x = FixedMul (actor->Speed, finecosine[angle]);
actor->vel.y = FixedMul (actor->Speed, finesine[angle]);
dist = actor->AproxDistance (target) / actor->Speed; dist = actor->AproxDistance (target) / actor->Speed;
if (actor->Top() < target->Z() || if (actor->Top() < target->Z() ||
target->Top() < actor->Z()) target->Top() < actor->Z())
@ -73,7 +71,7 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
{ // attack the destination mobj if it's attackable { // attack the destination mobj if it's attackable
AActor *oldTarget; AActor *oldTarget;
if (absangle(actor->angle - actor->AngleTo(target)) < ANGLE_45/2) if (absangle(actor->_f_angle() - actor->AngleTo(target)) < ANGLE_45/2)
{ {
oldTarget = actor->target; oldTarget = actor->target;
actor->target = target; actor->target = target;
@ -184,7 +182,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
angle_t angle; angle_t angle;
DragonSeek (self, 4*ANGLE_1, 8*ANGLE_1); DragonSeek (self, 4, 8);
if (self->target) if (self->target)
{ {
if(!(self->target->flags&MF_SHOOTABLE)) if(!(self->target->flags&MF_SHOOTABLE))
@ -193,14 +191,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
return 0; return 0;
} }
angle = self->AngleTo(self->target); angle = self->AngleTo(self->target);
if (absangle(self->angle-angle) < ANGLE_45/2 && self->CheckMeleeRange()) if (absangle(self->_f_angle()-angle) < ANGLE_45/2 && self->CheckMeleeRange())
{ {
int damage = pr_dragonflight.HitDice (8); int damage = pr_dragonflight.HitDice (8);
int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee); int newdam = P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self); P_TraceBleed (newdam > 0 ? newdam : damage, self->target, self);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); 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); self->SetState (self->MissileState);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);

View file

@ -236,7 +236,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
{ {
for (int j = 1; j >= -1; j -= 2) for (int j = 1; j >= -1; j -= 2)
{ {
angle = pmo->angle + j*i*(ANG45 / 16); angle = pmo->_f_angle() + j*i*(ANG45 / 16);
slope = P_AimLineAttack(pmo, angle, AXERANGE, &t); slope = P_AimLineAttack(pmo, angle, AXERANGE, &t);
if (t.linetarget) if (t.linetarget)
{ {
@ -257,7 +257,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
// didn't find any creatures, so try to strike any walls // didn't find any creatures, so try to strike any walls
pmo->weaponspecial = 0; pmo->weaponspecial = 0;
angle = pmo->angle; angle = pmo->_f_angle();
slope = P_AimLineAttack (pmo, angle, MELEERANGE); slope = P_AimLineAttack (pmo, angle, MELEERANGE);
P_LineAttack (pmo, angle, MELEERANGE, slope, damage, NAME_Melee, pufftype, true); P_LineAttack (pmo, angle, MELEERANGE, slope, damage, NAME_Melee, pufftype, true);

View file

@ -47,7 +47,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
hammertime = PClass::FindActor("HammerPuff"); hammertime = PClass::FindActor("HammerPuff");
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
angle = pmo->angle + i*(ANG45/32); angle = pmo->_f_angle() + i*(ANG45/32);
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &t, 0, ALF_CHECK3D); slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &t, 0, ALF_CHECK3D);
if (t.linetarget != NULL) if (t.linetarget != NULL)
{ {
@ -63,7 +63,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
goto hammerdone; goto hammerdone;
} }
} }
angle = pmo->angle-i*(ANG45/32); angle = pmo->_f_angle()-i*(ANG45/32);
slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &t, 0, ALF_CHECK3D); slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &t, 0, ALF_CHECK3D);
if (t.linetarget != NULL) if (t.linetarget != NULL)
{ {
@ -81,7 +81,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
} }
} }
// didn't find any targets in meleerange, so set to throw out a hammer // didn't find any targets in meleerange, so set to throw out a hammer
angle = pmo->angle; angle = pmo->_f_angle();
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, NULL, 0, ALF_CHECK3D); 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) if (P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true) != NULL)
{ {

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) void AdjustPlayerAngle (AActor *pmo, FTranslatedLineTarget *t)
{ {
angle_t angle; DAngle difference = deltaangle(pmo->Angles.Yaw, t->angleFromSource);
int difference; if (fabs(difference) > MAX_ANGLE_ADJUST)
angle = t->angleFromSource;
difference = (int)angle - (int)pmo->angle;
if (abs(difference) > MAX_ANGLE_ADJUST)
{ {
if (difference > 0) if (difference > 0)
{ {
pmo->angle += MAX_ANGLE_ADJUST; pmo->Angles.Yaw += MAX_ANGLE_ADJUST;
} }
else else
{ {
pmo->angle -= MAX_ANGLE_ADJUST; pmo->Angles.Yaw -= MAX_ANGLE_ADJUST;
} }
} }
else else
{ {
pmo->angle = angle; pmo->Angles.Yaw = t->angleFromSource;
} }
} }
@ -116,8 +112,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
power = 2*FRACUNIT; power = 2*FRACUNIT;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
if (TryPunch(pmo, pmo->angle + i*(ANG45/16), damage, power) || if (TryPunch(pmo, pmo->_f_angle() + i*(ANG45/16), damage, power) ||
TryPunch(pmo, pmo->angle - i*(ANG45/16), damage, power)) TryPunch(pmo, pmo->_f_angle() - i*(ANG45/16), damage, power))
{ // hit something { // hit something
if (pmo->weaponspecial >= 3) if (pmo->weaponspecial >= 3)
{ {
@ -131,7 +127,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
// didn't find any creatures, so try to strike any walls // didn't find any creatures, so try to strike any walls
pmo->weaponspecial = 0; pmo->weaponspecial = 0;
int slope = P_AimLineAttack (pmo, pmo->angle, MELEERANGE); int slope = P_AimLineAttack (pmo, pmo->_f_angle(), MELEERANGE);
P_LineAttack (pmo, pmo->angle, MELEERANGE, slope, damage, NAME_Melee, PClass::FindActor("PunchPuff"), true); P_LineAttack (pmo, pmo->_f_angle(), MELEERANGE, slope, damage, NAME_Melee, PClass::FindActor("PunchPuff"), true);
return 0; return 0;
} }

View file

@ -95,11 +95,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FSwordAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0; return 0;
} }
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->_f_angle()+ANGLE_45/4);
P_SpawnPlayerMissile (self, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle+ANGLE_45/8); P_SpawnPlayerMissile (self, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->_f_angle()+ANGLE_45/8);
P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->angle); P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->_f_angle());
P_SpawnPlayerMissile (self, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle-ANGLE_45/8); P_SpawnPlayerMissile (self, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->_f_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->_f_angle()-ANGLE_45/4);
S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
return 0; return 0;
} }
@ -138,7 +138,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FighterAttack)
if (!self->target) return 0; 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/4, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/8, 0); P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/8, 0);

View file

@ -39,7 +39,7 @@ IMPLEMENT_CLASS (AArtiPoisonBag1)
bool AArtiPoisonBag1::Use (bool pickup) bool AArtiPoisonBag1::Use (bool pickup)
{ {
angle_t angle = Owner->angle >> ANGLETOFINESHIFT; angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo; AActor *mo;
mo = Spawn ("PoisonBag", Owner->Vec3Offset( mo = Spawn ("PoisonBag", Owner->Vec3Offset(
@ -67,7 +67,7 @@ IMPLEMENT_CLASS (AArtiPoisonBag2)
bool AArtiPoisonBag2::Use (bool pickup) bool AArtiPoisonBag2::Use (bool pickup)
{ {
angle_t angle = Owner->angle >> ANGLETOFINESHIFT; angle_t angle = Owner->_f_angle() >> ANGLETOFINESHIFT;
AActor *mo; AActor *mo;
mo = Spawn ("FireBomb", Owner->Vec3Offset( mo = Spawn ("FireBomb", Owner->Vec3Offset(
@ -100,12 +100,12 @@ bool AArtiPoisonBag3::Use (bool pickup)
mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE); mo = Spawn("ThrowingBomb", Owner->PosPlusZ(-Owner->floorclip+35*FRACUNIT + (Owner->player? Owner->player->crouchoffset : 0)), ALLOW_REPLACE);
if (mo) if (mo)
{ {
mo->angle = Owner->angle + (((pr_poisonbag()&7) - 4) << 24); mo->Angles.Yaw = Owner->Angles.Yaw + (((pr_poisonbag() & 7) - 4) * 22.5f);
/* Original flight code from Hexen /* Original flight code from Hexen
* mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4)); * mo->momz = 4*FRACUNIT+((player->lookdir)<<(FRACBITS-4));
* mo->z += 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->momx += player->mo->momx>>1;
* mo->momy += player->mo->momy>>1; * mo->momy += player->mo->momy>>1;
*/ */
@ -114,9 +114,9 @@ bool AArtiPoisonBag3::Use (bool pickup)
// is as set by the projectile. To accommodate this with a proper trajectory, we // is as set by the projectile. To accommodate this with a proper trajectory, we
// aim the projectile ~20 degrees higher than we're looking at and increase the // aim the projectile ~20 degrees higher than we're looking at and increase the
// speed we fire at accordingly. // speed we fire at accordingly.
angle_t orgpitch = angle_t(-Owner->pitch) >> ANGLETOFINESHIFT; angle_t orgpitch = angle_t(-Owner->_f_pitch()) >> ANGLETOFINESHIFT;
angle_t modpitch = angle_t(0xDC00000 - Owner->pitch) >> ANGLETOFINESHIFT; angle_t modpitch = angle_t(0xDC00000 - Owner->_f_pitch()) >> ANGLETOFINESHIFT;
angle_t angle = mo->angle >> ANGLETOFINESHIFT; angle_t angle = mo->_f_angle() >> ANGLETOFINESHIFT;
fixed_t speed = fixed_t(g_sqrt((double)mo->Speed*mo->Speed + (4.0*65536*4*65536))); fixed_t speed = fixed_t(g_sqrt((double)mo->Speed*mo->Speed + (4.0*65536*4*65536)));
fixed_t xyscale = FixedMul(speed, finecosine[modpitch]); fixed_t xyscale = FixedMul(speed, finecosine[modpitch]);

View file

@ -84,9 +84,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlyBuzz)
return 0; return 0;
} }
angle_t ang = self->AngleTo(targ); self->Angles.Yaw = self->_f_AngleTo(targ);
self->angle = ang;
self->args[0]++; self->args[0]++;
angle_t ang = self->AngleTo(targ);
ang >>= ANGLETOFINESHIFT; ang >>= ANGLETOFINESHIFT;
if (!P_TryMove(self, self->X() + 6 * finecosine[ang], self->Y() + 6 * finesine[ang], true)) if (!P_TryMove(self, self->X() + 6 * finecosine[ang], self->Y() + 6 * finesine[ang], true))
{ {

View file

@ -51,7 +51,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn)
{ {
delta = self->args[1]; delta = self->args[1];
if (delta==0) delta=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; mo->target = self;
if (self->args[0] < 1) self->args[0] = 1; if (self->args[0] < 1) self->args[0] = 1;
mo->args[0] = (pr_fogspawn() % (self->args[0]))+1; // Random speed mo->args[0] = (pr_fogspawn() % (self->args[0]))+1; // Random speed
@ -94,7 +94,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
self->special2 = (weaveindex + 1) & 63; self->special2 = (weaveindex + 1) & 63;
} }
angle = self->angle>>ANGLETOFINESHIFT; angle = self->_f_angle()>>ANGLETOFINESHIFT;
self->vel.x = FixedMul(speed, finecosine[angle]); self->vel.x = FixedMul(speed, finecosine[angle]);
self->vel.y = FixedMul(speed, finesine[angle]); self->vel.y = FixedMul(speed, finesine[angle]);
return 0; return 0;

View file

@ -296,7 +296,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
baseangle = (angle_t)parent->special1; baseangle = (angle_t)parent->special1;
angle = baseangle + actor->AngleOffset; angle = baseangle + actor->AngleOffset;
actor->angle = angle; actor->Angles.Yaw = ANGLE2FLOAT(angle);
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
switch (mode) switch (mode)
@ -318,13 +318,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
case SORC_STOPPING: // Balls stopping case SORC_STOPPING: // Balls stopping
if ((parent->StopBall == actor->GetClass()) && if ((parent->StopBall == actor->GetClass()) &&
(parent->args[1] > SORCBALL_SPEED_ROTATIONS) && (parent->args[1] > SORCBALL_SPEED_ROTATIONS) &&
(absangle(angle - (parent->angle>>ANGLETOFINESHIFT)) < (30<<5))) (absangle(angle - (parent->_f_angle()>>ANGLETOFINESHIFT)) < (30<<5)))
{ {
// Can stop now // Can stop now
actor->target->args[3] = SORC_FIRESPELL; actor->target->args[3] = SORC_FIRESPELL;
actor->target->args[4] = 0; actor->target->args[4] = 0;
// Set angle so self angle == sorcerer angle // Set angle so self angle == sorcerer angle
parent->special1 = (int)(parent->angle - actor->AngleOffset); parent->special1 = (int)(parent->_f_angle() - actor->AngleOffset);
} }
else else
{ {
@ -573,8 +573,8 @@ void ASorcBall3::CastSorcererSpell ()
angle_t ang1, ang2; angle_t ang1, ang2;
AActor *parent = target; AActor *parent = target;
ang1 = angle - ANGLE_45; ang1 = FLOAT2ANGLE(Angles.Yaw.Degrees) - ANGLE_45;
ang2 = angle + ANGLE_45; ang2 = FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_45;
PClassActor *cls = PClass::FindActor("SorcFX3"); PClassActor *cls = PClass::FindActor("SorcFX3");
if (health < (SpawnHealth()/3)) if (health < (SpawnHealth()/3))
{ // Spawn 2 at a time { // Spawn 2 at a time
@ -622,8 +622,8 @@ void ASorcBall1::CastSorcererSpell ()
angle_t ang1, ang2; angle_t ang1, ang2;
AActor *parent = target; AActor *parent = target;
ang1 = angle + ANGLE_1*70; ang1 = FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_1*70;
ang2 = angle - ANGLE_1*70; ang2 = FLOAT2ANGLE(Angles.Yaw.Degrees) - ANGLE_1*70;
PClassActor *cls = PClass::FindActor("SorcFX1"); PClassActor *cls = PClass::FindActor("SorcFX1");
mo = P_SpawnMissileAngle (parent, cls, ang1, 0); mo = P_SpawnMissileAngle (parent, cls, ang1, 0);
if (mo) if (mo)
@ -670,7 +670,7 @@ void A_SorcOffense2(AActor *actor)
actor->args[4] = (actor->args[4] + 15) & 255; actor->args[4] = (actor->args[4] + 15) & 255;
delta = (finesine[index])*SORCFX4_SPREAD_ANGLE; delta = (finesine[index])*SORCFX4_SPREAD_ANGLE;
delta = (delta>>FRACBITS)*ANGLE_1; delta = (delta>>FRACBITS)*ANGLE_1;
ang1 = actor->angle + delta; ang1 = actor->_f_angle() + delta;
mo = P_SpawnMissileAngle(parent, PClass::FindActor("SorcFX4"), ang1, 0); mo = P_SpawnMissileAngle(parent, PClass::FindActor("SorcFX4"), ang1, 0);
if (mo) if (mo)
{ {
@ -715,13 +715,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnFizzle)
AActor *mo; AActor *mo;
int ix; int ix;
fixedvec3 pos = self->Vec3Angle(dist, self->angle, -self->floorclip + (self->height >> 1)); fixedvec3 pos = self->Vec3Angle(dist, self->_f_angle(), -self->floorclip + (self->height >> 1));
for (ix=0; ix<5; ix++) for (ix=0; ix<5; ix++)
{ {
mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE); mo = Spawn("SorcSpark1", pos, ALLOW_REPLACE);
if (mo) if (mo)
{ {
rangle = (self->angle >> ANGLETOFINESHIFT) + ((pr_heresiarch()%5) << 1); rangle = (self->_f_angle() >> ANGLETOFINESHIFT) + ((pr_heresiarch()%5) << 1);
mo->vel.x = FixedMul(pr_heresiarch()%speed, finecosine[rangle]); mo->vel.x = FixedMul(pr_heresiarch()%speed, finecosine[rangle]);
mo->vel.y = FixedMul(pr_heresiarch()%speed, finesine[rangle]); mo->vel.y = FixedMul(pr_heresiarch()%speed, finesine[rangle]);
mo->vel.z = FRACUNIT*2; mo->vel.z = FRACUNIT*2;
@ -776,7 +776,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
{ {
mo->target = self->target; mo->target = self->target;
mo->args[0] = 0; // CW mo->args[0] = 0; // CW
mo->special1 = self->angle; // Set angle mo->special1 = self->_f_angle(); // Set angle
mo->SetState (mo->FindState("Orbit")); mo->SetState (mo->FindState("Orbit"));
} }
mo = Spawn(self->GetClass(), self->Pos(), NO_REPLACE); mo = Spawn(self->GetClass(), self->Pos(), NO_REPLACE);
@ -784,7 +784,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
{ {
mo->target = self->target; mo->target = self->target;
mo->args[0] = 1; // CCW mo->args[0] = 1; // CCW
mo->special1 = self->angle; // Set angle mo->special1 = self->_f_angle(); // Set angle
mo->SetState (mo->FindState("Orbit")); mo->SetState (mo->FindState("Orbit"));
} }
self->Destroy (); self->Destroy ();

View file

@ -117,7 +117,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PotteryCheck)
if (playeringame[i]) if (playeringame[i])
{ {
AActor *pmo = players[i].mo; 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->AngleTo(self) - pmo->_f_angle()) <= ANGLE_45))
{ // Previous state (pottery bit waiting state) { // Previous state (pottery bit waiting state)
self->SetState (self->state - 1); self->SetState (self->state - 1);
return 0; return 0;
@ -222,7 +222,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn)
if (mo) if (mo)
{ {
P_ThrustMobj (mo, self->angle, (pr_leaf()<<9)+3*FRACUNIT); P_ThrustMobj (mo, self->_f_angle(), (pr_leaf()<<9)+3*FRACUNIT);
mo->target = self; mo->target = self;
mo->special1 = 0; mo->special1 = 0;
} }
@ -263,7 +263,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LeafCheck)
self->SetState (NULL); self->SetState (NULL);
return 0; return 0;
} }
angle_t ang = self->target ? self->target->angle : self->angle; angle_t ang = self->target ? self->target->_f_angle() : self->_f_angle();
if (pr_leafcheck() > 64) if (pr_leafcheck() > 64)
{ {
if (!self->vel.x && !self->vel.y) if (!self->vel.x && !self->vel.y)

View file

@ -35,7 +35,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook)
if (pr_iceguylook() < 64) if (pr_iceguylook() < 64)
{ {
dist = ((pr_iceguylook()-128)*self->radius)>>7; dist = ((pr_iceguylook()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT; an = (self->_f_angle()+ANG90)>>ANGLETOFINESHIFT;
Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Offset( Spawn(WispTypes[pr_iceguylook() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]), FixedMul(dist, finecosine[an]),
@ -63,7 +63,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
if (pr_iceguychase() < 128) if (pr_iceguychase() < 128)
{ {
dist = ((pr_iceguychase()-128)*self->radius)>>7; dist = ((pr_iceguychase()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT; an = (self->_f_angle()+ANG90)>>ANGLETOFINESHIFT;
mo = Spawn(WispTypes[pr_iceguychase() & 1], self->Vec3Offset( mo = Spawn(WispTypes[pr_iceguychase() & 1], self->Vec3Offset(
FixedMul(dist, finecosine[an]), FixedMul(dist, finecosine[an]),
@ -94,8 +94,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
{ {
return 0; 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->_f_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->Vec3Angle(self->radius>>1, self->_f_angle()-ANG90, 40*FRACUNIT), self, self->target, PClass::FindActor ("IceGuyFX"));
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
return 0; return 0;
} }

View file

@ -99,7 +99,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
spot = iterator.Next (); spot = iterator.Next ();
if (spot != NULL) if (spot != NULL)
{ {
P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, TELF_SOURCEFOG | TELF_DESTFOG); P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->Angles.Yaw, TELF_SOURCEFOG | TELF_DESTFOG);
} }
P_StartScript (self, NULL, 249, NULL, NULL, 0, 0); P_StartScript (self, NULL, 249, NULL, NULL, 0, 0);
@ -141,7 +141,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
self->tracer = spot; self->tracer = spot;
if (spot) if (spot)
{ {
P_Teleport (self, spot->X(), spot->Y(), ONFLOORZ, spot->angle, TELF_SOURCEFOG | TELF_DESTFOG); P_Teleport (self, spot->X(), spot->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); S_Sound (self, CHAN_VOICE, "KoraxCommand", 1, ATTN_NORM);
// Shoot stream of lightning to ceiling // Shoot stream of lightning to ceiling
ang = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT; ang = (self->_f_angle() - ANGLE_90) >> ANGLETOFINESHIFT;
fixedvec3 pos = self->Vec3Offset( fixedvec3 pos = self->Vec3Offset(
KORAX_COMMAND_OFFSET * finecosine[ang], KORAX_COMMAND_OFFSET * finecosine[ang],
KORAX_COMMAND_OFFSET * finesine[ang], KORAX_COMMAND_OFFSET * finesine[ang],
@ -331,7 +331,7 @@ void KoraxFire (AActor *actor, PClassActor *type, int arm)
angle_t ang; 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( fixedvec3 pos = actor->Vec3Offset(
extension[arm] * finecosine[ang], extension[arm] * finecosine[ang],
extension[arm] * finesine[ang], extension[arm] * finesine[ang],
@ -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 dir;
int dist; int dist;
angle_t delta; DAngle delta;
angle_t angle;
AActor *target; AActor *target;
fixed_t newZ; fixed_t newZ;
fixed_t deltaZ; fixed_t deltaZ;
@ -372,7 +371,7 @@ void A_KSpiritSeeker (AActor *actor, angle_t thresh, angle_t turnMax)
dir = P_FaceMobj (actor, target, &delta); dir = P_FaceMobj (actor, target, &delta);
if (delta > thresh) if (delta > thresh)
{ {
delta >>= 1; delta /= 2;
if(delta > turnMax) if(delta > turnMax)
{ {
delta = turnMax; delta = turnMax;
@ -380,15 +379,13 @@ void A_KSpiritSeeker (AActor *actor, angle_t thresh, angle_t turnMax)
} }
if(dir) if(dir)
{ // Turn clockwise { // Turn clockwise
actor->angle += delta; actor->Angles.Yaw += delta;
} }
else else
{ // Turn counter clockwise { // Turn counter clockwise
actor->angle -= delta; actor->Angles.Yaw -= delta;
} }
angle = actor->angle>>ANGLETOFINESHIFT; actor->VelFromAngle();
actor->vel.x = FixedMul (actor->Speed, finecosine[angle]);
actor->vel.y = FixedMul (actor->Speed, finesine[angle]);
if (!(level.time&15) if (!(level.time&15)
|| actor->Z() > target->Z()+(target->GetDefault()->height) || actor->Z() > target->Z()+(target->GetDefault()->height)
@ -436,8 +433,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KSpiritRoam)
{ {
if (self->tracer) if (self->tracer)
{ {
A_KSpiritSeeker (self, self->args[0]*ANGLE_1, A_KSpiritSeeker(self, self->args[0], self->args[0] * 2);
self->args[0]*ANGLE_1*2);
} }
CHolyWeave(self, pr_kspiritweave); CHolyWeave(self, pr_kspiritweave);
if (pr_kspiritroam()<50) if (pr_kspiritroam()<50)
@ -507,7 +503,7 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, PClassActor *type) AActor *source, AActor *dest, PClassActor *type)
{ {
AActor *th; AActor *th;
angle_t an; DAngle an;
int dist; int dist;
z -= source->floorclip; z -= source->floorclip;
@ -516,12 +512,10 @@ AActor *P_SpawnKoraxMissile (fixed_t x, fixed_t y, fixed_t z,
an = th->AngleTo(dest); an = th->AngleTo(dest);
if (dest->flags & MF_SHADOW) if (dest->flags & MF_SHADOW)
{ // Invisible target { // Invisible target
an += pr_kmissile.Random2()<<21; an += pr_missile.Random2() * (45/256.);
} }
th->angle = an; th->Angles.Yaw = an;
an >>= ANGLETOFINESHIFT; th->VelFromAngle();
th->vel.x = FixedMul (th->Speed, finecosine[an]);
th->vel.y = FixedMul (th->Speed, finesine[an]);
dist = dest->AproxDistance (th) / th->Speed; dist = dest->AproxDistance (th) / th->Speed;
if (dist < 1) if (dist < 1)
{ {

View file

@ -78,11 +78,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireConePL1)
damage = 90+(pr_cone()&15); damage = 90+(pr_cone()&15);
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
angle = self->angle+i*(ANG45/16); angle = self->_f_angle()+i*(ANG45/16);
slope = P_AimLineAttack (self, angle, MELEERANGE, &t, 0, ALF_CHECK3D); slope = P_AimLineAttack (self, angle, MELEERANGE, &t, 0, ALF_CHECK3D);
if (t.linetarget) if (t.linetarget)
{ {
P_DamageMobj (t.linetarget, self, self, damage, NAME_Ice, DMG_USEANGLE, t.angleFromSource); P_DamageMobj (t.linetarget, self, self, damage, NAME_Ice, DMG_USEANGLE, FLOAT2ANGLE(t.angleFromSource.Degrees));
conedone = true; conedone = true;
break; break;
} }
@ -128,7 +128,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
// every so many calls, spawn a new missile in its set directions // every so many calls, spawn a new missile in its set directions
if (spawndir & SHARDSPAWN_LEFT) if (spawndir & SHARDSPAWN_LEFT)
{ {
mo = P_SpawnMissileAngleZSpeed (self, self->Z(), RUNTIME_CLASS(AFrostMissile), self->angle+(ANG45/9), mo = P_SpawnMissileAngleZSpeed (self, self->Z(), RUNTIME_CLASS(AFrostMissile), self->_f_angle()+(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target); 0, (20+2*spermcount)<<FRACBITS, self->target);
if (mo) if (mo)
{ {
@ -140,7 +140,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
} }
if (spawndir & SHARDSPAWN_RIGHT) if (spawndir & SHARDSPAWN_RIGHT)
{ {
mo = P_SpawnMissileAngleZSpeed (self, self->Z(), RUNTIME_CLASS(AFrostMissile), self->angle-(ANG45/9), mo = P_SpawnMissileAngleZSpeed (self, self->Z(), RUNTIME_CLASS(AFrostMissile), self->_f_angle()-(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target); 0, (20+2*spermcount)<<FRACBITS, self->target);
if (mo) if (mo)
{ {
@ -152,7 +152,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
} }
if (spawndir & SHARDSPAWN_UP) if (spawndir & SHARDSPAWN_UP)
{ {
mo = P_SpawnMissileAngleZSpeed (self, self->Z()+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle, mo = P_SpawnMissileAngleZSpeed (self, self->Z()+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->_f_angle(),
0, (15+2*spermcount)<<FRACBITS, self->target); 0, (15+2*spermcount)<<FRACBITS, self->target);
if (mo) if (mo)
{ {
@ -167,7 +167,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
} }
if (spawndir & SHARDSPAWN_DOWN) if (spawndir & SHARDSPAWN_DOWN)
{ {
mo = P_SpawnMissileAngleZSpeed (self, self->Z()-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle, mo = P_SpawnMissileAngleZSpeed (self, self->Z()-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->_f_angle(),
0, (15+2*spermcount)<<FRACBITS, self->target); 0, (15+2*spermcount)<<FRACBITS, self->target);
if (mo) if (mo)
{ {

View file

@ -170,19 +170,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
zigZag = pr_lightningclip(); zigZag = pr_lightningclip();
if((zigZag > 128 && self->special1 < 2) || self->special1 < -2) if((zigZag > 128 && self->special1 < 2) || self->special1 < -2)
{ {
P_ThrustMobj(self, self->angle+ANG90, ZAGSPEED); P_ThrustMobj(self, self->_f_angle()+ANG90, ZAGSPEED);
if(cMo) if(cMo)
{ {
P_ThrustMobj(cMo, self->angle+ANG90, ZAGSPEED); P_ThrustMobj(cMo, self->_f_angle()+ANG90, ZAGSPEED);
} }
self->special1++; self->special1++;
} }
else else
{ {
P_ThrustMobj(self, self->angle-ANG90, ZAGSPEED); P_ThrustMobj(self, self->_f_angle()-ANG90, ZAGSPEED);
if(cMo) if(cMo)
{ {
P_ThrustMobj(cMo, cMo->angle-ANG90, ZAGSPEED); P_ThrustMobj(cMo, cMo->_f_angle()-ANG90, ZAGSPEED);
} }
self->special1--; self->special1--;
} }
@ -195,10 +195,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
} }
else else
{ {
self->angle = self->AngleTo(target); self->Angles.Yaw = self->_f_AngleTo(target);
self->vel.x = 0; self->vel.x = 0;
self->vel.y = 0; self->vel.y = 0;
P_ThrustMobj (self, self->angle, self->Speed>>1); P_ThrustMobj (self, self->Angles.Yaw, self->Speed>>1);
} }
} }
return 0; return 0;

View file

@ -139,7 +139,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0; return 0;
} }
angle = self->angle; angle = self->_f_angle();
// [RH] Let's try and actually track what the player aimed at // [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, ANGLE_1*32);
@ -258,7 +258,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MageAttack)
return 0; return 0;
} }
angle_t angle; angle_t angle;
angle = self->angle; angle = self->_f_angle();
MStaffSpawn2 (self, angle); MStaffSpawn2 (self, angle);
MStaffSpawn2 (self, angle-ANGLE_1*5); MStaffSpawn2 (self, angle-ANGLE_1*5);
MStaffSpawn2 (self, angle+ANGLE_1*5); MStaffSpawn2 (self, angle+ANGLE_1*5);

View file

@ -73,7 +73,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack)
} }
damage = 3+(pr_snoutattack()&3); damage = 3+(pr_snoutattack()&3);
angle = player->mo->angle; angle = player->mo->_f_angle();
slope = P_AimLineAttack(player->mo, angle, MELEERANGE); slope = P_AimLineAttack(player->mo, angle, MELEERANGE);
puff = P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "SnoutPuff", true, &t); puff = P_LineAttack(player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, "SnoutPuff", true, &t);
S_Sound(player->mo, CHAN_VOICE, "PigActive", 1, ATTN_NORM); S_Sound(player->mo, CHAN_VOICE, "PigActive", 1, ATTN_NORM);

View file

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

View file

@ -129,11 +129,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_WraithFX2)
{ {
if (pr_wraithfx2 ()<128) if (pr_wraithfx2 ()<128)
{ {
angle = self->angle+(pr_wraithfx2()<<22); angle = self->_f_angle()+(pr_wraithfx2()<<22);
} }
else else
{ {
angle = self->angle-(pr_wraithfx2()<<22); angle = self->_f_angle()-(pr_wraithfx2()<<22);
} }
mo->vel.z = 0; mo->vel.z = 0;
mo->vel.x = FixedMul((pr_wraithfx2()<<7)+FRACUNIT, mo->vel.x = FixedMul((pr_wraithfx2()<<7)+FRACUNIT,

View file

@ -1240,8 +1240,7 @@ void G_FinishTravel ()
{ {
if (!(changeflags & CHANGELEVEL_KEEPFACING)) if (!(changeflags & CHANGELEVEL_KEEPFACING))
{ {
pawn->angle = pawndup->angle; pawn->Angles = pawndup->Angles;
pawn->pitch = pawndup->pitch;
} }
pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z()); pawn->SetXYZ(pawndup->X(), pawndup->Y(), pawndup->Z());
pawn->vel.x = pawndup->vel.x; pawn->vel.x = pawndup->vel.x;

View file

@ -29,7 +29,7 @@ bool AArtiTeleport::Use (bool pickup)
{ {
fixed_t destX; fixed_t destX;
fixed_t destY; fixed_t destY;
angle_t destAngle; int destAngle;
if (deathmatch) if (deathmatch)
{ {
@ -37,14 +37,14 @@ bool AArtiTeleport::Use (bool pickup)
unsigned int i = pr_tele() % selections; unsigned int i = pr_tele() % selections;
destX = deathmatchstarts[i].x; destX = deathmatchstarts[i].x;
destY = deathmatchstarts[i].y; destY = deathmatchstarts[i].y;
destAngle = ANG45 * (deathmatchstarts[i].angle/45); destAngle = deathmatchstarts[i].angle;
} }
else else
{ {
FPlayerStart *start = G_PickPlayerStart(int(Owner->player - players)); FPlayerStart *start = G_PickPlayerStart(int(Owner->player - players));
destX = start->x; destX = start->x;
destY = start->y; 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, destAngle, TELF_SOURCEFOG | TELF_DESTFOG);
bool canlaugh = true; bool canlaugh = true;

View file

@ -210,7 +210,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
self->flags2 |= MF2_INVULNERABLE; self->flags2 |= MF2_INVULNERABLE;
} }
A_FaceTarget (self); A_FaceTarget (self);
angle = self->angle>>ANGLETOFINESHIFT; angle = self->_f_angle()>>ANGLETOFINESHIFT;
self->vel.x = FixedMul (MNTR_CHARGE_SPEED, finecosine[angle]); self->vel.x = FixedMul (MNTR_CHARGE_SPEED, finecosine[angle]);
self->vel.y = FixedMul (MNTR_CHARGE_SPEED, finesine[angle]); self->vel.y = FixedMul (MNTR_CHARGE_SPEED, finesine[angle]);
self->special1 = TICRATE/2; // Charge duration self->special1 = TICRATE/2; // Charge duration
@ -312,7 +312,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
{ {
// S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM); // S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
vz = mo->vel.z; vz = mo->vel.z;
angle = mo->angle; angle = mo->_f_angle();
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/8), vz); P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/8), vz); P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/8), vz);
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/16), vz); P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/16), vz);

View file

@ -315,7 +315,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
head->vel.x = pr_freeze.Random2 () << (FRACBITS-7); head->vel.x = pr_freeze.Random2 () << (FRACBITS-7);
head->vel.y = pr_freeze.Random2 () << (FRACBITS-7); head->vel.y = pr_freeze.Random2 () << (FRACBITS-7);
head->health = self->health; head->health = self->health;
head->angle = self->angle; head->Angles.Yaw = self->Angles.Yaw;
if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn))) if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
{ {
head->player = self->player; head->player = self->player;
@ -323,7 +323,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
self->player = NULL; self->player = NULL;
head->ObtainInventory (self); head->ObtainInventory (self);
} }
head->pitch = 0; head->Angles.Pitch = 0;
head->RenderStyle = self->RenderStyle; head->RenderStyle = self->RenderStyle;
head->alpha = self->alpha; head->alpha = self->alpha;
if (head->player->camera == self) if (head->player->camera == self)
@ -638,32 +638,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_LowGravity)
void FaceMovementDirection (AActor *actor) void FaceMovementDirection (AActor *actor)
{ {
switch (actor->movedir) if (actor->movedir >= DI_EAST && actor->movedir <= DI_NORTHEAST)
{ {
case DI_EAST: actor->Angles.Yaw = 45. * actor->movedir;
actor->angle = 0<<24;
break;
case DI_NORTHEAST:
actor->angle = 32<<24;
break;
case DI_NORTH:
actor->angle = 64<<24;
break;
case DI_NORTHWEST:
actor->angle = 96<<24;
break;
case DI_WEST:
actor->angle = 128<<24;
break;
case DI_SOUTHWEST:
actor->angle = 160<<24;
break;
case DI_SOUTH:
actor->angle = 192<<24;
break;
case DI_SOUTHEAST:
actor->angle = 224<<24;
break;
} }
} }

View file

@ -1267,7 +1267,7 @@ void APowerSpeed::DoEffect ()
AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->Pos(), NO_REPLACE); AActor *speedMo = Spawn<APlayerSpeedTrail> (Owner->Pos(), NO_REPLACE);
if (speedMo) if (speedMo)
{ {
speedMo->angle = Owner->angle; speedMo->Angles.Yaw = Owner->Angles.Yaw;
speedMo->Translation = Owner->Translation; speedMo->Translation = Owner->Translation;
speedMo->target = Owner; speedMo->target = Owner;
speedMo->sprite = Owner->sprite; speedMo->sprite = Owner->sprite;

View file

@ -101,18 +101,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
} }
// Set default values // Set default values
// Every five tics, Hexen moved the ball 3/256th of a revolution. // Every five tics, Hexen moved the ball 3/256th of a revolution.
int rotationspeed = ANGLE_45/32*3/5; DAngle rotationspeed = 45./32*3/5;
int rotationradius = ORBIT_RADIUS * FRACUNIT; int rotationradius = ORBIT_RADIUS;
// If the bridge is custom, set non-default values if any. // 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° // 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; if (self->target->args[3] > 128) rotationspeed = 45./32 * (self->target->args[3]-256) / TICRATE;
else if (self->target->args[3] > 0) rotationspeed = ANGLE_45/32 * (self->target->args[3]) / TICRATE; else if (self->target->args[3] > 0) rotationspeed = 45./32 * (self->target->args[3]) / TICRATE;
// Set rotation radius // Set rotation radius
if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100); if (self->target->args[4]) rotationradius = ((self->target->args[4] * self->target->radius) / 100);
self->angle += rotationspeed; self->Angles.Yaw += rotationspeed;
self->SetOrigin(self->target->Vec3Angle(rotationradius, self->angle, 0), true); self->SetOrigin(self->target->Vec3Angle(rotationradius, self->_f_angle(), 0), true);
self->floorz = self->target->floorz; self->floorz = self->target->floorz;
self->ceilingz = self->target->ceilingz; self->ceilingz = self->target->ceilingz;
return 0; return 0;
@ -124,7 +124,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT(balltype, AActor) { balltype = NULL; } PARAM_CLASS_OPT(balltype, AActor) { balltype = NULL; }
angle_t startangle;
AActor *ball; AActor *ball;
if (balltype == NULL) if (balltype == NULL)
@ -132,7 +131,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
balltype = PClass::FindActor("BridgeBall"); 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. // Spawn triad into world -- may be more than a triad now.
int ballcount = self->args[2]==0 ? 3 : self->args[2]; 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++) for (int i = 0; i < ballcount; i++)
{ {
ball = Spawn(balltype, self->Pos(), ALLOW_REPLACE); 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; ball->target = self;
CALL_ACTION(A_BridgeOrbit, ball); CALL_ACTION(A_BridgeOrbit, ball);
} }

View file

@ -57,10 +57,10 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
protected: protected:
angle_t Center; DAngle Center;
angle_t Acc; DAngle Acc;
angle_t Delta; DAngle Delta;
angle_t Range; DAngle Range;
}; };
IMPLEMENT_CLASS (ASecurityCamera) IMPLEMENT_CLASS (ASecurityCamera)
@ -74,29 +74,25 @@ void ASecurityCamera::Serialize (FArchive &arc)
void ASecurityCamera::PostBeginPlay () void ASecurityCamera::PostBeginPlay ()
{ {
Super::PostBeginPlay (); Super::PostBeginPlay ();
Center = angle; Center = Angles.Yaw;
if (args[2]) if (args[2])
Delta = ANGLE_MAX / (args[2] * TICRATE / 8); Delta = 360. / (args[2] * TICRATE / 8);
else else
Delta = 0; Delta = 0;
if (args[1]) if (args[1])
Delta /= 2; Delta /= 2;
Acc = 0; Acc = 0;
pitch = (signed int)((char)args[0]) * ANGLE_1; Angles.Pitch = clamp<int>((signed int)((signed char)args[0]), -89, 89);
if (pitch <= -ANGLE_90) Range = args[1];
pitch = -ANGLE_90 + ANGLE_1;
else if (pitch >= ANGLE_90)
pitch = ANGLE_90 - ANGLE_1;
Range = FLOAT2ANGLE(args[1]);
} }
void ASecurityCamera::Tick () void ASecurityCamera::Tick ()
{ {
Acc += Delta; Acc += Delta;
if (Range) if (Range != 0)
angle = Center + FixedMul (Range, finesine[Acc >> ANGLETOFINESHIFT]); Angles.Yaw = Center + Range * Acc.Sin();
else if (Delta) else if (Delta != 0)
angle = Acc; Angles.Yaw = Acc;
} }
/* /*
@ -120,7 +116,7 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
protected: protected:
int MaxPitchChange; DAngle MaxPitchChange;
}; };
IMPLEMENT_CLASS (AAimingCamera) IMPLEMENT_CLASS (AAimingCamera)
@ -137,7 +133,7 @@ void AAimingCamera::PostBeginPlay ()
args[2] = 0; args[2] = 0;
Super::PostBeginPlay (); Super::PostBeginPlay ();
MaxPitchChange = FLOAT2ANGLE(changepitch * TICRATE); MaxPitchChange = changepitch / TICRATE;
Range /= TICRATE; Range /= TICRATE;
TActorIterator<AActor> iterator (args[3]); TActorIterator<AActor> iterator (args[3]);
@ -161,7 +157,7 @@ void AAimingCamera::Tick ()
} }
if (tracer != NULL) if (tracer != NULL)
{ {
angle_t delta; DAngle delta;
int dir = P_FaceMobj (this, tracer, &delta); int dir = P_FaceMobj (this, tracer, &delta);
if (delta > Range) if (delta > Range)
{ {
@ -169,31 +165,32 @@ void AAimingCamera::Tick ()
} }
if (dir) if (dir)
{ {
angle += delta; Angles.Yaw += delta;
} }
else else
{ {
angle -= delta; Angles.Yaw -= delta;
} }
if (MaxPitchChange) if (MaxPitchChange != 0)
{ // Aim camera's pitch; use floats for precision { // Aim camera's pitch; use floats for precision
fixedvec2 fv3 = tracer->Vec2To(this); fixedvec2 fv3 = tracer->Vec2To(this);
DVector2 vect(fv3.x, fv3.y); DVector2 vect(fv3.x, fv3.y);
double dz = Z() - tracer->Z() - tracer->height/2; double dz = Z() - tracer->Z() - tracer->height/2;
double dist = vect.Length(); double dist = vect.Length();
double ang = dist != 0.f ? g_atan2 (dz, dist) : 0; double ang = dist != 0.f ? g_atan2 (dz, dist) : 0;
int desiredpitch = (int)RAD2ANGLE(ang); DAngle desiredPitch = ToDegrees(ang);
if (abs (desiredpitch - pitch) < MaxPitchChange) 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 else
{ {
pitch += MaxPitchChange; Angles.Pitch += MaxPitchChange;
} }
} }
} }

View file

@ -827,7 +827,7 @@ void ADecal::BeginPlay ()
// Look for a wall within 64 units behind the actor. If none can be // Look for a wall within 64 units behind the actor. If none can be
// found, then no decal is created, and this actor is destroyed // found, then no decal is created, and this actor is destroyed
// without effectively doing anything. // without effectively doing anything.
if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), Z(), angle + ANGLE_180, 64*FRACUNIT, true)) if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), 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 (%d,%d)\n", X()>>FRACBITS, Y()>>FRACBITS);
} }

View file

@ -176,7 +176,7 @@ void AFastProjectile::Effect()
AActor *act = Spawn (trail, X(), Y(), hitz, ALLOW_REPLACE); AActor *act = Spawn (trail, X(), Y(), hitz, ALLOW_REPLACE);
if (act != NULL) if (act != NULL)
{ {
act->angle = this->angle; act->Angles.Yaw = Angles.Yaw;
} }
} }
} }

View file

@ -43,7 +43,6 @@ class AHateTarget : public AActor
DECLARE_CLASS (AHateTarget, AActor) DECLARE_CLASS (AHateTarget, AActor)
public: public:
void BeginPlay (); void BeginPlay ();
int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype);
}; };
IMPLEMENT_CLASS (AHateTarget) IMPLEMENT_CLASS (AHateTarget)
@ -51,28 +50,14 @@ IMPLEMENT_CLASS (AHateTarget)
void AHateTarget::BeginPlay () void AHateTarget::BeginPlay ()
{ {
Super::BeginPlay (); Super::BeginPlay ();
if (angle != 0) if (SpawnAngle != 0)
{ // Each degree translates into 10 units of health { // Each degree translates into 10 units of health
health = Scale (angle >> 1, 1800, 0x40000000); health = SpawnAngle * 10;
// Round to the nearest 10 because of inaccuracy above
health = (health + 5) / 10 * 10;
} }
else else
{ {
special2 = 1; flags5 |= MF5_NODAMAGE;
health = 1000001; health = 1000001;
} }
} }
int AHateTarget::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype)
{
if (special2 != 0)
{
return 0;
}
else
{
return damage;
}
}

View file

@ -88,7 +88,7 @@ bool P_MorphPlayer (player_t *activator, player_t *p, PClassPlayerPawn *spawntyp
actor->RemoveFromHash (); actor->RemoveFromHash ();
actor->tid = 0; actor->tid = 0;
} }
morphed->angle = actor->angle; morphed->Angles.Yaw = actor->Angles.Yaw;
morphed->target = actor->target; morphed->target = actor->target;
morphed->tracer = actor; morphed->tracer = actor;
morphed->Score = actor->Score; morphed->Score = actor->Score;
@ -223,7 +223,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
mo->tid = pmo->tid; mo->tid = pmo->tid;
mo->AddToHash (); mo->AddToHash ();
} }
mo->angle = pmo->angle; mo->Angles.Yaw = pmo->Angles.Yaw;
mo->player = player; mo->player = player;
mo->reactiontime = 18; mo->reactiontime = 18;
mo->flags = ActorFlags::FromInt (pmo->special2) & ~MF_JUSTHIT; mo->flags = ActorFlags::FromInt (pmo->special2) & ~MF_JUSTHIT;
@ -307,7 +307,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
} }
} }
angle = mo->angle >> ANGLETOFINESHIFT; angle = mo->_f_angle() >> ANGLETOFINESHIFT;
AActor *eflash = NULL; AActor *eflash = NULL;
if (exit_flash != NULL) if (exit_flash != NULL)
{ {
@ -385,7 +385,7 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st
morphed = static_cast<AMorphedMonster *>(Spawn (spawntype, actor->Pos(), NO_REPLACE)); morphed = static_cast<AMorphedMonster *>(Spawn (spawntype, actor->Pos(), NO_REPLACE));
DObject::StaticPointerSubstitution (actor, morphed); DObject::StaticPointerSubstitution (actor, morphed);
morphed->tid = actor->tid; morphed->tid = actor->tid;
morphed->angle = actor->angle; morphed->Angles.Yaw = actor->Angles.Yaw;
morphed->UnmorphedMe = actor; morphed->UnmorphedMe = actor;
morphed->alpha = actor->alpha; morphed->alpha = actor->alpha;
morphed->RenderStyle = actor->RenderStyle; morphed->RenderStyle = actor->RenderStyle;
@ -450,7 +450,7 @@ bool P_UndoMonsterMorph (AMorphedMonster *beast, bool force)
beast->UnmorphTime = level.time + 5*TICRATE; // Next try in 5 seconds beast->UnmorphTime = level.time + 5*TICRATE; // Next try in 5 seconds
return false; return false;
} }
actor->angle = beast->angle; actor->Angles.Yaw = beast->Angles.Yaw;
actor->target = beast->target; actor->target = beast->target;
actor->FriendPlayer = beast->FriendPlayer; actor->FriendPlayer = beast->FriendPlayer;
actor->flags = beast->FlagsSave & ~MF_JUSTHIT; actor->flags = beast->FlagsSave & ~MF_JUSTHIT;

View file

@ -102,11 +102,7 @@ void AInterpolationPoint::FormChain ()
if (Next == NULL && (args[3] | args[4])) if (Next == NULL && (args[3] | args[4]))
Printf ("Can't find target for camera node %d\n", tid); Printf ("Can't find target for camera node %d\n", tid);
pitch = (signed int)((char)args[0]) * ANGLE_1; Angles.Pitch = clamp<int>((signed char)args[0], -89, 89);
if (pitch <= -ANGLE_90)
pitch = -ANGLE_90 + ANGLE_1;
else if (pitch >= ANGLE_90)
pitch = ANGLE_90 - ANGLE_1;
if (Next != NULL) if (Next != NULL)
Next->FormChain (); Next->FormChain ();
@ -426,7 +422,7 @@ bool APathFollower::Interpolate ()
} }
if (args[2] & 2) if (args[2] & 2)
{ // adjust yaw { // adjust yaw
angle = R_PointToAngle2 (0, 0, dx, dy); Angles.Yaw = vectoyaw(DVector2(dx, dy));
} }
if (args[2] & 4) if (args[2] & 4)
{ // adjust pitch; use floats for precision { // adjust pitch; use floats for precision
@ -435,57 +431,30 @@ bool APathFollower::Interpolate ()
double fdz = FIXED2DBL(-dz); double fdz = FIXED2DBL(-dz);
double dist = g_sqrt (fdx*fdx + fdy*fdy); double dist = g_sqrt (fdx*fdx + fdy*fdy);
double ang = dist != 0.f ? g_atan2 (fdz, dist) : 0; double ang = dist != 0.f ? g_atan2 (fdz, dist) : 0;
pitch = (fixed_t)RAD2ANGLE(ang); Angles.Pitch = ToDegrees(ang);
} }
} }
else else
{ {
if (args[2] & 2) if (args[2] & 2)
{ // interpolate angle { // interpolate angle
double angle1 = (double)CurrNode->angle; DAngle angle1 = CurrNode->Angles.Yaw.Normalized180();
double angle2 = (double)CurrNode->Next->angle; DAngle angle2 = angle1 + deltaangle(angle1, CurrNode->Next->Angles.Yaw);
if (angle2 - angle1 <= -2147483648.f) Angles.Yaw = Lerp(angle1.Degrees, angle2.Degrees);
{
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));
}
} }
if (args[2] & 1) if (args[2] & 1)
{ // linear { // linear
if (args[2] & 4) if (args[2] & 4)
{ // interpolate pitch { // 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 else
{ // spline { // spline
if (args[2] & 4) if (args[2] & 4)
{ // interpolate pitch { // interpolate pitch
pitch = FLOAT2FIXED(Splerp (FIXED2DBL(PrevNode->pitch), FIXED2DBL(CurrNode->pitch), Angles.Pitch = Splerp(PrevNode->Angles.Pitch.Degrees, CurrNode->Angles.Pitch.Degrees,
FIXED2DBL(CurrNode->Next->pitch), FIXED2DBL(CurrNode->Next->Next->pitch))); CurrNode->Next->Angles.Pitch.Degrees, CurrNode->Next->Next->Angles.Pitch.Degrees);
} }
} }
} }
@ -558,9 +527,9 @@ bool AActorMover::Interpolate ()
} }
if (args[2] & 2) if (args[2] & 2)
tracer->angle = angle; tracer->Angles.Yaw = Angles.Yaw;
if (args[2] & 4) if (args[2] & 4)
tracer->pitch = pitch; tracer->Angles.Pitch = Angles.Pitch;
return true; return true;
} }
@ -665,7 +634,7 @@ bool AMovingCamera::Interpolate ()
if (Super::Interpolate ()) if (Super::Interpolate ())
{ {
angle = AngleTo(tracer, true); Angles.Yaw = _f_AngleTo(tracer, true);
if (args[2] & 4) if (args[2] & 4)
{ // Also aim camera's pitch; use floats for precision { // Also aim camera's pitch; use floats for precision
@ -674,7 +643,7 @@ bool AMovingCamera::Interpolate ()
double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2); double dz = FIXED2DBL(Z() - tracer->Z() - tracer->height/2);
double dist = g_sqrt (dx*dx + dy*dy); double dist = g_sqrt (dx*dx + dy*dy);
double ang = dist != 0.f ? g_atan2 (dz, dist) : 0; double ang = dist != 0.f ? g_atan2 (dz, dist) : 0;
pitch = RAD2ANGLE(ang); Angles.Pitch = ToDegrees(ang);
} }
return true; return true;

View file

@ -140,7 +140,7 @@ void DEarthquake::Tick ()
P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), NAME_None); P_DamageMobj (victim, NULL, NULL, pr_quake.HitDice (1), NAME_None);
} }
// Thrust player around // Thrust player around
angle_t an = victim->angle + ANGLE_1*pr_quake(); angle_t an = victim->_f_angle() + ANGLE_1*pr_quake();
if (m_IntensityX == m_IntensityY) if (m_IntensityX == m_IntensityY)
{ // Thrust in a circle { // Thrust in a circle
P_ThrustMobj (victim, an, m_IntensityX << (FRACBITS-1)); P_ThrustMobj (victim, an, m_IntensityX << (FRACBITS-1));

View file

@ -160,7 +160,8 @@ class ARandomSpawner : public AActor
if (newmobj != NULL) if (newmobj != NULL)
{ {
// copy everything relevant // copy everything relevant
newmobj->SpawnAngle = newmobj->angle = angle; newmobj->SpawnAngle = SpawnAngle;
newmobj->Angles = Angles;
newmobj->SpawnPoint[2] = SpawnPoint[2]; newmobj->SpawnPoint[2] = SpawnPoint[2];
newmobj->special = special; newmobj->special = special;
newmobj->args[0] = args[0]; newmobj->args[0] = args[0];

View file

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

View file

@ -367,16 +367,16 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
{ {
// The next 12 lines are from the Doom statusbar code. // The next 12 lines are from the Doom statusbar code.
badguyangle = player->mo->AngleTo(player->attacker); badguyangle = player->mo->AngleTo(player->attacker);
if (badguyangle > player->mo->angle) if (badguyangle > player->mo->_f_angle())
{ {
// whether right or left // whether right or left
diffang = badguyangle - player->mo->angle; diffang = badguyangle - player->mo->_f_angle();
i = diffang > ANG180; i = diffang > ANG180;
} }
else else
{ {
// whether left or right // whether left or right
diffang = player->mo->angle - badguyangle; diffang = player->mo->_f_angle() - badguyangle;
i = diffang <= ANG180; i = diffang <= ANG180;
} // confusing, aint it? } // confusing, aint it?
if (i && diffang >= ANG45) if (i && diffang >= ANG45)

View file

@ -74,13 +74,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack)
foo->FriendPlayer = 0; foo->FriendPlayer = 0;
foo->tracer = self->target; foo->tracer = self->target;
self->angle -= ANGLE_180 / 20 * 10; self->Angles.Yaw -= 90.;
for (int i = 0; i < 20; ++i) for (int i = 0; i < 20; ++i)
{ {
self->angle += ANGLE_180 / 20; self->Angles.Yaw += 9.;
P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall2"), self); P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall2"), self);
} }
self->angle -= ANGLE_180 / 20 * 10; self->Angles.Yaw -= 90.;
return 0; return 0;
} }

View file

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

View file

@ -81,7 +81,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity)
AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70*FRACUNIT), ALLOW_REPLACE); AActor *entity = Spawn("EntityBoss", self->PosPlusZ(70*FRACUNIT), ALLOW_REPLACE);
if (entity != NULL) if (entity != NULL)
{ {
entity->angle = self->angle; entity->Angles.Yaw = self->Angles.Yaw;
entity->CopyFriendliness(self, true); entity->CopyFriendliness(self, true);
entity->vel.z = 5*FRACUNIT; entity->vel.z = 5*FRACUNIT;
entity->tracer = self; entity->tracer = self;
@ -100,19 +100,19 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath)
AActor *spot = self->tracer; AActor *spot = self->tracer;
if (spot == NULL) spot = self; if (spot == NULL) spot = self;
fixedvec3 pos = spot->Vec3Angle(secondRadius, self->angle, self->tracer? 70*FRACUNIT : 0); fixedvec3 pos = spot->Vec3Angle(secondRadius, self->_f_angle(), self->tracer? 70*FRACUNIT : 0);
an = self->angle >> ANGLETOFINESHIFT; an = self->_f_angle() >> ANGLETOFINESHIFT;
second = Spawn("EntitySecond", pos, ALLOW_REPLACE); second = Spawn("EntitySecond", pos, ALLOW_REPLACE);
second->CopyFriendliness(self, true); second->CopyFriendliness(self, true);
//second->target = self->target; //second->target = self->target;
A_FaceTarget (second); A_FaceTarget (second);
an = second->angle >> ANGLETOFINESHIFT; an = second->_f_angle() >> ANGLETOFINESHIFT;
second->vel.x += FixedMul (finecosine[an], 320000); second->vel.x += FixedMul (finecosine[an], 320000);
second->vel.y += FixedMul (finesine[an], 320000); second->vel.y += FixedMul (finesine[an], 320000);
pos = spot->Vec3Angle(secondRadius, self->angle + ANGLE_90, self->tracer? 70*FRACUNIT : 0); pos = spot->Vec3Angle(secondRadius, self->_f_angle() + ANGLE_90, self->tracer? 70*FRACUNIT : 0);
an = (self->angle + ANGLE_90) >> ANGLETOFINESHIFT; an = (self->_f_angle() + ANGLE_90) >> ANGLETOFINESHIFT;
second = Spawn("EntitySecond", pos, ALLOW_REPLACE); second = Spawn("EntitySecond", pos, ALLOW_REPLACE);
second->CopyFriendliness(self, true); second->CopyFriendliness(self, true);
//second->target = self->target; //second->target = self->target;
@ -120,8 +120,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath)
second->vel.y = FixedMul (secondRadius, finesine[an]) << 2; second->vel.y = FixedMul (secondRadius, finesine[an]) << 2;
A_FaceTarget (second); A_FaceTarget (second);
pos = spot->Vec3Angle(secondRadius, self->angle - ANGLE_90, self->tracer? 70*FRACUNIT : 0); pos = spot->Vec3Angle(secondRadius, self->_f_angle() - ANGLE_90, self->tracer? 70*FRACUNIT : 0);
an = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT; an = (self->_f_angle() - ANGLE_90) >> ANGLETOFINESHIFT;
second = Spawn("EntitySecond", pos, ALLOW_REPLACE); second = Spawn("EntitySecond", pos, ALLOW_REPLACE);
second->CopyFriendliness(self, true); second->CopyFriendliness(self, true);
//second->target = self->target; //second->target = self->target;

View file

@ -62,13 +62,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
A_FaceTarget (self); A_FaceTarget (self);
self->AddZ(32*FRACUNIT); self->AddZ(32*FRACUNIT);
self->angle -= ANGLE_45/32; self->Angles.Yaw -= 45./32;
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot")); proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot"));
if (proj != NULL) if (proj != NULL)
{ {
proj->vel.z += 9*FRACUNIT; proj->vel.z += 9*FRACUNIT;
} }
self->angle += ANGLE_45/16; self->Angles.Yaw += 45./16;
proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot")); proj = P_SpawnMissileZAimed (self, self->Z(), self->target, PClass::FindActor("InquisitorShot"));
if (proj != NULL) if (proj != NULL)
{ {
@ -92,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM); S_Sound (self, CHAN_ITEM|CHAN_LOOP, "inquisitor/jump", 1, ATTN_NORM);
self->AddZ(64*FRACUNIT); self->AddZ(64*FRACUNIT);
A_FaceTarget (self); A_FaceTarget (self);
an = self->angle >> ANGLETOFINESHIFT; an = self->_f_angle() >> ANGLETOFINESHIFT;
speed = self->Speed * 2/3; speed = self->Speed * 2/3;
self->vel.x += FixedMul (speed, finecosine[an]); self->vel.x += FixedMul (speed, finecosine[an]);
self->vel.y += FixedMul (speed, finesine[an]); self->vel.y += FixedMul (speed, finesine[an]);
@ -136,9 +136,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); AActor *foo = Spawn("InquisitorArm", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
foo->angle = self->angle - ANGLE_90 + (pr_inq.Random2() << 22); foo->Angles.Yaw = self->Angles.Yaw - 90. + pr_inq.Random2() * (360./1024.);
foo->vel.x = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]) >> 3; foo->VelFromAngle(foo->Speed / 8);
foo->vel.y = FixedMul (foo->Speed, finesine[foo->angle >> ANGLETOFINESHIFT]) >> 3;
foo->vel.z = pr_inq() << 10; foo->vel.z = pr_inq() << 10;
return 0; return 0;
} }

View file

@ -133,9 +133,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase)
AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); AActor *foo = Spawn("ProgrammerBase", self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
if (foo != NULL) if (foo != NULL)
{ {
foo->angle = self->angle + ANGLE_180 + (pr_prog.Random2() << 22); foo->Angles.Yaw = self->Angles.Yaw + 180. + pr_prog.Random2() * (360. / 1024.);
foo->vel.x = FixedMul (foo->Speed, finecosine[foo->angle >> ANGLETOFINESHIFT]); foo->VelFromAngle();
foo->vel.y = FixedMul (foo->Speed, finesine[foo->angle >> ANGLETOFINESHIFT]);
foo->vel.z = pr_prog() << 9; foo->vel.z = pr_prog() << 9;
} }
return 0; return 0;

View file

@ -22,7 +22,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ReaverRanged)
A_FaceTarget (self); A_FaceTarget (self);
S_Sound (self, CHAN_WEAPON, "reaver/attack", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "reaver/attack", 1, ATTN_NORM);
bangle = self->angle; bangle = self->_f_angle();
pitch = P_AimLineAttack (self, bangle, MISSILERANGE); pitch = P_AimLineAttack (self, bangle, MISSILERANGE);
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)

View file

@ -31,8 +31,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShootGun)
S_Sound (self, CHAN_WEAPON, "monsters/rifle", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "monsters/rifle", 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
pitch = P_AimLineAttack (self, self->angle, MISSILERANGE); pitch = P_AimLineAttack (self, self->_f_angle(), MISSILERANGE);
P_LineAttack (self, self->angle + (pr_shootgun.Random2() << 19), P_LineAttack (self, self->_f_angle() + (pr_shootgun.Random2() << 19),
MISSILERANGE, pitch, MISSILERANGE, pitch,
3*(pr_shootgun() % 5 + 1), NAME_Hitscan, NAME_StrifePuff); 3*(pr_shootgun() % 5 + 1), NAME_Hitscan, NAME_StrifePuff);
return 0; return 0;
@ -115,8 +115,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
} }
rebel->SetState (rebel->SeeState); rebel->SetState (rebel->SeeState);
rebel->angle = self->angle; rebel->Angles.Yaw = self->Angles.Yaw;
an = self->angle >> ANGLETOFINESHIFT; an = self->_f_angle() >> ANGLETOFINESHIFT;
Spawn<ATeleportFog> (rebel->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE); Spawn<ATeleportFog> (rebel->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE);
if (--self->health < 0) if (--self->health < 0)
{ {

View file

@ -60,7 +60,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
for (int i = 8; i > 1; --i) for (int i = 8; i > 1; --i)
{ {
trail = Spawn("SentinelFX1", trail = Spawn("SentinelFX1",
self->Vec3Angle(missile->radius*i, missile->angle, (missile->vel.z / 4 * i)), ALLOW_REPLACE); self->Vec3Angle(missile->radius*i, missile->_f_angle(), (missile->vel.z / 4 * i)), ALLOW_REPLACE);
if (trail != NULL) if (trail != NULL)
{ {
trail->target = self; trail->target = self;

View file

@ -30,7 +30,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail)
AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE); AActor *foo = Spawn("SpectralLightningHTail", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE);
foo->angle = self->angle; foo->Angles.Yaw = self->Angles.Yaw;
foo->FriendPlayer = self->FriendPlayer; foo->FriendPlayer = self->FriendPlayer;
return 0; return 0;
} }
@ -42,11 +42,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralBigBallLightning)
PClassActor *cls = PClass::FindActor("SpectralLightningH3"); PClassActor *cls = PClass::FindActor("SpectralLightningH3");
if (cls) if (cls)
{ {
self->angle += ANGLE_90; self->Angles.Yaw += 90.;
P_SpawnSubMissile (self, cls, self->target); P_SpawnSubMissile (self, cls, self->target);
self->angle += ANGLE_180; self->Angles.Yaw += 180.;
P_SpawnSubMissile (self, cls, self->target); P_SpawnSubMissile (self, cls, self->target);
self->angle += ANGLE_90; self->Angles.Yaw -= 270.;
P_SpawnSubMissile (self, cls, self->target); P_SpawnSubMissile (self, cls, self->target);
} }
return 0; return 0;
@ -87,14 +87,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
// In Strife, this number is stored in the data segment, but it doesn't seem to be // In Strife, this number is stored in the data segment, but it doesn't seem to be
// altered anywhere. // altered anywhere.
#define TRACEANGLE (0xe000000) #define TRACEANGLE (19.6875)
DEFINE_ACTION_FUNCTION(AActor, A_Tracer2) DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
{ {
PARAM_ACTION_PROLOGUE; PARAM_ACTION_PROLOGUE;
AActor *dest; AActor *dest;
angle_t exact;
fixed_t dist; fixed_t dist;
fixed_t slope; fixed_t slope;
@ -103,28 +102,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
if (!dest || dest->health <= 0 || self->Speed == 0 || !self->CanSeek(dest)) if (!dest || dest->health <= 0 || self->Speed == 0 || !self->CanSeek(dest))
return 0; return 0;
// change angle DAngle exact = self->_f_AngleTo(dest);
exact = self->AngleTo(dest); DAngle diff = deltaangle(self->Angles.Yaw, exact);
if (exact != self->angle) if (diff < 0)
{ {
if (exact - self->angle > 0x80000000) self->Angles.Yaw -= TRACEANGLE;
{ if (deltaangle(self->Angles.Yaw, exact) > 0)
self->angle -= TRACEANGLE; self->Angles.Yaw = exact;
if (exact - self->angle < 0x80000000) }
self->angle = exact; else if (diff > 0)
} {
else self->Angles.Yaw += TRACEANGLE;
{ if (deltaangle(self->Angles.Yaw, exact) < 0.)
self->angle += TRACEANGLE; self->Angles.Yaw = exact;
if (exact - self->angle > 0x80000000)
self->angle = exact;
}
} }
exact = self->angle >> ANGLETOFINESHIFT; self->VelFromAngle();
self->vel.x = FixedMul (self->Speed, finecosine[exact]);
self->vel.y = FixedMul (self->Speed, finesine[exact]);
if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) if (!(self->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{ {

View file

@ -600,7 +600,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossGib)
const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat"; const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat";
AActor *gib = Spawn (gibtype, self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE); AActor *gib = Spawn (gibtype, self->PosPlusZ(24*FRACUNIT), ALLOW_REPLACE);
angle_t an;
int speed; int speed;
if (gib == NULL) if (gib == NULL)
@ -608,11 +607,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_TossGib)
return 0; return 0;
} }
an = pr_gibtosser() << 24; gib->Angles.Yaw = pr_gibtosser() * (360 / 256.f);
gib->angle = an;
speed = pr_gibtosser() & 15; speed = pr_gibtosser() & 15;
gib->vel.x = speed * finecosine[an >> ANGLETOFINESHIFT]; gib->VelFromAngle(speed);
gib->vel.y = speed * finesine[an >> ANGLETOFINESHIFT];
gib->vel.z = (pr_gibtosser() & 15) << FRACBITS; gib->vel.z = (pr_gibtosser() & 15) << FRACBITS;
return 0; return 0;
} }

View file

@ -110,7 +110,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_JabDagger)
damage *= 10; damage *= 10;
} }
angle = self->angle + (pr_jabdagger.Random2() << 18); angle = self->_f_angle() + (pr_jabdagger.Random2() << 18);
pitch = P_AimLineAttack (self, angle, 80*FRACUNIT); pitch = P_AimLineAttack (self, angle, 80*FRACUNIT);
P_LineAttack (self, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, "StrifeSpark", true, &t); P_LineAttack (self, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, "StrifeSpark", true, &t);
@ -120,7 +120,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_JabDagger)
S_Sound (self, CHAN_WEAPON, S_Sound (self, CHAN_WEAPON,
t.linetarget->flags & MF_NOBLOOD ? "misc/metalhit" : "misc/meathit", t.linetarget->flags & MF_NOBLOOD ? "misc/metalhit" : "misc/meathit",
1, ATTN_NORM); 1, ATTN_NORM);
self->angle = t.angleFromSource; self->Angles.Yaw = t.angleFromSource;
self->flags |= MF_JUSTATTACKED; self->flags |= MF_JUSTATTACKED;
P_DaggerAlert (self, t.linetarget); P_DaggerAlert (self, t.linetarget);
} }
@ -265,11 +265,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireArrow)
if (ti) if (ti)
{ {
savedangle = self->angle; savedangle = self->_f_angle();
self->angle += pr_electric.Random2 () << (18 - self->player->mo->accuracy * 5 / 100); self->Angles.Yaw += ANGLE2DBL(pr_electric.Random2() * (1 << (18 - self->player->mo->accuracy * 5 / 100)));
self->player->mo->PlayAttacking2 (); self->player->mo->PlayAttacking2 ();
P_SpawnPlayerMissile (self, ti); P_SpawnPlayerMissile (self, ti);
self->angle = savedangle; self->Angles.Yaw = savedangle;
S_Sound (self, CHAN_WEAPON, "weapons/xbowshoot", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "weapons/xbowshoot", 1, ATTN_NORM);
} }
return 0; return 0;
@ -289,7 +289,7 @@ void P_StrifeGunShot (AActor *mo, bool accurate, angle_t pitch)
int damage; int damage;
damage = 4*(pr_sgunshot()%3+1); damage = 4*(pr_sgunshot()%3+1);
angle = mo->angle; angle = mo->_f_angle();
if (mo->player != NULL && !accurate) if (mo->player != NULL && !accurate)
{ {
@ -358,11 +358,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMiniMissile)
return 0; return 0;
} }
savedangle = self->angle; savedangle = self->_f_angle();
self->angle += pr_minimissile.Random2() << (19 - player->mo->accuracy * 5 / 100); self->Angles.Yaw += ANGLE2DBL(pr_minimissile.Random2() << (19 - player->mo->accuracy * 5 / 100));
player->mo->PlayAttacking2 (); player->mo->PlayAttacking2 ();
P_SpawnPlayerMissile (self, PClass::FindActor("MiniMissile")); P_SpawnPlayerMissile (self, PClass::FindActor("MiniMissile"));
self->angle = savedangle; self->Angles.Yaw = savedangle;
return 0; return 0;
} }
@ -379,7 +379,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight)
AActor *trail; AActor *trail;
S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM); S_Sound (self, CHAN_VOICE, "misc/missileinflight", 1, ATTN_NORM);
P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->Pos(), self->angle - ANGLE_180, 2, PF_HITTHING); P_SpawnPuff (self, PClass::FindActor("MiniMissilePuff"), self->Pos(), self->_f_angle() - ANGLE_180, 2, PF_HITTHING);
trail = Spawn("RocketTrail", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE); trail = Spawn("RocketTrail", self->Vec3Offset(-self->vel.x, -self->vel.y, 0), ALLOW_REPLACE);
if (trail != NULL) if (trail != NULL)
{ {
@ -428,7 +428,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireFlamer)
player->mo->PlayAttacking2 (); player->mo->PlayAttacking2 ();
} }
self->angle += pr_flamethrower.Random2() << 18; self->Angles.Yaw += pr_flamethrower.Random2() * (5.625/256.);
self = P_SpawnPlayerMissile (self, PClass::FindActor("FlameMissile")); self = P_SpawnPlayerMissile (self, PClass::FindActor("FlameMissile"));
if (self != NULL) if (self != NULL)
{ {
@ -472,7 +472,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMauler1)
for (int i = 0; i < 20; ++i) for (int i = 0; i < 20; ++i)
{ {
int damage = 5 * (pr_mauler1() % 3 + 1); int damage = 5 * (pr_mauler1() % 3 + 1);
angle_t angle = self->angle + (pr_mauler1.Random2() << 19); angle_t angle = self->_f_angle() + (pr_mauler1.Random2() << 19);
int pitch = bpitch + (pr_mauler1.Random2() * 332063); int pitch = bpitch + (pr_mauler1.Random2() * 332063);
// Strife used a range of 2112 units for the mauler to signal that // Strife used a range of 2112 units for the mauler to signal that
@ -530,7 +530,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2)
} }
P_SpawnPlayerMissile (self, PClass::FindActor("MaulerTorpedo")); P_SpawnPlayerMissile (self, PClass::FindActor("MaulerTorpedo"));
P_DamageMobj (self, self, NULL, 20, self->DamageType); P_DamageMobj (self, self, NULL, 20, self->DamageType);
P_ThrustMobj (self, self->angle + ANGLE_180, 0x7D000); P_ThrustMobj (self, self->_f_angle() + ANGLE_180, 0x7D000);
return 0; return 0;
} }
@ -548,7 +548,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
AActor *wavedef = GetDefaultByName("MaulerTorpedoWave"); AActor *wavedef = GetDefaultByName("MaulerTorpedoWave");
fixed_t savedz; fixed_t savedz;
self->angle += ANGLE_180; self->Angles.Yaw += 180.;
// If the torpedo hit the ceiling, it should still spawn the wave // If the torpedo hit the ceiling, it should still spawn the wave
savedz = self->Z(); savedz = self->Z();
@ -559,7 +559,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
for (int i = 0; i < 80; ++i) for (int i = 0; i < 80; ++i)
{ {
self->angle += ANGLE_45/10; self->Angles.Yaw += 4.5;
P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target); P_SpawnSubMissile (self, PClass::FindActor("MaulerTorpedoWave"), self->target);
} }
self->SetZ(savedz); self->SetZ(savedz);
@ -576,10 +576,8 @@ AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
} }
other->target = target; other->target = target;
other->angle = source->angle; other->Angles.Yaw = source->Angles.Yaw;
other->VelFromAngle();
other->vel.x = FixedMul (other->Speed, finecosine[source->angle >> ANGLETOFINESHIFT]);
other->vel.y = FixedMul (other->Speed, finesine[source->angle >> ANGLETOFINESHIFT]);
if (other->flags4 & MF4_SPECTRAL) if (other->flags4 & MF4_SPECTRAL)
{ {
@ -595,7 +593,7 @@ AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target)
if (P_CheckMissileSpawn (other, source->radius)) if (P_CheckMissileSpawn (other, source->radius))
{ {
angle_t pitch = P_AimLineAttack (source, source->angle, 1024*FRACUNIT); angle_t pitch = P_AimLineAttack (source, source->_f_angle(), 1024*FRACUNIT);
other->vel.z = FixedMul (-finesine[pitch>>ANGLETOFINESHIFT], other->Speed); other->vel.z = FixedMul (-finesine[pitch>>ANGLETOFINESHIFT], other->Speed);
return other; return other;
} }
@ -728,16 +726,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
S_Sound (grenade, CHAN_VOICE, grenade->SeeSound, 1, ATTN_NORM); S_Sound (grenade, CHAN_VOICE, grenade->SeeSound, 1, ATTN_NORM);
} }
grenade->vel.z = FixedMul (finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], grenade->Speed) + 8*FRACUNIT; grenade->vel.z = FixedMul (finetangent[FINEANGLES/4-(self->_f_pitch()>>ANGLETOFINESHIFT)], grenade->Speed) + 8*FRACUNIT;
fixedvec2 offset; fixedvec2 offset;
an = self->angle >> ANGLETOFINESHIFT; an = self->_f_angle() >> ANGLETOFINESHIFT;
tworadii = self->radius + grenade->radius; tworadii = self->radius + grenade->radius;
offset.x = FixedMul (finecosine[an], tworadii); offset.x = FixedMul (finecosine[an], tworadii);
offset.y = FixedMul (finesine[an], tworadii); offset.y = FixedMul (finesine[an], tworadii);
an = self->angle + angleofs; an = self->_f_angle() + angleofs;
an >>= ANGLETOFINESHIFT; an >>= ANGLETOFINESHIFT;
offset.x += FixedMul (finecosine[an], 15*FRACUNIT); offset.x += FixedMul (finecosine[an], 15*FRACUNIT);
offset.y += FixedMul (finesine[an], 15*FRACUNIT); offset.y += FixedMul (finesine[an], 15*FRACUNIT);
@ -1000,8 +998,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
spot = Spawn("SpectralLightningSpot", self->Pos(), ALLOW_REPLACE); spot = Spawn("SpectralLightningSpot", self->Pos(), ALLOW_REPLACE);
if (spot != NULL) if (spot != NULL)
{ {
spot->vel.x += 28 * finecosine[self->angle >> ANGLETOFINESHIFT]; spot->vel.x += 28 * finecosine[self->_f_angle() >> ANGLETOFINESHIFT];
spot->vel.y += 28 * finesine[self->angle >> ANGLETOFINESHIFT]; spot->vel.y += 28 * finesine[self->_f_angle() >> ANGLETOFINESHIFT];
} }
} }
if (spot != NULL) if (spot != NULL)
@ -1054,17 +1052,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3)
P_DamageMobj (self, self, NULL, 3*4, 0, DMG_NO_ARMOR); P_DamageMobj (self, self, NULL, 3*4, 0, DMG_NO_ARMOR);
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
self->angle -= ANGLE_90; self->Angles.Yaw -= 90.;
for (i = 0; i < 20; ++i) for (i = 0; i < 20; ++i)
{ {
self->angle += ANGLE_180/20; self->Angles.Yaw += 9.;
spot = P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall1"), self); spot = P_SpawnSubMissile (self, PClass::FindActor("SpectralLightningBall1"), self);
if (spot != NULL) if (spot != NULL)
{ {
spot->SetZ(self->Z() + 32*FRACUNIT); spot->SetZ(self->Z() + 32*FRACUNIT);
} }
} }
self->angle -= (ANGLE_180/20)*10; self->Angles.Yaw -= 90.;
return 0; return 0;
} }
@ -1091,7 +1089,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4)
P_BulletSlope (self, &t, ALF_PORTALRESTRICT); P_BulletSlope (self, &t, ALF_PORTALRESTRICT);
if (t.linetarget != NULL) if (t.linetarget != NULL)
{ {
spot = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindActor("SpectralLightningBigV1"), self->angle, &t, NULL, false, false, ALF_PORTALRESTRICT); spot = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindActor("SpectralLightningBigV1"), self->_f_angle(), &t, NULL, false, false, ALF_PORTALRESTRICT);
if (spot != NULL) if (spot != NULL)
{ {
spot->tracer = t.linetarget; spot->tracer = t.linetarget;
@ -1102,8 +1100,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4)
spot = P_SpawnPlayerMissile (self, PClass::FindActor("SpectralLightningBigV1")); spot = P_SpawnPlayerMissile (self, PClass::FindActor("SpectralLightningBigV1"));
if (spot != NULL) if (spot != NULL)
{ {
spot->vel.x += FixedMul (spot->Speed, finecosine[self->angle >> ANGLETOFINESHIFT]); spot->vel.x += FixedMul (spot->Speed, finecosine[self->_f_angle() >> ANGLETOFINESHIFT]);
spot->vel.y += FixedMul (spot->Speed, finesine[self->angle >> ANGLETOFINESHIFT]); spot->vel.y += FixedMul (spot->Speed, finesine[self->_f_angle() >> ANGLETOFINESHIFT]);
} }
} }
return 0; return 0;

View file

@ -25,12 +25,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_TemplarAttack)
S_Sound (self, CHAN_WEAPON, "templar/shoot", 1, ATTN_NORM); S_Sound (self, CHAN_WEAPON, "templar/shoot", 1, ATTN_NORM);
A_FaceTarget (self); A_FaceTarget (self);
pitch = P_AimLineAttack (self, self->angle, MISSILERANGE); pitch = P_AimLineAttack (self, self->_f_angle(), MISSILERANGE);
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)
{ {
damage = (pr_templar() & 4) * 2; damage = (pr_templar() & 4) * 2;
angle = self->angle + (pr_templar.Random2() << 19); angle = self->_f_angle() + (pr_templar.Random2() << 19);
pitchdiff = pr_templar.Random2() * 332063; pitchdiff = pr_templar.Random2() * 332063;
P_LineAttack (self, angle, MISSILERANGE+64*FRACUNIT, pitch+pitchdiff, damage, NAME_Hitscan, NAME_MaulerPuff); P_LineAttack (self, angle, MISSILERANGE+64*FRACUNIT, pitch+pitchdiff, damage, NAME_Hitscan, NAME_MaulerPuff);
} }

View file

@ -469,8 +469,8 @@ void cht_DoCheat (player_t *player, int cheat)
{ {
// Don't allow this in deathmatch even with cheats enabled, because it's // Don't allow this in deathmatch even with cheats enabled, because it's
// a very very cheap kill. // a very very cheap kill.
P_LineAttack (player->mo, player->mo->angle, PLAYERMISSILERANGE, P_LineAttack (player->mo, player->mo->_f_angle(), PLAYERMISSILERANGE,
P_AimLineAttack (player->mo, player->mo->angle, PLAYERMISSILERANGE), TELEFRAG_DAMAGE, P_AimLineAttack (player->mo, player->mo->_f_angle(), PLAYERMISSILERANGE), TELEFRAG_DAMAGE,
NAME_MDK, NAME_BulletPuff); NAME_MDK, NAME_BulletPuff);
} }
break; break;

View file

@ -3455,7 +3455,7 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i
actor->flags2 |= MF2_PASSMOBJ; actor->flags2 |= MF2_PASSMOBJ;
if (force || P_TestMobjLocation (actor)) if (force || P_TestMobjLocation (actor))
{ {
actor->angle = angle << 24; actor->Angles.Yaw = angle * (360. / 256);
actor->tid = tid; actor->tid = tid;
actor->AddToHash (); actor->AddToHash ();
if (actor->flags & MF_SPECIAL) if (actor->flags & MF_SPECIAL)
@ -3508,12 +3508,12 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force)
while ( (aspot = iterator.Next ()) ) while ( (aspot = iterator.Next ()) )
{ {
spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, aspot->angle >> 24, force); spawned += DoSpawn (type, aspot->X(), aspot->Y(), aspot->Z(), tid, aspot->_f_angle() >> 24, force);
} }
} }
else if (activator != NULL) else if (activator != NULL)
{ {
spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, activator->angle >> 24, force); spawned += DoSpawn (type, activator->X(), activator->Y(), activator->Z(), tid, activator->_f_angle() >> 24, force);
} }
return spawned; return spawned;
} }
@ -4736,7 +4736,7 @@ static bool DoSpawnDecal(AActor *actor, const FDecalTemplate *tpl, int flags, an
{ {
if (!(flags & SDF_ABSANGLE)) if (!(flags & SDF_ABSANGLE))
{ {
angle += actor->angle; angle += actor->_f_angle();
} }
return NULL != ShootDecal(tpl, actor, actor->Sector, actor->X(), actor->Y(), return NULL != ShootDecal(tpl, actor, actor->Sector, actor->X(), actor->Y(),
actor->Z() + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs, actor->Z() + (actor->height>>1) - actor->floorclip + actor->GetBobOffset() + zofs,
@ -4745,11 +4745,12 @@ static bool DoSpawnDecal(AActor *actor, const FDecalTemplate *tpl, int flags, an
static void SetActorAngle(AActor *activator, int tid, int angle, bool interpolate) static void SetActorAngle(AActor *activator, int tid, int angle, bool interpolate)
{ {
DAngle an = angle * (360. / 65536);
if (tid == 0) if (tid == 0)
{ {
if (activator != NULL) if (activator != NULL)
{ {
activator->SetAngle(angle << 16, interpolate); activator->SetAngle(an, interpolate);
} }
} }
else else
@ -4759,18 +4760,19 @@ static void SetActorAngle(AActor *activator, int tid, int angle, bool interpolat
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
{ {
actor->SetAngle(angle << 16, interpolate); actor->SetAngle(an, interpolate);
} }
} }
} }
static void SetActorPitch(AActor *activator, int tid, int angle, bool interpolate) static void SetActorPitch(AActor *activator, int tid, int angle, bool interpolate)
{ {
DAngle an = angle * (360. / 65536);
if (tid == 0) if (tid == 0)
{ {
if (activator != NULL) if (activator != NULL)
{ {
activator->SetPitch(angle << 16, interpolate); activator->SetPitch(an, interpolate);
} }
} }
else else
@ -4780,18 +4782,19 @@ static void SetActorPitch(AActor *activator, int tid, int angle, bool interpolat
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
{ {
actor->SetPitch(angle << 16, interpolate); actor->SetPitch(an, interpolate);
} }
} }
} }
static void SetActorRoll(AActor *activator, int tid, int angle, bool interpolate) static void SetActorRoll(AActor *activator, int tid, int angle, bool interpolate)
{ {
DAngle an = angle * (360. / 65536);
if (tid == 0) if (tid == 0)
{ {
if (activator != NULL) if (activator != NULL)
{ {
activator->SetRoll(angle << 16, interpolate); activator->SetRoll(an, interpolate);
} }
} }
else else
@ -4801,7 +4804,7 @@ static void SetActorRoll(AActor *activator, int tid, int angle, bool interpolate
while ((actor = iterator.Next())) while ((actor = iterator.Next()))
{ {
actor->SetRoll(angle << 16, interpolate); actor->SetRoll(an, interpolate);
} }
} }
} }
@ -5901,11 +5904,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
// [Nash] Actor roll functions. Let's roll! // [Nash] Actor roll functions. Let's roll!
case ACSF_SetActorRoll: case ACSF_SetActorRoll:
actor = SingleActorFromTID(args[0], activator); SetActorRoll(activator, args[0], args[1], false);
if (actor != NULL)
{
actor->SetRoll(args[1] << 16, false);
}
return 0; return 0;
case ACSF_ChangeActorRoll: case ACSF_ChangeActorRoll:
@ -5917,7 +5916,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_GetActorRoll: case ACSF_GetActorRoll:
actor = SingleActorFromTID(args[0], activator); actor = SingleActorFromTID(args[0], activator);
return actor != NULL? actor->roll >> 16 : 0; return actor != NULL? actor->Angles.Roll.FixedAngle() : 0;
// [ZK] A_Warp in ACS // [ZK] A_Warp in ACS
case ACSF_Warp: case ACSF_Warp:
@ -8690,14 +8689,14 @@ scriptwait:
case PCD_GETACTORANGLE: case PCD_GETACTORANGLE:
{ {
AActor *actor = SingleActorFromTID(STACK(1), activator); AActor *actor = SingleActorFromTID(STACK(1), activator);
STACK(1) = actor == NULL ? 0 : actor->angle >> 16; STACK(1) = actor == NULL ? 0 : actor->Angles.Yaw.FixedAngle();
} }
break; break;
case PCD_GETACTORPITCH: case PCD_GETACTORPITCH:
{ {
AActor *actor = SingleActorFromTID(STACK(1), activator); AActor *actor = SingleActorFromTID(STACK(1), activator);
STACK(1) = actor == NULL ? 0 : actor->pitch >> 16; STACK(1) = actor == NULL ? 0 : actor->Angles.Pitch.FixedAngle();
} }
break; break;
@ -9034,15 +9033,15 @@ scriptwait:
// Like Thing_Projectile(Gravity) specials, but you can give the // Like Thing_Projectile(Gravity) specials, but you can give the
// projectile a TID. // projectile a TID.
// Thing_Projectile2 (tid, type, angle, speed, vspeed, gravity, newtid); // Thing_Projectile2 (tid, type, angle, speed, vspeed, gravity, newtid);
P_Thing_Projectile (STACK(7), activator, STACK(6), NULL, ((angle_t)(STACK(5)<<24)), P_Thing_Projectile(STACK(7), activator, STACK(6), NULL, STACK(5) * (360. / 256.),
STACK(4)<<(FRACBITS-3), STACK(3)<<(FRACBITS-3), 0, NULL, STACK(2), STACK(1), false); STACK(4) << (FRACBITS - 3), STACK(3) << (FRACBITS - 3), 0, NULL, STACK(2), STACK(1), false);
sp -= 7; sp -= 7;
break; break;
case PCD_SPAWNPROJECTILE: case PCD_SPAWNPROJECTILE:
// Same, but takes an actor name instead of a spawn ID. // Same, but takes an actor name instead of a spawn ID.
P_Thing_Projectile (STACK(7), activator, 0, FBehavior::StaticLookupString (STACK(6)), ((angle_t)(STACK(5)<<24)), P_Thing_Projectile(STACK(7), activator, 0, FBehavior::StaticLookupString(STACK(6)), STACK(5) * (360. / 256.),
STACK(4)<<(FRACBITS-3), STACK(3)<<(FRACBITS-3), 0, NULL, STACK(2), STACK(1), false); STACK(4) << (FRACBITS - 3), STACK(3) << (FRACBITS - 3), 0, NULL, STACK(2), STACK(1), false);
sp -= 7; sp -= 7;
break; break;

View file

@ -1110,14 +1110,14 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
pc->player->ConversationFaceTalker = facetalker; pc->player->ConversationFaceTalker = facetalker;
if (saveangle) if (saveangle)
{ {
pc->player->ConversationNPCAngle = npc->angle; pc->player->ConversationNPCAngle = npc->Angles.Yaw;
} }
oldtarget = npc->target; oldtarget = npc->target;
npc->target = pc; npc->target = pc;
if (facetalker) if (facetalker)
{ {
A_FaceTarget (npc); A_FaceTarget (npc);
pc->angle = pc->AngleTo(npc); pc->Angles.Yaw = pc->_f_AngleTo(npc);
} }
if ((npc->flags & MF_FRIENDLY) || (npc->flags4 & MF4_NOHATEPLAYERS)) if ((npc->flags & MF_FRIENDLY) || (npc->flags4 & MF4_NOHATEPLAYERS))
{ {
@ -1227,7 +1227,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
if (reply == NULL) if (reply == NULL)
{ {
// The default reply was selected // The default reply was selected
npc->angle = player->ConversationNPCAngle; npc->Angles.Yaw = player->ConversationNPCAngle;
npc->flags5 &= ~MF5_INCONVERSATION; npc->flags5 &= ~MF5_INCONVERSATION;
return; return;
} }
@ -1243,7 +1243,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
TerminalResponse(reply->QuickNo); TerminalResponse(reply->QuickNo);
} }
npc->ConversationAnimation(2); npc->ConversationAnimation(2);
npc->angle = player->ConversationNPCAngle; npc->Angles.Yaw = player->ConversationNPCAngle;
npc->flags5 &= ~MF5_INCONVERSATION; npc->flags5 &= ~MF5_INCONVERSATION;
return; return;
} }
@ -1371,7 +1371,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
} }
} }
npc->angle = player->ConversationNPCAngle; npc->Angles.Yaw = player->ConversationNPCAngle;
// [CW] Set these to NULL because we're not using to them // [CW] Set these to NULL because we're not using to them
// anymore. However, this can interfere with slideshows // anymore. However, this can interfere with slideshows
@ -1421,7 +1421,7 @@ void P_ConversationCommand (int netcode, int pnum, BYTE **stream)
assert(netcode == DEM_CONVNULL || netcode == DEM_CONVCLOSE); assert(netcode == DEM_CONVNULL || netcode == DEM_CONVCLOSE);
if (player->ConversationNPC != NULL) if (player->ConversationNPC != NULL)
{ {
player->ConversationNPC->angle = player->ConversationNPCAngle; player->ConversationNPC->Angles.Yaw = player->ConversationNPCAngle;
player->ConversationNPC->flags5 &= ~MF5_INCONVERSATION; player->ConversationNPC->flags5 &= ~MF5_INCONVERSATION;
} }
if (netcode == DEM_CONVNULL) if (netcode == DEM_CONVNULL)

View file

@ -440,7 +440,7 @@ void P_RunEffect (AActor *actor, int effects)
} }
else else
{ {
moveangle = actor->angle; moveangle = actor->_f_angle();
} }
particle_t *particle; particle_t *particle;
@ -878,7 +878,7 @@ void P_DrawRailTrail(AActor *source, const DVector3 &start, const DVector3 &end,
AActor *thing = Spawn (spawnclass, FLOAT2FIXED(postmp.X), FLOAT2FIXED(postmp.Y), FLOAT2FIXED(postmp.Z), ALLOW_REPLACE); AActor *thing = Spawn (spawnclass, FLOAT2FIXED(postmp.X), FLOAT2FIXED(postmp.Y), FLOAT2FIXED(postmp.Z), ALLOW_REPLACE);
if (thing) if (thing)
thing->angle = angle; thing->Angles.Yaw = ANGLE2DBL(angle);
pos += trail_step; pos += trail_step;
} }
} }

View file

@ -1191,7 +1191,7 @@ bool P_IsVisible(AActor *lookee, AActor *other, INTBOOL allaround, FLookExParams
if (fov && fov < ANGLE_MAX) if (fov && fov < ANGLE_MAX)
{ {
angle_t an = lookee->AngleTo(other) - lookee->angle; angle_t an = lookee->AngleTo(other) - lookee->_f_angle();
if (an > (fov / 2) && an < (ANGLE_MAX - (fov / 2))) if (an > (fov / 2) && an < (ANGLE_MAX - (fov / 2)))
{ {
@ -2135,15 +2135,15 @@ void A_Wander(AActor *self, int flags)
// turn towards movement direction if not there yet // turn towards movement direction if not there yet
if (!(flags & CHF_NODIRECTIONTURN) && (self->movedir < DI_NODIR)) if (!(flags & CHF_NODIRECTIONTURN) && (self->movedir < DI_NODIR))
{ {
self->angle &= (angle_t)(7 << 29); self->Angles.Yaw = floor(self->Angles.Yaw.Degrees / 45) * 45.;
int delta = self->angle - (self->movedir << 29); DAngle delta = deltaangle(self->Angles.Yaw, (self->movedir * 45));
if (delta > 0) if (delta < 0)
{ {
self->angle -= ANG90 / 2; self->Angles.Yaw -= 45;
} }
else if (delta < 0) else if (delta > 0)
{ {
self->angle += ANG90 / 2; self->Angles.Yaw += 45;
} }
} }
@ -2228,7 +2228,6 @@ nosee:
void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *meleestate, FState *missilestate, bool playactive, bool nightmarefast, bool dontmove, int flags) void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *meleestate, FState *missilestate, bool playactive, bool nightmarefast, bool dontmove, int flags)
{ {
int delta;
if (actor->flags5 & MF5_INCONVERSATION) if (actor->flags5 & MF5_INCONVERSATION)
return; return;
@ -2290,15 +2289,15 @@ void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *mele
} }
else if (!(flags & CHF_NODIRECTIONTURN) && actor->movedir < 8) else if (!(flags & CHF_NODIRECTIONTURN) && actor->movedir < 8)
{ {
actor->angle &= (angle_t)(7<<29); actor->Angles.Yaw = floor(actor->Angles.Yaw.Degrees / 45) * 45.;
delta = actor->angle - (actor->movedir << 29); DAngle delta = deltaangle(actor->Angles.Yaw, (actor->movedir * 45));
if (delta > 0) if (delta < 0)
{ {
actor->angle -= ANG90/2; actor->Angles.Yaw -= 45;
} }
else if (delta < 0) else if (delta > 0)
{ {
actor->angle += ANG90/2; actor->Angles.Yaw += 45;
} }
} }
@ -2414,7 +2413,7 @@ void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *mele
spec->args[1], spec->args[2], spec->args[3], spec->args[4]); spec->args[1], spec->args[2], spec->args[3], spec->args[4]);
} }
angle_t lastgoalang = actor->goal->angle; DAngle lastgoalang = actor->goal->Angles.Yaw;
int delay; int delay;
AActor * newgoal = iterator.Next (); AActor * newgoal = iterator.Next ();
if (newgoal != NULL && actor->goal == actor->target) if (newgoal != NULL && actor->goal == actor->target)
@ -2426,7 +2425,7 @@ void A_DoChase (VMFrameStack *stack, AActor *actor, bool fastchase, FState *mele
{ {
delay = 0; delay = 0;
actor->reactiontime = actor->GetDefault()->reactiontime; actor->reactiontime = actor->GetDefault()->reactiontime;
actor->angle = lastgoalang; // Look in direction of last goal actor->Angles.Yaw = lastgoalang; // Look in direction of last goal
} }
if (actor->target == actor->goal) actor->target = NULL; if (actor->target == actor->goal) actor->target = NULL;
actor->flags |= MF_JUSTATTACKED; actor->flags |= MF_JUSTATTACKED;
@ -2820,7 +2819,7 @@ enum FAF_Flags
FAF_TOP = 4, FAF_TOP = 4,
FAF_NODISTFACTOR = 8, // deprecated FAF_NODISTFACTOR = 8, // deprecated
}; };
void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, angle_t ang_offset, angle_t pitch_offset, int flags, fixed_t z_add) void A_Face (AActor *self, AActor *other, angle_t _max_turn, angle_t _max_pitch, angle_t _ang_offset, angle_t _pitch_offset, int flags, fixed_t z_add)
{ {
if (!other) if (!other)
return; return;
@ -2833,43 +2832,35 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
self->flags &= ~MF_AMBUSH; self->flags &= ~MF_AMBUSH;
angle_t other_angle = self->AngleTo(other); DAngle max_turn = ANGLE2DBL(_max_turn);
DAngle ang_offset = ANGLE2DBL(_ang_offset);
DAngle max_pitch = ANGLE2DBL(_max_pitch);
DAngle pitch_offset = ANGLE2DBL(_pitch_offset);
DAngle other_angle = self->_f_AngleTo(other);
DAngle delta = deltaangle(self->Angles.Yaw, other_angle);
// 0 means no limit. Also, if we turn in a single step anyways, no need to go through the algorithms. // 0 means no limit. Also, if we turn in a single step anyways, no need to go through the algorithms.
// It also means that there is no need to check for going past the other. // It also means that there is no need to check for going past the other.
if (max_turn && (max_turn < absangle(self->angle - other_angle))) if (max_turn != 0 && (max_turn < fabs(delta)))
{ {
if (self->angle > other_angle) if (delta > 0)
{ {
if (self->angle - other_angle < ANGLE_180) self->Angles.Yaw -= max_turn + ang_offset;
{
self->angle -= max_turn + ang_offset;
}
else
{
self->angle += max_turn + ang_offset;
}
} }
else else
{ {
if (other_angle - self->angle < ANGLE_180) self->Angles.Yaw += max_turn + ang_offset;
{
self->angle += max_turn + ang_offset;
}
else
{
self->angle -= max_turn + ang_offset;
}
} }
} }
else else
{ {
self->angle = other_angle + ang_offset; self->Angles.Yaw = other_angle + ang_offset;
} }
// [DH] Now set pitch. In order to maintain compatibility, this can be // [DH] Now set pitch. In order to maintain compatibility, this can be
// disabled and is so by default. // disabled and is so by default.
if (max_pitch <= ANGLE_180) if (max_pitch <= 180.)
{ {
fixedvec2 pos = self->Vec2To(other); fixedvec2 pos = self->Vec2To(other);
DVector2 dist(pos.x, pos.y); DVector2 dist(pos.x, pos.y);
@ -2898,34 +2889,35 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn, angle_t max_pitch, a
double dist_z = target_z - source_z; double dist_z = target_z - source_z;
double ddist = g_sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z); double ddist = g_sqrt(dist.X*dist.X + dist.Y*dist.Y + dist_z*dist_z);
int other_pitch = (int)RAD2ANGLE(g_asin(dist_z / ddist));
DAngle other_pitch = DAngle(ToDegrees(g_asin(dist_z / ddist))).Normalized180();
if (max_pitch != 0) if (max_pitch != 0)
{ {
if (self->pitch > other_pitch) if (self->Angles.Pitch > other_pitch)
{ {
max_pitch = MIN(max_pitch, unsigned(self->pitch - other_pitch)); max_pitch = MIN(max_pitch, (self->Angles.Pitch - other_pitch).Normalized360());
self->pitch -= max_pitch; self->Angles.Pitch -= max_pitch;
} }
else else
{ {
max_pitch = MIN(max_pitch, unsigned(other_pitch - self->pitch)); max_pitch = MIN(max_pitch, (other_pitch - self->Angles.Pitch).Normalized360());
self->pitch += max_pitch; self->Angles.Pitch += max_pitch;
} }
} }
else else
{ {
self->pitch = other_pitch; self->Angles.Pitch = other_pitch;
} }
self->pitch += pitch_offset; self->Angles.Pitch += pitch_offset;
} }
// This will never work well if the turn angle is limited. // This will never work well if the turn angle is limited.
if (max_turn == 0 && (self->angle == other_angle) && other->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE) ) if (max_turn == 0 && (self->Angles.Yaw == other_angle) && other->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE) )
{ {
self->angle += pr_facetarget.Random2() << 21; self->Angles.Yaw += pr_facetarget.Random2() * (45 / 256.);
} }
} }
@ -2990,7 +2982,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
if (!self->target) if (!self->target)
return 0; return 0;
fixed_t saved_pitch = self->pitch; DAngle saved_pitch = self->Angles.Pitch;
FTranslatedLineTarget t; FTranslatedLineTarget t;
// [RH] Andy Baker's stealth monsters // [RH] Andy Baker's stealth monsters
@ -3001,28 +2993,28 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
self->flags &= ~MF_AMBUSH; self->flags &= ~MF_AMBUSH;
self->angle = self->AngleTo(self->target); self->Angles.Yaw = self->_f_AngleTo(self->target);
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE, &t, ANGLE_1*60, 0, self->target); self->Angles.Pitch = ANGLE2DBL(P_AimLineAttack (self, self->_f_angle(), MISSILERANGE, &t, ANGLE_1*60, 0, self->target));
if (t.linetarget == NULL) if (t.linetarget == NULL)
{ {
// We probably won't hit the target, but aim at it anyway so we don't look stupid. // We probably won't hit the target, but aim at it anyway so we don't look stupid.
fixedvec2 pos = self->Vec2To(self->target); fixedvec2 pos = self->Vec2To(self->target);
DVector2 xydiff(pos.x, pos.y); DVector2 xydiff(pos.x, pos.y);
double zdiff = (self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip); double zdiff = (self->target->Z() + (self->target->height>>1)) - (self->Z() + (self->height>>1) - self->floorclip);
self->pitch = int(g_atan2(zdiff, xydiff.Length()) * ANGLE_180 / -M_PI); self->Angles.Pitch = -ToDegrees(g_atan2(zdiff, xydiff.Length()));
} }
// Let the aim trail behind the player // Let the aim trail behind the player
self->angle = self->AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3); self->Angles.Yaw = ANGLE2DBL(self->AngleTo(self->target, -self->target->vel.x * 3, -self->target->vel.y * 3));
if (self->target->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE)) if (self->target->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE))
{ {
self->angle += pr_railface.Random2() << 21; self->Angles.Yaw += pr_railface.Random2() * 45./256;
} }
P_RailAttack (self, self->GetMissileDamage (0, 1), 0); P_RailAttack (self, self->GetMissileDamage (0, 1), 0);
self->pitch = saved_pitch; self->Angles.Pitch = saved_pitch;
return 0; return 0;
} }

View file

@ -82,7 +82,8 @@ static const BYTE ChangeMap[8] = { 0, 1, 5, 3, 7, 2, 6, 0 };
#define SPEED(a) ((a)*(FRACUNIT/8)) #define SPEED(a) ((a)*(FRACUNIT/8))
#define TICS(a) (((a)*TICRATE)/35) #define TICS(a) (((a)*TICRATE)/35)
#define OCTICS(a) (((a)*TICRATE)/8) #define OCTICS(a) (((a)*TICRATE)/8)
#define BYTEANGLE(a) ((angle_t)((a)<<24)) #define _f_BYTEANGLE(a) ((angle_t)((a)<<24))
#define BYTEANGLE(a) ((a) * (360./256.))
#define CRUSH(a) ((a) > 0? (a) : -1) #define CRUSH(a) ((a) > 0? (a) : -1)
#define CRUSHTYPE(a) ((a)==1? false : (a)==2? true : gameinfo.gametype == GAME_Hexen) #define CRUSHTYPE(a) ((a)==1? false : (a)==2? true : gameinfo.gametype == GAME_Hexen)
#define CHANGE(a) (((a) >= 0 && (a)<=7)? ChangeMap[a]:0) #define CHANGE(a) (((a) >= 0 && (a)<=7)? ChangeMap[a]:0)
@ -146,13 +147,13 @@ FUNC(LS_Polyobj_RotateRight)
FUNC(LS_Polyobj_Move) FUNC(LS_Polyobj_Move)
// Polyobj_Move (po, speed, angle, distance) // Polyobj_Move (po, speed, angle, distance)
{ {
return EV_MovePoly (ln, arg0, SPEED(arg1), BYTEANGLE(arg2), arg3 * FRACUNIT, false); return EV_MovePoly (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT, false);
} }
FUNC(LS_Polyobj_MoveTimes8) FUNC(LS_Polyobj_MoveTimes8)
// Polyobj_MoveTimes8 (po, speed, angle, distance) // Polyobj_MoveTimes8 (po, speed, angle, distance)
{ {
return EV_MovePoly (ln, arg0, SPEED(arg1), BYTEANGLE(arg2), arg3 * FRACUNIT * 8, false); return EV_MovePoly (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT * 8, false);
} }
FUNC(LS_Polyobj_MoveTo) FUNC(LS_Polyobj_MoveTo)
@ -173,13 +174,13 @@ FUNC(LS_Polyobj_MoveToSpot)
FUNC(LS_Polyobj_DoorSwing) FUNC(LS_Polyobj_DoorSwing)
// Polyobj_DoorSwing (po, speed, angle, delay) // Polyobj_DoorSwing (po, speed, angle, delay)
{ {
return EV_OpenPolyDoor (ln, arg0, arg1, BYTEANGLE(arg2), arg3, 0, PODOOR_SWING); return EV_OpenPolyDoor (ln, arg0, arg1, _f_BYTEANGLE(arg2), arg3, 0, PODOOR_SWING);
} }
FUNC(LS_Polyobj_DoorSlide) FUNC(LS_Polyobj_DoorSlide)
// Polyobj_DoorSlide (po, speed, angle, distance, delay) // Polyobj_DoorSlide (po, speed, angle, distance, delay)
{ {
return EV_OpenPolyDoor (ln, arg0, SPEED(arg1), BYTEANGLE(arg2), arg4, arg3*FRACUNIT, PODOOR_SLIDE); return EV_OpenPolyDoor (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg4, arg3*FRACUNIT, PODOOR_SLIDE);
} }
FUNC(LS_Polyobj_OR_RotateLeft) FUNC(LS_Polyobj_OR_RotateLeft)
@ -197,13 +198,13 @@ FUNC(LS_Polyobj_OR_RotateRight)
FUNC(LS_Polyobj_OR_Move) FUNC(LS_Polyobj_OR_Move)
// Polyobj_OR_Move (po, speed, angle, distance) // Polyobj_OR_Move (po, speed, angle, distance)
{ {
return EV_MovePoly (ln, arg0, SPEED(arg1), BYTEANGLE(arg2), arg3 * FRACUNIT, true); return EV_MovePoly (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT, true);
} }
FUNC(LS_Polyobj_OR_MoveTimes8) FUNC(LS_Polyobj_OR_MoveTimes8)
// Polyobj_OR_MoveTimes8 (po, speed, angle, distance) // Polyobj_OR_MoveTimes8 (po, speed, angle, distance)
{ {
return EV_MovePoly (ln, arg0, SPEED(arg1), BYTEANGLE(arg2), arg3 * FRACUNIT * 8, true); return EV_MovePoly (ln, arg0, SPEED(arg1), _f_BYTEANGLE(arg2), arg3 * FRACUNIT * 8, true);
} }
FUNC(LS_Polyobj_OR_MoveTo) FUNC(LS_Polyobj_OR_MoveTo)
@ -1100,7 +1101,7 @@ FUNC(LS_Teleport_Line)
return EV_SilentLineTeleport (ln, backSide, it, arg1, arg2); return EV_SilentLineTeleport (ln, backSide, it, arg1, arg2);
} }
static void ThrustThingHelper (AActor *it, angle_t angle, int force, INTBOOL nolimit); static void ThrustThingHelper (AActor *it, DAngle angle, int force, INTBOOL nolimit);
FUNC(LS_ThrustThing) FUNC(LS_ThrustThing)
// ThrustThing (angle, force, nolimit, tid) // ThrustThing (angle, force, nolimit, tid)
{ {
@ -1125,11 +1126,9 @@ FUNC(LS_ThrustThing)
return false; return false;
} }
static void ThrustThingHelper (AActor *it, angle_t angle, int force, INTBOOL nolimit) static void ThrustThingHelper (AActor *it, DAngle angle, int force, INTBOOL nolimit)
{ {
angle >>= ANGLETOFINESHIFT; it->VelFromAngle(angle, force << FRACBITS);
it->vel.x += force * finecosine[angle];
it->vel.y += force * finesine[angle];
if (!nolimit) if (!nolimit)
{ {
it->vel.x = clamp<fixed_t> (it->vel.x, -MAXMOVE, MAXMOVE); it->vel.x = clamp<fixed_t> (it->vel.x, -MAXMOVE, MAXMOVE);
@ -1661,7 +1660,7 @@ FUNC(LS_Thing_SpawnNoFog)
FUNC(LS_Thing_SpawnFacing) FUNC(LS_Thing_SpawnFacing)
// Thing_SpawnFacing (tid, type, nofog, newtid) // Thing_SpawnFacing (tid, type, nofog, newtid)
{ {
return P_Thing_Spawn (arg0, it, arg1, ANGLE_MAX, arg2 ? false : true, arg3); return P_Thing_Spawn (arg0, it, arg1, 1000000., arg2 ? false : true, arg3);
} }
FUNC(LS_Thing_Raise) FUNC(LS_Thing_Raise)
@ -3217,7 +3216,7 @@ FUNC(LS_ForceField)
if (it != NULL) if (it != NULL)
{ {
P_DamageMobj (it, NULL, NULL, 16, NAME_None); P_DamageMobj (it, NULL, NULL, 16, NAME_None);
P_ThrustMobj (it, it->angle + ANGLE_180, 0x7D000); P_ThrustMobj (it, it->_f_angle() + ANGLE_180, 0x7D000);
} }
return true; return true;
} }
@ -3272,8 +3271,6 @@ FUNC(LS_GlassBreak)
{ // Break some glass { // Break some glass
fixed_t x, y; fixed_t x, y;
AActor *glass; AActor *glass;
angle_t an;
int speed;
x = ln->v1->x + ln->dx/2; x = ln->v1->x + ln->dx/2;
y = ln->v1->y + ln->dy/2; y = ln->v1->y + ln->dy/2;
@ -3286,12 +3283,9 @@ FUNC(LS_GlassBreak)
glass->AddZ(24 * FRACUNIT); glass->AddZ(24 * FRACUNIT);
glass->SetState (glass->SpawnState + (pr_glass() % glass->health)); glass->SetState (glass->SpawnState + (pr_glass() % glass->health));
an = pr_glass() << (32-8);
glass->angle = an; glass->Angles.Yaw = pr_glass() * (360 / 256.);
an >>= ANGLETOFINESHIFT; glass->VelFromAngle(pr_glass() & 3);
speed = pr_glass() & 3;
glass->vel.x = finecosine[an] * speed;
glass->vel.y = finesine[an] * speed;
glass->vel.z = (pr_glass() & 7) << FRACBITS; glass->vel.z = (pr_glass() & 7) << FRACBITS;
// [RH] Let the shards stick around longer than they did in Strife. // [RH] Let the shards stick around longer than they did in Strife.
glass->tics += pr_glass(); glass->tics += pr_glass();

View file

@ -25,6 +25,7 @@
#include "doomtype.h" #include "doomtype.h"
#include "tables.h" #include "tables.h"
#include "vectors.h"
class player_t; class player_t;
class AActor; class AActor;
@ -129,7 +130,12 @@ void P_PredictionLerpReset();
APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags=0); APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags=0);
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move); void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta); inline void P_ThrustMobj(AActor *mo, DAngle angle, fixed_t move)
{
P_ThrustMobj(mo, FLOAT2ANGLE(angle.Degrees), move);
}
int P_FaceMobj (AActor *source, AActor *target, DAngle *delta);
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise = false, bool usecurspeed=false); bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise = false, bool usecurspeed=false);
enum EPuffFlags enum EPuffFlags
@ -187,8 +193,8 @@ AActor *P_SpawnSubMissile (AActor *source, PClassActor *type, AActor *target); /
extern FClassMap SpawnableThings; extern FClassMap SpawnableThings;
extern FClassMap StrifeTypes; extern FClassMap StrifeTypes;
bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog, int newtid); bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, int newtid);
bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_name, angle_t angle, bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_name, DAngle angle,
fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid, fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid,
bool leadTarget); bool leadTarget);
bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog); bool P_MoveThing(AActor *source, fixed_t x, fixed_t y, fixed_t z, bool fog);

View file

@ -2348,7 +2348,7 @@ bool P_TryMove(AActor *thing, fixed_t x, fixed_t y,
thing->UnlinkFromWorld(); thing->UnlinkFromWorld();
thing->SetXYZ(pos); thing->SetXYZ(pos);
P_TranslatePortalVXVY(ld, thing->vel.x, thing->vel.y); P_TranslatePortalVXVY(ld, thing->vel.x, thing->vel.y);
P_TranslatePortalAngle(ld, thing->angle); P_TranslatePortalAngle(ld, thing->Angles.Yaw);
thing->LinkToWorld(); thing->LinkToWorld();
P_FindFloorCeiling(thing); P_FindFloorCeiling(thing);
thing->ClearInterpolation(); thing->ClearInterpolation();
@ -3314,7 +3314,7 @@ bool FSlide::BounceWall(AActor *mo)
} }
moveangle = R_PointToAngle2(0, 0, mo->vel.x, mo->vel.y); moveangle = R_PointToAngle2(0, 0, mo->vel.x, mo->vel.y);
deltaangle = (2 * lineangle) - moveangle; deltaangle = (2 * lineangle) - moveangle;
mo->angle = deltaangle; mo->Angles.Yaw = ANGLE2DBL(deltaangle);
deltaangle >>= ANGLETOFINESHIFT; deltaangle >>= ANGLETOFINESHIFT;
@ -3379,13 +3379,11 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
if (!ontop) if (!ontop)
{ {
fixed_t speed; fixed_t speed;
angle_t angle = BlockingMobj->AngleTo(mo) + ANGLE_1*((pr_bounce() % 16) - 8); DAngle angle = BlockingMobj->_f_AngleTo(mo) + ((pr_bounce() % 16) - 8);
speed = P_AproxDistance(mo->vel.x, mo->vel.y); speed = P_AproxDistance(mo->vel.x, mo->vel.y);
speed = FixedMul(speed, mo->wallbouncefactor); // [GZ] was 0.75, using wallbouncefactor seems more consistent speed = FixedMul(speed, mo->wallbouncefactor); // [GZ] was 0.75, using wallbouncefactor seems more consistent
mo->angle = angle; mo->Angles.Yaw = ANGLE2DBL(angle);
angle >>= ANGLETOFINESHIFT; mo->VelFromAngle(speed);
mo->vel.x = FixedMul(speed, finecosine[angle]);
mo->vel.y = FixedMul(speed, finesine[angle]);
mo->PlayBounceSound(true); mo->PlayBounceSound(true);
if (mo->BounceFlags & BOUNCE_UseBounceState) if (mo->BounceFlags & BOUNCE_UseBounceState)
{ {
@ -3533,7 +3531,7 @@ struct aim_t
{ {
res.linetarget = th; res.linetarget = th;
res.pitch = pitch; res.pitch = pitch;
res.angleFromSource = R_PointToAngle2(startpos.x, startpos.y, th->X(), th->Y()); res.angleFromSource = vectoyaw(DVector2(th->X() - startpos.x, th->Y() - startpos.y));
res.unlinked = unlinked; res.unlinked = unlinked;
res.frac = frac; res.frac = frac;
} }
@ -4095,10 +4093,10 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, FTranslated
aim.startpos = t1->Pos(); aim.startpos = t1->Pos();
aim.aimtrace = Vec2Angle(distance, angle); aim.aimtrace = Vec2Angle(distance, angle);
aim.limitz = aim.shootz = shootz; aim.limitz = aim.shootz = shootz;
aim.toppitch = t1->pitch - vrange; aim.toppitch = t1->_f_pitch() - vrange;
aim.bottompitch = t1->pitch + vrange; aim.bottompitch = t1->_f_pitch() + vrange;
aim.attackrange = distance; aim.attackrange = distance;
aim.aimpitch = t1->pitch; aim.aimpitch = t1->_f_pitch();
aim.lastsector = t1->Sector; aim.lastsector = t1->Sector;
aim.startfrac = 0; aim.startfrac = 0;
aim.unlinked = false; aim.unlinked = false;
@ -4112,7 +4110,7 @@ fixed_t P_AimLineAttack(AActor *t1, angle_t angle, fixed_t distance, FTranslated
{ {
*pLineTarget = *result; *pLineTarget = *result;
} }
return result->linetarget ? result->pitch : t1->pitch; return result->linetarget ? result->pitch : t1->_f_pitch();
} }
@ -4399,7 +4397,7 @@ AActor *P_LineAttack(AActor *t1, angle_t angle, fixed_t distance,
if (victim != NULL) if (victim != NULL)
{ {
victim->linetarget = trace.Actor; victim->linetarget = trace.Actor;
victim->angleFromSource = trace.SrcAngleToTarget; victim->angleFromSource = ANGLE2DBL(trace.SrcAngleToTarget);
victim->unlinked = trace.unlinked; victim->unlinked = trace.unlinked;
} }
} }
@ -4625,7 +4623,7 @@ void P_TraceBleed(int damage, FTranslatedLineTarget *t, AActor *puff)
fixed_t randpitch = (pr_tracebleed() - 128) << 16; fixed_t randpitch = (pr_tracebleed() - 128) << 16;
P_TraceBleed(damage, t->linetarget->X(), t->linetarget->Y(), t->linetarget->Z() + t->linetarget->height / 2, P_TraceBleed(damage, t->linetarget->X(), t->linetarget->Y(), t->linetarget->Z() + t->linetarget->height / 2,
t->linetarget, t->angleFromSource, 0); t->linetarget, FLOAT2ANGLE(t->angleFromSource.Degrees), 0);
} }
//========================================================================== //==========================================================================
@ -4722,8 +4720,8 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
puffclass = PClass::FindActor(NAME_BulletPuff); puffclass = PClass::FindActor(NAME_BulletPuff);
} }
pitch = ((angle_t)(-source->pitch) + pitchoffset) >> ANGLETOFINESHIFT; pitch = ((angle_t)(-source->_f_pitch()) + pitchoffset) >> ANGLETOFINESHIFT;
angle = (source->angle + angleoffset) >> ANGLETOFINESHIFT; angle = (source->_f_angle() + angleoffset) >> ANGLETOFINESHIFT;
vx = FixedMul(finecosine[pitch], finecosine[angle]); vx = FixedMul(finecosine[pitch], finecosine[angle]);
vy = FixedMul(finecosine[pitch], finesine[angle]); vy = FixedMul(finecosine[pitch], finesine[angle]);
@ -4743,7 +4741,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
} }
} }
angle = ((source->angle + angleoffset) - ANG90) >> ANGLETOFINESHIFT; angle = ((source->_f_angle() + angleoffset) - ANG90) >> ANGLETOFINESHIFT;
fixedvec2 xy = source->Vec2Offset(offset_xy * finecosine[angle], offset_xy * finesine[angle]); fixedvec2 xy = source->Vec2Offset(offset_xy * finecosine[angle], offset_xy * finesine[angle]);
@ -4822,7 +4820,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
if (bleed) if (bleed)
{ {
P_SpawnBlood(hitpos, hitangle, newdam > 0 ? newdam : damage, hitactor); P_SpawnBlood(hitpos, hitangle, newdam > 0 ? newdam : damage, hitactor);
P_TraceBleed(newdam > 0 ? newdam : damage, hitpos, hitactor, source->angle, pitch); P_TraceBleed(newdam > 0 ? newdam : damage, hitpos, hitactor, source->_f_angle(), pitch);
} }
} }
@ -4874,7 +4872,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
end.X = FIXED2DBL(trace.HitPos.x); end.X = FIXED2DBL(trace.HitPos.x);
end.Y = FIXED2DBL(trace.HitPos.y); end.Y = FIXED2DBL(trace.HitPos.y);
end.Z = FIXED2DBL(trace.HitPos.z); end.Z = FIXED2DBL(trace.HitPos.z);
P_DrawRailTrail(source, start, end, color1, color2, maxdiff, railflags, spawnclass, source->angle + angleoffset, duration, sparsity, drift, SpiralOffset); P_DrawRailTrail(source, start, end, color1, color2, maxdiff, railflags, spawnclass, source->_f_angle() + angleoffset, duration, sparsity, drift, SpiralOffset);
} }
//========================================================================== //==========================================================================
@ -4889,8 +4887,8 @@ CVAR(Float, chase_dist, 90.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector, bool &unlinked) void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector, bool &unlinked)
{ {
fixed_t distance = (fixed_t)(clamp<double>(chase_dist, 0, 30000) * FRACUNIT); fixed_t distance = (fixed_t)(clamp<double>(chase_dist, 0, 30000) * FRACUNIT);
angle_t angle = (t1->angle - ANG180) >> ANGLETOFINESHIFT; angle_t angle = (t1->_f_angle() - ANG180) >> ANGLETOFINESHIFT;
angle_t pitch = (angle_t)(t1->pitch) >> ANGLETOFINESHIFT; angle_t pitch = (angle_t)(t1->_f_pitch()) >> ANGLETOFINESHIFT;
FTraceResults trace; FTraceResults trace;
fixed_t vx, vy, vz, sz; fixed_t vx, vy, vz, sz;
@ -4937,7 +4935,7 @@ bool P_TalkFacing(AActor *player)
for (int angle : angleofs) for (int angle : angleofs)
{ {
P_AimLineAttack(player, player->angle + angle, TALKRANGE, &t, ANGLE_1 * 35, ALF_FORCENOSMART | ALF_CHECKCONVERSATION | ALF_PORTALRESTRICT); P_AimLineAttack(player, player->_f_angle() + angle, TALKRANGE, &t, ANGLE_1 * 35, ALF_FORCENOSMART | ALF_CHECKCONVERSATION | ALF_PORTALRESTRICT);
if (t.linetarget != NULL) if (t.linetarget != NULL)
{ {
if (t.linetarget->health > 0 && // Dead things can't talk. if (t.linetarget->health > 0 && // Dead things can't talk.
@ -5133,7 +5131,7 @@ void P_UseLines(player_t *player)
// If the player is transitioning a portal, use the group that is at its vertical center. // If the player is transitioning a portal, use the group that is at its vertical center.
fixedvec2 start = player->mo->GetPortalTransition(player->mo->height / 2); fixedvec2 start = player->mo->GetPortalTransition(player->mo->height / 2);
// [NS] Now queries the Player's UseRange. // [NS] Now queries the Player's UseRange.
fixedvec2 end = start + Vec2Angle(userange > 0? fixed_t(userange<<FRACBITS) : player->mo->UseRange, player->mo->angle); fixedvec2 end = start + Vec2Angle(userange > 0? fixed_t(userange<<FRACBITS) : player->mo->UseRange, player->mo->_f_angle());
// old code: // old code:
// //
@ -5167,7 +5165,7 @@ bool P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType)
int angle; int angle;
fixed_t x1, y1, x2, y2, usedist; fixed_t x1, y1, x2, y2, usedist;
angle = PuzzleItemUser->angle >> ANGLETOFINESHIFT; angle = PuzzleItemUser->_f_angle() >> ANGLETOFINESHIFT;
x1 = PuzzleItemUser->X(); x1 = PuzzleItemUser->X();
y1 = PuzzleItemUser->Y(); y1 = PuzzleItemUser->Y();

View file

@ -237,7 +237,7 @@ void AActor::Serialize (FArchive &arc)
arc << __pos.x arc << __pos.x
<< __pos.y << __pos.y
<< __pos.z << __pos.z
<< angle << Angles.Yaw
<< frame << frame
<< scaleX << scaleX
<< scaleY << scaleY
@ -252,8 +252,8 @@ void AActor::Serialize (FArchive &arc)
<< effects << effects
<< alpha << alpha
<< fillcolor << fillcolor
<< pitch << Angles.Pitch // move these up when savegame compatibility is broken!
<< roll << Angles.Roll // For now they have to remain here.
<< Sector << Sector
<< floorz << floorz
<< ceilingz << ceilingz
@ -832,19 +832,17 @@ bool AActor::UseInventory (AInventory *item)
AInventory *AActor::DropInventory (AInventory *item) AInventory *AActor::DropInventory (AInventory *item)
{ {
angle_t an;
AInventory *drop = item->CreateTossable (); AInventory *drop = item->CreateTossable ();
if (drop == NULL) if (drop == NULL)
{ {
return NULL; return NULL;
} }
an = angle >> ANGLETOFINESHIFT;
drop->SetOrigin(PosPlusZ(10*FRACUNIT), false); drop->SetOrigin(PosPlusZ(10*FRACUNIT), false);
drop->angle = angle; drop->Angles.Yaw = Angles.Yaw;
drop->vel.x = vel.x + 5 * finecosine[an]; drop->VelFromAngle(5);
drop->vel.y = vel.y + 5 * finesine[an]; drop->vel.z = FRACUNIT;
drop->vel.z = vel.z + FRACUNIT; drop->vel += vel;
drop->flags &= ~MF_NOGRAVITY; // Don't float drop->flags &= ~MF_NOGRAVITY; // Don't float
drop->ClearCounters(); // do not count for statistics again drop->ClearCounters(); // do not count for statistics again
return drop; return drop;
@ -1576,7 +1574,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
vel.x -= MulScale15 (plane.a, dot); vel.x -= MulScale15 (plane.a, dot);
vel.y -= MulScale15 (plane.b, dot); vel.y -= MulScale15 (plane.b, dot);
vel.z -= MulScale15 (plane.c, dot); vel.z -= MulScale15 (plane.c, dot);
angle = R_PointToAngle2 (0, 0, vel.x, vel.y); AngleFromVel();
if (!(BounceFlags & BOUNCE_MBF)) // Heretic projectiles die, MBF projectiles don't. if (!(BounceFlags & BOUNCE_MBF)) // Heretic projectiles die, MBF projectiles don't.
{ {
flags |= MF_INBOUNCE; flags |= MF_INBOUNCE;
@ -1592,7 +1590,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane)
vel.x = FixedMul (vel.x - MulScale15 (plane.a, dot), bouncefactor); vel.x = FixedMul (vel.x - MulScale15 (plane.a, dot), bouncefactor);
vel.y = FixedMul (vel.y - MulScale15 (plane.b, dot), bouncefactor); vel.y = FixedMul (vel.y - MulScale15 (plane.b, dot), bouncefactor);
vel.z = FixedMul (vel.z - MulScale15 (plane.c, dot), bouncefactor); vel.z = FixedMul (vel.z - MulScale15 (plane.c, dot), bouncefactor);
angle = R_PointToAngle2 (0, 0, vel.x, vel.y); AngleFromVel();
} }
PlayBounceSound(true); PlayBounceSound(true);
@ -1652,41 +1650,20 @@ void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move)
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta) int P_FaceMobj (AActor *source, AActor *target, DAngle *delta)
{ {
angle_t diff; DAngle diff;
angle_t angle1;
angle_t angle2;
angle1 = source->angle; diff = deltaangle(source->Angles.Yaw, source->_f_AngleTo(target));
angle2 = source->AngleTo(target); if (diff > 0)
if (angle2 > angle1)
{ {
diff = angle2 - angle1; *delta = diff;
if (diff > ANGLE_180) return 0;
{
*delta = ANGLE_MAX - diff;
return 0;
}
else
{
*delta = diff;
return 1;
}
} }
else else
{ {
diff = angle1 - angle2; *delta = -diff;
if (diff > ANGLE_180) return 1;
{
*delta = ANGLE_MAX - diff;
return 1;
}
else
{
*delta = diff;
return 0;
}
} }
} }
@ -1719,16 +1696,18 @@ bool AActor::CanSeek(AActor *target) const
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool precise, bool usecurspeed) bool P_SeekerMissile (AActor *actor, angle_t _thresh, angle_t _turnMax, bool precise, bool usecurspeed)
{ {
DAngle thresh = ANGLE2DBL(_thresh);
DAngle turnMax = ANGLE2DBL(_turnMax);
int dir; int dir;
int dist; int dist;
angle_t delta; DAngle delta;
angle_t angle;
AActor *target; AActor *target;
fixed_t speed; fixed_t speed;
speed = !usecurspeed ? actor->Speed : xs_CRoundToInt(DVector3(actor->vel.x, actor->vel.y, actor->vel.z).Length()); speed = !usecurspeed ? actor->Speed : actor->VelToSpeed();
target = actor->tracer; target = actor->tracer;
if (target == NULL || !actor->CanSeek(target)) if (target == NULL || !actor->CanSeek(target))
{ {
@ -1746,7 +1725,7 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci
dir = P_FaceMobj (actor, target, &delta); dir = P_FaceMobj (actor, target, &delta);
if (delta > thresh) if (delta > thresh)
{ {
delta >>= 1; delta /= 2;
if (delta > turnMax) if (delta > turnMax)
{ {
delta = turnMax; delta = turnMax;
@ -1754,18 +1733,16 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci
} }
if (dir) if (dir)
{ // Turn clockwise { // Turn clockwise
actor->angle += delta; actor->Angles.Yaw += delta;
} }
else else
{ // Turn counter clockwise { // Turn counter clockwise
actor->angle -= delta; actor->Angles.Yaw -= delta;
} }
angle = actor->angle>>ANGLETOFINESHIFT;
if (!precise) if (!precise)
{ {
actor->vel.x = FixedMul (speed, finecosine[angle]); actor->VelFromAngle(speed);
actor->vel.y = FixedMul (speed, finesine[angle]);
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{ {
@ -1783,25 +1760,19 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci
} }
else else
{ {
angle_t pitch = 0; DAngle pitch = 0;
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{ // Need to seek vertically { // Need to seek vertically
fixedvec2 vec = actor->Vec2To(target); fixed_t dist = MAX(1, actor->Distance2D(target));
double dist = MAX(1.0, DVector2(vec.x, vec.y).Length());
// Aim at a player's eyes and at the middle of the actor for everything else. // Aim at a player's eyes and at the middle of the actor for everything else.
fixed_t aimheight = target->height/2; fixed_t aimheight = target->height/2;
if (target->IsKindOf(RUNTIME_CLASS(APlayerPawn))) if (target->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
{ {
aimheight = static_cast<APlayerPawn *>(target)->ViewHeight; aimheight = static_cast<APlayerPawn *>(target)->ViewHeight;
} }
pitch = R_PointToAngle2(0, actor->Z() + actor->height/2, xs_CRoundToInt(dist), target->Z() + aimheight); pitch = ANGLE2DBL(R_PointToAngle2(0, actor->Z() + actor->height/2, dist, target->Z() + aimheight));
pitch >>= ANGLETOFINESHIFT;
} }
actor->Vel3DFromAngle(pitch, speed);
fixed_t xyscale = FixedMul(speed, finecosine[pitch]);
actor->vel.z = FixedMul(speed, finesine[pitch]);
actor->vel.x = FixedMul(xyscale, finecosine[angle]);
actor->vel.y = FixedMul(xyscale, finesine[angle]);
} }
return true; return true;
@ -1820,7 +1791,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
{ {
static int pushtime = 0; static int pushtime = 0;
bool bForceSlide = scrollx || scrolly; bool bForceSlide = scrollx || scrolly;
angle_t angle; DAngle Angle;
fixed_t ptryx, ptryy; fixed_t ptryx, ptryy;
player_t *player; player_t *player;
fixed_t xmove, ymove; fixed_t xmove, ymove;
@ -1983,7 +1954,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
FCheckPosition tm(!!(mo->flags2 & MF2_RIP)); FCheckPosition tm(!!(mo->flags2 & MF2_RIP));
angle_t oldangle = mo->angle; angle_t oldangle = mo->_f_angle();
do do
{ {
if (i_compatflags & COMPATF_WALLRUN) pushtime++; if (i_compatflags & COMPATF_WALLRUN) pushtime++;
@ -2123,7 +2094,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
// Don't change the angle if there's THRUREFLECT on the monster. // Don't change the angle if there's THRUREFLECT on the monster.
if (!(BlockingMobj->flags7 & MF7_THRUREFLECT)) if (!(BlockingMobj->flags7 & MF7_THRUREFLECT))
{ {
angle = BlockingMobj->AngleTo(mo); DAngle angle = BlockingMobj->_f_AngleTo(mo);
bool dontReflect = (mo->AdjustReflectionAngle(BlockingMobj, angle)); bool dontReflect = (mo->AdjustReflectionAngle(BlockingMobj, angle));
// Change angle for deflection/reflection // Change angle for deflection/reflection
@ -2149,17 +2120,15 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
{ {
if ((BlockingMobj->flags7 & MF7_MIRRORREFLECT) && (tg | blockingtg)) if ((BlockingMobj->flags7 & MF7_MIRRORREFLECT) && (tg | blockingtg))
{ {
mo->angle += ANGLE_180; mo->Angles.Yaw += 180.;
mo->vel.x = -mo->vel.x / 2; mo->vel.x = -mo->vel.x / 2;
mo->vel.y = -mo->vel.y / 2; mo->vel.y = -mo->vel.y / 2;
mo->vel.z = -mo->vel.z / 2; mo->vel.z = -mo->vel.z / 2;
} }
else else
{ {
mo->angle = angle; mo->Angles.Yaw = angle;
angle >>= ANGLETOFINESHIFT; mo->VelFromAngle(mo->Speed / 2);
mo->vel.x = FixedMul(mo->Speed >> 1, finecosine[angle]);
mo->vel.y = FixedMul(mo->Speed >> 1, finesine[angle]);
mo->vel.z = -mo->vel.z / 2; mo->vel.z = -mo->vel.z / 2;
} }
} }
@ -2220,7 +2189,7 @@ explode:
} }
else else
{ {
angle_t anglediff = (mo->angle - oldangle) >> ANGLETOFINESHIFT; angle_t anglediff = (mo->_f_angle() - oldangle) >> ANGLETOFINESHIFT;
if (anglediff != 0) if (anglediff != 0)
{ {
@ -2229,7 +2198,7 @@ explode:
xmove = xnew; xmove = xnew;
ymove = ynew; ymove = ynew;
oldangle = mo->angle; // in case more moves are needed this needs to be updated. oldangle = mo->_f_angle(); // in case more moves are needed this needs to be updated.
} }
startx = mo->X() - Scale (xmove, step, steps); startx = mo->X() - Scale (xmove, step, steps);
@ -2855,7 +2824,7 @@ void P_NightmareRespawn (AActor *mobj)
mo->SpawnPoint[2] = mobj->SpawnPoint[2]; mo->SpawnPoint[2] = mobj->SpawnPoint[2];
mo->SpawnAngle = mobj->SpawnAngle; mo->SpawnAngle = mobj->SpawnAngle;
mo->SpawnFlags = mobj->SpawnFlags & ~MTF_DORMANT; // It wasn't dormant when it died, so it's not dormant now, either. mo->SpawnFlags = mobj->SpawnFlags & ~MTF_DORMANT; // It wasn't dormant when it died, so it's not dormant now, either.
mo->angle = ANG45 * (mobj->SpawnAngle/45); mo->Angles.Yaw = mobj->SpawnAngle;
mo->HandleSpawnFlags (); mo->HandleSpawnFlags ();
mo->reactiontime = 18; mo->reactiontime = 18;
@ -3119,37 +3088,37 @@ int AActor::SpecialMissileHit (AActor *victim)
return -1; return -1;
} }
bool AActor::AdjustReflectionAngle (AActor *thing, angle_t &angle) bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle)
{ {
if (flags2 & MF2_DONTREFLECT) return true; if (flags2 & MF2_DONTREFLECT) return true;
if (thing->flags7 & MF7_THRUREFLECT) return false; if (thing->flags7 & MF7_THRUREFLECT) return false;
// Change angle for reflection // Change angle for reflection
if (thing->flags4&MF4_SHIELDREFLECT) if (thing->flags4&MF4_SHIELDREFLECT)
{ {
// Shield reflection (from the Centaur // Shield reflection (from the Centaur)
if (absangle(angle - thing->angle)>>24 > 45) if (diffangle(angle, thing->Angles.Yaw) > 45)
return true; // Let missile explode return true; // Let missile explode
if (thing->IsKindOf (RUNTIME_CLASS(AHolySpirit))) // shouldn't this be handled by another flag??? if (thing->IsKindOf (RUNTIME_CLASS(AHolySpirit))) // shouldn't this be handled by another flag???
return true; return true;
if (pr_reflect () < 128) if (pr_reflect () < 128)
angle += ANGLE_45; angle += 45;
else else
angle -= ANGLE_45; angle -= 45;
} }
else if (thing->flags4&MF4_DEFLECT) else if (thing->flags4&MF4_DEFLECT)
{ {
// deflect (like the Heresiarch) // deflect (like the Heresiarch)
if(pr_reflect() < 128) if(pr_reflect() < 128)
angle += ANG45; angle += 45;
else else
angle -= ANG45; angle -= 45;
} }
else else
{ {
angle += ANGLE_1 * ((pr_reflect() % 16) - 8); angle += ((pr_reflect() % 16) - 8);
} }
//Always check for AIMREFLECT, no matter what else is checked above. //Always check for AIMREFLECT, no matter what else is checked above.
if (thing->flags7 & MF7_AIMREFLECT) if (thing->flags7 & MF7_AIMREFLECT)
@ -3219,7 +3188,7 @@ bool AActor::IsOkayToAttack (AActor *link)
// to only allow the check to succeed if the enemy was in a ~84<38> FOV of the player // to only allow the check to succeed if the enemy was in a ~84<38> FOV of the player
if (flags3 & MF3_SCREENSEEKER) if (flags3 & MF3_SCREENSEEKER)
{ {
angle_t angle = Friend->AngleTo(link) - Friend->angle; angle_t angle = Friend->AngleTo(link) - Friend->_f_angle();
angle >>= 24; angle >>= 24;
if (angle>226 || angle<30) if (angle>226 || angle<30)
{ {
@ -3244,11 +3213,11 @@ void AActor::SetShade (int r, int g, int b)
fillcolor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b); fillcolor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
} }
void AActor::SetPitch(int p, bool interpolate, bool forceclamp) void AActor::SetPitch(DAngle p, bool interpolate, bool forceclamp)
{ {
if (player != NULL || forceclamp) if (player != NULL || forceclamp)
{ // clamp the pitch we set { // clamp the pitch we set
int min, max; DAngle min, max;
if (player != NULL) if (player != NULL)
{ {
@ -3257,14 +3226,14 @@ void AActor::SetPitch(int p, bool interpolate, bool forceclamp)
} }
else else
{ {
min = -ANGLE_90 + (1 << ANGLETOFINESHIFT); min = -89.;
max = ANGLE_90 - (1 << ANGLETOFINESHIFT); max = 89.;
} }
p = clamp<int>(p, min, max); p = clamp(p, min, max);
} }
if (p != pitch) if (p != Angles.Pitch)
{ {
pitch = p; Angles.Pitch = p;
if (player != NULL && interpolate) if (player != NULL && interpolate)
{ {
player->cheats |= CF_INTERPVIEW; player->cheats |= CF_INTERPVIEW;
@ -3272,11 +3241,11 @@ void AActor::SetPitch(int p, bool interpolate, bool forceclamp)
} }
} }
void AActor::SetAngle(angle_t ang, bool interpolate) void AActor::SetAngle(DAngle ang, bool interpolate)
{ {
if (ang != angle) if (ang != Angles.Yaw)
{ {
angle = ang; Angles.Yaw = ang;
if (player != NULL && interpolate) if (player != NULL && interpolate)
{ {
player->cheats |= CF_INTERPVIEW; player->cheats |= CF_INTERPVIEW;
@ -3284,11 +3253,11 @@ void AActor::SetAngle(angle_t ang, bool interpolate)
} }
} }
void AActor::SetRoll(angle_t r, bool interpolate) void AActor::SetRoll(DAngle r, bool interpolate)
{ {
if (r != roll) if (r != Angles.Roll)
{ {
roll = r; Angles.Roll = r;
if (player != NULL && interpolate) if (player != NULL && interpolate)
{ {
player->cheats |= CF_INTERPVIEW; player->cheats |= CF_INTERPVIEW;
@ -4453,7 +4422,7 @@ void AActor::PostBeginPlay ()
{ {
Renderer->StateChanged(this); Renderer->StateChanged(this);
} }
PrevAngle = angle; PrevAngles = Angles;
flags7 |= MF7_HANDLENODELAY; flags7 |= MF7_HANDLENODELAY;
} }
@ -4613,7 +4582,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
APlayerPawn *mobj, *oldactor; APlayerPawn *mobj, *oldactor;
BYTE state; BYTE state;
fixed_t spawn_x, spawn_y, spawn_z; fixed_t spawn_x, spawn_y, spawn_z;
angle_t spawn_angle; DAngle SpawnAngle;
if (mthing == NULL) if (mthing == NULL)
{ {
@ -4672,25 +4641,18 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
spawn_y = p->mo->Y(); spawn_y = p->mo->Y();
spawn_z = p->mo->Z(); spawn_z = p->mo->Z();
spawn_angle = p->mo->angle; SpawnAngle = p->mo->Angles.Yaw;
} }
else else
{ {
spawn_x = mthing->x; spawn_x = mthing->x;
spawn_y = mthing->y; spawn_y = mthing->y;
// Allow full angular precision but avoid roundoff errors for multiples of 45 degrees. // Allow full angular precision
if (mthing->angle % 45 != 0) SpawnAngle = mthing->angle;
{
spawn_angle = mthing->angle * (ANG45 / 45);
}
else
{
spawn_angle = ANG45 * (mthing->angle / 45);
}
if (i_compatflags2 & COMPATF2_BADANGLES) if (i_compatflags2 & COMPATF2_BADANGLES)
{ {
spawn_angle += 1 << ANGLETOFINESHIFT; SpawnAngle += 0.01;
} }
if (GetDefaultByType(p->cls)->flags & MF_SPAWNCEILING) if (GetDefaultByType(p->cls)->flags & MF_SPAWNCEILING)
@ -4741,8 +4703,8 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
mobj->Translation = TRANSLATION(TRANSLATION_Players,playernum); mobj->Translation = TRANSLATION(TRANSLATION_Players,playernum);
} }
mobj->angle = spawn_angle; mobj->Angles.Yaw = SpawnAngle;
mobj->pitch = mobj->roll = 0; mobj->Angles.Pitch = mobj->Angles.Roll = 0;
mobj->health = p->health; mobj->health = p->health;
// [RH] Set player sprite based on skin // [RH] Set player sprite based on skin
@ -4829,7 +4791,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
if (multiplayer) if (multiplayer)
{ {
unsigned an = mobj->angle >> ANGLETOFINESHIFT; unsigned an = mobj->_f_angle() >> ANGLETOFINESHIFT;
Spawn ("TeleportFog", mobj->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE); Spawn ("TeleportFog", mobj->Vec3Offset(20*finecosine[an], 20*finesine[an], TELEFOGHEIGHT), ALLOW_REPLACE);
} }
@ -4946,7 +4908,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
polyspawn->x = mthing->x; polyspawn->x = mthing->x;
polyspawn->y = mthing->y; polyspawn->y = mthing->y;
polyspawn->angle = mthing->angle; polyspawn->angle = mthing->angle;
polyspawn->type = mentry->Special; polyspawn->type = mentry->Special;
polyspawns = polyspawn; polyspawns = polyspawn;
if (mentry->Special != SMT_PolyAnchor) if (mentry->Special != SMT_PolyAnchor)
po_NumPolyobjs++; po_NumPolyobjs++;
@ -5205,7 +5167,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
mobj->tid = mthing->thingid; mobj->tid = mthing->thingid;
mobj->AddToHash (); mobj->AddToHash ();
mobj->PrevAngle = mobj->angle = (DWORD)((mthing->angle * CONST64(0x100000000)) / 360); mobj->PrevAngles.Yaw = mobj->Angles.Yaw = mthing->angle;
// Check if this actor's mapthing has a conversation defined // Check if this actor's mapthing has a conversation defined
if (mthing->Conversation > 0) if (mthing->Conversation > 0)
@ -5229,9 +5191,9 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
if (mthing->scaleY) if (mthing->scaleY)
mobj->scaleY = FixedMul(mthing->scaleY, mobj->scaleY); mobj->scaleY = FixedMul(mthing->scaleY, mobj->scaleY);
if (mthing->pitch) if (mthing->pitch)
mobj->pitch = ANGLE_1 * mthing->pitch; mobj->Angles.Pitch = mthing->pitch;
if (mthing->roll) if (mthing->roll)
mobj->roll = ANGLE_1 * mthing->roll; mobj->Angles.Roll = mthing->roll;
if (mthing->score) if (mthing->score)
mobj->Score = mthing->score; mobj->Score = mthing->score;
if (mthing->fillcolor) if (mthing->fillcolor)
@ -5295,7 +5257,7 @@ AActor *P_SpawnPuff (AActor *source, PClassActor *pufftype, fixed_t x, fixed_t y
puff->target = source; puff->target = source;
// Angle is the opposite of the hit direction (i.e. the puff faces the source.) // Angle is the opposite of the hit direction (i.e. the puff faces the source.)
puff->angle = hitdir + ANGLE_180; puff->Angles.Yaw = ANGLE2DBL(hitdir + ANGLE_180);
// If a puff has a crash state and an actor was not hit, // If a puff has a crash state and an actor was not hit,
// it will enter the crash state. This is used by the StrifeSpark // it will enter the crash state. This is used by the StrifeSpark
@ -5361,7 +5323,7 @@ void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, angle_t dir, int damage, AAc
z += pr_spawnblood.Random2 () << 10; z += pr_spawnblood.Random2 () << 10;
th = Spawn (bloodcls, x, y, z, NO_REPLACE); // GetBloodType already performed the replacement th = Spawn (bloodcls, x, y, z, NO_REPLACE); // GetBloodType already performed the replacement
th->vel.z = FRACUNIT*2; th->vel.z = FRACUNIT*2;
th->angle = dir; th->Angles.Yaw = ANGLE2DBL(dir);
// [NG] Applying PUFFGETSOWNER to the blood will make it target the owner // [NG] Applying PUFFGETSOWNER to the blood will make it target the owner
if (th->flags5 & MF5_PUFFGETSOWNER) th->target = originator; if (th->flags5 & MF5_PUFFGETSOWNER) th->target = originator;
if (gameinfo.gametype & GAME_DoomChex) if (gameinfo.gametype & GAME_DoomChex)
@ -6029,7 +5991,7 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
th->vel.y = newy; th->vel.y = newy;
} }
th->angle = R_PointToAngle2 (0, 0, th->vel.x, th->vel.y); th->AngleFromVel();
if (th->flags4 & MF4_SPECTRAL) if (th->flags4 & MF4_SPECTRAL)
{ {
@ -6045,17 +6007,14 @@ AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassAct
{ {
return NULL; return NULL;
} }
angle_t an;
fixed_t dist; fixed_t dist;
AActor *th = Spawn (type, source->PosPlusZ(4*8*FRACUNIT), ALLOW_REPLACE); AActor *th = Spawn (type, source->PosPlusZ(4*8*FRACUNIT), ALLOW_REPLACE);
P_PlaySpawnSound(th, source); P_PlaySpawnSound(th, source);
th->target = owner; // record missile's originator th->target = owner; // record missile's originator
th->angle = an = source->AngleTo(dest); th->Angles.Yaw = source->_f_AngleTo(dest);
an >>= ANGLETOFINESHIFT; th->VelFromAngle();
th->vel.x = FixedMul (th->Speed, finecosine[an]);
th->vel.y = FixedMul (th->Speed, finesine[an]);
dist = source->AproxDistance (dest); dist = source->AproxDistance (dest);
if (th->Speed) dist = dist / th->Speed; if (th->Speed) dist = dist / th->Speed;
@ -6112,7 +6071,7 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, PClassAct
fixed_t speed; fixed_t speed;
fixed_t vz; fixed_t vz;
an = source->angle; an = source->_f_angle();
if (dest->flags & MF_SHADOW) if (dest->flags & MF_SHADOW)
{ {
@ -6164,10 +6123,8 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
P_PlaySpawnSound(mo, source); P_PlaySpawnSound(mo, source);
if (owner == NULL) owner = source; if (owner == NULL) owner = source;
mo->target = owner; mo->target = owner;
mo->angle = angle; mo->Angles.Yaw = ANGLE2DBL(angle);
angle >>= ANGLETOFINESHIFT; mo->VelFromAngle(speed);
mo->vel.x = FixedMul (speed, finecosine[angle]);
mo->vel.y = FixedMul (speed, finesine[angle]);
mo->vel.z = vz; mo->vel.z = vz;
if (mo->flags4 & MF4_SPECTRAL) if (mo->flags4 & MF4_SPECTRAL)
@ -6193,7 +6150,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type)
{ {
return NULL; return NULL;
} }
return P_SpawnPlayerMissile (source, 0, 0, 0, type, source->angle); return P_SpawnPlayerMissile (source, 0, 0, 0, type, source->_f_angle());
} }
AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, angle_t angle) AActor *P_SpawnPlayerMissile (AActor *source, PClassActor *type, angle_t angle)
@ -6221,7 +6178,7 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
{ {
// Keep exactly the same angle and pitch as the player's own aim // Keep exactly the same angle and pitch as the player's own aim
an = angle; an = angle;
pitch = source->pitch; pitch = source->_f_pitch();
pLineTarget->linetarget = NULL; pLineTarget->linetarget = NULL;
} }
else // see which target is to be aimed at else // see which target is to be aimed at
@ -6279,25 +6236,15 @@ AActor *P_SpawnPlayerMissile (AActor *source, fixed_t x, fixed_t y, fixed_t z,
if (pMissileActor) *pMissileActor = MissileActor; if (pMissileActor) *pMissileActor = MissileActor;
P_PlaySpawnSound(MissileActor, source); P_PlaySpawnSound(MissileActor, source);
MissileActor->target = source; MissileActor->target = source;
MissileActor->angle = an; MissileActor->Angles.Yaw = ANGLE2DBL(an);
if (MissileActor->flags3 & (MF3_FLOORHUGGER | MF3_CEILINGHUGGER))
fixed_t vx, vy, vz, speed;
vx = FixedMul (finecosine[pitch>>ANGLETOFINESHIFT], finecosine[an>>ANGLETOFINESHIFT]);
vy = FixedMul (finecosine[pitch>>ANGLETOFINESHIFT], finesine[an>>ANGLETOFINESHIFT]);
vz = -finesine[pitch>>ANGLETOFINESHIFT];
speed = MissileActor->Speed;
DVector3 vec(vx, vy, vz);
if (MissileActor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))
{ {
vec.Z = 0; MissileActor->VelFromAngle();
}
else
{
MissileActor->Vel3DFromAngle(ANGLE2DBL(pitch), MissileActor->Speed);
} }
vec.Resize(speed);
MissileActor->vel.x = xs_CRoundToInt(vec.X);
MissileActor->vel.y = xs_CRoundToInt(vec.Y);
MissileActor->vel.z = xs_CRoundToInt(vec.Z);
if (MissileActor->flags4 & MF4_SPECTRAL) if (MissileActor->flags4 & MF4_SPECTRAL)
{ {

View file

@ -932,7 +932,7 @@ angle_t P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget, int aimfl
i = 2; i = 2;
do do
{ {
an = mo->angle + angdiff[i]; an = mo->_f_angle() + angdiff[i];
pitch = P_AimLineAttack (mo, an, 16*64*FRACUNIT, pLineTarget, 0, aimflags); pitch = P_AimLineAttack (mo, an, 16*64*FRACUNIT, pLineTarget, 0, aimflags);
if (mo->player != NULL && if (mo->player != NULL &&
@ -956,7 +956,7 @@ void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, angle_t pitch)
int damage; int damage;
damage = 5*(pr_gunshot()%3+1); damage = 5*(pr_gunshot()%3+1);
angle = mo->angle; angle = mo->_f_angle();
if (!accurate) if (!accurate)
{ {

View file

@ -919,7 +919,7 @@ inline void P_SpawnTeleportFog(AActor *mobj, const fixedvec3 &pos, bool beforeTe
{ {
P_SpawnTeleportFog(mobj, pos.x, pos.y, pos.z, beforeTele, setTarget); P_SpawnTeleportFog(mobj, pos.x, pos.y, pos.z, beforeTele, setTarget);
} }
bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int flags); // bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, int flags); // bool useFog, bool sourceFog, bool keepOrientation, bool haltVelocity = true, bool keepHeight = false
bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int flags); bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int flags);
bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse); bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBOOL reverse);
bool EV_TeleportOther (int other_tid, int dest_tid, bool fog); bool EV_TeleportOther (int other_tid, int dest_tid, bool fog);

View file

@ -143,8 +143,8 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, fixedvec3 *optpo
fixedvec3 pos = optpos? *optpos : user->PosRelative(line); fixedvec3 pos = optpos? *optpos : user->PosRelative(line);
dlu.x = pos.x; dlu.x = pos.x;
dlu.y = pos.y; dlu.y = pos.y;
dlu.dx = finecosine[user->angle >> ANGLETOFINESHIFT]; dlu.dx = finecosine[user->_f_angle() >> ANGLETOFINESHIFT];
dlu.dy = finesine[user->angle >> ANGLETOFINESHIFT]; dlu.dy = finesine[user->_f_angle() >> ANGLETOFINESHIFT];
inter = P_InterceptVector(&dll, &dlu); inter = P_InterceptVector(&dll, &dlu);

View file

@ -99,7 +99,7 @@ void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool befo
// TELEPORTATION // TELEPORTATION
// //
bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, int flags) bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, DAngle angle, int flags)
{ {
bool predicting = (thing->player && (thing->player->cheats & CF_PREDICTING)); bool predicting = (thing->player && (thing->player->cheats & CF_PREDICTING));
@ -171,16 +171,16 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
player->viewz = thing->Z() + player->viewheight; player->viewz = thing->Z() + player->viewheight;
if (resetpitch) if (resetpitch)
{ {
player->mo->pitch = 0; player->mo->Angles.Pitch = 0;
} }
} }
if (!(flags & TELF_KEEPORIENTATION)) if (!(flags & TELF_KEEPORIENTATION))
{ {
thing->angle = angle; thing->Angles.Yaw = angle;
} }
else else
{ {
angle = thing->angle; angle = thing->Angles.Yaw;
} }
// Spawn teleport fog at source and destination // Spawn teleport fog at source and destination
if ((flags & TELF_SOURCEFOG) && !predicting) if ((flags & TELF_SOURCEFOG) && !predicting)
@ -214,9 +214,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
} }
if (thing->flags & MF_MISSILE) if (thing->flags & MF_MISSILE)
{ {
angle >>= ANGLETOFINESHIFT; thing->VelFromAngle(missilespeed);
thing->vel.x = FixedMul (missilespeed, finecosine[angle]);
thing->vel.y = FixedMul (missilespeed, finesine[angle]);
} }
// [BC] && bHaltVelocity. // [BC] && bHaltVelocity.
else if (!(flags & TELF_KEEPORIENTATION) && !(flags & TELF_KEEPVELOCITY)) else if (!(flags & TELF_KEEPORIENTATION) && !(flags & TELF_KEEPVELOCITY))
@ -328,10 +326,10 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f
{ {
AActor *searcher; AActor *searcher;
fixed_t z; fixed_t z;
angle_t angle = 0; DAngle angle = 0;
fixed_t s = 0, c = 0; fixed_t s = 0, c = 0;
fixed_t vx = 0, vy = 0; fixed_t vx = 0, vy = 0;
angle_t badangle = 0; DAngle badangle = 0;
if (thing == NULL) if (thing == NULL)
{ // Teleport function called with an invalid actor { // Teleport function called with an invalid actor
@ -358,11 +356,11 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f
// Rotate 90 degrees, so that walking perpendicularly across // Rotate 90 degrees, so that walking perpendicularly across
// teleporter linedef causes thing to exit in the direction // teleporter linedef causes thing to exit in the direction
// indicated by the exit thing. // indicated by the exit thing.
angle = R_PointToAngle2 (0, 0, line->dx, line->dy) - searcher->angle + ANG90; angle = vectoyaw(DVector2(line->dx, line->dy)) - searcher->Angles.Yaw + 90;
// Sine, cosine of angle adjustment // Sine, cosine of angle adjustment
s = finesine[angle>>ANGLETOFINESHIFT]; s = FLOAT2FIXED(angle.Sin());
c = finecosine[angle>>ANGLETOFINESHIFT]; c = FLOAT2FIXED(angle.Cos());
// Velocity of thing crossing teleporter linedef // Velocity of thing crossing teleporter linedef
vx = thing->vel.x; vx = thing->vel.x;
@ -380,15 +378,15 @@ bool EV_Teleport (int tid, int tag, line_t *line, int side, AActor *thing, int f
} }
if ((i_compatflags2 & COMPATF2_BADANGLES) && (thing->player != NULL)) if ((i_compatflags2 & COMPATF2_BADANGLES) && (thing->player != NULL))
{ {
badangle = 1 << ANGLETOFINESHIFT; badangle = 0.01;
} }
if (P_Teleport (thing, searcher->X(), searcher->Y(), z, searcher->angle + badangle, flags)) if (P_Teleport (thing, searcher->X(), searcher->Y(), z, searcher->Angles.Yaw + badangle, flags))
{ {
// [RH] Lee Killough's changes for silent teleporters from BOOM // [RH] Lee Killough's changes for silent teleporters from BOOM
if (!(flags & TELF_DESTFOG) && line && (flags & TELF_KEEPORIENTATION)) if (!(flags & TELF_DESTFOG) && line && (flags & TELF_KEEPORIENTATION))
{ {
// Rotate thing according to difference in angles // Rotate thing according to difference in angles
thing->angle += angle; thing->Angles.Yaw += angle;
// Rotate thing's velocity to come out of exit just like it entered // Rotate thing's velocity to come out of exit just like it entered
thing->vel.x = FixedMul(vx, c) - FixedMul(vy, s); thing->vel.x = FixedMul(vx, c) - FixedMul(vy, s);
@ -551,7 +549,7 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
} }
// Rotate thing's orientation according to difference in linedef angles // Rotate thing's orientation according to difference in linedef angles
thing->angle += angle; thing->Angles.Yaw += ANGLE2DBL(angle);
// Velocity of thing crossing teleporter linedef // Velocity of thing crossing teleporter linedef
x = thing->vel.x; x = thing->vel.x;
@ -611,10 +609,9 @@ bool EV_TeleportOther (int other_tid, int dest_tid, bool fog)
static bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool floorz, bool fog) static bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool floorz, bool fog)
{ {
int an = (dest->angle - source->angle) >> ANGLETOFINESHIFT; int an = (dest->_f_angle() - source->_f_angle()) >> ANGLETOFINESHIFT;
fixed_t offX = victim->X() - source->X(); fixed_t offX = victim->X() - source->X();
fixed_t offY = victim->Y() - source->Y(); fixed_t offY = victim->Y() - source->Y();
angle_t offAngle = victim->angle - source->angle;
fixed_t newX = DMulScale16 (offX, finecosine[an], -offY, finesine[an]); fixed_t newX = DMulScale16 (offX, finecosine[an], -offY, finesine[an]);
fixed_t newY = DMulScale16 (offX, finesine[an], offY, finecosine[an]); fixed_t newY = DMulScale16 (offX, finesine[an], offY, finecosine[an]);
@ -624,7 +621,7 @@ static bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool fl
floorz ? ONFLOORZ : dest->Z() + victim->Z() - source->Z(), floorz ? ONFLOORZ : dest->Z() + victim->Z() - source->Z(),
0, fog ? (TELF_DESTFOG | TELF_SOURCEFOG) : TELF_KEEPORIENTATION); 0, fog ? (TELF_DESTFOG | TELF_SOURCEFOG) : TELF_KEEPORIENTATION);
// P_Teleport only changes angle if fog is true // P_Teleport only changes angle if fog is true
victim->angle = dest->angle + offAngle; victim->Angles.Yaw = (dest->Angles.Yaw + victim->Angles.Yaw - source->Angles.Yaw).Normalized360();
return res; return res;
} }
@ -632,7 +629,7 @@ static bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool fl
#if 0 #if 0
static void MoveTheDecal (DBaseDecal *decal, fixed_t z, AActor *source, AActor *dest) static void MoveTheDecal (DBaseDecal *decal, fixed_t z, AActor *source, AActor *dest)
{ {
int an = (dest->angle - source->angle) >> ANGLETOFINESHIFT; int an = (dest->_f_angle() - source->_f_angle()) >> ANGLETOFINESHIFT;
fixed_t offX = decal->x - source->x; fixed_t offX = decal->x - source->x;
fixed_t offY = decal->y - source->y; fixed_t offY = decal->y - source->y;
fixed_t newX = DMulScale16 (offX, finecosine[an], -offY, finesine[an]); fixed_t newX = DMulScale16 (offX, finecosine[an], -offY, finesine[an]);
@ -691,7 +688,7 @@ bool EV_TeleportGroup (int group_tid, AActor *victim, int source_tid, int dest_t
didSomething |= didSomething |=
P_Teleport (sourceOrigin, destOrigin->X(), destOrigin->Y(), P_Teleport (sourceOrigin, destOrigin->X(), destOrigin->Y(),
floorz ? ONFLOORZ : destOrigin->Z(), 0, TELF_KEEPORIENTATION); floorz ? ONFLOORZ : destOrigin->Z(), 0, TELF_KEEPORIENTATION);
sourceOrigin->angle = destOrigin->angle; sourceOrigin->Angles.Yaw = destOrigin->Angles.Yaw;
} }
return didSomething; return didSomething;

View file

@ -57,7 +57,7 @@ FClassMap SpawnableThings;
static FRandom pr_leadtarget ("LeadTarget"); static FRandom pr_leadtarget ("LeadTarget");
bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog, int newtid) bool P_Thing_Spawn (int tid, AActor *source, int type, DAngle angle, bool fog, int newtid)
{ {
int rtn = 0; int rtn = 0;
PClassActor *kind; PClassActor *kind;
@ -95,7 +95,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog,
if (P_TestMobjLocation (mobj)) if (P_TestMobjLocation (mobj))
{ {
rtn++; rtn++;
mobj->angle = (angle != ANGLE_MAX ? angle : spot->angle); mobj->Angles.Yaw = (angle != 1000000. ? angle : spot->Angles.Yaw);
if (fog) if (fog)
{ {
P_SpawnTeleportFog(mobj, spot->X(), spot->Y(), spot->Z() + TELEFOGHEIGHT, false, true); P_SpawnTeleportFog(mobj, spot->X(), spot->Y(), spot->Z() + TELEFOGHEIGHT, false, true);
@ -172,7 +172,7 @@ bool P_Thing_Move (int tid, AActor *source, int mapspot, bool fog)
return false; return false;
} }
bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_name, angle_t angle, bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_name, DAngle angle,
fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid, fixed_t speed, fixed_t vspeed, int dest, AActor *forcedest, int gravity, int newtid,
bool leadTarget) bool leadTarget)
{ {
@ -303,12 +303,12 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
mobj->vel.x = fixed_t (aimvec[0] * aimscale); mobj->vel.x = fixed_t (aimvec[0] * aimscale);
mobj->vel.y = fixed_t (aimvec[1] * aimscale); mobj->vel.y = fixed_t (aimvec[1] * aimscale);
mobj->vel.z = fixed_t (aimvec[2] * aimscale); mobj->vel.z = fixed_t (aimvec[2] * aimscale);
mobj->angle = R_PointToAngle2 (0, 0, mobj->vel.x, mobj->vel.y); mobj->AngleFromVel();
} }
else else
{ {
nolead: nolead:
mobj->angle = mobj->AngleTo(targ); mobj->Angles.Yaw = mobj->_f_AngleTo(targ);
aim.Resize (fspeed); aim.Resize (fspeed);
mobj->vel.x = fixed_t(aim[0]); mobj->vel.x = fixed_t(aim[0]);
mobj->vel.y = fixed_t(aim[1]); mobj->vel.y = fixed_t(aim[1]);
@ -321,9 +321,8 @@ nolead:
} }
else else
{ {
mobj->angle = angle; mobj->Angles.Yaw = angle;
mobj->vel.x = FixedMul (speed, finecosine[angle>>ANGLETOFINESHIFT]); mobj->VelFromAngle();
mobj->vel.y = FixedMul (speed, finesine[angle>>ANGLETOFINESHIFT]);
mobj->vel.z = vspeed; mobj->vel.z = vspeed;
} }
// Set the missile's speed to reflect the speed it was spawned at. // Set the missile's speed to reflect the speed it was spawned at.
@ -701,7 +700,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
if (!(flags & WARPF_ABSOLUTEANGLE)) if (!(flags & WARPF_ABSOLUTEANGLE))
{ {
angle += (flags & WARPF_USECALLERANGLE) ? caller->angle : reference->angle; angle += (flags & WARPF_USECALLERANGLE) ? caller->_f_angle() : reference->_f_angle();
} }
const fixed_t rad = FixedMul(radiusoffset, reference->radius); const fixed_t rad = FixedMul(radiusoffset, reference->radius);
@ -762,13 +761,13 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs,
} }
else else
{ {
caller->angle = angle; caller->Angles.Yaw = ANGLE2DBL(angle);
if (flags & WARPF_COPYPITCH) if (flags & WARPF_COPYPITCH)
caller->SetPitch(reference->pitch, false); caller->SetPitch(reference->Angles.Pitch, false);
if (pitch) if (pitch)
caller->SetPitch(caller->pitch + pitch, false); caller->SetPitch(caller->Angles.Pitch + ANGLE2DBL(pitch), false);
if (flags & WARPF_COPYVELOCITY) if (flags & WARPF_COPYVELOCITY)
{ {

View file

@ -1660,7 +1660,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullPop)
mo->ObtainInventory (self); mo->ObtainInventory (self);
mo->player = player; mo->player = player;
mo->health = self->health; mo->health = self->health;
mo->angle = self->angle; mo->Angles.Yaw = self->Angles.Yaw;
if (player != NULL) if (player != NULL)
{ {
player->mo = mo; player->mo = mo;
@ -1768,9 +1768,9 @@ void P_ForwardThrust (player_t *player, angle_t angle, fixed_t move)
angle >>= ANGLETOFINESHIFT; angle >>= ANGLETOFINESHIFT;
if ((player->mo->waterlevel || (player->mo->flags & MF_NOGRAVITY)) if ((player->mo->waterlevel || (player->mo->flags & MF_NOGRAVITY))
&& player->mo->pitch != 0) && player->mo->_f_pitch() != 0)
{ {
angle_t pitch = (angle_t)player->mo->pitch >> ANGLETOFINESHIFT; angle_t pitch = (angle_t)player->mo->_f_pitch() >> ANGLETOFINESHIFT;
fixed_t zpush = FixedMul (move, finesine[pitch]); fixed_t zpush = FixedMul (move, finesine[pitch]);
if (player->mo->waterlevel && player->mo->waterlevel < 2 && zpush < 0) if (player->mo->waterlevel && player->mo->waterlevel < 2 && zpush < 0)
zpush = 0; zpush = 0;
@ -1796,9 +1796,9 @@ void P_Bob (player_t *player, angle_t angle, fixed_t move, bool forward)
{ {
if (forward if (forward
&& (player->mo->waterlevel || (player->mo->flags & MF_NOGRAVITY)) && (player->mo->waterlevel || (player->mo->flags & MF_NOGRAVITY))
&& player->mo->pitch != 0) && player->mo->_f_pitch() != 0)
{ {
angle_t pitch = (angle_t)player->mo->pitch >> ANGLETOFINESHIFT; angle_t pitch = (angle_t)player->mo->_f_pitch() >> ANGLETOFINESHIFT;
move = FixedMul (move, finecosine[pitch]); move = FixedMul (move, finecosine[pitch]);
} }
@ -1956,11 +1956,11 @@ void P_MovePlayer (player_t *player)
if (player->turnticks) if (player->turnticks)
{ {
player->turnticks--; player->turnticks--;
mo->angle += (ANGLE_180 / TURN180_TICKS); mo->Angles.Yaw += (180. / TURN180_TICKS);
} }
else else
{ {
mo->angle += cmd->ucmd.yaw << 16; mo->Angles.Yaw += cmd->ucmd.yaw * (360./65536.);
} }
player->onground = (mo->Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2); player->onground = (mo->Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
@ -2007,13 +2007,13 @@ void P_MovePlayer (player_t *player)
if (forwardmove) if (forwardmove)
{ {
P_Bob (player, mo->angle, (cmd->ucmd.forwardmove * bobfactor) >> 8, true); P_Bob (player, mo->_f_angle(), (cmd->ucmd.forwardmove * bobfactor) >> 8, true);
P_ForwardThrust (player, mo->angle, forwardmove); P_ForwardThrust (player, mo->_f_angle(), forwardmove);
} }
if (sidemove) if (sidemove)
{ {
P_Bob (player, mo->angle-ANG90, (cmd->ucmd.sidemove * bobfactor) >> 8, false); P_Bob (player, mo->_f_angle()-ANG90, (cmd->ucmd.sidemove * bobfactor) >> 8, false);
P_SideThrust (player, mo->angle, sidemove); P_SideThrust (player, mo->_f_angle(), sidemove);
} }
if (debugfile) if (debugfile)
@ -2147,8 +2147,7 @@ void P_FallingDamage (AActor *actor)
void P_DeathThink (player_t *player) void P_DeathThink (player_t *player)
{ {
int dir; int dir;
angle_t delta; DAngle delta;
int lookDelta;
P_MovePsprites (player); P_MovePsprites (player);
@ -2159,10 +2158,10 @@ void P_DeathThink (player_t *player)
player->deltaviewheight = 0; player->deltaviewheight = 0;
if (player->onground) if (player->onground)
{ {
if (player->mo->pitch > -(int)ANGLE_1*19) if (player->mo->Angles.Pitch > -19.)
{ {
lookDelta = (-(int)ANGLE_1*19 - player->mo->pitch) / 8; DAngle lookDelta = (-19. - player->mo->Angles.Pitch) / 8;
player->mo->pitch += lookDelta; player->mo->Angles.Pitch += lookDelta;
} }
} }
} }
@ -2177,17 +2176,17 @@ void P_DeathThink (player_t *player)
{ {
player->viewheight = 6*FRACUNIT; player->viewheight = 6*FRACUNIT;
} }
if (player->mo->pitch < 0) if (player->mo->Angles.Pitch < 0)
{ {
player->mo->pitch += ANGLE_1*3; player->mo->Angles.Pitch += 3;
} }
else if (player->mo->pitch > 0) else if (player->mo->Angles.Pitch > 0)
{ {
player->mo->pitch -= ANGLE_1*3; player->mo->Angles.Pitch -= 3;
} }
if (abs(player->mo->pitch) < ANGLE_1*3) if (fabs(player->mo->Angles.Pitch) < 3)
{ {
player->mo->pitch = 0; player->mo->Angles.Pitch = 0;
} }
} }
P_CalcHeight (player); P_CalcHeight (player);
@ -2195,7 +2194,7 @@ void P_DeathThink (player_t *player)
if (player->attacker && player->attacker != player->mo) if (player->attacker && player->attacker != player->mo)
{ // Watch killer { // Watch killer
dir = P_FaceMobj (player->mo, player->attacker, &delta); dir = P_FaceMobj (player->mo, player->attacker, &delta);
if (delta < ANGLE_1*10) if (delta < 10)
{ // Looking at killer, so fade damage and poison counters { // Looking at killer, so fade damage and poison counters
if (player->damagecount) if (player->damagecount)
{ {
@ -2207,17 +2206,17 @@ void P_DeathThink (player_t *player)
} }
} }
delta /= 8; delta /= 8;
if (delta > ANGLE_1*5) if (delta > 5)
{ {
delta = ANGLE_1*5; delta = 5;
} }
if (dir) if (dir)
{ // Turn clockwise { // Turn clockwise
player->mo->angle += delta; player->mo->Angles.Yaw += delta;
} }
else else
{ // Turn counter clockwise { // Turn counter clockwise
player->mo->angle -= delta; player->mo->Angles.Yaw -= delta;
} }
} }
else else
@ -2304,7 +2303,7 @@ void P_PlayerThink (player_t *player)
{ {
fprintf (debugfile, "tic %d for pl %d: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n", fprintf (debugfile, "tic %d for pl %d: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
gametic, (int)(player-players), player->mo->X(), player->mo->Y(), player->mo->Z(), gametic, (int)(player-players), player->mo->X(), player->mo->Y(), player->mo->Z(),
player->mo->angle>>ANGLETOFINESHIFT, player->cmd.ucmd.buttons, player->mo->_f_angle()>>ANGLETOFINESHIFT, player->cmd.ucmd.buttons,
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove, player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,
player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove); player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove);
} }
@ -2493,54 +2492,38 @@ void P_PlayerThink (player_t *player)
// [RH] Look up/down stuff // [RH] Look up/down stuff
if (!level.IsFreelookAllowed()) if (!level.IsFreelookAllowed())
{ {
player->mo->pitch = 0; player->mo->Angles.Pitch = 0;
} }
else else
{ {
int look = cmd->ucmd.pitch << 16;
// The player's view pitch is clamped between -32 and +56 degrees, // The player's view pitch is clamped between -32 and +56 degrees,
// which translates to about half a screen height up and (more than) // which translates to about half a screen height up and (more than)
// one full screen height down from straight ahead when view panning // one full screen height down from straight ahead when view panning
// is used. // is used.
if (look) int clook = cmd->ucmd.pitch;
if (clook != 0)
{ {
if (look == -32768 << 16) if (clook == -32768)
{ // center view { // center view
player->centering = true; player->centering = true;
} }
else if (!player->centering) else if (!player->centering)
{ {
fixed_t oldpitch = player->mo->pitch; // no more overflows with floating point. Yay! :)
player->mo->pitch -= look; player->mo->Angles.Pitch = clamp(player->mo->Angles.Pitch - clook * (360. / 65536.), player->MinPitch, player->MaxPitch);
if (look > 0)
{ // look up
player->mo->pitch = MAX(player->mo->pitch, player->MinPitch);
if (player->mo->pitch > oldpitch)
{
player->mo->pitch = player->MinPitch;
}
}
else
{ // look down
player->mo->pitch = MIN(player->mo->pitch, player->MaxPitch);
if (player->mo->pitch < oldpitch)
{
player->mo->pitch = player->MaxPitch;
}
}
} }
} }
} }
if (player->centering) if (player->centering)
{ {
if (abs(player->mo->pitch) > 2*ANGLE_1) player->mo->Angles.Pitch.Normalize180(); // make sure we are in the proper range here for the following code.
if (fabs(player->mo->Angles.Pitch) > 2.)
{ {
player->mo->pitch = FixedMul(player->mo->pitch, FRACUNIT*2/3); player->mo->Angles.Pitch *= (2. / 3.);
} }
else else
{ {
player->mo->pitch = 0; player->mo->Angles.Pitch = 0;
player->centering = false; player->centering = false;
if (player - players == consoleplayer) if (player - players == consoleplayer)
{ {
@ -3158,7 +3141,7 @@ void player_t::Serialize (FArchive &arc)
arc << LogText arc << LogText
<< ConversationNPC << ConversationNPC
<< ConversationPC << ConversationPC
<< ConversationNPCAngle << ConversationNPCAngle.Degrees
<< ConversationFaceTalker; << ConversationFaceTalker;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)

View file

@ -102,7 +102,7 @@ static int WriteTHINGS (FILE *file)
mt.x = LittleShort(short(mo->X() >> FRACBITS)); mt.x = LittleShort(short(mo->X() >> FRACBITS));
mt.y = LittleShort(short(mo->Y() >> FRACBITS)); mt.y = LittleShort(short(mo->Y() >> FRACBITS));
mt.angle = LittleShort(short(MulScale32 (mo->angle >> ANGLETOFINESHIFT, 360))); mt.angle = LittleShort(short(MulScale32 (mo->_f_angle() >> ANGLETOFINESHIFT, 360)));
mt.type = LittleShort((short)1); mt.type = LittleShort((short)1);
mt.flags = LittleShort((short)(7|224|MTF_SINGLE)); mt.flags = LittleShort((short)(7|224|MTF_SINGLE));
fwrite (&mt, sizeof(mt), 1, file); fwrite (&mt, sizeof(mt), 1, file);

View file

@ -174,8 +174,6 @@ void PO_Init (void);
// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
static void RotatePt (int an, fixed_t *x, fixed_t *y, fixed_t startSpotX,
fixed_t startSpotY);
static void UnLinkPolyobj (FPolyObj *po); static void UnLinkPolyobj (FPolyObj *po);
static void LinkPolyobj (FPolyObj *po); static void LinkPolyobj (FPolyObj *po);
static bool CheckMobjBlocking (side_t *seg, FPolyObj *po); static bool CheckMobjBlocking (side_t *seg, FPolyObj *po);
@ -1036,13 +1034,16 @@ void FPolyObj::DoMovePolyobj (int x, int y)
// //
//========================================================================== //==========================================================================
static void RotatePt (int an, fixed_t *x, fixed_t *y, fixed_t startSpotX, fixed_t startSpotY) static void RotatePt (DAngle an, fixed_t *x, fixed_t *y, fixed_t startSpotX, fixed_t startSpotY)
{ {
fixed_t tr_x = *x; fixed_t tr_x = *x;
fixed_t tr_y = *y; fixed_t tr_y = *y;
*x = (DMulScale16 (tr_x, finecosine[an], -tr_y, finesine[an]) & 0xFFFFFE00) + startSpotX; double s = an.Sin();
*y = (DMulScale16 (tr_x, finesine[an], tr_y, finecosine[an]) & 0xFFFFFE00) + startSpotY; double c = an.Cos();
*x = (xs_CRoundToInt(tr_x * c - tr_y*s) & 0xfffffe00) + startSpotX;
*y = (xs_CRoundToInt(tr_x * s + tr_y*c) & 0xfffffe00) + startSpotX;
} }
//========================================================================== //==========================================================================
@ -1053,11 +1054,11 @@ static void RotatePt (int an, fixed_t *x, fixed_t *y, fixed_t startSpotX, fixed_
bool FPolyObj::RotatePolyobj (angle_t angle, bool fromsave) bool FPolyObj::RotatePolyobj (angle_t angle, bool fromsave)
{ {
int an; DAngle an;
bool blocked; bool blocked;
FBoundingBox oldbounds = Bounds; FBoundingBox oldbounds = Bounds;
an = (this->angle+angle)>>ANGLETOFINESHIFT; an = ANGLE2DBL(this->angle + angle);
UnLinkPolyobj(); UnLinkPolyobj();

View file

@ -253,7 +253,7 @@ static void SetRotation(FLinePortal *port)
double angle = g_atan2(dst->dy, dst->dx) - g_atan2(line->dy, line->dx) + M_PI; double angle = g_atan2(dst->dy, dst->dx) - g_atan2(line->dy, line->dx) + M_PI;
port->mSinRot = FLOAT2FIXED(g_sin(angle)); port->mSinRot = FLOAT2FIXED(g_sin(angle));
port->mCosRot = FLOAT2FIXED(g_cos(angle)); port->mCosRot = FLOAT2FIXED(g_cos(angle));
port->mAngleDiff = RAD2ANGLE(angle); port->mAngleDiff = ToDegrees(angle);
} }
} }
@ -606,12 +606,12 @@ void P_TranslatePortalVXVY(line_t* src, fixed_t& vx, fixed_t& vy)
// //
//============================================================================ //============================================================================
void P_TranslatePortalAngle(line_t* src, angle_t& angle) void P_TranslatePortalAngle(line_t* src, DAngle& angle)
{ {
if (!src) return; if (!src) return;
FLinePortal *port = src->getPortal(); FLinePortal *port = src->getPortal();
if (!port) return; if (!port) return;
angle += port->mAngleDiff; angle = (angle + port->mAngleDiff).Normalized360();
} }
//============================================================================ //============================================================================

View file

@ -179,7 +179,7 @@ struct FLinePortal
BYTE mFlags; BYTE mFlags;
BYTE mDefFlags; BYTE mDefFlags;
BYTE mAlign; BYTE mAlign;
angle_t mAngleDiff; DAngle mAngleDiff;
fixed_t mSinRot; fixed_t mSinRot;
fixed_t mCosRot; fixed_t mCosRot;
}; };
@ -203,7 +203,7 @@ inline int P_NumPortalGroups()
bool P_ClipLineToPortal(line_t* line, line_t* portal, fixed_t viewx, fixed_t viewy, bool partial = true, bool samebehind = true); bool P_ClipLineToPortal(line_t* line, line_t* portal, fixed_t viewx, fixed_t viewy, bool partial = true, bool samebehind = true);
void P_TranslatePortalXY(line_t* src, fixed_t& x, fixed_t& y); void P_TranslatePortalXY(line_t* src, fixed_t& x, fixed_t& y);
void P_TranslatePortalVXVY(line_t* src, fixed_t& vx, fixed_t& vy); void P_TranslatePortalVXVY(line_t* src, fixed_t& vx, fixed_t& vy);
void P_TranslatePortalAngle(line_t* src, angle_t& angle); void P_TranslatePortalAngle(line_t* src, DAngle& angle);
void P_TranslatePortalZ(line_t* src, fixed_t& z); void P_TranslatePortalZ(line_t* src, fixed_t& z);
void P_NormalizeVXVY(fixed_t& vx, fixed_t& vy); void P_NormalizeVXVY(fixed_t& vx, fixed_t& vy);
fixed_t P_PointLineDistance(line_t* line, fixed_t x, fixed_t y); fixed_t P_PointLineDistance(line_t* line, fixed_t x, fixed_t y);

View file

@ -491,7 +491,7 @@ void SDLFB::Update ()
return; return;
pixels = Surface->pixels; pixels = Surface->pixels;
pitch = Surface->pitch; pitch = Surface->_f_pitch();
} }
if (NotPaletted) if (NotPaletted)

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