#define SETUP_TOKEN_TOONS 5
#define SETUP_TOKEN_SCROLL_DELAY 6
#define SETUP_TOKEN_SCROLL_DELAY_VALUE 7
-#define SETUP_TOKEN_SOFT_SCROLLING 8
-#define SETUP_TOKEN_FADE_SCREENS 9
-#define SETUP_TOKEN_AUTORECORD 10
-#define SETUP_TOKEN_SHOW_TITLESCREEN 11
-#define SETUP_TOKEN_QUICK_DOORS 12
-#define SETUP_TOKEN_TEAM_MODE 13
-#define SETUP_TOKEN_HANDICAP 14
-#define SETUP_TOKEN_SKIP_LEVELS 15
-#define SETUP_TOKEN_TIME_LIMIT 16
-#define SETUP_TOKEN_FULLSCREEN 17
-#define SETUP_TOKEN_FULLSCREEN_MODE 18
-#define SETUP_TOKEN_WINDOW_SCALING_PERCENT 19
-#define SETUP_TOKEN_WINDOW_SCALING_QUALITY 20
-#define SETUP_TOKEN_ASK_ON_ESCAPE 21
-#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR 22
-#define SETUP_TOKEN_QUICK_SWITCH 23
-#define SETUP_TOKEN_INPUT_ON_FOCUS 24
-#define SETUP_TOKEN_PREFER_AGA_GRAPHICS 25
-#define SETUP_TOKEN_GAME_FRAME_DELAY 26
-#define SETUP_TOKEN_SP_SHOW_BORDER_ELEMENTS 27
-#define SETUP_TOKEN_SMALL_GAME_GRAPHICS 28
-#define SETUP_TOKEN_GRAPHICS_SET 29
-#define SETUP_TOKEN_SOUNDS_SET 30
-#define SETUP_TOKEN_MUSIC_SET 31
-#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 32
-#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 33
-#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 34
-#define SETUP_TOKEN_VOLUME_SIMPLE 35
-#define SETUP_TOKEN_VOLUME_LOOPS 36
-#define SETUP_TOKEN_VOLUME_MUSIC 37
-#define SETUP_TOKEN_TOUCH_CONTROL_TYPE 38
-#define SETUP_TOKEN_TOUCH_MOVE_DISTANCE 39
-#define SETUP_TOKEN_TOUCH_DROP_DISTANCE 40
-
-#define NUM_GLOBAL_SETUP_TOKENS 41
+#define SETUP_TOKEN_ENGINE_SNAPSHOT_MODE 8
+#define SETUP_TOKEN_SOFT_SCROLLING 9
+#define SETUP_TOKEN_FADE_SCREENS 10
+#define SETUP_TOKEN_AUTORECORD 11
+#define SETUP_TOKEN_SHOW_TITLESCREEN 12
+#define SETUP_TOKEN_QUICK_DOORS 13
+#define SETUP_TOKEN_TEAM_MODE 14
+#define SETUP_TOKEN_HANDICAP 15
+#define SETUP_TOKEN_SKIP_LEVELS 16
+#define SETUP_TOKEN_TIME_LIMIT 17
+#define SETUP_TOKEN_FULLSCREEN 18
+#define SETUP_TOKEN_FULLSCREEN_MODE 19
+#define SETUP_TOKEN_WINDOW_SCALING_PERCENT 20
+#define SETUP_TOKEN_WINDOW_SCALING_QUALITY 21
+#define SETUP_TOKEN_ASK_ON_ESCAPE 22
+#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR 23
+#define SETUP_TOKEN_QUICK_SWITCH 24
+#define SETUP_TOKEN_INPUT_ON_FOCUS 25
+#define SETUP_TOKEN_PREFER_AGA_GRAPHICS 26
+#define SETUP_TOKEN_GAME_FRAME_DELAY 27
+#define SETUP_TOKEN_SP_SHOW_BORDER_ELEMENTS 28
+#define SETUP_TOKEN_SMALL_GAME_GRAPHICS 29
+#define SETUP_TOKEN_GRAPHICS_SET 30
+#define SETUP_TOKEN_SOUNDS_SET 31
+#define SETUP_TOKEN_MUSIC_SET 32
+#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 33
+#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 34
+#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 35
+#define SETUP_TOKEN_VOLUME_SIMPLE 36
+#define SETUP_TOKEN_VOLUME_LOOPS 37
+#define SETUP_TOKEN_VOLUME_MUSIC 38
+#define SETUP_TOKEN_TOUCH_CONTROL_TYPE 39
+#define SETUP_TOKEN_TOUCH_MOVE_DISTANCE 40
+#define SETUP_TOKEN_TOUCH_DROP_DISTANCE 41
+
+#define NUM_GLOBAL_SETUP_TOKENS 42
/* editor setup */
#define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0
{ TYPE_SWITCH, &si.toons, "toons" },
{ TYPE_SWITCH, &si.scroll_delay, "scroll_delay" },
{ TYPE_INTEGER,&si.scroll_delay_value, "scroll_delay_value" },
+ { TYPE_STRING, &si.engine_snapshot_mode, "engine_snapshot_mode" },
{ TYPE_SWITCH, &si.soft_scrolling, "soft_scrolling" },
{ TYPE_SWITCH, &si.fade_screens, "fade_screens" },
{ TYPE_SWITCH, &si.autorecord, "automatic_tape_recording"},
si->toons = TRUE;
si->scroll_delay = TRUE;
si->scroll_delay_value = STD_SCROLL_DELAY;
+ si->engine_snapshot_mode = getStringCopy(STR_SNAPSHOT_MODE_DEFAULT);
si->soft_scrolling = TRUE;
si->fade_screens = TRUE;
si->autorecord = TRUE;
for (i = 0; i < MAX_PLAYERS; i++)
game.snapshot.last_action[i] = 0;
game.snapshot.changed_action = FALSE;
- game.snapshot.mode = SNAPSHOT_MODE_MOVE;
+ game.snapshot.mode =
+ (strEqual(setup.engine_snapshot_mode, STR_SNAPSHOT_MODE_EVERY_STEP) ?
+ SNAPSHOT_MODE_EVERY_STEP :
+ strEqual(setup.engine_snapshot_mode, STR_SNAPSHOT_MODE_EVERY_MOVE) ?
+ SNAPSHOT_MODE_EVERY_MOVE : SNAPSHOT_MODE_OFF);
FreeEngineSnapshotList();
}
{
boolean save_snapshot =
(FrameCounter == 0 ||
- (game.snapshot.mode == SNAPSHOT_MODE_STEP) ||
- (game.snapshot.mode == SNAPSHOT_MODE_MOVE &&
+ (game.snapshot.mode == SNAPSHOT_MODE_EVERY_STEP) ||
+ (game.snapshot.mode == SNAPSHOT_MODE_EVERY_MOVE &&
game.snapshot.changed_action));
game.snapshot.changed_action = FALSE;
- if (!save_snapshot)
+ if (game.snapshot.mode == SNAPSHOT_MODE_OFF || !save_snapshot)
return FALSE;
ListNode *buffers = SaveEngineSnapshotBuffers();
LoadEngineSnapshotValues();
}
-boolean CheckEngineSnapshot()
+boolean CheckEngineSnapshotSingle()
{
return (strEqual(snapshot_level_identifier, leveldir_current->identifier) &&
snapshot_level_nr == level_nr);
}
+boolean CheckEngineSnapshotList()
+{
+ return CheckSnapshotList();
+}
+
/* ---------- new game button stuff ---------------------------------------- */
void GameUndo(int steps)
{
- if (!CheckEngineSnapshot())
+ if (!CheckEngineSnapshotList())
return;
LoadEngineSnapshot_Undo(steps);
void GameRedo(int steps)
{
- if (!CheckEngineSnapshot())
+ if (!CheckEngineSnapshotList())
return;
LoadEngineSnapshot_Redo(steps);
/* (not included here due to collisions with Emerald Mine engine definitions) */
/* #include "main.h" */
-#define MAX_INVENTORY_SIZE 1000
+#define MAX_INVENTORY_SIZE 1000
-#define STD_NUM_KEYS 4
-#define MAX_NUM_KEYS 8
+#define STD_NUM_KEYS 4
+#define MAX_NUM_KEYS 8
-#define NUM_BELTS 4
-#define NUM_BELT_PARTS 3
+#define NUM_BELTS 4
+#define NUM_BELT_PARTS 3
-#define NUM_PANEL_INVENTORY 8
-#define NUM_PANEL_GRAPHICS 8
-#define NUM_PANEL_ELEMENTS 8
-#define NUM_PANEL_CE_SCORE 8
+#define NUM_PANEL_INVENTORY 8
+#define NUM_PANEL_GRAPHICS 8
+#define NUM_PANEL_ELEMENTS 8
+#define NUM_PANEL_CE_SCORE 8
-#define SNAPSHOT_MODE_STEP 0
-#define SNAPSHOT_MODE_MOVE 1
+#define STR_SNAPSHOT_MODE_OFF "off"
+#define STR_SNAPSHOT_MODE_EVERY_STEP "every_step"
+#define STR_SNAPSHOT_MODE_EVERY_MOVE "every_move"
+#define STR_SNAPSHOT_MODE_DEFAULT STR_SNAPSHOT_MODE_EVERY_MOVE
+
+#define SNAPSHOT_MODE_OFF 0
+#define SNAPSHOT_MODE_EVERY_STEP 1
+#define SNAPSHOT_MODE_EVERY_MOVE 2
+#define SNAPSHOT_MODE_DEFAULT SNAPSHOT_MODE_EVERY_MOVE
struct GamePanelInfo
void LoadEngineSnapshotSingle();
void SaveEngineSnapshotSingle();
boolean SaveEngineSnapshotToList();
-boolean CheckEngineSnapshot();
+boolean CheckEngineSnapshotSingle();
void CreateGameButtons();
void FreeGameButtons();
}
// -----------------------------------------------------------------------------
-// functions for handling one of several snapshots
+// functions for handling single shapshot or list of snapshots
// -----------------------------------------------------------------------------
static void FreeSnapshot(void *snapshot_buffers_ptr)
boolean LoadSnapshotFromList_Older(int steps)
{
- if (snapshot_current->next)
+ if (snapshot_current && snapshot_current->next)
{
while (snapshot_current->next && steps--)
snapshot_current = snapshot_current->next;
boolean LoadSnapshotFromList_Newer(int steps)
{
- if (snapshot_current->prev)
+ if (snapshot_current && snapshot_current->prev)
{
while (snapshot_current->prev && steps--)
snapshot_current = snapshot_current->prev;
return FALSE;
}
+
+boolean CheckSnapshotList()
+{
+ return (snapshot_list ? TRUE : FALSE);
+}
boolean LoadSnapshotSingle();
boolean LoadSnapshotFromList_Older();
boolean LoadSnapshotFromList_Newer();
+boolean CheckSnapshotList();
void FreeSnapshotSingle();
void FreeSnapshotList();
boolean toons;
boolean scroll_delay;
boolean scroll_delay_value;
+ char *engine_snapshot_mode;
boolean soft_scrolling;
boolean fade_screens;
boolean autorecord;
/* sub-screens on the setup screen (specific) */
#define SETUP_MODE_CHOOSE_GAME_SPEED 16
#define SETUP_MODE_CHOOSE_SCROLL_DELAY 17
-#define SETUP_MODE_CHOOSE_SCREEN_MODE 18
-#define SETUP_MODE_CHOOSE_WINDOW_SIZE 19
-#define SETUP_MODE_CHOOSE_SCALING_TYPE 20
-#define SETUP_MODE_CHOOSE_GRAPHICS 21
-#define SETUP_MODE_CHOOSE_SOUNDS 22
-#define SETUP_MODE_CHOOSE_MUSIC 23
-#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 24
-#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 25
-#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 26
-#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 27
-#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 28
-#define SETUP_MODE_CHOOSE_DROP_DISTANCE 29
-
-#define MAX_SETUP_MODES 30
+#define SETUP_MODE_CHOOSE_SNAPSHOT_MODE 18
+#define SETUP_MODE_CHOOSE_SCREEN_MODE 19
+#define SETUP_MODE_CHOOSE_WINDOW_SIZE 20
+#define SETUP_MODE_CHOOSE_SCALING_TYPE 21
+#define SETUP_MODE_CHOOSE_GRAPHICS 22
+#define SETUP_MODE_CHOOSE_SOUNDS 23
+#define SETUP_MODE_CHOOSE_MUSIC 24
+#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 25
+#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 26
+#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 27
+#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 28
+#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 29
+#define SETUP_MODE_CHOOSE_DROP_DISTANCE 30
+
+#define MAX_SETUP_MODES 31
/* for input setup functions */
#define SETUPINPUT_SCREEN_POS_START 0
static TreeInfo *scroll_delays = NULL;
static TreeInfo *scroll_delay_current = NULL;
+static TreeInfo *snapshot_modes = NULL;
+static TreeInfo *snapshot_mode_current = NULL;
+
static TreeInfo *game_speeds = NULL;
static TreeInfo *game_speed_current = NULL;
{ -1, NULL },
};
+static struct
+{
+ char *value;
+ char *text;
+} snapshot_modes_list[] =
+{
+ { STR_SNAPSHOT_MODE_OFF, "Off" },
+ { STR_SNAPSHOT_MODE_EVERY_STEP, "Every Step" },
+ { STR_SNAPSHOT_MODE_EVERY_MOVE, "Every Move" },
+
+ { NULL, NULL },
+};
+
static struct
{
int value;
else if (game_status == GAME_MODE_SETUP)
{
if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED ||
- setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY)
+ setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY ||
+ setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE)
execSetupGame();
else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE ||
setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
ti->cl_first, ti);
}
-
return;
}
if (game_status == GAME_MODE_SETUP)
{
if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED ||
- setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY)
+ setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY ||
+ setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE)
execSetupGame();
else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE ||
setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
static char *window_size_text;
static char *scaling_type_text;
static char *scroll_delay_text;
+static char *snapshot_mode_text;
static char *game_speed_text;
static char *graphics_set_name;
static char *sounds_set_name;
scroll_delay_text = scroll_delay_current->name;
}
+static void execSetupGame_setSnapshotModes()
+{
+ if (snapshot_modes == NULL)
+ {
+ int i;
+
+ for (i = 0; snapshot_modes_list[i].value != NULL; i++)
+ {
+ TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+ char identifier[32], name[32];
+ char *value = snapshot_modes_list[i].value;
+ char *text = snapshot_modes_list[i].text;
+
+ ti->node_top = &snapshot_modes;
+ ti->sort_priority = i;
+
+ sprintf(identifier, "%s", value);
+ sprintf(name, "%s", text);
+
+ setString(&ti->identifier, identifier);
+ setString(&ti->name, name);
+ setString(&ti->name_sorting, name);
+ setString(&ti->infotext, "Snapshot Mode");
+
+ pushTreeInfo(&snapshot_modes, ti);
+ }
+
+ /* sort snapshot mode values to start with lowest snapshot mode value */
+ sortTreeInfo(&snapshot_modes);
+
+ /* set current snapshot mode value to configured snapshot mode value */
+ snapshot_mode_current =
+ getTreeInfoFromIdentifier(snapshot_modes, setup.engine_snapshot_mode);
+
+ /* if that fails, set current snapshot mode to reliable default value */
+ if (snapshot_mode_current == NULL)
+ snapshot_mode_current =
+ getTreeInfoFromIdentifier(snapshot_modes, STR_SNAPSHOT_MODE_DEFAULT);
+
+ /* if that also fails, set current snapshot mode to first available value */
+ if (snapshot_mode_current == NULL)
+ snapshot_mode_current = snapshot_modes;
+ }
+
+ setup.engine_snapshot_mode = snapshot_mode_current->identifier;
+
+ /* needed for displaying snapshot mode text instead of identifier */
+ snapshot_mode_text = snapshot_mode_current->name;
+}
+
static void execSetupGame()
{
execSetupGame_setGameSpeeds();
execSetupGame_setScrollDelays();
+ execSetupGame_setSnapshotModes();
setup_mode = SETUP_MODE_GAME;
DrawSetupScreen();
}
+static void execSetupChooseSnapshotMode()
+{
+ setup_mode = SETUP_MODE_CHOOSE_SNAPSHOT_MODE;
+
+ DrawSetupScreen();
+}
+
static void execSetupEditor()
{
setup_mode = SETUP_MODE_EDITOR;
{ TYPE_ENTER_LIST, execSetupChooseScrollDelay, "Scroll Delay:" },
{ TYPE_STRING, &scroll_delay_text, "" },
#endif
+ { TYPE_ENTER_LIST, execSetupChooseSnapshotMode,"Game Engine Snapshot Mode:" },
+ { TYPE_STRING, &snapshot_mode_text, "" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupMain, "Back" },
DrawChooseTree(&game_speed_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY)
DrawChooseTree(&scroll_delay_current);
+ else if (setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE)
+ DrawChooseTree(&snapshot_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
DrawChooseTree(&screen_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE)
HandleChooseTree(mx, my, dx, dy, button, &game_speed_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY)
HandleChooseTree(mx, my, dx, dy, button, &scroll_delay_current);
+ else if (setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE)
+ HandleChooseTree(mx, my, dx, dy, button, &snapshot_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
HandleChooseTree(mx, my, dx, dy, button, &screen_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE)
TapeAppendRecording();
- if (!CheckEngineSnapshot())
+ if (!CheckEngineSnapshotSingle())
SaveEngineSnapshotSingle();
}
}
- if (tape.pausing)
- MapUndoRedoButtons();
- else if (!tape.single_step)
- MapStopPlayButtons();
+ if (CheckEngineSnapshotList())
+ {
+ if (tape.pausing)
+ MapUndoRedoButtons();
+ else if (!tape.single_step)
+ MapStopPlayButtons();
+ }
}
void TapeStartPlaying()
if (game_status != GAME_MODE_PLAYING && game_status != GAME_MODE_MAIN)
return;
- if (CheckEngineSnapshot())
+ if (CheckEngineSnapshotSingle())
{
TapeStartGamePlaying();