From 8777c301e669a06b13a824a238f5310341d5a049 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 23 Aug 2018 18:49:30 +0200 Subject: [PATCH] fixed extremely nasty bug when using level template in level editor When checking the checkbox "use template for custom elements" on the "editor" tab on the level properties page, the playfield area was replaced with a "broken" level, caused by horrible bugs in the level initialization function "setLevelInfoToDefaults_MM()". Fixed now. This bug was introduced with the MM game engine in version 4.1.0.0. --- src/game_mm/mm_files.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/game_mm/mm_files.c b/src/game_mm/mm_files.c index 1def7cc3..fa47d1f4 100644 --- a/src/game_mm/mm_files.c +++ b/src/game_mm/mm_files.c @@ -97,12 +97,12 @@ void setLevelInfoToDefaults_MM() native_mm_level.encoding_16bit_field = FALSE; /* default: only 8-bit elements */ - lev_fieldx = native_mm_level.fieldx = STD_LEV_FIELDX; - lev_fieldy = native_mm_level.fieldy = STD_LEV_FIELDY; + native_mm_level.fieldx = STD_LEV_FIELDX; + native_mm_level.fieldy = STD_LEV_FIELDY; for (x = 0; x < MAX_LEV_FIELDX; x++) for (y = 0; y < MAX_LEV_FIELDY; y++) - native_mm_level.field[x][y] = Feld[x][y] = Ur[x][y] = EL_EMPTY; + native_mm_level.field[x][y] = Ur[x][y] = EL_EMPTY; native_mm_level.time = 100; native_mm_level.kettles_needed = 0; @@ -127,9 +127,8 @@ void setLevelInfoToDefaults_MM() for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++) native_mm_level.score[i] = 10; - native_mm_level.field[0][0] = Feld[0][0] = Ur[0][0] = EL_MCDUFFIN_RIGHT; + native_mm_level.field[0][0] = Ur[0][0] = EL_MCDUFFIN_RIGHT; native_mm_level.field[STD_LEV_FIELDX-1][STD_LEV_FIELDY-1] = - Feld[STD_LEV_FIELDX-1][STD_LEV_FIELDY-1] = Ur[STD_LEV_FIELDX-1][STD_LEV_FIELDY-1] = EL_EXIT_CLOSED; } @@ -158,8 +157,8 @@ static int LoadLevel_MM_HEAD(File *file, int chunk_size, int i; int laser_color; - lev_fieldx = level->fieldx = getFile8Bit(file); - lev_fieldy = level->fieldy = getFile8Bit(file); + level->fieldx = getFile8Bit(file); + level->fieldy = getFile8Bit(file); level->time = getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN); level->kettles_needed = getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN); @@ -236,7 +235,7 @@ static int LoadLevel_MM_BODY(File *file, int chunk_size, for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++) - native_mm_level.field[x][y] = Feld[x][y] = Ur[x][y] = + native_mm_level.field[x][y] = Ur[x][y] = checkLevelElement(level->encoding_16bit_field ? getFile16BitInteger(file, BYTE_ORDER_BIG_ENDIAN) : getFile8Bit(file)); -- 2.34.1