- gamecontrol: Initial setup of PlayerAngle struct and deployment within Duke.

* Struct made up of binangle class units.
* Create signed clone of binangle for use with look_ang and rotscrnang.
* Append currently outgoing function names with `2` at the end to avoid conflict.
This commit is contained in:
Mitchell Richters 2020-10-07 23:13:21 +11:00
parent e2691d4184
commit fca846272e
37 changed files with 473 additions and 304 deletions

View file

@ -55,7 +55,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
// Perform unsynchronised angle/horizon if not dead. // Perform unsynchronised angle/horizon if not dead.
if (gView->pXSprite->health != 0) if (gView->pXSprite->health != 0)
{ {
applylook(&pPlayer->q16ang, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, input.q16avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0); applylook2(&pPlayer->q16ang, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, input.q16avel, &pPlayer->input.actions, scaleAdjust, pPlayer->posture != 0);
sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust); sethorizon(&pPlayer->horizon.horiz, input.horz, &pPlayer->input.actions, scaleAdjust);
} }

View file

@ -1359,7 +1359,7 @@ void ProcessInput(PLAYER *pPlayer)
{ {
fixed_t fraggerAng = gethiq16angle(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y); fixed_t fraggerAng = gethiq16angle(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y);
pPlayer->angold = pSprite->ang = FixedToInt(fraggerAng); pPlayer->angold = pSprite->ang = FixedToInt(fraggerAng);
playerAddAngle(&pPlayer->q16ang, &pPlayer->angAdjust, FixedToFloat(getincangleq16(pPlayer->q16ang, fraggerAng))); playerAddAngle2(&pPlayer->q16ang, &pPlayer->angAdjust, FixedToFloat(getincangleq16(pPlayer->q16ang, fraggerAng)));
} }
pPlayer->deathTime += 4; pPlayer->deathTime += 4;
if (!bSeqStat) if (!bSeqStat)
@ -1445,7 +1445,7 @@ void ProcessInput(PLAYER *pPlayer)
if (cl_syncinput) if (cl_syncinput)
{ {
applylook(&pPlayer->q16ang, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, pInput->q16avel, &pInput->actions, 1, pPlayer->posture != 0); applylook2(&pPlayer->q16ang, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, pInput->q16avel, &pInput->actions, 1, pPlayer->posture != 0);
UpdatePlayerSpriteAngle(pPlayer); UpdatePlayerSpriteAngle(pPlayer);
} }

View file

@ -41,18 +41,20 @@
#include "xs_Float.h" // needed for reliably overflowing float->int conversions. #include "xs_Float.h" // needed for reliably overflowing float->int conversions.
#include "build.h" #include "build.h"
enum
{
BAMUNIT = 1 << 21
};
class binangle class binangle
{ {
unsigned int value; uint32_t value;
inline static constexpr double pi() { return 3.14159265358979323846; } constexpr binangle(uint32_t v) : value(v) {}
constexpr binangle(unsigned int v) : value(v) {} friend constexpr binangle bamang(uint32_t v);
friend constexpr binangle q16ang(uint32_t v);
friend constexpr binangle bamang(unsigned int v); friend constexpr binangle buildang(uint32_t v);
friend constexpr binangle q16ang(unsigned int v);
friend constexpr binangle buildang(unsigned int v);
friend binangle radang(double v); friend binangle radang(double v);
friend binangle degang(double v); friend binangle degang(double v);
@ -63,8 +65,8 @@ public:
constexpr short asbuild() const { return value >> 21; } constexpr short asbuild() const { return value >> 21; }
constexpr fixed_t asq16() const { return value >> 5; } constexpr fixed_t asq16() const { return value >> 5; }
constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); } constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); }
constexpr double asdeg() const { return value * (90. / 0x40000000); } constexpr double asdeg() const { return AngleToFloat(value); }
constexpr unsigned asbam() const { return value; } constexpr uint32_t asbam() const { return value; }
double fsin() const { return sin(asrad()); } double fsin() const { return sin(asrad()); }
double fcos() const { return cos(asrad()); } double fcos() const { return cos(asrad()); }
@ -72,27 +74,6 @@ public:
int bsin() const { return sintable[asbuild()]; } int bsin() const { return sintable[asbuild()]; }
int bcos() const { return sintable[(asbuild() + 512) & 2047]; } int bcos() const { return sintable[(asbuild() + 512) & 2047]; }
#if 0 // This makes no sense
bool operator< (binangle other) const
{
return value < other.value;
}
bool operator> (binangle other) const
{
return value > other.value;
}
bool operator<= (binangle other) const
{
return value <= other.value;
}
bool operator>= (binangle other) const
{
return value >= other.value;
}
#endif
constexpr bool operator== (binangle other) const constexpr bool operator== (binangle other) const
{ {
return value == other.value; return value == other.value;
@ -125,14 +106,65 @@ public:
return binangle(value - other.value); return binangle(value - other.value);
} }
void interpolate(binangle a1, binangle a2, fixed_t smoothratio) };
class lookangle
{ {
// Calculate in floating point to reduce the error caused by overflows which are to be expected here and then downconvert using a method that is safe to overflow. int32_t value;
// We do not want fixed point multiplications here to trash the result.
double smooth = smoothratio / 65536.f; constexpr lookangle(int32_t v) : value(v) {}
value = xs_CRoundToUInt(double(a1.asbam()) + smooth * (double(a2.asbam()) - double(a1.asbam())));
friend constexpr lookangle bamlook(int32_t v);
friend constexpr lookangle q16look(int32_t v);
friend constexpr lookangle buildlook(int32_t v);
friend lookangle radlook(double v);
friend lookangle deglook(double v);
public:
lookangle() = default;
lookangle(const lookangle &other) = default;
// This class intentionally makes no allowances for implicit type conversions because those would render it ineffective.
constexpr short asbuild() const { return value >> 21; }
constexpr fixed_t asq16() const { return value >> 5; }
constexpr double asrad() const { return value * (pi::pi() / 0x80000000u); }
constexpr double asdeg() const { return AngleToFloat(value); }
constexpr int32_t asbam() const { return value; }
double fsin() const { return sin(asrad()); }
double fcos() const { return cos(asrad()); }
double ftan() const { return tan(asrad()); }
constexpr bool operator== (lookangle other) const
{
return value == other.value;
} }
constexpr bool operator!= (lookangle other) const
{
return value != other.value;
}
constexpr lookangle &operator+= (lookangle other)
{
value += other.value;
return *this;
}
constexpr lookangle &operator-= (lookangle other)
{
value -= other.value;
return *this;
}
constexpr lookangle operator+ (lookangle other) const
{
return lookangle(value + other.value);
}
constexpr lookangle operator- (lookangle other) const
{
return lookangle(value - other.value);
}
}; };
@ -239,11 +271,17 @@ public:
}; };
inline constexpr binangle bamang(unsigned int v) { return binangle(v); } inline constexpr binangle bamang(uint32_t v) { return binangle(v); }
inline constexpr binangle q16ang(unsigned int v) { return binangle(v << 5); } inline constexpr binangle q16ang(uint32_t v) { return binangle(v << 5); }
inline constexpr binangle buildang(unsigned int v) { return binangle(v << 21); } inline constexpr binangle buildang(uint32_t v) { return binangle(v << 21); }
inline binangle radang(double v) { return binangle(xs_CRoundToUInt(v * (0x80000000u / binangle::pi()))); } inline binangle radang(double v) { return binangle(xs_CRoundToUInt(v * (0x80000000u / pi::pi()))); }
inline binangle degang(double v) { return binangle(xs_CRoundToUInt(v * (0x40000000 / 90.))); } inline binangle degang(double v) { return binangle(FloatToAngle(v)); }
inline constexpr lookangle bamlook(int32_t v) { return lookangle(v); }
inline constexpr lookangle q16look(int32_t v) { return lookangle(v << 5); }
inline constexpr lookangle buildlook(int32_t v) { return lookangle(v << 21); }
inline lookangle radlook(double v) { return lookangle(xs_CRoundToUInt(v * (0x80000000u / pi::pi()))); }
inline lookangle deglook(double v) { return lookangle(FloatToAngle(v)); }
inline constexpr fixedhoriz q16horiz(fixed_t v) { return fixedhoriz(v); } inline constexpr fixedhoriz q16horiz(fixed_t v) { return fixedhoriz(v); }
inline constexpr fixedhoriz buildhoriz(int v) { return fixedhoriz(IntToFixed(v)); } inline constexpr fixedhoriz buildhoriz(int v) { return fixedhoriz(IntToFixed(v)); }

View file

