X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftape.c;h=c14b21694940eea6c63844c1bd0e2f25285d4623;hb=71f6982088deb38bae6506216004fcbe4caf6f9a;hp=e9e2c26403de4f3587e9134286424a35698fc143;hpb=1e52e9632fd4a34e84c530d154ef5e86bbbe488b;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index e9e2c264..c14b2169 100644 --- a/src/tape.c +++ b/src/tape.c @@ -474,7 +474,7 @@ void TapeDeactivateDisplayOff(boolean redraw_display) struct AutoPlayInfo { LevelDirTree *leveldir; - boolean initialized; + boolean all_levelsets; int last_level_nr; int level_nr; int num_levels_played; @@ -1403,7 +1403,7 @@ static void AutoPlayTapes_WaitForUpload(void) Print("- uploading score tape to score server - uploaded.\n"); } -void AutoPlayTapes(void) +static void AutoPlayTapesExt(boolean initialize) { static struct AutoPlayInfo autoplay; static int patch_nr = 0; @@ -1442,7 +1442,7 @@ void AutoPlayTapes(void) boolean init_level_set = FALSE; int i; - if (autoplay.initialized) + if (!initialize) { if (global.autoplay_mode == AUTOPLAY_MODE_FIX) { @@ -1523,6 +1523,15 @@ void AutoPlayTapes(void) } else { + if (strEqual(global.autoplay_leveldir, "ALL")) + { + autoplay.all_levelsets = TRUE; + + // tape mass-uploading only allowed for private tapes + if (global.autoplay_mode == AUTOPLAY_MODE_UPLOAD) + options.mytapes = TRUE; + } + if ((global.autoplay_mode == AUTOPLAY_MODE_SAVE || global.autoplay_mode == AUTOPLAY_MODE_UPLOAD) && !options.mytapes && @@ -1558,8 +1567,17 @@ void AutoPlayTapes(void) global.autoplay_all = FALSE; } - autoplay.leveldir = getTreeInfoFromIdentifier(leveldir_first, - global.autoplay_leveldir); + if (autoplay.all_levelsets) + { + // start auto-playing first level set + autoplay.leveldir = getFirstValidTreeInfoEntry(leveldir_first); + } + else + { + // auto-play selected level set + autoplay.leveldir = getTreeInfoFromIdentifier(leveldir_first, + global.autoplay_leveldir); + } if (autoplay.leveldir == NULL) Fail("no such level identifier: '%s'", global.autoplay_leveldir); @@ -1569,8 +1587,6 @@ void AutoPlayTapes(void) options.mytapes = TRUE; init_level_set = TRUE; - - autoplay.initialized = TRUE; } while (1) @@ -1586,6 +1602,11 @@ void AutoPlayTapes(void) autoplay.level_nr = autoplay.leveldir->first_level; + autoplay.num_levels_played = 0; + autoplay.num_levels_solved = 0; + autoplay.num_tapes_patched = 0; + autoplay.num_tape_missing = 0; + for (i = 0; i < MAX_TAPES_PER_SET; i++) autoplay.level_failed[i] = FALSE; @@ -1597,11 +1618,24 @@ void AutoPlayTapes(void) if (global.autoplay_mode != AUTOPLAY_MODE_FIX || patch_nr == 0) level_nr = autoplay.level_nr++; + // check if all tapes for this level set have been processed if (level_nr > autoplay.leveldir->last_level) { PrintTapeReplaySummary(&autoplay); - break; + if (!autoplay.all_levelsets) + break; + + // continue with next level set + autoplay.leveldir = getNextValidTreeInfoEntry(autoplay.leveldir); + + // all level sets processed + if (autoplay.leveldir == NULL) + break; + + init_level_set = TRUE; + + continue; } // set patch info (required for progress output) @@ -1614,6 +1648,7 @@ void AutoPlayTapes(void) continue; TapeErase(); + TapeRewind(); // needed to reset "tape.auto_play_level_solved" LoadLevel(level_nr); @@ -1756,6 +1791,16 @@ void AutoPlayTapes(void) CloseAllAndExit(0); } +void AutoPlayTapes(void) +{ + AutoPlayTapesExt(TRUE); +} + +void AutoPlayTapesContinue(void) +{ + AutoPlayTapesExt(FALSE); +} + // ---------------------------------------------------------------------------- // tape patch functions