Merge branch 'viewpitch_overflow_fix' of https://github.com/edward-san/zdoom into maint

This commit is contained in:
Christoph Oelckers 2014-01-17 20:43:03 +01:00
commit 9a74f96702
2 changed files with 4 additions and 4 deletions

View File

@ -775,7 +775,7 @@ void G_AddViewPitch (int look)
else if (look > 0)
{
// Avoid overflowing
if (LocalViewPitch + look <= LocalViewPitch)
if (LocalViewPitch > INT_MAX - look)
{
LocalViewPitch = 0x78000000;
}
@ -787,7 +787,7 @@ void G_AddViewPitch (int look)
else if (look < 0)
{
// Avoid overflowing
if (LocalViewPitch + look >= LocalViewPitch)
if (LocalViewPitch < INT_MIN - look)
{
LocalViewPitch = -0x78000000;
}

View File

@ -602,7 +602,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
if (delta > 0)
{
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
if (viewpitch + delta <= viewpitch)
if (viewpitch > INT_MAX - delta)
{
viewpitch = player->MaxPitch;
}
@ -614,7 +614,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
else if (delta < 0)
{
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
if (viewpitch + delta >= viewpitch)
if (viewpitch < INT_MIN - delta)
{
viewpitch = player->MinPitch;
}