@ -1448,6 +1448,12 @@ void PlayerHorizon::backup()
ohorizoff = horizoff; ohorizoff = horizoff;
} }
void PlayerHorizon::restore()
{
horiz = ohoriz;
horizoff = ohorizoff;
}
void PlayerHorizon::addadjustment(double value) void PlayerHorizon::addadjustment(double value)
{ {
if (!cl_syncinput) if (!cl_syncinput)
@ -1509,6 +1515,92 @@ fixedhoriz PlayerHorizon::interpolatedsum(double const smoothratio)
return q16horiz(prev.asq16() + mulscale16(curr.asq16() - prev.asq16(), smoothratio)); return q16horiz(prev.asq16() + mulscale16(curr.asq16() - prev.asq16(), smoothratio));
} }
//---------------------------------------------------------------------------
//
// PlayerAngle struct functions.
//
//---------------------------------------------------------------------------
void PlayerAngle::backup()
{
oang = ang;
olook_ang = look_ang;
orotscrnang = rotscrnang;
}
void PlayerAngle::restore()
{
ang = oang;
look_ang = olook_ang;
rotscrnang = orotscrnang;
}
void PlayerAngle::addadjustment(double value)
{
if (!cl_syncinput)
{
adjustment += value;
}
else
{
ang += bamang(xs_CRoundToUInt(value * BAMUNIT));
}
}
void PlayerAngle::resetadjustment()
{
adjustment = 0;
}
void PlayerAngle::settarget(double value, bool backup)
{
if (!cl_syncinput)
{
target = bamang(xs_CRoundToUInt(value * BAMUNIT));
if (target.asbam() == 0) target += bamang(1);
}
else
{
ang = bamang(xs_CRoundToUInt(value * BAMUNIT));
if (backup) oang = ang;
}
}
void PlayerAngle::processhelpers(double const scaleAdjust)
{
if (target.asbam())
{
ang = bamang(ang.asbam() + xs_CRoundToInt(scaleAdjust * (target - ang).asbam()));
if (ang.asbam() - target.asbam() < BAMUNIT)
{
ang = target;
target = bamang(0);
}
}
else if (adjustment)
{
ang += bamang(xs_CRoundToUInt(scaleAdjust * adjustment * BAMUNIT));
}
}
binangle PlayerAngle::sum()
{
return bamang(ang.asbam() + look_ang.asbam());
}
binangle PlayerAngle::interpolatedsum(double const smoothratio)
{
auto prev = oang.asbam() + olook_ang.asbam();
auto curr = ang.asbam() + look_ang.asbam();
return bamang(xs_CRoundToUInt(prev + fmulscale16(curr - prev, smoothratio)));
}
lookangle PlayerAngle::interpolatedrotscrn(double const smoothratio)
{
return bamlook(xs_CRoundToUInt(orotscrnang.asbam() + fmulscale16(rotscrnang.asbam() - orotscrnang.asbam(), smoothratio)));
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// Player's movement function, called from game's ticker or from gi->GetInput() as required. // Player's movement function, called from game's ticker or from gi->GetInput() as required.
@ -1708,7 +1800,71 @@ void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void applylook(fixed_t* q16ang, fixed_t* q16look_ang, fixed_t* q16rotscrnang, fixed_t* spin, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching) void applylook(PlayerAngle* angle, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching)
{
// return q16rotscrnang to 0 and set to 0 if less than a quarter of a unit
angle->rotscrnang -= q16look(xs_CRoundToInt(scaleAdjust * (angle->rotscrnang.asq16() * (15. / GameTicRate))));
if (abs(angle->rotscrnang.asq16()) < (FRACUNIT >> 2)) angle->rotscrnang = q16look(0);
// return q16look_ang to 0 and set to 0 if less than a quarter of a unit
angle->look_ang -= q16look(xs_CRoundToInt(scaleAdjust * (angle->look_ang.asq16() * (7.5 / GameTicRate))));
if (abs(angle->look_ang.asq16()) < (FRACUNIT >> 2)) angle->look_ang = q16look(0);
if (*actions & SB_LOOK_LEFT)
{
// start looking left
angle->look_ang -= q16look(FloatToFixed(scaleAdjust * (4560. / GameTicRate)));
angle->rotscrnang += q16look(FloatToFixed(scaleAdjust * (720. / GameTicRate)));
}
if (*actions & SB_LOOK_RIGHT)
{
// start looking right
angle->look_ang += q16look(FloatToFixed(scaleAdjust * (4560. / GameTicRate)));
angle->rotscrnang -= q16look(FloatToFixed(scaleAdjust * (720. / GameTicRate)));
}
Printf("look_ang %d\n", angle->look_ang.asbuild());
Printf("rotscrnang %d\n", angle->rotscrnang.asbuild());
if (*actions & SB_TURNAROUND)
{
if (angle->spin.asbam() == 0)
{
// currently not spinning, so start a spin
angle->spin = buildlook(-1024);
}
*actions &= ~SB_TURNAROUND;
}
if (angle->spin.asbam() < 0)
{
// return spin to 0
fixed_t add = FloatToFixed(scaleAdjust * ((!crouching ? 3840. : 1920.) / GameTicRate));
angle->spin += q16look(add);
if (angle->spin.asbam() > 0)
{
// Don't overshoot our target. With variable factor this is possible.
add -= angle->spin.asq16();
angle->spin = bamlook(0);
}
angle->ang += q16ang(add);
}
if (q16avel)
{
// add player's input
angle->ang += degang(FixedToFloat(q16avel));
}
}
//---------------------------------------------------------------------------
//
// Player's angle function, called from game's ticker or from gi->GetInput() as required.
//
//---------------------------------------------------------------------------
void applylook2(fixed_t* q16ang, fixed_t* q16look_ang, fixed_t* q16rotscrnang, fixed_t* spin, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching)
{ {
// return q16rotscrnang to 0 and set to 0 if less than a quarter of a FRACUNIT (16384) // return q16rotscrnang to 0 and set to 0 if less than a quarter of a FRACUNIT (16384)
*q16rotscrnang -= xs_CRoundToInt(scaleAdjust * (*q16rotscrnang * (15. / GameTicRate))); *q16rotscrnang -= xs_CRoundToInt(scaleAdjust * (*q16rotscrnang * (15. / GameTicRate)));
@ -1769,7 +1925,7 @@ void applylook(fixed_t* q16ang, fixed_t* q16look_ang, fixed_t* q16rotscrnang, fi
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void playerAddAngle(fixed_t* q16ang, double* helper, double adjustment) void playerAddAngle2(fixed_t* q16ang, double* helper, double adjustment)
{ {
if (!cl_syncinput) if (!cl_syncinput)
{ {
@ -1781,7 +1937,7 @@ void playerAddAngle(fixed_t* q16ang, double* helper, double adjustment)
} }
} }
void playerSetAngle(fixed_t* q16ang, fixed_t* helper, double adjustment) void playerSetAngle2(fixed_t* q16ang, fixed_t* helper, double adjustment)
{ {
if (!cl_syncinput) if (!cl_syncinput)
{ {

View file

@ -75,6 +75,7 @@ struct PlayerHorizon
double adjustment; double adjustment;
void backup(); void backup();
void restore();
void addadjustment(double value); void addadjustment(double value);
void resetadjustment(); void resetadjustment();
void settarget(double value, bool backup = false); void settarget(double value, bool backup = false);
@ -83,11 +84,29 @@ struct PlayerHorizon
fixedhoriz interpolatedsum(double const smoothratio); fixedhoriz interpolatedsum(double const smoothratio);
}; };
struct PlayerAngle
{
binangle ang, oang, target;
lookangle look_ang, olook_ang, rotscrnang, orotscrnang, spin;
double adjustment;
void backup();
void restore();
void addadjustment(double value);
void resetadjustment();
void settarget(double value, bool backup = false);
void processhelpers(double const scaleAdjust);
binangle sum();
binangle interpolatedsum(double const smoothratio);
lookangle interpolatedrotscrn(double const smoothratio);
};
void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1); void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlInfo* const hidInput, double const scaleAdjust, int const drink_amt = 0, bool const allowstrafe = true, double const turnscale = 1);
void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust); void sethorizon(fixedhoriz* horiz, float const horz, ESyncBits* actions, double const scaleAdjust);
void applylook(fixed_t* q16ang, fixed_t* q16look_ang, fixed_t* q16rotscrnang, fixed_t* spin, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching); void applylook(PlayerAngle* angle, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching);
void playerAddAngle(fixed_t* q16ang, double* helper, double adjustment); void applylook2(fixed_t* q16ang, fixed_t* q16look_ang, fixed_t* q16rotscrnang, fixed_t* spin, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching);
void playerSetAngle(fixed_t* q16ang, fixed_t* helper, double adjustment); void playerAddAngle2(fixed_t* q16ang, double* helper, double adjustment);
void playerSetAngle2(fixed_t* q16ang, fixed_t* helper, double adjustment);
void playerProcessHelpers(fixed_t* q16ang, double* angAdjust, fixed_t* angTarget, double const scaleAdjust); void playerProcessHelpers(fixed_t* q16ang, double* angAdjust, fixed_t* angTarget, double const scaleAdjust);
struct UserConfig struct UserConfig

View file

@ -128,7 +128,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
if (!nFreeze) if (!nFreeze)
{ {
applylook(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, input.q16avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080); applylook2(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, input.q16avel, &sPlayerInput[nLocalPlayer].actions, scaleAdjust, eyelevel[nLocalPlayer] > -14080);
sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust); sethorizon(&pPlayer->horizon.horiz, input.horz, &sPlayerInput[nLocalPlayer].actions, scaleAdjust);
} }

View file

@ -948,7 +948,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
if (cl_syncinput) if (cl_syncinput)
{ {
Player* pPlayer = &PlayerList[nPlayer]; Player* pPlayer = &PlayerList[nPlayer];
applylook(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions, 1, eyelevel[nLocalPlayer] > -14080); applylook2(&pPlayer->q16angle, &pPlayer->q16look_ang, &pPlayer->q16rotscrnang, &pPlayer->spin, sPlayerInput[nPlayer].nAngle, &sPlayerInput[nLocalPlayer].actions, 1, eyelevel[nLocalPlayer] > -14080);
UpdatePlayerSpriteAngle(pPlayer); UpdatePlayerSpriteAngle(pPlayer);
} }
@ -1046,7 +1046,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
if (nTotalPlayers <= 1) if (nTotalPlayers <= 1)
{ {
auto ang = GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask; auto ang = GetAngleToSprite(nPlayerSprite, nSpiritSprite) & kAngleMask;
playerSetAngle(&PlayerList[nPlayer].q16angle, &PlayerList[nPlayer].angTarget, ang); playerSetAngle2(&PlayerList[nPlayer].q16angle, &PlayerList[nPlayer].angTarget, ang);
PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle; PlayerList[nPlayer].oq16angle = PlayerList[nPlayer].q16angle;
sprite[nPlayerSprite].ang = ang; sprite[nPlayerSprite].ang = ang;

View file

@ -203,7 +203,7 @@ void clearcamera(player_struct* ps)
ps->posx = ps->oposx; ps->posx = ps->oposx;
ps->posy = ps->oposy; ps->posy = ps->oposy;
ps->posz = ps->oposz; ps->posz = ps->oposz;
ps->q16ang = ps->oq16ang; ps->angle.restore();
updatesector(ps->posx, ps->posy, &ps->cursectnum); updatesector(ps->posx, ps->posy, &ps->cursectnum);
setpal(ps); setpal(ps);
@ -383,7 +383,7 @@ void movedummyplayers(void)
{ {
sprite[i].cstat = CSTAT_SPRITE_BLOCK_ALL; sprite[i].cstat = CSTAT_SPRITE_BLOCK_ALL;
sprite[i].z = sector[sprite[i].sectnum].ceilingz + (27 << 8); sprite[i].z = sector[sprite[i].sectnum].ceilingz + (27 << 8);
sprite[i].ang = ps[p].getang(); sprite[i].ang = ps[p].angle.ang.asbuild();
if (hittype[i].temp_data[0] == 8) if (hittype[i].temp_data[0] == 8)
hittype[i].temp_data[0] = 0; hittype[i].temp_data[0] = 0;
else hittype[i].temp_data[0]++; else hittype[i].temp_data[0]++;
@ -429,7 +429,7 @@ void moveplayers(void) //Players
s->x = p->oposx; s->x = p->oposx;
s->y = p->oposy; s->y = p->oposy;
hittype[i].bposz = s->z = p->oposz + PHEIGHT; hittype[i].bposz = s->z = p->oposz + PHEIGHT;
s->ang = p->getoang(); s->ang = p->angle.oang.asbuild();
setsprite(i, s->x, s->y, s->z); setsprite(i, s->x, s->y, s->z);
} }
else else
@ -468,7 +468,7 @@ void moveplayers(void) //Players
if (p->actorsqu >= 0) if (p->actorsqu >= 0)
{ {
playerAddAngle(&p->q16ang, &p->angAdjust, getincangle(p->getang(), getangle(sprite[p->actorsqu].x - p->posx, sprite[p->actorsqu].y - p->posy)) >> 2); p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), gethiq16angle(sprite[p->actorsqu].x - p->posx, sprite[p->actorsqu].y - p->posy)) >> 2));
} }
if (s->extra > 0) if (s->extra > 0)
@ -491,10 +491,10 @@ void moveplayers(void) //Players
if (p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS) if (p->wackedbyactor >= 0 && sprite[p->wackedbyactor].statnum < MAXSTATUS)
{ {
playerAddAngle(&p->q16ang, &p->angAdjust, getincangle(p->getang(), getangle(sprite[p->wackedbyactor].x - p->posx, sprite[p->wackedbyactor].y - p->posy)) >> 1); p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), gethiq16angle(sprite[p->wackedbyactor].x - p->posx, sprite[p->wackedbyactor].y - p->posy)) >> 1));
} }
} }
s->ang = p->getang(); s->ang = p->angle.ang.asbuild();
} }
} }
else else
@ -532,7 +532,7 @@ void moveplayers(void) //Players
if (s->extra < 8) if (s->extra < 8)
{ {
s->xvel = 128; s->xvel = 128;
s->ang = p->getang(); s->ang = p->angle.ang.asbuild();
s->extra++; s->extra++;
//IFMOVING; // JBF 20040825: is really "if (ssp(i,CLIPMASK0)) ;" which is probably //IFMOVING; // JBF 20040825: is really "if (ssp(i,CLIPMASK0)) ;" which is probably
ssp(i, CLIPMASK0); // not the safest of ideas because a zealous optimiser probably sees ssp(i, CLIPMASK0); // not the safest of ideas because a zealous optimiser probably sees
@ -540,7 +540,7 @@ void moveplayers(void) //Players
} }
else else
{ {
s->ang = 2047 - (p->getang()); s->ang = 2047 - (p->angle.ang.asbuild());
setsprite(i, s->x, s->y, s->z); setsprite(i, s->x, s->y, s->z);
} }
} }
@ -748,7 +748,7 @@ void movecrane(int i, int crane)
s->owner = -2; s->owner = -2;
ps[p].on_crane = i; ps[p].on_crane = i;
S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i); S_PlayActorSound(isRR() ? 390 : DUKE_GRUNT, ps[p].i);
playerSetAngle(&ps[p].q16ang, &ps[p].angTarget, s->ang + 1024); ps[p].angle.addadjustment(s->ang + 1024);
} }
else else
{ {
@ -834,7 +834,7 @@ void movecrane(int i, int crane)
} }
else if (s->owner == -2) else if (s->owner == -2)
{ {
auto ang = ps[p].getang(); auto ang = ps[p].angle.ang.asbuild();
ps[p].oposx = ps[p].posx; ps[p].oposx = ps[p].posx;
ps[p].oposy = ps[p].posy; ps[p].oposy = ps[p].posy;
ps[p].oposz = ps[p].posz; ps[p].oposz = ps[p].posz;
@ -1521,7 +1521,7 @@ bool queball(int i, int pocket, int queball, int stripeball)
// if(s->pal == 12) // if(s->pal == 12)
{ {
j = getincangle(ps[p].getang(), getangle(s->x - ps[p].posx, s->y - ps[p].posy)); j = getincangle(ps[p].angle.ang.asbuild(), getangle(s->x - ps[p].posx, s->y - ps[p].posy));
if (j > -64 && j < 64 && PlayerInput(p, SB_OPEN)) if (j > -64 && j < 64 && PlayerInput(p, SB_OPEN))
if (ps[p].toggle_key_flag == 1) if (ps[p].toggle_key_flag == 1)
{ {
@ -1530,7 +1530,7 @@ bool queball(int i, int pocket, int queball, int stripeball)
{ {
if (sprite[a].picnum == queball || sprite[a].picnum == stripeball) if (sprite[a].picnum == queball || sprite[a].picnum == stripeball)
{ {
j = getincangle(ps[p].getang(), getangle(sprite[a].x - ps[p].posx, sprite[a].y - ps[p].posy)); j = getincangle(ps[p].angle.ang.asbuild(), getangle(sprite[a].x - ps[p].posx, sprite[a].y - ps[p].posy));
if (j > -64 && j < 64) if (j > -64 && j < 64)
{ {
int l; int l;
@ -1545,7 +1545,7 @@ bool queball(int i, int pocket, int queball, int stripeball)
if (s->pal == 12) if (s->pal == 12)
s->xvel = 164; s->xvel = 164;
else s->xvel = 140; else s->xvel = 140;
s->ang = ps[p].getang(); s->ang = ps[p].angle.ang.asbuild();
ps[p].toggle_key_flag = 2; ps[p].toggle_key_flag = 2;
} }
} }
@ -2698,7 +2698,7 @@ void handle_se00(int i, int LASERLINE)
{ {
if (ps[p].cursectnum == s->sectnum && ps[p].on_ground == 1) if (ps[p].cursectnum == s->sectnum && ps[p].on_ground == 1)
{ {
playerAddAngle(&ps[p].q16ang, &ps[p].angAdjust, l * q); ps[p].angle.addadjustment(l * q);
ps[p].posz += zchange; ps[p].posz += zchange;
@ -2890,7 +2890,7 @@ void handle_se14(int i, bool checkstat, int RPG, int JIBS6)
ps[p].bobposx += m; ps[p].bobposx += m;
ps[p].bobposy += x; ps[p].bobposy += x;
playerAddAngle(&ps[p].q16ang, &ps[p].angAdjust, q); ps[p].angle.addadjustment(q);
if (numplayers > 1) if (numplayers > 1)
{ {

View file

@ -2098,7 +2098,7 @@ void movetransports_d(void)
sprite[ps[k].i].extra = 0; sprite[ps[k].i].extra = 0;
} }
ps[p].setang(sprite[sprite[i].owner].ang); ps[p].angle.ang = buildang(sprite[sprite[i].owner].ang);
if (sprite[sprite[i].owner].owner != sprite[i].owner) if (sprite[sprite[i].owner].owner != sprite[i].owner)
{ {
@ -2454,7 +2454,7 @@ static void greenslime(int i)
} }
else if (x < 1024 && ps[p].quick_kick == 0) else if (x < 1024 && ps[p].quick_kick == 0)
{ {
j = getincangle(ps[p].getang(), getangle(sprite[i].x - ps[p].posx, sprite[i].y - ps[p].posy)); j = getincangle(ps[p].angle.ang.asbuild(), getangle(sprite[i].x - ps[p].posx, sprite[i].y - ps[p].posy));
if (j > -128 && j < 128) if (j > -128 && j < 128)
ps[p].quick_kick = 14; ps[p].quick_kick = 14;
} }
@ -2476,7 +2476,7 @@ static void greenslime(int i)
setsprite(i, s->x, s->y, s->z); setsprite(i, s->x, s->y, s->z);
s->ang = ps[p].getang(); s->ang = ps[p].angle.ang.asbuild();
if ((PlayerInput(p, SB_FIRE) || (ps[p].quick_kick > 0)) && sprite[ps[p].i].extra > 0) if ((PlayerInput(p, SB_FIRE) || (ps[p].quick_kick > 0)) && sprite[ps[p].i].extra > 0)
if (ps[p].quick_kick > 0 || (ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0)) if (ps[p].quick_kick > 0 || (ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0))
@ -2518,7 +2518,7 @@ static void greenslime(int i)
ps[p].posx = ps[p].oposx; ps[p].posx = ps[p].oposx;
ps[p].posy = ps[p].oposy; ps[p].posy = ps[p].oposy;
ps[p].posz = ps[p].oposz; ps[p].posz = ps[p].oposz;
ps[p].q16ang = ps[p].oq16ang; ps[p].angle.restore();
updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum); updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum);
setpal(&ps[p]); setpal(&ps[p]);
@ -2557,8 +2557,8 @@ static void greenslime(int i)
s->xrepeat = 20 + (sintable[t[1] & 2047] >> 13); s->xrepeat = 20 + (sintable[t[1] & 2047] >> 13);
s->yrepeat = 15 + (sintable[t[1] & 2047] >> 13); s->yrepeat = 15 + (sintable[t[1] & 2047] >> 13);
s->x = ps[p].posx + (sintable[(ps[p].getang() + 512) & 2047] >> 7); s->x = ps[p].posx + (sintable[(ps[p].angle.ang.asbuild() + 512) & 2047] >> 7);
s->y = ps[p].posy + (sintable[ps[p].getang() & 2047] >> 7); s->y = ps[p].posy + (sintable[ps[p].angle.ang.asbuild() & 2047] >> 7);
return; return;
} }

View file

@ -1730,7 +1730,7 @@ void movetransports_r(void)
sprite[ps[k].i].extra = 0; sprite[ps[k].i].extra = 0;
} }
ps[p].setang(sprite[OW].ang); ps[p].angle.ang = buildang(sprite[OW].ang);
if (sprite[OW].owner != OW) if (sprite[OW].owner != OW)
{ {
@ -2633,7 +2633,7 @@ void rr_specialstats()
nextj = nextspritestat[j]; nextj = nextspritestat[j];
if (sprite[j].picnum == RRTILE297) if (sprite[j].picnum == RRTILE297)
{ {
ps[p].setang(sprite[j].ang); ps[p].angle.ang = buildang(sprite[j].ang);
ps[p].bobposx = ps[p].oposx = ps[p].posx = sprite[j].x; ps[p].bobposx = ps[p].oposx = ps[p].posx = sprite[j].x;
ps[p].bobposy = ps[p].oposy = ps[p].posy = sprite[j].y; ps[p].bobposy = ps[p].oposy = ps[p].posy = sprite[j].y;
ps[p].oposz = ps[p].posz = sprite[j].z - (36 << 8); ps[p].oposz = ps[p].posz = sprite[j].z - (36 << 8);

View file

@ -326,7 +326,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
t->x = omyx + mulscale16((int)(myx - omyx), smoothratio); t->x = omyx + mulscale16((int)(myx - omyx), smoothratio);
t->y = omyy + mulscale16((int)(myy - omyy), smoothratio); t->y = omyy + mulscale16((int)(myy - omyy), smoothratio);
t->z = omyz + mulscale16((int)(myz - omyz), smoothratio) + (40 << 8); t->z = omyz + mulscale16((int)(myz - omyz), smoothratio) + (40 << 8);
t->ang = FixedToInt(oq16myang + mulscale16((int)(((q16myang + IntToFixed(1024) - oq16myang) & 0x7FFFFFF) - IntToFixed(1024)), smoothratio)); t->ang = myang.asbuild() + mulscale16((((myang.asbuild() + 1024 - myang.asbuild()) & 2047) - 1024), smoothratio);
t->sectnum = mycursectnum; t->sectnum = mycursectnum;
} }
} }

View file

@ -373,9 +373,7 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
t->x = omyx + mulscale16((int)(myx - omyx), smoothratio); t->x = omyx + mulscale16((int)(myx - omyx), smoothratio);
t->y = omyy + mulscale16((int)(myy - omyy), smoothratio); t->y = omyy + mulscale16((int)(myy - omyy), smoothratio);
t->z = omyz + mulscale16((int)(myz - omyz), smoothratio) + (40 << 8); t->z = omyz + mulscale16((int)(myz - omyz), smoothratio) + (40 << 8);
int omyang = FixedToInt(oq16myang); t->ang = omyang.asbuild() + mulscale16((((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024), smoothratio);
int myang = FixedToInt(q16myang);
t->ang = omyang + mulscale16((int)(((myang + 1024 - omyang) & 2047) - 1024), smoothratio);
t->sectnum = mycursectnum; t->sectnum = mycursectnum;
} }
} }

View file

@ -114,7 +114,7 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
if (parm->numparms >= 4) if (parm->numparms >= 4)
{ {
p->oq16ang = p->q16ang = IntToFixed(atoi(parm->parms[3])); p->angle.oang = p->angle.ang = buildang(atoi(parm->parms[3]));
} }
if (parm->numparms == 5) if (parm->numparms == 5)

View file

@ -241,7 +241,6 @@ void dointerpolations(int smoothratio);
int* animateptr(int i); int* animateptr(int i);
void backuppos(player_struct* p, bool noclipping = false); void backuppos(player_struct* p, bool noclipping = false);
void backuplook(player_struct* p);
void backupweapon(player_struct* p); void backupweapon(player_struct* p);
void resetinputhelpers(player_struct* p); void resetinputhelpers(player_struct* p);
void checkhardlanding(player_struct* p); void checkhardlanding(player_struct* p);

View file

@ -62,7 +62,7 @@ FString GameInterface::GetCoordString()
FString out; FString out;
out.Format("pos= %d, %d, %d - angle = %2.3f - sector = %d, lotag = %d, hitag = %d", out.Format("pos= %d, %d, %d - angle = %2.3f - sector = %d, lotag = %d, hitag = %d",
ps[snum].posx, ps[snum].posy, ps[snum].posz, ps[snum].q16ang / 65536., ps[snum].cursectnum, ps[snum].posx, ps[snum].posy, ps[snum].posz, ps[snum].angle.ang.asbuild(), ps[snum].cursectnum,
sector[ps[snum].cursectnum].lotag, sector[ps[snum].cursectnum].hitag); sector[ps[snum].cursectnum].lotag, sector[ps[snum].cursectnum].hitag);
return out; return out;
@ -274,20 +274,20 @@ void drawoverlays(double smoothratio)
{ {
cposx = omyx + mulscale16(myx - omyx, smoothratio); cposx = omyx + mulscale16(myx - omyx, smoothratio);
cposy = omyy + mulscale16(myy - omyy, smoothratio); cposy = omyy + mulscale16(myy - omyy, smoothratio);
cang = FixedToInt(oq16myang + mulscale16(((q16myang + IntToFixed(1024) - oq16myang) & 0x7FFFFFF) - IntToFixed(1024), smoothratio)); cang = omyang.asbuild() + mulscale16(((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024, smoothratio);
} }
else else
{ {
cposx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio); cposx = pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio);
cposy = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio); cposy = pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio);
cang = pp->getoang() + mulscale16(((pp->getang() + 1024 - pp->getoang()) & 2047) - 1024, smoothratio); cang = pp->angle.oang.asbuild() + mulscale16(((pp->angle.ang.asbuild() + 1024 - pp->angle.oang.asbuild()) & 2047) - 1024, smoothratio);
} }
} }
else else
{ {
cposx = pp->oposx; cposx = pp->oposx;
cposy = pp->oposy; cposy = pp->oposy;
cang = pp->getoang(); cang = pp->angle.oang.asbuild();
} }
DrawOverheadMap(cposx, cposy, cang); DrawOverheadMap(cposx, cposy, cang);
restoreinterpolations(); restoreinterpolations();
@ -300,7 +300,7 @@ void drawoverlays(double smoothratio)
if (ps[myconnectindex].newowner == -1 && ud.camerasprite == -1) if (ps[myconnectindex].newowner == -1 && ud.camerasprite == -1)
{ {
DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -getHalfLookAng(pp->oq16look_ang, pp->q16look_ang, cl_syncinput, smoothratio), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1); DrawCrosshair(TILE_CROSSHAIR, ps[screenpeek].last_extra, -getHalfLookAng(pp->angle.olook_ang.asq16(), pp->angle.look_ang.asq16(), cl_syncinput, smoothratio), pp->over_shoulder_on ? 2.5 : 0, isRR() ? 0.5 : 1);
} }
if (paused == 2) if (paused == 2)

