From c467da448a5894387b7be98abab6b4a4b3446344 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Sat, 22 Jun 2002 01:00:32 +0000 Subject: [PATCH] The tragic end of ScreenTilePath git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1534 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/miso/client/IsoSceneView.java | 14 +--- .../miso/client/ScreenTilePath.java | 82 ------------------- 2 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 src/java/com/threerings/miso/client/ScreenTilePath.java diff --git a/src/java/com/threerings/miso/client/IsoSceneView.java b/src/java/com/threerings/miso/client/IsoSceneView.java index adcabc757..2d5fddaee 100644 --- a/src/java/com/threerings/miso/client/IsoSceneView.java +++ b/src/java/com/threerings/miso/client/IsoSceneView.java @@ -1,5 +1,5 @@ // -// $Id: IsoSceneView.java,v 1.113 2002/06/22 00:45:18 ray Exp $ +// $Id: IsoSceneView.java,v 1.114 2002/06/22 01:00:32 ray Exp $ package com.threerings.miso.scene; @@ -456,18 +456,6 @@ public class IsoSceneView implements SceneView } } - /** - * Get a path between the two points (in screen coordinates) - * that will update a MisoCharacterSprite as it walks the path. - */ - public Path getScreenTilePath (Point start, Point dest, int direction) - { - ScreenTilePath path = new ScreenTilePath(_model); - path.addNode(start.x, start.y, 0); // first direction matters not - path.addNode(dest.x, dest.y, direction); - return path; - } - // documentation inherited public Path getPath (MisoCharacterSprite sprite, int x, int y) { diff --git a/src/java/com/threerings/miso/client/ScreenTilePath.java b/src/java/com/threerings/miso/client/ScreenTilePath.java deleted file mode 100644 index 85132f0c4..000000000 --- a/src/java/com/threerings/miso/client/ScreenTilePath.java +++ /dev/null @@ -1,82 +0,0 @@ -// -// $Id: ScreenTilePath.java,v 1.1 2002/06/18 21:22:34 ray Exp $ - -package com.threerings.miso.scene; - -import java.awt.Point; -import java.util.List; - -import com.threerings.media.util.LineSegmentPath; -import com.threerings.media.util.Pathable; - -import com.threerings.miso.Log; -import com.threerings.miso.scene.util.IsoUtil; - -/** - * A line segment path that attempts to update the sprite's tile coordinates - * as it walks it along. - */ -public class ScreenTilePath extends LineSegmentPath -{ - /** - * Constructs a screen tile path. - * - * @param model the iso scene view model the path is associated with. - */ - public ScreenTilePath (IsoSceneViewModel model) - { - _model = model; - } - - // documentation inherited - public boolean tick (Pathable pable, long timestamp) - { - boolean moved = super.tick(pable, timestamp); - - if (moved) { - MisoCharacterSprite mcs = (MisoCharacterSprite)pable; - int sx = mcs.getX(), sy = mcs.getY(); - Point pos = new Point(); - - // check whether we've arrived at the destination tile - if (shouldComputeTileCoords()) { - // get the sprite's latest tile coordinates - IsoUtil.screenToTile(_model, sx, sy, pos); - - setTileCoords(mcs, pos); - } - - // get the sprite's latest fine coordinates - IsoUtil.tileToScreen(_model, mcs.getTileX(), mcs.getTileY(), pos); - Point fpos = new Point(); - IsoUtil.pixelToFine(_model, sx - pos.x, sy - pos.y, fpos); - - // inform the sprite - mcs.setFineLocation(fpos.x, fpos.y); - - // Log.info("Sprite moved [s=" + mcs + "]."); - } - - return moved; - } - - /** - * Should we compute and attempt to set the tile coordinates during - * this tick? - */ - protected boolean shouldComputeTileCoords () - { - return true; - } - - /** - * Set the tile coordinates. - */ - protected void setTileCoords (MisoCharacterSprite mcs, Point pos) - { - mcs.setTileLocation(pos.x, pos.y); - } - - /** The iso scene view model. */ - protected IsoSceneViewModel _model; -}