X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=d7a2b63e6883d10a6607eea3584561b16f866365;hb=5b58ec0b5237a4fdbea625e4473f4ef85f245d17;hp=20f5f67ce29dad3fdb2d6b02cb371e431ce8f5ac;hpb=31dd0f97d078a43ac6b23e06cafcd9b7c145d130;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 20f5f67c..d7a2b63e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -317,6 +317,9 @@ static struct } volumes_list[] = { { 0, "0 %" }, + { 1, "1 %" }, + { 2, "2 %" }, + { 5, "5 %" }, { 10, "10 %" }, { 20, "20 %" }, { 30, "30 %" }, @@ -961,10 +964,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 +973,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) */ @@ -1224,10 +1226,7 @@ void DrawTitleScreenImage(int nr, boolean initial) ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE); if (DrawingOnBackground(dst_x, dst_y)) - { - SetClipOrigin(bitmap, bitmap->stored_clip_gc, dst_x - src_x, dst_y - src_y); BlitBitmapMasked(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y); - } else BlitBitmap(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y); @@ -1313,9 +1312,6 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) KeyboardAutoRepeatOn(); ActivateJoystick(); - SetDrawDeactivationMask(REDRAW_NONE); - SetDrawBackgroundMask(REDRAW_FIELD); - audio.sound_deactivated = FALSE; GetPlayerConfig(); @@ -1377,6 +1373,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) @@ -1622,9 +1622,11 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (game_status == GAME_MODE_INFO) { + int fade_mask = (num_title_screens == 0 ? REDRAW_FIELD : REDRAW_ALL); + info_mode = INFO_MODE_MAIN; - DrawInfoScreenExt(REDRAW_ALL, use_fading_main_menu); + DrawInfoScreenExt(fade_mask, use_fading_main_menu); } else /* default: return to main menu */ { @@ -1684,7 +1686,7 @@ void HandleMainMenu_SelectLevel(int step, int direction, int selected_level_nr) /* needed because DrawPreviewLevelInitial() takes some time */ BackToFront(); - SyncDisplay(); + /* SyncDisplay(); */ } } @@ -2093,7 +2095,7 @@ void DrawInfoScreen_NotAvailable(char *text_title, char *text_error) int ystart2 = mSY - SY + 150; int ybottom = mSY - SY + SYSIZE - 20; - SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET); + SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO); FadeOut(REDRAW_FIELD); @@ -3020,6 +3022,41 @@ void DrawInfoScreen_LevelSet() { struct TitleMessageInfo *tmi = &readme; char *filename = getLevelSetInfoFilename(); + char *title = "Level Set Information:"; + int ystart1 = mSY - SY + 100; + int ybottom = mSY - SY + SYSIZE - 20; + + if (filename == NULL) + { + DrawInfoScreen_NotAvailable(title, "No information for this level set."); + + return; + } + + SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET); + + FadeOut(REDRAW_FIELD); + + ClearField(); + DrawHeadline(); + + DrawTextSCentered(ystart1, FONT_TEXT_1, title); + + /* if x position set to "-1", automatically determine by playfield width */ + if (tmi->x == -1) + tmi->x = SXSIZE / 2; + + /* if y position set to "-1", use static default value */ + if (tmi->y == -1) + tmi->y = 150; + + /* if width set to "-1", automatically determine by playfield width */ + if (tmi->width == -1) + tmi->width = SXSIZE - 2 * TILEX; + + /* if height set to "-1", automatically determine by playfield height */ + if (tmi->height == -1) + tmi->height = SYSIZE - 20 - tmi->y - 10; /* if chars set to "-1", automatically determine by text and font width */ if (tmi->chars == -1) @@ -3033,25 +3070,12 @@ void DrawInfoScreen_LevelSet() else tmi->height = tmi->lines * getFontHeight(tmi->font); - SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET); - - FadeOut(REDRAW_FIELD); - - ClearField(); - DrawHeadline(); - - DrawTextCentered(mSY + 100, FONT_TEXT_1, "Level Set Information:"); - - if (filename != NULL) - DrawTextFile(mSX + ALIGNED_TEXT_XPOS(tmi), mSY + ALIGNED_TEXT_YPOS(tmi), - filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1, - tmi->autowrap, tmi->centered, tmi->parse_comments); - else - DrawTextCentered(mSY + ALIGNED_TEXT_YPOS(tmi), FONT_TEXT_2, - "No information for this level set."); + DrawTextFile(mSX + ALIGNED_TEXT_XPOS(tmi), mSY + ALIGNED_TEXT_YPOS(tmi), + filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1, + tmi->autowrap, tmi->centered, tmi->parse_comments); - DrawTextCentered(mSY + SYSIZE - 20, FONT_TEXT_4, - "Press any key or button for info menu"); + DrawTextSCentered(ybottom, FONT_TEXT_4, + "Press any key or button for info menu"); FadeIn(REDRAW_FIELD); } @@ -3232,6 +3256,8 @@ void HandleTypeName(int newxpos, Key key) static void DrawChooseTree(TreeInfo **ti_ptr) { + int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD); + UnmapAllGadgets(); FreeScreenGadgets(); @@ -3239,14 +3265,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(); } @@ -3275,8 +3301,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 > SX + SC_SCROLLBAR_XPOS) + scrollbar_xpos = SX + SC_SCROLLBAR_XPOS; /* clear menu list area, but not title or scrollbar */ DrawBackground(mSX, mSY + MENU_SCREEN_START_YPOS * 32, @@ -3748,6 +3774,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(); @@ -3766,7 +3794,7 @@ void DrawHallOfFame(int highlight_position) FadeSetEnterScreen(); - FadeOut(REDRAW_FIELD); + FadeOut(fade_mask); InitAnimation(); @@ -3775,7 +3803,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) @@ -5293,6 +5321,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; @@ -5307,7 +5336,7 @@ static void DrawSetupScreen_Generic() if (redraw_mask & REDRAW_ALL) redraw_all = TRUE; - FadeOut(REDRAW_FIELD); + FadeOut(fade_mask); ClearField(); @@ -5394,9 +5423,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(); } @@ -6571,8 +6600,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 + @@ -6640,8 +6669,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;