View file

@ -457,12 +457,12 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
break; break;
case PLAYER_ANG: case PLAYER_ANG:
if (bSet) playerSetAngle(&ps[iPlayer].q16ang, &ps[iPlayer].angTarget, lValue); if (bSet) ps[iPlayer].angle.settarget(lValue);
else SetGameVarID((int)lVar2, ps[iPlayer].getang(), sActor, sPlayer); else SetGameVarID((int)lVar2, ps[iPlayer].angle.ang.asbuild(), sActor, sPlayer);
break; break;
case PLAYER_OANG: case PLAYER_OANG:
if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].getang(), sActor, sPlayer); if (!bSet) SetGameVarID((int)lVar2, ps[iPlayer].angle.oang.asbuild(), sActor, sPlayer);
break; break;
case PLAYER_ANGVEL: // This no longer exists. case PLAYER_ANGVEL: // This no longer exists.
@ -475,8 +475,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
break; break;
case PLAYER_LOOK_ANG: case PLAYER_LOOK_ANG:
if (bSet) ps[iPlayer].q16look_ang = IntToFixed(lValue); if (bSet) ps[iPlayer].angle.look_ang = buildlook(lValue);
else SetGameVarID((int)lVar2, FixedToInt(ps[iPlayer].q16look_ang), sActor, sPlayer); else SetGameVarID((int)lVar2, ps[iPlayer].angle.look_ang.asbuild(), sActor, sPlayer);
break; break;
case PLAYER_LAST_EXTRA: case PLAYER_LAST_EXTRA:
@ -636,8 +636,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
break; break;
case PLAYER_ONE_EIGHTY_COUNT: case PLAYER_ONE_EIGHTY_COUNT:
if (bSet) ps[iPlayer].one_eighty_count = lValue; if (bSet) ps[iPlayer].angle.spin = buildlook(lValue);
else SetGameVarID((int)lVar2, ps[iPlayer].one_eighty_count, sActor, sPlayer); else SetGameVarID((int)lVar2, ps[iPlayer].angle.spin.asbuild(), sActor, sPlayer);
break; break;
case PLAYER_CHEAT_PHASE: case PLAYER_CHEAT_PHASE:
@ -696,8 +696,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
break; break;
case PLAYER_ROTSCRNANG: case PLAYER_ROTSCRNANG:
if (bSet) ps[iPlayer].setrotscrnang(lValue); if (bSet) ps[iPlayer].angle.rotscrnang = buildlook(lValue);
else SetGameVarID((int)lVar2, FixedToInt(ps[iPlayer].q16rotscrnang), sActor, sPlayer); else SetGameVarID((int)lVar2, ps[iPlayer].angle.rotscrnang.asbuild(), sActor, sPlayer);
break; break;
case PLAYER_DEAD_FLAG: case PLAYER_DEAD_FLAG:
@ -2054,7 +2054,7 @@ int ParseState::parse(void)
ps[g_p].posx = ps[g_p].oposx; ps[g_p].posx = ps[g_p].oposx;
ps[g_p].posy = ps[g_p].oposy; ps[g_p].posy = ps[g_p].oposy;
ps[g_p].posz = ps[g_p].oposz; ps[g_p].posz = ps[g_p].oposz;
ps[g_p].q16ang = ps[g_p].oq16ang; ps[g_p].angle.restore();
updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum); updatesector(ps[g_p].posx,ps[g_p].posy,&ps[g_p].cursectnum);
setpal(&ps[g_p]); setpal(&ps[g_p]);
@ -2259,7 +2259,7 @@ int ParseState::parse(void)
ps[g_p].weapreccnt = 0; ps[g_p].weapreccnt = 0;
ps[g_p].ftq = 0; ps[g_p].ftq = 0;
ps[g_p].posxv = ps[g_p].posyv = 0; ps[g_p].posxv = ps[g_p].posyv = 0;
if (!isRR()) ps[g_p].setrotscrnang(0); if (!isRR()) ps[g_p].angle.orotscrnang = ps[g_p].angle.rotscrnang = buildlook(0);
ps[g_p].falling_counter = 0; ps[g_p].falling_counter = 0;
@ -2431,9 +2431,9 @@ int ParseState::parse(void)
else if( (l& pfacing) ) else if( (l& pfacing) )
{ {
if (g_sp->picnum == TILE_APLAYER && ud.multimode > 1) if (g_sp->picnum == TILE_APLAYER && ud.multimode > 1)
j = getincangle(ps[otherp].getang(), getangle(ps[g_p].posx - ps[otherp].posx, ps[g_p].posy - ps[otherp].posy)); j = getincangle(ps[otherp].angle.ang.asbuild(), getangle(ps[g_p].posx - ps[otherp].posx, ps[g_p].posy - ps[otherp].posy));
else else
j = getincangle(ps[g_p].getang(), getangle(g_sp->x - ps[g_p].posx, g_sp->y - ps[g_p].posy)); j = getincangle(ps[g_p].angle.ang.asbuild(), getangle(g_sp->x - ps[g_p].posx, g_sp->y - ps[g_p].posy));
if( j > -128 && j < 128 ) if( j > -128 && j < 128 )
j = 1; j = 1;
@ -2457,8 +2457,8 @@ int ParseState::parse(void)
case concmd_slapplayer: case concmd_slapplayer:
insptr++; insptr++;
forceplayerangle(g_p); forceplayerangle(g_p);
ps[g_p].posxv -= sintable[(ps[g_p].getang() + 512) & 2047] << 7; ps[g_p].posxv -= sintable[(ps[g_p].angle.ang.asbuild() + 512) & 2047] << 7;
ps[g_p].posyv -= sintable[ps[g_p].getang() & 2047] << 7; ps[g_p].posyv -= sintable[ps[g_p].angle.ang.asbuild() & 2047] << 7;
return 0; return 0;
case concmd_wackplayer: case concmd_wackplayer:
insptr++; insptr++;
@ -2466,8 +2466,8 @@ int ParseState::parse(void)
forceplayerangle(g_p); forceplayerangle(g_p);
else else
{ {
ps[g_p].posxv -= sintable[(ps[g_p].getang() + 512) & 2047] << 10; ps[g_p].posxv -= sintable[(ps[g_p].angle.ang.asbuild() + 512) & 2047] << 10;
ps[g_p].posyv -= sintable[ps[g_p].getang() & 2047] << 10; ps[g_p].posyv -= sintable[ps[g_p].angle.ang.asbuild() & 2047] << 10;
ps[g_p].jumping_counter = 767; ps[g_p].jumping_counter = 767;
ps[g_p].jumping_toggle = 1; ps[g_p].jumping_toggle = 1;
} }
@ -2828,7 +2828,7 @@ int ParseState::parse(void)
case concmd_ifangdiffl: case concmd_ifangdiffl:
insptr++; insptr++;
j = abs(getincangle(ps[g_p].getang(),g_sp->ang)); j = abs(getincangle(ps[g_p].angle.ang.asbuild(),g_sp->ang));
parseifelse( j <= *insptr); parseifelse( j <= *insptr);
break; break;
@ -3138,7 +3138,7 @@ int ParseState::parse(void)
int i; int i;
insptr++; insptr++;
i = *(insptr++); // ID of def i = *(insptr++); // ID of def
SetGameVarID(i, ps[g_p].getang(), g_i, g_p); SetGameVarID(i, ps[g_p].angle.ang.asbuild(), g_i, g_p);
break; break;
} }
case concmd_setplayerangle: case concmd_setplayerangle:
@ -3146,7 +3146,7 @@ int ParseState::parse(void)
int i; int i;
insptr++; insptr++;
i = *(insptr++); // ID of def i = *(insptr++); // ID of def
ps[g_p].setang(GetGameVarID(i, g_i, g_p) & 2047); ps[g_p].angle.ang = buildang(GetGameVarID(i, g_i, g_p) & 2047);
break; break;
} }
case concmd_getactorangle: case concmd_getactorangle:

