TapeQuickSave();
else if (key == setup.shortcut.load_game)
TapeQuickLoad();
+ else if (key == setup.shortcut.restart_game)
+ TapeRestartGame();
+ else if (key == setup.shortcut.pause_before_end)
+ TapeReplayAndPauseBeforeEnd();
else if (key == setup.shortcut.toggle_pause)
TapeTogglePause(TAPE_TOGGLE_MANUAL | TAPE_TOGGLE_PLAY_PAUSE);
TYPE_KEY_X11,
&setup.shortcut.load_game, "shortcut.load_game"
},
+ {
+ TYPE_KEY_X11,
+ &setup.shortcut.restart_game, "shortcut.restart_game"
+ },
+ {
+ TYPE_KEY_X11,
+ &setup.shortcut.pause_before_end, "shortcut.pause_before_end"
+ },
{
TYPE_KEY_X11,
&setup.shortcut.toggle_pause, "shortcut.toggle_pause"
si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME;
si->shortcut.load_game = DEFAULT_KEY_LOAD_GAME;
+ si->shortcut.restart_game = DEFAULT_KEY_RESTART_GAME;
+ si->shortcut.pause_before_end = DEFAULT_KEY_PAUSE_BEFORE_END;
si->shortcut.toggle_pause = DEFAULT_KEY_TOGGLE_PAUSE;
si->shortcut.focus_player[0] = DEFAULT_KEY_FOCUS_PLAYER_1;
// default shortcut keys
#define DEFAULT_KEY_SAVE_GAME KSYM_F1
#define DEFAULT_KEY_LOAD_GAME KSYM_F2
+#define DEFAULT_KEY_RESTART_GAME KSYM_F3
+#define DEFAULT_KEY_PAUSE_BEFORE_END KSYM_F4
#define DEFAULT_KEY_TOGGLE_PAUSE KSYM_space
#define DEFAULT_KEY_FOCUS_PLAYER_1 KSYM_F5
#define DEFAULT_KEY_FOCUS_PLAYER_2 KSYM_F6
{
Key save_game;
Key load_game;
+ Key restart_game;
+ Key pause_before_end;
Key toggle_pause;
Key focus_player[MAX_PLAYERS];
{ TYPE_KEY, &setup.shortcut.save_game, "" },
{ TYPE_KEYTEXT, NULL, "Quick Load Game from Tape:", },
{ TYPE_KEY, &setup.shortcut.load_game, "" },
+ { TYPE_KEYTEXT, NULL, "Restart Game:", },
+ { TYPE_KEY, &setup.shortcut.restart_game, "" },
+ { TYPE_KEYTEXT, NULL, "Replay & Pause Before End:", },
+ { TYPE_KEY, &setup.shortcut.pause_before_end, "" },
{ TYPE_KEYTEXT, NULL, "Start Game & Toggle Pause:", },
{ TYPE_KEY, &setup.shortcut.toggle_pause, "" },
{ TYPE_EMPTY, NULL, "" },
}
}
+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));
unsigned int GetTapeLengthSeconds(void);
void TapeQuickSave(void);
void TapeQuickLoad(void);
+void TapeRestartGame(void);
+void TapeReplayAndPauseBeforeEnd(void);
boolean hasSolutionTape(void);
boolean InsertSolutionTape(void);