rnd-20030210-2-src
authorHolger Schemel <info@artsoft.org>
Mon, 10 Feb 2003 03:47:14 +0000 (04:47 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:40:21 +0000 (10:40 +0200)
src/conftime.h
src/game.c
src/init.c
src/libgame/sound.c
src/libgame/system.h
src/main.c

index 9c30de7e9448c0b8eff9fb8e581662af9abc63c9..417cfb6bba9be844a51d2a4fcb849a35f443ff52 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-02-10 02:41]"
+#define COMPILE_DATE_STRING "[2003-02-10 04:43]"
index 5f3f9689f3cdbd505d7c56a5e3533afdb358337e..f86dffae3620dba97bb42b44651eb822562bb30c 100644 (file)
@@ -2327,6 +2327,13 @@ void Impact(int x, int y)
     return;
   }
 
+#if 0
+  printf("::: -> %d,%d [%d]\n", element, ACTION_IMPACT,
+        element_info[element].sound[ACTION_IMPACT]);
+
+  PlaySound(177);
+#endif
+
   /* play sound of object that hits the ground */
   if (lastline || object_hit)
     PlaySoundLevelElementAction(x, y, element, ACTION_IMPACT);
index 3d3a02cc286c95d245c24b7217de926c1c46fdd4..cf6987dbb83eda0ce3bbdd4325ac0b8818cd13b7 100644 (file)
@@ -189,7 +189,7 @@ static void InitArtworkConfig()
     special_suffix[i] = special_suffix_info[i].suffix;
 
   InitImageList(image_config, NUM_IMAGE_FILES, image_config_suffix,
-               element_prefix, action_suffix,direction_suffix, special_suffix,
+               element_prefix, action_suffix, direction_suffix,special_suffix,
                ignore_image_tokens);
   InitSoundList(sound_config, NUM_SOUND_FILES, sound_config_suffix,
                sound_class_prefix, action_suffix, dummy, dummy, dummy);
@@ -861,11 +861,6 @@ void InitElementSpecialGraphicInfo()
   }
 }
 
-static void InitElementSoundInfo()
-{
-  /* !!! soon to come !!! */
-}
-
 static void set_graphic_parameters(int graphic, char **parameter_raw)
 {
   Bitmap *src_bitmap = getBitmapFromImageID(graphic);
@@ -1123,6 +1118,11 @@ static void InitGraphicInfo()
   clipmasks_initialized = TRUE;
 }
 
+static void InitElementSoundInfo()
+{
+  /* !!! soon to come !!! */
+}
+
 static void set_sound_parameters(int sound, char **parameter_raw)
 {
   int parameter[NUM_SND_ARGS];
@@ -1140,6 +1140,8 @@ static void set_sound_parameters(int sound, char **parameter_raw)
 
 static void InitSoundInfo()
 {
+  struct PropertyMapping *property_mapping = getSoundListPropertyMapping();
+  int num_property_mappings = getSoundListPropertyMappingSize();
   int *sound_effect_properties;
   int num_sounds = getSoundListSize();
   int i, j;
@@ -1205,6 +1207,37 @@ static void InitSoundInfo()
 
   free(sound_effect_properties);
 
+  /* initialize element/sound mapping from dynamic configuration */
+  for (i=0; i < num_property_mappings; i++)
+  {
+    int element   = property_mapping[i].base_index;
+    int action    = property_mapping[i].ext1_index;
+    int sound     = property_mapping[i].artwork_index;
+
+    if (action < 0)
+      action = ACTION_DEFAULT;
+
+    element_info[element].sound[action] = sound;
+  }
+
+#if 0
+  /* TEST ONLY */
+  {
+    int element = EL_CUSTOM_11;
+    int j = 0;
+
+    while (element_action_info[j].suffix)
+    {
+      printf("element %d, sound action '%s'  == %d\n",
+            element, element_action_info[j].suffix,
+            element_info[element].sound[j]);
+      j++;
+    }
+  }
+
+  PlaySoundLevelElementAction(0,0, EL_CUSTOM_11, ACTION_PUSHING);
+#endif
+
 #if 0
   /* TEST ONLY */
   {
@@ -1217,7 +1250,7 @@ static void InitSoundInfo()
       if (element_action_info[j].value == sound_action)
        printf("element %d, sound action '%s'  == %d\n",
               element, element_action_info[j].suffix,
-              element_info_[element].sound[sound_action]);
+              element_info[element].sound[sound_action]);
       j++;
     }
   }
