Use same data type for pitch and angleturn (#1872)

This commit is contained in:
ceski 2024-09-02 00:03:10 -07:00 committed by GitHub
parent d7e1a4550e
commit eab8ca7c0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 9 deletions

View File

@ -36,7 +36,7 @@ typedef struct ticcmd_s
byte chatchar;
byte buttons;
int pitch;
short pitch;
short ticangleturn; // Local angle delta for composite input only.
} ticcmd_t;

View File

@ -538,7 +538,7 @@ void G_PrepGyroTiccmd(void)
if (gyro_axes[GYRO_LOOK])
{
localview.rawpitch += gyro_axes[GYRO_LOOK] * FRACUNIT;
localview.rawpitch += gyro_axes[GYRO_LOOK];
basecmd.pitch = G_CarryPitch(localview.rawpitch);
gyro_axes[GYRO_LOOK] = 0.0f;
}

View File

@ -146,10 +146,11 @@ void G_UpdateAngleFunctions(void)
}
}
int G_CarryPitch(double pitch)
short G_CarryPitch(double pitch)
{
return (localview.pitch =
CarryError(pitch, &prevcarry.pitch, &carry.pitch));
const short result = CarryError(pitch, &prevcarry.pitch, &carry.pitch);
localview.pitch = result << FRACBITS;
return result;
}
int G_CarrySide(double side)
@ -204,7 +205,7 @@ void G_UpdateGamepadVariables(void)
if (I_StandardLayout())
{
joy_scale_angle = ANALOG_MULT * direction[joy_invert_turn];
joy_scale_pitch = ANALOG_MULT * direction[joy_invert_look] * FRACUNIT;
joy_scale_pitch = ANALOG_MULT * direction[joy_invert_look];
if (correct_aspect_ratio)
{
@ -312,7 +313,7 @@ void G_UpdateMouseVariables(void)
if (mouse_sensitivity_y_look)
{
mouse_sens_pitch = ((double)(mouse_sensitivity_y_look + 5) * 8 / 10
* direction[mouse_y_invert] * FRACUNIT);
* direction[mouse_y_invert]);
if (correct_aspect_ratio)
{

View File

@ -31,7 +31,7 @@ void G_ClearCarry(void);
extern short (*G_CarryAngleTic)(double angle);
extern short (*G_CarryAngle)(double angle);
void G_UpdateAngleFunctions(void);
int G_CarryPitch(double pitch);
short G_CarryPitch(double pitch);
int G_CarrySide(double side);
int G_CarryVert(double vert);

View File

@ -250,7 +250,7 @@ void P_MovePlayer (player_t* player)
if (!menuactive && !demoplayback && !player->centering)
{
player->pitch += cmd->pitch;
player->pitch += cmd->pitch << FRACBITS;
player->pitch = BETWEEN(-MAX_PITCH_ANGLE, MAX_PITCH_ANGLE, player->pitch);
player->slope = PlayerSlope(player);
}