Made MisoTileSet an interface.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@449 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,46 +1,9 @@
|
|||||||
//
|
//
|
||||||
// $Id: BaseTileSet.java,v 1.2 2001/10/11 00:41:27 shaper Exp $
|
// $Id: BaseTileSet.java,v 1.3 2001/10/12 00:43:04 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.miso.tile;
|
package com.threerings.miso.tile;
|
||||||
|
|
||||||
import com.threerings.media.tile.*;
|
public interface MisoTileSet
|
||||||
|
|
||||||
import com.threerings.miso.scene.MisoScene;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The miso tile set class extends the base tile set class to add
|
|
||||||
* support for tile passability. Passability is used to determine
|
|
||||||
* whether {@link com.threerings.miso.scene.Traverser} objects can
|
|
||||||
* traverse a particular tile in a {@link
|
|
||||||
* com.threerings.miso.scene.MisoScene}.
|
|
||||||
*/
|
|
||||||
public class MisoTileSet extends TileSetImpl
|
|
||||||
{
|
{
|
||||||
/** The miso scene layer the tiles are intended for. */
|
public int getLayerIndex ();
|
||||||
public int layer;
|
|
||||||
|
|
||||||
/** Whether each tile is passable. */
|
|
||||||
public int passable[];
|
|
||||||
|
|
||||||
public Tile createTile (int tid)
|
|
||||||
{
|
|
||||||
// only create miso tiles for the base layer
|
|
||||||
if (layer != MisoScene.LAYER_BASE) {
|
|
||||||
return super.createTile(tid);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new MisoTile(tsid, tid);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void populateTile (Tile tile)
|
|
||||||
{
|
|
||||||
super.populateTile(tile);
|
|
||||||
|
|
||||||
if (tile instanceof MisoTile) {
|
|
||||||
// set the tile's passability, defaulting to passable if this
|
|
||||||
// tileset has no passability specified
|
|
||||||
((MisoTile)tile).passable =
|
|
||||||
(passable == null || (passable[tile.tid] == 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
//
|
||||||
|
// $Id: MisoTileSetImpl.java,v 1.1 2001/10/12 00:43:04 shaper Exp $
|
||||||
|
|
||||||
|
package com.threerings.miso.tile;
|
||||||
|
|
||||||
|
import com.threerings.media.tile.*;
|
||||||
|
|
||||||
|
import com.threerings.miso.scene.MisoScene;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The miso tile set class extends the base tile set class to add
|
||||||
|
* support for tile passability. Passability is used to determine
|
||||||
|
* whether {@link com.threerings.miso.scene.Traverser} objects can
|
||||||
|
* traverse a particular tile in a {@link
|
||||||
|
* com.threerings.miso.scene.MisoScene}.
|
||||||
|
*/
|
||||||
|
public class MisoTileSetImpl
|
||||||
|
extends TileSetImpl
|
||||||
|
implements MisoTileSet
|
||||||
|
{
|
||||||
|
/** The miso scene layer the tiles are intended for. */
|
||||||
|
public int layer;
|
||||||
|
|
||||||
|
/** Whether each tile is passable. */
|
||||||
|
public int passable[];
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public Tile createTile (int tid)
|
||||||
|
{
|
||||||
|
// only create miso tiles for the base layer
|
||||||
|
if (layer != MisoScene.LAYER_BASE) {
|
||||||
|
return super.createTile(tid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new MisoTile(tsid, tid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
protected void populateTile (Tile tile)
|
||||||
|
{
|
||||||
|
super.populateTile(tile);
|
||||||
|
|
||||||
|
if (tile instanceof MisoTile) {
|
||||||
|
// set the tile's passability, defaulting to passable if this
|
||||||
|
// tileset has no passability specified
|
||||||
|
((MisoTile)tile).passable =
|
||||||
|
(passable == null || (passable[tile.tid] == 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public int getLayerIndex ()
|
||||||
|
{
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: XMLMisoTileSetParser.java,v 1.2 2001/10/11 00:41:27 shaper Exp $
|
// $Id: XMLMisoTileSetParser.java,v 1.3 2001/10/12 00:43:04 shaper Exp $
|
||||||
|
|
||||||
package com.threerings.miso.tile;
|
package com.threerings.miso.tile;
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ public class XMLMisoTileSetParser extends XMLTileSetParser
|
|||||||
|
|
||||||
if (qName.equals("tileset")) {
|
if (qName.equals("tileset")) {
|
||||||
String val = attributes.getValue("layer");
|
String val = attributes.getValue("layer");
|
||||||
((MisoTileSet)_tset).layer = MisoSceneUtil.getLayerIndex(val);
|
((MisoTileSetImpl)_tset).layer = MisoSceneUtil.getLayerIndex(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,13 +34,13 @@ public class XMLMisoTileSetParser extends XMLTileSetParser
|
|||||||
super.finishElement(qName, str);
|
super.finishElement(qName, str);
|
||||||
|
|
||||||
if (qName.equals("passable")) {
|
if (qName.equals("passable")) {
|
||||||
((MisoTileSet)_tset).passable = StringUtil.parseIntArray(str);
|
((MisoTileSetImpl)_tset).passable = StringUtil.parseIntArray(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
protected TileSetImpl createTileSet ()
|
protected TileSetImpl createTileSet ()
|
||||||
{
|
{
|
||||||
return new MisoTileSet();
|
return new MisoTileSetImpl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user