From: Holger Schemel Date: Fri, 24 Jun 2016 18:25:30 +0000 (+0200) Subject: fixed and extended auto-replay modes from command line X-Git-Tag: 4.0.0.0~68 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=65dcb102effc9b2dd3b45df14fc35b3f224b79c6;p=rocksndiamonds.git fixed and extended auto-replay modes from command line --- diff --git a/src/init.c b/src/init.c index 770d88c8..ff6c5767 100644 --- a/src/init.c +++ b/src/init.c @@ -4904,13 +4904,17 @@ void Execute_Command(char *command) } else if (strPrefix(command, "autotest ") || strPrefix(command, "autoplay ") || - strPrefix(command, "autoffwd ")) + strPrefix(command, "autoffwd ") || + strPrefix(command, "autowarp ")) { 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); + global.autoplay_mode = + (strPrefix(command, "autotest") ? AUTOPLAY_MODE_TEST : + strPrefix(command, "autoplay") ? AUTOPLAY_MODE_PLAY : + strPrefix(command, "autoffwd") ? AUTOPLAY_MODE_FFWD : + strPrefix(command, "autowarp") ? AUTOPLAY_MODE_WARP : + AUTOPLAY_MODE_NONE); while (*str_ptr != '\0') /* continue parsing string */ { @@ -5380,7 +5384,7 @@ static void InitLevelInfo() LoadLevelSetup_SeriesInfo(); /* last played level info */ if (global.autoplay_leveldir && - global.autoplay_mode != AUTOPLAY_TEST) + global.autoplay_mode != AUTOPLAY_MODE_TEST) { leveldir_current = getTreeInfoFromIdentifier(leveldir_first, global.autoplay_leveldir); diff --git a/src/main.c b/src/main.c index d29a341a..c57461a5 100644 --- a/src/main.c +++ b/src/main.c @@ -5649,6 +5649,7 @@ static void print_usage() " \"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" + " \"autowarp LEVELDIR [NR ...]\" warp 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 d80ca571..566e0069 100644 --- a/src/main.h +++ b/src/main.h @@ -2122,9 +2122,19 @@ #define NUM_ENGINE_TYPES 4 /* values for automatically playing tapes */ -#define AUTOPLAY_TEST 0 -#define AUTOPLAY_PLAY 1 -#define AUTOPLAY_FFWD 2 +#define AUTOPLAY_NONE 0 +#define AUTOPLAY_PLAY (1 << 0) +#define AUTOPLAY_FFWD (1 << 1) +#define AUTOPLAY_WARP (1 << 2) +#define AUTOPLAY_TEST (1 << 3) +#define AUTOPLAY_WARP_NO_DISPLAY AUTOPLAY_TEST + +#define AUTOPLAY_MODE_NONE 0 +#define AUTOPLAY_MODE_PLAY (AUTOPLAY_MODE_NONE | AUTOPLAY_PLAY) +#define AUTOPLAY_MODE_FFWD (AUTOPLAY_MODE_PLAY | AUTOPLAY_FFWD) +#define AUTOPLAY_MODE_WARP (AUTOPLAY_MODE_FFWD | AUTOPLAY_WARP) +#define AUTOPLAY_MODE_TEST (AUTOPLAY_MODE_WARP | AUTOPLAY_TEST) +#define AUTOPLAY_MODE_WARP_NO_DISPLAY AUTOPLAY_MODE_TEST struct BorderInfo diff --git a/src/tape.c b/src/tape.c index 8087860b..6d90ca96 100644 --- a/src/tape.c +++ b/src/tape.c @@ -889,15 +889,16 @@ unsigned int GetTapeLengthSeconds() return (GetTapeLengthFrames() * GAME_FRAME_DELAY / 1000); } -static void TapeStartWarpForward() +static void TapeStartWarpForward(int mode) { - tape.fast_forward = TRUE; - tape.warp_forward = TRUE; - tape.deactivate_display = TRUE; + tape.fast_forward = (mode & AUTOPLAY_FFWD); + tape.warp_forward = (mode & AUTOPLAY_WARP); + tape.deactivate_display = (mode & AUTOPLAY_WARP_NO_DISPLAY); tape.pausing = FALSE; - TapeDeactivateDisplayOn(); + if (tape.deactivate_display) + TapeDeactivateDisplayOn(); DrawVideoDisplayCurrentState(); } @@ -1005,7 +1006,7 @@ void TapeQuickLoad() if (!TAPE_IS_EMPTY(tape)) { TapeStartGamePlaying(); - TapeStartWarpForward(); + TapeStartWarpForward(AUTOPLAY_MODE_WARP_NO_DISPLAY); tape.quick_resume = TRUE; } @@ -1135,12 +1136,7 @@ void AutoPlayTape() printf("playing tape ... "); TapeStartGamePlaying(); - - if (global.autoplay_mode == AUTOPLAY_FFWD) - tape.fast_forward = TRUE; - - if (global.autoplay_mode != AUTOPLAY_PLAY) - TapeStartWarpForward(); + TapeStartWarpForward(global.autoplay_mode); return; }