Skip to content

Commit

Permalink
Manage look limits before demo command
Browse files Browse the repository at this point in the history
  • Loading branch information
kraflab committed Apr 12, 2024
1 parent fe54f4f commit ef803a7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 24 deletions.
20 changes: 2 additions & 18 deletions prboom2/src/e6y.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,24 +268,8 @@ void M_ChangeSkyMode(void)
gl_drawskys = gl_skymode;
}

static int upViewPitchLimit;
static int downViewPitchLimit;

void M_ChangeMaxViewPitch(void)
{
if (raven || !V_IsOpenGLMode())
{
upViewPitchLimit = (int) raven_angle_up_limit;
downViewPitchLimit = (int) raven_angle_down_limit;
}
else
{
upViewPitchLimit = -ANG90 + (1 << ANGLETOFINESHIFT);
downViewPitchLimit = ANG90 - (1 << ANGLETOFINESHIFT);
}

CheckPitch(&viewpitch);
}
static const int upViewPitchLimit = -ANG90 + (1 << ANGLETOFINESHIFT);
static const int downViewPitchLimit = ANG90 - (1 << ANGLETOFINESHIFT);

void M_ChangeScreenMultipleFactor(void)
{
Expand Down
1 change: 0 additions & 1 deletion prboom2/src/e6y.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ int G_ReloadLevel(void);
int G_GotoNextLevel(void);

void M_ChangeSkyMode(void);
void M_ChangeMaxViewPitch(void);

void M_ChangeFOV(void);

Expand Down
13 changes: 11 additions & 2 deletions prboom2/src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,10 +806,19 @@ void G_BuildTiccmd(ticcmd_t* cmd)

// TODO: look keybinds

// TODO: need to restrict input relative to software mode here (for demo compatibility)

if (look)
{
if (!V_IsOpenGLMode())
{
int target_look = players[consoleplayer].mo->pitch + (look << 16);

if (target_look < (int) raven_angle_up_limit)
look = (raven_angle_up_limit - players[consoleplayer].mo->pitch) >> 16;

if (target_look > (int) raven_angle_down_limit)
look = (raven_angle_down_limit - players[consoleplayer].mo->pitch) >> 16;
}

dsda_QueueExCmdLook(look);
}
}
Expand Down
2 changes: 0 additions & 2 deletions prboom2/src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -3085,7 +3085,6 @@ void M_ChangeFullScreen(void)
void M_ChangeVideoMode(void)
{
V_ChangeScreenResolution();
M_ChangeMaxViewPitch();
}

void M_ChangeUseGLSurface(void)
Expand Down Expand Up @@ -6063,7 +6062,6 @@ void M_Init(void)

//e6y
M_ChangeSpeed();
M_ChangeMaxViewPitch();
M_ChangeSkyMode();
M_ChangeFOV();

Expand Down
1 change: 0 additions & 1 deletion prboom2/src/tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ typedef unsigned angle_t;
// precomputed to avoid compiler-dependent floating point operation!
static const angle_t raven_angle_down_limit = 0x18e70000; // (angle_t) (int) (110 * ANG1 / M_PI);
static const angle_t raven_angle_up_limit = 0xeba00000; // (angle_t) (int) (-90 * ANG1 / M_PI);
#define RAVEN_PITCH_UP_LIMIT ANGLE_T_TO_PITCH_F(raven_angle_up_limit)

// Load trig tables if needed
void R_LoadTrigTables(void);
Expand Down

0 comments on commit ef803a7

Please sign in to comment.