Include the timestamp associated with sprite events in the event.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2020 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2002-12-04 02:45:09 +00:00
parent c321f7eb33
commit 6552b5bd8b
10 changed files with 39 additions and 24 deletions
@@ -1,5 +1,5 @@
//
// $Id: CharacterSprite.java,v 1.37 2002/11/19 00:23:46 mdb Exp $
// $Id: CharacterSprite.java,v 1.38 2002/12/04 02:45:08 shaper Exp $
package com.threerings.cast;
@@ -258,9 +258,9 @@ public class CharacterSprite extends ImageSprite
}
// documentation inherited
public void pathCompleted ()
public void pathCompleted (long timestamp)
{
super.pathCompleted();
super.pathCompleted(timestamp);
halt();
}
@@ -1,5 +1,5 @@
//
// $Id: MediaPanel.java,v 1.23 2002/11/20 03:11:43 mdb Exp $
// $Id: MediaPanel.java,v 1.24 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media;
@@ -83,6 +83,8 @@ public class MediaPanel extends JComponent
*/
public void setPaused (boolean paused)
{
Log.info("setPaused [paused=" + paused + "].");
// sanity check
if ((paused && (_pauseTime != 0)) ||
(!paused && (_pauseTime == 0))) {
@@ -1,5 +1,5 @@
//
// $Id: CollisionEvent.java,v 1.1 2001/09/13 19:36:20 mdb Exp $
// $Id: CollisionEvent.java,v 1.2 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.sprite;
@@ -12,9 +12,9 @@ public class CollisionEvent extends SpriteEvent
/**
* Constructs a collision event for the specified sprites.
*/
public CollisionEvent (Sprite sprite, Sprite other)
public CollisionEvent (Sprite sprite, long when, Sprite other)
{
super(sprite);
super(sprite, when);
_other = other;
}
@@ -1,5 +1,5 @@
//
// $Id: PathCompletedEvent.java,v 1.2 2002/05/31 03:38:03 mdb Exp $
// $Id: PathCompletedEvent.java,v 1.3 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.sprite;
@@ -15,9 +15,9 @@ public class PathCompletedEvent extends SpriteEvent
* Constructs a path completed event for the specified sprite and
* path.
*/
public PathCompletedEvent (Sprite sprite, Path path)
public PathCompletedEvent (Sprite sprite, long when, Path path)
{
super(sprite);
super(sprite, when);
_path = path;
}
@@ -1,5 +1,5 @@
//
// $Id: Sprite.java,v 1.54 2002/12/02 20:11:24 mdb Exp $
// $Id: Sprite.java,v 1.55 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.sprite;
@@ -252,14 +252,14 @@ public abstract class Sprite extends AbstractMedia
/**
* Called by the active path when it has completed.
*/
public void pathCompleted ()
public void pathCompleted (long timestamp)
{
// keep a reference to the path just completed
Path oldpath = _path;
// clear out the path we've now finished
_path = null;
// inform observers that we've finished our path
notifyObservers(new PathCompletedEvent(this, oldpath));
notifyObservers(new PathCompletedEvent(this, timestamp, oldpath));
}
// documentation inherited
@@ -1,5 +1,5 @@
//
// $Id: SpriteEvent.java,v 1.2 2001/09/13 19:36:20 mdb Exp $
// $Id: SpriteEvent.java,v 1.3 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.sprite;
@@ -13,10 +13,12 @@ public class SpriteEvent
* Create a sprite event.
*
* @param sprite the involved sprite.
* @param when the time at which this event took place.
*/
public SpriteEvent (Sprite sprite)
public SpriteEvent (Sprite sprite, long when)
{
_sprite = sprite;
_when = when;
}
/**
@@ -27,6 +29,17 @@ public class SpriteEvent
return _sprite;
}
/**
* Returns the time associated with this event.
*/
public long getWhen ()
{
return _when;
}
/** The sprite associated with this event. */
protected Sprite _sprite;
/** The time associated with this event. */
protected long _when;
}
@@ -1,5 +1,5 @@
//
// $Id: ArcPath.java,v 1.2 2002/11/27 23:48:24 mdb Exp $
// $Id: ArcPath.java,v 1.3 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.util;
@@ -131,7 +131,7 @@ public class ArcPath extends TimedPath
// if we completed our path, let the sprite know
if (angle == _sangle + _delta) {
pable.pathCompleted();
pable.pathCompleted(timestamp);
}
return modified;
@@ -1,5 +1,5 @@
//
// $Id: LinePath.java,v 1.10 2002/09/17 03:59:05 mdb Exp $
// $Id: LinePath.java,v 1.11 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.util;
@@ -45,7 +45,7 @@ public class LinePath extends TimedPath
// to the prearranged spot and get the hell out
if (timestamp >= _startStamp + _duration) {
pable.setLocation(_dest.x, _dest.y);
pable.pathCompleted();
pable.pathCompleted(timestamp);
return true;
}
@@ -1,5 +1,5 @@
//
// $Id: LineSegmentPath.java,v 1.25 2002/06/18 22:25:33 mdb Exp $
// $Id: LineSegmentPath.java,v 1.26 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.util;
@@ -172,7 +172,7 @@ public class LineSegmentPath
pable.setLocation(node.loc.x, node.loc.y);
}
// and let the pathable know that we're done
pable.pathCompleted();
pable.pathCompleted(timestamp);
return;
}
@@ -239,7 +239,7 @@ public class LineSegmentPath
if (!_niter.hasNext()) {
// move the pathable to the location of our last destination
pable.setLocation(_dest.loc.x, _dest.loc.y);
pable.pathCompleted();
pable.pathCompleted(now);
return true;
}
@@ -1,5 +1,5 @@
//
// $Id: Pathable.java,v 1.4 2002/07/02 23:15:53 shaper Exp $
// $Id: Pathable.java,v 1.5 2002/12/04 02:45:09 shaper Exp $
package com.threerings.media.util;
@@ -54,5 +54,5 @@ public interface Pathable
/**
* Called by a path when this pathable finishes moving along its path.
*/
public void pathCompleted ();
public void pathCompleted (long timestamp);
}