rnd-20020407-1-src
[rocksndiamonds.git] / src / init.c
index f4a7f1aec7ed0cf9df4c4c3482a81c48c79c2714..3118aa35a76b2d294e2b62d3495f8860a02d96ed 100644 (file)
@@ -24,6 +24,7 @@
 #include "network.h"
 #include "netserv.h"
 #include "cartoons.h"
+#include "config.h"
 
 static char *image_filename[NUM_PICTURES] =
 {
@@ -42,6 +43,7 @@ static char *image_filename[NUM_PICTURES] =
 static void InitSetup(void);
 static void InitPlayerInfo(void);
 static void InitLevelInfo(void);
+static void InitArtworkInfo(void);
 static void InitNetworkServer(void);
 static void InitSound(void);
 static void InitGfx(void);
@@ -62,13 +64,14 @@ void OpenAll(void)
   }
 
   InitProgramInfo(UNIX_USERDATA_DIRECTORY,
-                 PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
+                 PROGRAM_TITLE_STRING, getWindowTitleString(),
                  ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
                  MSDOS_POINTER_FILENAME,
                  COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
 
   InitSetup();
   InitPlayerInfo();
+  InitArtworkInfo();           /* needed before loading gfx, sound & music */
 
   InitCounter();
   InitSound();
@@ -120,6 +123,11 @@ void InitLevelInfo()
   LoadLevelSetup_SeriesInfo();                 /* last played level info */
 }
 
+void InitArtworkInfo()
+{
+  LoadArtworkInfo();
+}
+
 void InitNetworkServer()
 {
 #if defined(PLATFORM_UNIX)
@@ -358,6 +366,36 @@ void InitGfxBackground()
   redraw_mask = REDRAW_ALL;
 }
 
+void ReloadCustomArtwork()
+{
+  if (artwork.graphics_set_current != artwork.gfx_current->name)
+  {
+    int i;
+
+    for(i=0; i<NUM_PICTURES; i++)
+      ReloadCustomImage(&pix[i], image_filename[i]);
+
+    InitGfxBackground();
+    SetDoorState(DOOR_OPEN_1 | DOOR_CLOSE_2);
+
+    artwork.graphics_set_current = artwork.gfx_current->name;
+  }
+
+  if (artwork.sounds_set_current != artwork.snd_current->name)
+  {
+    printf("reload sounds ...\n");
+
+    artwork.sounds_set_current = artwork.snd_current->name;
+  }
+
+  if (artwork.music_set_current != artwork.mus_current->name)
+  {
+    printf("reload music ...\n");
+
+    artwork.music_set_current = artwork.mus_current->name;
+  }
+}
+
 void InitGadgets()
 {
   CreateLevelEditorGadgets();