diff --git a/src/java/com/threerings/cast/util/CastUtil.java b/src/java/com/threerings/cast/util/CastUtil.java index 81f514c79..232cb69a9 100644 --- a/src/java/com/threerings/cast/util/CastUtil.java +++ b/src/java/com/threerings/cast/util/CastUtil.java @@ -1,5 +1,5 @@ // -// $Id: CastUtil.java,v 1.2 2001/11/18 04:09:21 mdb Exp $ +// $Id: CastUtil.java,v 1.3 2001/11/27 08:06:57 mdb Exp $ package com.threerings.cast.util; @@ -12,6 +12,7 @@ import com.threerings.media.util.RandomUtil; import com.threerings.cast.CharacterDescriptor; import com.threerings.cast.CharacterManager; import com.threerings.cast.ComponentClass; +import com.threerings.cast.ComponentRepository; /** * Miscellaneous cast utility routines. @@ -23,11 +24,11 @@ public class CastUtil * components. */ public static CharacterDescriptor getRandomDescriptor ( - CharacterManager charmgr) + ComponentRepository crepo) { // get all available classes ArrayList classes = new ArrayList(); - CollectionUtil.addAll(classes, charmgr.enumerateComponentClasses()); + CollectionUtil.addAll(classes, crepo.enumerateComponentClasses()); // select the components int size = classes.size(); @@ -37,12 +38,12 @@ public class CastUtil // get the components available for this class ArrayList choices = new ArrayList(); - Iterator iter = charmgr.enumerateComponentsByClass(cclass.clid); + Iterator iter = crepo.enumerateComponentIds(cclass); CollectionUtil.addAll(choices, iter); // choose a random component int idx = RandomUtil.getInt(choices.size()); - components[cclass.clid] = ((Integer)choices.get(idx)).intValue(); + components[ii] = ((Integer)choices.get(idx)).intValue(); } return new CharacterDescriptor(components); diff --git a/tests/bin/bant b/tests/bin/bant new file mode 100755 index 000000000..b074adf4b --- /dev/null +++ b/tests/bin/bant @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Invokes ant with the necessary class to build the component bundles. + +BINDIR=`dirname $0` + +# add all JAR files in /usr/share/ant/lib/ to CLASSPATH +SYSTEMCP=`echo /usr/share/java/*.jar | tr ' ' ':'` +# add all JAR files in /usr/share/ant/lib/ to CLASSPATH +PROJECTCP=`echo $BINDIR/../../lib/*.jar | tr ' ' ':'` +# also add narya.jar +export CLASSPATH=$BINDIR/../../dist/narya.jar:$PROJECTCP:$SYSTEMCP +# and invoke ant with the proper target +ant "$@" cbundles diff --git a/tests/build.xml b/tests/build.xml index 992ed2a0c..4faf8fc61 100644 --- a/tests/build.xml +++ b/tests/build.xml @@ -11,6 +11,9 @@ + + + @@ -39,7 +42,8 @@ + debug="on" optimize="off" deprecation="off" + excludes="com/threerings/cast/builder/**"> @@ -59,4 +63,22 @@ + + + + + + + + + + + + + diff --git a/tests/rsrc/bundles/components/actions.xml b/tests/rsrc/bundles/components/actions.xml new file mode 100644 index 000000000..300efa009 --- /dev/null +++ b/tests/rsrc/bundles/components/actions.xml @@ -0,0 +1,29 @@ + + + + + + + 5 + 47,80 + + 94, 94, 94, 94, 94, 94, 94, 94 + 94, 94, 94, 94, 94, 94, 94, 94 + 1, 1, 1, 1, 1, 1, 1, 1 + 1, 1 + 39, 18 + + + + + 5 + 47,80 + + 94, 94, 94, 94, 94, 94, 94, 94 + 94, 94, 94, 94, 94, 94, 94, 94 + 6, 6, 6, 6, 6, 6, 6, 6 + 1, 1 + 39, 18 + + + diff --git a/tests/rsrc/bundles/components/classes.xml b/tests/rsrc/bundles/components/classes.xml new file mode 100644 index 000000000..38f8bca50 --- /dev/null +++ b/tests/rsrc/bundles/components/classes.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/rsrc/bundles/components/pirate/.cvsignore b/tests/rsrc/bundles/components/pirate/.cvsignore new file mode 100644 index 000000000..1a4f5c010 --- /dev/null +++ b/tests/rsrc/bundles/components/pirate/.cvsignore @@ -0,0 +1,2 @@ +*.jar +*.map diff --git a/tests/rsrc/bundles/components/pirate/male/hat/tri/standing.png b/tests/rsrc/bundles/components/pirate/male/hat/tri/standing.png new file mode 100644 index 000000000..5257e88a8 Binary files /dev/null and b/tests/rsrc/bundles/components/pirate/male/hat/tri/standing.png differ diff --git a/tests/rsrc/bundles/components/pirate/male/hat/tri/walking.png b/tests/rsrc/bundles/components/pirate/male/hat/tri/walking.png new file mode 100644 index 000000000..bb98a1655 Binary files /dev/null and b/tests/rsrc/bundles/components/pirate/male/hat/tri/walking.png differ diff --git a/tests/rsrc/bundles/components/pirate/male/torso/red/standing.png b/tests/rsrc/bundles/components/pirate/male/torso/red/standing.png new file mode 100644 index 000000000..0eff5f76b Binary files /dev/null and b/tests/rsrc/bundles/components/pirate/male/torso/red/standing.png differ diff --git a/tests/rsrc/bundles/components/pirate/male/torso/red/walking.png b/tests/rsrc/bundles/components/pirate/male/torso/red/walking.png new file mode 100644 index 000000000..20d79b979 Binary files /dev/null and b/tests/rsrc/bundles/components/pirate/male/torso/red/walking.png differ diff --git a/tests/rsrc/config/resource/manager.properties b/tests/rsrc/config/resource/manager.properties index 1137e7030..577a22650 100644 --- a/tests/rsrc/config/resource/manager.properties +++ b/tests/rsrc/config/resource/manager.properties @@ -1,7 +1,11 @@ # -# $Id: manager.properties,v 1.1 2001/11/21 02:42:16 mdb Exp $ +# $Id: manager.properties,v 1.2 2001/11/27 08:06:57 mdb Exp $ # # Test resource manager configuration # used to test the BundledTileSetRepository resource.set.bundle_test = rsrc/media/tools/tile/bundle.jar + +# used to test the BundledComponentRepository +resource.set.components = rsrc/bundles/components/pirate/metadata.jar:\ + rsrc/bundles/components/pirate/components.jar diff --git a/tests/src/java/com/threerings/cast/bundle/BundledComponentRepositoryTest.java b/tests/src/java/com/threerings/cast/bundle/BundledComponentRepositoryTest.java new file mode 100644 index 000000000..a796622dc --- /dev/null +++ b/tests/src/java/com/threerings/cast/bundle/BundledComponentRepositoryTest.java @@ -0,0 +1,41 @@ +// +// $Id: BundledComponentRepositoryTest.java,v 1.1 2001/11/27 08:06:57 mdb Exp $ + +package com.threerings.cast.bundle; + +import java.util.Iterator; +import com.samskivert.util.StringUtil; +import com.threerings.resource.ResourceManager; +import com.threerings.cast.ComponentClass; + +public class BundledComponentRepositoryTest +{ + public static void main (String[] args) + { + try { + ResourceManager rmgr = new ResourceManager(null, "rsrc"); + BundledComponentRepository repo = + new BundledComponentRepository(rmgr, "components"); + + System.out.println("Classes: " + StringUtil.toString( + repo.enumerateComponentClasses())); + + System.out.println("Actions: " + StringUtil.toString( + repo.enumerateActionSequences())); + + System.out.println("Action sets: " + StringUtil.toString( + repo._actionSets.values().iterator())); + + Iterator iter = repo.enumerateComponentClasses(); + while (iter.hasNext()) { + ComponentClass cclass = (ComponentClass)iter.next(); + System.out.println("IDs [" + cclass + "]: " + + StringUtil.toString( + repo.enumerateComponentIds(cclass))); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java b/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java index d92c8d8be..ecdbce82d 100644 --- a/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java +++ b/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java @@ -1,5 +1,5 @@ // -// $Id: ViewerSceneViewPanel.java,v 1.31 2001/11/18 04:09:21 mdb Exp $ +// $Id: ViewerSceneViewPanel.java,v 1.32 2001/11/27 08:06:57 mdb Exp $ package com.threerings.miso.viewer; @@ -47,9 +47,9 @@ public class ViewerSceneViewPanel extends SceneViewPanel // configure the character manager from which we obtain sprites charmgr.setCharacterClass(MisoCharacterSprite.class); - // create the character descriptors - _descUser = CastUtil.getRandomDescriptor(charmgr); - _descDecoy = CastUtil.getRandomDescriptor(charmgr); + // create the character descriptors FIXME + _descUser = CastUtil.getRandomDescriptor(null); + _descDecoy = CastUtil.getRandomDescriptor(null); // create the manipulable sprite _sprite = createSprite(spritemgr, charmgr, _descUser);