+void InitGameEngine()
+{
+ static int sound_effect_properties[NUM_SOUND_EFFECTS];
+ int i, j;
+
+#if 0
+ debug_print_timestamp(0, NULL);
+#endif
+
+ for (i=0; i<NUM_SND_ACTIONS; i++)
+ for (j=0; j<NUM_LEVEL_ELEMENTS; j++)
+ element_action_sound[j][i] = -1;
+
+ for (i=0; i<NUM_SOUND_EFFECTS; i++)
+ {
+ int len_effect_text = strlen(sound_effects[i].text);
+
+ sound_effect_properties[i] = SND_ACTION_UNKNOWN;
+ is_loop_sound[i] = FALSE;
+
+ /* determine all loop sounds and identify certain sound classes */
+
+ j = 0;
+ while (sound_action_properties[j].text)
+ {
+ int len_action_text = strlen(sound_action_properties[j].text);
+
+ if (len_action_text < len_effect_text &&
+ strcmp(&sound_effects[i].text[len_effect_text - len_action_text],
+ sound_action_properties[j].text) == 0)
+ {
+ sound_effect_properties[i] = sound_action_properties[j].value;
+
+ if (sound_action_properties[j].is_loop)
+ is_loop_sound[i] = TRUE;
+ }
+
+ j++;
+ }
+
+ /* associate elements and some selected sound actions */
+
+ for (j=0; j<NUM_LEVEL_ELEMENTS; j++)
+ {
+ if (element_info[j].sound_class_name)
+ {
+ int len_class_text = strlen(element_info[j].sound_class_name);
+
+ if (len_class_text < len_effect_text &&
+ strncmp(sound_effects[i].text,
+ element_info[j].sound_class_name, len_class_text) == 0)
+ {
+ int sound_action_value = sound_effect_properties[i];
+
+ element_action_sound[j][sound_action_value] = i;
+ }
+ }
+ }
+ }
+
+#if 0
+ debug_print_timestamp(0, "InitGameEngine");
+#endif
+
+#if 0
+ /* TEST ONLY */
+ {
+ int element = EL_ROBOT;
+ int sound_action = SND_ACTION_COLLECTING;
+ int j = 0;
+
+ while (sound_action_properties[j].text)
+ {
+ if (sound_action_properties[j].value == sound_action)
+ printf("element %d, sound action '%s' == %d\n",
+ element, sound_action_properties[j].text,
+ element_action_sound[element][sound_action]);
+ j++;
+ }
+ }
+#endif
+}
+