From: Holger Schemel Date: Sun, 30 Apr 2006 15:50:59 +0000 (+0200) Subject: rnd-20060430-4-src X-Git-Tag: 3.2.0^2~25 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=e6e7b00366bd426aaaad8f5175feabb0eafb4cb0;p=rocksndiamonds.git rnd-20060430-4-src --- diff --git a/src/conf_g2m.c b/src/conf_g2m.c index 1c186459..1ad1b39e 100644 --- a/src/conf_g2m.c +++ b/src/conf_g2m.c @@ -30,6 +30,10 @@ gamemode_to_music[] = -1, MUS_BACKGROUND }, + { + GFX_SPECIAL_ARG_TITLE, + MUS_BACKGROUND_TITLE + }, { GFX_SPECIAL_ARG_MAIN, MUS_BACKGROUND_MAIN diff --git a/src/conf_g2s.c b/src/conf_g2s.c index 7ebfff0c..703f1453 100644 --- a/src/conf_g2s.c +++ b/src/conf_g2s.c @@ -26,6 +26,10 @@ static struct } gamemode_to_sound[] = { + { + GFX_SPECIAL_ARG_TITLE, + SND_BACKGROUND_TITLE + }, { GFX_SPECIAL_ARG_MAIN, SND_BACKGROUND_MAIN diff --git a/src/conf_mus.c b/src/conf_mus.c index 27ec9056..bb5f5e79 100644 --- a/src/conf_mus.c +++ b/src/conf_mus.c @@ -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 }, diff --git a/src/conf_mus.h b/src/conf_mus.h index e6ba90e9..a8d757b8 100644 --- a/src/conf_mus.h +++ b/src/conf_mus.h @@ -19,13 +19,14 @@ /* 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 */ diff --git a/src/conf_snd.c b/src/conf_snd.c index 8cdd4d7b..c15e0dec 100644 --- a/src/conf_snd.c +++ b/src/conf_snd.c @@ -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" }, diff --git a/src/conf_snd.h b/src/conf_snd.h index 91bb1291..6663812d 100644 --- a/src/conf_snd.h +++ b/src/conf_snd.h @@ -200,13 +200,14 @@ #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 */ diff --git a/src/conftime.h b/src/conftime.h index 52b9cad4..a18f9ffe 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-04-30 16:56]" +#define COMPILE_DATE_STRING "[2006-04-30 17:49]" diff --git a/src/events.c b/src/events.c index 002e4fdf..134a5e73 100644 --- a/src/events.c +++ b/src/events.c @@ -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: diff --git a/src/screens.c b/src/screens.c index 6f0208de..fb264ac4 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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); } diff --git a/src/tools.c b/src/tools.c index 3a2315a6..65c62558 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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); +} diff --git a/src/tools.h b/src/tools.h index 5044c746..f77a594a 100644 --- a/src/tools.h +++ b/src/tools.h @@ -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 */