From: Holger Schemel Date: Tue, 25 Sep 2007 21:15:06 +0000 (+0200) Subject: rnd-20070925-1-src X-Git-Tag: 3.2.5^2~6 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=56814df201c2d86273cf54e0e94c0448ce9bdd0f;p=rocksndiamonds.git rnd-20070925-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 2b817800..798079ba 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-09-18 02:08" +#define COMPILE_DATE_STRING "2007-09-25 03:18" diff --git a/src/files.c b/src/files.c index 48fb5865..e78c1cdb 100644 --- a/src/files.c +++ b/src/files.c @@ -8013,8 +8013,9 @@ 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 NUM_GLOBAL_SETUP_TOKENS 31 +#define NUM_GLOBAL_SETUP_TOKENS 32 /* editor setup */ #define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0 @@ -8142,6 +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"}, }; static boolean not_used = FALSE; @@ -8296,6 +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->editor.el_boulderdash = TRUE; si->editor.el_emerald_mine = TRUE; @@ -8968,7 +8971,11 @@ void LoadMenuDesignSettings() InitMenuDesignSettings_Static(); InitMenuDesignSettings_SpecialPreProcessing(); +#if 1 + if (!GFX_OVERRIDE_ARTWORK(ARTWORK_TYPE_GRAPHICS)) +#else if (!SETUP_OVERRIDE_ARTWORK(setup, ARTWORK_TYPE_GRAPHICS)) +#endif { /* first look for special settings configured in level series config */ filename_base = getCustomArtworkLevelConfigFilename(ARTWORK_TYPE_GRAPHICS); diff --git a/src/init.c b/src/init.c index 512c2756..4711b343 100644 --- a/src/init.c +++ b/src/init.c @@ -587,6 +587,58 @@ 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(); @@ -5422,6 +5474,7 @@ void InitGfx() InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE); InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE); InitGfxScrollbufferInfo(FXSIZE, FYSIZE); + InitGfxCustomArtworkInfo(); bitmap_font_initial = LoadCustomImage(filename_font_initial); @@ -5663,7 +5716,11 @@ static char *getNewArtworkIdentifier(int type) static boolean last_has_level_artwork_set[3] = { FALSE, FALSE, FALSE }; static boolean initialized[3] = { FALSE, FALSE, FALSE }; TreeInfo *artwork_first_node = ARTWORK_FIRST_NODE(artwork, type); +#if 1 + boolean setup_override_artwork = GFX_OVERRIDE_ARTWORK(type); +#else boolean setup_override_artwork = SETUP_OVERRIDE_ARTWORK(setup, type); +#endif char *setup_artwork_set = SETUP_ARTWORK_SET(setup, type); char *leveldir_identifier = leveldir_current->identifier; #if 1 @@ -5780,6 +5837,44 @@ 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 + force_reload_gfx |= AdjustGraphicsForEMC(); gfx_new_identifier = getNewArtworkIdentifier(ARTWORK_TYPE_GRAPHICS); diff --git a/src/libgame/image.c b/src/libgame/image.c index 85a73a54..c9712c81 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -1026,6 +1026,11 @@ 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 89f4f7c4..879c9615 100644 --- a/src/libgame/image.h +++ b/src/libgame/image.h @@ -89,6 +89,7 @@ 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 3d63cc5c..8ff6a458 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -2662,7 +2662,11 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) artwork_info->num_property_mapping_entries = 0; } +#if 1 + if (!GFX_OVERRIDE_ARTWORK(artwork_info->type)) +#else if (!SETUP_OVERRIDE_ARTWORK(setup, artwork_info->type)) +#endif { /* first look for special artwork configured in level series config */ filename_base = getCustomArtworkLevelConfigFilename(artwork_info->type); diff --git a/src/libgame/setup.c b/src/libgame/setup.c index df6e2f8a..e8e99a38 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -518,7 +518,7 @@ char *getLevelSetTitleMessageFilename(int nr, boolean initial) basename = getLevelSetTitleMessageBasename(nr, initial); - if (!setup.override_level_graphics) + if (!gfx.override_level_graphics) { /* 1st try: look for special artwork in current level series directory */ filename = getPath3(getCurrentLevelDir(), GRAPHICS_DIRECTORY, basename); @@ -615,7 +615,7 @@ char *getCustomImageFilename(char *basename) basename = getCorrectedArtworkBasename(basename); - if (!setup.override_level_graphics) + if (!gfx.override_level_graphics) { /* 1st try: look for special artwork in current level series directory */ filename = getPath3(getCurrentLevelDir(), GRAPHICS_DIRECTORY, basename); @@ -688,7 +688,7 @@ char *getCustomSoundFilename(char *basename) basename = getCorrectedArtworkBasename(basename); - if (!setup.override_level_sounds) + if (!gfx.override_level_sounds) { /* 1st try: look for special artwork in current level series directory */ filename = getPath3(getCurrentLevelDir(), SOUNDS_DIRECTORY, basename); @@ -756,7 +756,7 @@ char *getCustomMusicFilename(char *basename) basename = getCorrectedArtworkBasename(basename); - if (!setup.override_level_music) + if (!gfx.override_level_music) { /* 1st try: look for special artwork in current level series directory */ filename = getPath3(getCurrentLevelDir(), MUSIC_DIRECTORY, basename); @@ -850,7 +850,7 @@ char *getCustomMusicDirectory(void) checked_free(directory); - if (!setup.override_level_music) + if (!gfx.override_level_music) { /* 1st try: look for special artwork in current level series directory */ directory = getPath2(getCurrentLevelDir(), MUSIC_DIRECTORY); diff --git a/src/libgame/sound.c b/src/libgame/sound.c index b80cccab..d620dd93 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -474,8 +474,8 @@ static void WriteReloadInfoToPipe(char *set_identifier, int type) unsigned long str_size4 = strlen(ti->basepath) + 1; unsigned long str_size5 = strlen(ti->fullpath) + 1; boolean override_level_artwork = (type == SND_CTRL_RELOAD_SOUNDS ? - setup.override_level_sounds : - setup.override_level_music); + gfx.override_level_sounds : + gfx.override_level_music); if (IS_CHILD_PROCESS()) return; @@ -534,8 +534,8 @@ static void ReadReloadInfoFromPipe(SoundControl *snd_ctrl) unsigned long str_size1, str_size2, str_size3, str_size4, str_size5; static char *set_identifier = NULL; boolean *override_level_artwork = (snd_ctrl->state & SND_CTRL_RELOAD_SOUNDS ? - &setup.override_level_sounds : - &setup.override_level_music); + &gfx.override_level_sounds : + &gfx.override_level_music); checked_free(set_identifier); diff --git a/src/libgame/system.c b/src/libgame/system.c index 9ed186f1..ed856965 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -201,6 +201,15 @@ void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void)) gfx.draw_busy_anim_function = draw_busy_anim_function; } +void InitGfxCustomArtworkInfo() +{ + gfx.override_level_graphics = FALSE; + gfx.override_level_sounds = FALSE; + gfx.override_level_music = FALSE; + + gfx.draw_init_text = TRUE; +} + void SetDrawDeactivationMask(int draw_deactivation_mask) { gfx.draw_deactivation_mask = draw_deactivation_mask; diff --git a/src/libgame/system.h b/src/libgame/system.h index 59522dc6..a340b218 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -540,6 +540,13 @@ (setup).override_level_sounds : \ (setup).override_level_music) +#define GFX_OVERRIDE_ARTWORK(type) \ + ((type) == ARTWORK_TYPE_GRAPHICS ? \ + gfx.override_level_graphics : \ + (type) == ARTWORK_TYPE_SOUNDS ? \ + gfx.override_level_sounds : \ + gfx.override_level_music) + #define ARTWORK_FIRST_NODE(artwork, type) \ ((type) == ARTWORK_TYPE_GRAPHICS ? \ (artwork).gfx_first : \ @@ -725,6 +732,12 @@ struct GfxInfo Bitmap *background_bitmap; int background_bitmap_mask; + boolean override_level_graphics; + boolean override_level_sounds; + boolean override_level_music; + + boolean draw_init_text; + int num_fonts; struct FontBitmapInfo *font_bitmap_info; int (*select_font_function)(int); @@ -858,7 +871,7 @@ struct SetupInfo boolean override_level_graphics; boolean override_level_sounds; boolean override_level_music; -#if 0 +#if 1 boolean override_classic_artwork; #endif @@ -1134,6 +1147,7 @@ void InitGfxDoor1Info(int, int, int, int); void InitGfxDoor2Info(int, int, int, int); void InitGfxScrollbufferInfo(int, int); void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void)); +void InitGfxCustomArtworkInfo(); void SetDrawDeactivationMask(int); void SetDrawBackgroundMask(int); void SetWindowBackgroundBitmap(Bitmap *); diff --git a/src/libgame/text.c b/src/libgame/text.c index f5e9c066..f0cdb01a 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -203,6 +203,7 @@ void DrawInitTextExt(char *text, int ypos, int font_nr, boolean force) return; if (window != NULL && + gfx.draw_init_text && gfx.num_fonts > 0 && gfx.font_bitmap_info[font_nr].bitmap != NULL) { diff --git a/src/screens.c b/src/screens.c index 7ec7fac5..0ed0b384 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4203,6 +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:" }, #else { TYPE_STRING, NULL, "Override Level Artwork:"}, { TYPE_YES_NO, &setup.override_level_graphics, "Graphics:" },