View file

@ -287,7 +287,7 @@ void displayweapon_d(int snum, double smoothratio)
o = 0; o = 0;
horiz16th = get16thOfHoriz(snum, cl_syncinput, smoothratio); horiz16th = get16thOfHoriz(snum, cl_syncinput, smoothratio);
look_anghalf = getHalfLookAng(p->oq16look_ang, p->q16look_ang, cl_syncinput, smoothratio); look_anghalf = getHalfLookAng(p->angle.olook_ang.asq16(), p->angle.look_ang.asq16(), cl_syncinput, smoothratio);
looking_arc = fabs(look_anghalf) / 4.5; looking_arc = fabs(look_anghalf) / 4.5;
weapon_sway = p->oweapon_sway + fmulscale16(p->weapon_sway - p->oweapon_sway, smoothratio); weapon_sway = p->oweapon_sway + fmulscale16(p->weapon_sway - p->oweapon_sway, smoothratio);
kickback_pic = p->okickback_pic + fmulscale16(*kb - p->okickback_pic, smoothratio); kickback_pic = p->okickback_pic + fmulscale16(*kb - p->okickback_pic, smoothratio);

View file

@ -124,7 +124,7 @@ void displayweapon_r(int snum, double smoothratio)
o = 0; o = 0;
look_anghalf = getHalfLookAng(p->oq16look_ang, p->q16look_ang, cl_syncinput, smoothratio); look_anghalf = getHalfLookAng(p->angle.olook_ang.asq16(), p->angle.look_ang.asq16(), cl_syncinput, smoothratio);
looking_arc = fabs(look_anghalf) / 4.5; looking_arc = fabs(look_anghalf) / 4.5;
weapon_sway = p->oweapon_sway + fmulscale16((p->weapon_sway - p->oweapon_sway), smoothratio); weapon_sway = p->oweapon_sway + fmulscale16((p->weapon_sway - p->oweapon_sway), smoothratio);
TiltStatus = !cl_syncinput ? p->TiltStatus : p->oTiltStatus + fmulscale16((p->TiltStatus - p->oTiltStatus), smoothratio); TiltStatus = !cl_syncinput ? p->TiltStatus : p->oTiltStatus + fmulscale16((p->TiltStatus - p->oTiltStatus), smoothratio);

View file

@ -190,7 +190,7 @@ inline bool playrunning()
inline void backupplayer(player_struct* p) inline void backupplayer(player_struct* p)
{ {
backuppos(p); backuppos(p);
backuplook(p); p->angle.backup();
p->horizon.backup(); p->horizon.backup();
} }

View file

@ -286,7 +286,7 @@ void hud_input(int snum)
EGS(p->cursectnum, EGS(p->cursectnum,
p->posx, p->posx,
p->posy, p->posy,
p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->getang(), 0, 0, -1, 10); p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, -1, 10);
hittype[i].temp_data[3] = hittype[i].temp_data[4] = 0; hittype[i].temp_data[3] = hittype[i].temp_data[4] = 0;
sprite[i].yvel = snum; sprite[i].yvel = snum;
sprite[i].extra = 0; sprite[i].extra = 0;
@ -477,7 +477,7 @@ void hud_input(int snum)
} }
} }
if (PlayerInput(snum, SB_TURNAROUND) && p->one_eighty_count == 0 && p->on_crane < 0) if (PlayerInput(snum, SB_TURNAROUND) && p->angle.spin.asbam() == 0 && p->on_crane < 0)
{ {
SetGameVarID(g_iReturnVarID, 0, -1, snum); SetGameVarID(g_iReturnVarID, 0, -1, snum);
OnEvent(EVENT_TURNAROUND, -1, snum, -1); OnEvent(EVENT_TURNAROUND, -1, snum, -1);
@ -850,7 +850,7 @@ static void FinalizeInput(int playerNum, InputPacket& input, bool vehicle)
loc.q16avel = clamp(loc.q16avel, IntToFixed(-MAXANGVEL), IntToFixed(MAXANGVEL)); loc.q16avel = clamp(loc.q16avel, IntToFixed(-MAXANGVEL), IntToFixed(MAXANGVEL));
if (!cl_syncinput && input.q16avel) if (!cl_syncinput && input.q16avel)
{ {
p->one_eighty_count = 0; p->angle.spin = bamlook(0);
} }
} }
else else
@ -922,27 +922,27 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
// Do these in the same order as the old code. // Do these in the same order as the old code.
calcviewpitch(p, scaleAdjust); calcviewpitch(p, scaleAdjust);
processq16avel(p, &input.q16avel); processq16avel(p, &input.q16avel);
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, input.q16avel, &p->sync.actions, scaleAdjust, p->crouch_toggle || p->sync.actions & SB_CROUCH); applylook(&p->angle, input.q16avel, &p->sync.actions, scaleAdjust, p->crouch_toggle || p->sync.actions & SB_CROUCH);
sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust); sethorizon(&p->horizon.horiz, input.horz, &p->sync.actions, scaleAdjust);
} }
playerProcessHelpers(&p->q16ang, &p->angAdjust, &p->angTarget, scaleAdjust); p->angle.processhelpers(scaleAdjust);
p->horizon.processhelpers(scaleAdjust); p->horizon.processhelpers(scaleAdjust);
} }
if (packet) if (packet)
{ {
auto const pPlayer = &ps[myconnectindex]; auto const pPlayer = &ps[myconnectindex];
auto const q16ang = FixedToInt(pPlayer->q16ang); auto const ang = pPlayer->angle.ang.asbuild();
*packet = loc; *packet = loc;
auto fvel = loc.fvel; auto fvel = loc.fvel;
auto svel = loc.svel; auto svel = loc.svel;
packet->fvel = mulscale9(fvel, sintable[(q16ang + 2560) & 2047]) + packet->fvel = mulscale9(fvel, sintable[(ang + 2560) & 2047]) +
mulscale9(svel, sintable[(q16ang + 2048) & 2047]) + mulscale9(svel, sintable[(ang + 2048) & 2047]) +
pPlayer->fric.x; pPlayer->fric.x;
packet->svel = mulscale9(fvel, sintable[(q16ang + 2048) & 2047]) + packet->svel = mulscale9(fvel, sintable[(ang + 2048) & 2047]) +
mulscale9(svel, sintable[(q16ang + 1536) & 2047]) + mulscale9(svel, sintable[(ang + 1536) & 2047]) +
pPlayer->fric.y; pPlayer->fric.y;
loc = {}; loc = {};
} }

View file

