[Super-tux-commit] supertux/src Makefile.am,1.45,1.46 gameloop.cpp,1.195,1.196 gameloop.h,1.63,1.64
Brought to you by:
wkendrick
From: Matze B. <mat...@us...> - 2004-11-23 02:01:06
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25154/src Modified Files: Makefile.am gameloop.cpp gameloop.h leveleditor.cpp leveleditor.h particlesystem.cpp player.cpp scene.h tile.cpp tile.h title.cpp worldmap.cpp worldmap.h Log Message: fix some more timings and the long standing gradient software bug (which was function argument overriding class field) Index: tile.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- tile.h 20 Nov 2004 22:14:39 -0000 1.33 +++ tile.h 23 Nov 2004 02:00:51 -0000 1.34 @@ -85,7 +85,7 @@ been collected or jumped at */ int next_tile; - int anim_speed; + float anim_fps; /** Draw a tile on the screen */ void draw(DrawingContext& context, const Vector& pos, int layer) const; Index: particlesystem.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/particlesystem.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- particlesystem.cpp 20 Nov 2004 22:14:38 -0000 1.14 +++ particlesystem.cpp 23 Nov 2004 02:00:51 -0000 1.15 @@ -140,7 +140,7 @@ particle->pos.x = rand() % int(virtual_width); particle->pos.y = rand() % int(virtual_height); particle->texture = cloudimage; - particle->speed = -float(250 + rand() % 200) / 1000.0; + particle->speed = -float(25 + rand() % 30); particles.push_back(particle); } Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- worldmap.cpp 21 Nov 2004 03:21:25 -0000 1.132 +++ worldmap.cpp 23 Nov 2004 02:00:51 -0000 1.133 @@ -179,8 +179,8 @@ tile->images.push_back(image); } - tile->anim_speed = 25; - reader.read_int("anim-speed", tile->anim_speed); + tile->anim_fps = 1; + reader.read_float("anim-fps", tile->anim_fps); if (id >= int(tiles.size())) @@ -454,8 +454,7 @@ if(images.size() > 1) { - size_t frame - = ((global_frame_counter*25) / anim_speed) % images.size(); + size_t frame = size_t(global_time * anim_fps) % images.size(); context.draw_surface(images[frame], pos, LAYER_TILES); } @@ -490,8 +489,6 @@ name = "<no title>"; music = "salcon.mod"; - global_frame_counter = 0; - total_stats.reset(); } @@ -831,10 +828,6 @@ void WorldMap::update(float delta) { - if(!frame_timer.check()) { - global_frame_counter++; - } - if (enter_level && !tux->is_moving()) { /* Check special tile action */ @@ -1184,7 +1177,6 @@ frame_rate.set_frame_limit(false); frame_rate.start(); - frame_timer.start(.25, true); DrawingContext context; while(!quit) Index: scene.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/scene.h,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- scene.h 20 Nov 2004 22:14:39 -0000 1.36 +++ scene.h 23 Nov 2004 02:00:51 -0000 1.37 @@ -47,6 +47,4 @@ extern PlayerStatus player_status; -extern unsigned int global_frame_counter; - #endif /*SUPERTUX_SCENE_H*/ Index: worldmap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- worldmap.h 20 Nov 2004 22:14:39 -0000 1.49 +++ worldmap.h 23 Nov 2004 02:00:52 -0000 1.50 @@ -60,7 +60,7 @@ void draw(DrawingContext& context, Vector pos); std::vector<Surface*> images; - int anim_speed; + float anim_fps; // Directions in which Tux is allowed to walk from this tile bool north; @@ -248,8 +248,6 @@ Statistics total_stats; void calculate_total_stats(); - Timer2 frame_timer; - public: WorldMap(); ~WorldMap(); Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.195 retrieving revision 1.196 diff -u -d -r1.195 -r1.196 --- gameloop.cpp 20 Nov 2004 22:38:35 -0000 1.195 +++ gameloop.cpp 23 Nov 2004 02:00:33 -0000 1.196 @@ -88,7 +88,6 @@ { current_ = this; - global_frame_counter = 0; game_pause = false; fps_fps = 0; @@ -718,7 +717,6 @@ Uint32 lastticks = SDL_GetTicks(); fps_ticks = SDL_GetTicks(); - frame_timer.start(.025, true); while (exit_status == ES_NONE) { Uint32 ticks = SDL_GetTicks(); float elapsed_time = float(ticks - lastticks) / 1000.; @@ -728,10 +726,6 @@ if(elapsed_time > .05) elapsed_time = .05; - if(frame_timer.check()) { - ++global_frame_counter; - } - /* Handle events: */ currentsector->player->input.old_fire = currentsector->player->input.fire; currentsector->player->input.old_up = currentsector->player->input.old_up; @@ -857,7 +851,7 @@ context.draw_text(white_text, _("TIME's UP"), Vector(screen->w/2, 0), CENTER_ALLIGN, LAYER_FOREGROUND1); } else if (time_left.get_timeleft() > TIME_WARNING - || (global_frame_counter % 10) < 5) { + || int(global_time * 2.5) % 2) { sprintf(str, " %d", int(time_left.get_timeleft())); context.draw_text(white_text, _("TIME"), Vector(screen->w/2, 0), CENTER_ALLIGN, LAYER_FOREGROUND1); Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.199 retrieving revision 1.200 diff -u -d -r1.199 -r1.200 --- player.cpp 22 Nov 2004 21:35:04 -0000 1.199 +++ player.cpp 23 Nov 2004 02:00:51 -0000 1.200 @@ -846,7 +846,7 @@ get_pos(), layer); } } - else if (safe_timer.started() && global_frame_counter%2) + else if (safe_timer.started() && size_t(global_time*40)%2) ; // don't draw Tux else tux_body->draw(context, get_pos(), layer); @@ -854,7 +854,7 @@ // Draw blinking star overlay if (invincible_timer.started() && (invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING - || global_frame_counter % 3) + || size_t(global_time*20)%2) && !dying) { if (size == SMALL || duck) Index: Makefile.am =================================================================== RCS file: /cvsroot/super-tux/supertux/src/Makefile.am,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- Makefile.am 20 Nov 2004 22:38:35 -0000 1.45 +++ Makefile.am 23 Nov 2004 02:00:32 -0000 1.46 @@ -27,6 +27,7 @@ object/oneup.h object/oneup.cpp \ object/flower.h object/flower.cpp \ object/growup.h object/growup.cpp \ + object/invisible_block.h object/invisible_block.cpp \ badguy/badguy.h badguy/badguy.cpp \ badguy/bomb.h badguy/bomb.cpp \ badguy/bouncing_snowball.h badguy/bouncing_snowball.cpp\ Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.167 retrieving revision 1.168 diff -u -d -r1.167 -r1.168 --- leveleditor.cpp 20 Nov 2004 22:38:35 -0000 1.167 +++ leveleditor.cpp 23 Nov 2004 02:00:33 -0000 1.168 @@ -44,7 +44,6 @@ show_grid = true; selection.clear(); - global_frame_counter = 0; selection_end = selection_ini = Vector(0,0); left_button = middle_button = mouse_moved = false; level = 0; @@ -232,7 +231,6 @@ mouse_cursor->set_state(MC_NORMAL); -frame_timer.start(.25, true); done = false; while(!done) { @@ -534,10 +532,6 @@ if(sector) { - if(frame_timer.check()) { - ++global_frame_counter; - } - // don't scroll before the start or after the level's end float width = sector->solids->get_width() * 32; float height = sector->solids->get_height() * 32; Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- gameloop.h 20 Nov 2004 22:14:38 -0000 1.63 +++ gameloop.h 23 Nov 2004 02:00:33 -0000 1.64 @@ -57,7 +57,6 @@ { private: Uint32 fps_ticks; - Timer2 frame_timer; Timer2 endsequence_timer; Level* level; Sector* currentsector; Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.131 retrieving revision 1.132 diff -u -d -r1.131 -r1.132 --- title.cpp 21 Nov 2004 00:49:30 -0000 1.131 +++ title.cpp 23 Nov 2004 02:00:51 -0000 1.132 @@ -279,7 +279,6 @@ world->play_music(LEVEL_MUSIC); - global_frame_counter++; tux->key_event((SDLKey) keymap.right,DOWN); if(random_timer.check()) { Index: tile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- tile.cpp 22 Nov 2004 17:51:50 -0000 1.39 +++ tile.cpp 23 Nov 2004 02:00:51 -0000 1.40 @@ -100,7 +100,7 @@ } Tile::Tile() - : id(0), attributes(0), data(0), next_tile(0), anim_speed(25) + : id(0), attributes(0), data(0), next_tile(0), anim_fps(1) { } @@ -146,7 +146,7 @@ attributes |= GOAL; reader.read_int("data", data); - reader.read_int("anim-speed", anim_speed); + reader.read_float("anim-fps", anim_fps); reader.read_int("next-tile", next_tile); if(reader.read_int("slope-type", data)) { @@ -161,7 +161,7 @@ Tile::draw(DrawingContext& context, const Vector& pos, int layer) const { if(images.size() > 1) { - size_t frame = ((global_frame_counter*25) / anim_speed) % images.size(); + size_t frame = size_t(global_time * anim_fps) % images.size(); context.draw_surface(images[frame], pos, layer); } else if (images.size() == 1) { context.draw_surface(images[0], pos, layer); Index: leveleditor.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- leveleditor.h 20 Nov 2004 22:14:38 -0000 1.22 +++ leveleditor.h 23 Nov 2004 02:00:51 -0000 1.23 @@ -129,7 +129,6 @@ float zoom; SDL_Event event; - Timer2 frame_timer; Timer2 level_name_timer; Surface *img_background_bt, *img_foreground_bt, *img_interactive_bt; |