From: Holger Schemel Date: Sat, 3 Sep 2022 07:21:27 +0000 (+0200) Subject: added flag to tape files to explicitly mark solution tapes X-Git-Tag: 4.3.3.0~66 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9c94b5f043a204edb69f88c95d6a44fafa95ddb2;p=rocksndiamonds.git added flag to tape files to explicitly mark solution tapes --- diff --git a/src/files.c b/src/files.c index 6839934a..e8de1142 100644 --- a/src/files.c +++ b/src/files.c @@ -60,7 +60,6 @@ #define TAPE_CHUNK_VERS_SIZE 8 // size of file version chunk #define TAPE_CHUNK_HEAD_SIZE 20 // size of tape file header -#define TAPE_CHUNK_HEAD_UNUSED 1 // unused tape header bytes #define TAPE_CHUNK_SCRN_SIZE 2 // size of screen size chunk #define SCORE_CHUNK_VERS_SIZE 8 // size of file version chunk @@ -7887,6 +7886,7 @@ static void setTapeInfoToDefaults(void) tape.level_nr = level_nr; tape.counter = 0; tape.changed = FALSE; + tape.solved = FALSE; tape.recording = FALSE; tape.playing = FALSE; @@ -7973,8 +7973,7 @@ static int LoadTape_HEAD(File *file, int chunk_size, struct TapeInfo *tape) setTapeActionFlags(tape, getFile8Bit(file)); tape->property_bits = getFile8Bit(file); - - ReadUnusedBytesFromFile(file, TAPE_CHUNK_HEAD_UNUSED); + tape->solved = getFile8Bit(file); engine_version = getFileVersion(file); if (engine_version > 0) @@ -8419,9 +8418,7 @@ static void SaveTape_HEAD(FILE *file, struct TapeInfo *tape) putFile8Bit(file, getTapeActionValue(tape)); putFile8Bit(file, tape->property_bits); - - // unused bytes not at the end here for 4-byte alignment of engine_version - WriteUnusedBytesToFile(file, TAPE_CHUNK_HEAD_UNUSED); + putFile8Bit(file, tape->solved); putFileVersion(file, tape->engine_version); } @@ -8603,6 +8600,10 @@ void DumpTape(struct TapeInfo *tape) tape->engine_version); Print("Level series identifier: '%s'\n", tape->level_identifier); + Print("Solution tape: %s\n", + tape->solved ? "yes" : + tape->game_version < VERSION_IDENT(4,3,2,3) ? "unknown" : "no"); + Print("Special tape properties: "); if (tape->property_bits == TAPE_PROPERTY_NONE) Print("[none]"); diff --git a/src/game.c b/src/game.c index 4c4619c1..97617bb3 100644 --- a/src/game.c +++ b/src/game.c @@ -4777,6 +4777,8 @@ static void LevelSolved(void) game.LevelSolved = TRUE; game.GameOver = TRUE; + tape.solved = TRUE; + // needed here to display correct panel values while player walks into exit LevelSolved_SetFinalGameValues(); } diff --git a/src/tape.c b/src/tape.c index 3fb22a8d..240a1492 100644 --- a/src/tape.c +++ b/src/tape.c @@ -664,6 +664,7 @@ void TapeErase(void) tape.level_nr = level_nr; tape.pos[tape.counter].delay = 0; tape.changed = TRUE; + tape.solved = FALSE; tape.random_seed = InitRND(level.random_seed); @@ -760,6 +761,7 @@ static void TapeAppendRecording(void) // start recording tape.recording = TRUE; tape.changed = TRUE; + tape.solved = FALSE; // set current delay (for last played move) tape.pos[tape.counter].delay = tape.delay_played; diff --git a/src/tape.h b/src/tape.h index c3b3a6de..c4fba44d 100644 --- a/src/tape.h +++ b/src/tape.h @@ -210,6 +210,7 @@ struct TapeInfo boolean quick_resume; boolean single_step; boolean changed; + boolean solved; boolean player_participates[MAX_PLAYERS]; int num_participating_players; int centered_player_nr_next;