From: Holger Schemel Date: Fri, 9 Jul 2021 12:56:17 +0000 (+0200) Subject: added saving special tape properties X-Git-Tag: 4.3.0.0~107 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0feae4f4d0bc1f62266a0508306a87c78c6e41f9;p=rocksndiamonds.git added saving special tape properties --- diff --git a/src/events.c b/src/events.c index c2548e5f..13723bfa 100644 --- a/src/events.c +++ b/src/events.c @@ -2091,6 +2091,8 @@ void HandleKey(Key key, int key_status) { key_action |= key_info[i].action | JOY_BUTTON_SNAP; key_snap_action |= key_info[i].action; + + tape.property_bits |= TAPE_PROPERTY_TAS_KEYS; } } } diff --git a/src/files.c b/src/files.c index 1dd328c0..0d4eb7fe 100644 --- a/src/files.c +++ b/src/files.c @@ -8447,11 +8447,34 @@ void DumpTape(struct TapeInfo *tape) } PrintLine("-", 79); + Print("Tape of Level %03d (file version %08d, game version %08d)\n", tape->level_nr, tape->file_version, tape->game_version); Print(" (effective engine version %08d)\n", tape->engine_version); Print("Level series identifier: '%s'\n", tape->level_identifier); + + Print("Special tape properties: "); + if (tape->property_bits == TAPE_PROPERTY_NONE) + Print("[none]"); + if (tape->property_bits & TAPE_PROPERTY_EM_RANDOM_BUG) + Print("[em_random_bug]"); + if (tape->property_bits & TAPE_PROPERTY_GAME_SPEED) + Print("[game_speed]"); + if (tape->property_bits & TAPE_PROPERTY_PAUSE_MODE) + Print("[pause]"); + if (tape->property_bits & TAPE_PROPERTY_SINGLE_STEP) + Print("[single_step]"); + if (tape->property_bits & TAPE_PROPERTY_SNAPSHOT) + Print("[snapshot]"); + if (tape->property_bits & TAPE_PROPERTY_REPLAYED) + Print("[replayed]"); + if (tape->property_bits & TAPE_PROPERTY_TAS_KEYS) + Print("[tas_keys]"); + if (tape->property_bits & TAPE_PROPERTY_SMALL_GRAPHICS) + Print("[small_graphics]"); + + Print("\n"); PrintLine("-", 79); tape_frame_counter = 0; diff --git a/src/game.c b/src/game.c index 3d0e2d3b..a3cc0704 100644 --- a/src/game.c +++ b/src/game.c @@ -16334,8 +16334,12 @@ static void GameUndo(int steps) if (!CheckEngineSnapshotList()) return; + int tape_property_bits = tape.property_bits; + LoadEngineSnapshot_Undo(steps); + tape.property_bits |= tape_property_bits | TAPE_PROPERTY_SNAPSHOT; + GameUndoRedoExt(); } @@ -16344,8 +16348,12 @@ static void GameRedo(int steps) if (!CheckEngineSnapshotList()) return; + int tape_property_bits = tape.property_bits; + LoadEngineSnapshot_Redo(steps); + tape.property_bits |= tape_property_bits | TAPE_PROPERTY_SNAPSHOT; + GameUndoRedoExt(); } diff --git a/src/tape.c b/src/tape.c index 1df0fcee..1c691867 100644 --- a/src/tape.c +++ b/src/tape.c @@ -581,6 +581,8 @@ void TapeErase(void) tape.game_version = GAME_VERSION_ACTUAL; tape.engine_version = level.game_version; + tape.property_bits = TAPE_PROPERTY_NONE; + TapeSetDateFromNow(); for (i = 0; i < MAX_PLAYERS; i++) @@ -672,6 +674,8 @@ static void TapeAppendRecording(void) // set current delay (for last played move) tape.pos[tape.counter].delay = tape.delay_played; + tape.property_bits |= TAPE_PROPERTY_REPLAYED; + // set current date TapeSetDateFromNow(); @@ -762,6 +766,12 @@ void TapeRecordAction(byte action_raw[MAX_TAPE_ACTIONS]) tape.set_centered_player = FALSE; } + if (GameFrameDelay != GAME_FRAME_DELAY) + tape.property_bits |= TAPE_PROPERTY_GAME_SPEED; + + if (setup.small_game_graphics || SCR_FIELDX >= 2 * SCR_FIELDX_DEFAULT) + tape.property_bits |= TAPE_PROPERTY_SMALL_GRAPHICS; + if (!TapeAddAction(action)) TapeStopRecording(); } @@ -783,6 +793,12 @@ void TapeTogglePause(boolean toggle_mode) if (tape.single_step && (toggle_mode & TAPE_TOGGLE_MANUAL)) tape.single_step = FALSE; + if (tape.single_step) + tape.property_bits |= TAPE_PROPERTY_SINGLE_STEP; + + if (tape.pausing) + tape.property_bits |= TAPE_PROPERTY_PAUSE_MODE; + DrawVideoDisplayCurrentState(); if (tape.deactivate_display) @@ -1068,6 +1084,8 @@ void TapeQuickSave(void) return; } + tape.property_bits |= TAPE_PROPERTY_SNAPSHOT; + if (SaveTapeChecked(tape.level_nr)) SaveEngineSnapshotSingle(); } @@ -1126,6 +1144,7 @@ void TapeQuickLoad(void) TapeStartWarpForward(AUTOPLAY_MODE_WARP_NO_DISPLAY); tape.quick_resume = TRUE; + tape.property_bits |= TAPE_PROPERTY_SNAPSHOT; } else // this should not happen (basically checked above) { diff --git a/src/tape.h b/src/tape.h index e4732817..e710fa33 100644 --- a/src/tape.h +++ b/src/tape.h @@ -38,6 +38,13 @@ // values for tape properties stored in tape file #define TAPE_PROPERTY_NONE 0 #define TAPE_PROPERTY_EM_RANDOM_BUG (1 << 0) +#define TAPE_PROPERTY_GAME_SPEED (1 << 1) +#define TAPE_PROPERTY_PAUSE_MODE (1 << 2) +#define TAPE_PROPERTY_SINGLE_STEP (1 << 3) +#define TAPE_PROPERTY_SNAPSHOT (1 << 4) +#define TAPE_PROPERTY_REPLAYED (1 << 5) +#define TAPE_PROPERTY_TAS_KEYS (1 << 6) +#define TAPE_PROPERTY_SMALL_GRAPHICS (1 << 7) // values for score tape basename length (date, time, name hash, no extension) #define MAX_SCORE_TAPE_BASENAME_LEN 24