Implemented tile deletion from the scene.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@205 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-08-09 05:44:07 +00:00
parent d9b1d29a10
commit 6e7c8e29c5
2 changed files with 28 additions and 7 deletions
@@ -1,5 +1,5 @@
// //
// $Id: DisplayMisoSceneImpl.java,v 1.17 2001/08/04 01:41:02 shaper Exp $ // $Id: DisplayMisoSceneImpl.java,v 1.18 2001/08/09 05:44:07 shaper Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -60,18 +60,19 @@ public class Scene
public Scene (TileManager tilemgr, int deftsid, int deftid) public Scene (TileManager tilemgr, int deftsid, int deftid)
{ {
_tilemgr = tilemgr; _tilemgr = tilemgr;
_sid = SID_INVALID;
_sid = SID_INVALID;
_name = DEF_SCENE_NAME; _name = DEF_SCENE_NAME;
_hotspots = new Point[0]; _hotspots = new Point[0];
_exits = new ExitPoint[0]; _exits = new ExitPoint[0];
tiles = new Tile[TILE_WIDTH][TILE_HEIGHT][NUM_LAYERS]; tiles = new Tile[TILE_WIDTH][TILE_HEIGHT][NUM_LAYERS];
Tile tile = _tilemgr.getTile(deftsid, deftid); _deftile = _tilemgr.getTile(deftsid, deftid);
for (int xx = 0; xx < TILE_WIDTH; xx++) { for (int xx = 0; xx < TILE_WIDTH; xx++) {
for (int yy = 0; yy < TILE_HEIGHT; yy++) { for (int yy = 0; yy < TILE_HEIGHT; yy++) {
for (int ii = 0; ii < NUM_LAYERS; ii++) { for (int ii = 0; ii < NUM_LAYERS; ii++) {
if (ii == LAYER_BASE) { if (ii == LAYER_BASE) {
tiles[xx][yy][ii] = tile; tiles[xx][yy][ii] = _deftile;
} }
} }
} }
@@ -151,6 +152,14 @@ public class Scene
return numTiles; return numTiles;
} }
/**
* Return the default tile for the base layer of the scene.
*/
public Tile getDefaultTile ()
{
return _deftile;
}
/** /**
* Return a string representation of this Scene object. * Return a string representation of this Scene object.
*/ */
@@ -173,12 +182,15 @@ public class Scene
/** The unique scene id. */ /** The unique scene id. */
protected short _sid; protected short _sid;
/** Hot-spot zone points. */ /** The hot-spot zone points. */
protected Point _hotspots[]; protected Point _hotspots[];
/** Exit points to different scenes. */ /** The exit points to different scenes. */
protected ExitPoint _exits[]; protected ExitPoint _exits[];
/** The default tile for the base layer in the scene. */
protected Tile _deftile;
/** The tile manager. */ /** The tile manager. */
protected TileManager _tilemgr; protected TileManager _tilemgr;
} }
@@ -1,5 +1,5 @@
// //
// $Id: IsoSceneView.java,v 1.31 2001/08/08 22:29:39 shaper Exp $ // $Id: IsoSceneView.java,v 1.32 2001/08/09 05:44:07 shaper Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -483,6 +483,15 @@ public class IsoSceneView implements EditableSceneView
_scene.tiles[tpos.x][tpos.y][lnum] = tile; _scene.tiles[tpos.x][tpos.y][lnum] = tile;
} }
public void deleteTile (int x, int y, int lnum)
{
Point tpos = new Point();
IsoUtil.screenToTile(_model, x, y, tpos);
Tile tile = (lnum == 0) ? _scene.getDefaultTile() : null;
_scene.tiles[tpos.x][tpos.y][lnum] = tile;
}
public void setModel (IsoSceneModel model) public void setModel (IsoSceneModel model)
{ {
_model = model; _model = model;