rnd-20030128-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 27 Jan 2003 23:45:09 +0000 (00:45 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:40:08 +0000 (10:40 +0200)
14 files changed:
src/conftime.h
src/editor.c
src/init.c
src/libgame/image.c
src/libgame/image.h
src/libgame/misc.c
src/libgame/sound.c
src/libgame/sound.h
src/libgame/system.c
src/libgame/system.h
src/main.c
src/main.h
src/tools.c
src/tools.h

index 770195c4d55d1c161743445ad302194e28af59d8..a51b805396039ef538e70563e9c95e799091a292 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-01-27 04:33]"
+#define COMPILE_DATE_STRING "[2003-01-28 00:43]"
index c760e12da1a79a9e6a159934793e56211fd77568..540b409238738ca0522c740d22abe555a16424ba 100644 (file)
@@ -1793,7 +1793,7 @@ static void CreateControlButtons()
     gd_x2 = DOOR_GFX_PAGEX6 + ED_ELEMENTLIST_XPOS;
     gd_y  = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS;
 
-    getMiniGraphicSource(el2img(element), &deco_bitmap, &deco_x, &deco_y);
+    getMiniGraphicSource(el2edimg(element), &deco_bitmap, &deco_x, &deco_y);
     deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2;
     deco_ypos = (ED_ELEMENTLIST_YSIZE - MINI_TILEY) / 2;
 
@@ -2455,13 +2455,13 @@ void DrawLevelEd()
   /* draw mouse button brush elements */
   DrawMiniGraphicExt(drawto,
                     DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
-                    el2img(new_element1));
+                    el2edimg(new_element1));
   DrawMiniGraphicExt(drawto,
                     DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
-                    el2img(new_element2));
+                    el2edimg(new_element2));
   DrawMiniGraphicExt(drawto,
                     DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
-                    el2img(new_element3));
+                    el2edimg(new_element3));
 
   /* draw bigger door */
   DrawSpecialEditorDoor();
@@ -2637,21 +2637,21 @@ static void PickDrawingElement(int button, int element)
     new_element1 = element;
     DrawMiniGraphicExt(drawto,
                       DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
-                      el2img(new_element1));
+                      el2edimg(new_element1));
   }
   else if (button == 2)
   {
     new_element2 = element;
     DrawMiniGraphicExt(drawto,
                       DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
-                      el2img(new_element2));
+                      el2edimg(new_element2));
   }
   else
   {
     new_element3 = element;
     DrawMiniGraphicExt(drawto,
                       DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
-                      el2img(new_element3));
+                      el2edimg(new_element3));
   }
 
   redraw_mask |= REDRAW_DOOR_1;
@@ -2965,7 +2965,7 @@ static void DrawPropertiesWindow()
   DrawGraphicAnimationExt(drawto,
                          SX + xstart * MINI_TILEX,
                          SY + ystart * MINI_TILEY + MINI_TILEY / 2,
-                         el2img(properties_element), -1, NO_MASKING);
+                         el2edimg(properties_element), -1, NO_MASKING);
 
   FrameCounter = 0;    /* restart animation frame counter */
 
@@ -3752,11 +3752,11 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
        DrawMiniGraphicExt(drawto,
                           gi->x + sx * MINI_TILEX,
                           gi->y + sy * MINI_TILEY,
-                          el2img(new_element));
+                          el2edimg(new_element));
        DrawMiniGraphicExt(window,
                           gi->x + sx * MINI_TILEX,
                           gi->y + sy * MINI_TILEY,
-                          el2img(new_element));
+                          el2edimg(new_element));
 
        if (id == GADGET_ID_AMOEBA_CONTENT)
          level.amoeba_content = new_element;
@@ -4078,7 +4078,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
        int element = editor_elements[element_shift + i];
 
        UnmapGadget(gi);
-       getMiniGraphicSource(el2img(element), &gd->bitmap, &gd->x, &gd->y);
+       getMiniGraphicSource(el2edimg(element), &gd->bitmap, &gd->x, &gd->y);
        ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END);
        MapGadget(gi);
       }
@@ -4354,7 +4354,7 @@ void HandleLevelEditorIdle()
   DrawGraphicAnimationExt(drawto,
                          SX + xpos * TILEX,
                          SY + ypos * TILEY + MINI_TILEY / 2,
-                         el2img(properties_element), -1, NO_MASKING);
+                         el2edimg(properties_element), -1, NO_MASKING);
 
   MarkTileDirty(xpos, ypos);
   MarkTileDirty(xpos, ypos + 1);
