diff --git a/src/badguy/bouncing_snowball.cpp b/src/badguy/bouncing_snowball.cpp index 143468720d4..24d3ac2bd29 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 1d2a4afa5ff..245ec697c8d 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 0dab8149991..82d8104e311 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) 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; diff --git a/src/object/player.cpp b/src/object/player.cpp index 1203d5fbec5..7f8a05e6252 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -1379,7 +1379,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; @@ -2457,6 +2457,9 @@ Player::collision(GameObject& 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 c49d462c899..ca8c91fd174 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 58612963afc..70a678ffbc6 100644 --- a/src/supertux/sector.cpp +++ b/src/supertux/sector.cpp @@ -564,10 +564,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 e5208f99440..be0fa70ae5d 100644 --- a/src/supertux/sector.hpp +++ b/src/supertux/sector.hpp @@ -148,7 +148,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: