More progress toward arbitrarily scrollable scenes. The IsoSceneView still
requests all objects in God's green earth, but we now have the necessary structures for it to request new objects as they scroll (nearly) into view and for it to abandon objects as they scroll (way) out of view. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1742 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
//
|
//
|
||||||
// $Id: DisplayMisoScene.java,v 1.6 2002/09/18 02:32:57 mdb Exp $
|
// $Id: DisplayMisoScene.java,v 1.7 2002/09/23 21:54:50 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene;
|
package com.threerings.miso.scene;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Rectangle;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import com.threerings.media.tile.ObjectTile;
|
import com.threerings.media.tile.ObjectTile;
|
||||||
import com.threerings.media.tile.Tile;
|
import com.threerings.media.tile.Tile;
|
||||||
|
|
||||||
|
import com.threerings.miso.scene.util.ObjectSet;
|
||||||
import com.threerings.miso.tile.BaseTile;
|
import com.threerings.miso.tile.BaseTile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,29 +30,8 @@ public interface DisplayMisoScene
|
|||||||
public Tile getFringeTile (int x, int y);
|
public Tile getFringeTile (int x, int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of object tiles in the scene.
|
* Populates the supplied scene object set with all objects whose
|
||||||
|
* origin falls in the requested region.
|
||||||
*/
|
*/
|
||||||
public int getObjectCount ();
|
public void getSceneObjects (Rectangle region, ObjectSet set);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the object tile with the specified index.
|
|
||||||
*/
|
|
||||||
public ObjectTile getObjectTile (int index);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the tile coordinates for the specified object tile.
|
|
||||||
*
|
|
||||||
* @param index the index of the object tile for which coordinates are
|
|
||||||
* desired.
|
|
||||||
*/
|
|
||||||
public Point getObjectCoords (int index);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the action associated with the specified object tile. Null
|
|
||||||
* is returned if the object tile does not have an associated action.
|
|
||||||
*
|
|
||||||
* @param index the index of the object for which the action is
|
|
||||||
* desired.
|
|
||||||
*/
|
|
||||||
public String getObjectAction (int index);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
//
|
//
|
||||||
// $Id: DisplayMisoSceneImpl.java,v 1.60 2002/09/18 02:32:57 mdb Exp $
|
// $Id: DisplayMisoSceneImpl.java,v 1.61 2002/09/23 21:54:50 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene;
|
package com.threerings.miso.scene;
|
||||||
|
|
||||||
import java.awt.Point;
|
import java.awt.Rectangle;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -19,6 +18,7 @@ import com.threerings.media.tile.TileException;
|
|||||||
import com.threerings.media.tile.TileLayer;
|
import com.threerings.media.tile.TileLayer;
|
||||||
|
|
||||||
import com.threerings.miso.Log;
|
import com.threerings.miso.Log;
|
||||||
|
import com.threerings.miso.scene.util.ObjectSet;
|
||||||
import com.threerings.miso.tile.AutoFringer;
|
import com.threerings.miso.tile.AutoFringer;
|
||||||
import com.threerings.miso.tile.BaseTile;
|
import com.threerings.miso.tile.BaseTile;
|
||||||
import com.threerings.miso.tile.BaseTileLayer;
|
import com.threerings.miso.tile.BaseTileLayer;
|
||||||
@@ -157,32 +157,34 @@ public class DisplayMisoSceneImpl
|
|||||||
* Called to expand each object read from the model into an actual
|
* Called to expand each object read from the model into an actual
|
||||||
* object tile instance with the appropriate additional data.
|
* object tile instance with the appropriate additional data.
|
||||||
*
|
*
|
||||||
* @return the object info record for the newly created object tile
|
* @return the scene object record for the newly created object tile
|
||||||
* (which will have been put into all the appropriate lists and
|
* (which will have been put into all the appropriate lists and
|
||||||
* tables).
|
* tables).
|
||||||
*/
|
*/
|
||||||
protected ObjectInfo expandObject (
|
protected SceneObject expandObject (
|
||||||
int col, int row, int tsid, int tid, int fqTid, String action)
|
int col, int row, int tsid, int tid, int fqTid, String action)
|
||||||
throws NoSuchTileException, NoSuchTileSetException
|
throws NoSuchTileException, NoSuchTileSetException
|
||||||
{
|
{
|
||||||
// create and initialize an object info record for this object
|
// create and initialize an object info record for this object
|
||||||
ObjectInfo oinfo = createObjectInfo();
|
SceneObject scobj = createSceneObject(
|
||||||
oinfo.object = (ObjectTile)_tmgr.getTile(tsid, tid);
|
col, row, (ObjectTile)_tmgr.getTile(tsid, tid));
|
||||||
oinfo.coords = new Point(col, row);
|
|
||||||
if (!StringUtil.blank(action)) {
|
if (!StringUtil.blank(action)) {
|
||||||
oinfo.action = action;
|
scobj.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a "shadow" for this object tile by toggling the
|
// generate a "shadow" for this object tile by toggling the
|
||||||
// "covered" flag on in all base tiles below it (to prevent
|
// "covered" flag on in all base tiles below it (to prevent
|
||||||
// sprites from walking on those tiles)
|
// sprites from walking on those tiles)
|
||||||
setObjectTileFootprint(oinfo.object, col, row, true);
|
setObjectTileFootprint(scobj.tile, col, row, true);
|
||||||
|
|
||||||
|
// assign the object its index
|
||||||
|
scobj.index = _objects.size();
|
||||||
|
|
||||||
// add the info record to the list
|
// add the info record to the list
|
||||||
_objects.add(oinfo);
|
_objects.add(scobj);
|
||||||
|
|
||||||
// return the object info so that derived classes may access it
|
// return the object info so that derived classes may access it
|
||||||
return oinfo;
|
return scobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
@@ -198,27 +200,19 @@ public class DisplayMisoSceneImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public int getObjectCount ()
|
public void getSceneObjects (Rectangle region, ObjectSet set)
|
||||||
{
|
{
|
||||||
return _objects.size();
|
// iterate over all of our objects, creating and including scene
|
||||||
}
|
// objects for those that intersect the region
|
||||||
|
int ocount = _objects.size();
|
||||||
// documentation inherited from interface
|
for (int ii = 0; ii < ocount; ii++) {
|
||||||
public ObjectTile getObjectTile (int index)
|
SceneObject scobj = (SceneObject)_objects.get(ii);
|
||||||
{
|
if (region.contains(scobj.x, scobj.y)) {
|
||||||
return ((ObjectInfo)_objects.get(index)).object;
|
set.insert(scobj);
|
||||||
}
|
} else {
|
||||||
|
System.err.println("Skipping " + scobj + ", not in " + region + ".");
|
||||||
// documentation inherited from interface
|
}
|
||||||
public Point getObjectCoords (int index)
|
}
|
||||||
{
|
|
||||||
return ((ObjectInfo)_objects.get(index)).coords;
|
|
||||||
}
|
|
||||||
|
|
||||||
// documentation inherited from interface
|
|
||||||
public String getObjectAction (int index)
|
|
||||||
{
|
|
||||||
return ((ObjectInfo)_objects.get(index)).action;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,27 +227,26 @@ public class DisplayMisoSceneImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an object info. This allows derived classes to extend the
|
* Creates a scene object record. This allows derived classes to
|
||||||
* object info record.
|
* provide extended records.
|
||||||
*/
|
*/
|
||||||
protected ObjectInfo createObjectInfo ()
|
protected SceneObject createSceneObject (int x, int y, ObjectTile tile)
|
||||||
{
|
{
|
||||||
return new ObjectInfo();
|
return new SceneObject(x, y, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locates the object info record for the object tile at the specified
|
* Locates the scene object record for the object tile at the
|
||||||
* location. Two of the same kind of object tile cannot exist at the
|
* specified location. Two of the same kind of object tile cannot
|
||||||
* same location.
|
* exist at the same location.
|
||||||
*/
|
*/
|
||||||
protected ObjectInfo getObjectInfo (ObjectTile tile, int x, int y)
|
protected SceneObject getSceneObject (ObjectTile tile, int x, int y)
|
||||||
{
|
{
|
||||||
int ocount = _objects.size();
|
int ocount = _objects.size();
|
||||||
for (int ii = 0; ii < ocount; ii++) {
|
for (int ii = 0; ii < ocount; ii++) {
|
||||||
ObjectInfo info = (ObjectInfo)_objects.get(ii);
|
SceneObject scobj = (SceneObject)_objects.get(ii);
|
||||||
if (info.object == tile &&
|
if (scobj.tile == tile && scobj.x == x && scobj.y == y) {
|
||||||
info.coords.x == x && info.coords.y == y) {
|
return scobj;
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -308,7 +301,7 @@ public class DisplayMisoSceneImpl
|
|||||||
/** The fringe layer of tiles. */
|
/** The fringe layer of tiles. */
|
||||||
protected TileLayer _fringe;
|
protected TileLayer _fringe;
|
||||||
|
|
||||||
/** The object info records. */
|
/** The scene object records. */
|
||||||
protected ArrayList _objects = new ArrayList();
|
protected ArrayList _objects = new ArrayList();
|
||||||
|
|
||||||
/** The autofringer. */
|
/** The autofringer. */
|
||||||
@@ -316,13 +309,4 @@ public class DisplayMisoSceneImpl
|
|||||||
|
|
||||||
/** A random number generator for filling random base tiles and fringes. */
|
/** A random number generator for filling random base tiles and fringes. */
|
||||||
protected Random _rando = new Random();
|
protected Random _rando = new Random();
|
||||||
|
|
||||||
/** Used to report information on objects in this scene. */
|
|
||||||
protected static class ObjectInfo
|
|
||||||
{
|
|
||||||
public ObjectInfo () {}
|
|
||||||
public ObjectTile object;
|
|
||||||
public Point coords;
|
|
||||||
public String action;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: DisplayObjectInfo.java,v 1.1 2002/09/18 02:32:57 mdb Exp $
|
// $Id: DisplayObjectInfo.java,v 1.2 2002/09/23 21:54:50 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene;
|
package com.threerings.miso.scene;
|
||||||
|
|
||||||
@@ -44,7 +44,8 @@ public class SceneObject
|
|||||||
public boolean equals (Object other)
|
public boolean equals (Object other)
|
||||||
{
|
{
|
||||||
if (other instanceof SceneObject) {
|
if (other instanceof SceneObject) {
|
||||||
return (index == ((SceneObject)other).index);
|
SceneObject oso = (SceneObject)other;
|
||||||
|
return (x == oso.x && y == oso.y && tile == oso.tile);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -53,7 +54,7 @@ public class SceneObject
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public int hashCode ()
|
public int hashCode ()
|
||||||
{
|
{
|
||||||
return x ^ y ^ index ^ tile.hashCode();
|
return x ^ y ^ tile.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: IsoSceneView.java,v 1.119 2002/09/18 02:32:57 mdb Exp $
|
// $Id: IsoSceneView.java,v 1.120 2002/09/23 21:54:50 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene;
|
package com.threerings.miso.scene;
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ import com.threerings.miso.Log;
|
|||||||
import com.threerings.miso.scene.DirtyItemList.DirtyItem;
|
import com.threerings.miso.scene.DirtyItemList.DirtyItem;
|
||||||
import com.threerings.miso.scene.util.AStarPathUtil;
|
import com.threerings.miso.scene.util.AStarPathUtil;
|
||||||
import com.threerings.miso.scene.util.IsoUtil;
|
import com.threerings.miso.scene.util.IsoUtil;
|
||||||
|
import com.threerings.miso.scene.util.ObjectSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The iso scene view provides an isometric view of a particular scene. It
|
* The iso scene view provides an isometric view of a particular scene. It
|
||||||
@@ -422,27 +423,17 @@ public class IsoSceneView implements SceneView
|
|||||||
// clear out any previously existing object data
|
// clear out any previously existing object data
|
||||||
_objects.clear();
|
_objects.clear();
|
||||||
|
|
||||||
// generate metric records for all objects
|
// grab all available objects
|
||||||
int ocount = _scene.getObjectCount();
|
Rectangle rect = new Rectangle(Short.MIN_VALUE, Short.MIN_VALUE,
|
||||||
for (int ii = 0; ii < ocount; ii++) {
|
2*Short.MAX_VALUE, 2*Short.MAX_VALUE);
|
||||||
createSceneObject(_scene.getObjectCoords(ii).x,
|
_scene.getSceneObjects(rect, _objects);
|
||||||
_scene.getObjectCoords(ii).y,
|
|
||||||
_scene.getObjectTile(ii), ii,
|
|
||||||
_scene.getObjectAction(ii));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// and fill in those objects' bounds
|
||||||
* Creates a new scene object and adds it to the list.
|
int ocount = _objects.size();
|
||||||
*/
|
for (int ii = 0; ii < ocount; ii++) {
|
||||||
protected void createSceneObject (
|
SceneObject scobj = _objects.get(ii);
|
||||||
int x, int y, ObjectTile tile, int index, String action)
|
scobj.bounds = IsoUtil.getObjectBounds(_model, scobj);
|
||||||
{
|
}
|
||||||
SceneObject scobj = new SceneObject(x, y, tile);
|
|
||||||
scobj.index = index;
|
|
||||||
scobj.action = action;
|
|
||||||
scobj.bounds = IsoUtil.getObjectBounds(_model, scobj);
|
|
||||||
_objects.add(scobj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -620,8 +611,8 @@ public class IsoSceneView implements SceneView
|
|||||||
/** The scene to be displayed. */
|
/** The scene to be displayed. */
|
||||||
protected DisplayMisoScene _scene;
|
protected DisplayMisoScene _scene;
|
||||||
|
|
||||||
/** Metric information for all of the object tiles. */
|
/** Information for all of the objects visible in the scene. */
|
||||||
protected ArrayList _objects = new ArrayList();
|
protected ObjectSet _objects = new ObjectSet();
|
||||||
|
|
||||||
/** The dirty sprites and objects that need to be re-painted. */
|
/** The dirty sprites and objects that need to be re-painted. */
|
||||||
protected DirtyItemList _dirtyItems = new DirtyItemList();
|
protected DirtyItemList _dirtyItems = new DirtyItemList();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: EditableMisoScene.java,v 1.17 2002/09/18 02:32:57 mdb Exp $
|
// $Id: EditableMisoScene.java,v 1.18 2002/09/23 21:54:50 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene.tools;
|
package com.threerings.miso.scene.tools;
|
||||||
|
|
||||||
@@ -9,10 +9,11 @@ import com.threerings.media.tile.ObjectTile;
|
|||||||
import com.threerings.media.tile.Tile;
|
import com.threerings.media.tile.Tile;
|
||||||
import com.threerings.media.tile.TileUtil;
|
import com.threerings.media.tile.TileUtil;
|
||||||
|
|
||||||
import com.threerings.miso.tile.BaseTile;
|
|
||||||
import com.threerings.miso.tile.BaseTileSet;
|
|
||||||
import com.threerings.miso.scene.DisplayMisoScene;
|
import com.threerings.miso.scene.DisplayMisoScene;
|
||||||
import com.threerings.miso.scene.MisoSceneModel;
|
import com.threerings.miso.scene.MisoSceneModel;
|
||||||
|
import com.threerings.miso.scene.SceneObject;
|
||||||
|
import com.threerings.miso.tile.BaseTile;
|
||||||
|
import com.threerings.miso.tile.BaseTileSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The editable Miso scene interface is used in the offline scene building
|
* The editable Miso scene interface is used in the offline scene building
|
||||||
@@ -59,7 +60,7 @@ public interface EditableMisoScene
|
|||||||
public void setBaseTiles (Rectangle r, BaseTileSet set, int setId);
|
public void setBaseTiles (Rectangle r, BaseTileSet set, int setId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Addds an object tile to this scene.
|
* Adds an object to this scene.
|
||||||
*
|
*
|
||||||
* @param x the object's origin x-coordinate.
|
* @param x the object's origin x-coordinate.
|
||||||
* @param y the object's origin y-coordinate.
|
* @param y the object's origin y-coordinate.
|
||||||
@@ -67,14 +68,10 @@ public interface EditableMisoScene
|
|||||||
* @param fqTileId the fully-qualified tile id (@see
|
* @param fqTileId the fully-qualified tile id (@see
|
||||||
* TileUtil#getFQTileId}) of the new default base tile.
|
* TileUtil#getFQTileId}) of the new default base tile.
|
||||||
*
|
*
|
||||||
* @return the new object's index in the object list.
|
* @return the new scene object instance.
|
||||||
*/
|
*/
|
||||||
public int addObjectTile (ObjectTile tile, int x, int y, int fqTileId);
|
public SceneObject addSceneObject (
|
||||||
|
ObjectTile tile, int x, int y, int fqTileId);
|
||||||
/**
|
|
||||||
* Sets the action string for the specified object tile.
|
|
||||||
*/
|
|
||||||
public void setObjectAction (int index, String action);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the tile at the specified location in the base layer.
|
* Clears out the tile at the specified location in the base layer.
|
||||||
@@ -82,15 +79,9 @@ public interface EditableMisoScene
|
|||||||
public void clearBaseTile (int x, int y);
|
public void clearBaseTile (int x, int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the specified object tile at the specified coordinates
|
* Removes the specified object from the scene.
|
||||||
* from the object list.
|
|
||||||
*/
|
*/
|
||||||
public void removeObjectTile (int index);
|
public boolean removeSceneObject (SceneObject scobj);
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the action string for the specified object tile.
|
|
||||||
*/
|
|
||||||
public void clearObjectAction (int index);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a reference to the miso scene model that reflects the
|
* Returns a reference to the miso scene model that reflects the
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: EditableMisoSceneImpl.java,v 1.22 2002/09/18 02:32:57 mdb Exp $
|
// $Id: EditableMisoSceneImpl.java,v 1.23 2002/09/23 21:54:50 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene.tools;
|
package com.threerings.miso.scene.tools;
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ import com.threerings.miso.tile.MisoTileManager;
|
|||||||
|
|
||||||
import com.threerings.miso.scene.DisplayMisoSceneImpl;
|
import com.threerings.miso.scene.DisplayMisoSceneImpl;
|
||||||
import com.threerings.miso.scene.MisoSceneModel;
|
import com.threerings.miso.scene.MisoSceneModel;
|
||||||
|
import com.threerings.miso.scene.SceneObject;
|
||||||
import com.threerings.miso.scene.util.IsoUtil;
|
import com.threerings.miso.scene.util.IsoUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,26 +111,21 @@ public class EditableMisoSceneImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public int addObjectTile (ObjectTile tile, int x, int y, int fqTileId)
|
public SceneObject addSceneObject (
|
||||||
|
ObjectTile tile, int x, int y, int fqTileId)
|
||||||
{
|
{
|
||||||
// create an object info record and add it to the list
|
// create a scene object record and add it to the list
|
||||||
EditableObjectInfo info = (EditableObjectInfo)createObjectInfo();
|
EditableSceneObject scobj = (EditableSceneObject)
|
||||||
info.object = tile;
|
createSceneObject(x, y, tile);
|
||||||
info.coords = new Point(x, y);
|
scobj.fqTileId = fqTileId;
|
||||||
info.fqTileId = fqTileId;
|
scobj.index = _objects.size();
|
||||||
_objects.add(info);
|
_objects.add(scobj);
|
||||||
|
|
||||||
// toggle the "covered" flag on in all base tiles below this
|
// toggle the "covered" flag on in all base tiles below this
|
||||||
// object tile
|
// object tile
|
||||||
setObjectTileFootprint(tile, x, y, true);
|
setObjectTileFootprint(tile, x, y, true);
|
||||||
|
|
||||||
return _objects.size()-1;
|
return scobj;
|
||||||
}
|
|
||||||
|
|
||||||
// documentation inherited from interface
|
|
||||||
public void setObjectAction (int index, String action)
|
|
||||||
{
|
|
||||||
((ObjectInfo)_objects.get(index)).action = action;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -141,20 +137,16 @@ public class EditableMisoSceneImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public void removeObjectTile (int index)
|
public boolean removeSceneObject (SceneObject scobj)
|
||||||
{
|
{
|
||||||
ObjectInfo info = (ObjectInfo)_objects.remove(index);
|
if (_objects.remove(scobj)) {
|
||||||
|
// toggle the "covered" flag off on the base tiles in this object
|
||||||
// toggle the "covered" flag off on the base tiles in this object
|
// tile's footprint
|
||||||
// tile's footprint
|
setObjectTileFootprint(scobj.tile, scobj.x, scobj.y, false);
|
||||||
setObjectTileFootprint(
|
return true;
|
||||||
info.object, info.coords.x, info.coords.y, false);
|
} else {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
// documentation inherited from interface
|
|
||||||
public void clearObjectAction (int index)
|
|
||||||
{
|
|
||||||
((ObjectInfo)_objects.get(index)).action = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -170,11 +162,12 @@ public class EditableMisoSceneImpl
|
|||||||
String[] actions = new String[ocount];
|
String[] actions = new String[ocount];
|
||||||
|
|
||||||
for (int ii = 0; ii < ocount; ii++) {
|
for (int ii = 0; ii < ocount; ii++) {
|
||||||
EditableObjectInfo info = (EditableObjectInfo)_objects.get(ii);
|
EditableSceneObject scobj = (EditableSceneObject)
|
||||||
otids[3*ii] = info.coords.x;
|
_objects.get(ii);
|
||||||
otids[3*ii+1] = info.coords.y;
|
otids[3*ii] = scobj.x;
|
||||||
otids[3*ii+2] = info.fqTileId;
|
otids[3*ii+1] = scobj.y;
|
||||||
actions[ii] = info.action;
|
otids[3*ii+2] = scobj.fqTileId;
|
||||||
|
actions[ii] = scobj.action;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stuff the new arrays into the model
|
// stuff the new arrays into the model
|
||||||
@@ -187,31 +180,36 @@ public class EditableMisoSceneImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
protected ObjectInfo createObjectInfo ()
|
protected SceneObject createSceneObject (int x, int y, ObjectTile tile)
|
||||||
{
|
{
|
||||||
return new EditableObjectInfo();
|
return new EditableSceneObject(x, y, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
protected ObjectInfo expandObject (
|
protected SceneObject expandObject (
|
||||||
int col, int row, int tsid, int tid, int fqTid, String action)
|
int col, int row, int tsid, int tid, int fqTid, String action)
|
||||||
throws NoSuchTileException, NoSuchTileSetException
|
throws NoSuchTileException, NoSuchTileSetException
|
||||||
{
|
{
|
||||||
// do the actual object creation
|
// do the actual object creation
|
||||||
EditableObjectInfo info = (EditableObjectInfo)
|
EditableSceneObject scobj = (EditableSceneObject)
|
||||||
super.expandObject(col, row, tsid, tid, fqTid, action);
|
super.expandObject(col, row, tsid, tid, fqTid, action);
|
||||||
|
|
||||||
// we need this to track object layer mods
|
// we need this to track object layer mods
|
||||||
info.fqTileId = fqTid;
|
scobj.fqTileId = fqTid;
|
||||||
|
|
||||||
// pass on the objecty goodness
|
// pass on the objecty goodness
|
||||||
return info;
|
return scobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used to report information on objects in this scene. */
|
/** Used to report information on objects in this scene. */
|
||||||
protected static class EditableObjectInfo extends ObjectInfo
|
protected static class EditableSceneObject extends SceneObject
|
||||||
{
|
{
|
||||||
public int fqTileId;
|
public int fqTileId;
|
||||||
|
|
||||||
|
public EditableSceneObject (int x, int y, ObjectTile tile)
|
||||||
|
{
|
||||||
|
super(x, y, tile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The default tileset with which to fill the base layer. */
|
/** The default tileset with which to fill the base layer. */
|
||||||
|
|||||||
Reference in New Issue
Block a user