From: Ingo Ruhnke Date: Thu, 25 Mar 2004 02:27:45 +0000 (+0000) Subject: - fixed bricktile X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c1911c9050af3456fa60ab2322bc33fe823824db;p=supertux.git - fixed bricktile SVN-Revision: 353 --- diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 5addbe767..66e392e52 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -1318,17 +1318,19 @@ void unloadshared(void) void drawshape(float x, float y, unsigned int c) { - Tile* ptile = TileManager::instance()->get - (c); - if(ptile) + if (c != 0) { - if(ptile->images.size() > 1) + Tile* ptile = TileManager::instance()->get(c); + if(ptile) { - texture_draw(&ptile->images[( ((global_frame_counter*25) / ptile->anim_speed) % (ptile->images.size()))],x,y); - } - else - { - texture_draw(&ptile->images[0],x,y); + if(ptile->images.size() > 1) + { + texture_draw(&ptile->images[( ((global_frame_counter*25) / ptile->anim_speed) % (ptile->images.size()))],x,y); + } + else + { + texture_draw(&ptile->images[0],x,y); + } } } diff --git a/src/gameloop.h b/src/gameloop.h index a92f85f15..31230a58d 100644 --- a/src/gameloop.h +++ b/src/gameloop.h @@ -28,7 +28,9 @@ extern int game_started; extern st_level current_level; /* Function prototypes: */ +class Tile; +Tile* gettile(float x, float y); int gameloop(const char * subset, int levelnb, int mode); void savegame(int slot); void loadgame(int slot); diff --git a/src/level.cpp b/src/level.cpp index c6fe377bc..eebecdf1f 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -290,7 +290,10 @@ int level_load(st_level* plevel, const char* filename) reader.read_string("background", &plevel->bkgd_image); reader.read_string("particle_system", &plevel->particle_system); reader.read_int_vector("background-tm", &bg_tm); - reader.read_int_vector("interactive-tm", &ia_tm); + + if (!reader.read_int_vector("interactive-tm", &ia_tm)) + reader.read_int_vector("tilemap", &ia_tm); + reader.read_int_vector("dynamic-tm", &dn_tm); reader.read_int_vector("foreground-tm", &fg_tm); @@ -614,8 +617,6 @@ void tilemap_change_size(unsigned int** tilemap[15], int w, int old_w) /* Change the size of a level (width) */ void level_change_size (st_level* plevel, int new_width) { - int y; - if(new_width < 21) new_width = 21; tilemap_change_size((unsigned int***)&plevel->ia_tiles,new_width,plevel->width); diff --git a/src/player.cpp b/src/player.cpp index c6daeaef7..b40e09365 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -15,6 +15,7 @@ #include "player.h" #include "defines.h" #include "scene.h" +#include "tile.h" #include "screen.h" texture_type tux_life; @@ -243,8 +244,8 @@ Player::action() if(size == SMALL) { /* Get a distro from a brick? */ - if (shape(base.x, base.y) == 'x' || - shape(base.x, base.y) == 'y') + if (gettile(base.x, base.y)->brick || + gettile(base.x, base.y)->brick) { add_bouncy_distro((((int)base.x) / 32) * 32, @@ -262,8 +263,8 @@ Player::action() score = score + SCORE_DISTRO; distros++; } - else if (shape(base.x+ 31, base.y) == 'x' || - shape(base.x+ 31, base.y) == 'y') + else if (gettile(base.x+ 31, base.y)->brick || + gettile(base.x+ 31, base.y)->brick) { add_bouncy_distro((((int)base.x + 31) / 32) * 32, diff --git a/src/tile.cpp b/src/tile.cpp index 09a6f886e..80f6364a0 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -42,13 +42,13 @@ void TileManager::load_tileset(std::string filename) std::vector filenames; Tile* tile = new Tile; - tile->solid = false; - tile->brick = false; - tile->ice = false; + tile->solid = false; + tile->brick = false; + tile->ice = false; tile->fullbox = false; - tile->alpha = 0; - tile->distro = 0; - tile->data = 0; + tile->distro = false; + tile->data = 0; + tile->alpha = 0; tile->anim_speed = 25; LispReader reader(lisp_cdr(element));