Modified so that it will work if re-inited with a new Pathable.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2144 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2003-01-14 22:37:38 +00:00
parent a2867539bc
commit 4ba1fe57c3
@@ -1,5 +1,5 @@
// //
// $Id: BobblePath.java,v 1.1 2003/01/14 04:40:45 ray Exp $ // $Id: BobblePath.java,v 1.2 2003/01/14 22:37:38 ray Exp $
package com.threerings.media.util; package com.threerings.media.util;
@@ -40,8 +40,7 @@ public class BobblePath implements Path
public BobblePath (int dx, int dy, long duration, long updateFreq) public BobblePath (int dx, int dy, long duration, long updateFreq)
{ {
_updateFreq = updateFreq; _updateFreq = updateFreq;
// we store the duration in stoptime for now _duration = duration;
_stopTime = duration;
setVariance(dx, dy); setVariance(dx, dy);
} }
@@ -83,10 +82,10 @@ public class BobblePath implements Path
_sx = pable.getX(); _sx = pable.getX();
_sy = pable.getY(); _sy = pable.getY();
// change the duration to a real stop time // change the duration to a real stop time
if (_stopTime == -1L) { if (_duration == -1L) {
_stopTime = Long.MAX_VALUE; _stopTime = Long.MAX_VALUE;
} else { } else {
_stopTime += tickstamp; _stopTime = tickstamp + _duration;
} }
_nextMove = tickstamp; _nextMove = tickstamp;
} }
@@ -152,6 +151,9 @@ public class BobblePath implements Path
/** The variance we will bobble around that initial position. */ /** The variance we will bobble around that initial position. */
protected int _dx, _dy; protected int _dx, _dy;
/** How long we'll bobble. */
protected long _duration;
/** How often we update the locations. */ /** How often we update the locations. */
protected long _updateFreq; protected long _updateFreq;