+
+void PlayMenuSound()
+{
+ int sound = menu.sound[game_status];
+
+ if (sound == SND_UNDEFINED)
+ return;
+
+ if ((!setup.sound_simple && !IS_LOOP_SOUND(sound)) ||
+ (!setup.sound_loops && IS_LOOP_SOUND(sound)))
+ return;
+
+ if (IS_LOOP_SOUND(sound))
+ PlaySoundLoop(sound);
+ else
+ PlaySound(sound);
+}
+
+void PlayMenuSoundStereo(int sound, int stereo_position)
+{
+ if (sound == SND_UNDEFINED)
+ return;
+
+ if ((!setup.sound_simple && !IS_LOOP_SOUND(sound)) ||
+ (!setup.sound_loops && IS_LOOP_SOUND(sound)))
+ return;
+
+ if (IS_LOOP_SOUND(sound))
+ PlaySoundExt(sound, SOUND_MAX_VOLUME, stereo_position, SND_CTRL_PLAY_LOOP);
+ else
+ PlaySoundStereo(sound, stereo_position);
+}
+
+void PlayMenuSoundIfLoop()
+{
+ int sound = menu.sound[game_status];
+
+ if (sound == SND_UNDEFINED)
+ return;
+
+ if ((!setup.sound_simple && !IS_LOOP_SOUND(sound)) ||
+ (!setup.sound_loops && IS_LOOP_SOUND(sound)))
+ return;
+
+ if (IS_LOOP_SOUND(sound))
+ PlaySoundLoop(sound);
+}
+
+void PlayMenuMusic()
+{
+ int music = menu.music[game_status];
+
+ if (music == MUS_UNDEFINED)
+ return;
+
+ if (!setup.sound_music)
+ return;
+
+ PlayMusic(music);
+}
+
+void PlaySoundActivating()
+{
+#if 0
+ PlaySound(SND_MENU_ITEM_ACTIVATING);
+#endif
+}
+
+void PlaySoundSelecting()
+{
+#if 0
+ PlaySound(SND_MENU_ITEM_SELECTING);
+#endif
+}
+
+void ToggleFullscreenIfNeeded()
+{
+ boolean change_fullscreen = (setup.fullscreen !=
+ video.fullscreen_enabled);
+ boolean change_fullscreen_mode = (video.fullscreen_enabled &&
+ !strEqual(setup.fullscreen_mode,
+ video.fullscreen_mode_current));
+
+ if (!video.fullscreen_available)
+ return;
+
+#if 1
+ if (change_fullscreen || change_fullscreen_mode)
+#else
+ if (setup.fullscreen != video.fullscreen_enabled ||
+ setup.fullscreen_mode != video.fullscreen_mode_current)
+#endif
+ {
+ Bitmap *tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
+
+ /* save backbuffer content which gets lost when toggling fullscreen mode */
+ BlitBitmap(backbuffer, tmp_backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+
+#if 1
+ if (change_fullscreen_mode)
+#else
+ if (setup.fullscreen && video.fullscreen_enabled)
+#endif
+ {
+ /* keep fullscreen, but change fullscreen mode (screen resolution) */
+#if 1
+ /* (this is now set in sdl.c) */
+#else
+ video.fullscreen_mode_current = setup.fullscreen_mode;
+#endif
+ video.fullscreen_enabled = FALSE; /* force new fullscreen mode */
+ }
+
+ /* toggle fullscreen */
+ ChangeVideoModeIfNeeded(setup.fullscreen);
+
+ setup.fullscreen = video.fullscreen_enabled;
+
+ /* restore backbuffer content from temporary backbuffer backup bitmap */
+ BlitBitmap(tmp_backbuffer, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+
+ FreeBitmap(tmp_backbuffer);
+
+#if 1
+ /* update visible window/screen */
+ BlitBitmap(backbuffer, window, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+#else
+ redraw_mask = REDRAW_ALL;
+#endif
+ }
+}