From: Holger Schemel Date: Sun, 30 Jun 2024 14:40:19 +0000 (+0200) Subject: added mapping (scanned) BD run-time elements to normal BD elements X-Git-Tag: 4.4.0.0-test-3~12 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=88524b2ff8ec59a925cab0d34fbebb401091d512;p=rocksndiamonds.git added mapping (scanned) BD run-time elements to normal BD elements --- diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index 6e474620..0adabeb8 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -1665,7 +1665,7 @@ void gd_cave_adler_checksum_more(GdCave *cave, unsigned int *a, unsigned int *b) for (y = 0; y < cave->h; y++) for (x = 0; x < cave->w; x++) { - *a += gd_elements[cave->map[y][x]].character; + *a += gd_elements[cave->map[y][x] & O_MASK].character; *b += *a; *a %= 65521; diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 888c73d3..0f9eecc7 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -1713,7 +1713,7 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, } // add the ckdelay correction value for every element seen. - cave->ckdelay += gd_elements[get(cave, x, y)].ckdelay; + cave->ckdelay += gd_elements[get(cave, x, y) & O_MASK].ckdelay; switch (get(cave, x, y)) { @@ -3975,7 +3975,7 @@ void set_initial_cave_speed(GdCave *cave) for (x = 0; x < cave->w; x++) { // add the ckdelay correction value for every element seen. - cave->ckdelay += gd_elements[get(cave, x, y)].ckdelay; + cave->ckdelay += gd_elements[get(cave, x, y) & O_MASK].ckdelay; } } diff --git a/src/tools.c b/src/tools.c index d56532d1..17cd794a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -7686,6 +7686,9 @@ int map_element_BD_to_RND_cave(int element_bd) mapping_initialized = TRUE; } + // always map (scanned) run-time elements to normal elements + element_bd &= O_MASK; + if (element_bd < 0 || element_bd >= O_MAX_ALL) { Warn("invalid BD element %d", element_bd); @@ -7716,6 +7719,9 @@ int map_element_BD_to_RND_game(int element_bd) mapping_initialized = TRUE; } + // always map (scanned) run-time elements to normal elements + element_bd &= O_MASK; + if (element_bd < 0 || element_bd >= O_MAX_ALL) { Warn("invalid BD element %d", element_bd);