This was a tad broken - if an animation happened to paint before it ticked, it'd try to paint tile -1 which obviously didn't exist. This change may break any custom sequencers anyone has but seems necessary...

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@899 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2010-03-04 01:39:36 +00:00
parent e702a1b33e
commit 490dcdfd2b
3 changed files with 9 additions and 4 deletions
@@ -118,7 +118,7 @@ public interface AnimationFrameSequencer extends FrameSequencer
} }
// documentation inherited from interface // documentation inherited from interface
public void init (MultiFrameImage source) public int init (MultiFrameImage source)
{ {
int framecount = source.getFrameCount(); int framecount = source.getFrameCount();
// let's make sure our frames are valid // let's make sure our frames are valid
@@ -135,6 +135,8 @@ public interface AnimationFrameSequencer extends FrameSequencer
_lastStamp = 0L; _lastStamp = 0L;
_curIdx = 0; _curIdx = 0;
} }
return _sequence[_curIdx];
} }
// documentation inherited from interface // documentation inherited from interface
@@ -81,7 +81,7 @@ public class MultiFrameAnimation extends Animation
_fidx = -1; _fidx = -1;
// reset our frame sequencer // reset our frame sequencer
_seeker.init(_frames); setFrameIndex(_seeker.init(_frames));
if (_seeker instanceof AnimationFrameSequencer) { if (_seeker instanceof AnimationFrameSequencer) {
((AnimationFrameSequencer) _seeker).setAnimation(this); ((AnimationFrameSequencer) _seeker).setAnimation(this);
} }
@@ -35,8 +35,9 @@ public interface FrameSequencer
* *
* @param source the multie-frame image that is providing the * @param source the multie-frame image that is providing the
* animation frames. * animation frames.
* @return initial frame index
*/ */
public void init (MultiFrameImage source); public int init (MultiFrameImage source);
/** /**
* Called every display frame, the frame sequencer should return the * Called every display frame, the frame sequencer should return the
@@ -76,10 +77,12 @@ public interface FrameSequencer
} }
// documentation inherited from interface // documentation inherited from interface
public void init (MultiFrameImage source) public int init (MultiFrameImage source)
{ {
_frameCount = source.getFrameCount(); _frameCount = source.getFrameCount();
_startStamp = 0l; _startStamp = 0l;
return 0;
} }
// documentation inherited from interface // documentation inherited from interface