Disected and reassembled things so that a miso scene can be constructed
without a tile manager, which can be provided later, at which point all of the tiles will be resolved. Also made it possible to replace the model in a partially constructed scene. How's that for a turn of phrase: partially constructed scene. Wheee! git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@743 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: EditableMisoScene.java,v 1.8 2001/11/29 00:18:15 mdb Exp $
|
||||
// $Id: EditableMisoScene.java,v 1.9 2001/12/05 07:29:06 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tools.scene;
|
||||
|
||||
@@ -97,4 +97,10 @@ public interface EditableMisoScene
|
||||
* changes that have been made to this editable miso scene.
|
||||
*/
|
||||
public MisoSceneModel getMisoSceneModel ();
|
||||
|
||||
/**
|
||||
* Replaces the model in use by this editable miso scene with the
|
||||
* specified model.
|
||||
*/
|
||||
public void setMisoSceneModel (MisoSceneModel model);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: EditableMisoSceneImpl.java,v 1.5 2001/11/29 23:08:28 mdb Exp $
|
||||
// $Id: EditableMisoSceneImpl.java,v 1.6 2001/12/05 07:29:06 mdb Exp $
|
||||
|
||||
package com.threerings.miso.tools.scene;
|
||||
|
||||
@@ -36,21 +36,28 @@ public class EditableMisoSceneImpl
|
||||
throws NoSuchTileException, NoSuchTileSetException
|
||||
{
|
||||
super(model, tmgr);
|
||||
unpackObjectLayer();
|
||||
}
|
||||
|
||||
// we'll need to be keeping this
|
||||
_model = model;
|
||||
/**
|
||||
* Constructs an instance that will be used to display and edit the
|
||||
* supplied miso scene data. The tiles identified by the scene model
|
||||
* will not be loaded until a tile manager is provided via {@link
|
||||
* #setTileManager}.
|
||||
*
|
||||
* @param model the scene data that we'll be displaying.
|
||||
*/
|
||||
public EditableMisoSceneImpl (MisoSceneModel model)
|
||||
{
|
||||
super(model);
|
||||
unpackObjectLayer();
|
||||
}
|
||||
|
||||
// we need this to track object layer mods
|
||||
_objectTileIds = new int[_model.baseTileIds.length];
|
||||
|
||||
// populate our non-spare array
|
||||
int[] otids = model.objectTileIds;
|
||||
for (int i = 0; i < otids.length; i += 3) {
|
||||
int x = otids[i];
|
||||
int y = otids[i+1];
|
||||
int fqTileId = otids[i+2];
|
||||
_objectTileIds[model.width*y + x] = fqTileId;
|
||||
}
|
||||
// documentation inherited
|
||||
public void setMisoSceneModel (MisoSceneModel model)
|
||||
{
|
||||
super.setMisoSceneModel(model);
|
||||
unpackObjectLayer();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -170,9 +177,24 @@ public class EditableMisoSceneImpl
|
||||
return _model;
|
||||
}
|
||||
|
||||
/** Our scene model, which we always keep in sync with our display
|
||||
* model data. */
|
||||
protected MisoSceneModel _model;
|
||||
/**
|
||||
* Unpacks the object layer into an array that we can update along
|
||||
* with the other layers.
|
||||
*/
|
||||
protected void unpackObjectLayer ()
|
||||
{
|
||||
// we need this to track object layer mods
|
||||
_objectTileIds = new int[_model.baseTileIds.length];
|
||||
|
||||
// populate our non-spare array
|
||||
int[] otids = _model.objectTileIds;
|
||||
for (int i = 0; i < otids.length; i += 3) {
|
||||
int x = otids[i];
|
||||
int y = otids[i+1];
|
||||
int fqTileId = otids[i+2];
|
||||
_objectTileIds[_model.width*y + x] = fqTileId;
|
||||
}
|
||||
}
|
||||
|
||||
/** A non-sparse array where we can keep track of the object tile
|
||||
* ids. */
|
||||
|
||||
Reference in New Issue
Block a user