diff --git a/source/gamestate_sequence.cpp b/source/gamestate_sequence.cpp index b7cb912..3f172eb 100644 --- a/source/gamestate_sequence.cpp +++ b/source/gamestate_sequence.cpp @@ -57,9 +57,13 @@ namespace gamestate bool loop() { + if (draw::isfading()) { + draw::render(); + return true; + } if ( (wait_until > 0) && (SDL_GetTicks() < wait_until) ) { - if (!draw::isfading() && (input::anyKeyPressed() || input::mouseBtn(1))) { + if (input::anyKeyPressed() || input::mouseBtn(1)) { wait_until=0; if (input::keyPressed(SDL_SCANCODE_ESCAPE)) fseek(sequence_file, 0, SEEK_END); } else { @@ -67,6 +71,7 @@ namespace gamestate return true; } } + if (feof(sequence_file)) { fclose(sequence_file); @@ -90,14 +95,13 @@ namespace gamestate if (command=="ESPERAR") { int res = fscanf(sequence_file, "%i", &val); + printf("ESPERAR %i\n", val); wait_until = SDL_GetTicks() + val; } else if (command=="FADEIN") { int res = fscanf(sequence_file, " '%[^']'", text); drawPic(text); draw::fadein(); - draw::render(); - wait_until = SDL_GetTicks() + 500; } else if (command=="SHOW") { int res = fscanf(sequence_file, " '%[^']'", text); @@ -114,12 +118,10 @@ namespace gamestate } else if (command=="FADEOUT") { draw::fadeout(); - wait_until = SDL_GetTicks() + 500; } else if (command=="FADEOUTMUSIC") { draw::fadeout(); audio::fadeoutMusic(); - wait_until = SDL_GetTicks() + 500; } } }