From: Holger Schemel Date: Sun, 21 Jun 2015 19:24:44 +0000 (+0200) Subject: extended automatic tape playing modes X-Git-Tag: 4.0.0.0-rc1~170 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=4c3124b6e2b8454dbf25a30559676bfa1b2a1a87 extended automatic tape playing modes --- diff --git a/ChangeLog b/ChangeLog index 52c31379..00eea69a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-06-21 + * extended automatic tape playing modes: + - "autotest" to automatically test tapes (this was "autoplay" before) + - "autoplay" to automatically play tapes (visibly) + - "autoffwd" to automatically play tapes (visibly, with maximum speed) + 2015-06-16 * fixed and enhanced screen fading and background/border handling diff --git a/src/init.c b/src/init.c index 629133e8..42c4ce1b 100644 --- a/src/init.c +++ b/src/init.c @@ -4678,10 +4678,16 @@ void Execute_Command(char *command) exit(0); } - else if (strPrefix(command, "autoplay ")) + else if (strPrefix(command, "autotest ") || + strPrefix(command, "autoplay ") || + strPrefix(command, "autoffwd ")) { char *str_ptr = getStringCopy(&command[9]); /* read command parameters */ + global.autoplay_mode = (strPrefix(command, "autotest") ? AUTOPLAY_TEST : + strPrefix(command, "autoplay") ? AUTOPLAY_PLAY : + strPrefix(command, "autoffwd") ? AUTOPLAY_FFWD : 0); + while (*str_ptr != '\0') /* continue parsing string */ { /* cut leading whitespace from string, replace it by string terminator */ @@ -5217,6 +5223,15 @@ static void InitLevelInfo() LoadLevelInfo(); /* global level info */ LoadLevelSetup_LastSeries(); /* last played series info */ LoadLevelSetup_SeriesInfo(); /* last played level info */ + + if (global.autoplay_leveldir && + global.autoplay_mode != AUTOPLAY_TEST) + { + leveldir_current = getTreeInfoFromIdentifier(leveldir_first, + global.autoplay_leveldir); + if (leveldir_current == NULL) + leveldir_current = getFirstValidTreeInfoEntry(leveldir_first); + } } static void InitLevelArtworkInfo() diff --git a/src/main.c b/src/main.c index aa45c472..af4bcd34 100644 --- a/src/main.c +++ b/src/main.c @@ -5579,7 +5579,9 @@ static void print_usage() " \"print helptext.conf\" print default helptext config\n" " \"dump level FILE\" dump level data from FILE\n" " \"dump tape FILE\" dump tape data from FILE\n" + " \"autotest LEVELDIR [NR ...]\" test level tapes for LEVELDIR\n" " \"autoplay LEVELDIR [NR ...]\" play level tapes for LEVELDIR\n" + " \"autoffwd LEVELDIR [NR ...]\" ffwd level tapes for LEVELDIR\n" " \"convert LEVELDIR [NR]\" convert levels in LEVELDIR\n" " \"create images DIRECTORY\" write BMP images to DIRECTORY\n" " \"create CE image DIRECTORY\" write BMP image to DIRECTORY\n" diff --git a/src/main.h b/src/main.h index faf24a99..63eacc01 100644 --- a/src/main.h +++ b/src/main.h @@ -2051,6 +2051,11 @@ #define NUM_ENGINE_TYPES 4 +/* values for automatically playing tapes */ +#define AUTOPLAY_TEST 0 +#define AUTOPLAY_PLAY 1 +#define AUTOPLAY_FFWD 2 + struct BorderInfo { @@ -2516,6 +2521,7 @@ struct GlobalInfo char *autoplay_leveldir; int autoplay_level[MAX_TAPES_PER_SET]; boolean autoplay_all; + boolean autoplay_mode; char *convert_leveldir; int convert_level_nr; diff --git a/src/tape.c b/src/tape.c index 4ff0c968..58159cc5 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1197,7 +1197,12 @@ void AutoPlayTape() printf("playing tape ... "); TapeStartGamePlaying(); - TapeStartWarpForward(); + + if (global.autoplay_mode == AUTOPLAY_FFWD) + tape.fast_forward = TRUE; + + if (global.autoplay_mode != AUTOPLAY_PLAY) + TapeStartWarpForward(); return; }