rnd-20070926-1-src
authorHolger Schemel <info@artsoft.org>
Tue, 25 Sep 2007 23:07:23 +0000 (01:07 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:56:25 +0000 (10:56 +0200)
src/conftime.h
src/files.c
src/init.c
src/libgame/image.c
src/libgame/image.h
src/libgame/misc.c
src/libgame/system.h
src/screens.c

index 798079ba44f5a798ca54931da4394a1fb6048e7d..a25ffbaa93e3c6649a6adfd2ff07b45593424c16 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-09-25 03:18"
+#define COMPILE_DATE_STRING "2007-09-26 00:53"
index e78c1cdb271102049a81b6c596a7bab2bcfbe854..8827e08d402788dde1335c2bc7c67c381d75cf9b 100644 (file)
@@ -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;
index 4711b34394e3d88db8ca50e548abc47fdfcc3fbd..5d1867a2a1af1f37e1174e091fbaa706ae7ba82e 100644 (file)
@@ -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();
 
index c9712c81799556e6a02d9efd1bca6464e0fa1cc7..85a73a54f2a29322acb80ce9e4b9fab4f779ebd7 100644 (file)
@@ -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
index 879c96159dbb32e461419d3566791577697e4955..89f4f7c41d36ac7029fc9d39d05e6d792d18ad3b 100644 (file)
@@ -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);
index 8ff6a458b32682b374d43d994572d03a4eb8177b..9061a3cf89cd225a5a57bbe6f76aab422ec0f47e 100644 (file)
@@ -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);
   }
index a340b21844dc3dd12707617ac90ae1ab9473d8d0..93baffe9735cc67f7ef3928da49bfd92ce7c00ee 100644 (file)
@@ -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;
index 0ed0b384c0200e3e9277a895e5f9e2afa88fdc2d..18d560b77aed2178a498ab6ae97ce970266794c4 100644 (file)
@@ -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:"     },