Moved fringing code into base display miso scene and added code to fringe
a scene when it is first displayed. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1327 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DisplayMisoSceneImpl.java,v 1.56 2002/04/28 01:37:02 mdb Exp $
|
||||
// $Id: DisplayMisoSceneImpl.java,v 1.57 2002/05/03 04:12:48 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
@@ -17,6 +18,7 @@ import com.threerings.media.tile.Tile;
|
||||
import com.threerings.media.tile.TileLayer;
|
||||
|
||||
import com.threerings.miso.Log;
|
||||
import com.threerings.miso.tile.AutoFringer;
|
||||
import com.threerings.miso.tile.BaseTile;
|
||||
import com.threerings.miso.tile.BaseTileLayer;
|
||||
import com.threerings.miso.tile.MisoTileManager;
|
||||
@@ -90,6 +92,7 @@ public class DisplayMisoSceneImpl
|
||||
throws NoSuchTileException, NoSuchTileSetException
|
||||
{
|
||||
_tmgr = tmgr;
|
||||
_fringer = tmgr.getAutoFringer();
|
||||
populateLayers();
|
||||
}
|
||||
|
||||
@@ -105,6 +108,11 @@ public class DisplayMisoSceneImpl
|
||||
int swid = _base.getWidth();
|
||||
int shei = _base.getHeight();
|
||||
|
||||
// if we have a fringer, fill in our fringe
|
||||
if (_fringer != null) {
|
||||
_fringer.fringe(_model, _fringe, _rando);
|
||||
}
|
||||
|
||||
// populate the base and fringe layers
|
||||
for (int column = 0; column < shei; column++) {
|
||||
for (int row = 0; row < swid; row++) {
|
||||
@@ -282,4 +290,10 @@ public class DisplayMisoSceneImpl
|
||||
|
||||
/** A map from object tile to action string. */
|
||||
protected HashMap _actions = new HashMap();
|
||||
|
||||
/** The autofringer. */
|
||||
protected AutoFringer _fringer;
|
||||
|
||||
/** A random number generator for filling random base tiles and fringes. */
|
||||
protected Random _rando = new Random();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AutoFringer.java,v 1.9 2002/04/09 18:05:07 ray Exp $
|
||||
// $Id: AutoFringer.java,v 1.10 2002/05/03 04:12:48 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tile;
|
||||
|
||||
@@ -49,7 +49,15 @@ public class AutoFringer
|
||||
*/
|
||||
public void fringe (MisoSceneModel scene, TileLayer fringelayer, long seed)
|
||||
{
|
||||
Random rando = new Random(seed);
|
||||
fringe(scene, fringelayer, new Random(seed));
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically fringe the entire scene.
|
||||
*/
|
||||
public void fringe (
|
||||
MisoSceneModel scene, TileLayer fringelayer, Random rando)
|
||||
{
|
||||
fringe(scene, fringelayer,
|
||||
new Rectangle(0, 0, scene.width, scene.height), rando);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: EditableMisoSceneImpl.java,v 1.18 2002/04/28 03:14:15 mdb Exp $
|
||||
// $Id: EditableMisoSceneImpl.java,v 1.19 2002/05/03 04:12:48 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene.tools;
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.awt.Rectangle;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import com.threerings.media.tile.NoSuchTileException;
|
||||
import com.threerings.media.tile.NoSuchTileSetException;
|
||||
@@ -18,7 +17,6 @@ import com.threerings.media.tile.TileUtil;
|
||||
|
||||
import com.threerings.miso.Log;
|
||||
|
||||
import com.threerings.miso.tile.AutoFringer;
|
||||
import com.threerings.miso.tile.BaseTile;
|
||||
import com.threerings.miso.tile.BaseTileSet;
|
||||
import com.threerings.miso.tile.MisoTileManager;
|
||||
@@ -48,7 +46,6 @@ public class EditableMisoSceneImpl
|
||||
throws NoSuchTileException, NoSuchTileSetException
|
||||
{
|
||||
super(model, tmgr);
|
||||
_fringer = tmgr.getAutoFringer();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,8 +96,8 @@ public class EditableMisoSceneImpl
|
||||
|
||||
} catch (NoSuchTileException nste) {
|
||||
// not going to happen
|
||||
Log.warning("A tileset is lying to me [error=" + nste +
|
||||
"].");
|
||||
Log.warning("A tileset is lying to me " +
|
||||
"[error=" + nste + "].");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,10 +239,4 @@ public class EditableMisoSceneImpl
|
||||
|
||||
/** The tileset id of the default base tileset. */
|
||||
protected int _defaultBaseTileSetId;
|
||||
|
||||
/** The autofringer. */
|
||||
protected AutoFringer _fringer;
|
||||
|
||||
/** A random number generator for filling random base tiles and fringes. */
|
||||
protected Random _rando = new Random();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user