rnd-20020803-1-src
[rocksndiamonds.git] / src / init.c
index f89f107d8eefb2b59b8081af3bf195dafd3cb2db..41bdc3604a698e15300013591b71861fd74cabd9 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2001 Artsoft Entertainment                      *
+* (c) 1995-2002 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
@@ -411,19 +411,29 @@ void InitGfxBackground()
 
 void ReloadCustomArtwork()
 {
-  static char *leveldir_current_name = NULL;
+  static char *leveldir_current_filename = NULL;
   static boolean last_override_level_graphics = FALSE;
   static boolean last_override_level_sounds = FALSE;
   static boolean last_override_level_music = FALSE;
 
-  if (leveldir_current_name != leveldir_current->name)
+  if (leveldir_current_filename != leveldir_current->filename)
   {
-    /* force reload of custom artwork after new level series was selected */
-    artwork.graphics_set_current_name = NULL;
-    artwork.sounds_set_current_name = NULL;
-    artwork.music_set_current_name = NULL;
-
-    leveldir_current_name = leveldir_current->name;
+    char *filename_old = leveldir_current_filename;
+    char *filename_new = leveldir_current->filename;
+
+    /* force reload of custom artwork after new level series was selected,
+       but reload only that part of the artwork that really has changed */
+    if (getTreeInfoFromFilename(artwork.gfx_first, filename_old) !=
+       getTreeInfoFromFilename(artwork.gfx_first, filename_new))
+      artwork.graphics_set_current_name = NULL;
+    if (getTreeInfoFromFilename(artwork.snd_first, filename_old) !=
+       getTreeInfoFromFilename(artwork.snd_first, filename_new))
+      artwork.sounds_set_current_name = NULL;
+    if (getTreeInfoFromFilename(artwork.mus_first, filename_new) !=
+       getTreeInfoFromFilename(artwork.mus_first, filename_new))
+      artwork.music_set_current_name = NULL;
+
+    leveldir_current_filename = leveldir_current->filename;
   }
 
   if (artwork.graphics_set_current_name != artwork.gfx_current->name ||
@@ -443,7 +453,9 @@ void ReloadCustomArtwork()
     InitTileClipmasks();
     InitGfxBackground();
 
-    SetDoorState(DOOR_OPEN_1 | DOOR_CLOSE_2);
+    /* force redraw of (open or closed) door graphics */
+    SetDoorState(DOOR_OPEN_ALL);
+    CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
 
     artwork.graphics_set_current_name = artwork.gfx_current->name;
     last_override_level_graphics = setup.override_level_graphics;
@@ -1666,19 +1678,35 @@ void InitElementProperties()
 
 void Execute_Debug_Command(char *command)
 {
-  if (strcmp(command, "create soundinfo.conf") == 0)
+  if (strcmp(command, "create graphicsinfo.conf") == 0)
+  {
+    printf("# (Currently only the \"name\" directive is recognized.)\n");
+    printf("\n");
+    printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics"));
+    printf("\n");
+  }
+  else if (strcmp(command, "create soundsinfo.conf") == 0)
   {
     int i;
 
     printf("# You can configure additional/alternative sound effects here\n");
     printf("# (The sounds below are default and therefore commented out.)\n");
     printf("\n");
+    printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds"));
+    printf("\n");
 
     for (i=0; i<NUM_SOUND_EFFECTS; i++)
       printf("# %s\n",
             getFormattedSetupEntry(sound_effects[i].text,
                                    sound_effects[i].default_filename));
   }
+  else if (strcmp(command, "create musicinfo.conf") == 0)
+  {
+    printf("# (Currently only the \"name\" directive is recognized.)\n");
+    printf("\n");
+    printf("%s\n", getFormattedSetupEntry("name", "Classic Music"));
+    printf("\n");
+  }
 }
 
 void CloseAllAndExit(int exit_value)