Fixed x,y vs. col,row thing once and for all. Also cleaned up object tile
footprint setting. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@711 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DisplayMisoSceneImpl.java,v 1.46 2001/11/29 19:30:51 mdb Exp $
|
||||
// $Id: DisplayMisoSceneImpl.java,v 1.47 2001/11/29 23:08:27 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class DisplayMisoSceneImpl
|
||||
for (int column = 0; column < shei; column++) {
|
||||
for (int row = 0; row < swid; row++) {
|
||||
// first do the base layer
|
||||
int tsid = model.baseTileIds[swid*column+row];
|
||||
int tsid = model.baseTileIds[swid*row+column];
|
||||
if (tsid > 0) {
|
||||
int tid = (tsid & 0xFFFF);
|
||||
tsid >>= 16;
|
||||
@@ -63,7 +63,7 @@ public class DisplayMisoSceneImpl
|
||||
}
|
||||
|
||||
// then the fringe layer
|
||||
tsid = model.fringeTileIds[swid*column+row];
|
||||
tsid = model.fringeTileIds[swid*row+column];
|
||||
if (tsid > 0) {
|
||||
int tid = (tsid & 0xFFFF);
|
||||
tsid >>= 16;
|
||||
@@ -82,8 +82,8 @@ public class DisplayMisoSceneImpl
|
||||
|
||||
// now populate the object layer
|
||||
for (int i = 0; i < ocount; i+= 3) {
|
||||
int row = model.objectTileIds[i];
|
||||
int col = model.objectTileIds[i+1];
|
||||
int col = model.objectTileIds[i];
|
||||
int row = model.objectTileIds[i+1];
|
||||
int tsid = model.objectTileIds[i+2];
|
||||
int tid = (tsid & 0xFFFF);
|
||||
tsid >>= 16;
|
||||
@@ -96,7 +96,7 @@ public class DisplayMisoSceneImpl
|
||||
// we have to generate a shadow for this object tile in the
|
||||
// base layer so that we can prevent sprites from walking on
|
||||
// the object
|
||||
generateObjectShadow(row, col);
|
||||
setObjectTileFootprint(otile, col, row, new ShadowTile(col, row));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,38 +129,29 @@ public class DisplayMisoSceneImpl
|
||||
return buf.append("]").toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Place shadow tiles in the footprint of the object tile at the given
|
||||
* coordinates in the scene. This method should be called when an
|
||||
* object tile is added to the scene.
|
||||
*
|
||||
* @param x the tile x-coordinate.
|
||||
* @param y the tile y-coordinate.
|
||||
*/
|
||||
protected void generateObjectShadow (int x, int y)
|
||||
{
|
||||
setObjectTileFootprint(x, y, new ShadowTile(x, y));
|
||||
}
|
||||
|
||||
/**
|
||||
* Place the given tile in the footprint of the object tile at the
|
||||
* given coordinates in the scene.
|
||||
*
|
||||
* @param otile the object tile whose footprint should be set.
|
||||
* @param x the tile x-coordinate.
|
||||
* @param y the tile y-coordinate.
|
||||
* @param stamp the tile to place in the object footprint.
|
||||
*/
|
||||
protected void setObjectTileFootprint (int x, int y, BaseTile stamp)
|
||||
protected void setObjectTileFootprint (
|
||||
ObjectTile otile, int x, int y, BaseTile stamp)
|
||||
{
|
||||
ObjectTile tile = _object.getTile(y, x);
|
||||
int endx = Math.max(0, (x - tile.getBaseWidth() + 1));
|
||||
int endy = Math.max(0, (y - tile.getBaseHeight() + 1));
|
||||
int endx = Math.max(0, (x - otile.getBaseWidth() + 1));
|
||||
int endy = Math.max(0, (y - otile.getBaseHeight() + 1));
|
||||
|
||||
for (int xx = x; xx >= endx; xx--) {
|
||||
for (int yy = y; yy >= endy; yy--) {
|
||||
_base.setTile(yy, xx, stamp);
|
||||
_base.setTile(xx, yy, stamp);
|
||||
}
|
||||
}
|
||||
|
||||
// Log.info("Set object tile footprint [tile=" + otile + ", sx=" + x +
|
||||
// ", sy=" + y + ", ex=" + endx + ", ey=" + endy + "].");
|
||||
}
|
||||
|
||||
/** The base layer of tiles. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: IsoSceneView.java,v 1.73 2001/11/27 22:17:42 mdb Exp $
|
||||
// $Id: IsoSceneView.java,v 1.74 2001/11/29 23:08:27 mdb Exp $
|
||||
|
||||
package com.threerings.miso.scene;
|
||||
|
||||
@@ -229,10 +229,10 @@ public class IsoSceneView implements SceneView
|
||||
|
||||
// draw the base and fringe tile images
|
||||
Tile tile;
|
||||
if ((tile = base.getTile(yy, xx)) != null) {
|
||||
if ((tile = base.getTile(xx, yy)) != null) {
|
||||
tile.paint(gfx, _polys[xx][yy]);
|
||||
}
|
||||
if ((tile = fringe.getTile(yy, xx)) != null) {
|
||||
if ((tile = fringe.getTile(xx, yy)) != null) {
|
||||
tile.paint(gfx, _polys[xx][yy]);
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,7 @@ public class IsoSceneView implements SceneView
|
||||
ObjectTileLayer tiles = _scene.getObjectLayer();
|
||||
for (int yy = 0; yy < tiles.getHeight(); yy++) {
|
||||
for (int xx = 0; xx < tiles.getWidth(); xx++) {
|
||||
ObjectTile tile = tiles.getTile(yy, xx);
|
||||
ObjectTile tile = tiles.getTile(xx, yy);
|
||||
if (tile != null) {
|
||||
generateObjectBounds(tile, xx, yy);
|
||||
}
|
||||
@@ -575,7 +575,7 @@ public class IsoSceneView implements SceneView
|
||||
Rectangle drect = poly.getBounds().intersection(r);
|
||||
int tx = coord >> 16, ty = coord & 0x0000FFFF;
|
||||
_dirtyItems.appendDirtyObject(
|
||||
tiles.getTile(ty, tx), poly, tx, ty, drect);
|
||||
tiles.getTile(tx, ty), poly, tx, ty, drect);
|
||||
// Log.info("Dirtied item: Object(" + tx + ", " +
|
||||
// ty + ")");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user