mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
- Fixed overflow checking in some viewpitch code
This commit is contained in:
parent
2501dc6df6
commit
884928687d
2 changed files with 4 additions and 4 deletions
|
@ -775,7 +775,7 @@ void G_AddViewPitch (int look)
|
||||||
else if (look > 0)
|
else if (look > 0)
|
||||||
{
|
{
|
||||||
// Avoid overflowing
|
// Avoid overflowing
|
||||||
if (LocalViewPitch + look <= LocalViewPitch)
|
if (LocalViewPitch > INT_MAX - look)
|
||||||
{
|
{
|
||||||
LocalViewPitch = 0x78000000;
|
LocalViewPitch = 0x78000000;
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ void G_AddViewPitch (int look)
|
||||||
else if (look < 0)
|
else if (look < 0)
|
||||||
{
|
{
|
||||||
// Avoid overflowing
|
// Avoid overflowing
|
||||||
if (LocalViewPitch + look >= LocalViewPitch)
|
if (LocalViewPitch < INT_MIN - look)
|
||||||
{
|
{
|
||||||
LocalViewPitch = -0x78000000;
|
LocalViewPitch = -0x78000000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -602,7 +602,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
||||||
if (delta > 0)
|
if (delta > 0)
|
||||||
{
|
{
|
||||||
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
|
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
|
||||||
if (viewpitch + delta <= viewpitch)
|
if (viewpitch > INT_MAX - delta)
|
||||||
{
|
{
|
||||||
viewpitch = player->MaxPitch;
|
viewpitch = player->MaxPitch;
|
||||||
}
|
}
|
||||||
|
@ -614,7 +614,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi
|
||||||
else if (delta < 0)
|
else if (delta < 0)
|
||||||
{
|
{
|
||||||
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
|
// Avoid overflowing viewpitch (can happen when a netgame is stalled)
|
||||||
if (viewpitch + delta >= viewpitch)
|
if (viewpitch < INT_MIN - delta)
|
||||||
{
|
{
|
||||||
viewpitch = player->MinPitch;
|
viewpitch = player->MinPitch;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue