mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-31 01:11:15 +00:00
- Re-standardise horizon around 0 and not 100.
* Blood had this right. It makes sense that the horizon be based around as it's easier to work with. * Removed all associated game math to deduct default horizon of 100 when doing weapon zvel etc, meaning actual horizon can just be used. * Re-did return to center function to work on the already converted pitch. Return speed should be 1:1 with previous code.
This commit is contained in:
parent
99e6c718d7
commit
09a05f354c
30 changed files with 144 additions and 163 deletions
|
@ -1571,12 +1571,12 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn
|
|||
void sethorizon(fixed_t* q16horiz, fixed_t const q16horz, ESyncBits* actions, double const scaleAdjust)
|
||||
{
|
||||
// Calculate adjustment as true pitch (Fixed point math really sucks...)
|
||||
double horizAngle = atan2(*q16horiz - IntToFixed(100), IntToFixed(128)) * (512. / pi::pi());
|
||||
double horizAngle = atan2(*q16horiz, IntToFixed(128)) * (512. / pi::pi());
|
||||
|
||||
if (q16horz)
|
||||
{
|
||||
*actions &= ~SB_CENTERVIEW;
|
||||
horizAngle = clamp(horizAngle + FixedToFloat(q16horz), -180, 180);
|
||||
horizAngle += FixedToFloat(q16horz);
|
||||
}
|
||||
|
||||
// this is the locked type
|
||||
|
@ -1605,27 +1605,27 @@ void sethorizon(fixed_t* q16horiz, fixed_t const q16horz, ESyncBits* actions, do
|
|||
horizAngle += scaleAdjust * amount;
|
||||
}
|
||||
|
||||
// convert back to Build's horizon
|
||||
*q16horiz = IntToFixed(100) + xs_CRoundToInt(IntToFixed(128) * tan(horizAngle * (pi::pi() / 512.)));
|
||||
// clamp horizAngle after processing
|
||||
horizAngle = clamp(horizAngle, -180, 180);
|
||||
|
||||
// return to center if conditions met.
|
||||
if ((*actions & SB_CENTERVIEW) && !(*actions & (SB_LOOK_UP|SB_LOOK_DOWN)))
|
||||
{
|
||||
if (*q16horiz < FloatToFixed(99.75) || *q16horiz > FloatToFixed(100.25))
|
||||
if (abs(horizAngle) > 0.275)
|
||||
{
|
||||
// move *q16horiz back to 100
|
||||
*q16horiz += xs_CRoundToInt(scaleAdjust * (((1000. / GameTicRate) * FRACUNIT) - (*q16horiz * (10. / GameTicRate))));
|
||||
// move horizAngle back to 0
|
||||
horizAngle += -scaleAdjust * horizAngle * (9. / GameTicRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
// not looking anymore because *q16horiz is back at 100
|
||||
*q16horiz = IntToFixed(100);
|
||||
// not looking anymore because horizAngle is back at 0
|
||||
horizAngle = 0;
|
||||
*actions &= ~SB_CENTERVIEW;
|
||||
}
|
||||
}
|
||||
|
||||
// clamp before returning
|
||||
*q16horiz = clamp(*q16horiz, gi->playerHorizMin(), gi->playerHorizMax());
|
||||
*q16horiz = clamp(xs_CRoundToInt(IntToFixed(128) * tan(horizAngle * (pi::pi() / 512.))), gi->playerHorizMin(), gi->playerHorizMax());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -108,8 +108,8 @@ struct GameInterface
|
|||
virtual void LevelCompleted(MapRecord* map, int skill) {}
|
||||
virtual bool DrawAutomapPlayer(int x, int y, int z, int a) { return false; }
|
||||
virtual void SetTileProps(int tile, int surf, int vox, int shade) {}
|
||||
virtual fixed_t playerHorizMin() { return IntToFixed(-99); }
|
||||
virtual fixed_t playerHorizMax() { return IntToFixed(299); }
|
||||
virtual fixed_t playerHorizMin() { return IntToFixed(-200); }
|
||||
virtual fixed_t playerHorizMax() { return IntToFixed(200); }
|
||||
virtual int playerKeyMove() { return 0; }
|
||||
|
||||
virtual FString statFPS()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue