# HG changeset patch # User John Tsiombikas # Date 1361938826 -7200 # Node ID 28c9d38e80de368c62f61a8d1894b356f1b8b604 # Parent 529036ffe7a5317a5dc5f44c3e3a2f804ab53992 fixed a bug in time clamping diff -r 529036ffe7a5 -r 28c9d38e80de src/track.c --- a/src/track.c Mon Feb 25 05:58:09 2013 +0200 +++ b/src/track.c Wed Feb 27 06:20:26 2013 +0200 @@ -276,18 +276,27 @@ static anm_time_t remap_clamp(anm_time_t tm, anm_time_t start, anm_time_t end) { + if(start == end) { + return start; + } return tm < start ? start : (tm >= end ? end - 1 : tm); } static anm_time_t remap_repeat(anm_time_t tm, anm_time_t start, anm_time_t end) { anm_time_t interv = end - start; + anm_time_t x = (tm - start) % interv; - if(tm < start) { + if(x < 0) { + x += interv; + } + return x + start; + + /*if(tm < start) { while(tm < start) { tm += interv; } return tm; } - return (tm - start) % interv + start; + return (tm - start) % interv + start;*/ }