Need to specify gender information when generating character.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1157 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-03-27 20:31:11 +00:00
parent a76d37cc27
commit 97e04e29d7
2 changed files with 15 additions and 6 deletions
@@ -1,5 +1,5 @@
//
// $Id: CastUtil.java,v 1.6 2002/03/08 22:37:50 mdb Exp $
// $Id: CastUtil.java,v 1.7 2002/03/27 20:31:11 mdb Exp $
package com.threerings.cast.util;
@@ -7,12 +7,14 @@ import java.util.ArrayList;
import java.util.Iterator;
import com.samskivert.util.CollectionUtil;
import com.samskivert.util.StringUtil;
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;
import com.threerings.cast.Log;
/**
* Miscellaneous cast utility routines.
@@ -24,12 +26,19 @@ public class CastUtil
* components.
*/
public static CharacterDescriptor getRandomDescriptor (
ComponentRepository crepo)
String gender, ComponentRepository crepo)
{
// get all available classes
ArrayList classes = new ArrayList();
for (int i = 0; i < CLASSES.length; i++) {
classes.add(crepo.getComponentClass(CLASSES[i]));
String cname = gender + "/" + CLASSES[i];
ComponentClass cclass = crepo.getComponentClass(cname);
if (cclass == null) {
Log.warning("Missing definition for component class " +
"[class=" + cname + "].");
} else {
classes.add(cclass);
}
}
// select the components
@@ -1,5 +1,5 @@
//
// $Id: ViewerSceneViewPanel.java,v 1.42 2002/02/19 01:27:48 mdb Exp $
// $Id: ViewerSceneViewPanel.java,v 1.43 2002/03/27 20:31:11 mdb Exp $
package com.threerings.miso.viewer;
@@ -48,8 +48,8 @@ public class ViewerSceneViewPanel extends SceneViewPanel
super(new IsoSceneViewModel(ctx.getConfig()));
// create the character descriptors
_descUser = CastUtil.getRandomDescriptor(crepo);
_descDecoy = CastUtil.getRandomDescriptor(crepo);
_descUser = CastUtil.getRandomDescriptor("male", crepo);
_descDecoy = CastUtil.getRandomDescriptor("male", crepo);
// create the manipulable sprite
_sprite = createSprite(_spritemgr, charmgr, _descUser);