@ -93,8 +93,8 @@ void calcviewpitch(player_struct *p, double factor)
int psectlotag = sector[psect].lotag; int psectlotag = sector[psect].lotag;
if (p->aim_mode == 0 && p->on_ground && psectlotag != ST_2_UNDERWATER && (sector[psect].floorstat & 2)) if (p->aim_mode == 0 && p->on_ground && psectlotag != ST_2_UNDERWATER && (sector[psect].floorstat & 2))
{ {
int x = p->posx + (sintable[(p->getang() + 512) & 2047] >> 5); int x = p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 5);
int y = p->posy + (sintable[p->getang() & 2047] >> 5); int y = p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 5);
short tempsect = psect; short tempsect = psect;
updatesector(x, y, &tempsect); updatesector(x, y, &tempsect);
@ -166,8 +166,7 @@ void forceplayerangle(int snum)
p->horizon.addadjustment(64); p->horizon.addadjustment(64);
p->sync.actions |= SB_CENTERVIEW; p->sync.actions |= SB_CENTERVIEW;
p->setlookang(n >> 1); p->angle.rotscrnang = p->angle.look_ang = buildlook(n >> 1);
p->setrotscrnang(n >> 1);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -264,7 +263,7 @@ int hitawall(struct player_struct* p, int* hitw)
short sect, hs, hitw1; short sect, hs, hitw1;
hitscan(p->posx, p->posy, p->posz, p->cursectnum, hitscan(p->posx, p->posy, p->posz, p->cursectnum,
sintable[(p->getang() + 512) & 2047], sintable[p->getang() & 2047], 0, &sect, &hitw1, &hs, &sx, &sy, &sz, CLIPMASK0); sintable[(p->angle.ang.asbuild() + 512) & 2047], sintable[p->angle.ang.asbuild() & 2047], 0, &sect, &hitw1, &hs, &sx, &sy, &sz, CLIPMASK0);
*hitw = hitw1; *hitw = hitw1;
return (FindDistance2D(sx - p->posx, sy - p->posy)); return (FindDistance2D(sx - p->posx, sy - p->posy));
@ -656,7 +655,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
pushmove(&p->posx, &p->posy, &p->posz, &p->cursectnum, 128L, (4L << 8), (20L << 8), CLIPMASK0); pushmove(&p->posx, &p->posy, &p->posz, &p->cursectnum, 128L, (4L << 8), (20L << 8), CLIPMASK0);
if (fz > cz + (16 << 8) && s->pal != 1) if (fz > cz + (16 << 8) && s->pal != 1)
p->setrotscrnang((p->dead_flag + ((fz + p->posz) >> 7)) & 2047); p->angle.rotscrnang = buildlook(p->dead_flag + ((fz + p->posz) >> 7));
p->on_warping_sector = 0; p->on_warping_sector = 0;
@ -767,16 +766,16 @@ void apply_seasick(player_struct* p, double factor)
if (p->SeaSick < 250) if (p->SeaSick < 250)
{ {
if (p->SeaSick >= 180) if (p->SeaSick >= 180)
p->addrotscrnang(24 * factor); p->angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
else if (p->SeaSick >= 130) else if (p->SeaSick >= 130)
p->addrotscrnang(-24 * factor); p->angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
else if (p->SeaSick >= 70) else if (p->SeaSick >= 70)
p->addrotscrnang(24 * factor); p->angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
else if (p->SeaSick >= 20) else if (p->SeaSick >= 20)
p->addrotscrnang(-24 * factor); p->angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
} }
if (p->SeaSick < 250) if (p->SeaSick < 250)
p->addlookang(((krand() & 255) - 128) * factor); p->angle.look_ang = bamlook(xs_CRoundToUInt(((krand() & 255) - 128) * factor * BAMUNIT));
} }
} }
@ -830,19 +829,6 @@ void backuppos(player_struct* p, bool noclipping)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void backuplook(player_struct* p)
{
p->oq16ang = p->q16ang;
p->oq16look_ang = p->q16look_ang;
p->oq16rotscrnang = p->q16rotscrnang;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void backupweapon(player_struct* p) void backupweapon(player_struct* p)
{ {
p->oweapon_sway = p->weapon_sway; p->oweapon_sway = p->weapon_sway;
@ -861,7 +847,7 @@ void backupweapon(player_struct* p)
void resetinputhelpers(player_struct* p) void resetinputhelpers(player_struct* p)
{ {
p->horizon.resetadjustment(); p->horizon.resetadjustment();
p->angAdjust = 0; p->angle.resetadjustment();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -932,7 +918,7 @@ void checklook(int snum, ESyncBits actions)
actions &= ~SB_LOOK_RIGHT; actions &= ~SB_LOOK_RIGHT;
} }
} }
backuplook(p); p->angle.backup();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View file

@ -118,7 +118,7 @@ void shoot_d(int i, int atwith)
sx = ps[p].posx; sx = ps[p].posx;
sy = ps[p].posy; sy = ps[p].posy;
sz = ps[p].posz + ps[p].pyoff + (4 << 8); sz = ps[p].posz + ps[p].pyoff + (4 << 8);
sa = ps[p].getang(); sa = ps[p].angle.ang.asbuild();
ps[p].crack_time = CRACK_TIME; ps[p].crack_time = CRACK_TIME;
@ -403,7 +403,7 @@ void shoot_d(int i, int atwith)
j = fi.spawn(ps[p].i, WATERSPLASH2); j = fi.spawn(ps[p].i, WATERSPLASH2);
sprite[j].x = hitx; sprite[j].x = hitx;
sprite[j].y = hity; sprite[j].y = hity;
sprite[j].ang = ps[p].getang(); // Total tweek sprite[j].ang = ps[p].angle.ang.asbuild(); // Total tweek
sprite[j].xvel = 32; sprite[j].xvel = 32;
ssp(i, CLIPMASK0); ssp(i, CLIPMASK0);
sprite[j].xvel = 0; sprite[j].xvel = 0;
@ -1915,9 +1915,9 @@ static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz)
{ {
j = fi.spawn(pi, WATERBUBBLE); j = fi.spawn(pi, WATERBUBBLE);
sprite[j].x += sprite[j].x +=
sintable[(p->getang() + 512 + 64 - (global_random & 128)) & 2047] >> 6; sintable[(p->angle.ang.asbuild() + 512 + 64 - (global_random & 128)) & 2047] >> 6;
sprite[j].y += sprite[j].y +=
sintable[(p->getang() + 64 - (global_random & 128)) & 2047] >> 6; sintable[(p->angle.ang.asbuild() + 64 - (global_random & 128)) & 2047] >> 6;
sprite[j].xrepeat = 3; sprite[j].xrepeat = 3;
sprite[j].yrepeat = 2; sprite[j].yrepeat = 2;
sprite[j].z = p->posz + (8 << 8); sprite[j].z = p->posz + (8 << 8);
@ -1939,8 +1939,8 @@ int operateTripbomb(int snum)
short sect, hw, hitsp; short sect, hw, hitsp;
hitscan(p->posx, p->posy, p->posz, hitscan(p->posx, p->posy, p->posz,
p->cursectnum, sintable[(p->getang() + 512) & 2047], p->cursectnum, sintable[(p->angle.ang.asbuild() + 512) & 2047],
sintable[p->getang() & 2047], -p->horizon.sum().asq16() >> 11, sintable[p->angle.ang.asbuild() & 2047], -p->horizon.sum().asq16() >> 11,
&sect, &hw, &hitsp, &sx, &sy, &sz, CLIPMASK1); &sect, &hw, &hitsp, &sx, &sy, &sz, CLIPMASK1);
if (sect < 0 || hitsp >= 0) if (sect < 0 || hitsp >= 0)
@ -2131,10 +2131,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
} }
j = EGS(p->cursectnum, j = EGS(p->cursectnum,
p->posx + (sintable[(p->getang() + 512) & 2047] >> 6), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
p->posy + (sintable[p->getang() & 2047] >> 6), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
p->posz, HEAVYHBOMB, -16, 9, 9, p->posz, HEAVYHBOMB, -16, 9, 9,
p->getang(), (k + (p->hbomb_hold_delay << 5)), i, pi, 1); p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, pi, 1);
if (isNam()) if (isNam())
{ {
@ -2840,7 +2840,7 @@ void processinput_d(int snum)
// may still be needed later for demo recording // may still be needed later for demo recording
processq16avel(p, &sb_avel); processq16avel(p, &sb_avel);
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH); applylook(&p->angle, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH);
} }
if (p->spritebridge == 0) if (p->spritebridge == 0)

View file