index 1c0da669591633f3e2674158fd121d6be721bc2a..d5bd45b4d6034cda46c09d7bfd749402df5a0a18 100644 (file)
@@ -149,9 +149,14 @@ struct SoundControl
 typedef struct SoundControl SoundControl;
 
 static struct ArtworkListInfo *sound_info = NULL;
+#if 0
 static SoundInfo **Sound = NULL;
+#endif
 static MusicInfo **Music = NULL;
-static int num_sounds = 0, num_music = 0;
+#if 0
+static int num_sounds = 0;
+#endif
+static int num_music = 0;
 static int stereo_volume[SOUND_MAX_LEFT2RIGHT + 1];
 
 
@@ -175,6 +180,8 @@ static void ReloadCustomSounds();
 static void ReloadCustomMusic();
 static void FreeSound(void *);
 
+static SoundInfo *getSoundInfoEntryFromSoundID(int);
+
 
 /* ------------------------------------------------------------------------- */
 /* functions for native (non-SDL) Unix audio/mixer support                   */
@@ -816,6 +823,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl)
 {
   SoundInfo *snd_info;
   int i, k;
+  int num_sounds = getSoundListSize();
 
 #if 0
   printf("NEW SOUND %d ARRIVED [%d] [%d ACTIVE CHANNELS]\n",
@@ -832,7 +840,13 @@ static void Mixer_InsertSound(SoundControl snd_ctrl)
   else if (snd_ctrl.nr >= num_sounds)
     return;
 
+#if 0
   snd_info = (IS_MUSIC(snd_ctrl) ? Music[snd_ctrl.nr] : Sound[snd_ctrl.nr]);
+#else
+  snd_info = (IS_MUSIC(snd_ctrl) ? Music[snd_ctrl.nr] :
+             getSoundInfoEntryFromSoundID(snd_ctrl.nr));
+#endif
+
   if (snd_info == NULL)
     return;
 
@@ -1782,6 +1796,17 @@ struct FileInfo *getSoundListEntry(int pos)
          &sound_info->dynamic_file_list[list_pos]);
 }
 
+static SoundInfo *getSoundInfoEntryFromSoundID(int pos)
+{
+  int num_list_entries = sound_info->num_file_list_entries;
+  int list_pos = (pos < num_list_entries ? pos : pos - num_list_entries);
+  SoundInfo **snd_info =
+    (SoundInfo **)(pos < num_list_entries ? sound_info->artwork_list :
+                  sound_info->dynamic_artwork_list);
+
+  return snd_info[list_pos];
+}
+
 int getSoundListPropertyMappingSize()
 {
   return sound_info->num_property_mapping_entries;
@@ -1866,8 +1891,10 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries,
   sound_info->load_artwork = Load_WAV;
   sound_info->free_artwork = FreeSound;
 
+#if 0
   num_sounds = sound_info->num_file_list_entries;
   Sound = (SoundInfo **)sound_info->artwork_list;
+#endif
 }
 
 static MusicInfo *Load_MOD(char *filename)
@@ -2080,6 +2107,10 @@ static void ReloadCustomSounds()
 
   LoadArtworkConfig(sound_info);
   ReloadCustomArtworkList(sound_info);
+
+#if 0
+  num_sounds = getSoundListSize();
+#endif
 }
 
 static void ReloadCustomMusic()
index 03250949d9584fab32f7f372ee86412c0e1d6369..511355d31e0ce28a64ce8d9f98393065978d5b12 100644 (file)
 #define VERSION_PATCH(x)       ((x) % 100)
 
 /* functions for parent/child process identification */
+#if defined(PLATFORM_UNIX)
 #define IS_PARENT_PROCESS()    (audio.mixer_pid != getpid())
 #define IS_CHILD_PROCESS()     (audio.mixer_pid == getpid())
-
+#else
+#define IS_PARENT_PROCESS()    TRUE
+#define IS_CHILD_PROCESS()     FALSE
+#endif
 
 /* type definitions */
 typedef int (*EventFilter)(const Event *);
