Added character manager and character descriptions. Allow tile sets

that have no specified layer.  Made the scene editor gracefully handle
the case where there are no valid tile sets for use with the selected
scene layer.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@461 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-10-15 23:53:43 +00:00
parent 3773da79a6
commit 00d57dfb92
15 changed files with 276 additions and 351 deletions
@@ -1,10 +1,10 @@
//
// $Id: EditableTileSetManager.java,v 1.12 2001/10/12 16:38:59 shaper Exp $
// $Id: EditableTileSetManager.java,v 1.13 2001/10/15 23:53:43 shaper Exp $
package com.threerings.miso.tile;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import com.samskivert.util.Config;
@@ -28,12 +28,11 @@ public class EditableTileSetManager extends TileSetManagerImpl
// load the tilesets from the XML description file
String fname = config.getValue(TILESETS_KEY, (String)null);
List tilesets = null;
ArrayList tilesets = new ArrayList();
try {
tilesets = new XMLMisoTileSetParser().loadTileSets(fname);
new XMLMisoTileSetParser().loadTileSets(fname, tilesets);
} catch (IOException ioe) {
Log.warning("Exception loading tileset [fname=" + fname +
", ioe=" + ioe + "].");
Log.warning("Exception loading tile sets [ioe=" + ioe + "].");
return;
}
@@ -1,5 +1,5 @@
//
// $Id: TileUtil.java,v 1.6 2001/10/11 00:41:27 shaper Exp $
// $Id: TileUtil.java,v 1.7 2001/10/15 23:53:43 shaper Exp $
package com.threerings.miso.tile;
@@ -22,7 +22,7 @@ public class TileUtil
* frames of animation used to render the ambulatory sprite in
* each of the directions it may face. The tileset id referenced
* must contain <code>Sprite.NUM_DIRECTIONS</code> rows of tiles,
* with each row containing <code>NUM_DIR_FRAMES</code> tiles.
* with each row containing <code>frameCount</code> tiles.
*
* @param tilemgr the tile manager to retrieve tiles from.
* @param tsid the tileset id containing the sprite tiles.
@@ -30,15 +30,17 @@ public class TileUtil
* @return the array of multi-frame sprite images.
*/
public static MultiFrameImage[]
getAmbulatorySpriteFrames (TileManager tilemgr, int tsid)
getAmbulatorySpriteFrames (TileManager tilemgr, int tsid,
int frameCount)
{
MultiFrameImage[] anims = new MultiFrameImage[Sprite.NUM_DIRECTIONS];
try {
for (int ii = 0; ii < Sprite.NUM_DIRECTIONS; ii++) {
Tile[] tiles = new Tile[NUM_DIR_FRAMES];
for (int jj = 0; jj < NUM_DIR_FRAMES; jj++) {
int idx = (ii * NUM_DIR_FRAMES) + jj;
Tile[] tiles = new Tile[frameCount];
for (int jj = 0; jj < frameCount; jj++) {
int idx = (ii * frameCount) + jj;
tiles[jj] = tilemgr.getTile(tsid, idx);
}
@@ -77,7 +79,4 @@ public class TileUtil
protected Tile[] _tiles;
}
/** The number of frames of animation for each direction. */
protected static final int NUM_DIR_FRAMES = 8;
}
@@ -1,5 +1,5 @@
//
// $Id: XMLMisoTileSetParser.java,v 1.3 2001/10/12 00:43:04 shaper Exp $
// $Id: XMLMisoTileSetParser.java,v 1.4 2001/10/15 23:53:43 shaper Exp $
package com.threerings.miso.tile;
@@ -17,8 +17,8 @@ import com.threerings.miso.scene.util.MisoSceneUtil;
public class XMLMisoTileSetParser extends XMLTileSetParser
{
// documentation inherited
public void startElement (String uri, String localName,
String qName, Attributes attributes)
public void startElement (
String uri, String localName, String qName, Attributes attributes)
{
super.startElement(uri, localName, qName, attributes);
@@ -29,12 +29,13 @@ public class XMLMisoTileSetParser extends XMLTileSetParser
}
// documentation inherited
protected void finishElement (String qName, String str)
protected void finishElement (
String uri, String localName, String qName, String data)
{
super.finishElement(qName, str);
super.finishElement(uri, localName, qName, data);
if (qName.equals("passable")) {
((MisoTileSetImpl)_tset).passable = StringUtil.parseIntArray(str);
((MisoTileSetImpl)_tset).passable = StringUtil.parseIntArray(data);
}
}