@ -105,7 +105,7 @@ void shoot_r(int i, int atwith)
sx = ps[p].posx; sx = ps[p].posx;
sy = ps[p].posy; sy = ps[p].posy;
sz = ps[p].posz + ps[p].pyoff + (4 << 8); sz = ps[p].posz + ps[p].pyoff + (4 << 8);
sa = ps[p].getang(); sa = ps[p].angle.ang.asbuild();
if (isRRRA()) ps[p].crack_time = CRACK_TIME; if (isRRRA()) ps[p].crack_time = CRACK_TIME;
} }
@ -302,7 +302,7 @@ void shoot_r(int i, int atwith)
j = fi.spawn(ps[p].i, WATERSPLASH2); j = fi.spawn(ps[p].i, WATERSPLASH2);
sprite[j].x = hitx; sprite[j].x = hitx;
sprite[j].y = hity; sprite[j].y = hity;
sprite[j].ang = ps[p].getang(); // Total tweek sprite[j].ang = ps[p].angle.ang.asbuild(); // Total tweek
sprite[j].xvel = 32; sprite[j].xvel = 32;
ssp(i, 0); ssp(i, 0);
sprite[j].xvel = 0; sprite[j].xvel = 0;
@ -1275,8 +1275,8 @@ int doincrements_r(struct player_struct* p)
{ {
p->noise_radius = 16384; p->noise_radius = 16384;
madenoise(screenpeek); madenoise(screenpeek);
p->posxv += sintable[(p->getang() + 512) & 2047] << 4; p->posxv += sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
p->posyv += sintable[p->getang() & 2047] << 4; p->posyv += sintable[p->angle.ang.asbuild() & 2047] << 4;
} }
p->eat -= 4; p->eat -= 4;
if (p->eat < 0) if (p->eat < 0)
@ -1472,7 +1472,7 @@ void checkweapons_r(struct player_struct* p)
if (p->OnMotorcycle && numplayers > 1) if (p->OnMotorcycle && numplayers > 1)
{ {
j = fi.spawn(p->i, 7220); j = fi.spawn(p->i, 7220);
sprite[j].ang = p->getang(); sprite[j].ang = p->angle.ang.asbuild();
sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON]; sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON];
p->OnMotorcycle = 0; p->OnMotorcycle = 0;
p->gotweapon.Clear(MOTORCYCLE_WEAPON); p->gotweapon.Clear(MOTORCYCLE_WEAPON);
@ -1488,7 +1488,7 @@ void checkweapons_r(struct player_struct* p)
else if (p->OnBoat && numplayers > 1) else if (p->OnBoat && numplayers > 1)
{ {
j = fi.spawn(p->i, 7233); j = fi.spawn(p->i, 7233);
sprite[j].ang = p->getang(); sprite[j].ang = p->angle.ang.asbuild();
sprite[j].owner = p->ammo_amount[BOAT_WEAPON]; sprite[j].owner = p->ammo_amount[BOAT_WEAPON];
p->OnBoat = 0; p->OnBoat = 0;
p->gotweapon.Clear(BOAT_WEAPON); p->gotweapon.Clear(BOAT_WEAPON);
@ -1769,7 +1769,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
{ {
short var8c, var90, var94, var98; short var8c, var90, var94, var98;
var8c = p->MotoSpeed; var8c = p->MotoSpeed;
var90 = p->getang(); var90 = p->angle.ang.asbuild();
if (var74) if (var74)
var94 = -10; var94 = -10;
else else
@ -1817,13 +1817,13 @@ static void onMotorcycle(int snum, ESyncBits &actions)
ang = var98 >> 7; ang = var98 >> 7;
} }
} }
playerAddAngle(&p->q16ang, &p->angAdjust, FixedToFloat(getincangleq16(p->q16ang, IntToFixed(var90 - ang)))); p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), IntToFixed(var90 - ang))));
} }
else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil)) else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil))
{ {
short var9c, vara0, vara4=0; short var9c, vara0, vara4=0;
var9c = p->MotoSpeed; var9c = p->MotoSpeed;
vara0 = p->getang(); vara0 = p->angle.ang.asbuild();
var84 = krand() & 1; var84 = krand() & 1;
if (var84 == 0) if (var84 == 0)
vara4 = -10; vara4 = -10;
@ -2098,7 +2098,7 @@ static void onBoat(int snum, ESyncBits &actions)
{ {
short vard4, vard8, vardc, vare0; short vard4, vard8, vardc, vare0;
vard4 = p->MotoSpeed; vard4 = p->MotoSpeed;
vard8 = p->getang(); vard8 = p->angle.ang.asbuild();
if (varbc) if (varbc)
vardc = -10; vardc = -10;
else else
@ -2121,7 +2121,7 @@ static void onBoat(int snum, ESyncBits &actions)
p->posyv += (vard4 >> 7) * (sintable[(vardc * -51 + vard8) & 2047] << 4); p->posyv += (vard4 >> 7) * (sintable[(vardc * -51 + vard8) & 2047] << 4);
ang = vare0 >> 6; ang = vare0 >> 6;
} }
playerAddAngle(&p->q16ang, &p->angAdjust, FixedToFloat(getincangleq16(p->q16ang, IntToFixed(vard8 - ang)))); p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), IntToFixed(vard8 - ang))));
} }
if (p->NotOnWater) if (p->NotOnWater)
if (p->MotoSpeed > 50) if (p->MotoSpeed > 50)
@ -2427,9 +2427,9 @@ static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz)
{ {
j = fi.spawn(pi, WATERBUBBLE); j = fi.spawn(pi, WATERBUBBLE);
sprite[j].x += sprite[j].x +=
sintable[(p->getang() + 512 + 64 - (global_random & 128) + 128) & 2047] >> 6; sintable[(p->angle.ang.asbuild() + 512 + 64 - (global_random & 128) + 128) & 2047] >> 6;
sprite[j].y += sprite[j].y +=
sintable[(p->getang() + 64 - (global_random & 128) + 128) & 2047] >> 6; sintable[(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128) & 2047] >> 6;
sprite[j].xrepeat = 3; sprite[j].xrepeat = 3;
sprite[j].yrepeat = 2; sprite[j].yrepeat = 2;
sprite[j].z = p->posz + (8 << 8); sprite[j].z = p->posz + (8 << 8);
@ -2454,7 +2454,7 @@ void onMotorcycleMove(int snum, int psect, int j)
var104 = 0; var104 = 0;
j &= (MAXWALLS - 1); j &= (MAXWALLS - 1);
var108 = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y); var108 = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y);
var10c = abs(p->getang() - var108); var10c = abs(p->angle.ang.asbuild() - var108);
int ang; int ang;
switch (krand() & 1) switch (krand() & 1)
{ {
@ -2465,7 +2465,7 @@ void onMotorcycleMove(int snum, int psect, int j)
ang = -(p->MotoSpeed >> 1); ang = -(p->MotoSpeed >> 1);
break; break;
} }
playerAddAngle(&p->q16ang, &p->angAdjust, ang); p->angle.addadjustment(ang);
if (var10c >= 441 && var10c <= 581) if (var10c >= 441 && var10c <= 581)
{ {
var104 = (p->MotoSpeed * p->MotoSpeed) >> 8; var104 = (p->MotoSpeed * p->MotoSpeed) >> 8;
@ -2521,7 +2521,7 @@ void onBoatMove(int snum, int psect, int j)
short var114, var118; short var114, var118;
j &= (MAXWALLS - 1); j &= (MAXWALLS - 1);
var114 = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y); var114 = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y);
var118 = abs(p->getang() - var114); var118 = abs(p->angle.ang.asbuild() - var114);
int ang; int ang;
switch (krand() & 1) switch (krand() & 1)
{ {
@ -2532,7 +2532,7 @@ void onBoatMove(int snum, int psect, int j)
ang = -(p->MotoSpeed >> 2); ang = -(p->MotoSpeed >> 2);
break; break;
} }
playerAddAngle(&p->q16ang, &p->angAdjust, ang); p->angle.addadjustment(ang);
if (var118 >= 441 && var118 <= 581) if (var118 >= 441 && var118 <= 581)
{ {
p->MotoSpeed = ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 2; p->MotoSpeed = ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 2;
@ -2580,8 +2580,8 @@ void onMotorcycleHit(int snum, int var60)
{ {
if (numplayers == 1) if (numplayers == 1)
{ {
fi.movesprite(var60, sintable[int(p->TiltStatus * 20 + p->getang() + 512) & 2047] >> 8, fi.movesprite(var60, sintable[int(p->TiltStatus * 20 + p->angle.ang.asbuild() + 512) & 2047] >> 8,
sintable[int(p->TiltStatus * 20 + p->getang()) & 2047] >> 8, sprite[var60].zvel, CLIPMASK0); sintable[int(p->TiltStatus * 20 + p->angle.ang.asbuild()) & 2047] >> 8, sprite[var60].zvel, CLIPMASK0);
} }
} }
else else
@ -2637,8 +2637,8 @@ void onBoatHit(int snum, int var60)
{ {
if (numplayers == 1) if (numplayers == 1)
{ {
fi.movesprite(var60, sintable[int(p->TiltStatus * 20 + p->getang() + 512) & 2047] >> 9, fi.movesprite(var60, sintable[int(p->TiltStatus * 20 + p->angle.ang.asbuild() + 512) & 2047] >> 9,
sintable[int(p->TiltStatus * 20 + p->getang()) & 2047] >> 9, sprite[var60].zvel, CLIPMASK0); sintable[int(p->TiltStatus * 20 + p->angle.ang.asbuild()) & 2047] >> 9, sprite[var60].zvel, CLIPMASK0);
} }
} }
else else
@ -2852,10 +2852,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
} }
j = EGS(p->cursectnum, j = EGS(p->cursectnum,
p->posx + (sintable[(p->getang() + 512) & 2047] >> 6), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
p->posy + (sintable[p->getang() & 2047] >> 6), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
p->posz, HEAVYHBOMB, -16, 9, 9, p->posz, HEAVYHBOMB, -16, 9, 9,
p->getang(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pi, 1); p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pi, 1);
if (k == 15) if (k == 15)
{ {
@ -2904,8 +2904,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
p->visibility = 0; p->visibility = 0;
if (psectlotag != 857) if (psectlotag != 857)
{ {
p->posxv -= sintable[(p->getang() + 512) & 2047] << 4; p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
p->posyv -= sintable[p->getang() & 2047] << 4; p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 4;
} }
} }
else if (p->kickback_pic == 2) else if (p->kickback_pic == 2)
@ -3004,14 +3004,14 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (psectlotag != 857) if (psectlotag != 857)
{ {
p->posxv -= sintable[(p->getang() + 512) & 2047] << 5; p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 5;
p->posyv -= sintable[p->getang() & 2047] << 5; p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 5;
} }
} }
else if (psectlotag != 857) else if (psectlotag != 857)
{ {
p->posxv -= sintable[(p->getang() + 512) & 2047] << 4; p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
p->posyv -= sintable[p->getang() & 2047] << 4; p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 4;
} }
} }
@ -3095,8 +3095,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (psectlotag != 857) if (psectlotag != 857)
{ {
p->posxv -= sintable[(p->getang() + 512) & 2047] << 4; p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
p->posyv -= sintable[p->getang() & 2047] << 4; p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 4;
} }
checkavailweapon(p); checkavailweapon(p);
@ -3156,11 +3156,11 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
} }
if (p->kickback_pic == 2) if (p->kickback_pic == 2)
{ {
playerAddAngle(&p->q16ang, &p->angAdjust, 16); p->angle.addadjustment(16);
} }
else if (p->kickback_pic == 4) else if (p->kickback_pic == 4)
{ {
playerAddAngle(&p->q16ang, &p->angAdjust, -16); p->angle.addadjustment(-16);
} }
if (p->kickback_pic > 4) if (p->kickback_pic > 4)
p->kickback_pic = 1; p->kickback_pic = 1;
@ -3186,11 +3186,11 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
} }
if (p->kickback_pic == 2) if (p->kickback_pic == 2)
{ {
playerAddAngle(&p->q16ang, &p->angAdjust, 4); p->angle.addadjustment(4);
} }
else if (p->kickback_pic == 4) else if (p->kickback_pic == 4)
{ {
playerAddAngle(&p->q16ang, &p->angAdjust, -4); p->angle.addadjustment(-4);
} }
if (p->kickback_pic > 4) if (p->kickback_pic > 4)
p->kickback_pic = 1; p->kickback_pic = 1;
@ -3236,8 +3236,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
} }
else if (p->kickback_pic == 12) else if (p->kickback_pic == 12)
{ {
p->posxv -= sintable[(p->getang() + 512) & 2047] << 4; p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
p->posyv -= sintable[p->getang() & 2047] << 4; p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 4;
p->horizon.addadjustment(20); p->horizon.addadjustment(20);
p->recoil += 20; p->recoil += 20;
} }
@ -3262,10 +3262,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
} }
j = EGS(p->cursectnum, j = EGS(p->cursectnum,
p->posx + (sintable[(p->getang() + 512) & 2047] >> 6), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
p->posy + (sintable[p->getang() & 2047] >> 6), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
p->posz, TRIPBOMBSPRITE, -16, 9, 9, p->posz, TRIPBOMBSPRITE, -16, 9, 9,
p->getang(), k * 2, i, pi, 1); p->angle.ang.asbuild(), k * 2, i, pi, 1);
} }
p->kickback_pic++; p->kickback_pic++;
if (p->kickback_pic > 20) if (p->kickback_pic > 20)
@ -3286,8 +3286,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
} }
if (p->kickback_pic < 30) if (p->kickback_pic < 30)
{ {
p->posxv += sintable[(p->getang() + 512) & 2047] << 4; p->posxv += sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
p->posyv += sintable[p->getang() & 2047] << 4; p->posyv += sintable[p->angle.ang.asbuild() & 2047] << 4;
} }
p->kickback_pic++; p->kickback_pic++;
if (p->kickback_pic > 40) if (p->kickback_pic > 40)
@ -3741,7 +3741,7 @@ void processinput_r(int snum)
// may still be needed later for demo recording // may still be needed later for demo recording
processq16avel(p, &sb_avel); processq16avel(p, &sb_avel);
applylook(&p->q16ang, &p->q16look_ang, &p->q16rotscrnang, &p->one_eighty_count, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH); applylook(&p->angle, sb_avel, &p->sync.actions, 1, p->crouch_toggle || actions & SB_CROUCH);
apply_seasick(p, 1); apply_seasick(p, 1);
} }
@ -4170,7 +4170,7 @@ void OnMotorcycle(struct player_struct *p, int motosprite)
{ {
p->posx = sprite[motosprite].x; p->posx = sprite[motosprite].x;
p->posy = sprite[motosprite].y; p->posy = sprite[motosprite].y;
p->setang(sprite[motosprite].ang); p->angle.ang = buildang(sprite[motosprite].ang);
p->ammo_amount[MOTORCYCLE_WEAPON] = sprite[motosprite].owner; p->ammo_amount[MOTORCYCLE_WEAPON] = sprite[motosprite].owner;
deletesprite(motosprite); deletesprite(motosprite);
} }
@ -4222,13 +4222,13 @@ void OffMotorcycle(struct player_struct *p)
p->TurbCount = 0; p->TurbCount = 0;
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->posxv -= sintable[(p->getang()+512)&2047]<<7; p->posxv -= sintable[(p->angle.ang.asbuild()+512)&2047]<<7;
p->posyv -= sintable[p->getang()&2047]<<7; p->posyv -= sintable[p->angle.ang.asbuild()&2047]<<7;
p->moto_underwater = 0; p->moto_underwater = 0;
j = fi.spawn(p->i, EMPTYBIKE); j = fi.spawn(p->i, EMPTYBIKE);
sprite[j].ang = p->getang(); sprite[j].ang = p->angle.ang.asbuild();
sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; sprite[j].xvel += sintable[(p->angle.ang.asbuild()+512)&2047]<<7;
sprite[j].yvel += sintable[p->getang()&2047]<<7; sprite[j].yvel += sintable[p->angle.ang.asbuild()&2047]<<7;
sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON]; sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON];
} }
} }
@ -4247,7 +4247,7 @@ void OnBoat(struct player_struct *p, int boatsprite)
{ {
p->posx = sprite[boatsprite].x; p->posx = sprite[boatsprite].x;
p->posy = sprite[boatsprite].y; p->posy = sprite[boatsprite].y;
p->setang(sprite[boatsprite].ang); p->angle.ang = buildang(sprite[boatsprite].ang);
p->ammo_amount[BOAT_WEAPON] = sprite[boatsprite].owner; p->ammo_amount[BOAT_WEAPON] = sprite[boatsprite].owner;
deletesprite(boatsprite); deletesprite(boatsprite);
} }
@ -4287,13 +4287,13 @@ void OffBoat(struct player_struct *p)
p->TurbCount = 0; p->TurbCount = 0;
p->posxv = 0; p->posxv = 0;
p->posyv = 0; p->posyv = 0;
p->posxv -= sintable[(p->getang()+512)&2047]<<7; p->posxv -= sintable[(p->angle.ang.asbuild()+512)&2047]<<7;
p->posyv -= sintable[p->getang()&2047]<<7; p->posyv -= sintable[p->angle.ang.asbuild()&2047]<<7;
p->moto_underwater = 0; p->moto_underwater = 0;
j = fi.spawn(p->i, EMPTYBOAT); j = fi.spawn(p->i, EMPTYBOAT);
sprite[j].ang = p->getang(); sprite[j].ang = p->angle.ang.asbuild();
sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7; sprite[j].xvel += sintable[(p->angle.ang.asbuild()+512)&2047]<<7;
sprite[j].yvel += sintable[p->getang()&2047]<<7; sprite[j].yvel += sintable[p->angle.ang.asbuild()&2047]<<7;
sprite[j].owner = p->ammo_amount[BOAT_WEAPON]; sprite[j].owner = p->ammo_amount[BOAT_WEAPON];
} }
} }

View file

@ -342,10 +342,10 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
} }
j = EGS(p->cursectnum, j = EGS(p->cursectnum,
p->posx + (sintable[(p->getang() + 512) & 2047] >> 6), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
p->posy + (sintable[p->getang() & 2047] >> 6), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
p->posz, HEAVYHBOMB, -16, 9, 9, p->posz, HEAVYHBOMB, -16, 9, 9,
p->getang(), (k + (p->hbomb_hold_delay << 5)), i, pi, 1); p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, pi, 1);
{ {
int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, snum); int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, snum);

