Changed Scene to MisoScene. Made MisoScene implement Whirled's Scene

interface.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@249 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-08-15 01:08:49 +00:00
parent 1ffbae2cc4
commit a07f5d4d13
9 changed files with 98 additions and 76 deletions
@@ -1,5 +1,5 @@
// //
// $Id: DisplayMisoSceneImpl.java,v 1.27 2001/08/14 21:29:40 shaper Exp $ // $Id: DisplayMisoSceneImpl.java,v 1.28 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -8,18 +8,20 @@ import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
import com.threerings.whirled.data.Scene;
import com.threerings.miso.Log; import com.threerings.miso.Log;
import com.threerings.miso.tile.Tile; import com.threerings.miso.tile.Tile;
import com.threerings.miso.tile.TileManager; import com.threerings.miso.tile.TileManager;
import com.threerings.miso.scene.util.ClusterUtil; import com.threerings.miso.scene.util.ClusterUtil;
/** /**
* A Scene object represents the data model corresponding to a single * A scene object represents the data model corresponding to a single
* screen for game play. For instance, one scene might display a * screen for game play. For instance, one scene might display a portion
* portion of a street with several buildings scattered about on the * of a street with several buildings scattered about on the periphery.
* periphery.
*/ */
public class Scene public class MisoScene implements Scene
{ {
/** The base layer id. */ /** The base layer id. */
public static final int LAYER_BASE = 0; public static final int LAYER_BASE = 0;
@@ -52,15 +54,15 @@ public class Scene
public Tile tiles[][][]; public Tile tiles[][][];
/** /**
* Construct a new Scene object. The base layer tiles are * Construct a new miso scene object. The base layer tiles are
* initialized to contain tiles of the specified default tileset * initialized to contain tiles of the specified default tileset and
* and tile id. * tile id.
* *
* @param tilemgr the tile manager. * @param tilemgr the tile manager.
* @param deftsid the default tileset id. * @param deftsid the default tileset id.
* @param deftid the default tile id. * @param deftid the default tile id.
*/ */
public Scene (TileManager tilemgr, int deftsid, int deftid) public MisoScene (TileManager tilemgr, int deftsid, int deftid)
{ {
_tilemgr = tilemgr; _tilemgr = tilemgr;
@@ -85,7 +87,7 @@ public class Scene
} }
/** /**
* Construct a new Scene object with the given values. * Construct a new miso scene object with the given values.
* *
* @param tilemgr the tile manager. * @param tilemgr the tile manager.
* @param name the scene name. * @param name the scene name.
@@ -93,9 +95,9 @@ public class Scene
* @param exits the exits. * @param exits the exits.
* @param tiles the tiles comprising the scene. * @param tiles the tiles comprising the scene.
*/ */
public Scene (TileManager tilemgr, String name, public MisoScene (
ArrayList locations, ArrayList clusters, ArrayList exits, TileManager tilemgr, String name, ArrayList locations,
Tile tiles[][][]) ArrayList clusters, ArrayList exits, Tile tiles[][][])
{ {
_tilemgr = tilemgr; _tilemgr = tilemgr;
_sid = SID_INVALID; _sid = SID_INVALID;
@@ -212,11 +214,29 @@ public class Scene
/** /**
* Return the scene identifier. * Return the scene identifier.
*/ */
public short getId () public int getId ()
{ {
return _sid; return _sid;
} }
/**
* Returns this scene's version number (which is incremented when it
* is modified and stored into the scene repository).
*/
public int getVersion ()
{
// fake it for now
return 1;
}
/**
* Returns the scene ids of the exits from this scene.
*/
public int[] getExitIds ()
{
return null;
}
/** /**
* Return the scene locations list. * Return the scene locations list.
*/ */
@@ -1,5 +1,5 @@
// //
// $Id: IsoSceneView.java,v 1.43 2001/08/14 23:35:22 mdb Exp $ // $Id: IsoSceneView.java,v 1.44 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -46,7 +46,7 @@ public class IsoSceneView implements EditableSceneView
_font = new Font("Arial", Font.PLAIN, 7); _font = new Font("Arial", Font.PLAIN, 7);
// create the array used to mark dirty tiles // create the array used to mark dirty tiles
_dirty = new boolean[Scene.TILE_WIDTH][Scene.TILE_HEIGHT]; _dirty = new boolean[MisoScene.TILE_WIDTH][MisoScene.TILE_HEIGHT];
// create the list of dirty rectangles // create the list of dirty rectangles
_dirtyRects = new ArrayList(); _dirtyRects = new ArrayList();
@@ -103,8 +103,8 @@ public class IsoSceneView implements EditableSceneView
_dirtyRects.clear(); _dirtyRects.clear();
_numDirty = 0; _numDirty = 0;
for (int xx = 0; xx < Scene.TILE_WIDTH; xx++) { for (int xx = 0; xx < MisoScene.TILE_WIDTH; xx++) {
for (int yy = 0; yy < Scene.TILE_HEIGHT; yy++) { for (int yy = 0; yy < MisoScene.TILE_HEIGHT; yy++) {
_dirty[xx][yy] = false; _dirty[xx][yy] = false;
} }
} }
@@ -114,8 +114,8 @@ public class IsoSceneView implements EditableSceneView
{ {
// draw the dirty tiles // draw the dirty tiles
gfx.setColor(Color.cyan); gfx.setColor(Color.cyan);
for (int xx = 0; xx < Scene.TILE_WIDTH; xx++) { for (int xx = 0; xx < MisoScene.TILE_WIDTH; xx++) {
for (int yy = 0; yy < Scene.TILE_HEIGHT; yy++) { for (int yy = 0; yy < MisoScene.TILE_HEIGHT; yy++) {
if (_dirty[xx][yy]) { if (_dirty[xx][yy]) {
gfx.draw(IsoUtil.getTilePolygon(_model, xx, yy)); gfx.draw(IsoUtil.getTilePolygon(_model, xx, yy));
} }
@@ -140,8 +140,8 @@ public class IsoSceneView implements EditableSceneView
{ {
int numDrawn = 0; int numDrawn = 0;
for (int yy = 0; yy < Scene.TILE_HEIGHT; yy++) { for (int yy = 0; yy < MisoScene.TILE_HEIGHT; yy++) {
for (int xx = 0; xx < Scene.TILE_WIDTH; xx++) { for (int xx = 0; xx < MisoScene.TILE_WIDTH; xx++) {
// skip this tile if it's not marked dirty // skip this tile if it's not marked dirty
if (!_dirty[xx][yy]) continue; if (!_dirty[xx][yy]) continue;
@@ -150,7 +150,7 @@ public class IsoSceneView implements EditableSceneView
Polygon poly = IsoUtil.getTilePolygon(_model, xx, yy); Polygon poly = IsoUtil.getTilePolygon(_model, xx, yy);
// draw all layers at this tile position // draw all layers at this tile position
for (int kk = 0; kk < Scene.NUM_LAYERS; kk++) { for (int kk = 0; kk < MisoScene.NUM_LAYERS; kk++) {
// get the tile at these coordinates and layer // get the tile at these coordinates and layer
Tile tile = _scene.tiles[xx][yy][kk]; Tile tile = _scene.tiles[xx][yy][kk];
@@ -192,7 +192,7 @@ public class IsoSceneView implements EditableSceneView
for (int ii = 0; ii < _model.tilerows; ii++) { for (int ii = 0; ii < _model.tilerows; ii++) {
// determine starting tile coordinates // determine starting tile coordinates
int tx = (ii < Scene.TILE_HEIGHT) ? 0 : mx++; int tx = (ii < MisoScene.TILE_HEIGHT) ? 0 : mx++;
int ty = my; int ty = my;
// determine number of tiles in this row // determine number of tiles in this row
@@ -203,7 +203,7 @@ public class IsoSceneView implements EditableSceneView
for (int jj = 0; jj < length; jj++) { for (int jj = 0; jj < length; jj++) {
for (int kk = 0; kk < Scene.NUM_LAYERS; kk++) { for (int kk = 0; kk < MisoScene.NUM_LAYERS; kk++) {
// grab the tile we're rendering // grab the tile we're rendering
Tile tile = _scene.tiles[tx][ty][kk]; Tile tile = _scene.tiles[tx][ty][kk];
if (tile == null) continue; if (tile == null) continue;
@@ -239,7 +239,9 @@ public class IsoSceneView implements EditableSceneView
screenY += _model.tilehhei; screenY += _model.tilehhei;
// advance starting y-axis coordinate unless we've hit bottom // advance starting y-axis coordinate unless we've hit bottom
if ((++my) > Scene.TILE_HEIGHT - 1) my = Scene.TILE_HEIGHT - 1; if ((++my) > MisoScene.TILE_HEIGHT - 1) {
my = MisoScene.TILE_HEIGHT - 1;
}
} }
} }
@@ -510,7 +512,7 @@ public class IsoSceneView implements EditableSceneView
} }
} }
public void setScene (Scene scene) public void setScene (MisoScene scene)
{ {
_scene = scene; _scene = scene;
} }
@@ -623,7 +625,7 @@ public class IsoSceneView implements EditableSceneView
protected IsoSceneModel _model; protected IsoSceneModel _model;
/** The scene object to be displayed. */ /** The scene object to be displayed. */
protected Scene _scene; protected MisoScene _scene;
/** The sprite manager. */ /** The sprite manager. */
protected SpriteManager _spritemgr; protected SpriteManager _spritemgr;
@@ -1,5 +1,5 @@
// //
// $Id: IsoSceneViewModel.java,v 1.6 2001/08/10 21:17:07 shaper Exp $ // $Id: IsoSceneViewModel.java,v 1.7 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -149,7 +149,7 @@ public class IsoSceneModel
(tilehwid * tilehwid) + (tilehhei * tilehhei)); (tilehwid * tilehwid) + (tilehhei * tilehhei));
// calculate the number of tile rows to render // calculate the number of tile rows to render
tilerows = (Scene.TILE_WIDTH * Scene.TILE_HEIGHT) - 1; tilerows = (MisoScene.TILE_WIDTH * MisoScene.TILE_HEIGHT) - 1;
// calculate the slope of the x- and y-axis lines // calculate the slope of the x- and y-axis lines
slopeX = (float)tilehei / (float)tilewid; slopeX = (float)tilehei / (float)tilewid;
@@ -212,7 +212,7 @@ public class IsoSceneModel
bX = (int)-(slopeX * origin.x); bX = (int)-(slopeX * origin.x);
// determine the ending point // determine the ending point
lineX[1].x = lineX[0].x + (tilehwid * Scene.TILE_WIDTH); lineX[1].x = lineX[0].x + (tilehwid * MisoScene.TILE_WIDTH);
lineX[1].y = lineX[0].y + (int)((slopeX * lineX[1].x) + bX); lineX[1].y = lineX[0].y + (int)((slopeX * lineX[1].x) + bX);
// calculate tile-based x-axis line for conversion from // calculate tile-based x-axis line for conversion from
@@ -1,5 +1,5 @@
// //
// $Id: SceneView.java,v 1.10 2001/08/14 23:35:22 mdb Exp $ // $Id: SceneView.java,v 1.11 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -28,7 +28,7 @@ public interface SceneView extends AnimatedView
* *
* @param scene the scene to render in the view. * @param scene the scene to render in the view.
*/ */
public void setScene (Scene scene); public void setScene (MisoScene scene);
/** /**
* Return a Path object detailing a valid path for the given * Return a Path object detailing a valid path for the given
@@ -1,5 +1,5 @@
// //
// $Id: SceneViewPanel.java,v 1.5 2001/08/14 23:35:22 mdb Exp $ // $Id: SceneViewPanel.java,v 1.6 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.scene; package com.threerings.miso.scene;
@@ -38,7 +38,7 @@ public class SceneViewPanel extends JPanel
/** /**
* Set the scene managed by the panel. * Set the scene managed by the panel.
*/ */
public void setScene (Scene scene) public void setScene (MisoScene scene)
{ {
_view.setScene(scene); _view.setScene(scene);
} }
@@ -1,5 +1,5 @@
// //
// $Id: XMLSceneParser.java,v 1.10 2001/08/13 15:00:24 shaper Exp $ // $Id: XMLSceneParser.java,v 1.11 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.scene.xml; package com.threerings.miso.scene.xml;
@@ -58,12 +58,12 @@ public class XMLSceneParser extends DefaultHandler
} else if (qName.equals("version")) { } else if (qName.equals("version")) {
int version = getInt(_chars.toString()); int version = getInt(_chars.toString());
if (version < 0 || version > Scene.VERSION) { if (version < 0 || version > MisoScene.VERSION) {
Log.warning( Log.warning(
"Unrecognized scene file format version, will attempt " + "Unrecognized scene file format version, will attempt " +
"to continue parsing file but your mileage may vary " + "to continue parsing file but your mileage may vary " +
"[fname=" + _fname + ", version=" + version + "[fname=" + _fname + ", version=" + version +
", known_version=" + Scene.VERSION + "]."); ", known_version=" + MisoScene.VERSION + "].");
} }
} else if (qName.equals("locations")) { } else if (qName.equals("locations")) {
@@ -79,7 +79,7 @@ public class XMLSceneParser extends DefaultHandler
_scExits = toExitList(_scLocations, vals); _scExits = toExitList(_scLocations, vals);
} else if (qName.equals("row")) { } else if (qName.equals("row")) {
if (_scLnum == Scene.LAYER_BASE) { if (_scLnum == MisoScene.LAYER_BASE) {
readRowData(_chars.toString()); readRowData(_chars.toString());
} else { } else {
readSparseRowData(_chars.toString()); readSparseRowData(_chars.toString());
@@ -87,7 +87,7 @@ public class XMLSceneParser extends DefaultHandler
} else if (qName.equals("scene")) { } else if (qName.equals("scene")) {
// construct the scene object on tag close // construct the scene object on tag close
_scene = new Scene( _scene = new MisoScene(
_tilemgr, _scName, _scLocations, _scClusters, _tilemgr, _scName, _scLocations, _scClusters,
_scExits, _scTiles); _scExits, _scTiles);
@@ -122,7 +122,7 @@ public class XMLSceneParser extends DefaultHandler
int[] vals = StringUtil.parseIntArray(data); int[] vals = StringUtil.parseIntArray(data);
// make sure we have a suitable number of tiles // make sure we have a suitable number of tiles
int validLen = Scene.TILE_WIDTH * 2; int validLen = MisoScene.TILE_WIDTH * 2;
if (vals.length != validLen) { if (vals.length != validLen) {
Log.warning( Log.warning(
"Invalid number of tiles in full row data set, skipping set " + "Invalid number of tiles in full row data set, skipping set " +
@@ -270,22 +270,22 @@ public class XMLSceneParser extends DefaultHandler
{ {
_chars = new StringBuffer(); _chars = new StringBuffer();
_scene = null; _scene = null;
int width = Scene.TILE_WIDTH, height = Scene.TILE_HEIGHT; int width = MisoScene.TILE_WIDTH, height = MisoScene.TILE_HEIGHT;
_scTiles = new Tile[width][height][Scene.NUM_LAYERS]; _scTiles = new Tile[width][height][MisoScene.NUM_LAYERS];
_scLocations = null; _scLocations = null;
_scExits = null; _scExits = null;
_scClusters = new ArrayList(); _scClusters = new ArrayList();
} }
/** /**
* Parse the specified XML file and return a Scene object with the * Parse the specified XML file and return a miso scene object with
* data contained therein. * the data contained therein.
* *
* @param fname the file name. * @param fname the file name.
* *
* @return the scene object, or null if an error occurred. * @return the scene object, or null if an error occurred.
*/ */
public Scene loadScene (String fname) throws IOException public MisoScene loadScene (String fname) throws IOException
{ {
_fname = fname; _fname = fname;
@@ -318,7 +318,7 @@ public class XMLSceneParser extends DefaultHandler
protected String _tag; protected String _tag;
/** The scene object constructed as each scene file is read. */ /** The scene object constructed as each scene file is read. */
protected Scene _scene; protected MisoScene _scene;
/** The tile manager object for use in constructing scenes. */ /** The tile manager object for use in constructing scenes. */
protected TileManager _tilemgr; protected TileManager _tilemgr;
@@ -1,5 +1,5 @@
// //
// $Id: XMLSceneRepository.java,v 1.6 2001/08/15 00:10:58 mdb Exp $ // $Id: XMLSceneRepository.java,v 1.7 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.scene.xml; package com.threerings.miso.scene.xml;
@@ -8,7 +8,7 @@ import java.util.ArrayList;
import com.samskivert.util.Config; import com.samskivert.util.Config;
import com.threerings.miso.Log; import com.threerings.miso.Log;
import com.threerings.miso.scene.Scene; import com.threerings.miso.scene.MisoScene;
import com.threerings.miso.tile.TileManager; import com.threerings.miso.tile.TileManager;
/** /**
@@ -51,14 +51,14 @@ public class XMLFileSceneRepository
} }
/** /**
* Loads and returns a Scene object for the scene described in the * Loads and returns a miso scene object for the scene described in
* specified XML file. The filename should be relative to the * the specified XML file. The filename should be relative to the
* scene root directory. * scene root directory.
* *
* @param fname the full pathname to the file. * @param fname the full pathname to the file.
* @return the Scene object. * @return the scene object.
*/ */
public Scene loadScene (String fname) throws IOException public MisoScene loadScene (String fname) throws IOException
{ {
String path = getScenePath() + fname; String path = getScenePath() + fname;
Log.info("Loading scene [path=" + path + "]."); Log.info("Loading scene [path=" + path + "].");
@@ -74,7 +74,7 @@ public class XMLFileSceneRepository
* @param scene the scene to save. * @param scene the scene to save.
* @param fname the file to write the scene to. * @param fname the file to write the scene to.
*/ */
public void saveScene (Scene scene, String fname) throws IOException public void saveScene (MisoScene scene, String fname) throws IOException
{ {
String path = getScenePath() + fname; String path = getScenePath() + fname;
Log.info("Saving scene [path=" + path + "]."); Log.info("Saving scene [path=" + path + "].");
@@ -1,5 +1,5 @@
// //
// $Id: XMLSceneWriter.java,v 1.8 2001/08/11 00:01:40 shaper Exp $ // $Id: XMLSceneWriter.java,v 1.9 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.scene.xml; package com.threerings.miso.scene.xml;
@@ -17,8 +17,8 @@ import com.threerings.miso.scene.*;
import com.threerings.miso.tile.Tile; import com.threerings.miso.tile.Tile;
/** /**
* The <code>XMLSceneWriter</code> writes a <code>Scene</code> object * The <code>XMLSceneWriter</code> writes a {@link
* to an XML file. * com.threerings.miso.scene.MisoScene} object to an XML file.
* *
* <p> The scene id is omitted as the scene id is assigned when the * <p> The scene id is omitted as the scene id is assigned when the
* scene template is actually loaded into a server. Similarly, exit * scene template is actually loaded into a server. Similarly, exit
@@ -39,7 +39,7 @@ public class XMLSceneWriter extends DataWriter
* *
* @param fname the file to write to. * @param fname the file to write to.
*/ */
public void saveScene (Scene scene, String fname) throws IOException public void saveScene (MisoScene scene, String fname) throws IOException
{ {
FileOutputStream fos = new FileOutputStream(fname); FileOutputStream fos = new FileOutputStream(fname);
setOutput(new OutputStreamWriter(fos)); setOutput(new OutputStreamWriter(fos));
@@ -50,7 +50,7 @@ public class XMLSceneWriter extends DataWriter
startElement("scene"); startElement("scene");
dataElement("name", scene.getName()); dataElement("name", scene.getName());
dataElement("version", "" + Scene.VERSION); dataElement("version", "" + MisoScene.VERSION);
dataElement("locations", getLocationData(scene)); dataElement("locations", getLocationData(scene));
startElement("clusters"); startElement("clusters");
@@ -60,7 +60,7 @@ public class XMLSceneWriter extends DataWriter
dataElement("exits", getExitData(scene)); dataElement("exits", getExitData(scene));
startElement("tiles"); startElement("tiles");
for (int lnum = 0; lnum < Scene.NUM_LAYERS; lnum++) { for (int lnum = 0; lnum < MisoScene.NUM_LAYERS; lnum++) {
writeLayer(scene, lnum); writeLayer(scene, lnum);
} }
endElement("tiles"); endElement("tiles");
@@ -82,7 +82,7 @@ public class XMLSceneWriter extends DataWriter
* *
* @param scene the scene object. * @param scene the scene object.
*/ */
protected void writeClusters (Scene scene) throws SAXException protected void writeClusters (MisoScene scene) throws SAXException
{ {
ArrayList clusters = scene.getClusters(); ArrayList clusters = scene.getClusters();
ArrayList locs = scene.getLocations(); ArrayList locs = scene.getLocations();
@@ -115,14 +115,14 @@ public class XMLSceneWriter extends DataWriter
* @param scene the scene object. * @param scene the scene object.
* @param lnum the layer number. * @param lnum the layer number.
*/ */
protected void writeLayer (Scene scene, int lnum) throws SAXException protected void writeLayer (MisoScene scene, int lnum) throws SAXException
{ {
AttributesImpl attrs = new AttributesImpl(); AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "lnum", "", "CDATA", "" + lnum); attrs.addAttribute("", "lnum", "", "CDATA", "" + lnum);
startElement("", "layer", "", attrs); startElement("", "layer", "", attrs);
for (int yy = 0; yy < Scene.TILE_HEIGHT; yy++) { for (int yy = 0; yy < MisoScene.TILE_HEIGHT; yy++) {
if (lnum == Scene.LAYER_BASE) { if (lnum == MisoScene.LAYER_BASE) {
writeTileRowData(scene, yy, lnum); writeTileRowData(scene, yy, lnum);
} else { } else {
writeSparseTileRowData(scene, yy, lnum); writeSparseTileRowData(scene, yy, lnum);
@@ -140,7 +140,7 @@ public class XMLSceneWriter extends DataWriter
* *
* @return the exits in String format. * @return the exits in String format.
*/ */
protected String getExitData (Scene scene) protected String getExitData (MisoScene scene)
{ {
ArrayList locs = scene.getLocations(); ArrayList locs = scene.getLocations();
ArrayList exits = scene.getExits(); ArrayList exits = scene.getExits();
@@ -164,7 +164,7 @@ public class XMLSceneWriter extends DataWriter
* *
* @return the locations in String format. * @return the locations in String format.
*/ */
protected String getLocationData (Scene scene) protected String getLocationData (MisoScene scene)
{ {
ArrayList locs = scene.getLocations(); ArrayList locs = scene.getLocations();
@@ -195,7 +195,7 @@ public class XMLSceneWriter extends DataWriter
* *
* @return the tile data in String format. * @return the tile data in String format.
*/ */
protected String getTileData (Scene scene, int rownum, int lnum, protected String getTileData (MisoScene scene, int rownum, int lnum,
int colstart, int len) int colstart, int len)
{ {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
@@ -230,7 +230,7 @@ public class XMLSceneWriter extends DataWriter
* @param rownum the row in the scene tile array. * @param rownum the row in the scene tile array.
* @param lnum the layer number in the scene tile array. * @param lnum the layer number in the scene tile array.
*/ */
protected void writeTileRowData (Scene scene, int rownum, int lnum) protected void writeTileRowData (MisoScene scene, int rownum, int lnum)
throws SAXException throws SAXException
{ {
// set up the attributes for this row // set up the attributes for this row
@@ -238,7 +238,8 @@ public class XMLSceneWriter extends DataWriter
attrs.addAttribute("", "rownum", "", "CDATA", "" + rownum); attrs.addAttribute("", "rownum", "", "CDATA", "" + rownum);
// output the full row data element // output the full row data element
String data = getTileData(scene, rownum, lnum, 0, Scene.TILE_WIDTH); String data = getTileData(scene, rownum, lnum, 0,
MisoScene.TILE_WIDTH);
dataElement("", "row", "", attrs, data); dataElement("", "row", "", attrs, data);
} }
@@ -260,11 +261,11 @@ public class XMLSceneWriter extends DataWriter
* *
* @return true if any tiles were found, false if not. * @return true if any tiles were found, false if not.
*/ */
protected boolean protected boolean getSparseColumn (
getSparseColumn (Scene scene, int rownum, int lnum, int info[]) MisoScene scene, int rownum, int lnum, int info[])
{ {
int start = -1, len = 0; int start = -1, len = 0;
for (int xx = info[0]; xx < Scene.TILE_WIDTH; xx++) { for (int xx = info[0]; xx < MisoScene.TILE_WIDTH; xx++) {
Tile tile = scene.tiles[xx][rownum][lnum]; Tile tile = scene.tiles[xx][rownum][lnum];
if (tile == null) { if (tile == null) {
if (start == -1) continue; if (start == -1) continue;
@@ -297,7 +298,7 @@ public class XMLSceneWriter extends DataWriter
* @param lnum the layer number in the scene tile array. * @param lnum the layer number in the scene tile array.
*/ */
protected void protected void
writeSparseTileRowData (Scene scene, int rownum, int lnum) writeSparseTileRowData (MisoScene scene, int rownum, int lnum)
throws SAXException throws SAXException
{ {
// set up the attributes for this row // set up the attributes for this row
@@ -1,5 +1,5 @@
// //
// $Id: ViewerFrame.java,v 1.10 2001/08/14 23:35:22 mdb Exp $ // $Id: ViewerFrame.java,v 1.11 2001/08/15 01:08:49 mdb Exp $
package com.threerings.miso.viewer; package com.threerings.miso.viewer;
@@ -13,7 +13,6 @@ import com.samskivert.swing.*;
import com.threerings.media.sprite.*; import com.threerings.media.sprite.*;
import com.threerings.miso.Log; import com.threerings.miso.Log;
import com.threerings.miso.scene.Scene;
import com.threerings.miso.tile.TileManager; import com.threerings.miso.tile.TileManager;
import com.threerings.miso.tile.TileUtil; import com.threerings.miso.tile.TileUtil;
import com.threerings.miso.viewer.util.ViewerContext; import com.threerings.miso.viewer.util.ViewerContext;