From 71f6982088deb38bae6506216004fcbe4caf6f9a Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 6 Sep 2021 00:07:52 +0200 Subject: [PATCH] changed interface for functions to auto-play tapes --- src/screens.c | 4 ++-- src/tape.c | 18 ++++++++++++------ src/tape.h | 1 + 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/screens.c b/src/screens.c index 23e0b113..cfab48e7 100644 --- a/src/screens.c +++ b/src/screens.c @@ -9034,10 +9034,10 @@ void HandleGameActions(void) if (game_status != GAME_MODE_PLAYING) return; - GameActions(); // main game loop + GameActions(); // main game loop if (tape.auto_play && !tape.playing) - AutoPlayTapes(); // continue automatically playing next tape + AutoPlayTapesContinue(); // continue automatically playing next tape } diff --git a/src/tape.c b/src/tape.c index f957ba97..c14b2169 100644 --- a/src/tape.c +++ b/src/tape.c @@ -474,7 +474,6 @@ void TapeDeactivateDisplayOff(boolean redraw_display) struct AutoPlayInfo { LevelDirTree *leveldir; - boolean initialized; boolean all_levelsets; int last_level_nr; int level_nr; @@ -1404,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; @@ -1443,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) { @@ -1578,7 +1577,6 @@ void AutoPlayTapes(void) // auto-play selected level set autoplay.leveldir = getTreeInfoFromIdentifier(leveldir_first, global.autoplay_leveldir); - } if (autoplay.leveldir == NULL) @@ -1589,8 +1587,6 @@ void AutoPlayTapes(void) options.mytapes = TRUE; init_level_set = TRUE; - - autoplay.initialized = TRUE; } while (1) @@ -1795,6 +1791,16 @@ void AutoPlayTapes(void) CloseAllAndExit(0); } +void AutoPlayTapes(void) +{ + AutoPlayTapesExt(TRUE); +} + +void AutoPlayTapesContinue(void) +{ + AutoPlayTapesExt(FALSE); +} + // ---------------------------------------------------------------------------- // tape patch functions diff --git a/src/tape.h b/src/tape.h index e710fa33..b0d1d672 100644 --- a/src/tape.h +++ b/src/tape.h @@ -276,6 +276,7 @@ void UndoTape(void); void FixTape_ForceSinglePlayer(void); void AutoPlayTapes(void); +void AutoPlayTapesContinue(void); void PatchTapes(void); void CreateTapeButtons(void); -- 2.34.1