Skip to content

Commit

Permalink
Use excmd look for pitch
Browse files Browse the repository at this point in the history
  • Loading branch information
kraflab committed Feb 25, 2024
1 parent dc03c39 commit f2f5b10
Showing 1 changed file with 24 additions and 43 deletions.
67 changes: 24 additions & 43 deletions prboom2/src/p_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,64 +321,47 @@ void P_CalcHeight (player_t* player)
}

//
// P_SetPitch
// Mouse Look Stuff
// P_MovePlayer
//
// Adds momentum if the player is not in the air
//
void P_SetPitch(player_t *player)
// killough 10/98: simplified

void P_HandleExCmdLook(player_t* player)
{
mobj_t *mo = player->mo;
int look;

if (player == &players[consoleplayer])
look = player->cmd.ex.look;
if (look)
{
if (!demoplayback)
if (raven)
{
if (dsda_MouseLook())
{
if (!mo->reactiontime && automap_off)
{
if (raven && !demorecording)
{
player->lookdir += ANGLE_T_TO_LOOKDIR(mlooky << 16);
if (player->lookdir > 90)
player->lookdir = 90;
if (player->lookdir < -110)
player->lookdir = -110;
}
else
{
mo->pitch += (mlooky << 16);
CheckPitch((signed int *)&mo->pitch);
}
}
}
else
{
mo->pitch = 0;
}
player->lookdir += ANGLE_T_TO_LOOKDIR(look << 16);
if (player->lookdir > 90)
player->lookdir = 90;
if (player->lookdir < -110)
player->lookdir = -110;
}
else
{
mo->pitch = 0;
if (look == XC_LOOK_RESET)
player->mo->pitch = 0;
else
{
player->mo->pitch += look << 16;
CheckPitch((signed int *) &player->mo->pitch);
}
}
}
else
{
mo->pitch = 0;
}
}

//
// P_MovePlayer
//
// Adds momentum if the player is not in the air
//
// killough 10/98: simplified

void P_MovePlayer (player_t* player)
{
ticcmd_t *cmd;
mobj_t *mo;

P_HandleExCmdLook(player);

if (raven) return Raven_P_MovePlayer(player);

cmd = &player->cmd;
Expand Down Expand Up @@ -737,8 +720,6 @@ void P_PlayerThink (player_t* player)
}
}

P_SetPitch(player);

P_CalcHeight (player); // Determines view height and bobbing

// Determine if there's anything about the sector you're in that's
Expand Down

0 comments on commit f2f5b10

Please sign in to comment.