From: Ingo Ruhnke Date: Sun, 28 Mar 2004 14:11:53 +0000 (+0000) Subject: - removed alpha from tile since it isn't needed X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d252b040c3cfebbc8f291f1c05275dd68a1b8b09;p=supertux.git - removed alpha from tile since it isn't needed - fixed brick behaviour (I hope...) SVN-Revision: 406 --- diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 3c84ebbf6..3c298faa7 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -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(¤t_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; } } diff --git a/src/gameloop.h b/src/gameloop.h index 31230a58d..27a6d1629 100644 --- a/src/gameloop.h +++ b/src/gameloop.h @@ -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*/ diff --git a/src/player.cpp b/src/player.cpp index f20884403..dd7e3b1c5 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -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(¤t_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(¤t_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(); diff --git a/src/tile.cpp b/src/tile.cpp index 2f3916e04..25c8dcad9 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -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); diff --git a/src/tile.h b/src/tile.h index fc1520817..850e1214a 100644 --- a/src/tile.h +++ b/src/tile.h @@ -51,7 +51,6 @@ struct Tile int next_tile; int anim_speed; - unsigned char alpha; };