- Blood: Fix remaining issues such as starting horizon, remove q16look and clean up some remaining bits in nnexts.cpp.

This commit is contained in:
Mitchell Richters 2020-09-17 17:20:33 +10:00
parent f7957fc237
commit 0c4fe5f91b
4 changed files with 18 additions and 16 deletions

View File

@ -1482,17 +1482,22 @@ void trPlayerCtrlSetScreenEffect(XSPRITE* pXSource, PLAYER* pPlayer) {
}
void trPlayerCtrlSetLookAngle(XSPRITE* pXSource, PLAYER* pPlayer) {
const int upAngle = 289;
const int downAngle = -347;
const double lookStepUp = 4.0 * upAngle / 60.0;
const double lookStepDown = -4.0 * downAngle / 60.0;
void trPlayerCtrlSetLookAngle(XSPRITE* pXSource, PLAYER* pPlayer)
{
int look = pXSource->data2 << 5;
if (look > 0) pPlayer->q16look = min(mulscale8(FloatToFixed(lookStepUp), look), FloatToFixed(upAngle));
else if (look < 0) pPlayer->q16look = -max(mulscale8(FloatToFixed(lookStepDown), abs(look)), FloatToFixed(downAngle));
else pPlayer->q16look = 0;
if (abs(look) > 0)
{
if (pPlayer->q16horiz != IntToFixed(100))
{
// move q16horiz back to 100
pPlayer->q16horiz += IntToFixed(25) - (pPlayer->q16horiz >> 2);
}
}
else
{
pPlayer->q16horiz = IntToFixed(100);
}
}

View File

@ -721,9 +721,8 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->pXSprite->health = pDudeInfo->startHealth<<4;
pPlayer->pSprite->cstat &= (unsigned short)~32768;
pPlayer->bloodlust = 0;
pPlayer->q16horiz = 100;
pPlayer->q16horiz = IntToFixed(100);
pPlayer->q16slopehoriz = 0;
pPlayer->q16look = 100;
pPlayer->slope = 0;
pPlayer->fraggerId = -1;
pPlayer->underwaterTime = 1200;
@ -1362,7 +1361,7 @@ void sethorizon(PLAYER *pPlayer, fixed_t const q16horz, double const scaleAdjust
InputPacket *pInput = &pPlayer->input;
// Calculate adjustment as true pitch (Fixed point math really sucks...)
double horizAngle = clamp(atan2(pPlayer->q16look - IntToFixed(100), IntToFixed(128)) * (512. / pi::pi()), -180, 180);
double horizAngle = clamp(atan2(pPlayer->q16horiz - IntToFixed(100), IntToFixed(128)) * (512. / pi::pi()), -180, 180);
if (q16horz)
{
@ -1417,7 +1416,7 @@ void sethorizon(PLAYER *pPlayer, fixed_t const q16horz, double const scaleAdjust
}
// Convert back to Build's horizon and clamp.
pPlayer->q16horiz = pPlayer->q16look = clamp(IntToFixed(100) + xs_CRoundToInt(IntToFixed(128) * tan(horizAngle * (pi::pi() / 512.))), IntToFixed(PLAYER_HORIZ_MIN), IntToFixed(PLAYER_HORIZ_MAX));
pPlayer->q16horiz = clamp(IntToFixed(100) + xs_CRoundToInt(IntToFixed(128) * tan(horizAngle * (pi::pi() / 512.))), IntToFixed(PLAYER_HORIZ_MIN), IntToFixed(PLAYER_HORIZ_MAX));
}
//---------------------------------------------------------------------------

View File

@ -108,7 +108,6 @@ struct PLAYER
int zViewVel;
int zWeapon;
int zWeaponVel;
fixed_t q16look;
fixed_t q16horiz; // horiz
fixed_t q16slopehoriz; // horizoff
int slope;

View File

@ -58,7 +58,6 @@ static VIEW predictFifo[256];
void viewInitializePrediction(void)
{
predict.at30 = gMe->q16ang;
predict.at20 = gMe->q16look;
predict.at24 = gMe->q16horiz;
predict.at28 = gMe->q16slopehoriz;
predict.at2c = gMe->slope;