From: Holger Schemel Date: Mon, 8 Jan 2018 14:52:12 +0000 (+0100) Subject: removed storing 'end of demo' file marker in internal Supaplex demo buffer X-Git-Tag: 4.0.1.1~24 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=68907af560a253c727564b478d38eb0408ce0389;p=rocksndiamonds.git removed storing 'end of demo' file marker in internal Supaplex demo buffer --- diff --git a/src/files.c b/src/files.c index 4fd17038..ab8a3126 100644 --- a/src/files.c +++ b/src/files.c @@ -3787,8 +3787,6 @@ static void CopyNativeTape_RND_to_SP(struct LevelInfo *level) demo->data[demo->length++] = ((demo_repeat % 16 - 1) << 4) | demo_action; } - demo->data[demo->length++] = 0xff; - demo->is_available = TRUE; } @@ -3808,12 +3806,12 @@ static void CopyNativeTape_SP_to_RND(struct LevelInfo *level) return; tape.level_nr = demo->level_nr; /* (currently not used) */ - tape.length = demo->length - 1; /* without "end of demo" byte */ + tape.length = demo->length; tape.random_seed = level_sp->header.DemoRandomSeed; TapeSetDateFromEpochSeconds(getFileTimestampEpochSeconds(filename)); - for (i = 0; i < demo->length - 1; i++) + for (i = 0; i < demo->length; i++) { int demo_action = demo->data[i] & 0x0f; int demo_repeat = (demo->data[i] & 0xf0) >> 4; diff --git a/src/game_sp/file.c b/src/game_sp/file.c index a38c8066..bd1a0fa0 100644 --- a/src/game_sp/file.c +++ b/src/game_sp/file.c @@ -254,11 +254,7 @@ static void LoadNativeLevelFromFileStream_SP(File *file, int width, int height, native_sp_level.demo.data[i] = getFile8Bit(file); if (native_sp_level.demo.data[i] == 0xff) /* "end of demo" byte */ - { - i++; - break; - } } native_sp_level.demo.length = i; @@ -574,6 +570,8 @@ void SaveNativeLevel_SP(char *filename) for (i = 0; i < native_sp_level.demo.length; i++) putFile8Bit(file, native_sp_level.demo.data[i]); + + putFile8Bit(file, 0xff); /* "end of demo" byte */ } fclose(file);