A few bits I'd marked as part of the pathing overhaul that I can just get now.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@946 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
package com.threerings.stage.client {
|
package com.threerings.stage.client {
|
||||||
|
|
||||||
import flash.geom.Point;
|
import flash.geom.Point;
|
||||||
|
import flash.geom.Rectangle;
|
||||||
|
|
||||||
import flash.events.MouseEvent;
|
import flash.events.MouseEvent;
|
||||||
|
|
||||||
@@ -71,6 +72,8 @@ public class CrowdStageScenePanel extends StageScenePanel
|
|||||||
_proxrad = int(Math.max(_proxrad, Math.sqrt(_isoView.size.x*_isoView.size.x +
|
_proxrad = int(Math.max(_proxrad, Math.sqrt(_isoView.size.x*_isoView.size.x +
|
||||||
_isoView.size.y*_isoView.size.y)));
|
_isoView.size.y*_isoView.size.y)));
|
||||||
recomputeProximate();
|
recomputeProximate();
|
||||||
|
|
||||||
|
_vbounds = new Rectangle(0, 0, _isoView.size.x, _isoView.size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
override public function willEnterPlace (plObj :PlaceObject) :void
|
override public function willEnterPlace (plObj :PlaceObject) :void
|
||||||
@@ -285,7 +288,7 @@ public class CrowdStageScenePanel extends StageScenePanel
|
|||||||
if (!isProximateToLoc(nloc)) {
|
if (!isProximateToLoc(nloc)) {
|
||||||
if (sprite != null) {
|
if (sprite != null) {
|
||||||
// if they are visible, walk them to their new location
|
// if they are visible, walk them to their new location
|
||||||
if (true/*TODO Path _vbounds.intersects(sprite.getBounds())*/) {
|
if (_vbounds.intersects(sprite.screenBounds)) {
|
||||||
moveSpriteToLoc(sprite, nloc.loc);
|
moveSpriteToLoc(sprite, nloc.loc);
|
||||||
}
|
}
|
||||||
// now queue them up for removal on arrival as appropriate
|
// now queue them up for removal on arrival as appropriate
|
||||||
@@ -357,6 +360,8 @@ public class CrowdStageScenePanel extends StageScenePanel
|
|||||||
{
|
{
|
||||||
var cx :int = sprite.x;
|
var cx :int = sprite.x;
|
||||||
var cy :int = sprite.y;
|
var cy :int = sprite.y;
|
||||||
|
var nx :int = MisoUtil.fullToTile(loc.x);
|
||||||
|
var ny :int = MisoUtil.fullToTile(loc.y);
|
||||||
|
|
||||||
// if this panel is not yet showing, warp the sprite directly
|
// if this panel is not yet showing, warp the sprite directly
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
@@ -367,8 +372,8 @@ public class CrowdStageScenePanel extends StageScenePanel
|
|||||||
|
|
||||||
// if the source and destination are both offscreen, warp the
|
// if the source and destination are both offscreen, warp the
|
||||||
// sprite to where they are going
|
// sprite to where they are going
|
||||||
// TODO Path boolean endsOff = !_vbounds.contains(nx, ny);
|
var endsOff :Boolean = !_vbounds.contains(nx, ny);
|
||||||
if (false /*TODO Path!_vbounds.intersects(sprite.getBounds()) && endsOff*/) {
|
if (!_vbounds.intersects(sprite.screenBounds) && endsOff) {
|
||||||
sprite.cancelMove();
|
sprite.cancelMove();
|
||||||
sprite.placeAtLoc(loc);
|
sprite.placeAtLoc(loc);
|
||||||
return true;
|
return true;
|
||||||
@@ -376,12 +381,12 @@ public class CrowdStageScenePanel extends StageScenePanel
|
|||||||
|
|
||||||
// if we are obviously warping (i.e. we moved a great distance),
|
// if we are obviously warping (i.e. we moved a great distance),
|
||||||
// just blink into position and attempt to do so cleanly
|
// just blink into position and attempt to do so cleanly
|
||||||
//TODO Path int dx = Math.abs(nx - (_vbounds.x + _vbounds.width/2));
|
var dx :int = Math.abs(nx - (_vbounds.x + _vbounds.width/2));
|
||||||
//TODO Path int dy = Math.abs(ny - (_vbounds.y + _vbounds.height/2));
|
var dy :int = Math.abs(ny - (_vbounds.y + _vbounds.height/2));
|
||||||
if (sprite == _selfSprite/*TODO Path (dx > 2*_vbounds.width || dy > 2*_vbounds.height) &&
|
if ((dx > 2*_vbounds.width || dy > 2*_vbounds.height) &&
|
||||||
(sprite == _selfSprite)*/) {
|
(sprite == _selfSprite)) {
|
||||||
//TODO Path log.info("Warp-a-saurus! " + StringUtil.toString(_vbounds) +
|
log.info("Warp-a-saurus! " + StringUtil.toString(_vbounds) +
|
||||||
//TODO Path " -> " + StringUtil.toCoordsString(loc.x, loc.y));
|
" -> " + StringUtil.toCoordsString(loc.x, loc.y));
|
||||||
sprite.cancelMove();
|
sprite.cancelMove();
|
||||||
sprite.placeAtLoc(loc);
|
sprite.placeAtLoc(loc);
|
||||||
|
|
||||||
@@ -695,6 +700,8 @@ public class CrowdStageScenePanel extends StageScenePanel
|
|||||||
|
|
||||||
protected var _scObj :StageSceneObject;
|
protected var _scObj :StageSceneObject;
|
||||||
|
|
||||||
|
protected var _vbounds :Rectangle;
|
||||||
|
|
||||||
/** Our sprite path velocity. */
|
/** Our sprite path velocity. */
|
||||||
// if we had more frames, maybe we could only update their
|
// if we had more frames, maybe we could only update their
|
||||||
// location when their frame changed. Alas, we do not.
|
// location when their frame changed. Alas, we do not.
|
||||||
|
|||||||
Reference in New Issue
Block a user