From 740943f1b6d88ab01c8288c236f80814a8ec7f07 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Fri, 28 Feb 2025 10:04:11 +0100 Subject: [PATCH] instant feedback when disabling "free look" in the menu --- src/mn_menu.c | 3 +++ src/p_user.c | 39 ++++++++++++++++++++++----------------- src/p_user.h | 1 + 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/mn_menu.c b/src/mn_menu.c index 4323fe2f..9ae10d92 100644 --- a/src/mn_menu.c +++ b/src/mn_menu.c @@ -52,6 +52,7 @@ #include "mn_internal.h" #include "mn_snapshot.h" #include "p_saveg.h" +#include "p_user.h" #include "r_defs.h" #include "r_draw.h" #include "r_main.h" @@ -2354,6 +2355,8 @@ void M_Ticker(void) whichSkull ^= 1; skullAnimCounter = 8; } + + P_CenterView(&players[consoleplayer]); } ///////////////////////////////////////////////////////////////////////////// diff --git a/src/p_user.c b/src/p_user.c index 862a6bd7..446cd5ea 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -343,6 +343,27 @@ void P_DeathThink (player_t* player) // P_PlayerThink // +void P_CenterView (player_t* player) +{ + // [crispy] center view + if (player->centering) + { + player->pitch /= 2; + + if (abs(player->pitch) < ANG1) + { + player->pitch = 0; + + if (player->oldpitch == 0) + { + player->centering = false; + } + } + + player->slope = PlayerSlope(player); + } +} + void P_PlayerThink (player_t* player) { ticcmd_t* cmd; @@ -382,23 +403,7 @@ void P_PlayerThink (player_t* player) player->mo->flags &= ~MF_JUSTATTACKED; } - // [crispy] center view - if (player->centering) - { - player->pitch /= 2; - - if (abs(player->pitch) < ANG1) - { - player->pitch = 0; - - if (player->oldpitch == 0) - { - player->centering = false; - } - } - - player->slope = PlayerSlope(player); - } + P_CenterView(player); // [crispy] weapon recoil pitch if (player->recoilpitch) diff --git a/src/p_user.h b/src/p_user.h index 11ceb997..081a51e1 100644 --- a/src/p_user.h +++ b/src/p_user.h @@ -33,6 +33,7 @@ void P_CalcHeight(struct player_s *player); void P_DeathThink(struct player_s *player); void P_MovePlayer(struct player_s *player); void P_Thrust(struct player_s *player, angle_t angle, fixed_t move); +void P_CenterView (player_t* player); typedef enum {