do_powerup_frame: reject invalid vclip frametime

vclip::frame_time equal to 0 would cause an infinite loop.
vclip::frame_time less than 0 would cause the loop to run until
underflow, which could be very slow if frame_time is near 0.
This commit is contained in:
Kp 2017-12-07 05:45:41 +00:00
parent 544fc0f893
commit 0edf08cfbc

View file

@ -81,6 +81,8 @@ void do_powerup_frame(const vmobjptridx_t obj)
auto &vc = Vclip[vci->vclip_num];
const auto vc_frame_time = vc.frame_time;
if (vc_frame_time > 0)
{
const auto vc_num_frames1 = vc.num_frames - 1;
vci->frametime -= FrameTime+fudge;
@ -105,6 +107,7 @@ void do_powerup_frame(const vmobjptridx_t obj)
vci->framenum++;
}
}
}
if (obj->lifeleft <= 0) {
object_create_explosion(vmsegptridx(obj->segnum), obj->pos, F1_0*7/2, VCLIP_POWERUP_DISAPPEARANCE);