rnd-20020402-1-src
[rocksndiamonds.git] / src / init.c
index 70604f2a9392854cd4bda2dc4fc30ad16bcb6105..fe585257360fc68d0dc3785be8dbf0f4761013b4 100644 (file)
@@ -23,6 +23,8 @@
 #include "files.h"
 #include "network.h"
 #include "netserv.h"
+#include "cartoons.h"
+#include "config.h"
 
 static char *image_filename[NUM_PICTURES] =
 {
@@ -38,12 +40,13 @@ static char *image_filename[NUM_PICTURES] =
   "RocksFont3.pcx"
 }; 
 
+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);
-static void InitCustomGraphics(void);
 static void InitGfxBackground(void);
 static void InitGadgets(void);
 static void InitElementProperties(void);
@@ -61,11 +64,12 @@ 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();
 
   InitCounter();
@@ -79,20 +83,26 @@ void OpenAll(void)
 
   InitEventFilter(FilterMouseMotionEvents);
 
+  InitArtworkInfo();
   InitGfx();
   InitElementProperties();     /* initializes IS_CHAR() for el2gfx() */
 
   InitLevelInfo();
   InitGadgets();               /* needs to know number of level series */
 
-  InitCustomGraphics();
-
   InitGfxBackground();
+  InitToons();
+
   DrawMainMenu();
 
   InitNetworkServer();
 }
 
+void InitSetup()
+{
+  LoadSetup();                                 /* global setup info */
+}
+
 void InitPlayerInfo()
 {
   int i;
@@ -104,8 +114,6 @@ void InitPlayerInfo()
     stored_player[i].connected = FALSE;
 
   local_player->connected = TRUE;
-
-  LoadSetup();                                 /* global setup info */
 }
 
 void InitLevelInfo()
@@ -115,6 +123,11 @@ void InitLevelInfo()
   LoadLevelSetup_SeriesInfo();                 /* last played level info */
 }
 
+void InitArtworkInfo()
+{
+  LoadArtworkInfo();
+}
+
 void InitNetworkServer()
 {
 #if defined(PLATFORM_UNIX)
@@ -289,7 +302,6 @@ void InitTileClipmasks()
 
 void InitGfx()
 {
-  char *filename;
   int i;
 
   /* initialize some global variables */
@@ -308,11 +320,7 @@ void InitGfx()
   pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
   pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
 
-  filename = getImageFilename(image_filename[PIX_SMALLFONT]);
-  if ((pix_default[PIX_SMALLFONT] = LoadImage(filename)) == NULL)
-    Error(ERR_EXIT, "LoadImage() failed: %s", GetError());
-  pix_custom[PIX_SMALLFONT] = NULL;
-  pix[PIX_SMALLFONT] = pix_default[PIX_SMALLFONT];
+  pix[PIX_SMALLFONT] = LoadCustomImage(image_filename[PIX_SMALLFONT]);
 
   InitFontInfo(NULL, NULL, pix[PIX_SMALLFONT]);
 
@@ -330,11 +338,7 @@ void InitGfx()
     {
       DrawInitText(image_filename[i], 150, FC_YELLOW);
 
-      filename = getImageFilename(image_filename[i]);
-      if ((pix_default[i] = LoadImage(filename)) == NULL)
-       Error(ERR_EXIT, "LoadImage() failed: %s", GetError());
-      pix_custom[i] = NULL;
-      pix[i] = pix_default[i];
+      pix[i] = LoadCustomImage(image_filename[i]);
     }
   }
 
@@ -343,49 +347,6 @@ void InitGfx()
   InitTileClipmasks();
 }
 
-void LoadCustomGraphics()
-{
-#if 0
-  int i;
-
-  for(i=0; i<NUM_PICTURES; i++)
-  {
-    Bitmap *new_pic = 
-    pix_custom[i] = LoadImage(image_filename[i]);
-  }
-#endif
-}
-
-void InitCustomGraphics()
-{
-#if 0
-  static char *filename = NULL;
-
-  /* look for optional directory ~/.<program>/graphics */
-  filename = getPath2(getUserDataDir(), GRAPHICS_DIRECTORY);
-  if (access(dir, F_OK) == 0)
-  {
-  }
-
-
-
-
-(leveldir_current->user_defined ?
-                      getUserLevelDir("") :
-                      options.level_directory),
-                     leveldir_current->fullpath,
-                     basename);
-
-
-
-  filename = getPath3((leveldir_current->user_defined ?
-                      getUserLevelDir("") :
-                      options.level_directory),
-                     leveldir_current->fullpath,
-                     basename);
-#endif
-}
-
 void InitGfxBackground()
 {
   int x, y;
@@ -1572,10 +1533,7 @@ void CloseAllAndExit(int exit_value)
   CloseAudio();
 
   for(i=0; i<NUM_BITMAPS; i++)
-  {
-    FreeBitmap(pix_default[i]);
-    FreeBitmap(pix_custom[i]);
-  }
+    FreeBitmap(pix[i]);
 
   CloseVideoDisplay();
   ClosePlatformDependantStuff();