View file

@ -39,7 +39,7 @@ BEGIN_DUKE_NS
int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel; int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
short globalskillsound; short globalskillsound;
fixed_t q16myang, oq16myang; binangle myang, omyang;
fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff; fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff;
short mycursectnum, myjumpingcounter; short mycursectnum, myjumpingcounter;
char myjumpingtoggle, myonground, myhardlanding,myreturntocenter; char myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
@ -55,7 +55,7 @@ void resetmys()
myy = omyy = ps[myconnectindex].posy; myy = omyy = ps[myconnectindex].posy;
myz = omyz = ps[myconnectindex].posz; myz = omyz = ps[myconnectindex].posz;
myxvel = myyvel = myzvel = 0; myxvel = myyvel = myzvel = 0;
q16myang = oq16myang = ps[myconnectindex].q16ang; myang = myang = ps[myconnectindex].angle.ang;
myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz; myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz;
myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff; myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff;
mycursectnum = ps[myconnectindex].cursectnum; mycursectnum = ps[myconnectindex].cursectnum;
@ -214,7 +214,7 @@ void fakedomovethings(void)
if(p->on_crane >= 0) goto FAKEHORIZONLY; if(p->on_crane >= 0) goto FAKEHORIZONLY;
if(p->one_eighty_count < 0) myang += 128; if(p->angle.spin.asbam() < 0) myang += 128;
i = 40; i = 40;

View file

@ -5,7 +5,7 @@ BEGIN_DUKE_NS
extern int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel; extern int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
extern short globalskillsound; extern short globalskillsound;
extern short mycursectnum, myjumpingcounter; extern short mycursectnum, myjumpingcounter;
extern fixed_t q16myang, oq16myang; extern binangle myang, omyang;
extern fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff; extern fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff;
extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter; extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
extern int fakemovefifoplc; extern int fakemovefifoplc;

View file

@ -59,8 +59,7 @@ void pickrandomspot(int snum)
p->bobposx = p->oposx = p->posx = po[i].ox; p->bobposx = p->oposx = p->posx = po[i].ox;
p->bobposy = p->oposy = p->posy = po[i].oy; p->bobposy = p->oposy = p->posy = po[i].oy;
p->oposz = p->posz = po[i].oz; p->oposz = p->posz = po[i].oz;
p->setang(po[i].oa); p->angle.oang = p->angle.ang = buildang(po[i].oa);
p->setoang(po[i].oa);
p->cursectnum = po[i].os; p->cursectnum = po[i].os;
} }
@ -139,11 +138,9 @@ void resetplayerstats(int snum)
p->jetpack_on = 0; p->jetpack_on = 0;
p->holoduke_on = -1; p->holoduke_on = -1;
p->setlookang(512 - ((currentLevel->levelNumber & 1) << 10)); p->angle.olook_ang = p->angle.look_ang = buildlook(512 - ((currentLevel->levelNumber & 1) << 10));
p->oq16look_ang = p->q16look_ang; p->angle.orotscrnang = p->angle.rotscrnang = buildlook(0);
p->setrotscrnang(0);
p->oq16rotscrnang = p->q16rotscrnang;
p->newowner =-1; p->newowner =-1;
p->jumping_counter = 0; p->jumping_counter = 0;
p->hard_landing = 0; p->hard_landing = 0;
@ -153,7 +150,7 @@ void resetplayerstats(int snum)
p->fric.x = 0; p->fric.x = 0;
p->fric.y = 0; p->fric.y = 0;
p->somethingonplayer =-1; p->somethingonplayer =-1;
p->one_eighty_count = 0; p->angle.spin = bamlook(0);
p->on_crane = -1; p->on_crane = -1;
@ -511,7 +508,7 @@ void resetpspritevars(int g)
STATUSBARTYPE tsbar[MAXPLAYERS]; STATUSBARTYPE tsbar[MAXPLAYERS];
EGS(ps[0].cursectnum, ps[0].posx, ps[0].posy, ps[0].posz, EGS(ps[0].cursectnum, ps[0].posx, ps[0].posy, ps[0].posz,
TILE_APLAYER, 0, 0, 0, ps[0].getang(), 0, 0, 0, 10); TILE_APLAYER, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, 0, 10);
if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++) if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++)
{ {
@ -636,8 +633,7 @@ void resetpspritevars(int g)
hittype[i].bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x; hittype[i].bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x;
hittype[i].bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y; hittype[i].bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y;
hittype[i].bposz = ps[j].oposz = ps[j].posz = s->z; hittype[i].bposz = ps[j].oposz = ps[j].posz = s->z;
ps[j].setang(s->ang); ps[j].angle.oang = ps[j].angle.ang = buildang(s->ang);
ps[j].setoang(s->ang);
updatesector(s->x, s->y, &ps[j].cursectnum); updatesector(s->x, s->y, &ps[j].cursectnum);
@ -874,7 +870,7 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
ps[0].ammo_amount[i] = 0; ps[0].ammo_amount[i] = 0;
ps[0].gotweapon.Clear(KNEE_WEAPON); ps[0].gotweapon.Clear(KNEE_WEAPON);
} }
p->setang(lbang); p->angle.ang = buildang(lbang);
memset(gotpic, 0, sizeof(gotpic)); memset(gotpic, 0, sizeof(gotpic));

View file

@ -478,8 +478,8 @@ void displayrooms(int snum, double smoothratio)
int cposx, cposy, cposz, fz, cz; int cposx, cposy, cposz, fz, cz;
short sect; short sect;
binangle cang; binangle cang;
lookangle rotscrnang;
fixedhoriz choriz; fixedhoriz choriz;
fixed_t q16rotscrnang;
struct player_struct* p; struct player_struct* p;
int tiltcs = 0; // JBF 20030807 int tiltcs = 0; // JBF 20030807
@ -545,7 +545,7 @@ void displayrooms(int snum, double smoothratio)
} }
// set screen rotation. // set screen rotation.
q16rotscrnang = !cl_syncinput ? p->q16rotscrnang : p->oq16rotscrnang + fmulscale16(((p->q16rotscrnang - p->oq16rotscrnang + dang) & 0x7FFFFFF) - dang, smoothratio); rotscrnang = !cl_syncinput ? p->angle.rotscrnang : p->angle.interpolatedrotscrn(smoothratio);
if ((snum == myconnectindex) && (numplayers > 1)) if ((snum == myconnectindex) && (numplayers > 1))
{ {
@ -557,12 +557,12 @@ void displayrooms(int snum, double smoothratio)
fixed_t ohorz = (omyhoriz.asq16() + omyhorizoff.asq16()); fixed_t ohorz = (omyhoriz.asq16() + omyhorizoff.asq16());
fixed_t horz = (myhoriz.asq16() + myhorizoff.asq16()); fixed_t horz = (myhoriz.asq16() + myhorizoff.asq16());
choriz = q16horiz(ohorz + xs_CRoundToInt(fmulscale16(horz - ohorz, smoothratio))); choriz = q16horiz(ohorz + xs_CRoundToInt(fmulscale16(horz - ohorz, smoothratio)));
cang = q16ang(oq16myang + xs_CRoundToInt(fmulscale16(((q16myang + dang - oq16myang) & 0x7FFFFFF) - dang, smoothratio))); cang = bamang(xs_CRoundToUInt(omyang.asbam() + fmulscale16(myang.asbam() - omyang.asbam(), smoothratio)));
} }
else else
{ {
cang = q16ang(q16myang); cang = myang;
choriz = q16horiz(myhoriz.asq16() + myhorizoff.asq16()); choriz = myhoriz + myhorizoff;
} }
sect = mycursectnum; sect = mycursectnum;
} }
@ -575,15 +575,12 @@ void displayrooms(int snum, double smoothratio)
{ {
// Original code for when the values are passed through the sync struct // Original code for when the values are passed through the sync struct
choriz = p->horizon.interpolatedsum(smoothratio); choriz = p->horizon.interpolatedsum(smoothratio);
cang = p->angle.interpolatedsum(smoothratio);
fixed_t oang = (p->oq16ang + p->oq16look_ang);
fixed_t ang = (p->q16ang + p->q16look_ang);
cang = q16ang(oang + xs_CRoundToInt(fmulscale16(((ang + dang - oang) & 0x7FFFFFF) - dang, smoothratio)));
} }
else else
{ {
// This is for real time updating of the view direction. // This is for real time updating of the view direction.
cang = q16ang(p->q16ang + p->q16look_ang); cang = p->angle.sum();
choriz = p->horizon.sum(); choriz = p->horizon.sum();
} }
} }
@ -596,7 +593,7 @@ void displayrooms(int snum, double smoothratio)
cposy = sprite[p->newowner].pos.y; cposy = sprite[p->newowner].pos.y;
cposz = sprite[p->newowner].pos.z; cposz = sprite[p->newowner].pos.z;
sect = sprite[p->newowner].sectnum; sect = sprite[p->newowner].sectnum;
q16rotscrnang = 0; rotscrnang = buildlook(0);
smoothratio = MaxSmoothRatio; smoothratio = MaxSmoothRatio;
} }
else if (p->over_shoulder_on == 0) else if (p->over_shoulder_on == 0)
@ -615,7 +612,7 @@ void displayrooms(int snum, double smoothratio)
} }
// do screen rotation. // do screen rotation.
renderSetRollAngle(FixedToInt(q16rotscrnang)); renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT));
cz = hittype[p->i].ceilingz; cz = hittype[p->i].ceilingz;
fz = hittype[p->i].floorz; fz = hittype[p->i].floorz;

View file

@ -113,12 +113,12 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
arc("posx", w.posx) arc("posx", w.posx)
("posy", w.posy) ("posy", w.posy)
("posz", w.posz) ("posz", w.posz)
("q16ang", w.q16ang) //("q16ang", w.angle.ang.asq16())
//("q16horiz", w.horizon.horiz.asq16()) //("q16horiz", w.horizon.horiz.asq16())
//("q16horizoff", w.horizon.horizoff.asq16()) //("q16horizoff", w.horizon.horizoff.asq16())
("q16rotscrnang", w.q16rotscrnang) //("q16rotscrnang", w.angle.rotscrnang.asbuild())
("q16look_ang", w.q16look_ang) //("q16look_ang", w.angle.look_ang.asq16())
("one_eighty_count", w.one_eighty_count) //("one_eighty_count", w.angle.spin.asq16())
("gotweapon", w.gotweapon) ("gotweapon", w.gotweapon)
("palette", w.palette) ("palette", w.palette)
("pals", w.pals) ("pals", w.pals)
@ -284,10 +284,10 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
.EndObject(); .EndObject();
w.invdisptime = 0; w.invdisptime = 0;
w.oq16ang = w.q16ang; //w.angle.oang = w.angle.ang;
//w.horizon.ohoriz = w.horizon.horiz; //w.horizon.ohoriz = w.horizon.horiz;
//w.horizon.ohorizoff = w.horizon.horizoff; //w.horizon.ohorizoff = w.horizon.horizoff;
w.oq16rotscrnang = w.q16rotscrnang; //w.oq16rotscrnang = w.angle.rotscrnang;
w.oposx = w.posx; w.oposx = w.posx;
w.oposy = w.posy; w.oposy = w.posy;
w.oposz = w.posz; w.oposz = w.posz;

View file

