Re: [Super-tux-commit] supertux/src tile.cpp,1.21,1.22 world.cpp,1.86,1.87
Brought to you by:
wkendrick
From: Ricardo C. <ri...@ae...> - 2004-05-14 23:13:51
|
Why did this patch fixed the crash? I mean the only thing changed was that my debug outputs were removed, performance improved (in case scroll_y < 0 you don't do the other test) and scroll_y < 0 is tested twice, one after the other... Am I missing something? Really, I am just wondering, cause the level editor is crashing due to the same problem... Ricardo Cruz Em Sexta, 14 de Maio de 2004 18:35, o Ryan Flegel escreveu: > 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); > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: SourceForge.net Broadband > Sign-up now for SourceForge Broadband and get the fastest > 6.0/768 connection for only $19.95/mo for the first 3 months! > http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click > _______________________________________________ > Super-tux-commit mailing list > Sup...@li... > https://lists.sourceforge.net/lists/listinfo/super-tux-commit -- One picture is worth more than ten thousand words. -- Chinese proverb |