X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=d82f3bd25be8284036384bbf8ac5ef113e914b8d;hb=92989af5d5884cbc8a1a9a62c9d05e109eaf78d0;hp=0965eb9efcfe60aec3c14658bb3b7e28df351cfa;hpb=1ed02c282e3b4bd73c5d26244e4df30d731cc6c8;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 0965eb9e..d82f3bd2 100644 --- a/src/screens.c +++ b/src/screens.c @@ -139,29 +139,49 @@ static void drawChooseTreeCursor(int ypos, int color) game_status = last_game_status; /* restore current game status */ } -static void PlaySound_Menu_Start(int sound) +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 PlaySound_Menu_Continue(int 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() { - int text1_width = getTextWidth(PROGRAM_TITLE_STRING, FONT_TITLE_1); - int text2_width = getTextWidth(WINDOW_SUBTITLE_STRING, FONT_TITLE_2); + int text1_width = getTextWidth(PROGRAM_TITLE_STRING, FONT_TITLE_1); + int text2_width = getTextWidth(PROGRAM_COPYRIGHT_STRING, FONT_TITLE_2); int x1 = SX + (SXSIZE - text1_width) / 2; int x2 = SX + (SXSIZE - text2_width) / 2; - DrawText(x1, SY + 8, PROGRAM_TITLE_STRING, FONT_TITLE_1); - DrawText(x2, SY + 46, WINDOW_SUBTITLE_STRING, FONT_TITLE_2); + DrawText(x1, SY + 8, PROGRAM_TITLE_STRING, FONT_TITLE_1); + DrawText(x2, SY + 46, PROGRAM_COPYRIGHT_STRING, FONT_TITLE_2); } static void ToggleFullscreenIfNeeded() @@ -197,7 +217,7 @@ void DrawMainMenu() int i; UnmapAllGadgets(); - FadeSounds(); + FadeSoundsAndMusic(); KeyboardAutoRepeatOn(); ActivateJoystick(); @@ -212,6 +232,7 @@ void DrawMainMenu() { game_status = GAME_MODE_EDITOR; DrawLevelEd(); + return; } @@ -293,6 +314,9 @@ void DrawMainMenu() LoadTape(level_nr); DrawCompleteVideoDisplay(); + PlayMenuSound(); + PlayMenuMusic(); + OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); #if 0 @@ -960,7 +984,7 @@ void DrawHelpScreenMusicText(int num) int ystart = 150, ystep = 30; int ybottom = SYSIZE - 20; - FadeSounds(); + FadeSoundsAndMusic(); ClearWindow(); DrawHeadline(); @@ -989,7 +1013,7 @@ void DrawHelpScreenCreditsText() int ystart = 150, ystep = 30; int ybottom = SYSIZE - 20; - FadeSounds(); + FadeSoundsAndMusic(); ClearWindow(); DrawHeadline(); @@ -1062,11 +1086,8 @@ void DrawHelpScreen() FadeToFront(); InitAnimation(); -#if 0 - PlaySoundLoop(SND_BACKGROUND_INFO); -#else - PlaySound_Menu_Start(SND_BACKGROUND_INFO); -#endif + PlayMenuSound(); + PlayMenuMusic(); } void HandleHelpScreen(int button) @@ -1109,7 +1130,7 @@ void HandleHelpScreen(int button) } else { - FadeSounds(); + FadeSoundsAndMusic(); game_status = GAME_MODE_MAIN; DrawMainMenu(); @@ -1123,14 +1144,7 @@ void HandleHelpScreen(int button) DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS); } - /* !!! workaround for playing "music" that is really a sound loop (and - must therefore periodically be reactivated with the current sound - engine !!! */ -#if 0 - PlaySoundLoop(SND_BACKGROUND_INFO); -#else - PlaySound_Menu_Continue(SND_BACKGROUND_INFO); -#endif + PlayMenuSoundIfLoop(); } DoAnimation(); @@ -1240,12 +1254,6 @@ static void drawChooseTreeList(int first_entry, int num_page_entries, int yoffset = (ti->type == TREE_TYPE_LEVEL_DIR ? 0 : yoffset_setup); int last_game_status = game_status; /* save current game status */ -#if 1 - DrawBackground(mSX, mSY, SXSIZE - 32 + menu.scrollbar_xoffset, SYSIZE); -#else - DrawBackground(SX, SY, SXSIZE - 32, SYSIZE); -#endif - title_string = (ti->type == TREE_TYPE_LEVEL_DIR ? "Level Directories" : ti->type == TREE_TYPE_GRAPHICS_DIR ? "Custom Graphics" : @@ -1257,6 +1265,11 @@ static void drawChooseTreeList(int first_entry, int num_page_entries, /* force LEVELS font on artwork setup screen */ game_status = GAME_MODE_LEVELS; + /* clear tree list area, but not title or scrollbar */ + DrawBackground(mSX, mSY + MENU_SCREEN_START_YPOS * 32, + SXSIZE - 32 + menu.scrollbar_xoffset, + MAX_MENU_ENTRIES_ON_SCREEN * 32); + for(i=0; i max_value_len) value_string[max_value_len] = '\0'; } - else if (setup_info[pos].type & TYPE_BOOLEAN_STYLE) + else if (type & TYPE_BOOLEAN_STYLE) { - font_nr = (*(boolean *)(setup_info[pos].value) ? FONT_OPTION_ON : - FONT_OPTION_OFF); + font_nr = (*(boolean *)value ? FONT_OPTION_ON : FONT_OPTION_OFF); } DrawText(mSX + xpos * 32, mSY + ypos * 32, @@ -2766,6 +2777,9 @@ void DrawSetupScreen() DrawChooseTree(&artwork.mus_current); else DrawSetupScreen_Generic(); + + PlayMenuSound(); + PlayMenuMusic(); } void HandleSetupScreen(int mx, int my, int dx, int dy, int button)