@ -1149,8 +1149,8 @@ void moveclouds(double smoothratio)
cloudclock = myclock + 6; cloudclock = myclock + 6;
// cloudx/y were an array, but all entries were always having the same value so a single pair is enough. // cloudx/y were an array, but all entries were always having the same value so a single pair is enough.
cloudx += (sintable[(ps[screenpeek].getang() + 512) & 2047] >> 9); cloudx += (sintable[(ps[screenpeek].angle.ang.asbuild() + 512) & 2047] >> 9);
cloudy += (sintable[ps[screenpeek].getang() & 2047] >> 9); cloudy += (sintable[ps[screenpeek].angle.ang.asbuild() & 2047] >> 9);
for (int i = 0; i < numclouds; i++) for (int i = 0; i < numclouds; i++)
{ {
sector[clouds[i]].ceilingxpanning = cloudx >> 6; sector[clouds[i]].ceilingxpanning = cloudx >> 6;

View file

@ -719,7 +719,7 @@ void checkhitwall_d(int spr, int dawallnum, int x, int y, int z, int atwith)
if (wal->nextwall >= 0) if (wal->nextwall >= 0)
wall[wal->nextwall].cstat = 0; wall[wal->nextwall].cstat = 0;
i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].getang(), 0, 0, spr, 3); i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
sprite[i].lotag = 128; hittype[i].temp_data[1] = 5; hittype[i].temp_data[2] = dawallnum; sprite[i].lotag = 128; hittype[i].temp_data[1] = 5; hittype[i].temp_data[2] = dawallnum;
S_PlayActorSound(GLASS_BREAKING, i); S_PlayActorSound(GLASS_BREAKING, i);
return; return;
@ -921,13 +921,13 @@ void checkplayerhurt_d(struct player_struct* p, int j)
p->hurt_delay = 16; p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0)); SetPlayerPal(p, PalEntry(32, 32, 0, 0));
p->posxv = -(sintable[(p->getang() + 512) & 2047] << 8); p->posxv = -(sintable[(p->angle.ang.asbuild() + 512) & 2047] << 8);
p->posyv = -(sintable[(p->getang()) & 2047] << 8); p->posyv = -(sintable[(p->angle.ang.asbuild()) & 2047] << 8);
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->i); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->i);
fi.checkhitwall(p->i, j, fi.checkhitwall(p->i, j,
p->posx + (sintable[(p->getang() + 512) & 2047] >> 9), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 9),
p->posy + (sintable[p->getang() & 2047] >> 9), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 9),
p->posz, -1); p->posz, -1);
break; break;
@ -935,8 +935,8 @@ void checkplayerhurt_d(struct player_struct* p, int j)
case BIGFORCE: case BIGFORCE:
p->hurt_delay = 26; p->hurt_delay = 26;
fi.checkhitwall(p->i, j, fi.checkhitwall(p->i, j,
p->posx + (sintable[(p->getang() + 512) & 2047] >> 9), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 9),
p->posy + (sintable[p->getang() & 2047] >> 9), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 9),
p->posz, -1); p->posz, -1);
break; break;
@ -1460,7 +1460,7 @@ void checkhitsprite_d(int i, int sn)
ps[p].posx = ps[p].oposx; ps[p].posx = ps[p].oposx;
ps[p].posy = ps[p].oposy; ps[p].posy = ps[p].oposy;
ps[p].posz = ps[p].oposz; ps[p].posz = ps[p].oposz;
ps[p].q16ang = ps[p].oq16ang; ps[p].angle.restore();
updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum); updatesector(ps[p].posx, ps[p].posy, &ps[p].cursectnum);
setpal(&ps[p]); setpal(&ps[p]);
@ -1580,17 +1580,17 @@ void checksectors_d(int snum)
return; return;
if (p->newowner >= 0) if (p->newowner >= 0)
neartag(p->oposx, p->oposy, p->oposz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); neartag(p->oposx, p->oposy, p->oposz, sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
else else
{ {
neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (8 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); neartag(p->posx, p->posy, p->posz + (8 << 8), sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
{ {
neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
if (neartagsprite >= 0) if (neartagsprite >= 0)
{ {
switch (sprite[neartagsprite].picnum) switch (sprite[neartagsprite].picnum)

View file

@ -1033,7 +1033,7 @@ void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith)
if (wal->nextwall >= 0) if (wal->nextwall >= 0)
wall[wal->nextwall].cstat = 0; wall[wal->nextwall].cstat = 0;
i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].getang(), 0, 0, spr, 3); i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
sprite[i].lotag = 128; hittype[i].temp_data[1] = 2; hittype[i].temp_data[2] = dawallnum; sprite[i].lotag = 128; hittype[i].temp_data[1] = 2; hittype[i].temp_data[2] = dawallnum;
S_PlayActorSound(GLASS_BREAKING, i); S_PlayActorSound(GLASS_BREAKING, i);
return; return;
@ -1047,7 +1047,7 @@ void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith)
if (wal->nextwall >= 0) if (wal->nextwall >= 0)
wall[wal->nextwall].cstat = 0; wall[wal->nextwall].cstat = 0;
i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].getang(), 0, 0, spr, 3); i = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3);
sprite[i].lotag = 128; hittype[i].temp_data[1] = 2; hittype[i].temp_data[2] = dawallnum; sprite[i].lotag = 128; hittype[i].temp_data[1] = 2; hittype[i].temp_data[2] = dawallnum;
S_PlayActorSound(GLASS_BREAKING, i); S_PlayActorSound(GLASS_BREAKING, i);
return; return;
@ -1419,8 +1419,8 @@ void checkplayerhurt_r(struct player_struct* p, int j)
case BIGFORCE: case BIGFORCE:
p->hurt_delay = 26; p->hurt_delay = 26;
fi.checkhitwall(p->i, j, fi.checkhitwall(p->i, j,
p->posx + (sintable[(p->getang() + 512) & 2047] >> 9), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 9),
p->posy + (sintable[p->getang() & 2047] >> 9), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 9),
p->posz, -1); p->posz, -1);
break; break;
@ -2555,21 +2555,21 @@ void checksectors_r(int snum)
} }
return; return;
} }
neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
} }
if (p->newowner >= 0) if (p->newowner >= 0)
neartag(p->oposx, p->oposy, p->oposz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); neartag(p->oposx, p->oposy, p->oposz, sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
else else
{ {
neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); neartag(p->posx, p->posy, p->posz, sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (8 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); neartag(p->posx, p->posy, p->posz + (8 << 8), sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1);
if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1) if (neartagsprite == -1 && neartagwall == -1 && neartagsector == -1)
{ {
neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->getoang(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); neartag(p->posx, p->posy, p->posz + (16 << 8), sprite[p->i].sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3);
if (neartagsprite >= 0) if (neartagsprite >= 0)
{ {
switch (sprite[neartagsprite].picnum) switch (sprite[neartagsprite].picnum)

View file

@ -302,7 +302,7 @@ void S_GetCamera(vec3_t** c, int32_t* ca, int32_t* cs)
auto p = &ps[screenpeek]; auto p = &ps[screenpeek];
if (c) *c = &p->pos; if (c) *c = &p->pos;
if (cs) *cs = p->cursectnum; if (cs) *cs = p->cursectnum;
if (ca) *ca = p->getang(); if (ca) *ca = p->angle.ang.asbuild();
} }
else else
{ {

View file

@ -435,7 +435,7 @@ void initshell(int j, int i, bool isshell)
if (sprite[j].picnum == TILE_APLAYER) if (sprite[j].picnum == TILE_APLAYER)
{ {
snum = sprite[j].yvel; snum = sprite[j].yvel;
a = ps[snum].getang() - (krand() & 63) + 8; //Fine tune a = ps[snum].angle.ang.asbuild() - (krand() & 63) + 8; //Fine tune
t[0] = krand() & 1; t[0] = krand() & 1;
sp->z = (3 << 8) + ps[snum].pyoff + ps[snum].posz - (ps[snum].horizon.sum().asq16() >> 12) + (!isshell ? (3 << 8) : 0); sp->z = (3 << 8) + ps[snum].pyoff + ps[snum].posz - (ps[snum].horizon.sum().asq16() >> 12) + (!isshell ? (3 << 8) : 0);

View file

@ -95,13 +95,9 @@ struct player_struct
struct { int32_t posx, posy, posz; }; struct { int32_t posx, posy, posz; };
}; };
// input handles angle as fixed16 numbers. We need to account for that as well. // player's horizon and angle structs.
fixed_t q16ang, q16rotscrnang, q16look_ang;
fixed_t oq16ang, oq16rotscrnang, oq16look_ang; // These are only needed with synchronous mouse input.
fixed_t one_eighty_count;
// player's horison struct.
PlayerHorizon horizon; PlayerHorizon horizon;
PlayerAngle angle;
// using a bit field for this to save a bit of space. // using a bit field for this to save a bit of space.
FixedBitArray<MAX_WEAPONS> gotweapon; FixedBitArray<MAX_WEAPONS> gotweapon;
@ -210,23 +206,7 @@ struct player_struct
int8_t crouch_toggle; int8_t crouch_toggle;
// input stuff. // input stuff.
double angAdjust;
fixed_t angTarget;
InputPacket sync; InputPacket sync;
// Access helpers for the widened angle fields.
void setlookang(int b) { q16look_ang = IntToFixed(b); }
void addlookang(int b) { q16look_ang += IntToFixed(b); }
void addlookang(double b) { q16look_ang += FloatToFixed(b); }
void setrotscrnang(int b) { q16rotscrnang = IntToFixed(b); }
void addrotscrnang(int b) { q16rotscrnang += IntToFixed(b); }
void addrotscrnang(double b) { q16rotscrnang += FloatToFixed(b); }
int getang() { return FixedToInt(q16ang); }
int getoang() { return FixedToInt(oq16ang); }
void setang(int v) { q16ang = IntToFixed(v); }
void addang(int v) { q16ang = (q16ang + IntToFixed(v)) & 0x7FFFFFF; }
void setoang(int v) { oq16ang = IntToFixed(v); }
}; };

View file

@ -1530,7 +1530,7 @@ UpdatePlayerSpriteAngle(PLAYERp pp)
void void
DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust) DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust)
{ {
applylook(&pp->q16ang, &pp->q16look_ang, &pp->q16rotscrnang, &pp->turn180_target, q16avel, &pp->input.actions, scaleAdjust, pp->input.actions & (SB_CROUCH|SB_CROUCH_LOCK)); applylook2(&pp->q16ang, &pp->q16look_ang, &pp->q16rotscrnang, &pp->turn180_target, q16avel, &pp->input.actions, scaleAdjust, pp->input.actions & (SB_CROUCH|SB_CROUCH_LOCK));
UpdatePlayerSpriteAngle(pp); UpdatePlayerSpriteAngle(pp);
} }
@ -3671,7 +3671,7 @@ DoPlayerClimb(PLAYERp pp)
pp->lx = lsp->x + nx * 5; pp->lx = lsp->x + nx * 5;
pp->ly = lsp->y + ny * 5; pp->ly = lsp->y + ny * 5;
playerSetAngle(&pp->q16ang, &pp->angTarget, pp->LadderAngle); playerSetAngle2(&pp->q16ang, &pp->angTarget, pp->LadderAngle);
} }
} }
} }
@ -4126,7 +4126,7 @@ PlayerOnLadder(PLAYERp pp)
pp->lx = lsp->x + nx * 5; pp->lx = lsp->x + nx * 5;
pp->ly = lsp->y + ny * 5; pp->ly = lsp->y + ny * 5;
playerSetAngle(&pp->q16ang, &pp->angTarget, pp->LadderAngle); playerSetAngle2(&pp->q16ang, &pp->angTarget, pp->LadderAngle);
return true; return true;
} }
@ -5365,7 +5365,7 @@ DoPlayerBeginOperate(PLAYERp pp)
pp->sop = pp->sop_control = sop; pp->sop = pp->sop_control = sop;
sop->controller = pp->SpriteP; sop->controller = pp->SpriteP;
playerSetAngle(&pp->q16ang, &pp->angTarget, sop->ang); playerSetAngle2(&pp->q16ang, &pp->angTarget, sop->ang);
pp->posx = sop->xmid; pp->posx = sop->xmid;
pp->posy = sop->ymid; pp->posy = sop->ymid;
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
@ -5452,7 +5452,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
save_sectnum = pp->cursectnum; save_sectnum = pp->cursectnum;
playerSetAngle(&pp->q16ang, &pp->angTarget, sop->ang); playerSetAngle2(&pp->q16ang, &pp->angTarget, sop->ang);
pp->posx = sop->xmid; pp->posx = sop->xmid;
pp->posy = sop->ymid; pp->posy = sop->ymid;
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
@ -6242,7 +6242,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum)) if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum))
{ {
playerAddAngle(&pp->q16ang, &pp->angAdjust, getincangleq16(pp->q16ang, gethiq16angle(kp->x - pp->posx, kp->y - pp->posy)) / (double)(FRACUNIT << 4)); playerAddAngle2(&pp->q16ang, &pp->angAdjust, getincangleq16(pp->q16ang, gethiq16angle(kp->x - pp->posx, kp->y - pp->posy)) / (double)(FRACUNIT << 4));
} }
} }
} }
@ -7282,7 +7282,7 @@ domovethings(void)
// auto tracking mode for single player multi-game // auto tracking mode for single player multi-game
if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex) if (numplayers <= 1 && PlayerTrackingMode && pnum == screenpeek && screenpeek != myconnectindex)
{ {
playerSetAngle(&Player[screenpeek].q16ang, &Player[screenpeek].angTarget, FixedToFloat(gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy))); playerSetAngle2(&Player[screenpeek].q16ang, &Player[screenpeek].angTarget, FixedToFloat(gethiq16angle(Player[myconnectindex].posx - Player[screenpeek].posx, Player[myconnectindex].posy - Player[screenpeek].posy)));
} }
if (!TEST(pp->Flags, PF_DEAD)) if (!TEST(pp->Flags, PF_DEAD))

View file

@ -1678,7 +1678,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
// New angle is formed by taking last known angle and // New angle is formed by taking last known angle and
// adjusting by the delta angle // adjusting by the delta angle
playerAddAngle(&pp->q16ang, &pp->angAdjust, FixedToFloat(getincangleq16(pp->q16ang, pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng)))); playerAddAngle2(&pp->q16ang, &pp->angAdjust, FixedToFloat(getincangleq16(pp->q16ang, pp->RevolveQ16Ang + IntToFixed(pp->RevolveDeltaAng))));
UpdatePlayerSprite(pp); UpdatePlayerSprite(pp);
} }