mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- 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:
parent
e2691d4184
commit
fca846272e
37 changed files with 473 additions and 304 deletions
|
@ -55,7 +55,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
// Perform unsynchronised angle/horizon if not dead.
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1359,7 +1359,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
{
|
||||
fixed_t fraggerAng = gethiq16angle(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y);
|
||||
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;
|
||||
if (!bSeqStat)
|
||||
|
@ -1445,7 +1445,7 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,18 +41,20 @@
|
|||
#include "xs_Float.h" // needed for reliably overflowing float->int conversions.
|
||||
#include "build.h"
|
||||
|
||||
enum
|
||||
{
|
||||
BAMUNIT = 1 << 21
|
||||
};
|
||||
|
||||
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(unsigned int v);
|
||||
friend constexpr binangle q16ang(unsigned int v);
|
||||
friend constexpr binangle buildang(unsigned int v);
|
||||
friend constexpr binangle bamang(uint32_t v);
|
||||
friend constexpr binangle q16ang(uint32_t v);
|
||||
friend constexpr binangle buildang(uint32_t v);
|
||||
friend binangle radang(double v);
|
||||
friend binangle degang(double v);
|
||||
|
||||
|
@ -63,36 +65,15 @@ public:
|
|||
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 value * (90. / 0x40000000); }
|
||||
constexpr unsigned asbam() const { return value; }
|
||||
constexpr double asdeg() const { return AngleToFloat(value); }
|
||||
constexpr uint32_t asbam() const { return value; }
|
||||
|
||||
double fsin() const { return sin(asrad()); }
|
||||
double fcos() const { return cos(asrad()); }
|
||||
double ftan() const { return tan(asrad()); }
|
||||
int bsin() const { return sintable[asbuild()]; }
|
||||
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
|
||||
{
|
||||
return value == other.value;
|
||||
|
@ -124,15 +105,66 @@ public:
|
|||
{
|
||||
return binangle(value - other.value);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class lookangle
|
||||
{
|
||||
int32_t value;
|
||||
|
||||
void interpolate(binangle a1, binangle a2, fixed_t smoothratio)
|
||||
constexpr lookangle(int32_t v) : value(v) {}
|
||||
|
||||
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
|
||||
{
|
||||
// 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.
|
||||
// We do not want fixed point multiplications here to trash the result.
|
||||
double smooth = smoothratio / 65536.f;
|
||||
value = xs_CRoundToUInt(double(a1.asbam()) + smooth * (double(a2.asbam()) - double(a1.asbam())));
|
||||
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 q16ang(unsigned int v) { return binangle(v << 5); }
|
||||
inline constexpr binangle buildang(unsigned int v) { return binangle(v << 21); }
|
||||
inline binangle radang(double v) { return binangle(xs_CRoundToUInt(v * (0x80000000u / binangle::pi()))); }
|
||||
inline binangle degang(double v) { return binangle(xs_CRoundToUInt(v * (0x40000000 / 90.))); }
|
||||
inline constexpr binangle bamang(uint32_t v) { return binangle(v); }
|
||||
inline constexpr binangle q16ang(uint32_t v) { return binangle(v << 5); }
|
||||
inline constexpr binangle buildang(uint32_t v) { return binangle(v << 21); }
|
||||
inline binangle radang(double v) { return binangle(xs_CRoundToUInt(v * (0x80000000u / pi::pi()))); }
|
||||
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 buildhoriz(int v) { return fixedhoriz(IntToFixed(v)); }
|
||||
|
|
|
@ -1448,6 +1448,12 @@ void PlayerHorizon::backup()
|
|||
ohorizoff = horizoff;
|
||||
}
|
||||
|
||||
void PlayerHorizon::restore()
|
||||
{
|
||||
horiz = ohoriz;
|
||||
horizoff = ohorizoff;
|
||||
}
|
||||
|
||||
void PlayerHorizon::addadjustment(double value)
|
||||
{
|
||||
if (!cl_syncinput)
|
||||
|
@ -1509,6 +1515,92 @@ fixedhoriz PlayerHorizon::interpolatedsum(double const 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.
|
||||
|
@ -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)
|
||||
*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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -75,6 +75,7 @@ struct PlayerHorizon
|
|||
double adjustment;
|
||||
|
||||
void backup();
|
||||
void restore();
|
||||
void addadjustment(double value);
|
||||
void resetadjustment();
|
||||
void settarget(double value, bool backup = false);
|
||||
|
@ -83,11 +84,29 @@ struct PlayerHorizon
|
|||
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 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 playerAddAngle(fixed_t* q16ang, double* helper, double adjustment);
|
||||
void playerSetAngle(fixed_t* q16ang, fixed_t* helper, double adjustment);
|
||||
void applylook(PlayerAngle* angle, fixed_t const q16avel, ESyncBits* actions, double const scaleAdjust, bool const crouching);
|
||||
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 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);
|
||||
|
||||
struct UserConfig
|
||||
|
|
|
@ -128,7 +128,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -948,7 +948,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
if (cl_syncinput)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1046,7 +1046,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
if (nTotalPlayers <= 1)
|
||||
{
|
||||
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;
|
||||
sprite[nPlayerSprite].ang = ang;
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ void clearcamera(player_struct* ps)
|
|||
ps->posx = ps->oposx;
|
||||
ps->posy = ps->oposy;
|
||||
ps->posz = ps->oposz;
|
||||
ps->q16ang = ps->oq16ang;
|
||||
ps->angle.restore();
|
||||
updatesector(ps->posx, ps->posy, &ps->cursectnum);
|
||||
setpal(ps);
|
||||
|
||||
|
@ -383,7 +383,7 @@ void movedummyplayers(void)
|
|||
{
|
||||
sprite[i].cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
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)
|
||||
hittype[i].temp_data[0] = 0;
|
||||
else hittype[i].temp_data[0]++;
|
||||
|
@ -429,7 +429,7 @@ void moveplayers(void) //Players
|
|||
s->x = p->oposx;
|
||||
s->y = p->oposy;
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
@ -468,7 +468,7 @@ void moveplayers(void) //Players
|
|||
|
||||
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)
|
||||
|
@ -491,10 +491,10 @@ void moveplayers(void) //Players
|
|||
|
||||
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
|
||||
|
@ -532,7 +532,7 @@ void moveplayers(void) //Players
|
|||
if (s->extra < 8)
|
||||
{
|
||||
s->xvel = 128;
|
||||
s->ang = p->getang();
|
||||
s->ang = p->angle.ang.asbuild();
|
||||
s->extra++;
|
||||
//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
|
||||
|
@ -540,7 +540,7 @@ void moveplayers(void) //Players
|
|||
}
|
||||
else
|
||||
{
|
||||
s->ang = 2047 - (p->getang());
|
||||
s->ang = 2047 - (p->angle.ang.asbuild());
|
||||
setsprite(i, s->x, s->y, s->z);
|
||||
}
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ void movecrane(int i, int crane)
|
|||
s->owner = -2;
|
||||
ps[p].on_crane = 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
|
||||
{
|
||||
|
@ -834,7 +834,7 @@ void movecrane(int i, int crane)
|
|||
}
|
||||
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].oposy = ps[p].posy;
|
||||
ps[p].oposz = ps[p].posz;
|
||||
|
@ -1521,7 +1521,7 @@ bool queball(int i, int pocket, int queball, int stripeball)
|
|||
|
||||
// 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 (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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
int l;
|
||||
|
@ -1545,7 +1545,7 @@ bool queball(int i, int pocket, int queball, int stripeball)
|
|||
if (s->pal == 12)
|
||||
s->xvel = 164;
|
||||
else s->xvel = 140;
|
||||
s->ang = ps[p].getang();
|
||||
s->ang = ps[p].angle.ang.asbuild();
|
||||
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)
|
||||
{
|
||||
playerAddAngle(&ps[p].q16ang, &ps[p].angAdjust, l * q);
|
||||
ps[p].angle.addadjustment(l * q);
|
||||
|
||||
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].bobposy += x;
|
||||
|
||||
playerAddAngle(&ps[p].q16ang, &ps[p].angAdjust, q);
|
||||
ps[p].angle.addadjustment(q);
|
||||
|
||||
if (numplayers > 1)
|
||||
{
|
||||
|
|
|
@ -2098,7 +2098,7 @@ void movetransports_d(void)
|
|||
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)
|
||||
{
|
||||
|
@ -2454,7 +2454,7 @@ static void greenslime(int i)
|
|||
}
|
||||
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)
|
||||
ps[p].quick_kick = 14;
|
||||
}
|
||||
|
@ -2476,7 +2476,7 @@ static void greenslime(int i)
|
|||
|
||||
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 (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].posy = ps[p].oposy;
|
||||
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);
|
||||
setpal(&ps[p]);
|
||||
|
@ -2557,8 +2557,8 @@ static void greenslime(int i)
|
|||
s->xrepeat = 20 + (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->y = ps[p].posy + (sintable[ps[p].getang() & 2047] >> 7);
|
||||
s->x = ps[p].posx + (sintable[(ps[p].angle.ang.asbuild() + 512) & 2047] >> 7);
|
||||
s->y = ps[p].posy + (sintable[ps[p].angle.ang.asbuild() & 2047] >> 7);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1730,7 +1730,7 @@ void movetransports_r(void)
|
|||
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)
|
||||
{
|
||||
|
@ -2633,7 +2633,7 @@ void rr_specialstats()
|
|||
nextj = nextspritestat[j];
|
||||
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].bobposy = ps[p].oposy = ps[p].posy = sprite[j].y;
|
||||
ps[p].oposz = ps[p].posz = sprite[j].z - (36 << 8);
|
||||
|
|
|
@ -326,7 +326,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
|
|||
t->x = omyx + mulscale16((int)(myx - omyx), smoothratio);
|
||||
t->y = omyy + mulscale16((int)(myy - omyy), smoothratio);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -373,9 +373,7 @@ void animatesprites_r(int x,int y,int a,int smoothratio)
|
|||
t->x = omyx + mulscale16((int)(myx - omyx), smoothratio);
|
||||
t->y = omyy + mulscale16((int)(myy - omyy), smoothratio);
|
||||
t->z = omyz + mulscale16((int)(myz - omyz), smoothratio) + (40 << 8);
|
||||
int omyang = FixedToInt(oq16myang);
|
||||
int myang = FixedToInt(q16myang);
|
||||
t->ang = omyang + mulscale16((int)(((myang + 1024 - omyang) & 2047) - 1024), smoothratio);
|
||||
t->ang = omyang.asbuild() + mulscale16((((myang.asbuild() + 1024 - omyang.asbuild()) & 2047) - 1024), smoothratio);
|
||||
t->sectnum = mycursectnum;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ static int osdcmd_warptocoords(CCmdFuncPtr parm)
|
|||
|
||||
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)
|
||||
|
|
|
@ -241,7 +241,6 @@ void dointerpolations(int smoothratio);
|
|||
int* animateptr(int i);
|
||||
|
||||
void backuppos(player_struct* p, bool noclipping = false);
|
||||
void backuplook(player_struct* p);
|
||||
void backupweapon(player_struct* p);
|
||||
void resetinputhelpers(player_struct* p);
|
||||
void checkhardlanding(player_struct* p);
|
||||
|
|
|
@ -62,7 +62,7 @@ FString GameInterface::GetCoordString()
|
|||
FString out;
|
||||
|
||||
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);
|
||||
|
||||
return out;
|
||||
|
@ -274,20 +274,20 @@ void drawoverlays(double smoothratio)
|
|||
{
|
||||
cposx = omyx + mulscale16(myx - omyx, 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
|
||||
{
|
||||
cposx = pp->oposx + mulscale16(pp->posx - pp->oposx, 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
|
||||
{
|
||||
cposx = pp->oposx;
|
||||
cposy = pp->oposy;
|
||||
cang = pp->getoang();
|
||||
cang = pp->angle.oang.asbuild();
|
||||
}
|
||||
DrawOverheadMap(cposx, cposy, cang);
|
||||
restoreinterpolations();
|
||||
|
@ -300,7 +300,7 @@ void drawoverlays(double smoothratio)
|
|||
|
||||
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)
|
||||
|
|
|
@ -457,12 +457,12 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
|
|||
break;
|
||||
|
||||
case PLAYER_ANG:
|
||||
if (bSet) playerSetAngle(&ps[iPlayer].q16ang, &ps[iPlayer].angTarget, lValue);
|
||||
else SetGameVarID((int)lVar2, ps[iPlayer].getang(), sActor, sPlayer);
|
||||
if (bSet) ps[iPlayer].angle.settarget(lValue);
|
||||
else SetGameVarID((int)lVar2, ps[iPlayer].angle.ang.asbuild(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
case PLAYER_LOOK_ANG:
|
||||
if (bSet) ps[iPlayer].q16look_ang = IntToFixed(lValue);
|
||||
else SetGameVarID((int)lVar2, FixedToInt(ps[iPlayer].q16look_ang), sActor, sPlayer);
|
||||
if (bSet) ps[iPlayer].angle.look_ang = buildlook(lValue);
|
||||
else SetGameVarID((int)lVar2, ps[iPlayer].angle.look_ang.asbuild(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_LAST_EXTRA:
|
||||
|
@ -636,8 +636,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
|
|||
break;
|
||||
|
||||
case PLAYER_ONE_EIGHTY_COUNT:
|
||||
if (bSet) ps[iPlayer].one_eighty_count = lValue;
|
||||
else SetGameVarID((int)lVar2, ps[iPlayer].one_eighty_count, sActor, sPlayer);
|
||||
if (bSet) ps[iPlayer].angle.spin = buildlook(lValue);
|
||||
else SetGameVarID((int)lVar2, ps[iPlayer].angle.spin.asbuild(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_CHEAT_PHASE:
|
||||
|
@ -696,8 +696,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, int sActor, int sPl
|
|||
break;
|
||||
|
||||
case PLAYER_ROTSCRNANG:
|
||||
if (bSet) ps[iPlayer].setrotscrnang(lValue);
|
||||
else SetGameVarID((int)lVar2, FixedToInt(ps[iPlayer].q16rotscrnang), sActor, sPlayer);
|
||||
if (bSet) ps[iPlayer].angle.rotscrnang = buildlook(lValue);
|
||||
else SetGameVarID((int)lVar2, ps[iPlayer].angle.rotscrnang.asbuild(), sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_DEAD_FLAG:
|
||||
|
@ -2054,7 +2054,7 @@ int ParseState::parse(void)
|
|||
ps[g_p].posx = ps[g_p].oposx;
|
||||
ps[g_p].posy = ps[g_p].oposy;
|
||||
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);
|
||||
setpal(&ps[g_p]);
|
||||
|
||||
|
@ -2259,7 +2259,7 @@ int ParseState::parse(void)
|
|||
ps[g_p].weapreccnt = 0;
|
||||
ps[g_p].ftq = 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;
|
||||
|
||||
|
@ -2431,9 +2431,9 @@ int ParseState::parse(void)
|
|||
else if( (l& pfacing) )
|
||||
{
|
||||
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
|
||||
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 )
|
||||
j = 1;
|
||||
|
@ -2457,8 +2457,8 @@ int ParseState::parse(void)
|
|||
case concmd_slapplayer:
|
||||
insptr++;
|
||||
forceplayerangle(g_p);
|
||||
ps[g_p].posxv -= sintable[(ps[g_p].getang() + 512) & 2047] << 7;
|
||||
ps[g_p].posyv -= sintable[ps[g_p].getang() & 2047] << 7;
|
||||
ps[g_p].posxv -= sintable[(ps[g_p].angle.ang.asbuild() + 512) & 2047] << 7;
|
||||
ps[g_p].posyv -= sintable[ps[g_p].angle.ang.asbuild() & 2047] << 7;
|
||||
return 0;
|
||||
case concmd_wackplayer:
|
||||
insptr++;
|
||||
|
@ -2466,8 +2466,8 @@ int ParseState::parse(void)
|
|||
forceplayerangle(g_p);
|
||||
else
|
||||
{
|
||||
ps[g_p].posxv -= sintable[(ps[g_p].getang() + 512) & 2047] << 10;
|
||||
ps[g_p].posyv -= sintable[ps[g_p].getang() & 2047] << 10;
|
||||
ps[g_p].posxv -= sintable[(ps[g_p].angle.ang.asbuild() + 512) & 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_toggle = 1;
|
||||
}
|
||||
|
@ -2828,7 +2828,7 @@ int ParseState::parse(void)
|
|||
|
||||
case concmd_ifangdiffl:
|
||||
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);
|
||||
break;
|
||||
|
||||
|
@ -3138,7 +3138,7 @@ int ParseState::parse(void)
|
|||
int i;
|
||||
insptr++;
|
||||
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;
|
||||
}
|
||||
case concmd_setplayerangle:
|
||||
|
@ -3146,7 +3146,7 @@ int ParseState::parse(void)
|
|||
int i;
|
||||
insptr++;
|
||||
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;
|
||||
}
|
||||
case concmd_getactorangle:
|
||||
|
|
|
@ -287,7 +287,7 @@ void displayweapon_d(int snum, double smoothratio)
|
|||
o = 0;
|
||||
|
||||
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;
|
||||
weapon_sway = p->oweapon_sway + fmulscale16(p->weapon_sway - p->oweapon_sway, smoothratio);
|
||||
kickback_pic = p->okickback_pic + fmulscale16(*kb - p->okickback_pic, smoothratio);
|
||||
|
|
|
@ -124,7 +124,7 @@ void displayweapon_r(int snum, double smoothratio)
|
|||
|
||||
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;
|
||||
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);
|
||||
|
|
|
@ -190,7 +190,7 @@ inline bool playrunning()
|
|||
inline void backupplayer(player_struct* p)
|
||||
{
|
||||
backuppos(p);
|
||||
backuplook(p);
|
||||
p->angle.backup();
|
||||
p->horizon.backup();
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ void hud_input(int snum)
|
|||
EGS(p->cursectnum,
|
||||
p->posx,
|
||||
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;
|
||||
sprite[i].yvel = snum;
|
||||
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);
|
||||
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));
|
||||
if (!cl_syncinput && input.q16avel)
|
||||
{
|
||||
p->one_eighty_count = 0;
|
||||
p->angle.spin = bamlook(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -922,27 +922,27 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
|
|||
// Do these in the same order as the old code.
|
||||
calcviewpitch(p, scaleAdjust);
|
||||
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);
|
||||
}
|
||||
|
||||
playerProcessHelpers(&p->q16ang, &p->angAdjust, &p->angTarget, scaleAdjust);
|
||||
p->angle.processhelpers(scaleAdjust);
|
||||
p->horizon.processhelpers(scaleAdjust);
|
||||
}
|
||||
|
||||
if (packet)
|
||||
{
|
||||
auto const pPlayer = &ps[myconnectindex];
|
||||
auto const q16ang = FixedToInt(pPlayer->q16ang);
|
||||
auto const ang = pPlayer->angle.ang.asbuild();
|
||||
|
||||
*packet = loc;
|
||||
auto fvel = loc.fvel;
|
||||
auto svel = loc.svel;
|
||||
packet->fvel = mulscale9(fvel, sintable[(q16ang + 2560) & 2047]) +
|
||||
mulscale9(svel, sintable[(q16ang + 2048) & 2047]) +
|
||||
packet->fvel = mulscale9(fvel, sintable[(ang + 2560) & 2047]) +
|
||||
mulscale9(svel, sintable[(ang + 2048) & 2047]) +
|
||||
pPlayer->fric.x;
|
||||
packet->svel = mulscale9(fvel, sintable[(q16ang + 2048) & 2047]) +
|
||||
mulscale9(svel, sintable[(q16ang + 1536) & 2047]) +
|
||||
packet->svel = mulscale9(fvel, sintable[(ang + 2048) & 2047]) +
|
||||
mulscale9(svel, sintable[(ang + 1536) & 2047]) +
|
||||
pPlayer->fric.y;
|
||||
loc = {};
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ void calcviewpitch(player_struct *p, double factor)
|
|||
int psectlotag = sector[psect].lotag;
|
||||
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 y = p->posy + (sintable[p->getang() & 2047] >> 5);
|
||||
int x = p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 5);
|
||||
int y = p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 5);
|
||||
short tempsect = psect;
|
||||
updatesector(x, y, &tempsect);
|
||||
|
||||
|
@ -166,8 +166,7 @@ void forceplayerangle(int snum)
|
|||
|
||||
p->horizon.addadjustment(64);
|
||||
p->sync.actions |= SB_CENTERVIEW;
|
||||
p->setlookang(n >> 1);
|
||||
p->setrotscrnang(n >> 1);
|
||||
p->angle.rotscrnang = p->angle.look_ang = buildlook(n >> 1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -264,7 +263,7 @@ int hitawall(struct player_struct* p, int* hitw)
|
|||
short sect, hs, hitw1;
|
||||
|
||||
hitscan(p->posx, p->posy, p->posz, p->cursectnum,
|
||||
sintable[(p->getang() + 512) & 2047], sintable[p->getang() & 2047], 0, §, &hitw1, &hs, &sx, &sy, &sz, CLIPMASK0);
|
||||
sintable[(p->angle.ang.asbuild() + 512) & 2047], sintable[p->angle.ang.asbuild() & 2047], 0, §, &hitw1, &hs, &sx, &sy, &sz, CLIPMASK0);
|
||||
*hitw = hitw1;
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
|
@ -767,16 +766,16 @@ void apply_seasick(player_struct* p, double factor)
|
|||
if (p->SeaSick < 250)
|
||||
{
|
||||
if (p->SeaSick >= 180)
|
||||
p->addrotscrnang(24 * factor);
|
||||
p->angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
else if (p->SeaSick >= 130)
|
||||
p->addrotscrnang(-24 * factor);
|
||||
p->angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
else if (p->SeaSick >= 70)
|
||||
p->addrotscrnang(24 * factor);
|
||||
p->angle.rotscrnang += bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
else if (p->SeaSick >= 20)
|
||||
p->addrotscrnang(-24 * factor);
|
||||
p->angle.rotscrnang -= bamlook(xs_CRoundToUInt(24 * factor * BAMUNIT));
|
||||
}
|
||||
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)
|
||||
{
|
||||
p->oweapon_sway = p->weapon_sway;
|
||||
|
@ -861,7 +847,7 @@ void backupweapon(player_struct* p)
|
|||
void resetinputhelpers(player_struct* p)
|
||||
{
|
||||
p->horizon.resetadjustment();
|
||||
p->angAdjust = 0;
|
||||
p->angle.resetadjustment();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -932,7 +918,7 @@ void checklook(int snum, ESyncBits actions)
|
|||
actions &= ~SB_LOOK_RIGHT;
|
||||
}
|
||||
}
|
||||
backuplook(p);
|
||||
p->angle.backup();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -118,7 +118,7 @@ void shoot_d(int i, int atwith)
|
|||
sx = ps[p].posx;
|
||||
sy = ps[p].posy;
|
||||
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;
|
||||
|
||||
|
@ -403,7 +403,7 @@ void shoot_d(int i, int atwith)
|
|||
j = fi.spawn(ps[p].i, WATERSPLASH2);
|
||||
sprite[j].x = hitx;
|
||||
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;
|
||||
ssp(i, CLIPMASK0);
|
||||
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);
|
||||
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 +=
|
||||
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].yrepeat = 2;
|
||||
sprite[j].z = p->posz + (8 << 8);
|
||||
|
@ -1939,8 +1939,8 @@ int operateTripbomb(int snum)
|
|||
short sect, hw, hitsp;
|
||||
|
||||
hitscan(p->posx, p->posy, p->posz,
|
||||
p->cursectnum, sintable[(p->getang() + 512) & 2047],
|
||||
sintable[p->getang() & 2047], -p->horizon.sum().asq16() >> 11,
|
||||
p->cursectnum, sintable[(p->angle.ang.asbuild() + 512) & 2047],
|
||||
sintable[p->angle.ang.asbuild() & 2047], -p->horizon.sum().asq16() >> 11,
|
||||
§, &hw, &hitsp, &sx, &sy, &sz, CLIPMASK1);
|
||||
|
||||
if (sect < 0 || hitsp >= 0)
|
||||
|
@ -2131,10 +2131,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
}
|
||||
|
||||
j = EGS(p->cursectnum,
|
||||
p->posx + (sintable[(p->getang() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->getang() & 2047] >> 6),
|
||||
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
|
||||
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())
|
||||
{
|
||||
|
@ -2840,7 +2840,7 @@ void processinput_d(int snum)
|
|||
// may still be needed later for demo recording
|
||||
|
||||
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)
|
||||
|
|
|
@ -105,7 +105,7 @@ void shoot_r(int i, int atwith)
|
|||
sx = ps[p].posx;
|
||||
sy = ps[p].posy;
|
||||
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;
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ void shoot_r(int i, int atwith)
|
|||
j = fi.spawn(ps[p].i, WATERSPLASH2);
|
||||
sprite[j].x = hitx;
|
||||
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;
|
||||
ssp(i, 0);
|
||||
sprite[j].xvel = 0;
|
||||
|
@ -1275,8 +1275,8 @@ int doincrements_r(struct player_struct* p)
|
|||
{
|
||||
p->noise_radius = 16384;
|
||||
madenoise(screenpeek);
|
||||
p->posxv += sintable[(p->getang() + 512) & 2047] << 4;
|
||||
p->posyv += sintable[p->getang() & 2047] << 4;
|
||||
p->posxv += sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
|
||||
p->posyv += sintable[p->angle.ang.asbuild() & 2047] << 4;
|
||||
}
|
||||
p->eat -= 4;
|
||||
if (p->eat < 0)
|
||||
|
@ -1472,7 +1472,7 @@ void checkweapons_r(struct player_struct* p)
|
|||
if (p->OnMotorcycle && numplayers > 1)
|
||||
{
|
||||
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];
|
||||
p->OnMotorcycle = 0;
|
||||
p->gotweapon.Clear(MOTORCYCLE_WEAPON);
|
||||
|
@ -1488,7 +1488,7 @@ void checkweapons_r(struct player_struct* p)
|
|||
else if (p->OnBoat && numplayers > 1)
|
||||
{
|
||||
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];
|
||||
p->OnBoat = 0;
|
||||
p->gotweapon.Clear(BOAT_WEAPON);
|
||||
|
@ -1769,7 +1769,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
|||
{
|
||||
short var8c, var90, var94, var98;
|
||||
var8c = p->MotoSpeed;
|
||||
var90 = p->getang();
|
||||
var90 = p->angle.ang.asbuild();
|
||||
if (var74)
|
||||
var94 = -10;
|
||||
else
|
||||
|
@ -1817,13 +1817,13 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
|||
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))
|
||||
{
|
||||
short var9c, vara0, vara4=0;
|
||||
var9c = p->MotoSpeed;
|
||||
vara0 = p->getang();
|
||||
vara0 = p->angle.ang.asbuild();
|
||||
var84 = krand() & 1;
|
||||
if (var84 == 0)
|
||||
vara4 = -10;
|
||||
|
@ -2098,7 +2098,7 @@ static void onBoat(int snum, ESyncBits &actions)
|
|||
{
|
||||
short vard4, vard8, vardc, vare0;
|
||||
vard4 = p->MotoSpeed;
|
||||
vard8 = p->getang();
|
||||
vard8 = p->angle.ang.asbuild();
|
||||
if (varbc)
|
||||
vardc = -10;
|
||||
else
|
||||
|
@ -2121,7 +2121,7 @@ static void onBoat(int snum, ESyncBits &actions)
|
|||
p->posyv += (vard4 >> 7) * (sintable[(vardc * -51 + vard8) & 2047] << 4);
|
||||
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->MotoSpeed > 50)
|
||||
|
@ -2427,9 +2427,9 @@ static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz)
|
|||
{
|
||||
j = fi.spawn(pi, WATERBUBBLE);
|
||||
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 +=
|
||||
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].yrepeat = 2;
|
||||
sprite[j].z = p->posz + (8 << 8);
|
||||
|
@ -2454,7 +2454,7 @@ void onMotorcycleMove(int snum, int psect, int j)
|
|||
var104 = 0;
|
||||
j &= (MAXWALLS - 1);
|
||||
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;
|
||||
switch (krand() & 1)
|
||||
{
|
||||
|
@ -2465,7 +2465,7 @@ void onMotorcycleMove(int snum, int psect, int j)
|
|||
ang = -(p->MotoSpeed >> 1);
|
||||
break;
|
||||
}
|
||||
playerAddAngle(&p->q16ang, &p->angAdjust, ang);
|
||||
p->angle.addadjustment(ang);
|
||||
if (var10c >= 441 && var10c <= 581)
|
||||
{
|
||||
var104 = (p->MotoSpeed * p->MotoSpeed) >> 8;
|
||||
|
@ -2521,7 +2521,7 @@ void onBoatMove(int snum, int psect, int j)
|
|||
short var114, var118;
|
||||
j &= (MAXWALLS - 1);
|
||||
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;
|
||||
switch (krand() & 1)
|
||||
{
|
||||
|
@ -2532,7 +2532,7 @@ void onBoatMove(int snum, int psect, int j)
|
|||
ang = -(p->MotoSpeed >> 2);
|
||||
break;
|
||||
}
|
||||
playerAddAngle(&p->q16ang, &p->angAdjust, ang);
|
||||
p->angle.addadjustment(ang);
|
||||
if (var118 >= 441 && var118 <= 581)
|
||||
{
|
||||
p->MotoSpeed = ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 2;
|
||||
|
@ -2580,8 +2580,8 @@ void onMotorcycleHit(int snum, int var60)
|
|||
{
|
||||
if (numplayers == 1)
|
||||
{
|
||||
fi.movesprite(var60, sintable[int(p->TiltStatus * 20 + p->getang() + 512) & 2047] >> 8,
|
||||
sintable[int(p->TiltStatus * 20 + p->getang()) & 2047] >> 8, sprite[var60].zvel, CLIPMASK0);
|
||||
fi.movesprite(var60, sintable[int(p->TiltStatus * 20 + p->angle.ang.asbuild() + 512) & 2047] >> 8,
|
||||
sintable[int(p->TiltStatus * 20 + p->angle.ang.asbuild()) & 2047] >> 8, sprite[var60].zvel, CLIPMASK0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2637,8 +2637,8 @@ void onBoatHit(int snum, int var60)
|
|||
{
|
||||
if (numplayers == 1)
|
||||
{
|
||||
fi.movesprite(var60, sintable[int(p->TiltStatus * 20 + p->getang() + 512) & 2047] >> 9,
|
||||
sintable[int(p->TiltStatus * 20 + p->getang()) & 2047] >> 9, sprite[var60].zvel, CLIPMASK0);
|
||||
fi.movesprite(var60, sintable[int(p->TiltStatus * 20 + p->angle.ang.asbuild() + 512) & 2047] >> 9,
|
||||
sintable[int(p->TiltStatus * 20 + p->angle.ang.asbuild()) & 2047] >> 9, sprite[var60].zvel, CLIPMASK0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2852,10 +2852,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
}
|
||||
|
||||
j = EGS(p->cursectnum,
|
||||
p->posx + (sintable[(p->getang() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->getang() & 2047] >> 6),
|
||||
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
|
||||
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)
|
||||
{
|
||||
|
@ -2904,8 +2904,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
p->visibility = 0;
|
||||
if (psectlotag != 857)
|
||||
{
|
||||
p->posxv -= sintable[(p->getang() + 512) & 2047] << 4;
|
||||
p->posyv -= sintable[p->getang() & 2047] << 4;
|
||||
p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
|
||||
p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 4;
|
||||
}
|
||||
}
|
||||
else if (p->kickback_pic == 2)
|
||||
|
@ -3004,14 +3004,14 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
|
||||
if (psectlotag != 857)
|
||||
{
|
||||
p->posxv -= sintable[(p->getang() + 512) & 2047] << 5;
|
||||
p->posyv -= sintable[p->getang() & 2047] << 5;
|
||||
p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 5;
|
||||
p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 5;
|
||||
}
|
||||
}
|
||||
else if (psectlotag != 857)
|
||||
{
|
||||
p->posxv -= sintable[(p->getang() + 512) & 2047] << 4;
|
||||
p->posyv -= sintable[p->getang() & 2047] << 4;
|
||||
p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 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)
|
||||
{
|
||||
p->posxv -= sintable[(p->getang() + 512) & 2047] << 4;
|
||||
p->posyv -= sintable[p->getang() & 2047] << 4;
|
||||
p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
|
||||
p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 4;
|
||||
}
|
||||
checkavailweapon(p);
|
||||
|
||||
|
@ -3156,11 +3156,11 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
}
|
||||
if (p->kickback_pic == 2)
|
||||
{
|
||||
playerAddAngle(&p->q16ang, &p->angAdjust, 16);
|
||||
p->angle.addadjustment(16);
|
||||
}
|
||||
else if (p->kickback_pic == 4)
|
||||
{
|
||||
playerAddAngle(&p->q16ang, &p->angAdjust, -16);
|
||||
p->angle.addadjustment(-16);
|
||||
}
|
||||
if (p->kickback_pic > 4)
|
||||
p->kickback_pic = 1;
|
||||
|
@ -3186,11 +3186,11 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
}
|
||||
if (p->kickback_pic == 2)
|
||||
{
|
||||
playerAddAngle(&p->q16ang, &p->angAdjust, 4);
|
||||
p->angle.addadjustment(4);
|
||||
}
|
||||
else if (p->kickback_pic == 4)
|
||||
{
|
||||
playerAddAngle(&p->q16ang, &p->angAdjust, -4);
|
||||
p->angle.addadjustment(-4);
|
||||
}
|
||||
if (p->kickback_pic > 4)
|
||||
p->kickback_pic = 1;
|
||||
|
@ -3236,8 +3236,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
}
|
||||
else if (p->kickback_pic == 12)
|
||||
{
|
||||
p->posxv -= sintable[(p->getang() + 512) & 2047] << 4;
|
||||
p->posyv -= sintable[p->getang() & 2047] << 4;
|
||||
p->posxv -= sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
|
||||
p->posyv -= sintable[p->angle.ang.asbuild() & 2047] << 4;
|
||||
p->horizon.addadjustment(20);
|
||||
p->recoil += 20;
|
||||
}
|
||||
|
@ -3262,10 +3262,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
}
|
||||
|
||||
j = EGS(p->cursectnum,
|
||||
p->posx + (sintable[(p->getang() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->getang() & 2047] >> 6),
|
||||
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
|
||||
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++;
|
||||
if (p->kickback_pic > 20)
|
||||
|
@ -3286,8 +3286,8 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
}
|
||||
if (p->kickback_pic < 30)
|
||||
{
|
||||
p->posxv += sintable[(p->getang() + 512) & 2047] << 4;
|
||||
p->posyv += sintable[p->getang() & 2047] << 4;
|
||||
p->posxv += sintable[(p->angle.ang.asbuild() + 512) & 2047] << 4;
|
||||
p->posyv += sintable[p->angle.ang.asbuild() & 2047] << 4;
|
||||
}
|
||||
p->kickback_pic++;
|
||||
if (p->kickback_pic > 40)
|
||||
|
@ -3741,7 +3741,7 @@ void processinput_r(int snum)
|
|||
// may still be needed later for demo recording
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -4170,7 +4170,7 @@ void OnMotorcycle(struct player_struct *p, int motosprite)
|
|||
{
|
||||
p->posx = sprite[motosprite].x;
|
||||
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;
|
||||
deletesprite(motosprite);
|
||||
}
|
||||
|
@ -4222,13 +4222,13 @@ void OffMotorcycle(struct player_struct *p)
|
|||
p->TurbCount = 0;
|
||||
p->posxv = 0;
|
||||
p->posyv = 0;
|
||||
p->posxv -= sintable[(p->getang()+512)&2047]<<7;
|
||||
p->posyv -= sintable[p->getang()&2047]<<7;
|
||||
p->posxv -= sintable[(p->angle.ang.asbuild()+512)&2047]<<7;
|
||||
p->posyv -= sintable[p->angle.ang.asbuild()&2047]<<7;
|
||||
p->moto_underwater = 0;
|
||||
j = fi.spawn(p->i, EMPTYBIKE);
|
||||
sprite[j].ang = p->getang();
|
||||
sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7;
|
||||
sprite[j].yvel += sintable[p->getang()&2047]<<7;
|
||||
sprite[j].ang = p->angle.ang.asbuild();
|
||||
sprite[j].xvel += sintable[(p->angle.ang.asbuild()+512)&2047]<<7;
|
||||
sprite[j].yvel += sintable[p->angle.ang.asbuild()&2047]<<7;
|
||||
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->posy = sprite[boatsprite].y;
|
||||
p->setang(sprite[boatsprite].ang);
|
||||
p->angle.ang = buildang(sprite[boatsprite].ang);
|
||||
p->ammo_amount[BOAT_WEAPON] = sprite[boatsprite].owner;
|
||||
deletesprite(boatsprite);
|
||||
}
|
||||
|
@ -4287,13 +4287,13 @@ void OffBoat(struct player_struct *p)
|
|||
p->TurbCount = 0;
|
||||
p->posxv = 0;
|
||||
p->posyv = 0;
|
||||
p->posxv -= sintable[(p->getang()+512)&2047]<<7;
|
||||
p->posyv -= sintable[p->getang()&2047]<<7;
|
||||
p->posxv -= sintable[(p->angle.ang.asbuild()+512)&2047]<<7;
|
||||
p->posyv -= sintable[p->angle.ang.asbuild()&2047]<<7;
|
||||
p->moto_underwater = 0;
|
||||
j = fi.spawn(p->i, EMPTYBOAT);
|
||||
sprite[j].ang = p->getang();
|
||||
sprite[j].xvel += sintable[(p->getang()+512)&2047]<<7;
|
||||
sprite[j].yvel += sintable[p->getang()&2047]<<7;
|
||||
sprite[j].ang = p->angle.ang.asbuild();
|
||||
sprite[j].xvel += sintable[(p->angle.ang.asbuild()+512)&2047]<<7;
|
||||
sprite[j].yvel += sintable[p->angle.ang.asbuild()&2047]<<7;
|
||||
sprite[j].owner = p->ammo_amount[BOAT_WEAPON];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -342,10 +342,10 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
|
|||
}
|
||||
|
||||
j = EGS(p->cursectnum,
|
||||
p->posx + (sintable[(p->getang() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->getang() & 2047] >> 6),
|
||||
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
|
||||
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
|
||||
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);
|
||||
|
|
|
@ -39,7 +39,7 @@ BEGIN_DUKE_NS
|
|||
|
||||
int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
|
||||
short globalskillsound;
|
||||
fixed_t q16myang, oq16myang;
|
||||
binangle myang, omyang;
|
||||
fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff;
|
||||
short mycursectnum, myjumpingcounter;
|
||||
char myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
|
||||
|
@ -55,7 +55,7 @@ void resetmys()
|
|||
myy = omyy = ps[myconnectindex].posy;
|
||||
myz = omyz = ps[myconnectindex].posz;
|
||||
myxvel = myyvel = myzvel = 0;
|
||||
q16myang = oq16myang = ps[myconnectindex].q16ang;
|
||||
myang = myang = ps[myconnectindex].angle.ang;
|
||||
myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz;
|
||||
myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff;
|
||||
mycursectnum = ps[myconnectindex].cursectnum;
|
||||
|
@ -214,7 +214,7 @@ void fakedomovethings(void)
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ BEGIN_DUKE_NS
|
|||
extern int myx, omyx, myxvel, myy, omyy, myyvel, myz, omyz, myzvel;
|
||||
extern short globalskillsound;
|
||||
extern short mycursectnum, myjumpingcounter;
|
||||
extern fixed_t q16myang, oq16myang;
|
||||
extern binangle myang, omyang;
|
||||
extern fixedhoriz myhoriz, omyhoriz, myhorizoff, omyhorizoff;
|
||||
extern char myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
|
||||
extern int fakemovefifoplc;
|
||||
|
|
|
@ -59,8 +59,7 @@ void pickrandomspot(int snum)
|
|||
p->bobposx = p->oposx = p->posx = po[i].ox;
|
||||
p->bobposy = p->oposy = p->posy = po[i].oy;
|
||||
p->oposz = p->posz = po[i].oz;
|
||||
p->setang(po[i].oa);
|
||||
p->setoang(po[i].oa);
|
||||
p->angle.oang = p->angle.ang = buildang(po[i].oa);
|
||||
p->cursectnum = po[i].os;
|
||||
}
|
||||
|
||||
|
@ -139,11 +138,9 @@ void resetplayerstats(int snum)
|
|||
p->jetpack_on = 0;
|
||||
p->holoduke_on = -1;
|
||||
|
||||
p->setlookang(512 - ((currentLevel->levelNumber & 1) << 10));
|
||||
p->oq16look_ang = p->q16look_ang;
|
||||
p->angle.olook_ang = p->angle.look_ang = buildlook(512 - ((currentLevel->levelNumber & 1) << 10));
|
||||
p->angle.orotscrnang = p->angle.rotscrnang = buildlook(0);
|
||||
|
||||
p->setrotscrnang(0);
|
||||
p->oq16rotscrnang = p->q16rotscrnang;
|
||||
p->newowner =-1;
|
||||
p->jumping_counter = 0;
|
||||
p->hard_landing = 0;
|
||||
|
@ -153,7 +150,7 @@ void resetplayerstats(int snum)
|
|||
p->fric.x = 0;
|
||||
p->fric.y = 0;
|
||||
p->somethingonplayer =-1;
|
||||
p->one_eighty_count = 0;
|
||||
p->angle.spin = bamlook(0);
|
||||
|
||||
p->on_crane = -1;
|
||||
|
||||
|
@ -511,7 +508,7 @@ void resetpspritevars(int g)
|
|||
STATUSBARTYPE tsbar[MAXPLAYERS];
|
||||
|
||||
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++)
|
||||
{
|
||||
|
@ -636,8 +633,7 @@ void resetpspritevars(int g)
|
|||
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].bposz = ps[j].oposz = ps[j].posz = s->z;
|
||||
ps[j].setang(s->ang);
|
||||
ps[j].setoang(s->ang);
|
||||
ps[j].angle.oang = ps[j].angle.ang = buildang(s->ang);
|
||||
|
||||
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].gotweapon.Clear(KNEE_WEAPON);
|
||||
}
|
||||
p->setang(lbang);
|
||||
p->angle.ang = buildang(lbang);
|
||||
|
||||
memset(gotpic, 0, sizeof(gotpic));
|
||||
|
||||
|
|
|
@ -478,8 +478,8 @@ void displayrooms(int snum, double smoothratio)
|
|||
int cposx, cposy, cposz, fz, cz;
|
||||
short sect;
|
||||
binangle cang;
|
||||
lookangle rotscrnang;
|
||||
fixedhoriz choriz;
|
||||
fixed_t q16rotscrnang;
|
||||
struct player_struct* p;
|
||||
int tiltcs = 0; // JBF 20030807
|
||||
|
||||
|
@ -545,7 +545,7 @@ void displayrooms(int snum, double smoothratio)
|
|||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
|
@ -557,12 +557,12 @@ void displayrooms(int snum, double smoothratio)
|
|||
fixed_t ohorz = (omyhoriz.asq16() + omyhorizoff.asq16());
|
||||
fixed_t horz = (myhoriz.asq16() + myhorizoff.asq16());
|
||||
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
|
||||
{
|
||||
cang = q16ang(q16myang);
|
||||
choriz = q16horiz(myhoriz.asq16() + myhorizoff.asq16());
|
||||
cang = myang;
|
||||
choriz = myhoriz + myhorizoff;
|
||||
}
|
||||
sect = mycursectnum;
|
||||
}
|
||||
|
@ -575,15 +575,12 @@ void displayrooms(int snum, double smoothratio)
|
|||
{
|
||||
// Original code for when the values are passed through the sync struct
|
||||
choriz = p->horizon.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)));
|
||||
cang = p->angle.interpolatedsum(smoothratio);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
@ -596,7 +593,7 @@ void displayrooms(int snum, double smoothratio)
|
|||
cposy = sprite[p->newowner].pos.y;
|
||||
cposz = sprite[p->newowner].pos.z;
|
||||
sect = sprite[p->newowner].sectnum;
|
||||
q16rotscrnang = 0;
|
||||
rotscrnang = buildlook(0);
|
||||
smoothratio = MaxSmoothRatio;
|
||||
}
|
||||
else if (p->over_shoulder_on == 0)
|
||||
|
@ -615,7 +612,7 @@ void displayrooms(int snum, double smoothratio)
|
|||
}
|
||||
|
||||
// do screen rotation.
|
||||
renderSetRollAngle(FixedToInt(q16rotscrnang));
|
||||
renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT));
|
||||
|
||||
cz = hittype[p->i].ceilingz;
|
||||
fz = hittype[p->i].floorz;
|
||||
|
|
|
@ -113,12 +113,12 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
arc("posx", w.posx)
|
||||
("posy", w.posy)
|
||||
("posz", w.posz)
|
||||
("q16ang", w.q16ang)
|
||||
//("q16ang", w.angle.ang.asq16())
|
||||
//("q16horiz", w.horizon.horiz.asq16())
|
||||
//("q16horizoff", w.horizon.horizoff.asq16())
|
||||
("q16rotscrnang", w.q16rotscrnang)
|
||||
("q16look_ang", w.q16look_ang)
|
||||
("one_eighty_count", w.one_eighty_count)
|
||||
//("q16rotscrnang", w.angle.rotscrnang.asbuild())
|
||||
//("q16look_ang", w.angle.look_ang.asq16())
|
||||
//("one_eighty_count", w.angle.spin.asq16())
|
||||
("gotweapon", w.gotweapon)
|
||||
("palette", w.palette)
|
||||
("pals", w.pals)
|
||||
|
@ -284,10 +284,10 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
.EndObject();
|
||||
|
||||
w.invdisptime = 0;
|
||||
w.oq16ang = w.q16ang;
|
||||
//w.angle.oang = w.angle.ang;
|
||||
//w.horizon.ohoriz = w.horizon.horiz;
|
||||
//w.horizon.ohorizoff = w.horizon.horizoff;
|
||||
w.oq16rotscrnang = w.q16rotscrnang;
|
||||
//w.oq16rotscrnang = w.angle.rotscrnang;
|
||||
w.oposx = w.posx;
|
||||
w.oposy = w.posy;
|
||||
w.oposz = w.posz;
|
||||
|
|
|
@ -1149,8 +1149,8 @@ void moveclouds(double smoothratio)
|
|||
cloudclock = myclock + 6;
|
||||
|
||||
// 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);
|
||||
cloudy += (sintable[ps[screenpeek].getang() & 2047] >> 9);
|
||||
cloudx += (sintable[(ps[screenpeek].angle.ang.asbuild() + 512) & 2047] >> 9);
|
||||
cloudy += (sintable[ps[screenpeek].angle.ang.asbuild() & 2047] >> 9);
|
||||
for (int i = 0; i < numclouds; i++)
|
||||
{
|
||||
sector[clouds[i]].ceilingxpanning = cloudx >> 6;
|
||||
|
|
|
@ -719,7 +719,7 @@ void checkhitwall_d(int spr, int dawallnum, int x, int y, int z, int atwith)
|
|||
if (wal->nextwall >= 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;
|
||||
S_PlayActorSound(GLASS_BREAKING, i);
|
||||
return;
|
||||
|
@ -921,13 +921,13 @@ void checkplayerhurt_d(struct player_struct* p, int j)
|
|||
p->hurt_delay = 16;
|
||||
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
|
||||
|
||||
p->posxv = -(sintable[(p->getang() + 512) & 2047] << 8);
|
||||
p->posyv = -(sintable[(p->getang()) & 2047] << 8);
|
||||
p->posxv = -(sintable[(p->angle.ang.asbuild() + 512) & 2047] << 8);
|
||||
p->posyv = -(sintable[(p->angle.ang.asbuild()) & 2047] << 8);
|
||||
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->i);
|
||||
|
||||
fi.checkhitwall(p->i, j,
|
||||
p->posx + (sintable[(p->getang() + 512) & 2047] >> 9),
|
||||
p->posy + (sintable[p->getang() & 2047] >> 9),
|
||||
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 9),
|
||||
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 9),
|
||||
p->posz, -1);
|
||||
|
||||
break;
|
||||
|
@ -935,8 +935,8 @@ void checkplayerhurt_d(struct player_struct* p, int j)
|
|||
case BIGFORCE:
|
||||
p->hurt_delay = 26;
|
||||
fi.checkhitwall(p->i, j,
|
||||
p->posx + (sintable[(p->getang() + 512) & 2047] >> 9),
|
||||
p->posy + (sintable[p->getang() & 2047] >> 9),
|
||||
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 9),
|
||||
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 9),
|
||||
p->posz, -1);
|
||||
break;
|
||||
|
||||
|
@ -1460,7 +1460,7 @@ void checkhitsprite_d(int i, int sn)
|
|||
ps[p].posx = ps[p].oposx;
|
||||
ps[p].posy = ps[p].oposy;
|
||||
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);
|
||||
setpal(&ps[p]);
|
||||
|
@ -1580,17 +1580,17 @@ void checksectors_d(int snum)
|
|||
return;
|
||||
|
||||
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
|
||||
{
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
switch (sprite[neartagsprite].picnum)
|
||||
|
|
|
@ -1033,7 +1033,7 @@ void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith)
|
|||
if (wal->nextwall >= 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;
|
||||
S_PlayActorSound(GLASS_BREAKING, i);
|
||||
return;
|
||||
|
@ -1047,7 +1047,7 @@ void checkhitwall_r(int spr, int dawallnum, int x, int y, int z, int atwith)
|
|||
if (wal->nextwall >= 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;
|
||||
S_PlayActorSound(GLASS_BREAKING, i);
|
||||
return;
|
||||
|
@ -1419,8 +1419,8 @@ void checkplayerhurt_r(struct player_struct* p, int j)
|
|||
case BIGFORCE:
|
||||
p->hurt_delay = 26;
|
||||
fi.checkhitwall(p->i, j,
|
||||
p->posx + (sintable[(p->getang() + 512) & 2047] >> 9),
|
||||
p->posy + (sintable[p->getang() & 2047] >> 9),
|
||||
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 9),
|
||||
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 9),
|
||||
p->posz, -1);
|
||||
break;
|
||||
|
||||
|
@ -2555,21 +2555,21 @@ void checksectors_r(int snum)
|
|||
}
|
||||
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)
|
||||
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
|
||||
{
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
switch (sprite[neartagsprite].picnum)
|
||||
|
|
|
@ -302,7 +302,7 @@ void S_GetCamera(vec3_t** c, int32_t* ca, int32_t* cs)
|
|||
auto p = &ps[screenpeek];
|
||||
if (c) *c = &p->pos;
|
||||
if (cs) *cs = p->cursectnum;
|
||||
if (ca) *ca = p->getang();
|
||||
if (ca) *ca = p->angle.ang.asbuild();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -435,7 +435,7 @@ void initshell(int j, int i, bool isshell)
|
|||
if (sprite[j].picnum == TILE_APLAYER)
|
||||
{
|
||||
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;
|
||||
sp->z = (3 << 8) + ps[snum].pyoff + ps[snum].posz - (ps[snum].horizon.sum().asq16() >> 12) + (!isshell ? (3 << 8) : 0);
|
||||
|
|
|
@ -95,13 +95,9 @@ struct player_struct
|
|||
struct { int32_t posx, posy, posz; };
|
||||
};
|
||||
|
||||
// input handles angle as fixed16 numbers. We need to account for that as well.
|
||||
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.
|
||||
// player's horizon and angle structs.
|
||||
PlayerHorizon horizon;
|
||||
PlayerAngle angle;
|
||||
|
||||
// using a bit field for this to save a bit of space.
|
||||
FixedBitArray<MAX_WEAPONS> gotweapon;
|
||||
|
@ -210,23 +206,7 @@ struct player_struct
|
|||
int8_t crouch_toggle;
|
||||
|
||||
// input stuff.
|
||||
double angAdjust;
|
||||
fixed_t angTarget;
|
||||
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); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1530,7 +1530,7 @@ UpdatePlayerSpriteAngle(PLAYERp pp)
|
|||
void
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -3671,7 +3671,7 @@ DoPlayerClimb(PLAYERp pp)
|
|||
pp->lx = lsp->x + nx * 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->ly = lsp->y + ny * 5;
|
||||
|
||||
playerSetAngle(&pp->q16ang, &pp->angTarget, pp->LadderAngle);
|
||||
playerSetAngle2(&pp->q16ang, &pp->angTarget, pp->LadderAngle);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5365,7 +5365,7 @@ DoPlayerBeginOperate(PLAYERp pp)
|
|||
pp->sop = pp->sop_control = sop;
|
||||
sop->controller = pp->SpriteP;
|
||||
|
||||
playerSetAngle(&pp->q16ang, &pp->angTarget, sop->ang);
|
||||
playerSetAngle2(&pp->q16ang, &pp->angTarget, sop->ang);
|
||||
pp->posx = sop->xmid;
|
||||
pp->posy = sop->ymid;
|
||||
COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum);
|
||||
|
@ -5452,7 +5452,7 @@ DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
|
|||
|
||||
save_sectnum = pp->cursectnum;
|
||||
|
||||
playerSetAngle(&pp->q16ang, &pp->angTarget, sop->ang);
|
||||
playerSetAngle2(&pp->q16ang, &pp->angTarget, sop->ang);
|
||||
pp->posx = sop->xmid;
|
||||
pp->posy = sop->ymid;
|
||||
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))
|
||||
{
|
||||
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
|
||||
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))
|
||||
|
|
|
@ -1678,7 +1678,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
|||
|
||||
// New angle is formed by taking last known angle and
|
||||
// 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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue