#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 28
#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 29
#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 30
-#define SETUP_TOKEN_OVERRIDE_CLASSIC_ARTWORK 31
+#define SETUP_TOKEN_AUTO_OVERRIDE_ARTWORK 31
#define NUM_GLOBAL_SETUP_TOKENS 32
{ TYPE_SWITCH, &si.override_level_graphics, "override_level_graphics" },
{ TYPE_SWITCH, &si.override_level_sounds, "override_level_sounds" },
{ TYPE_SWITCH, &si.override_level_music, "override_level_music" },
- { TYPE_SWITCH, &si.override_classic_artwork,"override_classic_artwork"},
+ { TYPE_SWITCH, &si.auto_override_artwork, "auto_override_artwork" },
};
static boolean not_used = FALSE;
si->override_level_graphics = FALSE;
si->override_level_sounds = FALSE;
si->override_level_music = FALSE;
- si->override_classic_artwork = FALSE;
+ si->auto_override_artwork = FALSE;
si->editor.el_boulderdash = TRUE;
si->editor.el_emerald_mine = TRUE;
getFontBitmapID, getFontFromToken);
}
-static void CheckArtworkConfigForCustomElements(char *filename)
-{
- SetupFileHash *setup_file_hash;
- boolean redefined_ce_found = FALSE;
-
- if ((setup_file_hash = loadSetupFileHash(filename)) != NULL)
- {
- BEGIN_HASH_ITERATION(setup_file_hash, itr)
- {
- char *token = HASH_ITERATION_TOKEN(itr);
-
- if (strPrefix(token, "custom_"))
- redefined_ce_found = TRUE;
- }
- END_HASH_ITERATION(setup_file_hash, itr)
-
- freeSetupFileHash(setup_file_hash);
- }
-
- printf("::: redefined_ce_found == %d [%s]\n", redefined_ce_found, filename);
-}
-
-static void CheckCustomElementGraphicInfo()
-{
- struct PropertyMapping *property_mapping = getImageListPropertyMapping();
- int num_property_mappings = getImageListPropertyMappingSize();
- boolean redefined_ce_found = FALSE;
- int i;
-
- /* check normal element/graphic mapping from static configuration */
- for (i = 0; element_to_graphic[i].element > -1; i++)
- {
- int element = element_to_graphic[i].element;
- int graphic = element_to_graphic[i].graphic;
-
- if (IS_CUSTOM_ELEMENT(element))
- if (getImageListEntryFromImageID(graphic)->redefined)
- redefined_ce_found = TRUE;
- }
-
- /* check normal element/graphic mapping from dynamic configuration */
- for (i = 0; i < num_property_mappings; i++)
- {
- int element = property_mapping[i].base_index;
-
- if (IS_CUSTOM_ELEMENT(element))
- redefined_ce_found = TRUE;
- }
-
- printf("::: redefined_ce_found == %d\n", redefined_ce_found);
-}
-
void InitElementGraphicInfo()
{
struct PropertyMapping *property_mapping = getImageListPropertyMapping();
#endif
}
+static boolean CheckArtworkConfigForCustomElements(char *filename)
+{
+ SetupFileHash *setup_file_hash;
+ boolean redefined_ce_found = FALSE;
+
+ if ((setup_file_hash = loadSetupFileHash(filename)) != NULL)
+ {
+ BEGIN_HASH_ITERATION(setup_file_hash, itr)
+ {
+ char *token = HASH_ITERATION_TOKEN(itr);
+
+ if (strPrefix(token, "custom_"))
+ {
+ redefined_ce_found = TRUE;
+
+ break;
+ }
+ }
+ END_HASH_ITERATION(setup_file_hash, itr)
+
+ freeSetupFileHash(setup_file_hash);
+ }
+
+ return redefined_ce_found;
+}
+
+static void InitOverrideArtwork()
+{
+ boolean init_override_from_setup = TRUE;
+
+ gfx.override_level_graphics = FALSE;
+ gfx.override_level_sounds = FALSE;
+ gfx.override_level_music = FALSE;
+
+ if (setup.auto_override_artwork)
+ {
+ char *filename_base, *filename_local;
+ boolean redefined_ce_found = FALSE;
+
+ /* first look for special artwork configured in level series config */
+ filename_base = getCustomArtworkLevelConfigFilename(ARTWORK_TYPE_GRAPHICS);
+
+ if (fileExists(filename_base))
+ redefined_ce_found |= CheckArtworkConfigForCustomElements(filename_base);
+
+ filename_local = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS);
+
+ if (filename_local != NULL && !strEqual(filename_base, filename_local))
+ redefined_ce_found |= CheckArtworkConfigForCustomElements(filename_local);
+
+#if 0
+ printf("::: redefined_ce_found == %d\n", redefined_ce_found);
+#endif
+
+ if (!redefined_ce_found)
+ {
+ gfx.override_level_graphics = TRUE;
+ gfx.override_level_sounds = TRUE;
+ gfx.override_level_music = TRUE;
+
+ init_override_from_setup = FALSE;
+ }
+ }
+
+ if (init_override_from_setup)
+ {
+ gfx.override_level_graphics = setup.override_level_graphics;
+ gfx.override_level_sounds = setup.override_level_sounds;
+ gfx.override_level_music = setup.override_level_music;
+ }
+}
+
static char *getNewArtworkIdentifier(int type)
{
static char *leveldir_current_identifier[3] = { NULL, NULL, NULL };
boolean force_reload_mus = (force_reload & (1 << ARTWORK_TYPE_MUSIC));
boolean reload_needed;
-#if 1
- gfx.draw_init_text = FALSE;
-
- gfx.override_level_graphics = FALSE;
- gfx.override_level_sounds = FALSE;
- gfx.override_level_music = FALSE;
-
-#if 0
- LoadImageConfig();
-#endif
-#if 0
- CheckCustomElementGraphicInfo();
-#endif
-
-#if 1
- {
- char *filename_base, *filename_local;
-
- /* first look for special artwork configured in level series config */
- filename_base = getCustomArtworkLevelConfigFilename(ARTWORK_TYPE_GRAPHICS);
-
- if (fileExists(filename_base))
- CheckArtworkConfigForCustomElements(filename_base);
-
- filename_local = getCustomArtworkConfigFilename(ARTWORK_TYPE_GRAPHICS);
-
- if (filename_local != NULL && !strEqual(filename_base, filename_local))
- CheckArtworkConfigForCustomElements(filename_local);
- }
-#endif
-
- gfx.override_level_graphics = setup.override_level_graphics;
- gfx.override_level_sounds = setup.override_level_sounds;
- gfx.override_level_music = setup.override_level_music;
-
- gfx.draw_init_text = TRUE;
-#endif
+ InitOverrideArtwork();
force_reload_gfx |= AdjustGraphicsForEMC();