Sigh, instead let's try giving each drop sprite only two "pop-ups".
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2928 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DropBlockSprite.java,v 1.1 2003/11/26 01:42:34 mdb Exp $
|
||||
// $Id: DropBlockSprite.java,v 1.2 2003/12/31 01:26:23 ray Exp $
|
||||
|
||||
package com.threerings.puzzle.drop.client;
|
||||
|
||||
@@ -160,6 +160,22 @@ public class DropBlockSprite extends DropSprite
|
||||
buf.append(", ecol=").append(_ecol);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this sprite pop-up a row on a forgiving rotation?
|
||||
*/
|
||||
public boolean canPopup ()
|
||||
{
|
||||
return (_popups > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called if we pop up to decrement the remaining popups we have.
|
||||
*/
|
||||
public void didPopup ()
|
||||
{
|
||||
_popups--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-calculates the external piece position and bounds of the drop
|
||||
* block.
|
||||
@@ -223,6 +239,10 @@ public class DropBlockSprite extends DropSprite
|
||||
}
|
||||
}
|
||||
|
||||
/** How many times this sprite can be popped-up a row in a forgiving
|
||||
* rotation. */
|
||||
protected byte _popups = 2;
|
||||
|
||||
/** The drop block bounds in board coordinates. */
|
||||
protected Rectangle _dbounds = new Rectangle();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DropControllerDelegate.java,v 1.1 2003/11/26 01:42:34 mdb Exp $
|
||||
// $Id: DropControllerDelegate.java,v 1.2 2003/12/31 01:26:23 ray Exp $
|
||||
|
||||
package com.threerings.puzzle.drop.client;
|
||||
|
||||
@@ -374,7 +374,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
|
||||
// get the drop block position resulting from the rotation
|
||||
int[] info = _dboard.getForgivingRotation(
|
||||
rows, cols, _blocksprite.getOrientation(), dir,
|
||||
getRotationType(), pctdone);
|
||||
getRotationType(), pctdone, _blocksprite.canPopup());
|
||||
if (info != null) {
|
||||
// Log.info("Found valid rotation " +
|
||||
// "[orient=" + DirectionUtil.toShortString(info[0]) +
|
||||
@@ -387,6 +387,10 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
|
||||
// place the block in its newly rotated location
|
||||
_blocksprite.setBoardLocation(info[2], info[1]);
|
||||
|
||||
if (info[3] != 0) {
|
||||
_blocksprite.didPopup();
|
||||
}
|
||||
|
||||
// let derived classes do what they will
|
||||
blockDidRotate(dir);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: DropBoard.java,v 1.2 2003/12/31 00:03:14 ray Exp $
|
||||
// $Id: DropBoard.java,v 1.3 2003/12/31 01:26:23 ray Exp $
|
||||
|
||||
package com.threerings.puzzle.drop.data;
|
||||
|
||||
@@ -188,13 +188,16 @@ public abstract class DropBoard extends Board
|
||||
|
||||
/**
|
||||
* Rotates the given block in the given direction and returns its
|
||||
* final state as <code>(orient, col, row)</code>, where
|
||||
* final state as <code>(orient, col, row, popped)</code>, where
|
||||
* <code>orient</code> is the final orientation of the drop block;
|
||||
* <code>col</code> and <code>row</code> are the final column and row
|
||||
* coordinates, respectively, of the central drop block piece.
|
||||
* <code>popped</code> will be set to 1 if the piece was popped up, 0
|
||||
* otherwise.
|
||||
*/
|
||||
public int[] getForgivingRotation (
|
||||
int[] rows, int[] cols, int orient, int dir, int rtype, float pctdone)
|
||||
int[] rows, int[] cols, int orient, int dir, int rtype, float pctdone,
|
||||
boolean canPopup)
|
||||
{
|
||||
int px = cols[0], py = rows[0];
|
||||
int epx = cols[1], epy = rows[1];
|
||||
@@ -241,28 +244,26 @@ public abstract class DropBoard extends Board
|
||||
// ", orient=" + DirectionUtil.toShortString(orient) +
|
||||
// ", owid=" + ORIENT_WIDTHS[oidx] +
|
||||
// ", ohei=" + ORIENT_HEIGHTS[oidx] + "].");
|
||||
return new int[] { orient, px + cx, py };
|
||||
return new int[] { orient, px + cx, py, 0 };
|
||||
}
|
||||
}
|
||||
|
||||
// if our piece is facing south and we're using radial
|
||||
// rotation then we need to try popping the piece up a row to
|
||||
// check for a fit
|
||||
/*
|
||||
if (rtype == RADIAL_ROTATION && orient == SOUTH) {
|
||||
if (canPopup && rtype == RADIAL_ROTATION && orient == SOUTH) {
|
||||
// check if our hypothetical new coordinates are empty
|
||||
if (isBlockEmpty(ox, oy - 1,
|
||||
ORIENT_WIDTHS[oidx], ORIENT_HEIGHTS[oidx])) {
|
||||
// Log.info("Popped-up block is empty [ox=" + ox +
|
||||
// ", oy=" + (oy - 1) + ", oidx=" + oidx +
|
||||
// ", orient=" + DirectionUtil.toShortString(orient) +
|
||||
// ", owid=" + ORIENT_WIDTHS[oidx] +
|
||||
// ", ohei=" + ORIENT_HEIGHTS[oidx] +
|
||||
// ", bhei=" + _bhei + "].");
|
||||
return new int[] { orient, px, py - 1 };
|
||||
Log.info("Popped-up block is empty [ox=" + ox +
|
||||
", oy=" + (oy - 1) + ", oidx=" + oidx +
|
||||
", orient=" + DirectionUtil.toShortString(orient) +
|
||||
", owid=" + ORIENT_WIDTHS[oidx] +
|
||||
", ohei=" + ORIENT_HEIGHTS[oidx] +
|
||||
", bhei=" + _bhei + "].");
|
||||
return new int[] { orient, px, py - 1, 1 };
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// this should never happen since even in the most tightly
|
||||
|
||||
Reference in New Issue
Block a user