Oh the vast sweeping changes, and they're not even close to complete, but
things compile and most things run so this is a good time to checkpoint. Let me recall: - Refactored the whole scene deal. - Revamped the XML parser stuff (now uses Digester). - Rethought the tile management. - Started tile bundle stuff. - Wrote some tests. - Did a bit of Mike-ification. Onward and moreward. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@621 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: BuilderModel.java,v 1.2 2001/11/02 15:39:07 shaper Exp $
|
||||
// $Id: BuilderModel.java,v 1.3 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast.builder;
|
||||
package com.threerings.cast.tools.builder;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: BuilderModelListener.java,v 1.1 2001/11/02 01:10:28 shaper Exp $
|
||||
// $Id: BuilderModelListener.java,v 1.2 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast.builder;
|
||||
package com.threerings.cast.tools.builder;
|
||||
|
||||
/**
|
||||
* The builder model listener interface should be implemented by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: BuilderPanel.java,v 1.3 2001/11/02 01:10:28 shaper Exp $
|
||||
// $Id: BuilderPanel.java,v 1.4 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast.builder;
|
||||
package com.threerings.cast.tools.builder;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: ClassEditor.java,v 1.1 2001/11/02 01:10:28 shaper Exp $
|
||||
// $Id: ClassEditor.java,v 1.2 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast.builder;
|
||||
package com.threerings.cast.tools.builder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: ComponentPanel.java,v 1.4 2001/11/02 15:39:07 shaper Exp $
|
||||
// $Id: ComponentPanel.java,v 1.5 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast.builder;
|
||||
package com.threerings.cast.tools.builder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: SpritePanel.java,v 1.2 2001/11/02 01:10:28 shaper Exp $
|
||||
// $Id: SpritePanel.java,v 1.3 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast.builder;
|
||||
package com.threerings.cast.tools.builder;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.BorderFactory;
|
||||
|
||||
@@ -1,41 +1,36 @@
|
||||
//
|
||||
// $Id: XMLComponentParser.java,v 1.3 2001/11/01 01:40:42 shaper Exp $
|
||||
// $Id: XMLComponentParser.java,v 1.4 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast;
|
||||
package com.threerings.cast.tools.xml;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.xml.sax.*;
|
||||
|
||||
import com.samskivert.util.*;
|
||||
import com.samskivert.xml.SimpleParser;
|
||||
|
||||
import com.threerings.media.ImageManager;
|
||||
import com.threerings.media.tile.*;
|
||||
import com.threerings.media.tile.TileSet;
|
||||
import com.threerings.media.tile.xml.XMLTileSetParser;
|
||||
|
||||
import com.threerings.cast.Log;
|
||||
import com.threerings.cast.ActionSequence;
|
||||
import com.threerings.cast.ComponentClass;
|
||||
import com.threerings.cast.CharacterComponent;
|
||||
|
||||
/**
|
||||
* Parses an XML character component description file and populates
|
||||
* hashtables with {@link ActionSequence}, {@link ComponentClass}, and
|
||||
* the information necessary to construct {@link CharacterComponent}
|
||||
* objects.
|
||||
* hashtables with {@link ActionSequence}, {@link ComponentClass}, and the
|
||||
* information necessary to construct {@link CharacterComponent} objects.
|
||||
*
|
||||
* <p> Does not currently perform validation on the input XML stream,
|
||||
* though the parsing code assumes the XML document is well-formed.
|
||||
*/
|
||||
public class XMLComponentParser extends SimpleParser
|
||||
{
|
||||
/**
|
||||
* Constructs an xml component parser.
|
||||
*/
|
||||
public XMLComponentParser (ImageManager imgmgr)
|
||||
{
|
||||
_imgmgr = imgmgr;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void startElement (
|
||||
String uri, String localName, String qName, Attributes attributes)
|
||||
@@ -106,7 +101,7 @@ public class XMLComponentParser extends SimpleParser
|
||||
}
|
||||
|
||||
// parse the tile set description file
|
||||
XMLTileSetParser p = new XMLTileSetParser(_imgmgr);
|
||||
XMLTileSetParser p = new XMLTileSetParser();
|
||||
try {
|
||||
p.loadTileSets(path, _tilesets);
|
||||
} catch (IOException e) {
|
||||
@@ -127,11 +122,12 @@ public class XMLComponentParser extends SimpleParser
|
||||
as.name = attrs.getValue("name");
|
||||
as.fileid = attrs.getValue("fileid");
|
||||
|
||||
int tsid = parseInt(attrs.getValue("tsid"));
|
||||
as.tileset = (TileSet)_tilesets.get(tsid);
|
||||
String tileset = attrs.getValue("tileset");
|
||||
as.tileset = (TileSet)_tilesets.get(tileset);
|
||||
if (as.tileset == null) {
|
||||
Log.warning("Action sequence references non-existent " +
|
||||
"tile set [asid=" + as.asid + ", tsid=" + tsid + "].");
|
||||
"tile set [asid=" + as.asid +
|
||||
", tileset=" + tileset + "].");
|
||||
}
|
||||
|
||||
as.fps = parseInt(attrs.getValue("fps"));
|
||||
@@ -240,7 +236,7 @@ public class XMLComponentParser extends SimpleParser
|
||||
protected String _imagedir;
|
||||
|
||||
/** The hashtable of component tile sets. */
|
||||
protected HashIntMap _tilesets = new HashIntMap();
|
||||
protected HashMap _tilesets = new HashMap();
|
||||
|
||||
/** The hashtable of action sequences gathered while parsing. */
|
||||
protected HashIntMap _actions;
|
||||
@@ -250,7 +246,4 @@ public class XMLComponentParser extends SimpleParser
|
||||
|
||||
/** The hashtable of character components gathered while parsing. */
|
||||
protected HashIntMap _components;
|
||||
|
||||
/** The image manager. */
|
||||
protected ImageManager _imgmgr;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// $Id: XMLComponentRepository.java,v 1.6 2001/11/02 15:37:51 shaper Exp $
|
||||
// $Id: XMLComponentRepository.java,v 1.7 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene.xml;
|
||||
package com.threerings.cast.tools.xml;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@@ -29,12 +29,12 @@ public class XMLComponentRepository implements ComponentRepository
|
||||
/**
|
||||
* Constructs an xml component repository.
|
||||
*/
|
||||
public XMLComponentRepository (Config config, ImageManager imgmgr)
|
||||
public XMLComponentRepository (Config config)
|
||||
{
|
||||
// load component types and components
|
||||
String file = config.getValue(COMPONENTS_KEY, DEFAULT_COMPONENTS);
|
||||
try {
|
||||
XMLComponentParser p = new XMLComponentParser(imgmgr);
|
||||
XMLComponentParser p = new XMLComponentParser();
|
||||
p.loadComponents(file, _actions, _classes, _components);
|
||||
_imagedir = p.getImageDir();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: CastUtil.java,v 1.1 2001/11/02 15:28:20 shaper Exp $
|
||||
// $Id: CastUtil.java,v 1.2 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast.util;
|
||||
|
||||
@@ -7,10 +7,11 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.samskivert.util.CollectionUtil;
|
||||
|
||||
import com.threerings.media.util.RandomUtil;
|
||||
|
||||
import com.threerings.cast.*;
|
||||
import com.threerings.cast.CharacterDescriptor;
|
||||
import com.threerings.cast.CharacterManager;
|
||||
import com.threerings.cast.ComponentClass;
|
||||
|
||||
/**
|
||||
* Miscellaneous cast utility routines.
|
||||
@@ -18,11 +19,11 @@ import com.threerings.cast.*;
|
||||
public class CastUtil
|
||||
{
|
||||
/**
|
||||
* Returns a new character descriptor populated with a random set
|
||||
* of components.
|
||||
* Returns a new character descriptor populated with a random set of
|
||||
* components.
|
||||
*/
|
||||
public static CharacterDescriptor
|
||||
getRandomDescriptor (CharacterManager charmgr)
|
||||
public static CharacterDescriptor getRandomDescriptor (
|
||||
CharacterManager charmgr)
|
||||
{
|
||||
// get all available classes
|
||||
ArrayList classes = new ArrayList();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: TileUtil.java,v 1.2 2001/11/08 03:04:44 mdb Exp $
|
||||
// $Id: TileUtil.java,v 1.3 2001/11/18 04:09:21 mdb Exp $
|
||||
|
||||
package com.threerings.cast.util;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class TileUtil
|
||||
Image imgs[] = new Image[frameCount];
|
||||
for (int jj = 0; jj < frameCount; jj++) {
|
||||
int idx = (dir * frameCount) + jj;
|
||||
imgs[jj] = tset.getTile(idx).img;
|
||||
imgs[jj] = tset.getTileImage(idx);
|
||||
}
|
||||
|
||||
// create the multi frame image
|
||||
|
||||
Reference in New Issue
Block a user