X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fscreens.c;h=1f94c7850526b018393acae400a9c0b37980e86c;hp=4f7d783a681046a972839fda35ef9926e5fbfa8e;hb=064971ae82e2e3f98dc55e75b15c192c9165fb4e;hpb=38b4bf3fec7d93aa252f57270246b3e4ff41cf8d diff --git a/src/screens.c b/src/screens.c index 4f7d783a..1f94c785 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1252,14 +1252,6 @@ void DrawHeadline() setup.internal.program_copyright); } -int effectiveGameStatus() -{ - if (game_status == GAME_MODE_INFO && info_mode == INFO_MODE_TITLE) - return GAME_MODE_TITLE; - - return game_status; -} - void DrawTitleScreenImage(int nr, boolean initial) { int graphic = getTitleScreenGraphic(nr, initial); @@ -1316,6 +1308,14 @@ void DrawTitleScreenMessage(int nr, boolean initial) /* force TITLE font on title message screen */ game_status = getTitleMessageGameMode(initial); + /* if chars *and* width set to "-1", automatically determine width */ + if (tmi->chars == -1 && tmi->width == -1) + tmi->width = viewport.window[game_status].width; + + /* if lines *and* height set to "-1", automatically determine height */ + if (tmi->lines == -1 && tmi->height == -1) + tmi->height = viewport.window[game_status].height; + /* if chars set to "-1", automatically determine by text and font width */ if (tmi->chars == -1) tmi->chars = tmi->width / getFontWidth(tmi->font); @@ -1328,6 +1328,14 @@ void DrawTitleScreenMessage(int nr, boolean initial) else tmi->height = tmi->lines * getFontHeight(tmi->font); + /* if x set to "-1", automatically determine by width and alignment */ + if (tmi->x == -1) + tmi->x = -1 * ALIGNED_XPOS(0, tmi->width, tmi->align); + + /* if y set to "-1", automatically determine by height and alignment */ + if (tmi->y == -1) + tmi->y = -1 * ALIGNED_YPOS(0, tmi->height, tmi->valign); + SetDrawBackgroundMask(REDRAW_ALL); SetWindowBackgroundImage(getTitleBackground(nr, initial, FALSE)); @@ -1434,6 +1442,7 @@ void DrawMainMenu() if (CheckTitleScreen(levelset_has_changed)) { + game_status_last_screen = GAME_MODE_MAIN; game_status = GAME_MODE_TITLE; DrawTitleScreen(); @@ -1543,9 +1552,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) static int last_sound = -1, last_music = -1; boolean return_to_main_menu = FALSE; struct TitleControlInfo *tci; - struct TitleFadingInfo fading_default; - struct TitleFadingInfo fading_last = fading; - struct TitleFadingInfo fading_next; int sound, music; if (button == MB_MENU_INITIALIZE) @@ -1557,7 +1563,9 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) last_sound = SND_UNDEFINED; last_music = MUS_UNDEFINED; - if (game_status == GAME_MODE_INFO) + FadeSetEnterScreen(); + + if (game_status_last_screen == GAME_MODE_INFO) { if (num_title_screens == 0) { @@ -1572,22 +1580,17 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeOut(REDRAW_ALL); } + /* only required to update logic for redrawing global border */ + ClearField(); + + /* title screens may have different window size */ + ChangeViewportPropertiesIfNeeded(); + if (tci->is_image) DrawTitleScreenImage(tci->local_nr, tci->initial); else DrawTitleScreenMessage(tci->local_nr, tci->initial); - fading_default = (tci->initial ? title_initial_default : title_default); - - fading = fading_next = getTitleFading(tci); - - if (!(fading_last.fade_mode & FADE_TYPE_TRANSFORM) && - fading_next.fade_mode & FADE_TYPE_TRANSFORM) - { - fading.fade_mode = FADE_MODE_FADE; - fading.fade_delay = fading_default.fade_delay; - } - sound = getTitleSound(tci); music = getTitleMusic(tci); @@ -1603,8 +1606,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeIn(REDRAW_ALL); - fading = fading_next; - DelayReached(&title_delay, 0); /* reset delay counter */ return; @@ -1619,11 +1620,13 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) } else if (button == MB_MENU_CHOICE) { - if (game_status == GAME_MODE_INFO && num_title_screens == 0) + if (game_status_last_screen == GAME_MODE_INFO && num_title_screens == 0) { FadeSetEnterScreen(); + game_status = GAME_MODE_INFO; info_mode = INFO_MODE_MAIN; + DrawInfoScreen(); return; @@ -1642,6 +1645,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (music == MUS_UNDEFINED || music != last_music) FadeMusic(); + fading = getTitleFading(tci); + FadeOut(REDRAW_ALL); if (tci->is_image) @@ -1649,8 +1654,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) else DrawTitleScreenMessage(tci->local_nr, tci->initial); - fading_next = getTitleFading(tci); - sound = getTitleSound(tci); music = getTitleMusic(tci); @@ -1662,15 +1665,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) last_sound = sound; last_music = music; - /* last screen already faded out, next screen has no animation */ - if (!(fading.fade_mode & FADE_TYPE_TRANSFORM) && - fading_next.fade_mode == FADE_MODE_NONE) - fading = fading_next; - FadeIn(REDRAW_ALL); - fading = fading_next; - DelayReached(&title_delay, 0); /* reset delay counter */ } else @@ -1688,8 +1684,9 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) /* force full menu screen redraw after displaying title screens */ redraw_mask = REDRAW_ALL; - if (game_status == GAME_MODE_INFO) + if (game_status_last_screen == GAME_MODE_INFO) { + game_status = GAME_MODE_INFO; info_mode = INFO_MODE_MAIN; DrawInfoScreen(); @@ -2159,12 +2156,9 @@ static void DrawInfoScreen_Main() FadeOut(fade_mask); - if (fade_mask == REDRAW_ALL) - { - RedrawGlobalBorder(); + ChangeViewportPropertiesIfNeeded(); - OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - } + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); ClearField(); @@ -2189,6 +2183,11 @@ static void DrawInfoScreen_Main() PlayMenuSound(); PlayMenuMusic(); +#if 1 + // needed after returning from title screens with different window size + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); +#endif + DrawMaskedBorder(fade_mask); FadeIn(fade_mask); @@ -2667,6 +2666,9 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) void DrawInfoScreen_TitleScreen() { + game_status_last_screen = GAME_MODE_INFO; + game_status = GAME_MODE_TITLE; + DrawTitleScreen(); } @@ -3660,6 +3662,8 @@ static void DrawChooseTree(TreeInfo **ti_ptr) FadeOut(fade_mask); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + ClearField(); HandleChooseTree(0, 0, 0, 0, MB_MENU_INITIALIZE, ti_ptr); @@ -4172,6 +4176,8 @@ void DrawHallOfFame(int highlight_position) PlayMenuSound(); PlayMenuMusic(); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE); DrawMaskedBorder(fade_mask); @@ -5773,6 +5779,8 @@ static void DrawSetupScreen_Generic() FadeOut(fade_mask); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + ClearField(); if (setup_mode == SETUP_MODE_MAIN)