diff --git a/src/badguy/bouncing_snowball.cpp b/src/badguy/bouncing_snowball.cpp index 2cd096b536..d04616d2eb 100644 --- a/src/badguy/bouncing_snowball.cpp +++ b/src/badguy/bouncing_snowball.cpp @@ -82,7 +82,7 @@ BouncingSnowball::active_update(float dt_sec) Rectf side_look_box = get_bbox().grown(-1.f); side_look_box.set_left(get_bbox().get_left() + (m_dir == Direction::LEFT ? -1.f : 1.f)); side_look_box.set_right(get_bbox().get_right() + (m_dir == Direction::LEFT ? -1.f : 1.f)); - if (!Sector::get().is_free_of_statics(side_look_box)) + if (!Sector::get().is_free_of_statics(side_look_box, nullptr, true)) { m_dir = m_dir == Direction::LEFT ? Direction::RIGHT : Direction::LEFT; set_action(m_dir); diff --git a/src/collision/collision_system.cpp b/src/collision/collision_system.cpp index 558c454d61..87aaa3d7ce 100644 --- a/src/collision/collision_system.cpp +++ b/src/collision/collision_system.cpp @@ -726,11 +726,11 @@ CollisionSystem::is_free_of_statics(const Rectf& rect, const CollisionObject* ig } bool -CollisionSystem::is_free_of_movingstatics(const Rectf& rect, const CollisionObject* ignore_object) const +CollisionSystem::is_free_of_movingstatics(const Rectf& rect, const CollisionObject* ignore_object, const bool ignore_unisolid) const { using namespace collision; - if (!is_free_of_tiles(rect)) return false; + if (!is_free_of_tiles(rect, ignore_unisolid)) return false; for (const auto& object : m_objects) { if (object == ignore_object) continue; diff --git a/src/collision/collision_system.hpp b/src/collision/collision_system.hpp index 23d9b84e54..b8ab27228b 100644 --- a/src/collision/collision_system.hpp +++ b/src/collision/collision_system.hpp @@ -64,7 +64,7 @@ class CollisionSystem final bool is_free_of_tiles(const Rectf& rect, const bool ignoreUnisolid = false, uint32_t tiletype = Tile::SOLID) const; bool is_free_of_statics(const Rectf& rect, const CollisionObject* ignore_object, const bool ignoreUnisolid, uint32_t tiletype = Tile::SOLID) const; - bool is_free_of_movingstatics(const Rectf& rect, const CollisionObject* ignore_object) const; + bool is_free_of_movingstatics(const Rectf& rect, const CollisionObject* ignore_object, const bool ignore_unisolid = false) const; bool is_free_of_specifically_movingstatics(const Rectf& rect, const CollisionObject* ignore_object) const; enum RaycastIgnore { diff --git a/src/object/player.cpp b/src/object/player.cpp index 7c53c70e72..c03b703a16 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -1352,7 +1352,7 @@ Player::do_standup(bool force_standup) float new_height = m_swimming ? TUX_WIDTH : BIG_TUX_HEIGHT; new_bbox.move(Vector(0, m_col.m_bbox.get_height() - new_height)); new_bbox.set_height(new_height); - if (!Sector::get().is_free_of_movingstatics(new_bbox, this) && !force_standup) + if (!Sector::get().is_free_of_movingstatics(new_bbox, this, true) && !force_standup) { m_crawl = true; return; @@ -2385,6 +2385,9 @@ Player::collision(MovingObject& other, const CollisionHit& hit) return FORCE_MOVE; if (m_stone) return ABORT_MOVE; + + if (hit.bottom && badguy->is_frozen()) + m_on_ground_flag = true; } return CONTINUE; diff --git a/src/object/pushbutton.cpp b/src/object/pushbutton.cpp index d6775fd8b8..6afd0e0960 100644 --- a/src/object/pushbutton.cpp +++ b/src/object/pushbutton.cpp @@ -31,7 +31,7 @@ const std::string BUTTON_SOUND = "sounds/switch.ogg"; } PushButton::PushButton(const ReaderMapping& mapping) : - StickyObject(mapping, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), + StickyObject(mapping, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_STATIC), m_script(), m_state(OFF), m_dir(Direction::UP) diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp index b3305afae5..c6c8bfcc2b 100644 --- a/src/supertux/sector.cpp +++ b/src/supertux/sector.cpp @@ -551,10 +551,11 @@ Sector::is_free_of_statics(float left, float top, float right, float bottom, } bool -Sector::is_free_of_movingstatics(const Rectf& rect, const MovingObject* ignore_object) const +Sector::is_free_of_movingstatics(const Rectf& rect, const MovingObject* ignore_object, bool ignore_unisolid) const { return m_collision_system->is_free_of_movingstatics(rect, - ignore_object ? ignore_object->get_collision_object() : nullptr); + ignore_object ? ignore_object->get_collision_object() : nullptr, + ignore_unisolid); } bool diff --git a/src/supertux/sector.hpp b/src/supertux/sector.hpp index 07606089a6..4a8979a06f 100644 --- a/src/supertux/sector.hpp +++ b/src/supertux/sector.hpp @@ -149,7 +149,8 @@ class Sector final : public Base::Sector 1.) solid tiles and 2.) MovingObjects in COLGROUP_STATIC, COLGROUP_MOVINGSTATIC or COLGROUP_MOVING. This includes badguys and players. */ - bool is_free_of_movingstatics(const Rectf& rect, const MovingObject* ignore_object = nullptr) const; + bool is_free_of_movingstatics(const Rectf& rect, const MovingObject* ignore_object = nullptr, + bool ignore_unisolid = false) const; /** * @scripting * @description Checks if the specified sector-relative rectangle is free of both: