From 4cf58284bebc15e94f5f1c2bd22bc3451fceefb2 Mon Sep 17 00:00:00 2001 From: Brad Harding Date: Sat, 16 Sep 2023 10:40:47 +1000 Subject: [PATCH] Fix using controller to pan in automap --- releasenotes.md | 2 ++ src/am_map.c | 60 +++++++++---------------------------------------- src/g_game.c | 3 +++ 3 files changed, 15 insertions(+), 50 deletions(-) diff --git a/releasenotes.md b/releasenotes.md index f80dc3e1ac..85e41bff7d 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -3,6 +3,8 @@ #### DOOM Retro v5.0.1 * A crash no longer occurs when loading a savegame from a [*DSDHacked*](https://doomwiki.org/wiki/DSDHacked)-compatible WAD. +* A bug is fixed whereby no music or sound effects would play when opening *DOOM Retro* for the first time after installing it. +* Panning around the automap using a controller’s left thumbstick when the `am_followmode` CVAR is `off` now works as intended. * These changes have been made when playing [*Smooth DOOM MBF21*](https://www.doomworld.com/forum/topic/133318/): * Ammo casings will no disappear and leave blood splats on the floor. * Blood splats now appear around corpses spawned at the start of a map when the `r_corpses_moreblood` CVAR is `on`. diff --git a/src/am_map.c b/src/am_map.c index ba481c983b..162f3ebad9 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -1043,6 +1043,16 @@ bool AM_Responder(const event_t *ev) if (!am_followmode) { + if (!movement) + { + m_paninc.x = 0; + m_paninc.y = 0; + mtof_zoommul = FRACUNIT; + ftom_zoommul = FRACUNIT; + } + + movement = false; + // pan right with left thumbstick if (gamecontrollerthumbLX > 0) { @@ -1061,26 +1071,6 @@ bool AM_Responder(const event_t *ev) * ((float)(gamecontrollerthumbLX) / SHRT_MAX) * 1.2f); } - // pan right with right thumbstick - if (gamecontrollerthumbRX > 0 - && gamecontrollerthumbRX > gamecontrollerthumbLX) - { - movement = true; - speedtoggle = AM_GetSpeedToggle(); - m_paninc.x = (fixed_t)(FTOM(F_PANINC) - * ((float)gamecontrollerthumbRX / SHRT_MAX) * 1.2f); - } - - // pan left with right thumbstick - else if (gamecontrollerthumbRX < 0 - && gamecontrollerthumbRX < gamecontrollerthumbLX) - { - movement = true; - speedtoggle = AM_GetSpeedToggle(); - m_paninc.x = (fixed_t)(FTOM(F_PANINC) - * ((float)(gamecontrollerthumbRX) / SHRT_MAX) * 1.2f); - } - // pan up with left thumbstick if (gamecontrollerthumbLY < 0) { @@ -1098,37 +1088,7 @@ bool AM_Responder(const event_t *ev) m_paninc.y = -(fixed_t)(FTOM(F_PANINC) * ((float)gamecontrollerthumbLY / SHRT_MAX) * 1.2f); } - - // pan up with right thumbstick - if (gamecontrollerthumbRY < 0 - && gamecontrollerthumbRY < gamecontrollerthumbLY) - { - movement = true; - speedtoggle = AM_GetSpeedToggle(); - m_paninc.y = -(fixed_t)(FTOM(F_PANINC) - * ((float)(gamecontrollerthumbRY) / SHRT_MAX) * 1.2f); - } - - // pan down with right thumbstick - else if (gamecontrollerthumbRY > 0 - && gamecontrollerthumbRY > gamecontrollerthumbLY) - { - movement = true; - speedtoggle = AM_GetSpeedToggle(); - m_paninc.y = -(fixed_t)(FTOM(F_PANINC) - * ((float)gamecontrollerthumbRY / SHRT_MAX) * 1.2f); - } } - - if (!movement) - { - m_paninc.x = 0; - m_paninc.y = 0; - mtof_zoommul = FRACUNIT; - ftom_zoommul = FRACUNIT; - } - else - movement = false; } if ((viewplayer->cheats & CF_MYPOS) && !am_followmode && (m_paninc.x || m_paninc.y)) diff --git a/src/g_game.c b/src/g_game.c index 35f27c22a8..97518f2a12 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -261,6 +261,9 @@ void G_BuildTiccmd(ticcmd_t *cmd) int forward = 0; int side = 0; + if (automapactive && !am_followmode && viewplayer->health > 0) + return; + memset(cmd, 0, sizeof(ticcmd_t)); strafe = (gamekeydown[keyboardstrafe] || mousebuttons[mousestrafe] || (gamecontrollerbuttons & gamecontrollerstrafe));