From: Wolfgang Becker Date: Sun, 28 Jan 2007 19:17:55 +0000 (+0000) Subject: Allow Tux to unduck in unisolid tiles. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d781e98d106edc15267599be6c471d38d108a3a7;p=supertux.git Allow Tux to unduck in unisolid tiles. SVN-Revision: 4714 --- diff --git a/src/object/player.cpp b/src/object/player.cpp index bcde741c4..bec11024a 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -216,7 +216,7 @@ Player::adjust_height(float new_height) if(new_height > bbox.get_height()) { Rect additional_space = bbox2; additional_space.set_height(new_height - bbox.get_height()); - if(!Sector::current()->is_free_of_statics(additional_space, this)) + if(!Sector::current()->is_free_of_statics(additional_space, this, true)) return false; } diff --git a/src/sector.cpp b/src/sector.cpp index 3b3cbc8f5..79ad45986 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -1288,7 +1288,7 @@ Sector::handle_collisions() } bool -Sector::is_free_of_tiles(const Rect& rect) const +Sector::is_free_of_tiles(const Rect& rect, const bool ignoreUnisolid) const { using namespace collision; @@ -1313,7 +1313,8 @@ Sector::is_free_of_tiles(const Rect& rect) const Constraints constraints; return collision::rectangle_aatriangle(&constraints, rect, triangle); } - if(tile->getAttributes() & Tile::SOLID) return false; + if((tile->getAttributes() & Tile::SOLID) && !ignoreUnisolid) return false; + if((tile->getAttributes() & Tile::SOLID) && !(tile->getAttributes() & Tile::UNISOLID)) return false; } } } @@ -1322,11 +1323,11 @@ Sector::is_free_of_tiles(const Rect& rect) const } bool -Sector::is_free_of_statics(const Rect& rect, const MovingObject* ignore_object) const +Sector::is_free_of_statics(const Rect& rect, const MovingObject* ignore_object, const bool ignoreUnisolid) const { using namespace collision; - if (!is_free_of_tiles(rect)) return false; + if (!is_free_of_tiles(rect, ignoreUnisolid)) return false; for(MovingObjects::const_iterator i = moving_objects.begin(); i != moving_objects.end(); ++i) { diff --git a/src/sector.hpp b/src/sector.hpp index 487f4a2bf..777ce937f 100644 --- a/src/sector.hpp +++ b/src/sector.hpp @@ -138,14 +138,14 @@ public: * Checks if the specified rectangle is free of (solid) tiles. * Note that this does not include static objects, e.g. bonus blocks. */ - bool is_free_of_tiles(const Rect& rect) const; + bool is_free_of_tiles(const Rect& rect, const bool ignoreUnisolid = false) const; /** * Checks if the specified rectangle is free of both * 1.) solid tiles and * 2.) MovingObjects in COLGROUP_STATIC. * Note that this does not include badguys or players. */ - bool is_free_of_statics(const Rect& rect, const MovingObject* ignore_object = 0) const; + bool is_free_of_statics(const Rect& rect, const MovingObject* ignore_object = 0, const bool ignoreUnisolid = false) const; /** * Checks if the specified rectangle is free of both * 1.) solid tiles and