index 2c04d701df202a8d07d7a6230573271de540f17f..14acc191bb0038c66c6e4784421cfe51d764b399 100644 (file)
@@ -74,6 +74,7 @@ static void InitGfxBackground();
 static void InitGadgets();
 static void InitElementImages();
 static void InitElementGraphicInfo();
+static void InitElementEditorGraphicInfo();
 static void InitElementSoundInfo();
 static void InitElementProperties();
 static void InitGraphicInfo();
@@ -189,12 +190,10 @@ static void InitArtworkConfig()
   static char *sound_class_prefix[MAX_NUM_ELEMENTS + 1];
   static char *action_suffix[NUM_ACTIONS + 1];
   static char *direction_suffix[NUM_DIRECTIONS + 1];
+  static char *special_suffix[NUM_SPECIAL_GFX_ARGS + 1];
   static char *dummy[1] = { NULL };
   int i;
 
-  for (i=0; i<MAX_NUM_ELEMENTS; i++)
-    element_info[i].custom_description = NULL;
-
   for (i=0; i<MAX_NUM_ELEMENTS + 1; i++)
     element_prefix[i] = element_info[i].token_name;
   for (i=0; i<MAX_NUM_ELEMENTS + 1; i++)
@@ -203,11 +202,13 @@ static void InitArtworkConfig()
     action_suffix[i] = element_action_info[i].suffix;
   for (i=0; i<NUM_DIRECTIONS + 1; i++)
     direction_suffix[i] = element_direction_info[i].suffix;
+  for (i=0; i<NUM_SPECIAL_GFX_ARGS + 1; i++)
+    special_suffix[i] = special_suffix_info[i].suffix;
 
   InitImageList(image_config, NUM_IMAGE_FILES, image_config_suffix,
-               element_prefix, action_suffix, direction_suffix);
+               element_prefix, action_suffix,direction_suffix,special_suffix);
   InitSoundList(sound_config, NUM_SOUND_FILES, sound_config_suffix,
-               sound_class_prefix, action_suffix, dummy);
+               sound_class_prefix, action_suffix, dummy, dummy);
 }
 
 void InitLevelArtworkInfo()
@@ -246,8 +247,9 @@ static void InitMixer()
 
 static void ReinitializeGraphics()
 {
-  InitElementGraphicInfo();    /* initialize element/graphic config info */
-  InitGraphicInfo();           /* initialize graphic info from config file */
+  InitElementGraphicInfo();            /* element => game graphic mapping */
+  InitElementEditorGraphicInfo();      /* element => editor graphic mapping */
+  InitGraphicInfo();                   /* graphic => properties mapping */
 
   InitFontInfo(bitmap_font_initial,
               graphic_info[IMG_FONT_BIG].bitmap,
@@ -293,10 +295,10 @@ static void ReinitializeGraphics()
 
 static void ReinitializeSounds()
 {
-  InitElementSoundInfo();      /* initialize element/sound config info */
-  InitSoundInfo();             /* initialize sounds info from config file */
+  InitElementSoundInfo();      /* element => game sound mapping */
+  InitSoundInfo();             /* sound   => properties mapping */
 
-  InitPlaySoundLevel();                /* initialize internal game sound values */
+  InitPlaySoundLevel();                /* internal game sound settings */
 }
 
 static void ReinitializeMusic()
@@ -801,8 +803,12 @@ void InitElementGraphicInfo()
     int element   = property_mapping[i].base_index;
     int action    = property_mapping[i].ext1_index;
     int direction = property_mapping[i].ext2_index;
+    int special   = property_mapping[i].ext3_index;
     int graphic   = property_mapping[i].artwork_index;
 
+    if (special != -1)
+      continue;
+
     if (action < 0)
       action = ACTION_DEFAULT;
 
@@ -852,6 +858,45 @@ void InitElementGraphicInfo()
   }
 }
 
