Formatting changes:
- removed tabs - explicitly specify imports - I made each comment a complete and punctuated sentance. - other minor convention changes git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1155 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,22 +1,24 @@
|
|||||||
//
|
//
|
||||||
// $Id: ColorUtil.java,v 1.1 2002/03/26 20:09:43 ray Exp $
|
// $Id: ColorUtil.java,v 1.2 2002/03/26 23:35:01 ray Exp $
|
||||||
|
|
||||||
package com.threerings.media.util;
|
package com.threerings.media.util;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities to manipulate colors
|
* Utilities to manipulate colors.
|
||||||
*/
|
*/
|
||||||
public class ColorUtil
|
public class ColorUtil
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return a color halfway between the two colors
|
* Blends the two supplied colors.
|
||||||
|
*
|
||||||
|
* @return a color halfway between the two colors.
|
||||||
*/
|
*/
|
||||||
public static final Color blend (Color c1, Color c2)
|
public static final Color blend (Color c1, Color c2)
|
||||||
{
|
{
|
||||||
return new Color((c1.getRed() + c2.getRed()) >> 1,
|
return new Color((c1.getRed() + c2.getRed()) >> 1,
|
||||||
(c1.getGreen() + c2.getGreen()) >> 1,
|
(c1.getGreen() + c2.getGreen()) >> 1,
|
||||||
(c1.getBlue() + c2.getBlue()) >> 1);
|
(c1.getBlue() + c2.getBlue()) >> 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ObjectTileLayer.java,v 1.2 2002/03/26 20:17:51 ray Exp $
|
// $Id: ObjectTileLayer.java,v 1.3 2002/03/26 23:35:01 ray Exp $
|
||||||
|
|
||||||
package com.threerings.media.tile;
|
package com.threerings.media.tile;
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ public final class ObjectTileLayer
|
|||||||
*/
|
*/
|
||||||
public ObjectTile getTile (int column, int row)
|
public ObjectTile getTile (int column, int row)
|
||||||
{
|
{
|
||||||
return (ObjectTile) _tiles.get(IsoUtil.coordsToKey(column, row));
|
return (ObjectTile) _tiles.get(IsoUtil.coordsToKey(column, row));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,15 +67,15 @@ public final class ObjectTileLayer
|
|||||||
*/
|
*/
|
||||||
public void setTile (int column, int row, ObjectTile tile)
|
public void setTile (int column, int row, ObjectTile tile)
|
||||||
{
|
{
|
||||||
_tiles.put(IsoUtil.coordsToKey(column, row), tile);
|
_tiles.put(IsoUtil.coordsToKey(column, row), tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the tile at the specified row and column
|
* Removes the tile at the specified row and column.
|
||||||
*/
|
*/
|
||||||
public void clearTile (int column, int row)
|
public void clearTile (int column, int row)
|
||||||
{
|
{
|
||||||
_tiles.remove(IsoUtil.coordsToKey(column, row));
|
_tiles.remove(IsoUtil.coordsToKey(column, row));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Our tiles. */
|
/** Our tiles. */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: DisplayMisoSceneImpl.java,v 1.52 2002/03/26 20:17:51 ray Exp $
|
// $Id: DisplayMisoSceneImpl.java,v 1.53 2002/03/26 23:35:01 ray Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene;
|
package com.threerings.miso.scene;
|
||||||
|
|
||||||
@@ -227,10 +227,14 @@ public class DisplayMisoSceneImpl
|
|||||||
int endy = Math.max(0, (y - otile.getBaseHeight() + 1));
|
int endy = Math.max(0, (y - otile.getBaseHeight() + 1));
|
||||||
|
|
||||||
for (int xx = x; xx >= endx; xx--) {
|
for (int xx = x; xx >= endx; xx--) {
|
||||||
if ((xx < 0) || (xx >= _model.width)) continue;
|
if ((xx < 0) || (xx >= _model.width)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (int yy = y; yy >= endy; yy--) {
|
for (int yy = y; yy >= endy; yy--) {
|
||||||
if ((yy < 0) || (yy >= _model.height)) continue;
|
if ((yy < 0) || (yy >= _model.height)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
BaseTile tile = _base.getTile(xx, yy);
|
BaseTile tile = _base.getTile(xx, yy);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: IsoSceneView.java,v 1.103 2002/03/26 20:17:51 ray Exp $
|
// $Id: IsoSceneView.java,v 1.104 2002/03/26 23:35:01 ray Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene;
|
package com.threerings.miso.scene;
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class IsoSceneView implements SceneView
|
|||||||
_scene = scene;
|
_scene = scene;
|
||||||
|
|
||||||
// clear all dirty lists and tile array
|
// clear all dirty lists and tile array
|
||||||
clearDirtyRegions();
|
clearDirtyRegions();
|
||||||
|
|
||||||
// obtain a list of the objects in the scene and generate records
|
// obtain a list of the objects in the scene and generate records
|
||||||
// for each of them that contain precomputed metrics
|
// for each of them that contain precomputed metrics
|
||||||
@@ -157,7 +157,7 @@ public class IsoSceneView implements SceneView
|
|||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public void paint (Graphics2D gfx, List invalidRects)
|
public void paint (Graphics2D gfx, List invalidRects)
|
||||||
{
|
{
|
||||||
if (_scene == null) {
|
if (_scene == null) {
|
||||||
Log.warning("Scene view painted with null scene.");
|
Log.warning("Scene view painted with null scene.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -194,16 +194,16 @@ public class IsoSceneView implements SceneView
|
|||||||
// clear out the dirty tiles and rectangles
|
// clear out the dirty tiles and rectangles
|
||||||
clearDirtyRegions();
|
clearDirtyRegions();
|
||||||
|
|
||||||
// draw sprite paths
|
// draw sprite paths
|
||||||
if (_model.showPaths) {
|
if (_model.showPaths) {
|
||||||
_spritemgr.renderSpritePaths(gfx);
|
_spritemgr.renderSpritePaths(gfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// paint our highlighted tile (if any)
|
// paint our highlighted tile (if any)
|
||||||
paintHighlights(gfx);
|
paintHighlights(gfx);
|
||||||
|
|
||||||
// paint any extra goodies
|
// paint any extra goodies
|
||||||
paintExtras(gfx);
|
paintExtras(gfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -243,15 +243,15 @@ public class IsoSceneView implements SceneView
|
|||||||
// if we've determined that there's something to highlight
|
// if we've determined that there's something to highlight
|
||||||
if (hpoly != null) {
|
if (hpoly != null) {
|
||||||
// set the desired stroke and color
|
// set the desired stroke and color
|
||||||
Stroke ostroke = gfx.getStroke();
|
Stroke ostroke = gfx.getStroke();
|
||||||
gfx.setStroke(_hstroke);
|
gfx.setStroke(_hstroke);
|
||||||
gfx.setColor(Color.green);
|
gfx.setColor(Color.green);
|
||||||
|
|
||||||
// draw the outline
|
// draw the outline
|
||||||
gfx.draw(hpoly);
|
gfx.draw(hpoly);
|
||||||
|
|
||||||
// restore the original stroke
|
// restore the original stroke
|
||||||
gfx.setStroke(ostroke);
|
gfx.setStroke(ostroke);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,12 +278,12 @@ public class IsoSceneView implements SceneView
|
|||||||
*/
|
*/
|
||||||
protected void clearDirtyRegions ()
|
protected void clearDirtyRegions ()
|
||||||
{
|
{
|
||||||
_dirtyRects.clear();
|
_dirtyRects.clear();
|
||||||
_dirtyItems.clear();
|
_dirtyItems.clear();
|
||||||
_numDirty = 0;
|
_numDirty = 0;
|
||||||
for (int xx = 0; xx < _model.scenewid; xx++) {
|
for (int xx = 0; xx < _model.scenewid; xx++) {
|
||||||
Arrays.fill(_dirty[xx], false);
|
Arrays.fill(_dirty[xx], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -291,25 +291,25 @@ public class IsoSceneView implements SceneView
|
|||||||
*/
|
*/
|
||||||
protected void drawDirtyRegions (Graphics2D gfx)
|
protected void drawDirtyRegions (Graphics2D gfx)
|
||||||
{
|
{
|
||||||
// draw the dirty tiles
|
// draw the dirty tiles
|
||||||
gfx.setColor(Color.cyan);
|
gfx.setColor(Color.cyan);
|
||||||
for (int xx = 0; xx < _model.scenewid; xx++) {
|
for (int xx = 0; xx < _model.scenewid; xx++) {
|
||||||
for (int yy = 0; yy < _model.scenehei; yy++) {
|
for (int yy = 0; yy < _model.scenehei; yy++) {
|
||||||
if (_dirty[xx][yy]) {
|
if (_dirty[xx][yy]) {
|
||||||
gfx.draw(getTilePoly(xx, yy));
|
gfx.draw(getTilePoly(xx, yy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the dirty rectangles
|
// draw the dirty rectangles
|
||||||
Stroke ostroke = gfx.getStroke();
|
Stroke ostroke = gfx.getStroke();
|
||||||
gfx.setStroke(DIRTY_RECT_STROKE);
|
gfx.setStroke(DIRTY_RECT_STROKE);
|
||||||
gfx.setColor(Color.red);
|
gfx.setColor(Color.red);
|
||||||
int size = _dirtyRects.size();
|
int size = _dirtyRects.size();
|
||||||
for (int ii = 0; ii < size; ii++) {
|
for (int ii = 0; ii < size; ii++) {
|
||||||
Rectangle rect = (Rectangle)_dirtyRects.get(ii);
|
Rectangle rect = (Rectangle)_dirtyRects.get(ii);
|
||||||
gfx.draw(rect);
|
gfx.draw(rect);
|
||||||
}
|
}
|
||||||
gfx.setStroke(ostroke);
|
gfx.setStroke(ostroke);
|
||||||
|
|
||||||
// draw the dirty item rectangles
|
// draw the dirty item rectangles
|
||||||
@@ -351,9 +351,9 @@ public class IsoSceneView implements SceneView
|
|||||||
protected void renderTiles (Graphics2D gfx)
|
protected void renderTiles (Graphics2D gfx)
|
||||||
{
|
{
|
||||||
// render the base and fringe layers
|
// render the base and fringe layers
|
||||||
for (int yy = 0; yy < _model.scenehei; yy++) {
|
for (int yy = 0; yy < _model.scenehei; yy++) {
|
||||||
for (int xx = 0; xx < _model.scenewid; xx++) {
|
for (int xx = 0; xx < _model.scenewid; xx++) {
|
||||||
if (!_dirty[xx][yy]) {
|
if (!_dirty[xx][yy]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,8 +373,8 @@ public class IsoSceneView implements SceneView
|
|||||||
if (_model.showCoords) {
|
if (_model.showCoords) {
|
||||||
gfx.draw(getTilePoly(xx, yy));
|
gfx.draw(getTilePoly(xx, yy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -415,8 +415,8 @@ public class IsoSceneView implements SceneView
|
|||||||
{
|
{
|
||||||
FontMetrics fm = gfx.getFontMetrics(_font);
|
FontMetrics fm = gfx.getFontMetrics(_font);
|
||||||
|
|
||||||
gfx.setFont(_font);
|
gfx.setFont(_font);
|
||||||
gfx.setColor(Color.white);
|
gfx.setColor(Color.white);
|
||||||
|
|
||||||
int cx = _model.tilehwid, cy = _model.tilehhei;
|
int cx = _model.tilehwid, cy = _model.tilehhei;
|
||||||
int fhei = fm.getAscent();
|
int fhei = fm.getAscent();
|
||||||
@@ -503,12 +503,12 @@ public class IsoSceneView implements SceneView
|
|||||||
*/
|
*/
|
||||||
protected Polygon getTilePoly (int x, int y)
|
protected Polygon getTilePoly (int x, int y)
|
||||||
{
|
{
|
||||||
int key = IsoUtil.coordsToKey(x, y);
|
int key = IsoUtil.coordsToKey(x, y);
|
||||||
|
|
||||||
Polygon poly = (Polygon) _polys.get(key);
|
Polygon poly = (Polygon) _polys.get(key);
|
||||||
if (poly == null) {
|
if (poly == null) {
|
||||||
poly = IsoUtil.getTilePolygon(_model, x, y);
|
poly = IsoUtil.getTilePolygon(_model, x, y);
|
||||||
_polys.put(key, poly);
|
_polys.put(key, poly);
|
||||||
}
|
}
|
||||||
return poly;
|
return poly;
|
||||||
}
|
}
|
||||||
@@ -548,91 +548,91 @@ public class IsoSceneView implements SceneView
|
|||||||
// invalidated rectangle
|
// invalidated rectangle
|
||||||
Rectangle tileBounds = new Rectangle(-1, -1, 0, 0);
|
Rectangle tileBounds = new Rectangle(-1, -1, 0, 0);
|
||||||
|
|
||||||
// note that corner tiles may be included unnecessarily, but
|
// note that corner tiles may be included unnecessarily, but
|
||||||
// checking to determine whether they're actually needed
|
// checking to determine whether they're actually needed
|
||||||
// complicates the code with likely-insufficient benefit
|
// complicates the code with likely-insufficient benefit
|
||||||
|
|
||||||
// determine the top-left tile impacted by this rect
|
// determine the top-left tile impacted by this rect
|
||||||
Point tpos = new Point();
|
Point tpos = new Point();
|
||||||
IsoUtil.screenToTile(_model, rx, ry, tpos);
|
IsoUtil.screenToTile(_model, rx, ry, tpos);
|
||||||
|
|
||||||
// determine screen coordinates for top-left tile
|
// determine screen coordinates for top-left tile
|
||||||
Point topleft = new Point();
|
Point topleft = new Point();
|
||||||
IsoUtil.tileToScreen(_model, tpos.x, tpos.y, topleft);
|
IsoUtil.tileToScreen(_model, tpos.x, tpos.y, topleft);
|
||||||
|
|
||||||
// determine number of horizontal tiles for rect
|
// determine number of horizontal tiles for rect
|
||||||
int numh = (int)Math.ceil((float)r.width / (float)_model.tilewid);
|
int numh = (int)Math.ceil((float)r.width / (float)_model.tilewid);
|
||||||
|
|
||||||
// set up iterating variables
|
// set up iterating variables
|
||||||
int tx = tpos.x, ty = tpos.y, mx = tpos.x, my = tpos.y;
|
int tx = tpos.x, ty = tpos.y, mx = tpos.x, my = tpos.y;
|
||||||
|
|
||||||
// set the starting screen y-position
|
// set the starting screen y-position
|
||||||
int screenY = topleft.y;
|
int screenY = topleft.y;
|
||||||
|
|
||||||
// add top row if rect may overlap
|
// add top row if rect may overlap
|
||||||
if (ry < (screenY + _model.tilehhei)) {
|
if (ry < (screenY + _model.tilehhei)) {
|
||||||
ty--;
|
ty--;
|
||||||
for (int ii = 0; ii < numh; ii++) {
|
for (int ii = 0; ii < numh; ii++) {
|
||||||
addDirtyTile(tileBounds, tx++, ty--);
|
addDirtyTile(tileBounds, tx++, ty--);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine the bottom-left tile impacted by this rect
|
// determine the bottom-left tile impacted by this rect
|
||||||
Point bpos = new Point();
|
Point bpos = new Point();
|
||||||
IsoUtil.screenToTile(_model, rx, ry + r.height, bpos);
|
IsoUtil.screenToTile(_model, rx, ry + r.height, bpos);
|
||||||
|
|
||||||
// determine screen coordinates for bottom-left tile
|
// determine screen coordinates for bottom-left tile
|
||||||
Point botleft = new Point();
|
Point botleft = new Point();
|
||||||
IsoUtil.tileToScreen(_model, bpos.x, bpos.y, botleft);
|
IsoUtil.tileToScreen(_model, bpos.x, bpos.y, botleft);
|
||||||
|
|
||||||
// determine the number of vertical rows for our rect (we do this
|
// determine the number of vertical rows for our rect (we do this
|
||||||
// by subtracting the "height" of the top tile from that of the
|
// by subtracting the "height" of the top tile from that of the
|
||||||
// bottom tile, the height being the sum of the x and y
|
// bottom tile, the height being the sum of the x and y
|
||||||
// coordinate)
|
// coordinate)
|
||||||
int numv = (bpos.x + bpos.y) - (tpos.x + tpos.y);
|
int numv = (bpos.x + bpos.y) - (tpos.x + tpos.y);
|
||||||
|
|
||||||
// now we need to extend the rect to contain the row containing
|
// now we need to extend the rect to contain the row containing
|
||||||
// the bottom tile, and potentially the row below that
|
// the bottom tile, and potentially the row below that
|
||||||
numv += ((ry + r.height) > (botleft.y + _model.tilehhei)) ? 2 : 1;
|
numv += ((ry + r.height) > (botleft.y + _model.tilehhei)) ? 2 : 1;
|
||||||
|
|
||||||
// add dirty tiles from each affected row
|
// add dirty tiles from each affected row
|
||||||
for (int ii = 0; ii < numv; ii++) {
|
for (int ii = 0; ii < numv; ii++) {
|
||||||
|
|
||||||
// set up iterating variables for this row
|
// set up iterating variables for this row
|
||||||
tx = mx;
|
tx = mx;
|
||||||
ty = my;
|
ty = my;
|
||||||
int length = numh;
|
int length = numh;
|
||||||
|
|
||||||
// set the starting screen x-position
|
// set the starting screen x-position
|
||||||
int screenX = topleft.x;
|
int screenX = topleft.x;
|
||||||
if (ii%2 == 1) {
|
if (ii%2 == 1) {
|
||||||
screenX -= _model.tilehwid;
|
screenX -= _model.tilehwid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip leftmost tile if rect doesn't overlap
|
// skip leftmost tile if rect doesn't overlap
|
||||||
if (rx > screenX + _model.tilewid) {
|
if (rx > screenX + _model.tilewid) {
|
||||||
tx++;
|
tx++;
|
||||||
ty--;
|
ty--;
|
||||||
screenX += _model.tilewid;
|
screenX += _model.tilewid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add to the right edge if rect may overlap
|
// add to the right edge if rect may overlap
|
||||||
if (rx + r.width > (screenX + (length * _model.tilewid))) {
|
if (rx + r.width > (screenX + (length * _model.tilewid))) {
|
||||||
length++;
|
length++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add all tiles in the row to the dirty set
|
// add all tiles in the row to the dirty set
|
||||||
for (int jj = 0; jj < length; jj++) {
|
for (int jj = 0; jj < length; jj++) {
|
||||||
addDirtyTile(tileBounds, tx++, ty--);
|
addDirtyTile(tileBounds, tx++, ty--);
|
||||||
}
|
}
|
||||||
|
|
||||||
// step along the x- or y-axis appropriately
|
// step along the x- or y-axis appropriately
|
||||||
if (ii%2 == 1) {
|
if (ii%2 == 1) {
|
||||||
mx++;
|
mx++;
|
||||||
} else {
|
} else {
|
||||||
my++;
|
my++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return tileBounds;
|
return tileBounds;
|
||||||
}
|
}
|
||||||
@@ -655,14 +655,14 @@ public class IsoSceneView implements SceneView
|
|||||||
tileBounds.add(bounds);
|
tileBounds.add(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do nothing if the tile's already dirty
|
// do nothing if the tile's already dirty
|
||||||
if (_dirty[x][y]) {
|
if (_dirty[x][y]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark the tile dirty
|
// mark the tile dirty
|
||||||
_numDirty++;
|
_numDirty++;
|
||||||
_dirty[x][y] = true;
|
_dirty[x][y] = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,11 +738,11 @@ public class IsoSceneView implements SceneView
|
|||||||
IsoUtil.screenToTile(_model, x + _xoff, y + _yoff, dest);
|
IsoUtil.screenToTile(_model, x + _xoff, y + _yoff, dest);
|
||||||
|
|
||||||
// get a reasonable tile path through the scene
|
// get a reasonable tile path through the scene
|
||||||
List points = AStarPathUtil.getPath(
|
List points = AStarPathUtil.getPath(
|
||||||
_scene, _model.scenewid, _model.scenehei,
|
_scene, _model.scenewid, _model.scenehei,
|
||||||
sprite, sprite.getTileX(), sprite.getTileY(), dest.x, dest.y);
|
sprite, sprite.getTileX(), sprite.getTileY(), dest.x, dest.y);
|
||||||
|
|
||||||
// construct a path object to guide the sprite on its merry way
|
// construct a path object to guide the sprite on its merry way
|
||||||
return (points == null) ? null :
|
return (points == null) ? null :
|
||||||
new TilePath(_model, sprite, points, x, y);
|
new TilePath(_model, sprite, points, x, y);
|
||||||
}
|
}
|
||||||
@@ -750,8 +750,8 @@ public class IsoSceneView implements SceneView
|
|||||||
// documentation inherited
|
// documentation inherited
|
||||||
public Point getScreenCoords (int x, int y)
|
public Point getScreenCoords (int x, int y)
|
||||||
{
|
{
|
||||||
Point coords = new Point();
|
Point coords = new Point();
|
||||||
IsoUtil.fullToScreen(_model, x, y, coords);
|
IsoUtil.fullToScreen(_model, x, y, coords);
|
||||||
// adjust for our scrolling offset
|
// adjust for our scrolling offset
|
||||||
coords.x -= _xoff;
|
coords.x -= _xoff;
|
||||||
coords.y -= _yoff;
|
coords.y -= _yoff;
|
||||||
@@ -895,7 +895,7 @@ public class IsoSceneView implements SceneView
|
|||||||
*/
|
*/
|
||||||
protected boolean updateTileCoords (int sx, int sy, Point tpos)
|
protected boolean updateTileCoords (int sx, int sy, Point tpos)
|
||||||
{
|
{
|
||||||
Point npos = new Point();
|
Point npos = new Point();
|
||||||
IsoUtil.screenToTile(_model, sx + _xoff, sy + _yoff, npos);
|
IsoUtil.screenToTile(_model, sx + _xoff, sy + _yoff, npos);
|
||||||
|
|
||||||
// make sure the new coordinate is both valid and different
|
// make sure the new coordinate is both valid and different
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: IsoUtil.java,v 1.23 2002/03/26 20:17:51 ray Exp $
|
// $Id: IsoUtil.java,v 1.24 2002/03/26 23:35:02 ray Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene.util;
|
package com.threerings.miso.scene.util;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public class IsoUtil
|
|||||||
IsoSceneViewModel model, Polygon root, ObjectTile tile)
|
IsoSceneViewModel model, Polygon root, ObjectTile tile)
|
||||||
{
|
{
|
||||||
Polygon boundsPoly = new SmartPolygon();
|
Polygon boundsPoly = new SmartPolygon();
|
||||||
Rectangle bounds = root.getBounds();
|
Rectangle bounds = root.getBounds();
|
||||||
|
|
||||||
int bwid = tile.getBaseWidth(), bhei = tile.getBaseHeight();
|
int bwid = tile.getBaseWidth(), bhei = tile.getBaseHeight();
|
||||||
int oox = bounds.x + model.tilehwid, ooy = bounds.y + model.tilehei;
|
int oox = bounds.x + model.tilehwid, ooy = bounds.y + model.tilehei;
|
||||||
@@ -107,7 +107,7 @@ public class IsoUtil
|
|||||||
public static Polygon getObjectBounds (
|
public static Polygon getObjectBounds (
|
||||||
IsoSceneViewModel model, Polygon root, ObjectTile tile)
|
IsoSceneViewModel model, Polygon root, ObjectTile tile)
|
||||||
{
|
{
|
||||||
Rectangle bounds = root.getBounds();
|
Rectangle bounds = root.getBounds();
|
||||||
|
|
||||||
// if the tile has an origin, use that, otherwise compute the
|
// if the tile has an origin, use that, otherwise compute the
|
||||||
// origin based on the tile footprint
|
// origin based on the tile footprint
|
||||||
@@ -178,41 +178,41 @@ public class IsoUtil
|
|||||||
* class's direction constants.
|
* class's direction constants.
|
||||||
*/
|
*/
|
||||||
public static int getDirection (
|
public static int getDirection (
|
||||||
IsoSceneViewModel model, int ax, int ay, int bx, int by)
|
IsoSceneViewModel model, int ax, int ay, int bx, int by)
|
||||||
{
|
{
|
||||||
Point afpos = new Point(), bfpos = new Point();
|
Point afpos = new Point(), bfpos = new Point();
|
||||||
|
|
||||||
// convert screen coordinates to full coordinates to get both
|
// convert screen coordinates to full coordinates to get both
|
||||||
// tile coordinates and fine coordinates
|
// tile coordinates and fine coordinates
|
||||||
screenToFull(model, ax, ay, afpos);
|
screenToFull(model, ax, ay, afpos);
|
||||||
screenToFull(model, bx, by, bfpos);
|
screenToFull(model, bx, by, bfpos);
|
||||||
|
|
||||||
// pull out the tile coordinates for each point
|
// pull out the tile coordinates for each point
|
||||||
int tax = afpos.x / FULL_TILE_FACTOR;
|
int tax = afpos.x / FULL_TILE_FACTOR;
|
||||||
int tay = afpos.y / FULL_TILE_FACTOR;
|
int tay = afpos.y / FULL_TILE_FACTOR;
|
||||||
|
|
||||||
int tbx = bfpos.x / FULL_TILE_FACTOR;
|
int tbx = bfpos.x / FULL_TILE_FACTOR;
|
||||||
int tby = bfpos.y / FULL_TILE_FACTOR;
|
int tby = bfpos.y / FULL_TILE_FACTOR;
|
||||||
|
|
||||||
// compare tile coordinates to determine direction
|
// compare tile coordinates to determine direction
|
||||||
int dir = getIsoDirection(tax, tay, tbx, tby);
|
int dir = getIsoDirection(tax, tay, tbx, tby);
|
||||||
if (dir != DirectionCodes.NONE) return dir;
|
if (dir != DirectionCodes.NONE) return dir;
|
||||||
|
|
||||||
// destination point is in the same tile as the
|
// destination point is in the same tile as the
|
||||||
// origination point, so consider fine coordinates
|
// origination point, so consider fine coordinates
|
||||||
|
|
||||||
// pull out the fine coordinates for each point
|
// pull out the fine coordinates for each point
|
||||||
int fax = afpos.x - (tax * FULL_TILE_FACTOR);
|
int fax = afpos.x - (tax * FULL_TILE_FACTOR);
|
||||||
int fay = afpos.y - (tay * FULL_TILE_FACTOR);
|
int fay = afpos.y - (tay * FULL_TILE_FACTOR);
|
||||||
|
|
||||||
int fbx = bfpos.x - (tbx * FULL_TILE_FACTOR);
|
int fbx = bfpos.x - (tbx * FULL_TILE_FACTOR);
|
||||||
int fby = bfpos.y - (tby * FULL_TILE_FACTOR);
|
int fby = bfpos.y - (tby * FULL_TILE_FACTOR);
|
||||||
|
|
||||||
// compare fine coordinates to determine direction
|
// compare fine coordinates to determine direction
|
||||||
dir = getIsoDirection(fax, fay, fbx, fby);
|
dir = getIsoDirection(fax, fay, fbx, fby);
|
||||||
|
|
||||||
// arbitrarily return southwest if fine coords were also equivalent
|
// arbitrarily return southwest if fine coords were also equivalent
|
||||||
return (dir == -1) ? SOUTHWEST : dir;
|
return (dir == -1) ? SOUTHWEST : dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,24 +233,24 @@ public class IsoUtil
|
|||||||
*/
|
*/
|
||||||
public static int getIsoDirection (int ax, int ay, int bx, int by)
|
public static int getIsoDirection (int ax, int ay, int bx, int by)
|
||||||
{
|
{
|
||||||
if (bx > ax) {
|
if (bx > ax) {
|
||||||
if (by == ay) {
|
if (by == ay) {
|
||||||
return SOUTH;
|
return SOUTH;
|
||||||
}
|
}
|
||||||
return (by < ay) ? SOUTHEAST : SOUTHWEST;
|
return (by < ay) ? SOUTHEAST : SOUTHWEST;
|
||||||
|
|
||||||
} else if (bx == ax) {
|
} else if (bx == ax) {
|
||||||
if (by == ay) {
|
if (by == ay) {
|
||||||
return DirectionCodes.NONE;
|
return DirectionCodes.NONE;
|
||||||
}
|
}
|
||||||
return (by < ay) ? EAST : WEST;
|
return (by < ay) ? EAST : WEST;
|
||||||
|
|
||||||
} else { // bx < ax
|
} else { // bx < ax
|
||||||
if (by == ay) {
|
if (by == ay) {
|
||||||
return NORTH;
|
return NORTH;
|
||||||
}
|
}
|
||||||
return (by < ay) ? NORTHEAST : NORTHWEST;
|
return (by < ay) ? NORTHEAST : NORTHWEST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -258,7 +258,7 @@ public class IsoUtil
|
|||||||
*/
|
*/
|
||||||
public static int fullToTile (int val)
|
public static int fullToTile (int val)
|
||||||
{
|
{
|
||||||
return (val / FULL_TILE_FACTOR);
|
return (val / FULL_TILE_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -266,7 +266,7 @@ public class IsoUtil
|
|||||||
*/
|
*/
|
||||||
public static int fullToFine (int val)
|
public static int fullToFine (int val)
|
||||||
{
|
{
|
||||||
return (val - ((val / FULL_TILE_FACTOR) * FULL_TILE_FACTOR));
|
return (val - ((val / FULL_TILE_FACTOR) * FULL_TILE_FACTOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -279,24 +279,24 @@ public class IsoUtil
|
|||||||
* @param tpos the point object to place coordinates in.
|
* @param tpos the point object to place coordinates in.
|
||||||
*/
|
*/
|
||||||
public static void screenToTile (
|
public static void screenToTile (
|
||||||
IsoSceneViewModel model, int sx, int sy, Point tpos)
|
IsoSceneViewModel model, int sx, int sy, Point tpos)
|
||||||
{
|
{
|
||||||
// calculate line parallel to the y-axis (from mouse pos to x-axis)
|
// calculate line parallel to the y-axis (from mouse pos to x-axis)
|
||||||
int bY = (int)(sy - (model.slopeY * sx));
|
int bY = (int)(sy - (model.slopeY * sx));
|
||||||
|
|
||||||
// determine intersection of x- and y-axis lines
|
// determine intersection of x- and y-axis lines
|
||||||
int crossx = (int)((bY - (model.bX + model.origin.y)) /
|
int crossx = (int)((bY - (model.bX + model.origin.y)) /
|
||||||
(model.slopeX - model.slopeY));
|
(model.slopeX - model.slopeY));
|
||||||
int crossy = (int)((model.slopeY * crossx) + bY);
|
int crossy = (int)((model.slopeY * crossx) + bY);
|
||||||
|
|
||||||
// determine distance of mouse pos along the x axis
|
// determine distance of mouse pos along the x axis
|
||||||
int xdist = (int)MathUtil.distance(
|
int xdist = (int)MathUtil.distance(
|
||||||
model.origin.x, model.origin.y, crossx, crossy);
|
model.origin.x, model.origin.y, crossx, crossy);
|
||||||
tpos.x = (int)(xdist / model.tilelen);
|
tpos.x = (int)(xdist / model.tilelen);
|
||||||
|
|
||||||
// determine distance of mouse pos along the y-axis
|
// determine distance of mouse pos along the y-axis
|
||||||
int ydist = (int)MathUtil.distance(sx, sy, crossx, crossy);
|
int ydist = (int)MathUtil.distance(sx, sy, crossx, crossy);
|
||||||
tpos.y = (int)(ydist / model.tilelen);
|
tpos.y = (int)(ydist / model.tilelen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -309,7 +309,7 @@ public class IsoUtil
|
|||||||
* @param spos the point object to place coordinates in.
|
* @param spos the point object to place coordinates in.
|
||||||
*/
|
*/
|
||||||
public static void tileToScreen (
|
public static void tileToScreen (
|
||||||
IsoSceneViewModel model, int x, int y, Point spos)
|
IsoSceneViewModel model, int x, int y, Point spos)
|
||||||
{
|
{
|
||||||
spos.x = model.origin.x + ((x - y - 1) * model.tilehwid);
|
spos.x = model.origin.x + ((x - y - 1) * model.tilehwid);
|
||||||
spos.y = model.origin.y + ((x + y) * model.tilehhei);
|
spos.y = model.origin.y + ((x + y) * model.tilehhei);
|
||||||
@@ -325,10 +325,10 @@ public class IsoUtil
|
|||||||
* @param ppos the point object to place coordinates in.
|
* @param ppos the point object to place coordinates in.
|
||||||
*/
|
*/
|
||||||
public static void fineToPixel (
|
public static void fineToPixel (
|
||||||
IsoSceneViewModel model, int x, int y, Point ppos)
|
IsoSceneViewModel model, int x, int y, Point ppos)
|
||||||
{
|
{
|
||||||
ppos.x = model.tilehwid + ((x - y) * model.finehwid);
|
ppos.x = model.tilehwid + ((x - y) * model.finehwid);
|
||||||
ppos.y = (x + y) * model.finehhei;
|
ppos.y = (x + y) * model.finehhei;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,28 +342,28 @@ public class IsoUtil
|
|||||||
* @param fpos the point object to place coordinates in.
|
* @param fpos the point object to place coordinates in.
|
||||||
*/
|
*/
|
||||||
public static void pixelToFine (
|
public static void pixelToFine (
|
||||||
IsoSceneViewModel model, int x, int y, Point fpos)
|
IsoSceneViewModel model, int x, int y, Point fpos)
|
||||||
{
|
{
|
||||||
// calculate line parallel to the y-axis (from the given
|
// calculate line parallel to the y-axis (from the given
|
||||||
// x/y-pos to the x-axis)
|
// x/y-pos to the x-axis)
|
||||||
float bY = y - (model.fineSlopeY * x);
|
float bY = y - (model.fineSlopeY * x);
|
||||||
|
|
||||||
// determine intersection of x- and y-axis lines
|
// determine intersection of x- and y-axis lines
|
||||||
int crossx = (int)((bY - model.fineBX) /
|
int crossx = (int)((bY - model.fineBX) /
|
||||||
(model.fineSlopeX - model.fineSlopeY));
|
(model.fineSlopeX - model.fineSlopeY));
|
||||||
int crossy = (int)((model.fineSlopeY * crossx) + bY);
|
int crossy = (int)((model.fineSlopeY * crossx) + bY);
|
||||||
|
|
||||||
// TODO: final position should check distance between our
|
// TODO: final position should check distance between our
|
||||||
// position and the surrounding fine coords and return the
|
// position and the surrounding fine coords and return the
|
||||||
// actual closest fine coord, rather than just dividing.
|
// actual closest fine coord, rather than just dividing.
|
||||||
|
|
||||||
// determine distance along the x-axis
|
// determine distance along the x-axis
|
||||||
float xdist = MathUtil.distance(model.tilehwid, 0, crossx, crossy);
|
float xdist = MathUtil.distance(model.tilehwid, 0, crossx, crossy);
|
||||||
fpos.x = (int)(xdist / model.finelen);
|
fpos.x = (int)(xdist / model.finelen);
|
||||||
|
|
||||||
// determine distance along the y-axis
|
// determine distance along the y-axis
|
||||||
float ydist = MathUtil.distance(x, y, crossx, crossy);
|
float ydist = MathUtil.distance(x, y, crossx, crossy);
|
||||||
fpos.y = (int)(ydist / model.finelen);
|
fpos.y = (int)(ydist / model.finelen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -377,22 +377,22 @@ public class IsoUtil
|
|||||||
* @param fpos the point object to place coordinates in.
|
* @param fpos the point object to place coordinates in.
|
||||||
*/
|
*/
|
||||||
public static void screenToFull (
|
public static void screenToFull (
|
||||||
IsoSceneViewModel model, int sx, int sy, Point fpos)
|
IsoSceneViewModel model, int sx, int sy, Point fpos)
|
||||||
{
|
{
|
||||||
// get the tile coordinates
|
// get the tile coordinates
|
||||||
Point tpos = new Point();
|
Point tpos = new Point();
|
||||||
screenToTile(model, sx, sy, tpos);
|
screenToTile(model, sx, sy, tpos);
|
||||||
|
|
||||||
// get the screen coordinates for the containing tile
|
// get the screen coordinates for the containing tile
|
||||||
Point spos = new Point();
|
Point spos = new Point();
|
||||||
tileToScreen(model, tpos.x, tpos.y, spos);
|
tileToScreen(model, tpos.x, tpos.y, spos);
|
||||||
|
|
||||||
// get the fine coordinates within the containing tile
|
// get the fine coordinates within the containing tile
|
||||||
pixelToFine(model, sx - spos.x, sy - spos.y, fpos);
|
pixelToFine(model, sx - spos.x, sy - spos.y, fpos);
|
||||||
|
|
||||||
// toss in the tile coordinates for good measure
|
// toss in the tile coordinates for good measure
|
||||||
fpos.x += (tpos.x * FULL_TILE_FACTOR);
|
fpos.x += (tpos.x * FULL_TILE_FACTOR);
|
||||||
fpos.y += (tpos.y * FULL_TILE_FACTOR);
|
fpos.y += (tpos.y * FULL_TILE_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -405,21 +405,21 @@ public class IsoUtil
|
|||||||
* @param spos the point object to place coordinates in.
|
* @param spos the point object to place coordinates in.
|
||||||
*/
|
*/
|
||||||
public static void fullToScreen (
|
public static void fullToScreen (
|
||||||
IsoSceneViewModel model, int x, int y, Point spos)
|
IsoSceneViewModel model, int x, int y, Point spos)
|
||||||
{
|
{
|
||||||
// get the tile screen position
|
// get the tile screen position
|
||||||
Point tspos = new Point();
|
Point tspos = new Point();
|
||||||
int tx = x / FULL_TILE_FACTOR, ty = y / FULL_TILE_FACTOR;
|
int tx = x / FULL_TILE_FACTOR, ty = y / FULL_TILE_FACTOR;
|
||||||
tileToScreen(model, tx, ty, tspos);
|
tileToScreen(model, tx, ty, tspos);
|
||||||
|
|
||||||
// get the pixel position of the fine coords within the tile
|
// get the pixel position of the fine coords within the tile
|
||||||
Point ppos = new Point();
|
Point ppos = new Point();
|
||||||
int fx = x - (tx * FULL_TILE_FACTOR), fy = y - (ty * FULL_TILE_FACTOR);
|
int fx = x - (tx * FULL_TILE_FACTOR), fy = y - (ty * FULL_TILE_FACTOR);
|
||||||
fineToPixel(model, fx, fy, ppos);
|
fineToPixel(model, fx, fy, ppos);
|
||||||
|
|
||||||
// final position is tile position offset by fine position
|
// final position is tile position offset by fine position
|
||||||
spos.x = tspos.x + ppos.x;
|
spos.x = tspos.x + ppos.x;
|
||||||
spos.y = tspos.y + ppos.y;
|
spos.y = tspos.y + ppos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -429,7 +429,7 @@ public class IsoUtil
|
|||||||
* @param y the tile y-position coordinate.
|
* @param y the tile y-position coordinate.
|
||||||
*/
|
*/
|
||||||
public static Polygon getTilePolygon (
|
public static Polygon getTilePolygon (
|
||||||
IsoSceneViewModel model, int x, int y)
|
IsoSceneViewModel model, int x, int y)
|
||||||
{
|
{
|
||||||
// get the top-left screen coordinate for the tile
|
// get the top-left screen coordinate for the tile
|
||||||
Point spos = new Point();
|
Point spos = new Point();
|
||||||
@@ -447,27 +447,33 @@ public class IsoUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the hash key, give x and y
|
* Turns x and y scene coordinates into an integer key.
|
||||||
|
*
|
||||||
|
* @return the hash key, given x and y.
|
||||||
*/
|
*/
|
||||||
public static final int coordsToKey (int x, int y)
|
public static final int coordsToKey (int x, int y)
|
||||||
{
|
{
|
||||||
return ((y << 16) & (0xFFFF0000)) | (x & 0xFFFF);
|
return ((y << 16) & (0xFFFF0000)) | (x & 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the x coordinate from the hash key
|
* Gets the x coordinate from an integer hash key.
|
||||||
|
*
|
||||||
|
* @return the x coordinate.
|
||||||
*/
|
*/
|
||||||
public static final int xCoordFromKey (int key)
|
public static final int xCoordFromKey (int key)
|
||||||
{
|
{
|
||||||
return (key & 0xFFFF);
|
return (key & 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the y coordinate from the hash key
|
* Gets the y coordinate from an integer hash key.
|
||||||
|
*
|
||||||
|
* @return the y coordinate from the hash key.
|
||||||
*/
|
*/
|
||||||
public static final int yCoordFromKey (int key)
|
public static final int yCoordFromKey (int key)
|
||||||
{
|
{
|
||||||
return ((key >> 16) & 0xFFFF);
|
return ((key >> 16) & 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Multiplication factor to embed tile coords in full coords. */
|
/** Multiplication factor to embed tile coords in full coords. */
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
//
|
//
|
||||||
// $Id: EditableMisoSceneImpl.java,v 1.10 2002/03/26 20:17:51 ray Exp $
|
// $Id: EditableMisoSceneImpl.java,v 1.11 2002/03/26 23:35:02 ray Exp $
|
||||||
|
|
||||||
package com.threerings.miso.scene.tools;
|
package com.threerings.miso.scene.tools;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import com.samskivert.util.HashIntMap;
|
import com.samskivert.util.HashIntMap;
|
||||||
|
|
||||||
import com.threerings.media.tile.NoSuchTileException;
|
import com.threerings.media.tile.NoSuchTileException;
|
||||||
@@ -17,8 +19,6 @@ import com.threerings.miso.scene.DisplayMisoSceneImpl;
|
|||||||
import com.threerings.miso.scene.MisoSceneModel;
|
import com.threerings.miso.scene.MisoSceneModel;
|
||||||
import com.threerings.miso.scene.util.IsoUtil;
|
import com.threerings.miso.scene.util.IsoUtil;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default implementation of the {@link EditableMisoScene} interface.
|
* The default implementation of the {@link EditableMisoScene} interface.
|
||||||
*/
|
*/
|
||||||
@@ -108,7 +108,7 @@ public class EditableMisoSceneImpl
|
|||||||
// object tile
|
// object tile
|
||||||
setObjectTileFootprint(tile, x, y, true);
|
setObjectTileFootprint(tile, x, y, true);
|
||||||
// stick this value into our non-sparse object layer
|
// stick this value into our non-sparse object layer
|
||||||
_objectTileIds.put(IsoUtil.coordsToKey(x, y), new Integer(fqTileId));
|
_objectTileIds.put(IsoUtil.coordsToKey(x, y), new Integer(fqTileId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
@@ -145,7 +145,7 @@ public class EditableMisoSceneImpl
|
|||||||
_object.clearTile(x, y);
|
_object.clearTile(x, y);
|
||||||
}
|
}
|
||||||
// clear it out in our non-sparse array
|
// clear it out in our non-sparse array
|
||||||
_objectTileIds.remove(IsoUtil.coordsToKey(x, y));
|
_objectTileIds.remove(IsoUtil.coordsToKey(x, y));
|
||||||
// clear out any action for this tile as well
|
// clear out any action for this tile as well
|
||||||
_actions.remove(objectKey(x, y));
|
_actions.remove(objectKey(x, y));
|
||||||
}
|
}
|
||||||
@@ -170,15 +170,15 @@ public class EditableMisoSceneImpl
|
|||||||
String[] actions = new String[otileCount];
|
String[] actions = new String[otileCount];
|
||||||
int otidx = 0, actidx = 0;
|
int otidx = 0, actidx = 0;
|
||||||
|
|
||||||
Iterator keys = _objectTileIds.keys();
|
Iterator keys = _objectTileIds.keys();
|
||||||
while (keys.hasNext()) {
|
while (keys.hasNext()) {
|
||||||
int key = ((Integer) keys.next()).intValue();
|
int key = ((Integer) keys.next()).intValue();
|
||||||
int c = IsoUtil.xCoordFromKey(key);
|
int c = IsoUtil.xCoordFromKey(key);
|
||||||
int r = IsoUtil.yCoordFromKey(key);
|
int r = IsoUtil.yCoordFromKey(key);
|
||||||
otids[otidx++] = c;
|
otids[otidx++] = c;
|
||||||
otids[otidx++] = r;
|
otids[otidx++] = r;
|
||||||
otids[otidx++] = ((Integer) _objectTileIds.get(key)).intValue();
|
otids[otidx++] = ((Integer) _objectTileIds.get(key)).intValue();
|
||||||
actions[actidx++] = (String)_actions.get(objectKey(c, r));
|
actions[actidx++] = (String)_actions.get(objectKey(c, r));
|
||||||
}
|
}
|
||||||
|
|
||||||
// stuff the new arrays into the model
|
// stuff the new arrays into the model
|
||||||
@@ -196,7 +196,7 @@ public class EditableMisoSceneImpl
|
|||||||
protected void unpackObjectLayer ()
|
protected void unpackObjectLayer ()
|
||||||
{
|
{
|
||||||
// we need this to track object layer mods
|
// we need this to track object layer mods
|
||||||
_objectTileIds = new HashIntMap();
|
_objectTileIds = new HashIntMap();
|
||||||
|
|
||||||
// populate our non-spare array
|
// populate our non-spare array
|
||||||
int[] otids = _model.objectTileIds;
|
int[] otids = _model.objectTileIds;
|
||||||
@@ -204,8 +204,8 @@ public class EditableMisoSceneImpl
|
|||||||
int x = otids[i];
|
int x = otids[i];
|
||||||
int y = otids[i+1];
|
int y = otids[i+1];
|
||||||
int fqTileId = otids[i+2];
|
int fqTileId = otids[i+2];
|
||||||
_objectTileIds.put(IsoUtil.coordsToKey(x, y),
|
_objectTileIds.put(IsoUtil.coordsToKey(x, y),
|
||||||
new Integer(fqTileId));
|
new Integer(fqTileId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user