rnd-20060430-4-src
authorHolger Schemel <info@artsoft.org>
Sun, 30 Apr 2006 15:50:59 +0000 (17:50 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:51:40 +0000 (10:51 +0200)
src/conf_g2m.c
src/conf_g2s.c
src/conf_mus.c
src/conf_mus.h
src/conf_snd.c
src/conf_snd.h
src/conftime.h
src/events.c
src/screens.c
src/tools.c
src/tools.h

index 1c1864598a2c266b2c6b647581083302c7b4840e..1ad1b39ef8f5289265f122bdf4555781f23ffd65 100644 (file)
@@ -30,6 +30,10 @@ gamemode_to_music[] =
     -1,
     MUS_BACKGROUND
   },
+  {
+    GFX_SPECIAL_ARG_TITLE,
+    MUS_BACKGROUND_TITLE
+  },
   {
     GFX_SPECIAL_ARG_MAIN,
     MUS_BACKGROUND_MAIN
index 7ebfff0c72abc30351be4c1389f42bfc41e32881..703f1453dbb59ccfcf1c5d18a89963568b2b37b2 100644 (file)
@@ -26,6 +26,10 @@ static struct
 }
 gamemode_to_sound[] =
 {
+  {
+    GFX_SPECIAL_ARG_TITLE,
+    SND_BACKGROUND_TITLE
+  },
   {
     GFX_SPECIAL_ARG_MAIN,
     SND_BACKGROUND_MAIN
index 27ec9056f35678f6d3ebe16f29914b254e1ac3ae..bb5f5e79d7e75efc52710aa2a6b9d3d0246824e2 100644 (file)
@@ -29,6 +29,7 @@ struct ConfigTypeInfo music_config_suffix[] =
 struct ConfigInfo music_config[] =
 {
   { "background",                      UNDEFINED_FILENAME              },
+  { "background.TITLE",                        UNDEFINED_FILENAME              },
   { "background.MAIN",                 UNDEFINED_FILENAME              },
   { "background.LEVELS",               UNDEFINED_FILENAME              },
   { "background.SCORES",               UNDEFINED_FILENAME              },
index e6ba90e908cc49d94e218817823a7906475a7d96..a8d757b82a60a561c45d9969bf6f421248cabf32 100644 (file)
 /* values for music configuration */
 
 #define MUS_BACKGROUND                                 0
-#define MUS_BACKGROUND_MAIN                            1
-#define MUS_BACKGROUND_LEVELS                          2
-#define MUS_BACKGROUND_SCORES                          3
-#define MUS_BACKGROUND_EDITOR                          4
-#define MUS_BACKGROUND_INFO                            5
-#define MUS_BACKGROUND_SETUP                           6
+#define MUS_BACKGROUND_TITLE                           1
+#define MUS_BACKGROUND_MAIN                            2
+#define MUS_BACKGROUND_LEVELS                          3
+#define MUS_BACKGROUND_SCORES                          4
+#define MUS_BACKGROUND_EDITOR                          5
+#define MUS_BACKGROUND_INFO                            6
+#define MUS_BACKGROUND_SETUP                           7
 
-#define NUM_MUSIC_FILES                                        7
+#define NUM_MUSIC_FILES                                        8
 
 #endif /* CONF_MUS_H */
index 8cdd4d7b1f0f3740328b663fafdfa0f2aa302cdc..c15e0dec81385f29360c24201a7755b51bb1bc4c 100644 (file)
@@ -240,6 +240,7 @@ struct ConfigInfo sound_config[] =
   { "door.opening",                    "oeffnen.wav"                   },
   { "door.closing",                    "oeffnen.wav"                   },
 
+  { "background.TITLE",                        UNDEFINED_FILENAME              },
   { "background.MAIN",                 UNDEFINED_FILENAME              },
   { "background.LEVELS",               UNDEFINED_FILENAME              },
   { "background.SCORES",               "halloffame.wav"                },
index 91bb12919c557716bfdf656d6a011caed0f21f95..6663812dcf9af83155c617565fc674f30ae629c7 100644 (file)
 #define SND_GAME_SOKOBAN_SOLVING                       179
 #define SND_DOOR_OPENING                               180
 #define SND_DOOR_CLOSING                               181
-#define SND_BACKGROUND_MAIN                            182
-#define SND_BACKGROUND_LEVELS                          183
-#define SND_BACKGROUND_SCORES                          184
-#define SND_BACKGROUND_EDITOR                          185
-#define SND_BACKGROUND_INFO                            186
-#define SND_BACKGROUND_SETUP                           187
+#define SND_BACKGROUND_TITLE                           182
+#define SND_BACKGROUND_MAIN                            183
+#define SND_BACKGROUND_LEVELS                          184
+#define SND_BACKGROUND_SCORES                          185
+#define SND_BACKGROUND_EDITOR                          186
+#define SND_BACKGROUND_INFO                            187
+#define SND_BACKGROUND_SETUP                           188
 
-#define NUM_SOUND_FILES                                        188
+#define NUM_SOUND_FILES                                        189
 
 #endif /* CONF_SND_H */
index 52b9cad42851695239e11b87de84f0cdd3b9ff88..a18f9ffea6aad5b06a272071cd86709b4da1dda9 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2006-04-30 16:56]"
+#define COMPILE_DATE_STRING "[2006-04-30 17:49]"
index 002e4fdff521dc77e50a4a95195379905bdc7ec3..134a5e73f536a54d9ac7288c7502df7a69a62ce5 100644 (file)
@@ -1001,6 +1001,7 @@ void HandleJoystick()
 
   switch(game_status)
   {
+    case GAME_MODE_TITLE:
     case GAME_MODE_MAIN:
     case GAME_MODE_LEVELS:
     case GAME_MODE_SETUP:
index 6f0208de91732e8b3a37df2b4c1a359a25a81eb1..fb264ac434a2f4a960fb50a032a90e48ff2d83b1 100644 (file)
@@ -201,40 +201,6 @@ static void drawChooseTreeCursor(int ypos, int color)
   game_status = last_game_status;      /* restore current game status */
 }
 
-static void PlayMenuSound()
-{
-  int sound = menu.sound[game_status];
-
-  if (sound == SND_UNDEFINED)
-    return;
-
-  if (sound_info[sound].loop)
-    PlaySoundLoop(sound);
-  else
-    PlaySound(sound);
-}
-
-static void PlayMenuSoundIfLoop()
-{
-  int sound = menu.sound[game_status];
-
-  if (sound == SND_UNDEFINED)
-    return;
-
-  if (sound_info[sound].loop)
-    PlaySoundLoop(sound);
-}
-
-static void PlayMenuMusic()
-{
-  int music = menu.music[game_status];
-
-  if (music == MUS_UNDEFINED)
-    return;
-
-  PlayMusic(music);
-}
-
 void DrawHeadline()
 {
   DrawTextSCentered(MENU_TITLE1_YPOS, FONT_TITLE_1, PROGRAM_TITLE_STRING);
@@ -312,11 +278,7 @@ void DrawTitleScreenImage(int nr)
   dst_x = (WIN_XSIZE - width) / 2;
   dst_y = (WIN_YSIZE - height) / 2;
 
-#if 1
   ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
-#else
-  DrawBackground(0, 0, WIN_XSIZE, WIN_YSIZE);
-#endif
 
   if (DrawingOnBackground(dst_x, dst_y))
     BlitBitmapMasked(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
@@ -332,23 +294,11 @@ void DrawTitleScreen()
 
   SetMainBackgroundImage(IMG_BACKGROUND_TITLE);
 
-#if 0
-  CloseDoor(DOOR_CLOSE_1);
-#endif
-
   PlayMenuSound();
   PlayMenuMusic();
 
   HandleTitleScreen(0, 0, 0, 0, MB_MENU_INITIALIZE);
 
-#if 0
-#if 1
-  FadeIn(1000);
-#else
-  FadeToFront();
-#endif
-#endif
-
   StopAnimation();
 }
 
@@ -376,6 +326,10 @@ static void DrawMainMenuExt(int fade_delay)
 
   audio.sound_deactivated = FALSE;
 
+#if 1
+  GetPlayerConfig();
+#endif
+
   /* needed if last screen was the playing screen, invoked from level editor */
   if (level_editor_test_game)
   {
@@ -427,7 +381,9 @@ static void DrawMainMenuExt(int fade_delay)
   if (setup.handicap && level_nr > leveldir_current->handicap_level)
     level_nr = leveldir_current->handicap_level;
 
+#if 0
   GetPlayerConfig();
+#endif
   LoadLevel(level_nr);
 
   SetMainBackgroundImage(IMG_BACKGROUND_MAIN);
@@ -561,10 +517,7 @@ static void DrawMainMenuExt(int fade_delay)
 #endif
 
 #if 1
-  if (fade_delay > 0)
-    FadeIn(fade_delay);
-  else
-    BackToFront();
+  FadeIn(fade_delay);
 
   InitAnimation();
 #endif
@@ -650,7 +603,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
       drawto = drawto_last;
 
       if (use_cross_fading)
-       FadeCross(bitmap_db_title, fade_delay);
+       FadeCross(fade_delay);
       else
        FadeIn(fade_delay);
     }
index 3a2315a6a8217e6f8d95c006c7d6ff10626f13d1..65c6255871d133ba329e29f677649d03ef6a0429 100644 (file)
@@ -416,6 +416,13 @@ void FadeToFront()
 
 void FadeIn(int fade_delay)
 {
+  if (fade_delay == 0)
+  {
+    BackToFront();
+
+    return;
+  }
+
   FadeScreen(NULL, FADE_MODE_FADE_IN, fade_delay, 0);
 
   redraw_mask = REDRAW_NONE;
@@ -423,14 +430,30 @@ void FadeIn(int fade_delay)
 
 void FadeOut(int fade_delay, int post_delay)
 {
+  if (fade_delay == 0)
+  {
+    ClearRectangle(backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE);
+    BackToFront();
+
+    return;
+  }
+
   FadeScreen(NULL, FADE_MODE_FADE_OUT, fade_delay, post_delay);
 
   redraw_mask = REDRAW_NONE;
 }
 
-void FadeCross(Bitmap *bitmap, int fade_delay)
+void FadeCross(int fade_delay)
 {
-  FadeScreen(bitmap, FADE_MODE_CROSSFADE, fade_delay, 0);
+  if (fade_delay == 0)
+  {
+    BlitBitmap(bitmap_db_title, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+    BackToFront();
+
+    return;
+  }
+
+  FadeScreen(bitmap_db_title, FADE_MODE_CROSSFADE, fade_delay, 0);
 
   redraw_mask = REDRAW_NONE;
 }
@@ -1429,7 +1452,7 @@ void ShowEnvelope(int envelope_nr)
 
   game.envelope_active = TRUE; /* needed for RedrawPlayfield() events */
 
-  PlaySoundStereo(sound_opening, SOUND_MIDDLE);
+  PlayMenuSoundStereo(sound_opening, SOUND_MIDDLE);
 
   if (anim_mode == ANIM_DEFAULT)
     AnimateEnvelope(envelope_nr, ANIM_DEFAULT, ACTION_OPENING);
@@ -1441,7 +1464,7 @@ void ShowEnvelope(int envelope_nr)
   else
     WaitForEventToContinue();
 
-  PlaySoundStereo(sound_closing, SOUND_MIDDLE);
+  PlayMenuSoundStereo(sound_closing, SOUND_MIDDLE);
 
   if (anim_mode != ANIM_NONE)
     AnimateEnvelope(envelope_nr, main_anim_mode, ACTION_CLOSING);
@@ -2606,9 +2629,9 @@ unsigned int MoveDoor(unsigned int door_state)
     {
       /* opening door sound has priority over simultaneously closing door */
       if (door_state & (DOOR_OPEN_1 | DOOR_OPEN_2))
-       PlaySoundStereo(SND_DOOR_OPENING, SOUND_MIDDLE);
+       PlayMenuSoundStereo(SND_DOOR_OPENING, SOUND_MIDDLE);
       else if (door_state & (DOOR_CLOSE_1 | DOOR_CLOSE_2))
-       PlaySoundStereo(SND_DOOR_CLOSING, SOUND_MIDDLE);
+       PlayMenuSoundStereo(SND_DOOR_CLOSING, SOUND_MIDDLE);
     }
 
     for (k = start; k <= end && !(door_1_done && door_2_done); k += stepsize)
@@ -5891,3 +5914,60 @@ void InitGraphicInfo_EM(void)
   exit(0);
 #endif
 }
+
+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;
+
+  PlayMusic(music);
+}
index 5044c746a92d97a6b50e479654ebcadc62bb9806..f77a594acf99ef1da2b5670b47e8a1ca022a696c 100644 (file)
@@ -69,7 +69,7 @@ void FadeToFront();
 
 void FadeIn(int);
 void FadeOut(int, int);
-void FadeCross(Bitmap *, int);
+void FadeCross(int);
 
 void ClearWindow();
 void SetMainBackgroundImageIfDefined(int);
@@ -165,4 +165,9 @@ int font2baseimg(int);
 unsigned int InitRND(long);
 void InitGraphicInfo_EM(void);
 
+void PlayMenuSound();
+void PlayMenuSoundStereo(int, int);
+void PlayMenuSoundIfLoop();
+void PlayMenuMusic();
+
 #endif /* TOOLS_H */