I.e. "south" meaning "can go down, not up", and "west" and "east" for left and
right as appropriate.
git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6595
837edb03-e0f3-0310-88ca-
d4d4e8b29345
/* If the tile is not a slope, this is very easy. */
if (!tile->is_slope ())
{
/* If the tile is not a slope, this is very easy. */
if (!tile->is_slope ())
{
- if (movement.y >= 0) /* moving down */
+ int dir = tile->getData () & ((int) Tile::UNI_DIR_MASK);
+
+ log_debug << "Tile data is " << tile->getData () << ", dir = " << dir << std::endl;
+
+ if (dir != Tile::UNI_DIR_NORTH)
+ log_debug << "Found non-north facing unisolid tile." << std::endl;
+
+ if (((dir == Tile::UNI_DIR_NORTH) && (movement.y >= 0)) /* moving down */
+ || ((dir == Tile::UNI_DIR_SOUTH) && (movement.y < 0)) /* moving up */
+ || ((dir == Tile::UNI_DIR_WEST) && (movement.x >= 0)) /* moving right */
+ || ((dir == Tile::UNI_DIR_EAST) && (movement.x < 0))) /* moving left */
/* If this is not a slope, this is - again - easy */
if (!tile->is_slope ())
{
/* If this is not a slope, this is - again - easy */
if (!tile->is_slope ())
{
- if ((obj_bbox.get_bottom () - SHIFT_DELTA) <= tile_bbox.get_top ())
+ int dir = tile->getData () & Tile::UNI_DIR_MASK;
+
+ if ((dir == Tile::UNI_DIR_NORTH)
+ && ((obj_bbox.get_bottom () - SHIFT_DELTA) <= tile_bbox.get_top ()))
- else
- return POS_NON_SOLID;
+ else if ((dir == Tile::UNI_DIR_SOUTH)
+ && ((obj_bbox.get_top () + SHIFT_DELTA) >= tile_bbox.get_bottom ()))
+ return POS_SOLID;
+ else if ((dir == Tile::UNI_DIR_WEST)
+ && ((obj_bbox.get_right () - SHIFT_DELTA) <= tile_bbox.get_left ()))
+ return POS_SOLID;
+ else if ((dir == Tile::UNI_DIR_EAST)
+ && ((obj_bbox.get_left () + SHIFT_DELTA) >= tile_bbox.get_right ()))
+ return POS_SOLID;
+
+ return POS_NON_SOLID;
}
/* There are 20 different cases. For each case, calculate a line that
}
/* There are 20 different cases. For each case, calculate a line that
+ enum
+ {
+ UNI_DIR_NORTH = 0,
+ UNI_DIR_SOUTH = 1,
+ UNI_DIR_WEST = 2,
+ UNI_DIR_EAST = 3,
+ UNI_DIR_MASK = 3
+ };
+
private:
std::vector<ImageSpec> imagespecs;
std::vector<SurfacePtr> images;
private:
std::vector<ImageSpec> imagespecs;
std::vector<SurfacePtr> images;