X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Freademc.c;h=3f366227a6785c7d0cee3010ac22f8c723c66209;hb=1a22e8bdd70708d1ee0bb3f21a456eca4e3de50a;hp=839b795a28987a00369215982c902ea9a8ea54da;hpb=5ef31acc3a53ad8dac120cfe86b6fde6ee533d55;p=rocksndiamonds.git diff --git a/src/game_em/reademc.c b/src/game_em/reademc.c index 839b795a..3f366227 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 */ @@ -451,7 +479,7 @@ static const unsigned char map_v6[256] = /* filter for v6 */ 0,0,2,2, 4,4,118,118, 8,9,10,11, 12,13,14,15, // 0 - 16,16,18,18, 20,21,22,23, 24,25,26,27, 28,28,118,28, // 16 + 16,16,18,18, 20,21,22,23, 24,25,26,27, 28,28,128,28, // 16 0,16,2,18, 36,37,37,37, 40,41,42,43, 44,45,128,128, // 32 128,148,148,148, 45,45,45,148, 0,57,58,59, 60,61,62,63, // 48 @@ -476,14 +504,14 @@ static const unsigned char map_v5[256] = /* filter for v5 */ 0,0,2,2, 4,4,118,118, 8,9,10,11, 12,13,14,15, // 0 - 16,16,18,18, 20,21,22,23, 24,25,26,27, 28,28,118,28, // 16 + 16,16,18,18, 20,21,22,23, 24,25,26,27, 28,28,128,28, // 16 0,16,2,18, 36,37,37,37, 147,41,42,43, 44,45,128,128, // 32 128,148,148,148, 45,45,45,148, 0,57,58,59, 60,61,62,63, // 48 64,65,66,67, 68,153,153,153, 153,153,153,153, 153,153,153,153, // 64 153,153,153,153, 153,153,153,153, 153,153,153,153, 153,153,153,153, // 80 153,153,153,153, 153,68,68,68, 68,68,68,68, 68,118,118,118, // 96 - 118,118,114,115, 131,118,118,119, 120,121,122,118, 118,118,118,118, // 112 + 118,118,114,115, 131,62,118,119, 120,121,122,118, 118,118,118,118, // 112 128,129,130,131, 132,133,134,135, 136,137,138,139, 140,141,142,143, // 128 144,145,146,147, 148,149,150,151, 152,153,154,155, 156,157,158,159, // 144 @@ -501,17 +529,17 @@ static const unsigned char map_v4[256] = /* filter for v4 */ 0,0,2,2, 4,4,118,118, 8,9,10,11, 12,13,14,15, // 0 - 16,16,18,18, 20,21,22,23, 24,25,26,27, 28,28,118,28, // 16 + 16,16,18,18, 20,21,22,23, 24,25,26,27, 28,28,128,28, // 16 0,16,2,18, 36,37,37,37, 147,41,42,43, 44,45,128,128, // 32 128,148,148,148, 45,45,45,148, 0,153,153,59, 60,61,62,63, // 48 64,65,66,153, 153,153,153,153, 153,153,153,153, 153,153,153,153, // 64 153,153,153,153, 153,153,153,153, 153,153,153,153, 153,153,153,153, // 80 153,153,153,153, 153,153,153,153, 153,153,153,153, 153,153,153,153, // 96 - 153,118,114,115, 131,118,118,119, 120,121,122,118, 118,118,118,118, // 112 + 153,118,114,115, 179,62,118,119, 120,121,122,118, 118,118,118,118, // 112 128,180,189,179, 252,133,134,135, 136,137,138,139, 140,141,142,143, // 128 - 144,145,146,147, 148,149,150,151, 152,68,154,155, 156,157,158,160, // 144 + 144,145,146,147, 148,149,150,151, 152,68,248,249, 250,251,158,160, // 144 160,160,160,160, 160,160,160,160, 160,160,160,160, 160,160,160,175, // 160 153,153,153,153, 153,153,153,153, 153,153,153,153, 153,153,68,153, // 176