Not to freak out if we have no frames.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1083 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-03-04 22:47:06 +00:00
parent 001932b5a5
commit 22d0839b72
2 changed files with 16 additions and 5 deletions
@@ -1,5 +1,5 @@
//
// $Id: CharacterSprite.java,v 1.21 2002/02/19 22:09:08 mdb Exp $
// $Id: CharacterSprite.java,v 1.22 2002/03/04 22:47:06 mdb Exp $
package com.threerings.cast;
@@ -71,7 +71,7 @@ public class CharacterSprite
setFrames(_frames[_orient]);
} catch (NoSuchComponentException nsce) {
Log.warning("Character sprite referneces non-existent " +
Log.warning("Character sprite references non-existent " +
"component [sprite=" + this + ", err=" + nsce + "].");
}
}
@@ -82,7 +82,9 @@ public class CharacterSprite
super.setOrientation(orient);
// update the sprite frames to reflect the direction
setFrames(_frames[orient]);
if (_frames != null) {
setFrames(_frames[orient]);
}
}
/**
@@ -1,5 +1,5 @@
//
// $Id: Sprite.java,v 1.37 2002/02/20 03:13:57 mdb Exp $
// $Id: Sprite.java,v 1.38 2002/03/04 22:47:06 mdb Exp $
package com.threerings.media.sprite;
@@ -198,7 +198,11 @@ public class Sprite implements DirectionCodes
*/
public void paint (Graphics2D gfx)
{
gfx.drawImage(_frame, _bounds.x, _bounds.y, null);
if (_frame != null) {
gfx.drawImage(_frame, _bounds.x, _bounds.y, null);
} else {
gfx.draw(_bounds);
}
}
/**
@@ -435,6 +439,11 @@ public class Sprite implements DirectionCodes
*/
public void tick (long timestamp)
{
// if we have no frames, we're hosulated (to use a Greenwell term)
if (_frames == null) {
return;
}
int fcount = _frames.getFrameCount();
boolean moved = false;