Add additional type of orientation to ArcPath - NONE - which keeps us from reorienting sprites following the path.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3780 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Mike Thomas
2005-12-08 21:59:12 +00:00
parent db5de88da2
commit 12c9f86735
@@ -45,6 +45,11 @@ public class ArcPath extends TimedPath
* follow this path. */ * follow this path. */
public static final int FINE = 1; public static final int FINE = 1;
/** An orientation indicating that the pathable should not be oriented
* as it moves along the path.
*/
public static final int NONE = 2;
/** /**
* Creates an arc path that will animate a pathable from the specified * Creates an arc path that will animate a pathable from the specified
* starting position along an ellipse defined by the supplied * starting position along an ellipse defined by the supplied
@@ -130,6 +135,8 @@ public class ArcPath extends TimedPath
// determine where we should be along the path // determine where we should be along the path
computePosition(_center, _xradius, _yradius, angle, _tpos); computePosition(_center, _xradius, _yradius, angle, _tpos);
// Skip this if we are not reorienting as we follow the path.
if (_orient != NONE) {
// compute the pathable's new orientation // compute the pathable's new orientation
double theta = angle + ((_delta > 0) ? Math.PI/2 : -Math.PI/2); double theta = angle + ((_delta > 0) ? Math.PI/2 : -Math.PI/2);
int orient; int orient;
@@ -148,17 +155,18 @@ public class ArcPath extends TimedPath
break; break;
} }
// update the pathable's location if it moved
if (pable.getX() != _tpos.x || pable.getY() != _tpos.y) {
pable.setLocation(_tpos.x, _tpos.y);
modified = true;
}
// update the pathable's orientation if it changed // update the pathable's orientation if it changed
if (pable.getOrientation() != orient) { if (pable.getOrientation() != orient) {
pable.setOrientation(orient); pable.setOrientation(orient);
modified = true; modified = true;
} }
}
// update the pathable's location if it moved
if (pable.getX() != _tpos.x || pable.getY() != _tpos.y) {
pable.setLocation(_tpos.x, _tpos.y);
modified = true;
}
// if we completed our path, let the sprite know // if we completed our path, let the sprite know
if (angle == _sangle + _delta) { if (angle == _sangle + _delta) {