[Super-tux-commit] supertux/src tile.cpp,1.21,1.22 world.cpp,1.86,1.87
Brought to you by:
wkendrick
From: Ryan F. <sik...@us...> - 2004-05-14 17:35:40
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19219 Modified Files: tile.cpp world.cpp Log Message: - fixed drawing crash - not quite in a playable state yet :) Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- world.cpp 14 May 2004 16:02:41 -0000 1.86 +++ world.cpp 14 May 2004 17:35:30 -0000 1.87 @@ -196,16 +196,11 @@ (*p)->draw(scroll_x, 0, 0); } -fprintf(stderr, "level->height: %i\n", level->height); -fprintf(stderr, "scroll_x: %i\n", scroll_x); -fprintf(stderr, "scroll_y: %i\n", scroll_y); /* Draw background: */ for (y = 0; y < VISIBLE_TILES_Y && y < level->height; ++y) { -fprintf(stderr, "drawing row: %i\n", y); for (x = 0; x < VISIBLE_TILES_X; ++x) { -fprintf(stderr, "x: %i\n", x); Tile::draw(32*x - fmodf(scroll_x, 32), y * 32 - fmodf(scroll_y, 32), level->bg_tiles[(int)y + (int)(scroll_y / 32)][(int)x + (int)(scroll_x / 32)]); } @@ -340,9 +335,15 @@ // this code prevent the screen to scroll before the start or after the level's end if(scroll_y < 0) scroll_y = 0; - if(scroll_y > level->height * 32 - screen->h) + else if(scroll_y > level->height * 32 - screen->h) scroll_y = level->height * 32 - screen->h; + if (scroll_y < 0) + { + std::cerr << "Level too short!!" << std::endl; + scroll_y = 0; + } + /* X-axis scrolling */ /* Auto scrolling */ @@ -384,8 +385,6 @@ scroll_x += (final_scroll_x - scroll_x) / (frame_ratio * (CHANGE_DIR_SCROLL_SPEED / 100)) + (tux.physic.get_velocity_x() * frame_ratio + tux.physic.get_acceleration_x() * frame_ratio * frame_ratio); - // std::cerr << tux_pos_x << " " << final_scroll_x << " " << scroll_x << std::endl; - } else { @@ -398,7 +397,7 @@ // this code prevent the screen to scroll before the start or after the level's end if(scroll_x < 0) scroll_x = 0; - if(scroll_x > level->width * 32 - screen->w) + else if(scroll_x > level->width * 32 - screen->w) scroll_x = level->width * 32 - screen->w; } Index: tile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- tile.cpp 14 May 2004 16:02:41 -0000 1.21 +++ tile.cpp 14 May 2004 17:35:30 -0000 1.22 @@ -185,8 +185,6 @@ void Tile::draw(float x, float y, unsigned int c, Uint8 alpha) { -fprintf(stderr, "x: %i\n", x); -fprintf(stderr, "y: %i\n", y); if (c != 0) { Tile* ptile = TileManager::instance()->get(c); |