diff --git a/tests/src/java/com/threerings/cast/CharSpriteViz.java b/tests/src/java/com/threerings/cast/CharSpriteViz.java index 248e87c0f..44ca66ece 100644 --- a/tests/src/java/com/threerings/cast/CharSpriteViz.java +++ b/tests/src/java/com/threerings/cast/CharSpriteViz.java @@ -1,5 +1,5 @@ // -// $Id: CharSpriteViz.java,v 1.3 2003/01/13 22:57:45 mdb Exp $ +// $Id: CharSpriteViz.java,v 1.4 2003/02/12 07:24:07 mdb Exp $ package com.threerings.cast; @@ -40,7 +40,7 @@ public class CharSpriteViz extends JPanel // put the sprite in the appropriate action mode _sprite.setRestingAction(action); _sprite.setFollowingPathAction(action); - _sprite.setActionSequence(action, false); + _sprite.setActionSequence(action); addMouseMotionListener(this); } diff --git a/tests/src/java/com/threerings/miso/client/ScrollingScene.java b/tests/src/java/com/threerings/miso/client/ScrollingScene.java index bcc63d969..6594cd819 100644 --- a/tests/src/java/com/threerings/miso/client/ScrollingScene.java +++ b/tests/src/java/com/threerings/miso/client/ScrollingScene.java @@ -1,5 +1,5 @@ // -// $Id: ScrollingScene.java,v 1.11 2003/01/31 23:11:07 mdb Exp $ +// $Id: ScrollingScene.java,v 1.12 2003/02/12 07:24:07 mdb Exp $ package com.threerings.miso.client; @@ -26,7 +26,7 @@ import com.threerings.miso.util.MisoContext; /** * Provides an infinite array of tiles in which to scroll. */ -public class ScrollingScene implements DisplayMisoScene +public class ScrollingScene extends VirtualDisplayMisoSceneImpl { public ScrollingScene (MisoContext ctx) throws NoSuchTileSetException, NoSuchTileException, PersistenceException @@ -34,21 +34,25 @@ public class ScrollingScene implements DisplayMisoScene // locate the water tileset TileSetRepository tsrepo = ctx.getTileManager().getTileSetRepository(); Iterator iter = tsrepo.enumerateTileSets(); - TileSet wtset = null; + String tsname = null; while (iter.hasNext()) { TileSet tset = (TileSet)iter.next(); // yay for built-in regex support! if (tset.getName().matches(".*[Ww]ater.*") && tset instanceof BaseTileSet) { - wtset = tset; + tsname = tset.getName(); break; } } - if (wtset == null) { + if (tsname == null) { throw new RuntimeException("Unable to locate water tileset."); } + // now we look the tileset up by name so that it is properly + // initialized and all that business + TileSet wtset = ctx.getTileManager().getTileSet(tsname); + // grab our four repeating tiles _tiles = new BaseTile[wtset.getTileCount()]; for (int ii = 0; ii < wtset.getTileCount(); ii++) { @@ -65,24 +69,6 @@ public class ScrollingScene implements DisplayMisoScene return _tiles[tidx]; } - // documentation inherited from interface - public Tile getFringeTile (int x, int y) - { - return null; - } - - // documentation inherited from interface - public void getSceneObjects (Rectangle region, ObjectSet set) - { - // nothing for now - } - - // documentation inherited from interface - public boolean canTraverse (Object trav, int x, int y) - { - return true; - } - protected BaseTile[] _tiles; protected Random _rand = new Random(); diff --git a/tests/src/java/com/threerings/miso/client/ScrollingTestApp.java b/tests/src/java/com/threerings/miso/client/ScrollingTestApp.java index 5539c5f0d..0a6d1a901 100644 --- a/tests/src/java/com/threerings/miso/client/ScrollingTestApp.java +++ b/tests/src/java/com/threerings/miso/client/ScrollingTestApp.java @@ -1,5 +1,5 @@ // -// $Id: ScrollingTestApp.java,v 1.19 2003/01/31 23:11:07 mdb Exp $ +// $Id: ScrollingTestApp.java,v 1.20 2003/02/12 07:24:07 mdb Exp $ package com.threerings.miso.client; @@ -113,7 +113,7 @@ public class ScrollingTestApp if (_ship != null) { _ship.setFollowingPathAction("sailing"); _ship.setRestingAction("sailing"); - _ship.setActionSequence("sailing", true); + _ship.setActionSequence("sailing"); _ship.setLocation(_panel.getModel().bounds.width/2, _panel.getModel().bounds.height/2); _panel.addSprite(_ship); @@ -146,15 +146,6 @@ public class ScrollingTestApp int x = _ship.getX(), y = _ship.getY(); _ship.move(new LinePath(x, y, x, y + 1000, 3000l)); - // set the scene to our scrolling scene - try { - _panel.setScene(new ScrollingScene(ctx)); - - } catch (Exception e) { - Log.warning("Error creating scene: " + e); - Log.logStackTrace(e); - } - // size and position the window, entering full-screen exclusive // mode if available if (gd.isFullScreenSupported()) { @@ -168,6 +159,13 @@ public class ScrollingTestApp _frame.setSize(200, 300); SwingUtil.centerWindow(_frame); } + + try { + _panel.setScene(new ScrollingScene(ctx)); + } catch (Exception e) { + Log.warning("Error creating scene: " + e); + Log.logStackTrace(e); + } } /** diff --git a/tests/src/java/com/threerings/miso/viewer/ViewerApp.java b/tests/src/java/com/threerings/miso/viewer/ViewerApp.java index 7817f9382..8440df07f 100644 --- a/tests/src/java/com/threerings/miso/viewer/ViewerApp.java +++ b/tests/src/java/com/threerings/miso/viewer/ViewerApp.java @@ -1,5 +1,5 @@ // -// $Id: ViewerApp.java,v 1.36 2003/01/31 23:11:07 mdb Exp $ +// $Id: ViewerApp.java,v 1.37 2003/02/12 07:24:08 mdb Exp $ package com.threerings.miso.viewer; @@ -21,10 +21,10 @@ import com.threerings.cast.CharacterManager; import com.threerings.cast.bundle.BundledComponentRepository; import com.threerings.miso.Log; -import com.threerings.miso.client.DisplayMisoSceneImpl; -import com.threerings.miso.data.MisoSceneModel; +import com.threerings.miso.client.SimpleDisplayMisoSceneImpl; +import com.threerings.miso.data.SimpleMisoSceneModel; import com.threerings.miso.tile.MisoTileManager; -import com.threerings.miso.tools.xml.MisoSceneParser; +import com.threerings.miso.tools.xml.SimpleMisoSceneParser; import com.threerings.miso.util.MisoContext; /** @@ -88,14 +88,14 @@ public class ViewerApp // load up the scene specified by the user try { - MisoSceneParser parser = new MisoSceneParser("miso"); - MisoSceneModel model = parser.parseScene(args[0]); - if (model != null) { - _panel.setScene(new DisplayMisoSceneImpl(model, _tilemgr)); - } else { + SimpleMisoSceneParser parser = new SimpleMisoSceneParser("miso"); + SimpleMisoSceneModel model = parser.parseScene(args[0]); + if (model == null) { Log.warning("No miso scene found in scene file " + "[path=" + args[0] + "]."); + System.exit(-1); } + _panel.setScene(new SimpleDisplayMisoSceneImpl(model, _tilemgr)); } catch (Exception e) { Log.warning("Unable to parse scene [path=" + args[0] + "]."); @@ -165,7 +165,4 @@ public class ViewerApp /** The main panel. */ protected ViewerSceneViewPanel _panel; - - /** The default scene to load and display. */ - protected static final String DEF_SCENE = "rsrc/scenes/default.xml"; } diff --git a/tests/src/java/com/threerings/miso/viewer/ViewerFrame.java b/tests/src/java/com/threerings/miso/viewer/ViewerFrame.java index 87edecb32..28afe16fa 100644 --- a/tests/src/java/com/threerings/miso/viewer/ViewerFrame.java +++ b/tests/src/java/com/threerings/miso/viewer/ViewerFrame.java @@ -1,5 +1,5 @@ // -// $Id: ViewerFrame.java,v 1.33 2002/04/27 02:34:29 mdb Exp $ +// $Id: ViewerFrame.java,v 1.34 2003/02/12 07:24:08 mdb Exp $ package com.threerings.miso.viewer; @@ -7,6 +7,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.GraphicsConfiguration; +import java.awt.event.ActionEvent; import javax.swing.JFrame; import javax.swing.JMenu; @@ -63,5 +64,13 @@ public class ViewerFrame extends JFrame getContentPane().add(_panel, BorderLayout.CENTER); } + /** + * Dummy callback method. + */ + public void handlePreferences (ActionEvent event) + { + System.err.println("Nothing doing!"); + } + protected Component _panel; } diff --git a/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java b/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java index 3f3e246df..03009f23f 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.55 2003/01/31 23:11:07 mdb Exp $ +// $Id: ViewerSceneViewPanel.java,v 1.56 2003/02/12 07:24:08 mdb Exp $ package com.threerings.miso.viewer; @@ -92,7 +92,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel CharacterSprite s = charmgr.getCharacter(desc); if (s != null) { // start 'em out standing - s.setActionSequence(CharacterSprite.STANDING, false); + s.setActionSequence(CharacterSprite.STANDING); s.setLocation(300, 300); s.addSpriteObserver(this); spritemgr.addSprite(s); diff --git a/tests/src/java/com/threerings/whirled/TestClient.java b/tests/src/java/com/threerings/whirled/TestClient.java index e27d94ede..9afe12c12 100644 --- a/tests/src/java/com/threerings/whirled/TestClient.java +++ b/tests/src/java/com/threerings/whirled/TestClient.java @@ -1,5 +1,5 @@ // -// $Id: TestClient.java,v 1.14 2002/11/12 22:55:15 shaper Exp $ +// $Id: TestClient.java,v 1.15 2003/02/12 07:24:08 mdb Exp $ package com.threerings.whirled; @@ -11,11 +11,15 @@ import com.threerings.presents.net.*; import com.threerings.crowd.Log; import com.threerings.crowd.client.*; +import com.threerings.crowd.data.PlaceConfig; import com.threerings.crowd.data.PlaceObject; import com.threerings.whirled.client.SceneDirector; -import com.threerings.whirled.client.DefaultDisplaySceneFactory; import com.threerings.whirled.client.persist.SceneRepository; +import com.threerings.whirled.data.Scene; +import com.threerings.whirled.data.SceneImpl; +import com.threerings.whirled.data.SceneModel; +import com.threerings.whirled.util.SceneFactory; import com.threerings.whirled.util.WhirledContext; public class TestClient @@ -31,8 +35,13 @@ public class TestClient _screp = new DummyClientSceneRepository(); _occdir = new OccupantDirector(_ctx); _locdir = new LocationDirector(_ctx); - _scdir = new SceneDirector( - _ctx, _locdir, _screp, new DefaultDisplaySceneFactory()); + + SceneFactory sfact = new SceneFactory() { + public Scene createScene (SceneModel model, PlaceConfig config) { + return new SceneImpl(model, config); + } + }; + _scdir = new SceneDirector(_ctx, _locdir, _screp, sfact); // we want to know about logon/logoff _client.addClientObserver(this); diff --git a/tests/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneParserTest.java b/tests/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneParserTest.java index abfb2638b..437597493 100644 --- a/tests/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneParserTest.java +++ b/tests/src/java/com/threerings/whirled/spot/tools/xml/SpotSceneParserTest.java @@ -1,14 +1,14 @@ // -// $Id: SpotSceneParserTest.java,v 1.3 2002/02/09 07:50:04 mdb Exp $ +// $Id: SpotSceneParserTest.java,v 1.4 2003/02/12 07:24:08 mdb Exp $ -package com.threerings.whirled.tools.spot.xml; +package com.threerings.whirled.spot.tools.xml; import com.samskivert.test.TestUtil; import junit.framework.Test; import junit.framework.TestCase; -import com.threerings.whirled.tools.spot.EditableSpotScene; +import com.threerings.whirled.spot.data.SpotScene; public class SpotSceneParserTest extends TestCase { @@ -22,8 +22,8 @@ public class SpotSceneParserTest extends TestCase try { SpotSceneParser parser = new SpotSceneParser("scene"); String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH); - EditableSpotScene scene = parser.parseScene(tspath); - // System.out.println("Parsed " + scene.getSpotSceneModel() + "."); + SpotScene scene = parser.parseScene(tspath); + System.out.println("Parsed " + scene + "."); } catch (Exception e) { e.printStackTrace(); @@ -43,5 +43,5 @@ public class SpotSceneParserTest extends TestCase } protected static final String TEST_SCENE_PATH = - "rsrc/whirled/tools/spot/xml/scene.xml"; + "rsrc/whirled/spot/tools/xml/scene.xml"; } diff --git a/tests/src/java/com/threerings/whirled/tools/xml/SceneParserTest.java b/tests/src/java/com/threerings/whirled/tools/xml/SceneParserTest.java index e67abd536..0518cb984 100644 --- a/tests/src/java/com/threerings/whirled/tools/xml/SceneParserTest.java +++ b/tests/src/java/com/threerings/whirled/tools/xml/SceneParserTest.java @@ -1,5 +1,5 @@ // -// $Id: SceneParserTest.java,v 1.3 2002/02/09 07:50:04 mdb Exp $ +// $Id: SceneParserTest.java,v 1.4 2003/02/12 07:24:08 mdb Exp $ package com.threerings.whirled.tools.xml; @@ -8,7 +8,7 @@ import com.samskivert.test.TestUtil; import junit.framework.Test; import junit.framework.TestCase; -import com.threerings.whirled.tools.EditableScene; +import com.threerings.whirled.data.Scene; public class SceneParserTest extends TestCase { @@ -22,8 +22,8 @@ public class SceneParserTest extends TestCase try { SceneParser parser = new SceneParser("scene"); String tspath = TestUtil.getResourcePath(TEST_SCENE_PATH); - EditableScene scene = parser.parseScene(tspath); - // System.out.println("Parsed " + scene.getSceneModel() + "."); + Scene scene = parser.parseScene(tspath); + System.out.println("Parsed " + scene + "."); } catch (Exception e) { e.printStackTrace();