+static void PlayGlobalAnimMusic(struct GlobalAnimPartControlInfo *part)
+{
+ int music = part->music;
+
+ if (music == MUS_UNDEFINED)
+ return;
+
+ if (!setup.sound_music)
+ return;
+
+ PlayMusic(music);
+
+#if 0
+ printf("::: PLAY MUSIC %d.%d.%d: %d\n",
+ part->anim_nr, part->nr, part->mode_nr, music);
+#endif
+}
+
+static void StopGlobalAnimMusic(struct GlobalAnimPartControlInfo *part)
+{
+ int music = part->music;
+
+ if (music == MUS_UNDEFINED)
+ return;
+
+ StopMusic();
+
+#if 0
+ printf("::: STOP MUSIC %d.%d.%d: %d\n",
+ part->anim_nr, part->nr, part->mode_nr, music);
+#endif
+}
+
+static void PlayGlobalAnimSoundAndMusic(struct GlobalAnimPartControlInfo *part)
+{
+ // when drawing animations to fading buffer, do not play sounds or music
+ if (drawing_to_fading_buffer)
+ return;
+
+ PlayGlobalAnimSound(part);
+ PlayGlobalAnimMusic(part);
+}
+
+static void StopGlobalAnimSoundAndMusic(struct GlobalAnimPartControlInfo *part)
+{
+ StopGlobalAnimSound(part);
+ StopGlobalAnimMusic(part);
+}
+
+static boolean isClickablePart(struct GlobalAnimPartControlInfo *part)
+{
+ struct GraphicInfo *c = &part->control_info;
+
+ return (c->init_event & ANIM_EVENT_CLICK ||
+ c->anim_event & ANIM_EVENT_CLICK);
+}
+
+static boolean isClickedPart(struct GlobalAnimPartControlInfo *part,
+ int mx, int my, boolean clicked)
+{
+ struct GraphicInfo *g = &part->graphic_info;
+ int part_x = part->viewport_x + part->x;
+ int part_y = part->viewport_y + part->y;
+ int part_width = g->width;
+ int part_height = g->height;
+
+ // check if mouse click was detected at all
+ if (!clicked)
+ return FALSE;
+
+ // check if mouse click is inside the animation part's viewport
+ if (mx < part->viewport_x ||
+ mx >= part->viewport_x + part->viewport_width ||
+ my < part->viewport_y ||
+ my >= part->viewport_y + part->viewport_height)
+ return FALSE;
+
+ // check if mouse click is inside the animation part's graphic
+ if (mx < part_x ||
+ mx >= part_x + part_width ||
+ my < part_y ||
+ my >= part_y + part_height)
+ return FALSE;
+
+ return TRUE;
+}
+