Changed Scene to MisoScene. Made MisoScene implement Whirled's Scene
interface. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@249 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DisplayMisoSceneImpl.java,v 1.27 2001/08/14 21:29:40 shaper Exp $
|
||||
// $Id: DisplayMisoSceneImpl.java,v 1.28 2001/08/15 01:08:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -8,18 +8,20 @@ import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.whirled.data.Scene;
|
||||
|
||||
import com.threerings.miso.Log;
|
||||
import com.threerings.miso.tile.Tile;
|
||||
import com.threerings.miso.tile.TileManager;
|
||||
import com.threerings.miso.scene.util.ClusterUtil;
|
||||
|
||||
/**
|
||||
* A Scene object represents the data model corresponding to a single
|
||||
* screen for game play. For instance, one scene might display a
|
||||
* portion of a street with several buildings scattered about on the
|
||||
* periphery.
|
||||
* A scene object represents the data model corresponding to a single
|
||||
* screen for game play. For instance, one scene might display a portion
|
||||
* of a street with several buildings scattered about on the periphery.
|
||||
*/
|
||||
public class Scene
|
||||
public class MisoScene implements Scene
|
||||
{
|
||||
/** The base layer id. */
|
||||
public static final int LAYER_BASE = 0;
|
||||
@@ -52,15 +54,15 @@ public class Scene
|
||||
public Tile tiles[][][];
|
||||
|
||||
/**
|
||||
* Construct a new Scene object. The base layer tiles are
|
||||
* initialized to contain tiles of the specified default tileset
|
||||
* and tile id.
|
||||
* Construct a new miso scene object. The base layer tiles are
|
||||
* initialized to contain tiles of the specified default tileset and
|
||||
* tile id.
|
||||
*
|
||||
* @param tilemgr the tile manager.
|
||||
* @param deftsid the default tileset id.
|
||||
* @param deftid the default tile id.
|
||||
*/
|
||||
public Scene (TileManager tilemgr, int deftsid, int deftid)
|
||||
public MisoScene (TileManager tilemgr, int deftsid, int deftid)
|
||||
{
|
||||
_tilemgr = tilemgr;
|
||||
|
||||
@@ -85,7 +87,7 @@ public class Scene
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Scene object with the given values.
|
||||
* Construct a new miso scene object with the given values.
|
||||
*
|
||||
* @param tilemgr the tile manager.
|
||||
* @param name the scene name.
|
||||
@@ -93,9 +95,9 @@ public class Scene
|
||||
* @param exits the exits.
|
||||
* @param tiles the tiles comprising the scene.
|
||||
*/
|
||||
public Scene (TileManager tilemgr, String name,
|
||||
ArrayList locations, ArrayList clusters, ArrayList exits,
|
||||
Tile tiles[][][])
|
||||
public MisoScene (
|
||||
TileManager tilemgr, String name, ArrayList locations,
|
||||
ArrayList clusters, ArrayList exits, Tile tiles[][][])
|
||||
{
|
||||
_tilemgr = tilemgr;
|
||||
_sid = SID_INVALID;
|
||||
@@ -212,11 +214,29 @@ public class Scene
|
||||
/**
|
||||
* Return the scene identifier.
|
||||
*/
|
||||
public short getId ()
|
||||
public int getId ()
|
||||
{
|
||||
return _sid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this scene's version number (which is incremented when it
|
||||
* is modified and stored into the scene repository).
|
||||
*/
|
||||
public int getVersion ()
|
||||
{
|
||||
// fake it for now
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the scene ids of the exits from this scene.
|
||||
*/
|
||||
public int[] getExitIds ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the scene locations list.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: IsoSceneView.java,v 1.43 2001/08/14 23:35:22 mdb Exp $
|
||||
// $Id: IsoSceneView.java,v 1.44 2001/08/15 01:08:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class IsoSceneView implements EditableSceneView
|
||||
_font = new Font("Arial", Font.PLAIN, 7);
|
||||
|
||||
// create the array used to mark dirty tiles
|
||||
_dirty = new boolean[Scene.TILE_WIDTH][Scene.TILE_HEIGHT];
|
||||
_dirty = new boolean[MisoScene.TILE_WIDTH][MisoScene.TILE_HEIGHT];
|
||||
|
||||
// create the list of dirty rectangles
|
||||
_dirtyRects = new ArrayList();
|
||||
@@ -103,8 +103,8 @@ public class IsoSceneView implements EditableSceneView
|
||||
_dirtyRects.clear();
|
||||
|
||||
_numDirty = 0;
|
||||
for (int xx = 0; xx < Scene.TILE_WIDTH; xx++) {
|
||||
for (int yy = 0; yy < Scene.TILE_HEIGHT; yy++) {
|
||||
for (int xx = 0; xx < MisoScene.TILE_WIDTH; xx++) {
|
||||
for (int yy = 0; yy < MisoScene.TILE_HEIGHT; yy++) {
|
||||
_dirty[xx][yy] = false;
|
||||
}
|
||||
}
|
||||
@@ -114,8 +114,8 @@ public class IsoSceneView implements EditableSceneView
|
||||
{
|
||||
// draw the dirty tiles
|
||||
gfx.setColor(Color.cyan);
|
||||
for (int xx = 0; xx < Scene.TILE_WIDTH; xx++) {
|
||||
for (int yy = 0; yy < Scene.TILE_HEIGHT; yy++) {
|
||||
for (int xx = 0; xx < MisoScene.TILE_WIDTH; xx++) {
|
||||
for (int yy = 0; yy < MisoScene.TILE_HEIGHT; yy++) {
|
||||
if (_dirty[xx][yy]) {
|
||||
gfx.draw(IsoUtil.getTilePolygon(_model, xx, yy));
|
||||
}
|
||||
@@ -140,8 +140,8 @@ public class IsoSceneView implements EditableSceneView
|
||||
{
|
||||
int numDrawn = 0;
|
||||
|
||||
for (int yy = 0; yy < Scene.TILE_HEIGHT; yy++) {
|
||||
for (int xx = 0; xx < Scene.TILE_WIDTH; xx++) {
|
||||
for (int yy = 0; yy < MisoScene.TILE_HEIGHT; yy++) {
|
||||
for (int xx = 0; xx < MisoScene.TILE_WIDTH; xx++) {
|
||||
|
||||
// skip this tile if it's not marked dirty
|
||||
if (!_dirty[xx][yy]) continue;
|
||||
@@ -150,7 +150,7 @@ public class IsoSceneView implements EditableSceneView
|
||||
Polygon poly = IsoUtil.getTilePolygon(_model, xx, yy);
|
||||
|
||||
// draw all layers at this tile position
|
||||
for (int kk = 0; kk < Scene.NUM_LAYERS; kk++) {
|
||||
for (int kk = 0; kk < MisoScene.NUM_LAYERS; kk++) {
|
||||
|
||||
// get the tile at these coordinates and layer
|
||||
Tile tile = _scene.tiles[xx][yy][kk];
|
||||
@@ -192,7 +192,7 @@ public class IsoSceneView implements EditableSceneView
|
||||
|
||||
for (int ii = 0; ii < _model.tilerows; ii++) {
|
||||
// determine starting tile coordinates
|
||||
int tx = (ii < Scene.TILE_HEIGHT) ? 0 : mx++;
|
||||
int tx = (ii < MisoScene.TILE_HEIGHT) ? 0 : mx++;
|
||||
int ty = my;
|
||||
|
||||
// determine number of tiles in this row
|
||||
@@ -203,7 +203,7 @@ public class IsoSceneView implements EditableSceneView
|
||||
|
||||
for (int jj = 0; jj < length; jj++) {
|
||||
|
||||
for (int kk = 0; kk < Scene.NUM_LAYERS; kk++) {
|
||||
for (int kk = 0; kk < MisoScene.NUM_LAYERS; kk++) {
|
||||
// grab the tile we're rendering
|
||||
Tile tile = _scene.tiles[tx][ty][kk];
|
||||
if (tile == null) continue;
|
||||
@@ -239,7 +239,9 @@ public class IsoSceneView implements EditableSceneView
|
||||
screenY += _model.tilehhei;
|
||||
|
||||
// advance starting y-axis coordinate unless we've hit bottom
|
||||
if ((++my) > Scene.TILE_HEIGHT - 1) my = Scene.TILE_HEIGHT - 1;
|
||||
if ((++my) > MisoScene.TILE_HEIGHT - 1) {
|
||||
my = MisoScene.TILE_HEIGHT - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,7 +512,7 @@ public class IsoSceneView implements EditableSceneView
|
||||
}
|
||||
}
|
||||
|
||||
public void setScene (Scene scene)
|
||||
public void setScene (MisoScene scene)
|
||||
{
|
||||
_scene = scene;
|
||||
}
|
||||
@@ -623,7 +625,7 @@ public class IsoSceneView implements EditableSceneView
|
||||
protected IsoSceneModel _model;
|
||||
|
||||
/** The scene object to be displayed. */
|
||||
protected Scene _scene;
|
||||
protected MisoScene _scene;
|
||||
|
||||
/** The sprite manager. */
|
||||
protected SpriteManager _spritemgr;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: IsoSceneViewModel.java,v 1.6 2001/08/10 21:17:07 shaper Exp $
|
||||
// $Id: IsoSceneViewModel.java,v 1.7 2001/08/15 01:08:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -149,7 +149,7 @@ public class IsoSceneModel
|
||||
(tilehwid * tilehwid) + (tilehhei * tilehhei));
|
||||
|
||||
// calculate the number of tile rows to render
|
||||
tilerows = (Scene.TILE_WIDTH * Scene.TILE_HEIGHT) - 1;
|
||||
tilerows = (MisoScene.TILE_WIDTH * MisoScene.TILE_HEIGHT) - 1;
|
||||
|
||||
// calculate the slope of the x- and y-axis lines
|
||||
slopeX = (float)tilehei / (float)tilewid;
|
||||
@@ -212,7 +212,7 @@ public class IsoSceneModel
|
||||
bX = (int)-(slopeX * origin.x);
|
||||
|
||||
// determine the ending point
|
||||
lineX[1].x = lineX[0].x + (tilehwid * Scene.TILE_WIDTH);
|
||||
lineX[1].x = lineX[0].x + (tilehwid * MisoScene.TILE_WIDTH);
|
||||
lineX[1].y = lineX[0].y + (int)((slopeX * lineX[1].x) + bX);
|
||||
|
||||
// calculate tile-based x-axis line for conversion from
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneView.java,v 1.10 2001/08/14 23:35:22 mdb Exp $
|
||||
// $Id: SceneView.java,v 1.11 2001/08/15 01:08:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface SceneView extends AnimatedView
|
||||
*
|
||||
* @param scene the scene to render in the view.
|
||||
*/
|
||||
public void setScene (Scene scene);
|
||||
public void setScene (MisoScene scene);
|
||||
|
||||
/**
|
||||
* Return a Path object detailing a valid path for the given
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: SceneViewPanel.java,v 1.5 2001/08/14 23:35:22 mdb Exp $
|
||||
// $Id: SceneViewPanel.java,v 1.6 2001/08/15 01:08:49 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SceneViewPanel extends JPanel
|
||||
/**
|
||||
* Set the scene managed by the panel.
|
||||
*/
|
||||
public void setScene (Scene scene)
|
||||
public void setScene (MisoScene scene)
|
||||
{
|
||||
_view.setScene(scene);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user