Reworking exits and locations en route to editor support for placement

within a scene.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@208 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-08-09 21:17:06 +00:00
parent 506623be27
commit 593d17aeb5
9 changed files with 225 additions and 141 deletions
@@ -1,10 +1,11 @@
//
// $Id: DisplayMisoSceneImpl.java,v 1.18 2001/08/09 05:44:07 shaper Exp $
// $Id: DisplayMisoSceneImpl.java,v 1.19 2001/08/09 21:17:06 shaper Exp $
package com.threerings.miso.scene;
import java.awt.Point;
import java.io.*;
import java.util.ArrayList;
import com.samskivert.util.StringUtil;
import com.threerings.miso.tile.Tile;
@@ -63,8 +64,8 @@ public class Scene
_sid = SID_INVALID;
_name = DEF_SCENE_NAME;
_hotspots = new Point[0];
_exits = new ExitPoint[0];
_locations = new ArrayList();
_exits = new ArrayList();
tiles = new Tile[TILE_WIDTH][TILE_HEIGHT][NUM_LAYERS];
_deftile = _tilemgr.getTile(deftsid, deftid);
@@ -80,23 +81,22 @@ public class Scene
}
/**
* Construct a new Scene object with the given values, specifying
* the tile manager from which the scene obtains tiles.
* Construct a new Scene object with the given values.
*
* @param tilemgr the tile manager.
* @param name the scene name.
* @param hotspots the hotspot points.
* @param exits the exit points.
* @param locations the locations.
* @param exits the exits.
* @param tiles the tiles comprising the scene.
*/
public Scene (TileManager tilemgr, String name,
Point hotspots[], ExitPoint exits[],
ArrayList locations, ArrayList exits,
Tile tiles[][][])
{
_tilemgr = tilemgr;
_sid = SID_INVALID;
_name = name;
_hotspots = hotspots;
_locations = locations;
_exits = exits;
this.tiles = tiles;
}
@@ -118,17 +118,17 @@ public class Scene
}
/**
* Return the scene hot spots array.
* Return the scene locations list.
*/
public Point[] getHotSpots ()
public ArrayList getLocations ()
{
return _hotspots;
return _locations;
}
/**
* Return the scene exits array.
* Return the scene exits list.
*/
public ExitPoint[] getExitPoints ()
public ArrayList getExits ()
{
return _exits;
}
@@ -168,7 +168,7 @@ public class Scene
StringBuffer buf = new StringBuffer();
buf.append("[name=").append(_name);
buf.append(", sid=").append(_sid);
buf.append(", hotspots=").append(StringUtil.toString(_hotspots));
buf.append(", locations=").append(StringUtil.toString(_locations));
buf.append(", exits=").append(StringUtil.toString(_exits));
return buf.append("]").toString();
}
@@ -182,11 +182,11 @@ public class Scene
/** The unique scene id. */
protected short _sid;
/** The hot-spot zone points. */
protected Point _hotspots[];
/** The locations within the scene. */
protected ArrayList _locations;
/** The exit points to different scenes. */
protected ExitPoint _exits[];
protected ArrayList _exits;
/** The default tile for the base layer in the scene. */
protected Tile _deftile;
@@ -0,0 +1,42 @@
//
// $Id: Exit.java,v 1.1 2001/08/09 21:17:06 shaper Exp $
package com.threerings.miso.scene;
/**
* The <code>Exit</code> class represents a <code>Location</code> in a
* scene that leads to a different scene.
*
* @see Location
*/
public class Exit
{
/** The location this exit is associated with. */
public Location loc;
/** The scene name this exit transitions to. */
public String name;
/**
* Construct an <code>Exit</code> object.
*
* @param loc the location associated with the exit.
* @param name the scene name this exit leads to.
*/
public Exit (Location loc, String name)
{
this.loc = loc;
this.name = name;
}
/**
* Return a String representation of this object.
*/
public String toString ()
{
StringBuffer buf = new StringBuffer();
buf.append("[loc=").append(loc);
buf.append(", name=").append(name);
return buf.append("]").toString();
}
}
@@ -1,33 +0,0 @@
//
// $Id: ExitPoint.java,v 1.5 2001/07/24 22:52:02 shaper Exp $
package com.threerings.miso.scene;
/**
* The ExitPoint class represents a point in a scene that leads to a
* different scene.
*/
public class ExitPoint
{
/** Coordinates for this exit point. */
public byte x, y;
/** The scene name this exit transitions to. */
public String name;
/** The scene id this exit transitions to. */
public short sid;
/**
* Return a String representation of this ExitPoint object.
*/
public String toString ()
{
StringBuffer buf = new StringBuffer();
buf.append("[x=").append(x);
buf.append(", y=").append(y);
buf.append(", name=").append(name);
buf.append(", sid=").append(sid);
return buf.append("]").toString();
}
}
@@ -1,5 +1,5 @@
//
// $Id: IsoSceneView.java,v 1.34 2001/08/09 17:04:56 shaper Exp $
// $Id: IsoSceneView.java,v 1.35 2001/08/09 21:17:06 shaper Exp $
package com.threerings.miso.scene;
@@ -322,6 +322,11 @@ public class IsoSceneView implements EditableSceneView
IsoUtil.screenToFull(_model, x, y, _hfull);
}
public void getFullCoordinates (int sx, int sy, Point fpos)
{
IsoUtil.screenToFull(_model, sx, sy, fpos);
}
/**
* Invalidate a list of rectangles in the view for later repainting.
*
@@ -0,0 +1,53 @@
//
// $Id: Location.java,v 1.1 2001/08/09 21:17:06 shaper Exp $
package com.threerings.miso.scene;
/**
* The <code>Location</code> class represents a unique well-defined
* location within the scene at the lowest level of granularity
* available within the scene coordinate system. Locations reside at
* a full coordinate (comprised of tile coordinates and fine
* coordinates within the tile), and only one location may reside at
* each full coordinate in the scene.
*/
public class Location
{
/** The spot index in the scene containing this location. */
public int spotid;
/** The location position in full coordinates. */
public int x, y;
/** The location orientation. */
public int orient;
/**
* Construct a <code>Location</code> object.
*
* @param spotid the spot id.
* @param x the x-position full coordinate.
* @param y the y-position full coordinate.
* @param orient the location orientation.
*/
public Location (int spotid, int x, int y, int orient)
{
this.spotid = spotid;
this.x = x;
this.y = y;
this.orient = orient;
}
/**
* Return a String representation of this object.
*/
public String toString ()
{
StringBuffer buf = new StringBuffer();
buf.append("[spotid=").append(spotid);
buf.append(", x=").append(x);
buf.append(", y=").append(y);
buf.append(", orient=").append(orient);
return buf.append("]").toString();
}
}