mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-13 22:31:03 +00:00
Reset vertical look when toggling joyaiming
This commit is contained in:
parent
a883c0c122
commit
39a8a15e6d
1 changed files with 22 additions and 2 deletions
24
src/g_game.c
24
src/g_game.c
|
@ -960,13 +960,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
INT32 tspeed, forward, side, axis, i;
|
INT32 tspeed, forward, side, axis, i;
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, mouseaiming, joyaiming, analogjoystickmove, gamepadjoystickmove;
|
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming;
|
||||||
player_t *player = &players[consoleplayer];
|
player_t *player = &players[consoleplayer];
|
||||||
camera_t *thiscam = &camera;
|
camera_t *thiscam = &camera;
|
||||||
|
|
||||||
static INT32 turnheld; // for accelerative turning
|
static INT32 turnheld; // for accelerative turning
|
||||||
static boolean keyboard_look; // true if lookup/down using keyboard
|
static boolean keyboard_look; // true if lookup/down using keyboard
|
||||||
static boolean resetdown; // don't cam reset every frame
|
static boolean resetdown; // don't cam reset every frame
|
||||||
|
static boolean joyaiming; // check the last frame's value if we need to reset the camera
|
||||||
|
|
||||||
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
|
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
|
||||||
|
|
||||||
|
@ -986,6 +987,15 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
|
||||||
analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle;
|
analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle;
|
||||||
gamepadjoystickmove = cv_usejoystick.value && Joystick.bGamepadStyle;
|
gamepadjoystickmove = cv_usejoystick.value && Joystick.bGamepadStyle;
|
||||||
|
|
||||||
|
// todo joystick-juggling next
|
||||||
|
//thisjoyaiming = (cv_chasecam.value) ? cv_chasefreelook.value : cv_alwaysfreelook.value;
|
||||||
|
thisjoyaiming = cv_alwaysfreelook.value;
|
||||||
|
|
||||||
|
// Reset the vertical look if we're no longer joyaiming
|
||||||
|
if (!thisjoyaiming && joyaiming)
|
||||||
|
localaiming = 0;
|
||||||
|
joyaiming = thisjoyaiming;
|
||||||
|
|
||||||
axis = JoyAxis(AXISTURN);
|
axis = JoyAxis(AXISTURN);
|
||||||
if (gamepadjoystickmove && axis != 0)
|
if (gamepadjoystickmove && axis != 0)
|
||||||
{
|
{
|
||||||
|
@ -1252,13 +1262,14 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
INT32 tspeed, forward, side, axis, i;
|
INT32 tspeed, forward, side, axis, i;
|
||||||
const INT32 speed = 1;
|
const INT32 speed = 1;
|
||||||
// these ones used for multiple conditions
|
// these ones used for multiple conditions
|
||||||
boolean turnleft, turnright, mouseaiming, joyaiming, analogjoystickmove, gamepadjoystickmove;
|
boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove, thisjoyaiming;
|
||||||
player_t *player = &players[secondarydisplayplayer];
|
player_t *player = &players[secondarydisplayplayer];
|
||||||
camera_t *thiscam = (player->bot == 2 ? &camera : &camera2);
|
camera_t *thiscam = (player->bot == 2 ? &camera : &camera2);
|
||||||
|
|
||||||
static INT32 turnheld; // for accelerative turning
|
static INT32 turnheld; // for accelerative turning
|
||||||
static boolean keyboard_look; // true if lookup/down using keyboard
|
static boolean keyboard_look; // true if lookup/down using keyboard
|
||||||
static boolean resetdown; // don't cam reset every frame
|
static boolean resetdown; // don't cam reset every frame
|
||||||
|
static boolean joyaiming; // check the last frame's value if we need to reset the camera
|
||||||
|
|
||||||
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1); // empty, or external driver
|
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1); // empty, or external driver
|
||||||
|
|
||||||
|
@ -1278,6 +1289,15 @@ void G_BuildTiccmd2(ticcmd_t *cmd, INT32 realtics)
|
||||||
analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle;
|
analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle;
|
||||||
gamepadjoystickmove = cv_usejoystick2.value && Joystick2.bGamepadStyle;
|
gamepadjoystickmove = cv_usejoystick2.value && Joystick2.bGamepadStyle;
|
||||||
|
|
||||||
|
// todo joystick-juggling next
|
||||||
|
//thisjoyaiming = (cv_chasecam.value) ? cv_chasefreelook2.value : cv_alwaysfreelook2.value;
|
||||||
|
thisjoyaiming = cv_alwaysfreelook2.value;
|
||||||
|
|
||||||
|
// Reset the vertical look if we're no longer joyaiming
|
||||||
|
if (!thisjoyaiming && joyaiming)
|
||||||
|
localaiming2 = 0;
|
||||||
|
joyaiming = thisjoyaiming;
|
||||||
|
|
||||||
axis = Joy2Axis(AXISTURN);
|
axis = Joy2Axis(AXISTURN);
|
||||||
if (gamepadjoystickmove && axis != 0)
|
if (gamepadjoystickmove && axis != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue