From a773fb8a2e63ec07086f4a03b1e94340ea170c73 Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Sat, 27 Mar 2004 00:38:47 +0000 Subject: [PATCH] - removed dn_tilemap - fixed broken level_change() function to draw only on one map, not all at once SVN-Revision: 386 --- src/gameloop.cpp | 7 ++----- src/level.cpp | 30 ++++++------------------------ src/level.h | 4 +--- src/leveleditor.cpp | 23 ----------------------- 4 files changed, 9 insertions(+), 55 deletions(-) diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 4a8d7f299..f2e454e27 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -477,7 +477,7 @@ int game_action(void) void game_draw(void) { -int y,x; + int y,x; /* Draw screen: */ if (tux.dying && (global_frame_counter % 4) == 0) @@ -518,7 +518,6 @@ int y,x; } /* Draw interactive tiles: */ - for (y = 0; y < 15; ++y) { for (x = 0; x < 21; ++x) @@ -529,7 +528,6 @@ int y,x; } /* (Bouncy bricks): */ - for (unsigned int i = 0; i < bouncy_bricks.size(); ++i) bouncy_brick_draw(&bouncy_bricks[i]); @@ -548,13 +546,12 @@ int y,x; upgrade_draw(&upgrades[i]); for (unsigned int i = 0; i < bouncy_distros.size(); ++i) - bouncy_distro_draw(&bouncy_distros[i]); + bouncy_distro_draw(&bouncy_distros[i]); for (unsigned int i = 0; i < broken_bricks.size(); ++i) broken_brick_draw(&broken_bricks[i]); /* Draw foreground: */ - for (y = 0; y < 15; ++y) { for (x = 0; x < 21; ++x) diff --git a/src/level.cpp b/src/level.cpp index 34241ac2e..d4935863c 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -224,12 +224,6 @@ void level_default(st_level* plevel) for(y = 0; y < plevel->width; ++y) plevel->fg_tiles[i][y] = (unsigned int) '.'; plevel->fg_tiles[i][plevel->width] = (unsigned int) '\0'; - - plevel->dn_tiles[i] = (unsigned int*) malloc((plevel->width+1)*sizeof(unsigned int)); - plevel->dn_tiles[i][plevel->width] = (unsigned int) '\0'; - for(y = 0; y < plevel->width; ++y) - plevel->dn_tiles[i][y] = (unsigned int) '.'; - plevel->dn_tiles[i][plevel->width] = (unsigned int) '\0'; } } @@ -389,7 +383,6 @@ int level_load(st_level* plevel, const char* filename) for(int i = 0; i < 15; ++i) { - plevel->dn_tiles[i] = (unsigned int*) calloc((plevel->width +1) , sizeof(unsigned int) ); plevel->ia_tiles[i] = (unsigned int*) calloc((plevel->width +1) , sizeof(unsigned int) ); plevel->bg_tiles[i] = (unsigned int*) calloc((plevel->width +1) , sizeof(unsigned int) ); plevel->fg_tiles[i] = (unsigned int*) calloc((plevel->width +1) , sizeof(unsigned int) ); @@ -502,15 +495,6 @@ void level_save(st_level* plevel,const char * subset, int level) } fprintf( fi,")\n"); - fprintf(fi," (dynamic-tm "); - - for(y = 0; y < 15; ++y) - { - for(i = 0; i < plevel->width; ++i) - fprintf(fi," %d ", plevel->dn_tiles[y][i]); - } - - fprintf( fi,")\n"); fprintf(fi," (foreground-tm "); for(y = 0; y < 15; ++y) @@ -536,8 +520,6 @@ void level_free(st_level* plevel) for(i=0; i < 15; ++i) free(plevel->ia_tiles[i]); for(i=0; i < 15; ++i) - free(plevel->dn_tiles[i]); - for(i=0; i < 15; ++i) free(plevel->fg_tiles[i]); plevel->name.clear(); @@ -637,7 +619,6 @@ void level_change_size (st_level* plevel, int new_width) if(new_width < 21) new_width = 21; tilemap_change_size((unsigned int***)&plevel->ia_tiles,new_width,plevel->width); - tilemap_change_size((unsigned int***)&plevel->dn_tiles,new_width,plevel->width); tilemap_change_size((unsigned int***)&plevel->bg_tiles,new_width,plevel->width); tilemap_change_size((unsigned int***)&plevel->fg_tiles,new_width,plevel->width); plevel->width = new_width; @@ -657,14 +638,15 @@ void level_change(st_level* plevel, float x, float y, int tm, unsigned int c) { switch(tm) { - case 0: + case TM_BG: plevel->bg_tiles[yy][xx] = c; - case 1: + break; + case TM_IA: plevel->ia_tiles[yy][xx] = c; - case 2: - plevel->dn_tiles[yy][xx] = c; - case 4: + break; + case TM_FG: plevel->fg_tiles[yy][xx] = c; + break; } } } diff --git a/src/level.h b/src/level.h index 486242ea3..521c14845 100644 --- a/src/level.h +++ b/src/level.h @@ -42,10 +42,9 @@ class st_subset #define LEVEL_NAME_MAX 20 -enum { +enum TileMapType { TM_BG, TM_IA, - TM_DN, TM_FG }; @@ -64,7 +63,6 @@ class st_level std::string particle_system; unsigned int* bg_tiles[15]; /* Tiles in the background */ unsigned int* ia_tiles[15]; /* Tiles which can interact in the game (solids for example)*/ - unsigned int* dn_tiles[15]; /* Dynamic tiles (bad guys and moving platforms for example)*/ unsigned int* fg_tiles[15]; /* Tiles in the foreground */ int time_left; int bkgd_red; diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index a7fc46f3c..aeb44e9e4 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -118,24 +118,6 @@ static square selection; static int le_selection_mode; static SDL_Event event; -void le_activate_bad_guys(void) -{ - int x,y; - - /* Activate bad guys: */ - - /* as oposed to the gameloop.c func, this one doesn't remove - the badguys from tiles */ - - for (y = 0; y < 15; ++y) - for (x = 0; x < le_current_level->width; ++x) - if (le_current_level->dn_tiles[y][x] >= '0' && le_current_level->dn_tiles[y][x] <= '9') - add_bad_guy(x * 32, y * 32, static_cast(le_current_level->dn_tiles[y][x] - '0')); - - - -} - void le_set_defaults() { if(le_current_level != NULL) @@ -241,7 +223,6 @@ int leveleditor(int levelnb) le_update_buttons(le_current_level->theme.c_str()); le_set_defaults(); level_load_gfx(le_current_level); - le_activate_bad_guys(); show_menu = true; } break; @@ -273,7 +254,6 @@ int leveleditor(int levelnb) le_update_buttons(le_current_level->theme.c_str()); le_set_defaults(); level_load_gfx(le_current_level); - le_activate_bad_guys(); menu_item_change_input(&subset_new_menu->item[2],""); show_menu = true; break; @@ -659,8 +639,6 @@ void le_goto_level(int levelnb) level_free_gfx(); level_load_gfx(le_current_level); - - le_activate_bad_guys(); } void le_quit(void) @@ -1383,7 +1361,6 @@ void le_testlevel() arrays_init(); level_load_gfx(le_current_level); loadshared(); - le_activate_bad_guys(); } void le_showhelp() -- 2.11.0