index f6f909b2aec6c3bb886edaa4f0ec4d0081c225bb..743360fd45aa94b36ddaab1a3c4eeed4767a9143 100644 (file)
@@ -1897,642 +1897,642 @@ struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1] =
   },
   {
     "custom_1",
-    "custom",
+    "custom_1",
     "custom element 1"
   },
   {
     "custom_2",
-    "custom",
+    "custom_2",
     "custom element 2"
   },
   {
     "custom_3",
-    "custom",
+    "custom_3",
     "custom element 3"
   },
   {
     "custom_4",
-    "custom",
+    "custom_4",
     "custom element 4"
   },
   {
     "custom_5",
-    "custom",
+    "custom_5",
     "custom element 5"
   },
   {
     "custom_6",
-    "custom",
+    "custom_6",
     "custom element 6"
   },
   {
     "custom_7",
-    "custom",
+    "custom_7",
     "custom element 7"
   },
   {
     "custom_8",
-    "custom",
+    "custom_8",
     "custom element 8"
   },
   {
     "custom_9",
-    "custom",
+    "custom_9",
     "custom element 9"
   },
   {
     "custom_10",
-    "custom",
+    "custom_10",
     "custom element 10"
   },
   {
     "custom_11",
-    "custom",
+    "custom_11",
     "custom element 11"
   },
   {
     "custom_12",
-    "custom",
+    "custom_12",
     "custom element 12"
   },
   {
     "custom_13",
-    "custom",
+    "custom_13",
     "custom element 13"
   },
   {
     "custom_14",
-    "custom",
+    "custom_14",
     "custom element 14"
   },
   {
     "custom_15",
-    "custom",
+    "custom_15",
     "custom element 15"
   },
   {
     "custom_16",
-    "custom",
+    "custom_16",
     "custom element 16"
   },
   {
     "custom_17",
-    "custom",
+    "custom_17",
     "custom element 17"
   },
   {
     "custom_18",
-    "custom",
+    "custom_18",
     "custom element 18"
   },
   {
     "custom_19",
-    "custom",
+    "custom_19",
     "custom element 19"
   },
   {
     "custom_20",
-    "custom",
+    "custom_20",
     "custom element 20"
   },
   {
     "custom_21",
-    "custom",
+    "custom_21",
     "custom element 21"
   },
   {
     "custom_22",
-    "custom",
+    "custom_22",
     "custom element 22"
   },
   {
     "custom_23",
-    "custom",
+    "custom_23",
     "custom element 23"
   },
   {
     "custom_24",
-    "custom",
+    "custom_24",
     "custom element 24"
   },
   {
     "custom_25",
-    "custom",
+    "custom_25",
     "custom element 25"
   },
   {
     "custom_26",
-    "custom",
+    "custom_26",
     "custom element 26"
   },
   {
     "custom_27",
-    "custom",
+    "custom_27",
     "custom element 27"
   },
   {
     "custom_28",
-    "custom",
+    "custom_28",
     "custom element 28"
   },
   {
     "custom_29",
-    "custom",
+    "custom_29",
     "custom element 29"
   },
   {
     "custom_30",
-    "custom",
+    "custom_30",
     "custom element 30"
   },
   {
     "custom_31",
-    "custom",
+    "custom_31",
     "custom element 31"
   },
   {
     "custom_32",
-    "custom",
+    "custom_32",
     "custom element 32"
   },
   {
     "custom_33",
-    "custom",
+    "custom_33",
     "custom element 33"
   },
   {
     "custom_34",
-    "custom",
+    "custom_34",
     "custom element 34"
   },
   {
     "custom_35",
-    "custom",
+    "custom_35",
     "custom element 35"
   },
   {
     "custom_36",
-    "custom",
+    "custom_36",
     "custom element 36"
   },
   {
     "custom_37",
-    "custom",
+    "custom_37",
     "custom element 37"
   },
   {
     "custom_38",
-    "custom",
+    "custom_38",
     "custom element 38"
   },
   {
     "custom_39",
-    "custom",
+    "custom_39",
     "custom element 39"
   },
   {
     "custom_40",
-    "custom",
+    "custom_40",
     "custom element 40"
   },
   {
     "custom_41",
-    "custom",
+    "custom_41",
     "custom element 41"
   },
   {
     "custom_42",
-    "custom",
+    "custom_42",
     "custom element 42"
   },
   {
     "custom_43",
-    "custom",
+    "custom_43",
     "custom element 43"
   },
   {
     "custom_44",
-    "custom",
+    "custom_44",
     "custom element 44"
   },
   {
     "custom_45",
-    "custom",
+    "custom_45",
     "custom element 45"
   },
   {
     "custom_46",
-    "custom",
+    "custom_46",
     "custom element 46"
   },
   {
     "custom_47",
-    "custom",
+    "custom_47",
     "custom element 47"
   },
   {
     "custom_48",
-    "custom",
+    "custom_48",
     "custom element 48"
   },
   {
     "custom_49",
-    "custom",
+    "custom_49",
     "custom element 49"
   },
   {
     "custom_50",
-    "custom",
+    "custom_50",
     "custom element 50"
   },
   {
     "custom_51",
-    "custom",
+    "custom_51",
     "custom element 51"
   },
   {
     "custom_52",
-    "custom",
+    "custom_52",
     "custom element 52"
   },
   {
     "custom_53",
-    "custom",
+    "custom_53",
     "custom element 53"
   },
   {
     "custom_54",
-    "custom",
+    "custom_54",
     "custom element 54"
   },
   {
     "custom_55",
-    "custom",
+    "custom_55",
     "custom element 55"
   },
   {
     "custom_56",
-    "custom",
+    "custom_56",
     "custom element 56"
   },
   {
     "custom_57",
-    "custom",
+    "custom_57",
     "custom element 57"
   },
   {
     "custom_58",
-    "custom",
+    "custom_58",
     "custom element 58"
   },
   {
     "custom_59",
-    "custom",
+    "custom_59",
     "custom element 59"
   },
   {
     "custom_60",
-    "custom",
+    "custom_60",
     "custom element 60"
   },
   {
     "custom_61",
-    "custom",
+    "custom_61",
     "custom element 61"
   },
   {
     "custom_62",
-    "custom",
+    "custom_62",
     "custom element 62"
   },
   {
     "custom_63",
-    "custom",
+    "custom_63",
     "custom element 63"
   },
   {
     "custom_64",
-    "custom",
+    "custom_64",
     "custom element 64"
   },
   {
     "custom_65",
-    "custom",
+    "custom_65",
     "custom element 65"
   },
   {
     "custom_66",
-    "custom",
+    "custom_66",
     "custom element 66"
   },
   {
     "custom_67",
-    "custom",
+    "custom_67",
     "custom element 67"
   },
   {
     "custom_68",
-    "custom",
+    "custom_68",
     "custom element 68"
   },
   {
     "custom_69",
-    "custom",
+    "custom_69",
     "custom element 69"
   },
   {
     "custom_70",
-    "custom",
+    "custom_70",
     "custom element 70"
   },
   {
     "custom_71",
-    "custom",
+    "custom_71",
     "custom element 71"
   },
   {
     "custom_72",
-    "custom",
+    "custom_72",
     "custom element 72"
   },
   {
     "custom_73",
-    "custom",
+    "custom_73",
     "custom element 73"
   },
   {
     "custom_74",
-    "custom",
+    "custom_74",
     "custom element 74"
   },
   {
     "custom_75",
-    "custom",
+    "custom_75",
     "custom element 75"
   },
   {
     "custom_76",
-    "custom",
+    "custom_76",
     "custom element 76"
   },
   {
     "custom_77",
-    "custom",
+    "custom_77",
     "custom element 77"
   },
   {
     "custom_78",
-    "custom",
+    "custom_78",
     "custom element 78"
   },
   {
     "custom_79",
-    "custom",
+    "custom_79",
     "custom element 79"
   },
   {
     "custom_80",
-    "custom",
+    "custom_80",
     "custom element 80"
   },
   {
     "custom_81",
-    "custom",
+    "custom_81",
     "custom element 81"
   },
   {
     "custom_82",
-    "custom",
+    "custom_82",
     "custom element 82"
   },
   {
     "custom_83",
-    "custom",
+    "custom_83",
     "custom element 83"
   },
   {
     "custom_84",
-    "custom",
+    "custom_84",
     "custom element 84"
   },
   {
     "custom_85",
-    "custom",
+    "custom_85",
     "custom element 85"
   },
   {
     "custom_86",
-    "custom",
+    "custom_86",
     "custom element 86"
   },
   {
     "custom_87",
-    "custom",
+    "custom_87",
     "custom element 87"
   },
   {
     "custom_88",
-    "custom",
+    "custom_88",
     "custom element 88"
   },
   {
     "custom_89",
-    "custom",
+    "custom_89",
     "custom element 89"
   },
   {
     "custom_90",
-    "custom",
+    "custom_90",
     "custom element 90"
   },
   {
     "custom_91",
-    "custom",
+    "custom_91",
     "custom element 91"
   },
   {
     "custom_92",
-    "custom",
+    "custom_92",
     "custom element 92"
   },
   {
     "custom_93",
-    "custom",
+    "custom_93",
     "custom element 93"
   },
   {
     "custom_94",
-    "custom",
+    "custom_94",
     "custom element 94"
   },
   {
     "custom_95",
-    "custom",
+    "custom_95",
     "custom element 95"
   },
   {
     "custom_96",
-    "custom",
+    "custom_96",
     "custom element 96"
   },
   {
     "custom_97",
-    "custom",
+    "custom_97",
     "custom element 97"
   },
   {
     "custom_98",
-    "custom",
+    "custom_98",
     "custom element 98"
   },
   {
     "custom_99",
-    "custom",
+    "custom_99",
     "custom element 99"
   },
   {
     "custom_100",
-    "custom",
+    "custom_100",
     "custom element 100"
   },
   {
     "custom_101",
-    "custom",
+    "custom_101",
     "custom element 101"
   },
   {
     "custom_102",
-    "custom",
+    "custom_102",
     "custom element 102"
   },
   {
     "custom_103",
-    "custom",
+    "custom_103",
     "custom element 103"
   },
   {
     "custom_104",
-    "custom",
+    "custom_104",
     "custom element 104"
   },
   {
     "custom_105",
-    "custom",
+    "custom_105",
     "custom element 105"
   },
   {
     "custom_106",
-    "custom",
+    "custom_106",
     "custom element 106"
   },
   {
     "custom_107",
-    "custom",
+    "custom_107",
     "custom element 107"
   },
   {
     "custom_108",
-    "custom",
+    "custom_108",
     "custom element 108"
   },
   {
     "custom_109",
-    "custom",
+    "custom_109",
     "custom element 109"
   },
   {
     "custom_110",
-    "custom",
+    "custom_110",
     "custom element 110"
   },
   {
     "custom_111",
-    "custom",
+    "custom_111",
     "custom element 111"
   },
   {
     "custom_112",
-    "custom",
+    "custom_112",
     "custom element 112"
   },
   {
     "custom_113",
-    "custom",
+    "custom_113",
     "custom element 113"
   },
   {
     "custom_114",
-    "custom",
+    "custom_114",
     "custom element 114"
   },
   {
     "custom_115",
-    "custom",
+    "custom_115",
     "custom element 115"
   },
   {
     "custom_116",
-    "custom",
+    "custom_116",
     "custom element 116"
   },
   {
     "custom_117",
-    "custom",
+    "custom_117",
     "custom element 117"
   },
   {
     "custom_118",
-    "custom",
+    "custom_118",
     "custom element 118"
   },
   {
     "custom_119",
-    "custom",
+    "custom_119",
     "custom element 119"
   },
   {
     "custom_120",
-    "custom",
+    "custom_120",
     "custom element 120"
   },
   {
     "custom_121",
-    "custom",
+    "custom_121",
     "custom element 121"
   },
   {
     "custom_122",
-    "custom",
+    "custom_122",
     "custom element 122"
   },
   {
     "custom_123",
-    "custom",
+    "custom_123",
     "custom element 123"
   },
   {
     "custom_124",
-    "custom",
+    "custom_124",
     "custom element 124"
   },
   {
     "custom_125",
-    "custom",
+    "custom_125",
     "custom element 125"
   },
   {
     "custom_126",
-    "custom",
+    "custom_126",
     "custom element 126"
   },
   {
     "custom_127",
-    "custom",
+    "custom_127",
     "custom element 127"
   },
   {
     "custom_128",
-    "custom",
+    "custom_128",
     "custom element 128"
   },