Hardcoded stay-on-platform behaviour as follows: Mr. Bomb, Mr. Tree and the Totem...
authorChristoph Sommer <mail@christoph-sommer.de>
Wed, 19 Apr 2006 00:54:40 +0000 (00:54 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Wed, 19 Apr 2006 00:54:40 +0000 (00:54 +0000)
SVN-Revision: 3364

23 files changed:
src/badguy/badguy.cpp
src/badguy/badguy.hpp
src/badguy/dispenser.cpp
src/badguy/mrbomb.cpp
src/badguy/mrbomb.hpp
src/badguy/mriceblock.cpp
src/badguy/mriceblock.hpp
src/badguy/mrtree.cpp
src/badguy/mrtree.hpp
src/badguy/nolok_01.cpp
src/badguy/poisonivy.cpp
src/badguy/poisonivy.hpp
src/badguy/snowball.cpp
src/badguy/snowball.hpp
src/badguy/snowsnail.cpp
src/badguy/snowsnail.hpp
src/badguy/spiky.cpp
src/badguy/spiky.hpp
src/badguy/sspiky.cpp
src/badguy/sspiky.hpp
src/badguy/totem.cpp
src/badguy/totem.hpp
src/sector.cpp

index 88827a5..fa572a1 100644 (file)
@@ -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()
 {
index 24f3154..872d2ac 100644 (file)
@@ -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;
 
index ec8653f..09f8d39 100644 (file)
@@ -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;
       }
     }
index 37622c3..5867480 100644 (file)
@@ -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");
index b5a8874..92af127 100644 (file)
@@ -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;  
 };
 
index 7327937..3361f41 100644 (file)
@@ -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");
index d6e311c..7ded21a 100644 (file)
@@ -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;
 };
 
index dbcc450..3ad7ab4 100644 (file)
@@ -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);
     }
 
index 8253a21..db3d019 100644 (file)
@@ -38,7 +38,6 @@ protected:
     STATE_BIG, STATE_INVINCIBLE, STATE_NORMAL
   };
   MyState mystate;
-  bool stay_on_platform;
 
   Timer invincible_timer;
 
index c97ae4e..aa07791 100644 (file)
@@ -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;
index 904d0d3..cad1a64 100644 (file)
@@ -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)
 {
index 710c6ff..33d7e2c 100644 (file)
@@ -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;  
 };
 
index 63e1246..1c2e6b6 100644 (file)
@@ -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)
 {
index 370ae16..ce642fb 100644 (file)
@@ -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;
 };
index bd68f59..6799885 100644 (file)
@@ -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);
 }
 
index 7364b49..4a304d3 100644 (file)
@@ -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;  
 };
 
index 536e63e..8aceaae 100644 (file)
@@ -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");
index fc04ffb..8eed442 100644 (file)
@@ -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
index 779c6ff..8275b88 100644 (file)
@@ -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")
index 8aa24b3..532e06e 100644 (file)
@@ -42,8 +42,6 @@ protected:
     SSPIKY_WALKING
   };
   SSpikyState state;
-private:
-  bool stay_on_platform;  
 };
 
 #endif
index e6111f0..c61ab9a 100644 (file)
@@ -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();
index 5146d82..f64e098 100644 (file)
@@ -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) */
 
index 0d8bcc1..1fbbbb0 100644 (file)
@@ -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;