removed storing 'end of demo' file marker in internal Supaplex demo buffer
authorHolger Schemel <info@artsoft.org>
Mon, 8 Jan 2018 14:52:12 +0000 (15:52 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 8 Jan 2018 14:52:58 +0000 (15:52 +0100)
src/files.c
src/game_sp/file.c

index 4fd17038204a1dce81521c71a3f83df4aa0d4735..ab8a31266ff22ff566d5c24578d27e5402b0a460 100644 (file)
@@ -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;
index a38c80667cff3390b9426f37c07fd7d2771f9832..bd1a0fa0833ac43be47f3bf8ee0bd262719d7d06 100644 (file)
@@ -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);