From 8d120b8a4db1411c4a21245dec80cb2221c0fc5c Mon Sep 17 00:00:00 2001 From: kichikuou Date: Fri, 13 Jun 2025 12:53:45 +0900 Subject: [PATCH] 3d: Avoid zero division in update_motion() --- src/3d/reign.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/3d/reign.c b/src/3d/reign.c index 276292a..b4da982 100644 --- a/src/3d/reign.c +++ b/src/3d/reign.c @@ -131,7 +131,9 @@ static void update_motion(struct motion *m, float delta_frame) } break; case RE_MOTION_STATE_LOOP: - if (m->current_frame > m->loop_frame_end) + if (m->loop_frame_begin == m->loop_frame_end) + m->current_frame = m->loop_frame_begin; + else if (m->current_frame > m->loop_frame_end) m->current_frame = m->loop_frame_begin + fmodf(m->current_frame - m->loop_frame_begin, m->loop_frame_end - m->loop_frame_begin); break; default: