X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Freademc.c;h=1308615c363d7ceee40d581fa8c11036e933ca1d;hb=04c0f302;hp=a8449a04dd4113b1ffb03b1bcc3498e2e3f4d62c;hpb=d0965bd91225c82b3b099a50050321d84568bb16;p=rocksndiamonds.git diff --git a/src/game_em/reademc.c b/src/game_em/reademc.c index a8449a04..1308615c 100644 --- a/src/game_em/reademc.c +++ b/src/game_em/reademc.c @@ -42,7 +42,7 @@ #define GET_BE16(x) ((&x)[0] << 8 | (&x)[1]) -static const short map_emc[256] = +static const short map_emc_raw[256] = { Cstone, Cstone, Cdiamond, Cdiamond, // 0 Calien, Calien, Cpause, Cpause, // 4 @@ -113,6 +113,21 @@ static const short map_emc[256] = Cwall_1, Cblank, Calpha_copyr, Cfake_acid_1 // 252 }; +static const short swap_emc[CAVE_TILE_MAX] = +{ + [Cdirt] = Cgrass, + [Cgrass] = Cdirt, + + [Csteel_1] = Csteel_2, + [Csteel_2] = Csteel_1, + + [Cwall_1] = Cwall_2, + [Cwall_2] = Cwall_1, + + [Croundwall_1] = Croundwall_2, + [Croundwall_2] = Croundwall_1 +}; + static struct { int bit_nr; @@ -256,6 +271,19 @@ static int eater_offset[8] = void convert_em_level(unsigned char *src, int file_version) { int i, x, y, temp; + short map_emc[256]; + + /* initialize element mapping */ + + for (i = 0; i < 256; i++) + map_emc[i] = map_emc_raw[i]; + + /* swap tiles for pre-EMC caves (older than V5/V6), if needed */ + + if (swapTiles_EM(file_version < FILE_VERSION_EM_V5)) + for (i = 0; i < 256; i++) + if (swap_emc[map_emc[i]] != 0) + map_emc[i] = swap_emc[map_emc[i]]; /* common to all emc caves */ @@ -265,7 +293,7 @@ void convert_em_level(unsigned char *src, int file_version) cav.time_seconds = MIN(GET_BE16(src[2110]), 9999); cav.gems_needed = src[2095]; - cav.infinite = TRUE; + cav.infinite = game_em.use_wrap_around; cav.testmode = FALSE; cav.teamwork = (src[2150] & 128) != 0;