ref: a46521d80d704dc4401a3a222b575a1a47021570
parent: bf0b0ac06a006f952034b08fd6a07c4f16ab18da
parent: bc304548e3e9b7c59e3cc22b383e106507ec701b
author: Fabian Greffrath <fabian@greffrath.com>
date: Thu Apr 8 08:36:36 EDT 2021
Merge branch 'mouse_left_right' of https://github.com/chocolate-doom/chocolate-doom into mouse_left_right
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -369,12 +369,12 @@
// let movement keys cancel each other out
if (strafe)
{
- if (gamekeydown[key_right])
+ if (gamekeydown[key_right] || mousebuttons[mousebturnright])
{
// fprintf(stderr, "strafe right\n");
side += sidemove[speed];
}
- if (gamekeydown[key_left])
+ if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
{
// fprintf(stderr, "strafe left\n");
side -= sidemove[speed];
@@ -383,26 +383,18 @@
side += sidemove[speed];
if (joyxmove < 0)
side -= sidemove[speed];
- if (mousebuttons[mousebturnright])
- side += sidemove[speed];
- if (mousebuttons[mousebturnleft])
- side -= sidemove[speed];
}
else
{
- if (gamekeydown[key_right])
+ if (gamekeydown[key_right] || mousebuttons[mousebturnright])
cmd->angleturn -= angleturn[tspeed];
- if (gamekeydown[key_left])
+ if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
cmd->angleturn += angleturn[tspeed];
if (joyxmove > 0)
cmd->angleturn -= angleturn[tspeed];
if (joyxmove < 0)
cmd->angleturn += angleturn[tspeed];
- if (mousebuttons[mousebturnright])
- cmd->angleturn -= angleturn[tspeed];
- if (mousebuttons[mousebturnleft])
- cmd->angleturn += angleturn[tspeed];
}
if (gamekeydown[key_up])
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -352,32 +352,24 @@
//
if (strafe)
{
- if (gamekeydown[key_right])
+ if (gamekeydown[key_right] || mousebuttons[mousebturnright])
side += sidemove[speed];
- if (gamekeydown[key_left])
+ if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
side -= sidemove[speed];
if (joyxmove > 0)
side += sidemove[speed];
if (joyxmove < 0)
side -= sidemove[speed];
- if (mousebuttons[mousebturnright])
- side += sidemove[speed];
- if (mousebuttons[mousebturnleft])
- side -= sidemove[speed];
}
else
{
- if (gamekeydown[key_right])
+ if (gamekeydown[key_right] || mousebuttons[mousebturnright])
cmd->angleturn -= angleturn[tspeed];
- if (gamekeydown[key_left])
+ if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
cmd->angleturn += angleturn[tspeed];
if (joyxmove > 0)
cmd->angleturn -= angleturn[tspeed];
if (joyxmove < 0)
- cmd->angleturn += angleturn[tspeed];
- if (mousebuttons[mousebturnright])
- cmd->angleturn -= angleturn[tspeed];
- if (mousebuttons[mousebturnleft])
cmd->angleturn += angleturn[tspeed];
}
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -270,11 +270,11 @@
//
if (strafe)
{
- if (gamekeydown[key_right])
+ if (gamekeydown[key_right] || mousebuttons[mousebturnright])
{
side += sidemove[pClass][speed];
}
- if (gamekeydown[key_left])
+ if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
{
side -= sidemove[pClass][speed];
}
@@ -286,28 +286,16 @@
{
side -= sidemove[pClass][speed];
}
- if (mousebuttons[mousebturnright])
- {
- side += sidemove[pClass][speed];
- }
- if (mousebuttons[mousebturnleft])
- {
- side -= sidemove[pClass][speed];
- }
}
else
{
- if (gamekeydown[key_right])
+ if (gamekeydown[key_right] || mousebuttons[mousebturnright])
cmd->angleturn -= angleturn[tspeed];
- if (gamekeydown[key_left])
+ if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
cmd->angleturn += angleturn[tspeed];
if (joyxmove > 0)
cmd->angleturn -= angleturn[tspeed];
if (joyxmove < 0)
- cmd->angleturn += angleturn[tspeed];
- if (mousebuttons[mousebturnright])
- cmd->angleturn -= angleturn[tspeed];
- if (mousebuttons[mousebturnleft])
cmd->angleturn += angleturn[tspeed];
}
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -420,12 +420,12 @@
// let movement keys cancel each other out
if (strafe)
{
- if (gamekeydown[key_right])
+ if (gamekeydown[key_right] || mousebuttons[mousebturnright])
{
// fprintf(stderr, "strafe right\n");
side += sidemove[speed];
}
- if (gamekeydown[key_left])
+ if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
{
// fprintf(stderr, "strafe left\n");
side -= sidemove[speed];
@@ -434,26 +434,18 @@
side += sidemove[speed];
if (joyxmove < 0)
side -= sidemove[speed];
- if (mousebuttons[mousebturnright])
- side += sidemove[speed];
- if (mousebuttons[mousebturnleft])
- side -= sidemove[speed];
}
else
{
- if (gamekeydown[key_right])
+ if (gamekeydown[key_right] || mousebuttons[mousebturnright])
cmd->angleturn -= angleturn[tspeed];
- if (gamekeydown[key_left])
+ if (gamekeydown[key_left] || mousebuttons[mousebturnleft])
cmd->angleturn += angleturn[tspeed];
if (joyxmove > 0)
cmd->angleturn -= angleturn[tspeed];
if (joyxmove < 0)
cmd->angleturn += angleturn[tspeed];
- if (mousebuttons[mousebturnright])
- cmd->angleturn -= angleturn[tspeed];
- if (mousebuttons[mousebturnleft])
- cmd->angleturn += angleturn[tspeed];
}
if (gamekeydown[key_up])