X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=68ffadcf92677d6d126deb3075b6b5e1f417fdeb;hb=bd4bc1bc76940bd91ecfbf7d01790c0433ab19e2;hp=a6ab98561aa32c9f2dcc213cbc07312941cfa3d2;hpb=c44dfe1e8ab65317cc4468352084a75dc19067a4;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index a6ab9856..68ffadcf 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1244,6 +1244,59 @@ void TapeQuickLoad(void) } } +static boolean checkRestartGame(char *message) +{ + if (game_status == GAME_MODE_MAIN) + return TRUE; + + if (!hasStartedNetworkGame()) + return FALSE; + + if (level_editor_test_game) + return TRUE; + + if (game.all_players_gone) + return TRUE; + + if (!setup.ask_on_quit_game) + return TRUE; + + if (Request(message, REQ_ASK | REQ_STAY_CLOSED)) + return TRUE; + + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); + + return FALSE; +} + +void TapeRestartGame(void) +{ + if (!checkRestartGame("Restart game?")) + return; + + StartGameActions(network.enabled, setup.autorecord, level.random_seed); +} + +void TapeReplayAndPauseBeforeEnd(void) +{ + if (TAPE_IS_EMPTY(tape) && !tape.recording) + { + Request("No tape for this level!", REQ_CONFIRM); + + return; + } + + if (!checkRestartGame("Replay game and pause before end?")) + return; + + TapeStop(); + TapeStartGamePlaying(); + TapeStartWarpForward(AUTOPLAY_MODE_WARP_NO_DISPLAY); + + tape.pause_before_end = TRUE; + tape.quick_resume = TRUE; +} + boolean hasSolutionTape(void) { boolean tape_file_exists = fileExists(getSolutionTapeFilename(level_nr));