MrBomb, MrIceBlock, and Snail now die on invincibility rather than just being kicked...
authorMathnerd314 <man.is.allan@gmail.com>
Tue, 19 Jan 2010 03:06:25 +0000 (03:06 +0000)
committerMathnerd314 <man.is.allan@gmail.com>
Tue, 19 Jan 2010 03:06:25 +0000 (03:06 +0000)
SVN-Revision: 6262

src/badguy/mrbomb.cpp
src/badguy/mriceblock.cpp
src/badguy/snail.cpp

index 9614e74..8b41189 100644 (file)
@@ -18,6 +18,7 @@
 #include "badguy/bomb.hpp"
 #include "badguy/mrbomb.hpp"
 #include "object/explosion.hpp"
+#include "object/player.hpp"
 #include "sprite/sprite.hpp"
 #include "sprite/sprite_manager.hpp"
 #include "supertux/object_factory.hpp"
@@ -77,6 +78,12 @@ MrBomb::collision_player(Player& player, const CollisionHit& hit)
 bool
 MrBomb::collision_squished(GameObject& object)
 {
+  Player* player = dynamic_cast<Player*>(&object);
+  if(player && player->is_invincible()) {
+    player->bounce(*this);
+    kill_fall();
+    return true;
+  }
   if(is_valid()) {
     remove_me();
     Sector::current()->add_object(new Bomb(get_pos(), dir, sprite_name ));
index 9cc320a..4b8d6e3 100644 (file)
@@ -177,6 +177,13 @@ MrIceBlock::collision_badguy(BadGuy& badguy, const CollisionHit& hit)
 bool
 MrIceBlock::collision_squished(GameObject& object)
 {
+  Player* player = dynamic_cast<Player*>(&object);
+  if(player && (player->does_buttjump || player->is_invincible())) {
+    player->bounce(*this);
+    kill_fall();
+    return true;
+  }
+
   switch(ice_state) {
     case ICESTATE_KICKED:
     {
@@ -190,9 +197,8 @@ MrIceBlock::collision_squished(GameObject& object)
     // fall through
     case ICESTATE_NORMAL:
     {
-      Player* player = dynamic_cast<Player*>(&object);
       squishcount++;
-      if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) {
+      if (squishcount >= MAXSQUISHES) {
         kill_fall();
         return true;
       }
@@ -217,7 +223,6 @@ MrIceBlock::collision_squished(GameObject& object)
       break;
   }
 
-  Player* player = dynamic_cast<Player*>(&object);
   if (player) player->bounce(*this);
   return true;
 }
index cff4b63..c441b01 100644 (file)
@@ -185,14 +185,20 @@ Snail::collision_badguy(BadGuy& badguy, const CollisionHit& hit)
 bool
 Snail::collision_squished(GameObject& object)
 {
+  Player* player = dynamic_cast<Player*>(&object);
+  if(player && (player->does_buttjump || player->is_invincible())) {
+    kill_fall();
+    player->bounce(*this);
+    return true;
+  }
+
   switch(state) {
 
     case STATE_KICKED:
     case STATE_NORMAL:
     {
-      Player* player = dynamic_cast<Player*>(&object);
       squishcount++;
-      if ((squishcount >= MAX_SNAIL_SQUISHES) || (player && player->does_buttjump)) {
+      if (squishcount >= MAX_SNAIL_SQUISHES) {
         kill_fall();
         return true;
       }
@@ -220,7 +226,6 @@ Snail::collision_squished(GameObject& object)
 
   }
 
-  Player* player = dynamic_cast<Player*>(&object);
   if (player) player->bounce(*this);
   return true;
 }