Initial work on support for objects whose images span multiple tiles.

Made TileSet an interface.  Throw exceptions for unknown tile or tile
set requests.  General clean-up and documentation.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@427 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-10-11 00:41:27 +00:00
parent 5c79f8f082
commit ad7b64d4a1
30 changed files with 811 additions and 521 deletions
@@ -1,5 +1,5 @@
//
// $Id: AStarPathUtil.java,v 1.5 2001/10/08 21:04:25 shaper Exp $
// $Id: AStarPathUtil.java,v 1.6 2001/10/11 00:41:27 shaper Exp $
package com.threerings.miso.scene.util;
@@ -43,7 +43,7 @@ public class AStarPathUtil
* @return the list of points in the path.
*/
public static List getPath (
MisoTile tiles[][][], int tilewid, int tilehei, Traverser trav,
MisoTile tiles[][], int tilewid, int tilehei, Traverser trav,
int ax, int ay, int bx, int by)
{
AStarInfo info = new AStarInfo(tiles, tilewid, tilehei, trav, bx, by);
@@ -109,8 +109,7 @@ public class AStarPathUtil
}
// skip node if it's impassable
// TODO: fix hard-coded consideration of only the base layer
if (!info.trav.canTraverse(info.tiles[x][y][0])) {
if (!info.trav.canTraverse(info.tiles[x][y])) {
return;
}
@@ -198,7 +197,7 @@ public class AStarPathUtil
class AStarInfo
{
/** The array of tiles being traversed. */
public MisoTile tiles[][][];
public MisoTile tiles[][];
/** The tile array dimensions. */
public int tilewid, tilehei;
@@ -219,7 +218,7 @@ class AStarInfo
public int destx, desty;
public AStarInfo (
MisoTile tiles[][][], int tilewid, int tilehei, Traverser trav,
MisoTile tiles[][], int tilewid, int tilehei, Traverser trav,
int destx, int desty)
{
// save off references
@@ -1,5 +1,5 @@
//
// $Id: MisoSceneUtil.java,v 1.2 2001/09/28 01:31:32 mdb Exp $
// $Id: MisoSceneUtil.java,v 1.3 2001/10/11 00:41:27 shaper Exp $
package com.threerings.miso.scene.util;
@@ -15,6 +15,31 @@ public class MisoSceneUtil
/** String translations of each tile layer name. */
public static final String[] XLATE_LAYERS = { "Base", "Fringe", "Object" };
/**
* Returns the layer index number for the named layer. Layer
* names are looked up via <code>XLATE_LAYERS</code> and are
* case-insensitive.
*
* @param name the layer name.
*/
public static int getLayerIndex (String name)
{
if (name == null) {
return DEF_LAYER;
}
name = name.toLowerCase();
for (int ii = 0; ii < MisoScene.NUM_LAYERS; ii++) {
String b = MisoSceneUtil.XLATE_LAYERS[ii].toLowerCase();
if (name.equals(b)) {
return ii;
}
}
return DEF_LAYER;
}
/**
* Return the location object at the given full coordinates, or null
* if no location is currently present at that location.
@@ -74,4 +99,7 @@ public class MisoSceneUtil
{
return ClusterUtil.getClusterIndex(scene.getClusters(), loc);
}
/** The default layer index for an unknown named layer. */
protected static final int DEF_LAYER = MisoScene.LAYER_BASE;
}