X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftape.c;h=68ffadcf92677d6d126deb3075b6b5e1f417fdeb;hb=7d6371b626a62594233de7deb9ff95cfdc75602d;hp=2a1a3ec345e5b65e85279bae23234da2ed97f801;hpb=7a8e465114815815796c2ebbe5f2e018a9265a3f;p=rocksndiamonds.git diff --git a/src/tape.c b/src/tape.c index 2a1a3ec3..68ffadcf 100644 --- a/src/tape.c +++ b/src/tape.c @@ -985,7 +985,7 @@ byte *TapePlayAction(void) if (tape.pause_before_end) // stop some seconds before end of tape { - if (TapeTime > tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH) + if (TapeTime > (int)tape.length_seconds - TAPE_PAUSE_SECONDS_BEFORE_DEATH) { TapeStopWarpForward(); TapeTogglePause(TAPE_TOGGLE_MANUAL); @@ -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)); @@ -1381,8 +1434,10 @@ static TreeInfo *getFirstValidAutoPlayEntry(TreeInfo *node) static void AutoPlayTapes_SetScoreEntry(int score, int time) { + char *name = (options.mytapes ? setup.player_name : options.player_name); + // set unique basename for score tape (for uploading to score server) - strcpy(tape.score_tape_basename, getScoreTapeBasename(setup.player_name)); + strcpy(tape.score_tape_basename, getScoreTapeBasename(name)); // store score in first score entry scores.last_added = 0;