Use BaseTile objects to contain fringe tile info, mark them as impassible
if they are fringed on by any SPECIFIED tileId (ie, not the default tileId) that is impassible. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2852 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: MisoScenePanel.java,v 1.51 2003/10/15 23:20:40 mdb Exp $
|
||||
// $Id: MisoScenePanel.java,v 1.52 2003/11/12 23:05:40 ray Exp $
|
||||
|
||||
package com.threerings.miso.client;
|
||||
|
||||
@@ -1403,14 +1403,14 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
}
|
||||
|
||||
/** Returns the fringe tile for the specified tile coordinate. */
|
||||
protected Tile getFringeTile (int tx, int ty)
|
||||
protected BaseTile getFringeTile (int tx, int ty)
|
||||
{
|
||||
SceneBlock block = getBlock(tx, ty);
|
||||
return (block == null) ? null : block.getFringeTile(tx, ty);
|
||||
}
|
||||
|
||||
/** Computes the fringe tile for the specified coordinate. */
|
||||
protected Tile computeFringeTile (int tx, int ty)
|
||||
protected BaseTile computeFringeTile (int tx, int ty)
|
||||
{
|
||||
return _ctx.getTileManager().getAutoFringer().getFringeTile(
|
||||
_model, tx, ty, _masks);
|
||||
@@ -1462,11 +1462,6 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
tile.paint(_gfx, tbounds.x, tbounds.y);
|
||||
passable = ((BaseTile)tile).isPassable();
|
||||
|
||||
// highlight impassable tiles
|
||||
if (_traverseDebug.getValue() && !passable) {
|
||||
fillTile(_gfx, tx, ty, Color.yellow);
|
||||
}
|
||||
|
||||
} else {
|
||||
// draw black where there are no tiles
|
||||
Polygon poly = MisoUtil.getTilePolygon(_metrics, tx, ty);
|
||||
@@ -1476,12 +1471,19 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
|
||||
if ((tile = getFringeTile(tx, ty)) != null) {
|
||||
tile.paint(_gfx, tbounds.x, tbounds.y);
|
||||
passable = passable && ((BaseTile)tile).isPassable();
|
||||
}
|
||||
|
||||
// highlight passable non-traversable tiles
|
||||
if (_traverseDebug.getValue() && passable &&
|
||||
!canTraverse(null, tx, ty)) {
|
||||
fillTile(_gfx, tx, ty, Color.green);
|
||||
// highlight impassable tiles
|
||||
if (_traverseDebug.getValue()) {
|
||||
if (!passable) {
|
||||
// highlight tiles blocked by base or fringe in yellow
|
||||
fillTile(_gfx, tx, ty, Color.yellow);
|
||||
|
||||
} else if (!canTraverse(null, tx, ty)) {
|
||||
// highlight passable non-traversable tiles in green
|
||||
fillTile(_gfx, tx, ty, Color.green);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneBlock.java,v 1.21 2003/10/29 01:42:37 mdb Exp $
|
||||
// $Id: SceneBlock.java,v 1.22 2003/11/12 23:05:40 ray Exp $
|
||||
|
||||
package com.threerings.miso.client;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SceneBlock
|
||||
_panel = panel;
|
||||
_bounds = new Rectangle(tx, ty, width, height);
|
||||
_base = new BaseTile[width*height];
|
||||
_fringe = new Tile[width*height];
|
||||
_fringe = new BaseTile[width*height];
|
||||
_covered = new boolean[width*height];
|
||||
|
||||
// compute our screen-coordinate footprint polygon
|
||||
@@ -252,7 +252,7 @@ public class SceneBlock
|
||||
* Returns the fringe tile at the specified coordinates or null if
|
||||
* there's no tile at said coordinates.
|
||||
*/
|
||||
public Tile getFringeTile (int tx, int ty)
|
||||
public BaseTile getFringeTile (int tx, int ty)
|
||||
{
|
||||
return _fringe[index(tx, ty)];
|
||||
}
|
||||
@@ -367,8 +367,20 @@ public class SceneBlock
|
||||
*/
|
||||
public boolean canTraverse (Object traverser, int tx, int ty)
|
||||
{
|
||||
if (_covered[index(tx, ty)]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BaseTile base = getBaseTile(tx, ty);
|
||||
return !_covered[index(tx, ty)] && (base != null && base.isPassable());
|
||||
if ((base == null) || !base.isPassable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
BaseTile fringe = getFringeTile(tx, ty);
|
||||
if (fringe != null) {
|
||||
return fringe.isPassable();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -551,7 +563,7 @@ public class SceneBlock
|
||||
protected BaseTile[] _base;
|
||||
|
||||
/** Our fringe tiles. */
|
||||
protected Tile[] _fringe;
|
||||
protected BaseTile[] _fringe;
|
||||
|
||||
/** Indicates whether our tiles are covered by an object. */
|
||||
protected boolean[] _covered;
|
||||
|
||||
Reference in New Issue
Block a user