mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-21 19:03:11 -04:00
Merge pull request #1720 from ceski-1/pitch_fix
This commit is contained in:
commit
4f95da2225
@ -2456,6 +2456,7 @@ void D_DoomMain(void)
|
||||
G_UpdateSideMove();
|
||||
G_UpdateAngleFunctions();
|
||||
G_UpdateLocalViewFunction();
|
||||
G_UpdateControllerVariables();
|
||||
G_UpdateMouseVariables();
|
||||
R_UpdateViewAngleFunction();
|
||||
|
||||
|
@ -171,6 +171,19 @@ int G_CarryVert(double vert)
|
||||
|
||||
static const int direction[] = {1, -1};
|
||||
static double deltatics;
|
||||
static double joy_scale_angle;
|
||||
static double joy_scale_pitch;
|
||||
|
||||
void G_UpdateControllerVariables(void)
|
||||
{
|
||||
joy_scale_angle = angleturn[1] * direction[joy_invert_turn];
|
||||
joy_scale_pitch = angleturn[1] * direction[joy_invert_look] * FRACUNIT;
|
||||
|
||||
if (correct_aspect_ratio)
|
||||
{
|
||||
joy_scale_pitch /= 1.2;
|
||||
}
|
||||
}
|
||||
|
||||
void G_UpdateDeltaTics(void)
|
||||
{
|
||||
@ -200,14 +213,12 @@ void G_UpdateDeltaTics(void)
|
||||
|
||||
double G_CalcControllerAngle(void)
|
||||
{
|
||||
return (angleturn[1] * axes[AXIS_TURN] * direction[joy_invert_turn]
|
||||
* deltatics);
|
||||
return (axes[AXIS_TURN] * joy_scale_angle * deltatics);
|
||||
}
|
||||
|
||||
double G_CalcControllerPitch(void)
|
||||
{
|
||||
return (angleturn[1] * axes[AXIS_LOOK] * direction[joy_invert_look]
|
||||
* deltatics * FRACUNIT);
|
||||
return (axes[AXIS_LOOK] * joy_scale_pitch * deltatics);
|
||||
}
|
||||
|
||||
int G_CalcControllerSideTurn(int speed)
|
||||
@ -297,6 +308,11 @@ void G_UpdateMouseVariables(void)
|
||||
{
|
||||
mouse_sens_pitch = ((double)(mouse_sensitivity_y_look + 5) * 8 / 10
|
||||
* direction[mouse_y_invert] * FRACUNIT);
|
||||
|
||||
if (correct_aspect_ratio)
|
||||
{
|
||||
mouse_sens_pitch /= 1.2;
|
||||
}
|
||||
}
|
||||
|
||||
if (mouse_sensitivity_strafe)
|
||||
|
@ -35,6 +35,7 @@ int G_CarryVert(double vert);
|
||||
|
||||
// Gamepad
|
||||
|
||||
void G_UpdateControllerVariables(void);
|
||||
void G_UpdateDeltaTics(void);
|
||||
double G_CalcControllerAngle(void);
|
||||
double G_CalcControllerPitch(void);
|
||||
|
@ -83,7 +83,7 @@ boolean toggle_fullscreen;
|
||||
boolean toggle_exclusive_fullscreen;
|
||||
|
||||
static boolean use_vsync; // killough 2/8/98: controls whether vsync is called
|
||||
static boolean correct_aspect_ratio;
|
||||
boolean correct_aspect_ratio;
|
||||
static int fpslimit; // when uncapped, limit framerate to this value
|
||||
static boolean fullscreen;
|
||||
static boolean exclusive_fullscreen;
|
||||
|
@ -77,6 +77,7 @@ extern boolean resetneeded;
|
||||
extern boolean setrefreshneeded;
|
||||
extern boolean toggle_fullscreen;
|
||||
extern boolean toggle_exclusive_fullscreen;
|
||||
extern boolean correct_aspect_ratio;
|
||||
extern boolean screenvisible;
|
||||
|
||||
extern int gamma2;
|
||||
|
@ -2189,7 +2189,8 @@ static setup_menu_t gen_settings4[] = {
|
||||
{"Free Look", S_ONOFF, CNTR_X, M_SPC, {"padlook"}, m_null, input_null,
|
||||
str_empty, MN_UpdateFreeLook},
|
||||
|
||||
{"Invert Look", S_ONOFF, CNTR_X, M_SPC, {"joy_invert_look"}},
|
||||
{"Invert Look", S_ONOFF, CNTR_X, M_SPC, {"joy_invert_look"},
|
||||
m_null, input_null, str_empty, G_UpdateControllerVariables},
|
||||
|
||||
MI_GAP,
|
||||
|
||||
|
11
src/p_user.c
11
src/p_user.c
@ -45,16 +45,7 @@
|
||||
static fixed_t PlayerSlope(player_t *player)
|
||||
{
|
||||
const fixed_t pitch = player->pitch;
|
||||
|
||||
if (pitch)
|
||||
{
|
||||
const fixed_t slope = -finetangent[(ANG90 - pitch) >> ANGLETOFINESHIFT];
|
||||
return (fixed_t)((int64_t)slope * SCREENHEIGHT / ACTUALHEIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return pitch ? -finetangent[(ANG90 - pitch) >> ANGLETOFINESHIFT] : 0;
|
||||
}
|
||||
|
||||
// Index of the special effects (INVUL inverse) map.
|
||||
|
@ -497,7 +497,6 @@ static void R_SetupFreelook(void)
|
||||
if (viewpitch)
|
||||
{
|
||||
dy = FixedMul(projection, -finetangent[(ANG90 - viewpitch) >> ANGLETOFINESHIFT]);
|
||||
dy = (fixed_t)((int64_t)dy * SCREENHEIGHT / ACTUALHEIGHT);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user