+void InitElementEditorGraphicInfo()
+{
+  struct PropertyMapping *property_mapping = getImageListPropertyMapping();
+  int num_property_mappings = getImageListPropertyMappingSize();
+  int i;
+
+  /* always start with reliable default values */
+  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+    element_info[i].editor_graphic = element_info[i].graphic[ACTION_DEFAULT];
+
+#if 0
+  /* initialize element/graphic mapping from static configuration */
+  for (i=0; ... ; i++)
+  {
+    int element   = ... element;
+    int special   = ... special;
+    int graphic   = ... graphic;
+
+    if (special != GFX_SPECIAL_ARG_EDITOR)
+      continue;
+
+    element_info[element].editor_graphic = graphic;
+  }
+#endif
+
+  /* initialize element/graphic mapping from dynamic configuration */
+  for (i=0; i < num_property_mappings; i++)
+  {
+    int element   = property_mapping[i].base_index;
+    int special   = property_mapping[i].ext3_index;
+    int graphic   = property_mapping[i].artwork_index;
+
+    if (special != GFX_SPECIAL_ARG_EDITOR)
+      continue;
+
+    element_info[element].editor_graphic = graphic;
+  }
+}
+
 static void InitElementSoundInfo()
 {
   /* soon to come */
index 8cdf83245a88ec88c6e5ed5cb746d7842869b785..f72c37e81577f52f5c269ea97a5d616fbf950b90 100644 (file)
@@ -824,7 +824,8 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries,
                   struct ConfigInfo *config_suffix_list,
                   char **base_prefixes,
                   char **ext1_suffixes,
-                  char **ext2_suffixes)
+                  char **ext2_suffixes,
+                  char **ext3_suffixes)
 {
   int i;
 
@@ -861,9 +862,14 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries,
   for (i=0; ext2_suffixes[i] != NULL; i++)
     image_info->num_ext2_suffixes++;
 
+  image_info->num_ext3_suffixes = 0;
+  for (i=0; ext3_suffixes[i] != NULL; i++)
+    image_info->num_ext3_suffixes++;
+
   image_info->base_prefixes = base_prefixes;
   image_info->ext1_suffixes = ext1_suffixes;
   image_info->ext2_suffixes = ext2_suffixes;
+  image_info->ext3_suffixes = ext3_suffixes;
 
   image_info->num_property_mapping_entries = 0;
 
index 46d06425bf2ba8eb089b8b9bccdefa3f4d72b93e..88e18dda13dbaf3d70a3bd46d8bfb27e45358fb8 100644 (file)
@@ -82,7 +82,7 @@ char *getImageConfigFilename();
 int getImageListPropertyMappingSize();
 struct PropertyMapping *getImageListPropertyMapping();
 void InitImageList(struct ConfigInfo *, int, struct ConfigInfo *,
-                  char **, char **, char **);
+                  char **, char **, char **, char **);
 
 void ReloadCustomImages();
 void CreateImageWithSmallImages(int);
