From: Christoph Sommer Date: Wed, 19 Apr 2006 00:54:40 +0000 (+0000) Subject: Hardcoded stay-on-platform behaviour as follows: Mr. Bomb, Mr. Tree and the Totem... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4c9b57d29e67f9db5605f378549b07f670baa837;p=supertux.git Hardcoded stay-on-platform behaviour as follows: Mr. Bomb, Mr. Tree and the Totem never drop off ledges. Mr. Iceblock and Spiky will only drop to lower ledges. The rest will ignore ledges. SVN-Revision: 3364 --- diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 88827a509..fa572a1d6 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -359,6 +359,26 @@ BadGuy::may_fall_off_platform() return true; } +bool +BadGuy::might_fall(int height) +{ + // make sure we check for at least a 1-pixel fall + assert(height > 0); + + float x1; + float x2; + float y1 = bbox.p2.y + 1; + float y2 = bbox.p2.y + 1 + height; + if (dir == LEFT) { + x1 = bbox.p1.x - 1; + x2 = bbox.p1.x - 1; + } else { + x1 = bbox.p2.x + 1; + x2 = bbox.p2.x + 1; + } + return Sector::current()->is_free_space(Rect(x1, y1, x2, y2)); +} + Player* BadGuy::get_nearest_player() { diff --git a/src/badguy/badguy.hpp b/src/badguy/badguy.hpp index 24f31549f..872d2acb0 100644 --- a/src/badguy/badguy.hpp +++ b/src/badguy/badguy.hpp @@ -149,6 +149,7 @@ protected: * Checks if the badguy may fall off a platform if continuing a given movement. */ bool may_fall_off_platform(); + bool might_fall(int height); /**< returns true if we might soon fall at least @c height pixels. Minimum value for height is 1 pixel */ Vector start_position; diff --git a/src/badguy/dispenser.cpp b/src/badguy/dispenser.cpp index ec8653fe5..09f8d394e 100644 --- a/src/badguy/dispenser.cpp +++ b/src/badguy/dispenser.cpp @@ -92,31 +92,31 @@ Dispenser::launch_badguy() //FIXME: Does is_offscreen() work right here? if (!is_offscreen()) { if (badguy == "snowball") - Sector::current()->add_object(new SnowBall(get_pos().x, get_pos().y+32, dir, false)); + Sector::current()->add_object(new SnowBall(get_pos().x, get_pos().y+32, dir)); else if (badguy == "bouncingsnowball") Sector::current()->add_object(new BouncingSnowball(get_pos().x, get_pos().y+32, dir)); else if (badguy == "mrbomb") - Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir, false)); + Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir)); else if (badguy == "mriceblock") - Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir, false)); + Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir)); else if (badguy == "snowsnail") - Sector::current()->add_object(new SnowSnail(get_pos().x, get_pos().y+32, dir, false)); + Sector::current()->add_object(new SnowSnail(get_pos().x, get_pos().y+32, dir)); else if (badguy == "mrrocket") { Sector::current()->add_object(new MrRocket(get_pos().x+(dir == LEFT ? -32 : 32), get_pos().y, dir));} else if (badguy == "poisonivy") - Sector::current()->add_object(new PoisonIvy(get_pos().x, get_pos().y+32, dir, false)); + Sector::current()->add_object(new PoisonIvy(get_pos().x, get_pos().y+32, dir)); else if (badguy == "skullyhop") Sector::current()->add_object(new SkullyHop(get_pos().x, get_pos().y+44, dir)); else if (badguy == "random") { switch (rand()%7) { - case 0: Sector::current()->add_object(new SnowBall(get_pos().x, get_pos().y+32, dir, false)); break; + case 0: Sector::current()->add_object(new SnowBall(get_pos().x, get_pos().y+32, dir)); break; case 1: Sector::current()->add_object(new BouncingSnowball(get_pos().x, get_pos().y+32, dir)); break; - case 2: Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir, false)); break; - case 3: Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir, false)); break; - case 4: Sector::current()->add_object(new PoisonIvy(get_pos().x, get_pos().y+32, dir, false)); break; - case 5: Sector::current()->add_object(new SnowSnail(get_pos().x, get_pos().y+32, dir, false)); break; + case 2: Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir)); break; + case 3: Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir)); break; + case 4: Sector::current()->add_object(new PoisonIvy(get_pos().x, get_pos().y+32, dir)); break; + case 5: Sector::current()->add_object(new SnowSnail(get_pos().x, get_pos().y+32, dir)); break; case 6: Sector::current()->add_object(new SkullyHop(get_pos().x, get_pos().y+44, dir)); break; } } diff --git a/src/badguy/mrbomb.cpp b/src/badguy/mrbomb.cpp index 37622c3c1..586748080 100644 --- a/src/badguy/mrbomb.cpp +++ b/src/badguy/mrbomb.cpp @@ -28,18 +28,15 @@ MrBomb::MrBomb(const lisp::Lisp& reader) { reader.get("x", start_position.x); reader.get("y", start_position.y); - stay_on_platform = false; - reader.get("stay-on-platform", stay_on_platform); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/mr_bomb/mr_bomb.sprite"); set_direction = false; } -MrBomb::MrBomb(float pos_x, float pos_y, Direction d, bool stay_on_plat = false) +MrBomb::MrBomb(float pos_x, float pos_y, Direction d) { start_position.x = pos_x; start_position.y = pos_y; - stay_on_platform = stay_on_plat; bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/mr_bomb/mr_bomb.sprite"); set_direction = true; @@ -53,7 +50,6 @@ MrBomb::write(lisp::Writer& writer) writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); - writer.write_bool("stay-on-platform", stay_on_platform); writer.end_list("mrbomb"); } @@ -69,7 +65,7 @@ MrBomb::activate() void MrBomb::active_update(float elapsed_time) { - if (stay_on_platform && may_fall_off_platform()) + if (may_fall_off_platform()) { dir = (dir == LEFT ? RIGHT : LEFT); sprite->set_action(dir == LEFT ? "left" : "right"); diff --git a/src/badguy/mrbomb.hpp b/src/badguy/mrbomb.hpp index b5a887481..92af127c1 100644 --- a/src/badguy/mrbomb.hpp +++ b/src/badguy/mrbomb.hpp @@ -26,7 +26,7 @@ class MrBomb : public BadGuy { public: MrBomb(const lisp::Lisp& reader); - MrBomb(float pos_x, float pos_y, Direction d, bool stay_on_plat); + MrBomb(float pos_x, float pos_y, Direction d); void activate(); void active_update(float elapsed_time); @@ -38,7 +38,6 @@ public: protected: bool collision_squished(Player& player); bool set_direction; - bool stay_on_platform; Direction initial_direction; }; diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index 732793742..3361f41ab 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -31,19 +31,16 @@ MrIceBlock::MrIceBlock(const lisp::Lisp& reader) { reader.get("x", start_position.x); reader.get("y", start_position.y); - stay_on_platform = false; - reader.get("stay-on-platform", stay_on_platform); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/mr_iceblock/mr_iceblock.sprite"); set_direction = false; } -MrIceBlock::MrIceBlock(float pos_x, float pos_y, Direction d, bool stay_on_plat = false ) +MrIceBlock::MrIceBlock(float pos_x, float pos_y, Direction d) : ice_state(ICESTATE_NORMAL), squishcount(0) { start_position.x = pos_x; start_position.y = pos_y; - stay_on_platform = stay_on_plat; bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/mr_iceblock/mr_iceblock.sprite"); set_direction = true; @@ -57,7 +54,6 @@ MrIceBlock::write(lisp::Writer& writer) writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); - writer.write_bool("stay-on-platform", stay_on_platform); writer.end_list("mriceblock"); } @@ -83,9 +79,7 @@ MrIceBlock::active_update(float elapsed_time) set_state(ICESTATE_NORMAL); } - if (ice_state == ICESTATE_NORMAL && - stay_on_platform && - may_fall_off_platform()) + if (ice_state == ICESTATE_NORMAL && might_fall(601)) { dir = (dir == LEFT ? RIGHT : LEFT); sprite->set_action(dir == LEFT ? "left" : "right"); diff --git a/src/badguy/mriceblock.hpp b/src/badguy/mriceblock.hpp index d6e311c93..7ded21a37 100644 --- a/src/badguy/mriceblock.hpp +++ b/src/badguy/mriceblock.hpp @@ -27,7 +27,7 @@ class MrIceBlock : public BadGuy, public Portable { public: MrIceBlock(const lisp::Lisp& reader); - MrIceBlock(float pos_x, float pos_y, Direction d, bool stay_on_plat); + MrIceBlock(float pos_x, float pos_y, Direction d); void activate(); void write(lisp::Writer& writer); @@ -58,7 +58,6 @@ private: Timer flat_timer; int squishcount; bool set_direction; - bool stay_on_platform; Direction initial_direction; }; diff --git a/src/badguy/mrtree.cpp b/src/badguy/mrtree.cpp index dbcc450cf..3ad7ab40e 100644 --- a/src/badguy/mrtree.cpp +++ b/src/badguy/mrtree.cpp @@ -31,8 +31,6 @@ MrTree::MrTree(const lisp::Lisp& reader) { reader.get("x", start_position.x); reader.get("y", start_position.y); - stay_on_platform = false; - reader.get("stay-on-platform", stay_on_platform); bbox.set_size(84.8, 84.8); sprite = sprite_manager->create("images/creatures/mr_tree/mr_tree.sprite"); } @@ -76,7 +74,7 @@ MrTree::active_update(float elapsed_time) activate(); } - if (stay_on_platform && may_fall_off_platform()) + if (may_fall_off_platform()) { dir = (dir == LEFT ? RIGHT : LEFT); activate(); @@ -106,12 +104,12 @@ MrTree::collision_squished(Player& player) Rect leaf1_bbox = Rect(pos.x-32-1, pos.y-23+1, pos.x-32-1+32, pos.y-23+1+32); if (Sector::current()->is_free_space(leaf1_bbox)) { - PoisonIvy* leaf1 = new PoisonIvy(leaf1_bbox.p1.x, leaf1_bbox.p1.y, LEFT, true); + PoisonIvy* leaf1 = new PoisonIvy(leaf1_bbox.p1.x, leaf1_bbox.p1.y, LEFT); Sector::current()->add_object(leaf1); } Rect leaf2_bbox = Rect(pos.x+42+1, pos.y-23+1, pos.x+32+1+32, pos.y-23+1+32); if (Sector::current()->is_free_space(leaf2_bbox)) { - PoisonIvy* leaf2 = new PoisonIvy(leaf2_bbox.p1.x, leaf2_bbox.p1.y, RIGHT, true); + PoisonIvy* leaf2 = new PoisonIvy(leaf2_bbox.p1.x, leaf2_bbox.p1.y, RIGHT); Sector::current()->add_object(leaf2); } diff --git a/src/badguy/mrtree.hpp b/src/badguy/mrtree.hpp index 8253a2187..db3d019ba 100644 --- a/src/badguy/mrtree.hpp +++ b/src/badguy/mrtree.hpp @@ -38,7 +38,6 @@ protected: STATE_BIG, STATE_INVINCIBLE, STATE_NORMAL }; MyState mystate; - bool stay_on_platform; Timer invincible_timer; diff --git a/src/badguy/nolok_01.cpp b/src/badguy/nolok_01.cpp index c97ae4e51..aa0779120 100644 --- a/src/badguy/nolok_01.cpp +++ b/src/badguy/nolok_01.cpp @@ -94,8 +94,8 @@ Nolok_01::active_update(float elapsed_time) } case SHOOTING: { - Sector::current()->add_object(new SnowSnail(get_pos().x - 64, get_pos().y, LEFT, true)); - Sector::current()->add_object(new SnowSnail(get_pos().x + 64, get_pos().y, RIGHT, true)); + Sector::current()->add_object(new SnowSnail(get_pos().x - 64, get_pos().y, LEFT)); + Sector::current()->add_object(new SnowSnail(get_pos().x + 64, get_pos().y, RIGHT)); physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED); sprite->set_action(dir == LEFT ? "left" : "right"); action = WALKING; diff --git a/src/badguy/poisonivy.cpp b/src/badguy/poisonivy.cpp index 904d0d3a5..cad1a6402 100644 --- a/src/badguy/poisonivy.cpp +++ b/src/badguy/poisonivy.cpp @@ -27,18 +27,15 @@ PoisonIvy::PoisonIvy(const lisp::Lisp& reader) { reader.get("x", start_position.x); reader.get("y", start_position.y); - stay_on_platform = false; - reader.get("stay-on-platform", stay_on_platform); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/poison_ivy/poison_ivy.sprite"); set_direction = false; } -PoisonIvy::PoisonIvy(float pos_x, float pos_y, Direction d, bool stay_on_plat = false) +PoisonIvy::PoisonIvy(float pos_x, float pos_y, Direction d) { start_position.x = pos_x; start_position.y = pos_y; - stay_on_platform = stay_on_plat; bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/poison_ivy/poison_ivy.sprite"); set_direction = true; @@ -52,7 +49,6 @@ PoisonIvy::write(lisp::Writer& writer) writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); - if (stay_on_platform) writer.write_bool("stay-on-platform", true); writer.end_list("poisonivy"); } @@ -65,19 +61,6 @@ PoisonIvy::activate() sprite->set_action(dir == LEFT ? "left" : "right"); } -void -PoisonIvy::active_update(float elapsed_time) -{ - BadGuy::active_update(elapsed_time); - - if (stay_on_platform && may_fall_off_platform()) - { - dir = (dir == LEFT ? RIGHT : LEFT); - sprite->set_action(dir == LEFT ? "left" : "right"); - physic.set_velocity_x(-physic.get_velocity_x()); - } -} - bool PoisonIvy::collision_squished(Player& player) { diff --git a/src/badguy/poisonivy.hpp b/src/badguy/poisonivy.hpp index 710c6fff7..33d7e2c8d 100644 --- a/src/badguy/poisonivy.hpp +++ b/src/badguy/poisonivy.hpp @@ -26,18 +26,16 @@ class PoisonIvy : public BadGuy { public: PoisonIvy(const lisp::Lisp& reader); - PoisonIvy(float pos_x, float pos_y, Direction d, bool stay_on_plat); + PoisonIvy(float pos_x, float pos_y, Direction d); void activate(); void write(lisp::Writer& writer); - void active_update(float elapsed_time); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit); protected: bool collision_squished(Player& player); bool set_direction; - bool stay_on_platform; Direction initial_direction; }; diff --git a/src/badguy/snowball.cpp b/src/badguy/snowball.cpp index 63e12466f..1c2e6b678 100644 --- a/src/badguy/snowball.cpp +++ b/src/badguy/snowball.cpp @@ -30,19 +30,16 @@ SnowBall::SnowBall(const lisp::Lisp& reader) //This is for a hidden badguy :) fluffy = false; reader.get("fluffy",fluffy); - stay_on_platform = false; - reader.get("stay-on-platform", stay_on_platform); bbox.set_size(31.8, 31.8); if (fluffy) sprite = sprite_manager->create("images/creatures/fluffy/fluffy.sprite"); else sprite = sprite_manager->create("images/creatures/snowball/snowball.sprite"); set_direction = false; } -SnowBall::SnowBall(float pos_x, float pos_y, Direction d, bool stay_on_plat = false) +SnowBall::SnowBall(float pos_x, float pos_y, Direction d) { start_position.x = pos_x; start_position.y = pos_y; - stay_on_platform = stay_on_plat; bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/snowball/snowball.sprite"); set_direction = true; @@ -61,9 +58,6 @@ SnowBall::write(lisp::Writer& writer) writer.write_bool("fluffy", true); } - if (stay_on_platform) - writer.write_bool("stay-on-platform", true); - writer.end_list("snowball"); } @@ -75,19 +69,6 @@ SnowBall::activate() sprite->set_action(dir == LEFT ? "left" : "right"); } -void -SnowBall::active_update(float elapsed_time) -{ - BadGuy::active_update(elapsed_time); - - if (stay_on_platform && may_fall_off_platform()) - { - dir = (dir == LEFT ? RIGHT : LEFT); - sprite->set_action(dir == LEFT ? "left" : "right"); - physic.set_velocity_x(-physic.get_velocity_x()); - } -} - bool SnowBall::collision_squished(Player& player) { diff --git a/src/badguy/snowball.hpp b/src/badguy/snowball.hpp index 370ae169c..ce642fb9c 100644 --- a/src/badguy/snowball.hpp +++ b/src/badguy/snowball.hpp @@ -26,18 +26,16 @@ class SnowBall : public BadGuy { public: SnowBall(const lisp::Lisp& reader); - SnowBall(float pos_x, float pos_y, Direction d, bool stay_on_plat); + SnowBall(float pos_x, float pos_y, Direction d); void activate(); void write(lisp::Writer& writer); - void active_update(float elapsed_time); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit); protected: bool collision_squished(Player& player); bool set_direction; - bool stay_on_platform; Direction initial_direction; bool fluffy; }; diff --git a/src/badguy/snowsnail.cpp b/src/badguy/snowsnail.cpp index bd68f593e..679988539 100644 --- a/src/badguy/snowsnail.cpp +++ b/src/badguy/snowsnail.cpp @@ -31,19 +31,16 @@ SnowSnail::SnowSnail(const lisp::Lisp& reader) { reader.get("x", start_position.x); reader.get("y", start_position.y); - stay_on_platform = false; - reader.get("stay-on-platform", stay_on_platform); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/snowsnail/snowsnail.sprite"); set_direction = false; } -SnowSnail::SnowSnail(float pos_x, float pos_y, Direction d, bool stay_on_plat = false) +SnowSnail::SnowSnail(float pos_x, float pos_y, Direction d) : ice_state(ICESTATE_NORMAL), squishcount(0) { start_position.x = pos_x; start_position.y = pos_y; - stay_on_platform = stay_on_plat; bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/snowsnail/snowsnail.sprite"); set_direction = true; @@ -57,7 +54,6 @@ SnowSnail::write(lisp::Writer& writer) writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); - if (stay_on_platform) writer.write_bool("stay-on-platform", true); writer.end_list("snowsnail"); } @@ -81,13 +77,6 @@ SnowSnail::active_update(float elapsed_time) physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED); sprite->set_action(dir == LEFT ? "left" : "right"); } - if(ice_state == ICESTATE_NORMAL && stay_on_platform - && may_fall_off_platform()) - { - dir = (dir == LEFT ? RIGHT : LEFT); - sprite->set_action(dir == LEFT ? "left" : "right"); - physic.set_velocity_x(-physic.get_velocity_x()); - } BadGuy::active_update(elapsed_time); } diff --git a/src/badguy/snowsnail.hpp b/src/badguy/snowsnail.hpp index 7364b4907..4a304d33d 100644 --- a/src/badguy/snowsnail.hpp +++ b/src/badguy/snowsnail.hpp @@ -26,7 +26,7 @@ class SnowSnail : public BadGuy { public: SnowSnail(const lisp::Lisp& reader); - SnowSnail(float pos_x, float pos_y, Direction d, bool stay_on_plat); + SnowSnail(float pos_x, float pos_y, Direction d); void activate(); void write(lisp::Writer& writer); @@ -48,7 +48,6 @@ private: Timer flat_timer; int squishcount; bool set_direction; - bool stay_on_platform; Direction initial_direction; }; diff --git a/src/badguy/spiky.cpp b/src/badguy/spiky.cpp index 536e63ed9..8aceaae30 100644 --- a/src/badguy/spiky.cpp +++ b/src/badguy/spiky.cpp @@ -27,8 +27,6 @@ Spiky::Spiky(const lisp::Lisp& reader) { reader.get("x", start_position.x); reader.get("y", start_position.y); - stay_on_platform = false; - reader.get("stay-on-platform", stay_on_platform); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/spiky/spiky.sprite"); } @@ -40,7 +38,6 @@ Spiky::write(lisp::Writer& writer) writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); - if (stay_on_platform) writer.write_bool("stay-on-platform", true); writer.end_list("spiky"); } @@ -57,7 +54,7 @@ Spiky::active_update(float elapsed_time) { BadGuy::active_update(elapsed_time); - if (stay_on_platform && may_fall_off_platform()) + if (might_fall(601)) { dir = (dir == LEFT ? RIGHT : LEFT); sprite->set_action(dir == LEFT ? "left" : "right"); diff --git a/src/badguy/spiky.hpp b/src/badguy/spiky.hpp index fc04ffbcb..8eed44297 100644 --- a/src/badguy/spiky.hpp +++ b/src/badguy/spiky.hpp @@ -32,8 +32,6 @@ public: void active_update(float elapsed_time); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit); -private: - bool stay_on_platform; }; #endif diff --git a/src/badguy/sspiky.cpp b/src/badguy/sspiky.cpp index 779c6ff7c..8275b88fc 100644 --- a/src/badguy/sspiky.cpp +++ b/src/badguy/sspiky.cpp @@ -28,8 +28,6 @@ SSpiky::SSpiky(const lisp::Lisp& reader) { reader.get("x", start_position.x); reader.get("y", start_position.y); - stay_on_platform = false; - reader.get("stay-on-platform", stay_on_platform); bbox.set_size(31.8, 31.8); sprite = sprite_manager->create("images/creatures/spiky/sleepingspiky.sprite"); state = SSPIKY_SLEEPING; @@ -42,7 +40,6 @@ SSpiky::write(lisp::Writer& writer) writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); - if (stay_on_platform) writer.write_bool("stay-on-platform", true); writer.end_list("sspiky"); } @@ -121,13 +118,6 @@ SSpiky::active_update(float elapsed_time) { state = SSPIKY_WALKING; } } - - if (state == SSPIKY_WALKING && stay_on_platform && may_fall_off_platform()) - { - dir = (dir == LEFT ? RIGHT : LEFT); - sprite->set_action(dir == LEFT ? "left" : "right"); - physic.set_velocity_x(-physic.get_velocity_x()); - } } IMPLEMENT_FACTORY(SSpiky, "sspiky") diff --git a/src/badguy/sspiky.hpp b/src/badguy/sspiky.hpp index 8aa24b3b0..532e06e01 100644 --- a/src/badguy/sspiky.hpp +++ b/src/badguy/sspiky.hpp @@ -42,8 +42,6 @@ protected: SSPIKY_WALKING }; SSpikyState state; -private: - bool stay_on_platform; }; #endif diff --git a/src/badguy/totem.cpp b/src/badguy/totem.cpp index e6111f0ba..c61ab9aa5 100644 --- a/src/badguy/totem.cpp +++ b/src/badguy/totem.cpp @@ -29,14 +29,12 @@ static const float JUMP_OFF_SPEED_Y = 500; Totem::Totem(const lisp::Lisp& reader) { - stay_on_platform = false; carrying = 0; carried_by = 0; bbox.set_size(48, 49); reader.get("x", start_position.x); reader.get("y", start_position.y); - reader.get("stay-on-platform", stay_on_platform); sprite = sprite_manager->create("images/creatures/totem/totem.sprite"); } @@ -53,7 +51,6 @@ Totem::write(lisp::Writer& writer) writer.write_float("x", start_position.x); writer.write_float("y", start_position.y); - writer.write_bool("stay-on-platform", stay_on_platform); writer.end_list("totem"); } @@ -78,7 +75,7 @@ Totem::active_update(float elapsed_time) BadGuy::active_update(elapsed_time); if (!carried_by) { - if (stay_on_platform && may_fall_off_platform()) + if (may_fall_off_platform()) { dir = (dir == LEFT ? RIGHT : LEFT); activate(); diff --git a/src/badguy/totem.hpp b/src/badguy/totem.hpp index 5146d82b3..f64e0985b 100644 --- a/src/badguy/totem.hpp +++ b/src/badguy/totem.hpp @@ -39,8 +39,6 @@ public: HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit); protected: - bool stay_on_platform; /**< change direction before falling off a ledge */ - Totem* carrying; /**< Totem we are currently carrying (or 0) */ Totem* carried_by; /**< Totem by which we are currently carried (or 0) */ diff --git a/src/sector.cpp b/src/sector.cpp index 0d8bcc13b..1fbbbb0e6 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -1065,8 +1065,8 @@ Sector::is_free_space(const Rect& rect) const int max_x = int(rect.p2.x); int max_y = int(rect.p2.y); - for(int x = starttilex; x*32 < max_x; ++x) { - for(int y = starttiley; y*32 < max_y; ++y) { + for(int x = starttilex; x*32 <= max_x; ++x) { + for(int y = starttiley; y*32 <= max_y; ++y) { const Tile* tile = solids->get_tile(x, y); if(!tile) continue;