instant feedback when disabling "free look" in the menu

This commit is contained in:
Fabian Greffrath 2025-02-28 10:04:11 +01:00
parent 40d413183c
commit 740943f1b6
3 changed files with 26 additions and 17 deletions

View File

@ -52,6 +52,7 @@
#include "mn_internal.h" #include "mn_internal.h"
#include "mn_snapshot.h" #include "mn_snapshot.h"
#include "p_saveg.h" #include "p_saveg.h"
#include "p_user.h"
#include "r_defs.h" #include "r_defs.h"
#include "r_draw.h" #include "r_draw.h"
#include "r_main.h" #include "r_main.h"
@ -2354,6 +2355,8 @@ void M_Ticker(void)
whichSkull ^= 1; whichSkull ^= 1;
skullAnimCounter = 8; skullAnimCounter = 8;
} }
P_CenterView(&players[consoleplayer]);
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -343,6 +343,27 @@ void P_DeathThink (player_t* player)
// P_PlayerThink // 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) void P_PlayerThink (player_t* player)
{ {
ticcmd_t* cmd; ticcmd_t* cmd;
@ -382,23 +403,7 @@ void P_PlayerThink (player_t* player)
player->mo->flags &= ~MF_JUSTATTACKED; player->mo->flags &= ~MF_JUSTATTACKED;
} }
// [crispy] center view P_CenterView(player);
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);
}
// [crispy] weapon recoil pitch // [crispy] weapon recoil pitch
if (player->recoilpitch) if (player->recoilpitch)

View File

@ -33,6 +33,7 @@ void P_CalcHeight(struct player_s *player);
void P_DeathThink(struct player_s *player); void P_DeathThink(struct player_s *player);
void P_MovePlayer(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_Thrust(struct player_s *player, angle_t angle, fixed_t move);
void P_CenterView (player_t* player);
typedef enum typedef enum
{ {