When having EMC level sets with EMC graphics that were originally
played with the EMC player program, but that have cave files in old
cave file format, setting "use_emc_tiles" to "true" causes certain
game elements to be swapped just like when loading cave files with new
EMC file format (version V5 or V6), like swapping dirt and grass and
some wall elements.
This is a level set option, not a graphics set option, so it is still
possible to override graphics for classic style EM level sets with
modern EMC graphics without game elements being changed (so dirt does
not change to grass in this case).
void UpdateEngineValues(int, int, int, int);
void UpdateEngineValues(int, int, int, int);
+boolean swapTiles_EM(boolean);
boolean getTeamMode_EM(void);
boolean isActivePlayer_EM(int);
boolean getTeamMode_EM(void);
boolean isActivePlayer_EM(int);
#define GET_BE16(x) ((&x)[0] << 8 | (&x)[1])
#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
{
Cstone, Cstone, Cdiamond, Cdiamond, // 0
Calien, Calien, Cpause, Cpause, // 4
Cwall_1, Cblank, Calpha_copyr, Cfake_acid_1 // 252
};
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;
static struct
{
int bit_nr;
void convert_em_level(unsigned char *src, int file_version)
{
int i, x, y, temp;
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 */
/* common to all emc caves */
#define LEVELINFO_TOKEN_SPECIAL_FLAGS 24
#define LEVELINFO_TOKEN_HANDICAP 25
#define LEVELINFO_TOKEN_SKIP_LEVELS 26
#define LEVELINFO_TOKEN_SPECIAL_FLAGS 24
#define LEVELINFO_TOKEN_HANDICAP 25
#define LEVELINFO_TOKEN_SKIP_LEVELS 26
+#define LEVELINFO_TOKEN_USE_EMC_TILES 27
-#define NUM_LEVELINFO_TOKENS 27
+#define NUM_LEVELINFO_TOKENS 28
{ TYPE_STRING, &ldi.level_filetype, "filetype" },
{ TYPE_STRING, &ldi.special_flags, "special_flags" },
{ TYPE_BOOLEAN, &ldi.handicap, "handicap" },
{ TYPE_STRING, &ldi.level_filetype, "filetype" },
{ TYPE_STRING, &ldi.special_flags, "special_flags" },
{ TYPE_BOOLEAN, &ldi.handicap, "handicap" },
- { TYPE_BOOLEAN, &ldi.skip_levels, "skip_levels" }
+ { TYPE_BOOLEAN, &ldi.skip_levels, "skip_levels" },
+ { TYPE_BOOLEAN, &ldi.use_emc_tiles, "use_emc_tiles" }
};
static struct TokenInfo artworkinfo_tokens[] =
};
static struct TokenInfo artworkinfo_tokens[] =
ti->readonly = TRUE;
ti->handicap = TRUE;
ti->skip_levels = FALSE;
ti->readonly = TRUE;
ti->handicap = TRUE;
ti->skip_levels = FALSE;
+
+ ti->use_emc_tiles = FALSE;
ti->readonly = parent->readonly;
ti->handicap = parent->handicap;
ti->skip_levels = parent->skip_levels;
ti->readonly = parent->readonly;
ti->handicap = parent->handicap;
ti->skip_levels = parent->skip_levels;
+
+ ti->use_emc_tiles = parent->use_emc_tiles;
ti_copy->handicap = ti->handicap;
ti_copy->skip_levels = ti->skip_levels;
ti_copy->handicap = ti->handicap;
ti_copy->skip_levels = ti->skip_levels;
+ ti_copy->use_emc_tiles = ti->use_emc_tiles;
+
ti_copy->color = ti->color;
ti_copy->class_desc = getStringCopy(ti->class_desc);
ti_copy->handicap_level = ti->handicap_level;
ti_copy->color = ti->color;
ti_copy->class_desc = getStringCopy(ti->class_desc);
ti_copy->handicap_level = ti->handicap_level;
boolean handicap; // level set has no handicap when set to "false"
boolean skip_levels; // levels can be skipped when set to "true"
boolean handicap; // level set has no handicap when set to "false"
boolean skip_levels; // levels can be skipped when set to "true"
+ boolean use_emc_tiles;// use (swapped) V5/V6 EMC tiles when set to "true"
+
int color; // color to use on selection screen for this level
char *class_desc; // description of level series class
int handicap_level; // number of the lowest unsolved level
int color; // color to use on selection screen for this level
char *class_desc; // description of level series class
int handicap_level; // number of the lowest unsolved level
return getBeltSwitchElementFromBeltNrAndBeltDirNr(belt_nr, belt_dir_nr);
}
return getBeltSwitchElementFromBeltNrAndBeltDirNr(belt_nr, belt_dir_nr);
}
+boolean swapTiles_EM(boolean is_pre_emc_cave)
+{
+ return is_pre_emc_cave && leveldir_current->use_emc_tiles;
+}
+
boolean getTeamMode_EM(void)
{
return game.team_mode || network_playing;
boolean getTeamMode_EM(void)
{
return game.team_mode || network_playing;