index 32910410bff9d25d3732813e85091a0fae53f269..b5dab8f7ebd2da86faddea65b30055e46a20ce1a 100644 (file)
@@ -1552,9 +1552,23 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list,
 
   for (i=0; config_list[i].token != NULL; i++)
   {
+#if 0
+    int len_config_token;
+    int len_config_value;
+    boolean is_file_entry;
+
+    printf("%d: '%s' => '%s'\n",
+          i, config_list[i].token, config_list[i].value);
+
+    len_config_token = strlen(config_list[i].token);
+    len_config_value = strlen(config_list[i].value);
+    is_file_entry = TRUE;
+
+#else
     int len_config_token = strlen(config_list[i].token);
     int len_config_value = strlen(config_list[i].value);
     boolean is_file_entry = TRUE;
+#endif
 
     for (j=0; suffix_list[j].token != NULL; j++)
     {
@@ -1616,7 +1630,7 @@ static boolean token_suffix_match(char *token, char *suffix, int start_pos)
   int len_suffix = strlen(suffix);
 
 #if 0
-  if (IS_PARENT_PROCESS(audio.mixer_pid))
+  if (IS_PARENT_PROCESS())
     printf(":::::::::: check '%s' for '%s' ::::::::::\n", token, suffix);
 #endif
 
@@ -1649,6 +1663,9 @@ static void read_token_parameters(struct SetupFileList *setup_file_list,
   char *known_token_value = KNOWN_TOKEN_VALUE;
   int i;
 
+  if (file_list_entry->filename != NULL)
+    free(file_list_entry->filename);
+
   if (filename != NULL)
   {
     /* when file definition found, set all parameters to default values */
@@ -1695,7 +1712,7 @@ static void add_dynamic_file_list_entry(struct FileInfo **list,
   int parameter_array_size = num_suffix_list_entries * sizeof(int);
 
 #if 0
-  if (IS_PARENT_PROCESS(audio.mixer_pid))
+  if (IS_PARENT_PROCESS())
     printf("===> found dynamic definition '%s'\n", token);
 #endif
 
@@ -1704,6 +1721,7 @@ static void add_dynamic_file_list_entry(struct FileInfo **list,
   new_list_entry = &(*list)[*num_list_entries - 1];
 
   new_list_entry->token = getStringCopy(token);
+  new_list_entry->filename = NULL;
   new_list_entry->parameter = checked_calloc(parameter_array_size);
 
   read_token_parameters(extra_file_list, suffix_list, new_list_entry);
@@ -1711,7 +1729,8 @@ static void add_dynamic_file_list_entry(struct FileInfo **list,
 
 static void add_property_mapping(struct PropertyMapping **list,
                                 int *num_list_entries,
-                                int base_index, int ext1_index,int ext2_index,
+                                int base_index, int ext1_index,
+                                int ext2_index, int ext3_index,
                                 int artwork_index)
 {
   struct PropertyMapping *new_list_entry;
@@ -1724,6 +1743,7 @@ static void add_property_mapping(struct PropertyMapping **list,
   new_list_entry->base_index = base_index;
   new_list_entry->ext1_index = ext1_index;
   new_list_entry->ext2_index = ext2_index;
+  new_list_entry->ext3_index = ext3_index;
 
   new_list_entry->artwork_index = artwork_index;
 }
@@ -1735,17 +1755,19 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
   char **base_prefixes = artwork_info->base_prefixes;
   char **ext1_suffixes = artwork_info->ext1_suffixes;
   char **ext2_suffixes = artwork_info->ext2_suffixes;
+  char **ext3_suffixes = artwork_info->ext3_suffixes;
   int num_file_list_entries = artwork_info->num_file_list_entries;
   int num_suffix_list_entries = artwork_info->num_suffix_list_entries;
   int num_base_prefixes = artwork_info->num_base_prefixes;
   int num_ext1_suffixes = artwork_info->num_ext1_suffixes;
   int num_ext2_suffixes = artwork_info->num_ext2_suffixes;
+  int num_ext3_suffixes = artwork_info->num_ext3_suffixes;
   char *filename = getCustomArtworkConfigFilename(artwork_info->type);
   struct SetupFileList *setup_file_list;
   struct SetupFileList *extra_file_list = NULL;
   struct SetupFileList *list;
   char *known_token_value = KNOWN_TOKEN_VALUE;
-  int i, j, k;
+  int i, j, k, l;
 
 #if 0
   printf("GOT CUSTOM ARTWORK CONFIG FILE '%s'\n", filename);
@@ -1756,7 +1778,7 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
   {
     if (file_list[i].filename != NULL)
       free(file_list[i].filename);
-    file_list[i].filename = NULL;
+    file_list[i].filename = getStringCopy(file_list[i].default_filename);
 
     for (j=0; j<num_suffix_list_entries; j++)
       file_list[i].parameter[j] = file_list[i].default_parameter[j];
@@ -1848,7 +1870,7 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
     }
 
 #if 0
-    if (IS_PARENT_PROCESS(audio.mixer_pid))
+    if (IS_PARENT_PROCESS())
     {
       if (parameter_suffix_found)
        printf("---> skipping token '%s' (parameter token)\n", token);
@@ -1860,7 +1882,7 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
     if (parameter_suffix_found)
       continue;
 
-    /* ---------- step 1: search for matching base prefix ---------- */
+    /* ---------- step 0: search for matching base prefix ---------- */
 
     start_pos = 0;
     for (i=0; i<num_base_prefixes && !base_prefix_found; i++)
@@ -1868,14 +1890,25 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
       char *base_prefix = base_prefixes[i];
       int len_base_prefix = strlen(base_prefix);
       boolean ext1_suffix_found = FALSE;
+      boolean ext2_suffix_found = FALSE;
+      boolean ext3_suffix_found = FALSE;
+      boolean exact_match = FALSE;
+      int base_index = -1;
+      int ext1_index = -1;
+      int ext2_index = -1;
+      int ext3_index = -1;
 
       base_prefix_found = token_suffix_match(token, base_prefix, start_pos);
 
       if (!base_prefix_found)
        continue;
 
+      base_index = i;
+
       if (start_pos + len_base_prefix == len_token)    /* exact match */
       {
+       exact_match = TRUE;
+
        add_dynamic_file_list_entry(dynamic_file_list,
                                    num_dynamic_file_list_entries,
                                    extra_file_list,
@@ -1884,32 +1917,35 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
                                    token);
        add_property_mapping(property_mapping,
                             num_property_mapping_entries,
-                            i, -1, -1,
+                            base_index, -1, -1, -1,
                             current_summarized_file_list_entry);
        continue;
       }
 
 #if 0
-      if (IS_PARENT_PROCESS(audio.mixer_pid))
+      if (IS_PARENT_PROCESS())
        printf("---> examining token '%s': search 1st suffix ...\n", token);
 #endif
 
-      /* ---------- step 2: search for matching first suffix ---------- */
+      /* ---------- step 1: search for matching first suffix ---------- */
 
       start_pos += len_base_prefix;
       for (j=0; j<num_ext1_suffixes && !ext1_suffix_found; j++)
       {
        char *ext1_suffix = ext1_suffixes[j];
        int len_ext1_suffix = strlen(ext1_suffix);
-       boolean ext2_suffix_found = FALSE;
 
        ext1_suffix_found = token_suffix_match(token, ext1_suffix, start_pos);
 
        if (!ext1_suffix_found)
          continue;
 
+       ext1_index = j;
+
        if (start_pos + len_ext1_suffix == len_token)   /* exact match */
        {
+         exact_match = TRUE;
+
          add_dynamic_file_list_entry(dynamic_file_list,
                                      num_dynamic_file_list_entries,
                                      extra_file_list,
@@ -1918,43 +1954,93 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
                                      token);
          add_property_mapping(property_mapping,
                               num_property_mapping_entries,
-                              i, j, -1,
+                              base_index, ext1_index, -1, -1,
                               current_summarized_file_list_entry);
          continue;
        }
 
+       start_pos += len_ext1_suffix;
+      }
+
+      if (exact_match)
+       break;
+
 #if 0
-       if (IS_PARENT_PROCESS(audio.mixer_pid))
-         printf("---> examining token '%s': search 2nd suffix ...\n", token);
+      if (IS_PARENT_PROCESS())
+       printf("---> examining token '%s': search 2nd suffix ...\n", token);
 #endif
 
-       /* ---------- step 3: search for matching second suffix ---------- */
+      /* ---------- step 2: search for matching second suffix ---------- */
 
-       start_pos += len_ext1_suffix;
-       for (k=0; k<num_ext2_suffixes && !ext2_suffix_found; k++)
+      for (k=0; k<num_ext2_suffixes && !ext2_suffix_found; k++)
+      {
+       char *ext2_suffix = ext2_suffixes[k];
+       int len_ext2_suffix = strlen(ext2_suffix);
+
+       ext2_suffix_found = token_suffix_match(token, ext2_suffix,start_pos);
+
+       if (!ext2_suffix_found)
+         continue;
+
+       ext2_index = k;
+
+       if (start_pos + len_ext2_suffix == len_token)   /* exact match */
+       {
+         exact_match = TRUE;
+
+         add_dynamic_file_list_entry(dynamic_file_list,
+                                     num_dynamic_file_list_entries,
+                                     extra_file_list,
+                                     suffix_list,
+                                     num_suffix_list_entries,
+                                     token);
+         add_property_mapping(property_mapping,
+                              num_property_mapping_entries,
+                              base_index, ext1_index, ext2_index, -1,
+                              current_summarized_file_list_entry);
+         continue;
+       }
+
+       start_pos += len_ext2_suffix;
+      }
+
+      if (exact_match)
+       break;
+
+#if 0
+      if (IS_PARENT_PROCESS())
+       printf("---> examining token '%s': search 3rd suffix ...\n",token);
+#endif
+
+      /* ---------- step 3: search for matching third suffix ---------- */
+
+      for (l=0; l<num_ext3_suffixes && !ext3_suffix_found; l++)
+      {
+       char *ext3_suffix = ext3_suffixes[l];
+       int len_ext3_suffix = strlen(ext3_suffix);
+
+       ext3_suffix_found =token_suffix_match(token,ext3_suffix,start_pos);
+
+       if (!ext3_suffix_found)
+         continue;
+
+       ext3_index = l;
+
+       if (start_pos + len_ext3_suffix == len_token) /* exact match */
        {
-         char *ext2_suffix = ext2_suffixes[k];
-         int len_ext2_suffix = strlen(ext2_suffix);
-
-         ext2_suffix_found = token_suffix_match(token, ext2_suffix,start_pos);
-
-         if (!ext2_suffix_found)
-           continue;
-
-         if (start_pos + len_ext2_suffix == len_token) /* exact match */
-         {
-           add_dynamic_file_list_entry(dynamic_file_list,
-                                       num_dynamic_file_list_entries,
-                                       extra_file_list,
-                                       suffix_list,
-                                       num_suffix_list_entries,
-                                       token);
-           add_property_mapping(property_mapping,
-                                num_property_mapping_entries,
-                                i, j, k,
-                                current_summarized_file_list_entry);
-           continue;
-         }
+         exact_match = TRUE;
+
+         add_dynamic_file_list_entry(dynamic_file_list,
+                                     num_dynamic_file_list_entries,
+                                     extra_file_list,
+                                     suffix_list,
+                                     num_suffix_list_entries,
+                                     token);
+         add_property_mapping(property_mapping,
+                              num_property_mapping_entries,
+                              base_index, ext1_index, ext2_index, ext3_index,
+                              current_summarized_file_list_entry);
+         continue;
        }
       }
     }
@@ -1967,8 +2053,7 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
                     artwork_info->sizeof_artwork_list_entry);
   }
 
-  if (extra_file_list != NULL &&
-      options.verbose && IS_PARENT_PROCESS(audio.mixer_pid))
+  if (extra_file_list != NULL && options.verbose && IS_PARENT_PROCESS())
   {
     boolean dynamic_tokens_found = FALSE;
     boolean unknown_tokens_found = FALSE;
@@ -2187,14 +2272,17 @@ void ReloadCustomArtworkList(struct ArtworkListInfo *artwork_info)
 #if 0
   printf("DEBUG: reloading %d static artwork files ...\n",
         num_file_list_entries);
-  printf("DEBUG: reloading %d dynamic artwork files ...\n",
-        num_dynamic_file_list_entries);
 #endif
 
   for(i=0; i<num_file_list_entries; i++)
     LoadArtworkToList(artwork_info, &artwork_info->artwork_list[i],
                      file_list[i].filename, i);
 
+#if 0
+  printf("DEBUG: reloading %d dynamic artwork files ...\n",
+        num_dynamic_file_list_entries);
+#endif
+
   for(i=0; i<num_dynamic_file_list_entries; i++)
     LoadArtworkToList(artwork_info, &artwork_info->dynamic_artwork_list[i],
                      dynamic_file_list[i].filename, i);
@@ -2228,7 +2316,7 @@ void FreeCustomArtworkLists(struct ArtworkListInfo *artwork_info)
 
 #if 0
   printf("%s: FREEING ARTWORK ...\n",
-        IS_CHILD_PROCESS(audio.mixer_pid) ? "CHILD" : "PARENT");
+        IS_CHILD_PROCESS() ? "CHILD" : "PARENT");
 #endif
 
   FreeCustomArtworkList(artwork_info, &artwork_info->artwork_list,
@@ -2239,7 +2327,7 @@ void FreeCustomArtworkLists(struct ArtworkListInfo *artwork_info)
 
 #if 0
   printf("%s: FREEING ARTWORK -- DONE\n",
-        IS_CHILD_PROCESS(audio.mixer_pid) ? "CHILD" : "PARENT");
+        IS_CHILD_PROCESS() ? "CHILD" : "PARENT");
 #endif
 }
 
index ffb9925b47533b7106e55f672caae4b3c10c64ff..3f1d04e9eee0cd0593e1f54114e5e3af1f3c626a 100644 (file)
@@ -253,13 +253,15 @@ static boolean ForkAudioProcess(void)
     return FALSE;
   }
 
+  if (audio.mixer_pid == 0)            /* we are the child process */
+    audio.mixer_pid = getpid();
+
 #if 0
-  printf("PID: %d [%s]\n", getpid(),
-        (IS_CHILD_PROCESS(audio.mixer_pid) ? "child" : "parent"));
+  printf("PID: %d [%s]\n", getpid(),(IS_CHILD_PROCESS() ? "child" : "parent"));
   Delay(10000 * 0);
 #endif
 
-  if (IS_CHILD_PROCESS(audio.mixer_pid))
+  if (IS_CHILD_PROCESS())
     Mixer_Main();                      /* this function never returns */
   else
     close(audio.mixer_pipe[0]);                /* no reading from pipe needed */
@@ -290,7 +292,7 @@ void UnixCloseAudio(void)
   if (audio.device_fd)
     close(audio.device_fd);
 
-  if (IS_PARENT_PROCESS(audio.mixer_pid))
+  if (IS_PARENT_PROCESS())
     kill(audio.mixer_pid, SIGTERM);
 }
 
@@ -457,7 +459,7 @@ static void InitAudioDevice(struct AudioFormatInfo *afmt)
 
 static void SendSoundControlToMixerProcess(SoundControl *snd_ctrl)
 {
-  if (IS_CHILD_PROCESS(audio.mixer_pid))
+  if (IS_CHILD_PROCESS())
     return;
 
   if (write(audio.mixer_pipe[1], snd_ctrl, sizeof(SoundControl)) < 0)
@@ -470,7 +472,7 @@ static void SendSoundControlToMixerProcess(SoundControl *snd_ctrl)
 
 static void ReadSoundControlFromMainProcess(SoundControl *snd_ctrl)
 {
-  if (IS_PARENT_PROCESS(audio.mixer_pid))
+  if (IS_PARENT_PROCESS())
     return;
 
   if (read(audio.mixer_pipe[0], snd_ctrl, sizeof(SoundControl))
@@ -492,7 +494,7 @@ static void WriteReloadInfoToPipe(char *set_identifier, int type)
                                    setup.override_level_sounds :
                                    setup.override_level_music);
 
-  if (IS_CHILD_PROCESS(audio.mixer_pid))
+  if (IS_CHILD_PROCESS())
     return;
 
   if (leveldir_current == NULL)                /* should never happen */
@@ -1012,7 +1014,7 @@ static void HandleSoundRequest(SoundControl snd_ctrl)
   int i;
 
 #if defined(AUDIO_UNIX_NATIVE)
-  if (IS_PARENT_PROCESS(audio.mixer_pid))
+  if (IS_PARENT_PROCESS())
   {
     SendSoundControlToMixerProcess(&snd_ctrl);
     return;
@@ -1794,7 +1796,8 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries,
                   struct ConfigInfo *config_suffix_list,
                   char **base_prefixes,
                   char **ext1_suffixes,
-                  char **ext2_suffixes)
+                  char **ext2_suffixes,
+                  char **ext3_suffixes)
 {
   int i;
 
@@ -1831,9 +1834,14 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries,
   for (i=0; ext2_suffixes[i] != NULL; i++)
     sound_info->num_ext2_suffixes++;
 
+  sound_info->num_ext3_suffixes = 0;
+  for (i=0; ext3_suffixes[i] != NULL; i++)
+    sound_info->num_ext3_suffixes++;
+
   sound_info->base_prefixes = base_prefixes;
   sound_info->ext1_suffixes = ext1_suffixes;
   sound_info->ext2_suffixes = ext2_suffixes;
+  sound_info->ext3_suffixes = ext3_suffixes;
 
   sound_info->num_property_mapping_entries = 0;
 
index 81d938f1f5aded89584e214c80c6a3f33b9c2ca7..6bebb5dc936c32f6338d18b595b130dc5adc43b2 100644 (file)
@@ -148,7 +148,7 @@ struct FileInfo *getSoundListEntry(int);
 int getSoundListPropertyMappingSize();
 struct PropertyMapping *getSoundListPropertyMapping();
 void InitSoundList(struct ConfigInfo *, int, struct ConfigInfo *,
-                  char **, char **, char **);
+                  char **, char **, char **, char **);
 void InitReloadCustomSounds(char *);
 void InitReloadCustomMusic(char *);
 void FreeAllSounds(void);
index 7ec7d7df5aa37ac0f59ef2f7a2c6a63826716048..a075e6d1ceb3cd5a9979ba45266b904ec84f563a 100644 (file)
@@ -937,7 +937,7 @@ inline void OpenAudio(void)
   audio.sound_deactivated = FALSE;
 
   audio.mixer_pipe[0] = audio.mixer_pipe[1] = 0;
-  audio.mixer_pid = -1;
+  audio.mixer_pid = 0;
   audio.device_name = NULL;
   audio.device_fd = -1;
 
index 655d00b1d1e5946d9e9dab214e1c375a5a8be812..89945cb9b3d93ca9eb187951787c7ea900cd8cd7 100644 (file)
 #define VERSION_PATCH(x)       ((x) % 100)
 
 /* functions for parent/child process identification */
-#define IS_PARENT_PROCESS(pid) ((pid) > 0 || (pid) == -1)
-#define IS_CHILD_PROCESS(pid)  ((pid) == 0)
+#define IS_PARENT_PROCESS()    (audio.mixer_pid != getpid())
+#define IS_CHILD_PROCESS()     (audio.mixer_pid == getpid())
 
 
 /* type definitions */
@@ -521,6 +521,7 @@ struct PropertyMapping
   int base_index;
   int ext1_index;
   int ext2_index;
+  int ext3_index;
 
   int artwork_index;
 };
@@ -542,10 +543,12 @@ struct ArtworkListInfo
   int num_base_prefixes;
   int num_ext1_suffixes;
   int num_ext2_suffixes;
+  int num_ext3_suffixes;
 
   char **base_prefixes;                                /* base token prefixes array */
   char **ext1_suffixes;                                /* property suffixes array 1 */
   char **ext2_suffixes;                                /* property suffixes array 2 */
+  char **ext3_suffixes;                                /* property suffixes array 3 */
 
   int num_property_mapping_entries;
 
index f32e6f351ecf9897e5510d01c51e71c466c44253..a6a970f9a3c0093e3da7f963ada3a6b3f7dd0c24 100644 (file)
@@ -2798,7 +2798,7 @@ struct ElementActionInfo element_action_info[] =
   { ".active",         ACTION_ACTIVE,          TRUE    },
   { ".other",          ACTION_OTHER,           FALSE   },
 
-  { NULL,              0,                      0       },
+  { NULL,              0,                      0       }
 };
 
 struct ElementDirectionInfo element_direction_info[] =
@@ -2808,7 +2808,14 @@ struct ElementDirectionInfo element_direction_info[] =
   { ".up",             MV_BIT_UP                       },
   { ".down",           MV_BIT_DOWN                     },
 
-  { NULL,              0                               },
+  { NULL,              0                               }
+};
+
+struct SpecialSuffixInfo special_suffix_info[] =
+{
+  { ".EDITOR",         0,                              },
+
+  { NULL,              0,                              }
 };
 
 
index 040412fda890087f1c5db67e8331263e2632be04..31264e0345dbc73b994973a000ee2883729a853e 100644 (file)
 
 #define NUM_ACTIONS                            21
 
+/* values for special image configuration suffixes */
+#define GFX_SPECIAL_ARG_EDITOR                 0
+
+#define NUM_SPECIAL_GFX_ARGS                   1
+
 
 /* values for image configuration suffixes */
 #define GFX_ARG_XPOS                           0
@@ -1050,6 +1055,8 @@ struct ElementInfo
                                /* special graphics for left/right/up/down */
   int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS];
 
