- Implement multitick viewpitch centering logic.

SVN r3512 (trunk)
This commit is contained in:
Randy Heit 2012-04-03 04:09:30 +00:00
parent ee20c2169e
commit c5a3d846dd
3 changed files with 20 additions and 11 deletions

View file

@ -2062,14 +2062,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
break;
case DEM_CENTERVIEW:
if (players[player].mo != NULL)
{
players[player].mo->pitch = 0;
}
if (player == consoleplayer)
{
LocalViewPitch = 0;
}
players[player].centering = true;
break;
case DEM_INVUSEALL:

View file

@ -2241,9 +2241,9 @@ void P_PlayerThink (player_t *player)
{
if (look == -32768 << 16)
{ // center view
player->mo->pitch = 0;
player->centering = true;
}
else
else if (!player->centering)
{
player->mo->pitch -= look;
if (look > 0)
@ -2257,6 +2257,22 @@ void P_PlayerThink (player_t *player)
}
}
}
if (player->centering)
{
if (abs(player->mo->pitch) > 2*ANGLE_1)
{
player->mo->pitch = FixedMul(player->mo->pitch, FRACUNIT*2/3);
}
else
{
player->mo->pitch = 0;
player->centering = false;
if (player - players == consoleplayer)
{
LocalViewPitch = 0;
}
}
}
// [RH] Check for fast turn around
if (cmd->ucmd.buttons & BT_TURN180 && !(player->oldbuttons & BT_TURN180))

View file

@ -593,7 +593,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
{
viewangle = iview->nviewangle + (LocalViewAngle & 0xFFFF0000);
fixed_t delta = -(signed)(LocalViewPitch & 0xFFFF0000);
fixed_t delta = player->centering ? 0 : -(signed)(LocalViewPitch & 0xFFFF0000);
viewpitch = iview->nviewpitch;
if (delta > 0)