[Super-tux-commit] supertux/src level.cpp,1.36,1.37 player.cpp,1.42,1.43 player.h,1.28,1.29 resource
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-04-18 21:17:10
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6171/src Modified Files: level.cpp player.cpp player.h resources.cpp Log Message: - fixed some align problems with tux - fixed bug in tilemap resize Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- player.cpp 18 Apr 2004 20:36:00 -0000 1.42 +++ player.cpp 18 Apr 2004 21:16:53 -0000 1.43 @@ -32,8 +32,8 @@ Sprite* bigtux_left; Sprite* bigtux_right_jump; Sprite* bigtux_left_jump; -Surface* ducktux_right; -Surface* ducktux_left; +Sprite* ducktux_right; +Sprite* ducktux_left; Surface* skidtux_right; Surface* skidtux_left; Surface* firetux_right[3]; @@ -517,14 +517,9 @@ /* Draw cape: */ if (dir == RIGHT) - { - cape_right[global_frame_counter % 2]->draw(base.x- scroll_x, base.y); - } + cape_right[global_frame_counter % 2]->draw(base.x- scroll_x, base.y); else - { - cape_left[global_frame_counter % 2]->draw( - base.x- scroll_x, base.y); - } + cape_left[global_frame_counter % 2]->draw(base.x- scroll_x, base.y); } @@ -549,11 +544,9 @@ else // moving { if (dir == RIGHT) - tux_right[(global_frame_counter/2) % tux_right.size()]->draw( - base.x - scroll_x, base.y - 9); + tux_right[(global_frame_counter/2) % tux_right.size()]->draw(base.x - scroll_x, base.y - 9); else - tux_left[(global_frame_counter/2) % tux_left.size()]->draw( - base.x - scroll_x, base.y - 9); + tux_left[(global_frame_counter/2) % tux_left.size()]->draw(base.x - scroll_x, base.y - 9); } } } @@ -581,15 +574,9 @@ /* Draw cape (just not in ducked mode since that looks silly): */ if (dir == RIGHT) - { - bigcape_right[global_frame_counter % 2]->draw( - capex, capey); - } + bigcape_right[global_frame_counter % 2]->draw(capex, capey); else - { - bigcape_left[global_frame_counter % 2]->draw( - capex, capey); - } + bigcape_left[global_frame_counter % 2]->draw(capex, capey); } if (!got_coffee) @@ -601,36 +588,32 @@ if (physic.get_velocity_y() == 0) { if (dir == RIGHT) - bigtux_right->draw(base.x- scroll_x - 8, base.y); + bigtux_right->draw(base.x - scroll_x, base.y); else - bigtux_left->draw(base.x- scroll_x - 8, base.y); + bigtux_left->draw(base.x - scroll_x, base.y); } else { if (dir == RIGHT) - bigtux_right_jump->draw(base.x- scroll_x - 8, base.y); + bigtux_right_jump->draw(base.x - scroll_x, base.y); else - bigtux_left_jump->draw(base.x- scroll_x - 8, base.y); + bigtux_left_jump->draw(base.x - scroll_x, base.y); } } else { if (dir == RIGHT) - skidtux_right->draw(base.x- scroll_x - 8, base.y); + skidtux_right->draw(base.x - scroll_x - 8, base.y); else - skidtux_left->draw(base.x- scroll_x - 8, base.y); + skidtux_left->draw(base.x - scroll_x - 8, base.y); } } else { if (dir == RIGHT) - { - ducktux_right->draw( base.x- scroll_x - 8, base.y - 16); - } + ducktux_right->draw(base.x - scroll_x, base.y); else - { - ducktux_left->draw( base.x- scroll_x - 8, base.y - 16); - } + ducktux_left->draw(base.x - scroll_x, base.y); } } else @@ -643,54 +626,32 @@ if (!jumping || physic.get_velocity_y() > 0) { if (dir == RIGHT) - { - bigfiretux_right[frame_]->draw( - base.x- scroll_x - 8, base.y); - } + bigfiretux_right[frame_]->draw(base.x- scroll_x - 8, base.y); else - { - bigfiretux_left[frame_]->draw( - base.x- scroll_x - 8, base.y); - } + bigfiretux_left[frame_]->draw(base.x- scroll_x - 8, base.y); } else { if (dir == RIGHT) - { - bigfiretux_right_jump->draw( - base.x- scroll_x - 8, base.y); - } + bigfiretux_right_jump->draw(base.x- scroll_x - 8, base.y); else - { - bigfiretux_left_jump->draw( - base.x- scroll_x - 8, base.y); - } + bigfiretux_left_jump->draw(base.x- scroll_x - 8, base.y); } } else { if (dir == RIGHT) - { - skidfiretux_right->draw( - base.x- scroll_x - 8, base.y); - } + skidfiretux_right->draw(base.x- scroll_x - 8, base.y); else - { - skidfiretux_left->draw( - base.x- scroll_x - 8, base.y); - } + skidfiretux_left->draw(base.x- scroll_x - 8, base.y); } } else { if (dir == RIGHT) - { - duckfiretux_right->draw( base.x- scroll_x - 8, base.y - 16); - } + duckfiretux_right->draw( base.x- scroll_x - 8, base.y - 16); else - { - duckfiretux_left->draw( base.x- scroll_x - 8, base.y - 16); - } + duckfiretux_left->draw( base.x- scroll_x - 8, base.y - 16); } } } Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- player.h 18 Apr 2004 20:36:00 -0000 1.28 +++ player.h 18 Apr 2004 21:16:53 -0000 1.29 @@ -73,8 +73,8 @@ extern Sprite* bigtux_left; extern Sprite* bigtux_right_jump; extern Sprite* bigtux_left_jump; -extern Surface* ducktux_right; -extern Surface* ducktux_left; +extern Sprite* ducktux_right; +extern Sprite* ducktux_left; extern Surface* skidtux_right; extern Surface* skidtux_left; extern Surface* firetux_right[3]; Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- level.cpp 18 Apr 2004 13:42:15 -0000 1.36 +++ level.cpp 18 Apr 2004 21:16:53 -0000 1.37 @@ -289,12 +289,15 @@ reader.read_int("version", &version); reader.read_int("width", &width); reader.read_int("time", &time_left); + reader.read_int("bkgd_top_red", &bkgd_top.red); reader.read_int("bkgd_top_green", &bkgd_top.green); reader.read_int("bkgd_top_blue", &bkgd_top.blue); + reader.read_int("bkgd_bottom_red", &bkgd_bottom.red); reader.read_int("bkgd_bottom_green", &bkgd_bottom.green); reader.read_int("bkgd_bottom_blue", &bkgd_bottom.blue); + reader.read_float("gravity", &gravity); reader.read_string("name", &name); reader.read_string("author", &author); @@ -597,19 +600,6 @@ *ptexture = new Surface(fname, use_alpha); } -void tilemap_change_size(unsigned int** tilemap[15], int w, int old_w) -{ - int j,y; - for(y = 0; y < 15; ++y) - { - *tilemap[y] = (unsigned int*) realloc(*tilemap[y],(w+1)*sizeof(unsigned int)); - if(w > old_w) - for(j = 0; j < w - old_w; ++j) - *tilemap[y][old_w+j] = 0; - *tilemap[y][w] = 0; - } -} - /* Change the size of a level (width) */ void Level::change_size (int new_width) @@ -617,9 +607,12 @@ if(new_width < 21) new_width = 21; - tilemap_change_size((unsigned int***)&ia_tiles, new_width, width); - tilemap_change_size((unsigned int***)&bg_tiles, new_width, width); - tilemap_change_size((unsigned int***)&fg_tiles, new_width, width); + for(int y = 0; y < 15; ++y) + { + ia_tiles[y].resize(new_width, 0); + bg_tiles[y].resize(new_width, 0); + fg_tiles[y].resize(new_width, 0); + } width = new_width; } Index: resources.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/resources.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- resources.cpp 18 Apr 2004 20:36:01 -0000 1.11 +++ resources.cpp 18 Apr 2004 21:16:53 -0000 1.12 @@ -128,13 +128,8 @@ USE_ALPHA); - ducktux_right = new Surface(datadir + - "/images/shared/tux-duck-right.png", - USE_ALPHA); - - ducktux_left = new Surface(datadir + - "/images/shared/tux-duck-left.png", - USE_ALPHA); + ducktux_left = sprite_manager->load("largetux-duck-left"); + ducktux_right = sprite_manager->load("largetux-duck-right"); skidtux_right = new Surface(datadir + "/images/shared/skidtux-right.png", |