From 23b6fe9e393f2f7ecf9ea20dafb8fb173f63556b Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 28 Sep 2024 12:55:24 +0200 Subject: [PATCH] changed 16-bit level micro chunk value type from unsigned to signed This change allows for saving and loading negative 16-bit values in level files (like negatiove values for "gems needed", for example). As a result, 16-bit and 32-bit micro chunk values are always signed now, while 8-bit micro chunk values are still always unsigned bytes. --- src/files.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/files.c b/src/files.c index 9e3c25e5..93c7303e 100644 --- a/src/files.c +++ b/src/files.c @@ -3845,9 +3845,9 @@ static int LoadLevel_MicroChunk(File *file, struct LevelFileConfigInfo *conf, } else // constant size configuration data (1, 2 or 4 bytes) { - int value = (byte_mask == CONF_MASK_1_BYTE ? getFile8Bit (file) : - byte_mask == CONF_MASK_2_BYTE ? getFile16BitBE(file) : - byte_mask == CONF_MASK_4_BYTE ? getFile32BitBE(file) : 0); + int value = (byte_mask == CONF_MASK_1_BYTE ? (byte) getFile8Bit (file) : + byte_mask == CONF_MASK_2_BYTE ? (short) getFile16BitBE(file) : + byte_mask == CONF_MASK_4_BYTE ? (int) getFile32BitBE(file) : 0); for (i = 0; conf[i].data_type != -1; i++) { -- 2.34.1