- removed alpha from tile since it isn't needed
authorIngo Ruhnke <grumbel@gmx.de>
Sun, 28 Mar 2004 14:11:53 +0000 (14:11 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Sun, 28 Mar 2004 14:11:53 +0000 (14:11 +0000)
- fixed brick behaviour (I hope...)

SVN-Revision: 406

src/gameloop.cpp
src/gameloop.h
src/player.cpp
src/tile.cpp
src/tile.h

index 3c84ebb..3c298fa 100644 (file)
@@ -1344,8 +1344,7 @@ bool isdistro(float x, float y)
 }
 
 /* Break a brick: */
-
-void trybreakbrick(float x, float y)
+void trybreakbrick(float x, float y, bool small)
 {
   Tile* tile = gettile(x, y);
   if (tile->brick)
@@ -1369,23 +1368,19 @@ void trybreakbrick(float x, float y)
           score = score + SCORE_DISTRO;
           distros++;
         }
-      else
+      else if (!small)
         {
           /* Get rid of it: */
           level_change(&current_level,x, y, TM_IA, tile->next_tile);
+          
+          /* Replace it with broken bits: */
+          add_broken_brick(((int)(x + 1) / 32) * 32,
+                           (int)(y / 32) * 32);
+          
+          /* Get some score: */
+          play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER);
+          score = score + SCORE_BRICK;
         }
-
-
-      /* Replace it with broken bits: */
-
-      add_broken_brick(((int)(x + 1) / 32) * 32,
-                       (int)(y / 32) * 32);
-
-
-      /* Get some score: */
-
-      play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER);
-      score = score + SCORE_BRICK;
     }
 }
 
index 31230a5..27a6d16 100644 (file)
@@ -43,9 +43,18 @@ bool rectcollision(base_type* one, base_type* two);
 void drawshape(float x, float y, unsigned int c);
 unsigned int shape(float x, float y);
 void bumpbrick(float x, float y);
+
+/** Try to grab the coin at the given coordinates */
 void trygrabdistro(float x, float y, int bounciness);
-void trybreakbrick(float x, float y);
+
+/** Try to break the brick at the given coordinates */
+void trybreakbrick(float x, float y, bool small);
+
+/** Try to get the content out of a bonus box, thus emptying it */
 void tryemptybox(float x, float y, int col_side);
+
+/** Try to bumb a badguy that might we walking above Tux, thus shaking
+    the tile which the badguy is walking on an killing him this way */
 void trybumpbadguy(float x, float y);
 
 #endif /*SUPERTUX_GAMELOOP_H*/
index f208844..dd7e3b1 100644 (file)
@@ -216,8 +216,7 @@ Player::action()
               trygrabdistro(base.x, base.y - 32,BOUNCE);
               trybumpbadguy(base.x, base.y - 64);
 
-              if(size == BIG)
-                trybreakbrick(base.x, base.y);
+              trybreakbrick(base.x, base.y, size == SMALL);
 
               bumpbrick(base.x, base.y);
               tryemptybox(base.x, base.y, RIGHT);
@@ -230,59 +229,11 @@ Player::action()
               trybumpbadguy(base.x+ 31, base.y - 64);
 
               if(size == BIG)
-                trybreakbrick(base.x+ 31, base.y);
+                trybreakbrick(base.x+ 31, base.y, size == SMALL);
 
               bumpbrick(base.x+ 31, base.y);
               tryemptybox(base.x+ 31, base.y, LEFT);
             }
-
-
-          if(size == SMALL)
-            {
-              Tile* tile  = gettile(base.x, base.y);
-              /* Get a distro from a brick? */
-              if (tile->brick)
-                {
-                  add_bouncy_distro((((int)base.x)
-                                     / 32) * 32,
-                                    ((int)base.y / 32) * 32);
-                  
-                  if (counting_distros == false)
-                    {
-                      counting_distros = true;
-                      distro_counter = 100;
-                    }
-
-                  if (distro_counter <= 0)
-                    level_change(&current_level,base.x,base.y - 1, TM_IA, tile->next_tile);
-                   
-                  play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
-                  score = score + SCORE_DISTRO;
-                  distros++;
-                }
-            }
-          else 
-            {
-              Tile* tile2 = gettile(base.x + 31, base.y);
-              if (tile2->brick)
-              {
-                  add_bouncy_distro((((int)base.x + 31)
-                                     / 32) * 32,
-                                    ((int)base.y / 32) * 32);
-                  if (counting_distros == false)
-                    {
-                      counting_distros = true;
-                      distro_counter = 100;
-                    }
-
-                  if (distro_counter <= 0)
-                    level_change(&current_level,base.x+ 31, base.y, TM_IA, tile2->next_tile);
-
-                  play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER);
-                  score = score + SCORE_DISTRO;
-                  distros++;
-                }
-            }
         }
 
       grabdistros();
index 2f3916e..25c8dca 100644 (file)
@@ -46,7 +46,6 @@ void TileManager::load_tileset(std::string filename)
              tile->fullbox = false;          
               tile->distro  = false;
               tile->data    = 0;
-              tile->alpha   = 0;
               tile->next_tile  = 0;
               tile->anim_speed = 25;
   
@@ -57,8 +56,7 @@ void TileManager::load_tileset(std::string filename)
               reader.read_bool("ice",       &tile->ice);          
               reader.read_bool("fullbox",   &tile->fullbox);
               reader.read_bool("distro",    &tile->distro);
-              reader.read_int("data",       (int*)&tile->data);
-              reader.read_int("alpha",      (int*)&tile->alpha);
+              reader.read_int("data",       &tile->data);
               reader.read_int("anim-speed", &tile->anim_speed);
               reader.read_int("next-tile",  &tile->next_tile);
               reader.read_string_vector("images",  &tile->filenames);
index fc15208..850e121 100644 (file)
@@ -51,7 +51,6 @@ struct Tile
   int next_tile;
 
   int anim_speed;
-  unsigned char alpha;
 };