X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=e9f3cbbcde34908bfcc3661ba0be3ae6eb32c22e;hb=3fd727f8ab7628eaab0be7de31658d7d468d6c8d;hp=8ca52a0335e4e172751344f4cf655346c72a4533;hpb=30d133ac6c0358f7c895df1af02ff4cca730707f;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index 8ca52a03..e9f3cbbc 100644 --- a/src/tape.c +++ b/src/tape.c @@ -326,7 +326,7 @@ static void TapeRewind() tape.playing = FALSE; tape.fast_forward = FALSE; tape.index_search = FALSE; - tape.auto_play = (options.autoplay_leveldir != NULL); + tape.auto_play = (global.autoplay_leveldir != NULL); tape.auto_play_level_solved = FALSE; tape.quick_resume = FALSE; tape.single_step = FALSE; @@ -614,7 +614,7 @@ static void TapeStartIndexSearch() { tape.pausing = FALSE; - SetDrawDeactivationMask(REDRAW_FIELD | REDRAW_DOOR_1); + SetDrawDeactivationMask(REDRAW_FIELD); audio.sound_deactivated = TRUE; } } @@ -687,26 +687,49 @@ void AutoPlayTape() static LevelDirTree *autoplay_leveldir = NULL; static boolean autoplay_initialized = FALSE; static int autoplay_level_nr = -1; + static int levels_played = 0; + static int levels_solved = 0; if (autoplay_initialized) { /* just finished auto-playing tape */ printf("%s.\n", tape.auto_play_level_solved ? "solved" : "NOT SOLVED"); + + levels_played++; + if (tape.auto_play_level_solved) + levels_solved++; } else { + DrawCompleteVideoDisplay(); + audio.sound_enabled = FALSE; + autoplay_leveldir = getTreeInfoFromIdentifier(leveldir_first, - options.autoplay_leveldir); + global.autoplay_leveldir); if (autoplay_leveldir == NULL) Error(ERR_EXIT, "no such level identifier: '%s'", - options.autoplay_leveldir); + global.autoplay_leveldir); leveldir_current = autoplay_leveldir; + if (global.autoplay_level_nr != -1) + { + autoplay_leveldir->first_level = global.autoplay_level_nr; + autoplay_leveldir->last_level = global.autoplay_level_nr; + } + autoplay_level_nr = autoplay_leveldir->first_level; - printf("Playing tapes of level series '%s'.\n", options.autoplay_leveldir); + printf_line('=', 79); + printf("Automatically playing level tapes\n"); + printf_line('-', 79); + printf("Level series identifier: '%s'\n", autoplay_leveldir->identifier); + printf("Level series name: '%s'\n", autoplay_leveldir->name); + printf("Level series author: '%s'\n", autoplay_leveldir->author); + printf("Number of levels: %d\n", autoplay_leveldir->levels); + printf_line('=', 79); + printf("\n"); autoplay_initialized = TRUE; } @@ -722,27 +745,35 @@ void AutoPlayTape() LoadLevel(level_nr); if (level.no_level_file) { - printf("(no level file)\n"); + printf("(no level)\n"); continue; } LoadTape(level_nr); if (TAPE_IS_EMPTY(tape)) { - printf("(no tape file)\n"); + printf("(no tape)\n"); continue; } - break; - } + printf("playing tape ... "); - if (autoplay_level_nr >= autoplay_leveldir->last_level) - CloseAllAndExit(0); + TapeStartGamePlaying(); + TapeStartIndexSearch(); - printf("playing tape ... "); + return; + } - TapeStartGamePlaying(); - TapeStartIndexSearch(); + printf("\n"); + printf_line('=', 79); + printf("Summary\n"); + printf_line('-', 79); + printf("Number of levels played: %d\n", levels_played); + printf("Number of levels solved: %d (%d%%)\n", levels_solved, + levels_solved * 100 / levels_played); + printf_line('=', 79); + + CloseAllAndExit(0); } @@ -845,6 +876,14 @@ void CreateTapeButtons() } } +void FreeTapeButtons() +{ + int i; + + for (i=0; i