X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fgameloop.cpp;h=fb3e557718a47de299cf63951ea99ed0cb1415f6;hb=d26d9e424eed4bd31dfdf023a120e6ebf3270eba;hp=b739d05658acbc013b396dc6a4b6711d8134880d;hpb=3d9d19f47c0dd104980173f2dc2196810b51fd14;p=supertux.git diff --git a/src/gameloop.cpp b/src/gameloop.cpp index b739d0565..fb3e55771 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -540,17 +540,12 @@ GameSession::run() update_time = last_update_time = st_get_ticks(); - /* Clear screen: */ -// clearscreen(0, 0, 0); -// updatescreen(); - // Eat unneeded events SDL_Event event; while (SDL_PollEvent(&event)) {} draw(); - float overlap = 0.0f; while (exit_status == NONE) { /* Calculate the movement-factor */ @@ -573,19 +568,12 @@ GameSession::run() // determistic and not different on different machines if(!game_pause && !Menu::current()) { - frame_ratio *= game_speed; - frame_ratio += overlap; - while (frame_ratio > 0) - { - // Update the world - check_end_conditions(); - if (end_sequence == ENDSEQUENCE_RUNNING) - action(.5f); - else if(end_sequence == NO_ENDSEQUENCE) - action(1.0f); - frame_ratio -= 1.0f; - } - overlap = frame_ratio; + // Update the world + check_end_conditions(); + if (end_sequence == ENDSEQUENCE_RUNNING) + action(frame_ratio/2); + else if(end_sequence == NO_ENDSEQUENCE) + action(frame_ratio); } else { @@ -615,22 +603,22 @@ GameSession::run() } /* Handle time: */ - if (!time_left.check() && world->get_tux()->dying == DYING_NOT) + if (!time_left.check() && world->get_tux()->dying == DYING_NOT + && !end_sequence) world->get_tux()->kill(Player::KILL); /* Handle music: */ - if(world->get_tux()->invincible_timer.check()) + if(world->get_tux()->invincible_timer.check() && !end_sequence) { - if(world->get_music_type() != HERRING_MUSIC) - world->play_music(HERRING_MUSIC); + world->play_music(HERRING_MUSIC); } /* are we low on time ? */ - else if (time_left.get_left() < TIME_WARNING) + else if (time_left.get_left() < TIME_WARNING && !end_sequence) { world->play_music(HURRYUP_MUSIC); } /* or just normal music? */ - else if(world->get_music_type() != LEVEL_MUSIC) + else if(world->get_music_type() != LEVEL_MUSIC && !end_sequence) { world->play_music(LEVEL_MUSIC); }