Some warning cleanups, widening, and varargs logification.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@700 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2008-11-12 18:45:13 +00:00
parent 9931cae098
commit e92d57e315
6 changed files with 137 additions and 180 deletions
@@ -30,19 +30,17 @@ import com.samskivert.util.StringUtil;
import com.threerings.util.DirectionUtil; import com.threerings.util.DirectionUtil;
/** /**
* An object tile extends the base tile to provide support for objects * An object tile extends the base tile to provide support for objects whose image spans more than
* whose image spans more than one unit tile. * one unit tile.
* *
* <p> An object tile is generally positioned based on its origin rather * <p> An object tile is generally positioned based on its origin rather than the upper left of
* than the upper left of its image. Generally this origin is in the * its image. Generally this origin is in the bottom center of the object image, but can be
* bottom center of the object image, but can be configured to be anywhere * configured to be anywhere that the natural center point of "contact" is for the object. Note
* that the natural center point of "contact" is for the object. Note that * that this does not automatically adjust the semantics of {@link Tile#paint}, it is just
* this does not automatically adjust the semantics of {@link #paint}, it * expected that the caller will account for the object tile's origin when painting, if
* is just expected that the caller will account for the object tile's * appropriate.
* origin when painting, if appropriate.
* *
* <p> An object tile has dimensions (in tile units) that represent its * <p> An object tile has dimensions (in tile units) that represent its footprint or "shadow".
* footprint or "shadow".
*/ */
public class ObjectTile extends Tile public class ObjectTile extends Tile
{ {
@@ -72,11 +70,9 @@ public class ObjectTile extends Tile
} }
/** /**
* Returns the x offset into the tile image of the origin (which will * Returns the x offset into the tile image of the origin (which will be aligned with the
* be aligned with the bottom center of the origin tile) or * bottom center of the origin tile) or <code>Integer.MIN_VALUE</code> if the origin is not
* <code>Integer.MIN_VALUE</code> if the origin is not explicitly * explicitly specified and should be computed from the image size and tile footprint.
* specified and should be computed from the image size and tile
* footprint.
*/ */
public int getOriginX () public int getOriginX ()
{ {
@@ -84,11 +80,9 @@ public class ObjectTile extends Tile
} }
/** /**
* Returns the y offset into the tile image of the origin (which will * Returns the y offset into the tile image of the origin (which will be aligned with the
* be aligned with the bottom center of the origin tile) or * bottom center of the origin tile) or <code>Integer.MIN_VALUE</code> if the origin is not
* <code>Integer.MIN_VALUE</code> if the origin is not explicitly * explicitly specified and should be computed from the image size and tile footprint.
* specified and should be computed from the image size and tile
* footprint.
*/ */
public int getOriginY () public int getOriginY ()
{ {
@@ -96,12 +90,11 @@ public class ObjectTile extends Tile
} }
/** /**
* Sets the offset in pixels from the origin of the tile image to the * Sets the offset in pixels from the origin of the tile image to the origin of the object.
* origin of the object. The object will be rendered such that its * The object will be rendered such that its origin is at the bottom center of its origin
* origin is at the bottom center of its origin tile. If no origin is * tile. If no origin is specified, the bottom of the image is aligned with the bottom of the
* specified, the bottom of the image is aligned with the bottom of * origin tile and the left side of the image is aligned with the left edge of the left-most
* the origin tile and the left side of the image is aligned with the * base tile.
* left edge of the left-most base tile.
*/ */
protected void setOrigin (int x, int y) protected void setOrigin (int x, int y)
{ {
@@ -167,14 +160,14 @@ public class ObjectTile extends Tile
} }
/** /**
* Returns the list of constraints associated with this object, or * Returns the list of constraints associated with this object, or <code>null</code> if the
* <code>null</code> if the object has no constraints. * object has no constraints.
*/ */
public String[] getConstraints () public String[] getConstraints ()
{ {
return _constraints; return _constraints;
} }
/** /**
* Checks whether this object has the given constraint. * Checks whether this object has the given constraint.
*/ */
@@ -183,7 +176,7 @@ public class ObjectTile extends Tile
return (_constraints == null) ? false : return (_constraints == null) ? false :
ListUtil.contains(_constraints, constraint); ListUtil.contains(_constraints, constraint);
} }
/** /**
* Configures this object's constraints. * Configures this object's constraints.
*/ */
@@ -191,7 +184,7 @@ public class ObjectTile extends Tile
{ {
_constraints = constraints; _constraints = constraints;
} }
@Override @Override
public void toString (StringBuilder buf) public void toString (StringBuilder buf)
{ {
@@ -213,9 +206,8 @@ public class ObjectTile extends Tile
/** The object footprint width in unit tile units. */ /** The object footprint width in unit tile units. */
protected Dimension _base = new Dimension(1, 1); protected Dimension _base = new Dimension(1, 1);
/** The offset from the origin of the tile image to the object's /** The offset from the origin of the tile image to the object's origin or MIN_VALUE if the
* origin or MIN_VALUE if the origin should be calculated based on the * origin should be calculated based on the footprint. */
* footprint. */
protected Point _origin = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE); protected Point _origin = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
/** This object tile's default render priority. */ /** This object tile's default render priority. */
@@ -226,7 +218,7 @@ public class ObjectTile extends Tile
/** The orientation of the "spot" associated with this object. */ /** The orientation of the "spot" associated with this object. */
protected byte _sorient; protected byte _sorient;
/** The list of constraints associated with this object. */ /** The list of constraints associated with this object. */
protected String[] _constraints; protected String[] _constraints;
} }
@@ -89,15 +89,14 @@ import static com.threerings.miso.Log.log;
* Renders a Miso scene for all to see. * Renders a Miso scene for all to see.
*/ */
public class MisoScenePanel extends VirtualMediaPanel public class MisoScenePanel extends VirtualMediaPanel
implements MouseListener, MouseMotionListener, AStarPathUtil.TraversalPred, implements MouseListener, MouseMotionListener, AStarPathUtil.TraversalPred, RadialMenu.Host
RadialMenu.Host
{ {
/** Show flag that indicates we should show all tips. */ /** Show flag that indicates we should show all tips. */
public static final int SHOW_TIPS = (1 << 0); public static final int SHOW_TIPS = (1 << 0);
/** /**
* Creates a blank miso scene display. Configure it with a scene model * Creates a blank miso scene display. Configure it with a scene model via
* via {@link #setSceneModel} to cause it to display something. * {@link #setSceneModel} to cause it to display something.
*/ */
public MisoScenePanel (MisoContext ctx, MisoSceneMetrics metrics) public MisoScenePanel (MisoContext ctx, MisoSceneMetrics metrics)
{ {
@@ -124,8 +123,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Configures this display with a scene model which will immediately * Configures this display with a scene model which will immediately be resolved and
* be resolved and displayed. * displayed.
*/ */
public void setSceneModel (MisoSceneModel model) public void setSceneModel (MisoSceneModel model)
{ {
@@ -156,8 +155,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Completely invalidates our current resolved scene and re-resolves * Completely invalidates our current resolved scene and re-resolves it from the ground up.
* it from the ground up.
*/ */
public void refreshScene () public void refreshScene ()
{ {
@@ -192,8 +190,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Returns the scene metrics in use by this panel. <em>Do not</em> * Returns the scene metrics in use by this panel. <em>Do not</em> modify!
* modify!
*/ */
public MisoSceneMetrics getSceneMetrics () public MisoSceneMetrics getSceneMetrics ()
{ {
@@ -201,8 +198,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Set whether or not to highlight object tooltips (and potentially * Set whether or not to highlight object tooltips (and potentially other scene entities).
* other scene entities).
*/ */
public void setShowFlags (int flags, boolean on) public void setShowFlags (int flags, boolean on)
{ {
@@ -240,8 +236,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Returns the top-most object over which the mouse is hovering; this * Returns the top-most object over which the mouse is hovering; this may be a sprite or a
* may be a sprite or a {@link SceneObject}. * {@link SceneObject}.
*/ */
public Object getHoverObject () public Object getHoverObject ()
{ {
@@ -249,8 +245,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Returns the tile coordinates of the tile over which the mouse is * Returns the tile coordinates of the tile over which the mouse is hovering.
* hovering.
*/ */
public Point getHoverCoords () public Point getHoverCoords ()
{ {
@@ -266,8 +261,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Returns the resolved block that contains the specified tile * Returns the resolved block that contains the specified tile coordinate or null if no block
* coordinate or null if no block is resolved for that coordinate. * is resolved for that coordinate.
*/ */
public SceneBlock getBlock (int tx, int ty) public SceneBlock getBlock (int tx, int ty)
{ {
@@ -277,13 +272,11 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Computes a path for the specified sprite to the specified tile * Computes a path for the specified sprite to the specified tile coordinates.
* coordinates.
* *
* @param loose if true, an approximate path will be returned if a * @param loose if true, an approximate path will be returned if a complete path cannot be
* complete path cannot be located. This path will navigate the sprite * located. This path will navigate the sprite "legally" as far as possible and then walk the
* "legally" as far as possible and then walk the sprite in a straight * sprite in a straight line to its final destination. This is generally only useful if the
* line to its final destination. This is generally only useful if the
* the path goes "off screen". * the path goes "off screen".
*/ */
public Path getPath (Sprite sprite, int x, int y, boolean loose) public Path getPath (Sprite sprite, int x, int y, boolean loose)
@@ -308,8 +301,7 @@ public class MisoScenePanel extends VirtualMediaPanel
this, sprite, longestPath, src.x, src.y, dest.x, dest.y, loose); this, sprite, longestPath, src.x, src.y, dest.x, dest.y, loose);
long duration = System.currentTimeMillis() - start; long duration = System.currentTimeMillis() - start;
// sanity check the number of nodes searched so that we can keep // sanity check the number of nodes searched so that we can keep an eye out for bogosity
// an eye out for bogosity
if (duration > 500L) { if (duration > 500L) {
int considered = AStarPathUtil.getConsidered(); int considered = AStarPathUtil.getConsidered();
log.warning("Considered " + considered + " nodes for path from " + log.warning("Considered " + considered + " nodes for path from " +
@@ -332,7 +324,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Coverts the supplied screen coordinates to full coordinates. * Converts the supplied screen coordinates to full coordinates.
*/ */
public Point getFullCoords (int x, int y) public Point getFullCoords (int x, int y)
{ {
@@ -340,7 +332,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Coverts the supplied screen coordinates to tile coordinates. * Converts the supplied screen coordinates to tile coordinates.
*/ */
public Point getTileCoords (int x, int y) public Point getTileCoords (int x, int y)
{ {
@@ -358,8 +350,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Reports the memory usage of the resolved tiles in the current scene * Reports the memory usage of the resolved tiles in the current scene block.
* block.
*/ */
public void reportMemoryUsage () public void reportMemoryUsage ()
{ {
@@ -432,8 +423,7 @@ public class MisoScenePanel extends VirtualMediaPanel
/** /**
* Programmatically "click" a scene object. This results in a call to * Programmatically "click" a scene object. This results in a call to
* {@link #handleObjectPressed} with click coordinates in the center * {@link #handleObjectPressed} with click coordinates in the center of the object.
* of the object.
*/ */
public void pressObject (SceneObject scobj) public void pressObject (SceneObject scobj)
{ {
@@ -497,9 +487,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Returns an appropriate set of menu bounds for the specified object. * Returns an appropriate set of menu bounds for the specified object. Returns a rectangle of
* Returns a rectangle of the size specified by * the size specified by {@link #getObjectRadialSize} centered around the object.
* {@link #getObjectRadialSize} centered around the object.
*/ */
protected Rectangle getRadialMenuBounds (SceneObject scobj) protected Rectangle getRadialMenuBounds (SceneObject scobj)
{ {
@@ -517,10 +506,9 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Returns the size of the rectangle around which we create an * Returns the size of the rectangle around which we create an object's radial menu. The
* object's radial menu. The default is a sensible size, but derived * default is a sensible size, but derived classes may wish to tune the value to make their
* classes may wish to tune the value to make their menus lay out in a * menus lay out in a more aestetically pleasing manner.
* more aestetically pleasing manner.
*/ */
protected Dimension getObjectRadialSize () protected Dimension getObjectRadialSize ()
{ {
@@ -541,11 +529,10 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Called when the mouse is pressed over an unknown or non-existent * Called when the mouse is pressed over an unknown or non-existent hover object.
* hover object.
* *
* @param hobject the hover object at the time of the mouse press or * @param hobject the hover object at the time of the mouse press or null if no hover object
* null if no hover object is active. * is active.
* *
* @return true if the mouse press was handled, false if not. * @return true if the mouse press was handled, false if not.
*/ */
@@ -637,10 +624,9 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Gives derived classes a chance to compute a hover object that takes * Gives derived classes a chance to compute a hover object that takes precedence over sprites
* precedence over sprites and actionable objects. If this method * and actionable objects. If this method returns non-null, no sprite or object hover
* returns non-null, no sprite or object hover calculations will be * calculations will be performed and the object returned will become the new hover object.
* performed and the object returned will become the new hover object.
*/ */
protected Object computeOverHover (int mx, int my) protected Object computeOverHover (int mx, int my)
{ {
@@ -648,11 +634,10 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Gives derived classes a chance to compute a hover object that is * Gives derived classes a chance to compute a hover object that is used if the mouse is not
* used if the mouse is not hovering over a sprite or actionable * hovering over a sprite or actionable object. If this method is called, it means that there
* object. If this method is called, it means that there are no * are no sprites or objects under the mouse. Thus if it returns non-null, the object returned
* sprites or objects under the mouse. Thus if it returns non-null, * will become the new hover object.
* the object returned will become the new hover object.
*/ */
protected Object computeUnderHover (int mx, int my) protected Object computeUnderHover (int mx, int my)
{ {
@@ -668,8 +653,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Derived classes can control whether or not we consider unresolved * Derived classes can control whether or not we consider unresolved tiles to be traversable
* tiles to be traversable or not. * or not.
*/ */
protected boolean canTraverseUnresolved (Object traverser, int tx, int ty) protected boolean canTraverseUnresolved (Object traverser, int tx, int ty)
{ {
@@ -731,13 +716,12 @@ public class MisoScenePanel extends VirtualMediaPanel
{ {
super.viewLocationDidChange(dx, dy); super.viewLocationDidChange(dx, dy);
// compute the tile coordinates of our upper left screen // compute the tile coordinates of our upper left screen coordinate and request a rethink
// coordinate and request a rethink if they've changed // if they've changed
MisoUtil.screenToTile(_metrics, _vbounds.x, _vbounds.y, _tcoords); MisoUtil.screenToTile(_metrics, _vbounds.x, _vbounds.y, _tcoords);
if (_ulpos == null || !_tcoords.equals(_ulpos)) { if (_ulpos == null || !_tcoords.equals(_ulpos)) {
// if this is a forced rethink (_ulpos is null), we might // if this is a forced rethink (_ulpos is null), we might delay paint as a result of
// delay paint as a result of it, but only if we queue up // it, but only if we queue up blocks for resolution in our rethink
// blocks for resolution in our rethink
boolean mightDelayPaint = false; boolean mightDelayPaint = false;
if (_ulpos == null) { if (_ulpos == null) {
_ulpos = new Point(); _ulpos = new Point();
@@ -751,16 +735,16 @@ public class MisoScenePanel extends VirtualMediaPanel
if (_delayRepaint) { if (_delayRepaint) {
setVisible(false); setVisible(false);
} }
log.info("Got new pending blocks", "need", _visiBlocks.size(), "of", log.info("Got new pending blocks",
_pendingBlocks, "view", StringUtil.toString(_vbounds), "delay", _delayRepaint); "need", _visiBlocks.size(), "of", _pendingBlocks,
"view", StringUtil.toString(_vbounds), "delay", _delayRepaint);
} }
} }
} }
/** /**
* Derived classes can override this method and provide a colorizer * Derived classes can override this method and provide a colorizer that will be used to
* that will be used to colorize the supplied scene object when * colorize the supplied scene object when rendering.
* rendering.
*/ */
protected TileSet.Colorizer getColorizer (ObjectInfo oinfo) protected TileSet.Colorizer getColorizer (ObjectInfo oinfo)
{ {
@@ -768,8 +752,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Computes the tile coordinates of the supplied sprite and appends it * Computes the tile coordinates of the supplied sprite and appends it to the supplied dirty
* to the supplied dirty item list. * item list.
*/ */
protected void appendDirtySprite (DirtyItemList list, Sprite sprite) protected void appendDirtySprite (DirtyItemList list, Sprite sprite)
{ {
@@ -786,12 +770,13 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* This is called when our view position has changed by more than one * This is called when our view position has changed by more than one tile in any direction.
* tile in any direction. Herein we do a whole crapload of stuff: * Herein we do a whole crapload of stuff:
* *
* <ul><li> Queue up loads for any new influential blocks. * <ul>
* <li> Flush any blocks that are no longer influential. * <li>Queue up loads for any new influential blocks.</li>
* <li> Recompute the list of potentially visible scene objects. * <li>Flush any blocks that are no longer influential.</li>
* <li>Recompute the list of potentially visible scene objects.</li>
* </ul> * </ul>
* *
* @return the count of blocks pending after this rethink. * @return the count of blocks pending after this rethink.
@@ -872,10 +857,10 @@ public class MisoScenePanel extends VirtualMediaPanel
/** /**
* Configures <code>influentialBounds</code> to contain the bounds of the potentially * Configures <code>influentialBounds</code> to contain the bounds of the potentially
* "influential" world and <code>visibleBlockBounds</code> to contain bounds that are used to * "influential" world and <code>visibleBlockBounds</code> to contain bounds that are used
* determine which blocks should be resolved before making the view visible. * to determine which blocks should be resolved before making the view visible.
* *
* <p> Everything that intersects the influential area will be resolved on the expectation * <p>Everything that intersects the influential area will be resolved on the expectation
* that it could be scrolled into view at any time. The influential bounds should be large * that it could be scrolled into view at any time. The influential bounds should be large
* enough that the time between a block becoming influential and the time at which it is * enough that the time between a block becoming influential and the time at which it is
* resolved is longer than the expected time by which it will be scrolled into view, otherwise * resolved is longer than the expected time by which it will be scrolled into view, otherwise
@@ -895,8 +880,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Returns the bounds for which all intersecting scene blocks are kept * Returns the bounds for which all intersecting scene blocks are kept resolved. Do not modify
* resolved. Do not modify the rectangle returned by this method. * the rectangle returned by this method.
*/ */
protected Rectangle getInfluentialBounds () protected Rectangle getInfluentialBounds ()
{ {
@@ -914,8 +899,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Called by the scene block if it has come up for resolution but is * Called by the scene block if it has come up for resolution but is no longer influential.
* no longer influential.
*/ */
protected void blockAbandoned (SceneBlock block) protected void blockAbandoned (SceneBlock block)
{ {
@@ -927,8 +911,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Called by a scene block when it has completed its resolution * Called by a scene block when it has completed its resolution process.
* process.
*/ */
protected void blockResolved (SceneBlock block) protected void blockResolved (SceneBlock block)
{ {
@@ -939,9 +922,8 @@ public class MisoScenePanel extends VirtualMediaPanel
Rectangle sbounds = block.getScreenBounds(); Rectangle sbounds = block.getScreenBounds();
if (!_delayRepaint && sbounds != null && sbounds.intersects(_vbounds)) { if (!_delayRepaint && sbounds != null && sbounds.intersects(_vbounds)) {
// warnVisible(block, sbounds); // warnVisible(block, sbounds);
// if we have yet further blocks to resolve, queue up a // if we have yet further blocks to resolve, queue up a repaint now so that we get these
// repaint now so that we get this data onscreen as quickly as // data onscreen as quickly as possible
// possible
if (_pendingBlocks > 1) { if (_pendingBlocks > 1) {
recomputeVisible(); recomputeVisible();
_remgr.invalidateRegion(sbounds); _remgr.invalidateRegion(sbounds);
@@ -973,9 +955,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Issues a warning to the error log that the specified block became * Issues a warning to the error log that the specified block became visible prior to being
* visible prior to being resolved. Derived classes may wish to * resolved. Derived classes may wish to augment or inhibit this warning.
* augment or inhibit this warning.
*/ */
protected void warnVisible (SceneBlock block, Rectangle sbounds) protected void warnVisible (SceneBlock block, Rectangle sbounds)
{ {
@@ -1088,8 +1069,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Derived classes can provide human readable object tips via this * Derived classes can provide human readable object tips via this method.
* method.
*/ */
protected String getTipText (SceneObject scobj, String action) protected String getTipText (SceneObject scobj, String action)
{ {
@@ -1098,8 +1078,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Provides an icon for this tooltip, the default looks up an object * Provides an icon for this tooltip, the default looks up an object action handler for the
* action handler for the action and requests the icon from it. * action and requests the icon from it.
*/ */
protected Icon getTipIcon (SceneObject scobj, String action) protected Icon getTipIcon (SceneObject scobj, String action)
{ {
@@ -1159,10 +1139,9 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Adds to the supplied dirty item list, all of the object tiles that * Adds to the supplied dirty item list, all of the object tiles that are hit by the specified
* are hit by the specified point (meaning the point is contained * point (meaning the point is contained within their bounds and intersects a non-transparent
* within their bounds and intersects a non-transparent pixel in the * pixel in the actual object image.
* actual object image.
*/ */
protected void getHitObjects (DirtyItemList list, int x, int y) protected void getHitObjects (DirtyItemList list, int x, int y)
{ {
@@ -1177,8 +1156,7 @@ public class MisoScenePanel extends VirtualMediaPanel
continue; continue;
} }
// now check that the pixel in the tile image is // now check that the pixel in the tile image is non-transparent at that point
// non-transparent at that point
if (!scobj.tile.hitTest(x - pbounds.x, y - pbounds.y)) { if (!scobj.tile.hitTest(x - pbounds.x, y - pbounds.y)) {
continue; continue;
} }
@@ -1189,10 +1167,9 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Determines whether we should skip the specified object when compiling * Determines whether we should skip the specified object when compiling the list of objects
* the list of objects under a specified point using * under a specified point using {@link #getHitObjects}. The default implementation returns
* {@link #getHitObjects}. The default implementation returns * <code>true</code> if the object has no action.
* <code>true</code> iff the object has no action.
*/ */
protected boolean skipHitObject (SceneObject scobj) protected boolean skipHitObject (SceneObject scobj)
{ {
@@ -1200,12 +1177,10 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Converts the supplied screen coordinates into tile coordinates, * Converts the supplied screen coordinates into tile coordinates, writing the values into the
* writing the values into the supplied {@link Point} instance and * supplied {@link Point} instance and returning true if the screen coordinates translated
* returning true if the screen coordinates translated into a * into a different set of tile coordinates than were already contained in the point (so that
* different set of tile coordinates than were already contained in * the caller can know to update a highlight, for example).
* the point (so that the caller can know to update a highlight, for
* example).
* *
* @return true if the tile coordinates have changed. * @return true if the tile coordinates have changed.
*/ */
@@ -1263,9 +1238,8 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* We don't want sprites rendered using the standard mechanism because * We don't want sprites rendered using the standard mechanism because we intersperse them
* we intersperse them with objects in our scene and need to manage * with objects in our scene and need to manage their z-order.
* their z-order.
*/ */
@Override @Override
protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty) protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty)
@@ -1274,9 +1248,9 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* A function where derived classes can paint things after the base * A function where derived classes can paint things after the base tiles have been rendered
* tiles have been rendered but before anything else has been rendered * but before anything else has been rendered (so that whatever is painted appears to be on
* (so that whatever is painted appears to be on the ground). * the ground).
*/ */
protected void paintBaseDecorations (Graphics2D gfx, Rectangle clip) protected void paintBaseDecorations (Graphics2D gfx, Rectangle clip)
{ {
@@ -1284,8 +1258,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
/** /**
* Renders the dirty sprites and objects in the scene to the given * Renders the dirty sprites and objects in the scene to the given graphics context.
* graphics context.
*/ */
protected void paintDirtyItems (Graphics2D gfx, Rectangle clip) protected void paintDirtyItems (Graphics2D gfx, Rectangle clip)
{ {
@@ -1428,7 +1401,7 @@ public class MisoScenePanel extends VirtualMediaPanel
return true; return true;
} }
/** Used by {@link #paintTiles}. */ /** Used by {@link MisoScenePanel#paintTiles}. */
protected class PaintTileOp implements TileOp protected class PaintTileOp implements TileOp
{ {
public void setGraphics (Graphics2D gfx) { public void setGraphics (Graphics2D gfx) {
@@ -1483,8 +1456,7 @@ public class MisoScenePanel extends VirtualMediaPanel
} }
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
log.warning("Whoops, booched it [tx=" + tx + log.warning("Whoops, booched it", "tx", tx, "ty", ty, "tb.x", tbounds.x);
", ty=" + ty + ", tb.x=" + tbounds.x + "].");
e.printStackTrace(System.err); e.printStackTrace(System.err);
} }
@@ -1541,8 +1513,7 @@ public class MisoScenePanel extends VirtualMediaPanel
/** Contains the bounds of our "area of influence" in screen coords. */ /** Contains the bounds of our "area of influence" in screen coords. */
protected Rectangle _ibounds = new Rectangle(); protected Rectangle _ibounds = new Rectangle();
/** Contains the bounds of our visible "area of influence" in screen /** Contains the bounds of our visible "area of influence" in screen coords. */
* coords. */
protected Rectangle _vibounds = new Rectangle(); protected Rectangle _vibounds = new Rectangle();
/** Used by {@link #rethink}. */ /** Used by {@link #rethink}. */
@@ -36,17 +36,16 @@ import com.threerings.media.tile.TileManager;
import static com.threerings.miso.Log.log; import static com.threerings.miso.Log.log;
/** /**
* Extends the basic tile manager and provides support for automatically * Extends the basic tile manager and provides support for automatically generating fringes in
* generating fringes in between different types of base tiles in a scene. * between different types of base tiles in a scene.
*/ */
public class MisoTileManager extends TileManager public class MisoTileManager extends TileManager
{ {
/** /**
* Creates a tile manager and provides it with a reference to the * Creates a tile manager and provides it with a reference to the image manager from which it
* image manager from which it will load tileset images. * will load tileset images.
* *
* @param imgr the image manager via which the tile manager will * @param imgr the image manager via which the tile manager will decode and cache images.
* decode and cache images.
*/ */
public MisoTileManager (ResourceManager rmgr, ImageManager imgr) public MisoTileManager (ResourceManager rmgr, ImageManager imgr)
{ {
@@ -56,16 +55,14 @@ public class MisoTileManager extends TileManager
InputStream in = null; InputStream in = null;
try { try {
in = rmgr.getResource(FRINGE_CONFIG_PATH); in = rmgr.getResource(FRINGE_CONFIG_PATH);
FringeConfiguration config = (FringeConfiguration) FringeConfiguration config = (FringeConfiguration) CompiledConfig.loadConfig(in);
CompiledConfig.loadConfig(in);
// if we've found it, create our auto fringer with it // if we've found it, create our auto fringer with it
_fringer = new AutoFringer(config, imgr, this); _fringer = new AutoFringer(config, imgr, this);
} catch (IOException ioe) { } catch (IOException ioe) {
log.warning("Unable to load fringe configuration " + log.warning("Unable to load fringe configuration",
"[path=" + FRINGE_CONFIG_PATH + "path", FRINGE_CONFIG_PATH, "error", ioe);
", error=" + ioe + "].");
} finally { } finally {
StreamUtil.close(in); StreamUtil.close(in);
@@ -73,10 +70,9 @@ public class MisoTileManager extends TileManager
} }
/** /**
* Returns the auto fringer that has been configured for use by this * Returns the auto fringer that has been configured for use by this tile manager. This will
* tile manager. This will only be valid if this tile manager has been * only be valid if this tile manager has been provided with a miso tileset repository via
* provided with a miso tileset repository via {@link * {@link TileManager#setTileSetRepository}.
* #setTileSetRepository}.
*/ */
public AutoFringer getAutoFringer () public AutoFringer getAutoFringer ()
{ {
@@ -86,8 +82,6 @@ public class MisoTileManager extends TileManager
/** The entity that performs the automatic fringe layer generation. */ /** The entity that performs the automatic fringe layer generation. */
protected AutoFringer _fringer; protected AutoFringer _fringer;
/** The path (in the classpath) to the serialized fringe /** The path (in the classpath) to the serialized fringe configuration. */
* configuration. */ protected static final String FRINGE_CONFIG_PATH = "config/miso/tile/fringeconf.dat";
protected static final String FRINGE_CONFIG_PATH =
"config/miso/tile/fringeconf.dat";
} }
@@ -113,7 +113,7 @@ public class OpenALSoundPlayer extends SoundPlayer
public void setClipVolume (final float vol) public void setClipVolume (final float vol)
{ {
super.setClipVolume(vol); super.setClipVolume(vol);
_ticker.postRunnable(new Runnable(){ _ticker.postRunnable(new Runnable() {
public void run () { public void run () {
_alSoundManager.setBaseGain(vol); _alSoundManager.setBaseGain(vol);
}}); }});
+4 -4
View File
@@ -89,8 +89,8 @@ public class Source
public void setSourceRelative (boolean relative) public void setSourceRelative (boolean relative)
{ {
if (_sourceRelative != relative) { if (_sourceRelative != relative) {
AL10.alSourcei(_id, AL10.AL_SOURCE_RELATIVE, _sourceRelative = relative;
(_sourceRelative = relative) ? AL10.AL_TRUE : AL10.AL_FALSE); AL10.alSourcei(_id, AL10.AL_SOURCE_RELATIVE, relative ? AL10.AL_TRUE : AL10.AL_FALSE);
} }
} }
@@ -100,8 +100,8 @@ public class Source
public void setLooping (boolean looping) public void setLooping (boolean looping)
{ {
if (_looping != looping) { if (_looping != looping) {
AL10.alSourcei(_id, AL10.AL_LOOPING, _looping = looping;
(_looping = looping) ? AL10.AL_TRUE : AL10.AL_FALSE); AL10.alSourcei(_id, AL10.AL_LOOPING, looping ? AL10.AL_TRUE : AL10.AL_FALSE);
} }
} }
@@ -64,7 +64,7 @@ public class Unsafe
/** /**
* Causes the current thread to block for the specified number of * Causes the current thread to block for the specified number of
* milliseconds. This exists primarily to work around the fact that on * milliseconds. This exists primarily to work around the fact that on
* Linux, {@link Thread#sleep} is only accurate to around 12ms which * Linux, {@link Thread#sleep(long)} is only accurate to around 12ms which
* is wholly unacceptable. * is wholly unacceptable.
*/ */
public static void sleep (int millis) public static void sleep (int millis)