rnd-20030402-1-src
[rocksndiamonds.git] / src / init.c
index 62109f0009e33f5e4ff5d755d5dc8c8a320b9b24..9b57d1b04c4477872429c6bc652ac7decb039e44 100644 (file)
@@ -24,7 +24,6 @@
 #include "network.h"
 #include "netserv.h"
 #include "cartoons.h"
-#include "config.h"
 
 #include "conf_e2g.c"  /* include auto-generated data structure definitions */
 #include "conf_esg.c"  /* include auto-generated data structure definitions */
@@ -424,6 +423,9 @@ void InitElementGraphicInfo()
     int direction = element_to_graphic[i].direction;
     int graphic   = element_to_graphic[i].graphic;
 
+    if (graphic_info[graphic].bitmap == NULL)
+      continue;
+
     if (action < 0)
       action = ACTION_DEFAULT;
 
@@ -442,6 +444,9 @@ void InitElementGraphicInfo()
     int special   = property_mapping[i].ext3_index;
     int graphic   = property_mapping[i].artwork_index;
 
+    if (graphic_info[graphic].bitmap == NULL)
+      continue;
+
     if (element >= MAX_NUM_ELEMENTS || special != -1)
       continue;
 
@@ -474,13 +479,18 @@ void InitElementGraphicInfo()
 
     for (act=0; act<NUM_ACTIONS; act++)
     {
+      boolean act_empty = (act == ACTION_DIGGING ||
+                          act == ACTION_SNAPPING ||
+                          act == ACTION_COLLECTING);
+
       for (dir=0; dir<NUM_DIRECTIONS; dir++)
       {
        int default_direction_graphic = element_info[i].graphic[act];
 
        /* no graphic for current action -- use default direction graphic */
        if (default_direction_graphic == -1)
-         default_direction_graphic = default_action_direction_graphic[dir];
+         default_direction_graphic =
+           (act_empty ? IMG_EMPTY : default_action_direction_graphic[dir]);
 
        if (element_info[i].direction_graphic[act][dir] == -1)
          element_info[i].direction_graphic[act][dir] =
@@ -489,7 +499,8 @@ void InitElementGraphicInfo()
 
       /* no graphic for this specific action -- use default action graphic */
       if (element_info[i].graphic[act] == -1)
-       element_info[i].graphic[act] = default_action_graphic;
+       element_info[i].graphic[act] =
+         (act_empty ? IMG_EMPTY : default_action_graphic);
     }
   }
 
@@ -1015,9 +1026,9 @@ static void InitSoundInfo()
 
 static void ReinitializeGraphics()
 {
+  InitGraphicInfo();                   /* graphic properties mapping */
   InitElementGraphicInfo();            /* element game graphic mapping */
   InitElementSpecialGraphicInfo();     /* element special graphic mapping */
-  InitGraphicInfo();                   /* graphic properties mapping */
 
   InitElementSmallImages();            /* create editor and preview images */
   InitFontGraphicInfo();               /* initialize text drawing functions */
@@ -1031,8 +1042,8 @@ static void ReinitializeGraphics()
 
 static void ReinitializeSounds()
 {
-  InitElementSoundInfo();      /* element game sound mapping */
   InitSoundInfo();             /* sound properties mapping */
+  InitElementSoundInfo();      /* element game sound mapping */
 
 #if 1
   InitElementSoundInfo();      /* element game sound mapping */
@@ -2120,6 +2131,20 @@ void InitElementProperties()
   };
   static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube);
 
+  static int ep_em_slippery_wall[] =
+  {
+  };
+  static int ep_em_slippery_wall_num = SIZEOF_ARRAY_INT(ep_em_slippery_wall);
+
+  static int ep_can_be_crumbled[] =
+  {
+    EL_SAND,
+    EL_LANDMINE,
+    EL_TRAP,
+    EL_TRAP_ACTIVE
+  };
+  static int ep_can_be_crumbled_num = SIZEOF_ARRAY_INT(ep_can_be_crumbled);
+
   static long ep1_bit[] =
   {
     EP_BIT_AMOEBALIVE,
@@ -2159,7 +2184,9 @@ void InitElementProperties()
     EP_BIT_BELT,
     EP_BIT_BELT_ACTIVE,
     EP_BIT_BELT_SWITCH,
-    EP_BIT_TUBE
+    EP_BIT_TUBE,
+    EP_BIT_EM_SLIPPERY_WALL,
+    EP_BIT_CAN_BE_CRUMBLED
   };
   static int *ep1_array[] =
   {
@@ -2200,7 +2227,9 @@ void InitElementProperties()
     ep_belt,
     ep_belt_active,
     ep_belt_switch,
-    ep_tube
+    ep_tube,
+    ep_em_slippery_wall,
+    ep_can_be_crumbled
   };
   static int *ep1_num[] =
   {
@@ -2241,7 +2270,9 @@ void InitElementProperties()
     &ep_belt_num,
     &ep_belt_active_num,
     &ep_belt_switch_num,
-    &ep_tube_num
+    &ep_tube_num,
+    &ep_em_slippery_wall_num,
+    &ep_can_be_crumbled_num
   };
   static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *);
   static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *);
@@ -2462,7 +2493,7 @@ static void InitArtworkConfig()
                special_id_suffix, ignore_image_tokens);
   InitSoundList(sound_config, NUM_SOUND_FILES, sound_config_suffix,
                sound_id_prefix, action_id_suffix, dummy,
-               dummy, ignore_sound_tokens);
+               special_id_suffix, ignore_sound_tokens);
 }
 
 static void InitMixer()
@@ -2770,12 +2801,6 @@ void OpenAll()
     exit(0);   /* never reached */
   }
 
-  InitProgramInfo(UNIX_USERDATA_DIRECTORY,
-                 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();
@@ -2785,8 +2810,10 @@ void OpenAll()
 
   InitCounter();
 
-  InitJoysticks();
   InitRND(NEW_RANDOMIZE);
+  InitSimpleRND(NEW_RANDOMIZE);
+
+  InitJoysticks();
 
   InitVideoDisplay();
   InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,