Clamp chase_dist and chase_height because integer overflow is a thing.

This commit is contained in:
Randy Heit 2014-12-26 15:15:42 -06:00
parent ec98937c88
commit e0667544d2
1 changed files with 2 additions and 2 deletions

View File

@ -4279,7 +4279,7 @@ CVAR(Float, chase_dist, 90.f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &CameraZ, sector_t *&CameraSector)
{
fixed_t distance = (fixed_t)(chase_dist * FRACUNIT);
fixed_t distance = (fixed_t)(clamp<double>(chase_dist, 0, 30000) * FRACUNIT);
angle_t angle = (t1->angle - ANG180) >> ANGLETOFINESHIFT;
angle_t pitch = (angle_t)(t1->pitch) >> ANGLETOFINESHIFT;
FTraceResults trace;
@ -4289,7 +4289,7 @@ void P_AimCamera(AActor *t1, fixed_t &CameraX, fixed_t &CameraY, fixed_t &Camera
vy = FixedMul(finecosine[pitch], finesine[angle]);
vz = finesine[pitch];
sz = t1->z - t1->floorclip + t1->height + (fixed_t)(chase_height * FRACUNIT);
sz = t1->z - t1->floorclip + t1->height + (fixed_t)(clamp<double>(chase_height, -1000, 1000) * FRACUNIT);
if (Trace(t1->x, t1->y, sz, t1->Sector,
vx, vy, vz, distance, 0, 0, NULL, trace) &&