rnd-19990204-3
[rocksndiamonds.git] / src / init.c
index 33cec176b737016ff375784fe52dc6add95ae32a..7c62ad953e0e56ee95b5c0b3ac99751220b38208 100644 (file)
@@ -18,6 +18,8 @@
 #include "sound.h"
 #include "screens.h"
 #include "editor.h"
+#include "game.h"
+#include "tape.h"
 #include "tools.h"
 #include "files.h"
 #include "joystick.h"
@@ -48,6 +50,7 @@ static void InitSoundServer(void);
 static void InitWindow(int, char **);
 static void InitGfx(void);
 static void LoadGfx(int, struct PictureFileInfo *);
+static void InitGadgets(void);
 static void InitElementProperties(void);
 
 void OpenAll(int argc, char *argv[])
@@ -67,7 +70,6 @@ void OpenAll(int argc, char *argv[])
   InitSoundServer();
   InitJoysticks();
   InitRND(NEW_RANDOMIZE);
-  InitLevelEditorGadgets();
 
   signal(SIGINT, CloseAllAndExit);
   signal(SIGTERM, CloseAllAndExit);
@@ -80,6 +82,7 @@ void OpenAll(int argc, char *argv[])
 
   InitGfx();
   InitElementProperties();
+  InitGadgets();
 
   DrawMainMenu();
 
@@ -348,8 +351,8 @@ void InitWindow(int argc, char *argv[])
   XSizeHints size_hints;
   XWMHints wm_hints;
   XClassHint class_hints;
-  char *window_name = WINDOWTITLE_STRING;
-  char *icon_name = WINDOWTITLE_STRING;
+  char *window_name = WINDOW_TITLE_STRING;
+  char *icon_name = WINDOW_TITLE_STRING;
   long window_event_mask;
   Atom proto_atom = None, delete_atom = None;
 #endif
@@ -494,6 +497,21 @@ void InitGfx()
   }; 
 #endif
 
+#ifdef DEBUG
+#if 0
+  static struct PictureFileInfo test_pic1 =
+  {
+    "RocksFont2",
+    FALSE
+  };
+  static struct PictureFileInfo test_pic2 =
+  {
+    "mouse",
+    FALSE
+  };
+#endif
+#endif
+
   static struct
   {
     int start;
@@ -525,6 +543,15 @@ void InitGfx()
     { GFX_SPIELER4_RIGHT, 4 },
     { GFX_SPIELER4_PUSH_LEFT, 4 },
     { GFX_SPIELER4_PUSH_RIGHT, 4 },
+    { GFX_SP_MURPHY, 1 },
+    { GFX_MURPHY_GO_LEFT, 3 },
+    { GFX_MURPHY_GO_RIGHT, 3 },
+    { GFX_MURPHY_SNAP_UP, 1 },
+    { GFX_MURPHY_SNAP_DOWN, 1 },
+    { GFX_MURPHY_SNAP_RIGHT, 1 },
+    { GFX_MURPHY_SNAP_LEFT, 1 },
+    { GFX_MURPHY_PUSH_RIGHT, 1 },
+    { GFX_MURPHY_PUSH_LEFT, 1 },
     { GFX_GEBLUBBER, 4 },
     { GFX_DYNAMIT, 7 },
     { GFX_DYNABOMB, 4 },
@@ -539,8 +566,21 @@ void InitGfx()
   debug_print_timestamp(0, NULL);      /* initialize timestamp function */
 #endif
 
+#ifdef DEBUG
+#if 0
+  printf("Test: Loading RocksFont2.pcx ...\n");
+  LoadGfx(PIX_SMALLFONT,&test_pic1);
+  printf("Test: Done.\n");
+  printf("Test: Loading mouse.pcx ...\n");
+  LoadGfx(PIX_SMALLFONT,&test_pic2);
+  printf("Test: Done.\n");
+#endif
+#endif
+
+
+
   LoadGfx(PIX_SMALLFONT,&pic[PIX_SMALLFONT]);
-  DrawInitText(WINDOWTITLE_STRING,20,FC_YELLOW);
+  DrawInitText(WINDOW_TITLE_STRING,20,FC_YELLOW);
   DrawInitText(COPYRIGHT_STRING,50,FC_RED);
 #ifdef MSDOS
   DrawInitText("MSDOS version done by Guido Schulz",210,FC_BLUE);
@@ -590,6 +630,7 @@ void InitGfx()
       int src_x, src_y;
       Pixmap src_pixmap;
 
+#if 0
       if (graphic >= GFX_START_ROCKSSCREEN &&
          graphic <= GFX_END_ROCKSSCREEN)
       {
@@ -617,6 +658,14 @@ void InitGfx()
       }
       else
        break;
+#else
+
+      int pixmap_nr;
+
+      getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
+      src_pixmap = clipmask[pixmap_nr];
+
+#endif
 
       tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
 
@@ -791,6 +840,14 @@ void LoadGfx(int pos, struct PictureFileInfo *pic)
   }
 }
 
+void InitGadgets()
+{
+  CreateLevelEditorGadgets();
+  CreateGameButtons();
+  CreateTapeButtons();
+  CreateToolButtons();
+}
+
 void InitElementProperties()
 {
   int i,j;