+  int editor_graphic;          /* graphic displayed in level editor */
+
   int sound[NUM_ACTIONS];      /* default sounds for several actions */
 };
 
@@ -1088,6 +1095,12 @@ struct ElementDirectionInfo
   int value;
 };
 
+struct SpecialSuffixInfo
+{
+  char *suffix;
+  int value;
+};
+
 
 #if 0
 extern GC                      tile_clip_gc;
@@ -1164,6 +1177,7 @@ extern struct GlobalInfo  global;
 extern struct ElementInfo      element_info[];
 extern struct ElementActionInfo        element_action_info[];
 extern struct ElementDirectionInfo element_direction_info[];
+extern struct SpecialSuffixInfo special_suffix_info[];
 extern struct GraphicInfo      *graphic_info;
 extern struct SoundInfo               *sound_info;
 extern struct ConfigInfo       image_config[], sound_config[];
index 1036ff89ca54b7f828afb4021e4bfbd5c25bbb33..5722e2528137a59a47f4b0bca72baf29a2795879 100644 (file)
@@ -1465,7 +1465,7 @@ void DrawMiniElement(int x, int y, int element)
 {
   int graphic;
 
-  graphic = el2img(element);
+  graphic = el2edimg(element);
   DrawMiniGraphic(x, y, graphic);
 }
 
@@ -2450,3 +2450,8 @@ int el2img(int element)
 {
   return element_info[element].graphic[ACTION_DEFAULT];
 }
+
+int el2edimg(int element)
+{
+  return element_info[element].editor_graphic;
+}
index 638d58e911efcdbe7eee1dac7744501cf2bfd491..a7415f02141462b372b8e18e4fbde3010e41c16e 100644 (file)
@@ -137,5 +137,6 @@ int el_act_dir2img(int, int, int);
 int el_act2img(int, int);
 int el_dir2img(int, int);
 int el2img(int);
+int el2edimg(int);
 
 #endif /* TOOLS_H */