X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=86e127912a6bcda8861b06eb8486e86fa2dad406;hb=1d189cb5b9d8266d6b1cee2ed6b5b42044cd13aa;hp=c1e4bcea9f05cb67f8035a0af5cd0336c014cd6b;hpb=f5b65dacd63ac8767720f317ed227291a286e306;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index c1e4bcea..86e12791 100644 --- a/src/tape.c +++ b/src/tape.c @@ -540,6 +540,8 @@ void TapeErase(void) tape.length_frames = 0; tape.length_seconds = 0; + tape.score_tape_basename[0] = '\0'; + if (leveldir_current) { strncpy(tape.level_identifier, leveldir_current->identifier, @@ -1227,12 +1229,14 @@ void AutoPlayTapes(void) { static LevelDirTree *autoplay_leveldir = NULL; static boolean autoplay_initialized = FALSE; + static int autoplay_last_level_nr = -1; static int autoplay_level_nr = -1; static int num_levels_played = 0; static int num_levels_solved = 0; static int num_tapes_patched = 0; static int num_tape_missing = 0; static boolean level_failed[MAX_TAPES_PER_SET]; + static char *tape_filename = NULL; static int patch_nr = 0; static char *patch_name[] = { @@ -1325,6 +1329,20 @@ void AutoPlayTapes(void) audio.sound_enabled = FALSE; setup.engine_snapshot_mode = getStringCopy(STR_SNAPSHOT_MODE_OFF); + if (strSuffix(global.autoplay_leveldir, ".tape")) + { + tape_filename = global.autoplay_leveldir; + + LoadTapeFromFilename(tape_filename); + + global.autoplay_leveldir = tape.level_identifier; + + if (tape.level_nr >= 0 && tape.level_nr < MAX_TAPES_PER_SET) + global.autoplay_level[tape.level_nr] = TRUE; + + global.autoplay_all = FALSE; + } + autoplay_leveldir = getTreeInfoFromIdentifier(leveldir_first, global.autoplay_leveldir); @@ -1397,7 +1415,9 @@ void AutoPlayTapes(void) continue; #endif - if (options.mytapes) + if (tape_filename) + LoadTapeFromFilename(tape_filename); + else if (options.mytapes) LoadTape(level_nr); else LoadSolutionTape(level_nr); @@ -1473,9 +1493,16 @@ void AutoPlayTapes(void) TapeStartGamePlaying(); TapeStartWarpForward(global.autoplay_mode); + autoplay_last_level_nr = level_nr; + return; } + char *autoplay_status = (num_levels_played == num_levels_solved && + num_levels_played > 0 ? " OK " : "WARN"); + int autoplay_percent = (num_levels_played ? + num_levels_solved * 100 / num_levels_played : 0); + Print("\n"); PrintLine("=", 79); Print("Number of levels played: %d\n", num_levels_played); @@ -1485,17 +1512,32 @@ void AutoPlayTapes(void) Print("Number of tapes fixed: %d\n", num_tapes_patched); PrintLine("-", 79); Print("Summary (for automatic parsing by scripts):\n"); - Print("LEVELDIR [%s] '%s', SOLVED %d/%d (%d%%)", - (num_levels_played == num_levels_solved ? " OK " : "WARN"), - autoplay_leveldir->identifier, num_levels_solved, num_levels_played, - (num_levels_played ? num_levels_solved * 100 / num_levels_played : 0)); - if (num_levels_played != num_levels_solved) + if (tape_filename) { - Print(", FAILED:"); - for (i = 0; i < MAX_TAPES_PER_SET; i++) - if (level_failed[i]) - Print(" %03d", i); + Print("TAPEFILE [%s] '%s', %d, %d, %d", + autoplay_status, + autoplay_leveldir->identifier, + autoplay_last_level_nr, + game.score_final, + game.score_time_final); + } + else + { + Print("LEVELDIR [%s] '%s', SOLVED %d/%d (%d%%)", + autoplay_status, + autoplay_leveldir->identifier, + num_levels_solved, + num_levels_played, + autoplay_percent); + + if (num_levels_played != num_levels_solved) + { + Print(", FAILED:"); + for (i = 0; i < MAX_TAPES_PER_SET; i++) + if (level_failed[i]) + Print(" %03d", i); + } } Print("\n");