Changed MisoSceneModel so that it knows about the view width and height.

It no longer stores base tiles that are not visable in the view,
in fact it stores the base tiles in an array almost half the size as the
fully expanded scene array, and this new smaller array is used everywhere:
when saving the scene, serializing it to the user, or saving it in
the database.
We must now use the getBaseTile() and setBaseTile() methods to access the
base tiles because they are stored in this compressed format.
Also removed the fringe layer completely from the MisoSceneModel.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1369 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2002-05-17 19:06:23 +00:00
parent ab242f4a71
commit bb6b0f56ca
7 changed files with 180 additions and 86 deletions
@@ -1,5 +1,5 @@
//
// $Id: MisoSceneRuleSet.java,v 1.8 2002/05/16 02:25:19 ray Exp $
// $Id: MisoSceneRuleSet.java,v 1.9 2002/05/17 19:06:23 ray Exp $
package com.threerings.miso.scene.tools.xml;
@@ -9,6 +9,7 @@ import org.apache.commons.digester.RuleSetBase;
import com.samskivert.xml.CallMethodSpecialRule;
import com.samskivert.xml.SetFieldRule;
import com.threerings.miso.Log;
import com.threerings.miso.scene.MisoSceneModel;
/**
@@ -51,6 +52,10 @@ public class MisoSceneRuleSet extends RuleSetBase
new SetFieldRule(digester, "width"));
digester.addRule(_prefix + "/height",
new SetFieldRule(digester, "height"));
digester.addRule(_prefix + "/viewwidth",
new SetFieldRule(digester, "vwidth"));
digester.addRule(_prefix + "/viewheight",
new SetFieldRule(digester, "vheight"));
digester.addRule(_prefix + "/base",
new SetFieldRule(digester, "baseTileIds"));
digester.addRule(_prefix + "/object",
@@ -72,8 +77,13 @@ public class MisoSceneRuleSet extends RuleSetBase
model.objectActions = new String[1];
}
// and allocate the fringe tile layer
model.fringeTileIds = new int[model.baseTileIds.length];
// check to see if we've read in an old-style model.
// TODO: remove this someday after all our scenes are
// converted.
if (model.vwidth == 0) {
model.convertOldSchool(10, 12);
Log.info("Converted old-school MisoSceneModel.");
}
}
});
}
@@ -1,5 +1,5 @@
//
// $Id: MisoSceneWriter.java,v 1.6 2002/05/16 02:25:19 ray Exp $
// $Id: MisoSceneWriter.java,v 1.7 2002/05/17 19:06:23 ray Exp $
package com.threerings.miso.scene.tools.xml;
@@ -38,9 +38,10 @@ public class MisoSceneWriter
{
writer.dataElement("width", Integer.toString(model.width));
writer.dataElement("height", Integer.toString(model.height));
writer.dataElement("viewwidth", Integer.toString(model.vwidth));
writer.dataElement("viewheight", Integer.toString(model.vheight));
writer.dataElement("base",
StringUtil.toString(model.baseTileIds, "", ""));
// note that we don't write the fringe layer.
writer.dataElement("object",
StringUtil.toString(model.objectTileIds, "", ""));
writer.dataElement("actions",