From: Holger Schemel Date: Tue, 25 Sep 2007 23:07:23 +0000 (+0200) Subject: rnd-20070926-1-src X-Git-Tag: 3.2.5^2~5 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ae9c6c4794c6a8f9704850427de3ebbe933400da;p=rocksndiamonds.git rnd-20070926-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 798079ba..a25ffbaa 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-09-25 03:18" +#define COMPILE_DATE_STRING "2007-09-26 00:53" diff --git a/src/files.c b/src/files.c index e78c1cdb..8827e08d 100644 --- a/src/files.c +++ b/src/files.c @@ -8013,7 +8013,7 @@ void SaveScore(int nr) #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 @@ -8143,7 +8143,7 @@ static struct TokenInfo global_setup_tokens[] = { 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; @@ -8298,7 +8298,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) 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; diff --git a/src/init.c b/src/init.c index 4711b343..5d1867a2 100644 --- a/src/init.c +++ b/src/init.c @@ -587,58 +587,6 @@ void InitFontGraphicInfo() 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(); @@ -5709,6 +5657,78 @@ void InitNetworkServer() #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 }; @@ -5837,43 +5857,7 @@ void ReloadCustomArtwork(int force_reload) 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(); diff --git a/src/libgame/image.c b/src/libgame/image.c index c9712c81..85a73a54 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -1026,11 +1026,6 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries, image_info->free_artwork = FreeImage; } -void LoadImageConfig() -{ - LoadArtworkConfig(image_info); -} - void ReloadCustomImages() { #if 0 diff --git a/src/libgame/image.h b/src/libgame/image.h index 879c9615..89f4f7c4 100644 --- a/src/libgame/image.h +++ b/src/libgame/image.h @@ -89,7 +89,6 @@ struct PropertyMapping *getImageListPropertyMapping(); void InitImageList(struct ConfigInfo *, int, struct ConfigTypeInfo *, char **, char **, char **, char **, char **); -void LoadImageConfig(); void ReloadCustomImages(); void CreateImageWithSmallImages(int, int); void ScaleImage(int, int); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 8ff6a458..9061a3cf 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2211,7 +2211,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, if (filename == NULL) return; -#if 0 +#if 1 printf("LoadArtworkConfigFromFilename '%s' ...\n", filename); #endif @@ -2671,6 +2671,10 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) /* first look for special artwork configured in level series config */ filename_base = getCustomArtworkLevelConfigFilename(artwork_info->type); + printf("::: filename_base == '%s' [%s, %s]\n", filename_base, + leveldir_current->graphics_set, + leveldir_current->graphics_path); + if (fileExists(filename_base)) LoadArtworkConfigFromFilename(artwork_info, filename_base); } diff --git a/src/libgame/system.h b/src/libgame/system.h index a340b218..93baffe9 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -48,8 +48,8 @@ #define FULLSCREEN_NOT_AVAILABLE FALSE #define FULLSCREEN_AVAILABLE TRUE -#define CREATE_SPECIAL_EDITION FALSE -#define CREATE_SPECIAL_EDITION_RND_JUE FALSE +#define CREATE_SPECIAL_EDITION TRUE +#define CREATE_SPECIAL_EDITION_RND_JUE TRUE /* default input keys */ #define DEFAULT_KEY_LEFT KSYM_Left @@ -871,9 +871,7 @@ struct SetupInfo boolean override_level_graphics; boolean override_level_sounds; boolean override_level_music; -#if 1 - boolean override_classic_artwork; -#endif + boolean auto_override_artwork; struct SetupEditorInfo editor; struct SetupEditorCascadeInfo editor_cascade; diff --git a/src/screens.c b/src/screens.c index 0ed0b384..18d560b7 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4203,7 +4203,7 @@ static struct TokenInfo setup_info_artwork[] = { TYPE_YES_NO, &setup.override_level_graphics,"Override Level Graphics:" }, { TYPE_YES_NO, &setup.override_level_sounds, "Override Level Sounds:" }, { TYPE_YES_NO, &setup.override_level_music, "Override Level Music:" }, - { TYPE_YES_NO, &setup.override_classic_artwork,"Override Classic Artwork:" }, + { TYPE_YES_NO, &setup.auto_override_artwork, "Auto-Override Non-CE Sets:" }, #else { TYPE_STRING, NULL, "Override Level Artwork:"}, { TYPE_YES_NO, &setup.override_level_graphics, "Graphics:" },