X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fscreens.c;h=ca4e669ac05707cb747a48ee70fbec41b331d5a8;hp=0bd9af8403d35c5a2de0cbdc3fb445a98d603b0b;hb=f7165d318c089b77d0a91a77afc44cb8866dc1cc;hpb=14d7691c65ca4a466ce9b9448153e8fbe8351a81 diff --git a/src/screens.c b/src/screens.c index 0bd9af84..ca4e669a 100644 --- a/src/screens.c +++ b/src/screens.c @@ -961,10 +961,8 @@ static void InitializeMainControls() if (pos_button != NULL) /* (x/y may be -1/-1 here) */ { - if (pos_button->width == 0) - pos_button->width = button_width; - if (pos_button->height == 0) - pos_button->height = button_height; + pos_button->width = button_width; + pos_button->height = button_height; } if (pos_text != NULL) /* (x/y may be -1/-1 here) */ @@ -972,18 +970,19 @@ static void InitializeMainControls() /* calculate size for non-clickable text -- needed for text alignment */ boolean calculate_text_size = (pos_button == NULL && text != NULL); + if (pos_text->width == -1 || calculate_text_size) + pos_text->width = text_width; + if (pos_text->height == -1 || calculate_text_size) + pos_text->height = text_height; + if (visibleMenuPos(pos_button)) { if (pos_text->x == -1) pos_text->x = pos_button->x + pos_button->width; if (pos_text->y == -1) - pos_text->y = pos_button->y; + pos_text->y = + pos_button->y + (pos_button->height - pos_text->height) / 2; } - - if (pos_text->width == -1 || calculate_text_size) - pos_text->width = text_width; - if (pos_text->height == -1 || calculate_text_size) - pos_text->height = text_height; } if (pos_input != NULL) /* (x/y may be -1/-1 here) */ @@ -1310,9 +1309,6 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) KeyboardAutoRepeatOn(); ActivateJoystick(); - SetDrawDeactivationMask(REDRAW_NONE); - SetDrawBackgroundMask(REDRAW_FIELD); - audio.sound_deactivated = FALSE; GetPlayerConfig(); @@ -1374,6 +1370,10 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) LoadLevel(level_nr); LoadScore(level_nr); + // set this after "ChangeViewportPropertiesIfNeeded()" (which may reset it) + SetDrawDeactivationMask(REDRAW_NONE); + SetDrawBackgroundMask(REDRAW_FIELD); + SetMainBackgroundImage(IMG_BACKGROUND_MAIN); if (fade_mask == REDRAW_ALL) @@ -3229,6 +3229,8 @@ void HandleTypeName(int newxpos, Key key) static void DrawChooseTree(TreeInfo **ti_ptr) { + int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD); + UnmapAllGadgets(); FreeScreenGadgets(); @@ -3236,14 +3238,14 @@ static void DrawChooseTree(TreeInfo **ti_ptr) CloseDoor(DOOR_CLOSE_2); - FadeOut(REDRAW_FIELD); + FadeOut(fade_mask); ClearField(); HandleChooseTree(0, 0, 0, 0, MB_MENU_INITIALIZE, ti_ptr); MapScreenTreeGadgets(*ti_ptr); - FadeIn(REDRAW_FIELD); + FadeIn(fade_mask); InitAnimation(); } @@ -3272,8 +3274,8 @@ static void clearMenuListArea() int scrollbar_xpos = mSX + SC_SCROLLBAR_XPOS + menu.scrollbar_xoffset; /* correct scrollbar position if placed outside menu (playfield) area */ - if (scrollbar_xpos > SC_SCROLLBAR_XPOS) - scrollbar_xpos = SC_SCROLLBAR_XPOS; + if (scrollbar_xpos > mSX + SC_SCROLLBAR_XPOS) + scrollbar_xpos = mSX + SC_SCROLLBAR_XPOS; /* clear menu list area, but not title or scrollbar */ DrawBackground(mSX, mSY + MENU_SCREEN_START_YPOS * 32, @@ -3745,6 +3747,8 @@ void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button) void DrawHallOfFame(int highlight_position) { + int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD); + UnmapAllGadgets(); FadeSoundsAndMusic(); @@ -3763,7 +3767,7 @@ void DrawHallOfFame(int highlight_position) FadeSetEnterScreen(); - FadeOut(REDRAW_FIELD); + FadeOut(fade_mask); InitAnimation(); @@ -3772,7 +3776,7 @@ void DrawHallOfFame(int highlight_position) HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE); - FadeIn(REDRAW_FIELD); + FadeIn(fade_mask); } static void drawHallOfFameList(int first_entry, int highlight_position) @@ -5290,6 +5294,7 @@ static void drawSetupInfoList(struct TokenInfo *setup_info, static void DrawSetupScreen_Generic() { + int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD); boolean redraw_all = FALSE; char *title_string = NULL; int i; @@ -5304,7 +5309,7 @@ static void DrawSetupScreen_Generic() if (redraw_mask & REDRAW_ALL) redraw_all = TRUE; - FadeOut(REDRAW_FIELD); + FadeOut(fade_mask); ClearField(); @@ -5391,9 +5396,9 @@ static void DrawSetupScreen_Generic() MapScreenGadgets(max_setup_info); if (redraw_all) - redraw_mask = REDRAW_ALL; + redraw_mask = fade_mask = REDRAW_ALL; - FadeIn(redraw_mask); + FadeIn(fade_mask); InitAnimation(); } @@ -6568,8 +6573,8 @@ static void CreateScreenScrollbuttons() height = SC_SCROLLBUTTON_YSIZE; /* correct scrollbar position if placed outside menu (playfield) area */ - if (x > SC_SCROLL_UP_XPOS) - x = SC_SCROLL_UP_XPOS; + if (x > SX + SC_SCROLL_UP_XPOS) + x = SX + SC_SCROLL_UP_XPOS; if (id == SCREEN_CTRL_ID_SCROLL_DOWN) y = mSY + (SC_SCROLL_VERTICAL_YPOS + @@ -6637,8 +6642,8 @@ static void CreateScreenScrollbars() height = scrollbar_info[i].height; /* correct scrollbar position if placed outside menu (playfield) area */ - if (x > SC_SCROLL_VERTICAL_XPOS) - x = SC_SCROLL_VERTICAL_XPOS; + if (x > SX + SC_SCROLL_VERTICAL_XPOS) + x = SX + SC_SCROLL_VERTICAL_XPOS; if (id == SCREEN_CTRL_ID_SCROLL_VERTICAL) height = (NUM_MENU_ENTRIES_ON_SCREEN - 2) * SC_SCROLLBUTTON_YSIZE;