[Super-tux-commit] supertux/src world.cpp,1.90,1.91
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-05-15 12:09:08
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2123/src Modified Files: world.cpp Log Message: Only do vertical scrolling when the height is higher than 19. This fixes the problem that scrolling was used in 19 Y tiles levels. Since the right number of Y tiles is 18.75, not 19. Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.90 retrieving revision 1.91 diff -u -d -r1.90 -r1.91 --- world.cpp 15 May 2004 09:59:02 -0000 1.90 +++ world.cpp 15 May 2004 12:08:57 -0000 1.91 @@ -321,10 +321,13 @@ float tux_pos_y = tux.base.y + (tux.base.height/2); - if (scroll_y < tux_pos_y - (screen->h - Y_SPACE)) - scroll_y = tux_pos_y - (screen->h - Y_SPACE); - else if (scroll_y > tux_pos_y - Y_SPACE) - scroll_y = tux_pos_y - Y_SPACE; + if(level->height > VISIBLE_TILES_Y-1) + { + if (scroll_y < tux_pos_y - (screen->h - Y_SPACE)) + scroll_y = tux_pos_y - (screen->h - Y_SPACE); + else if (scroll_y > tux_pos_y - Y_SPACE) + scroll_y = tux_pos_y - Y_SPACE; + } // this code prevent the screen to scroll before the start or after the level's end if(scroll_y > level->height * 32 - screen->h) |