X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=7cc586bc9cb90cf1d80c253def97e0d0171938e9;hb=72b8afe4885eda3b89b166b4cfcd80a3464ee37d;hp=aadbe74dcaf486c587c8fe59496d0f4b547695a5;hpb=f36facaa50d9c7cbfe56f34f0269bb4b9bdcc1fa;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index aadbe74d..7cc586bc 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1119,6 +1119,27 @@ static int compareTitleControlInfo(const void *object1, const void *object2) return compare_result; } +static boolean CheckTitleScreen_BD(int nr, boolean initial) +{ + // only show BD style title screen for native BD level sets + if (level.game_engine_type != GAME_ENGINE_TYPE_BD) + return FALSE; + + // only show BD style title screen for first title screen of a level set + if (initial || nr != 0) + return FALSE; + + int graphic = getTitleScreenGraphic(nr, initial); + Bitmap *bitmap = graphic_info[graphic].bitmap; + + // only show BD style title screen if no other title screen defined + if (bitmap != NULL) + return FALSE; + + // check if BD style title screen defined + return (GetTitleScreenBitmaps_BD() != NULL); +} + static void InitializeTitleControlsExt_AddTitleInfo(boolean is_image, boolean initial, int nr, int sort_priority) @@ -1142,8 +1163,13 @@ static void InitializeTitleControls_CheckTitleInfo(boolean initial) int graphic = getTitleScreenGraphic(i, initial); Bitmap *bitmap = graphic_info[graphic].bitmap; int sort_priority = graphic_info[graphic].sort_priority; + boolean has_title_screen = (bitmap != NULL); - if (bitmap != NULL) + // check for optional title screen of native BD style level set + if (CheckTitleScreen_BD(i, initial)) + has_title_screen = TRUE; + + if (has_title_screen) InitializeTitleControlsExt_AddTitleInfo(TRUE, initial, i, sort_priority); } @@ -1596,8 +1622,10 @@ static void DrawInfoScreen_Headline(int screen_nr, int num_screens, static void DrawTitleScreenImage(int nr, boolean initial) { + static int frame_counter = 0; int graphic = getTitleScreenGraphic(nr, initial); Bitmap *bitmap = graphic_info[graphic].bitmap; + Bitmap *bitmap_background = NULL; int draw_masked = graphic_info[graphic].draw_masked; int width = graphic_info[graphic].width; int height = graphic_info[graphic].height; @@ -1605,6 +1633,23 @@ static void DrawTitleScreenImage(int nr, boolean initial) int src_y = graphic_info[graphic].src_y; int dst_x, dst_y; + // check for optional title screen of native BD style level set + if (CheckTitleScreen_BD(nr, initial)) + { + Bitmap **title_screen_bitmaps = GetTitleScreenBitmaps_BD(); + + bitmap = title_screen_bitmaps[0]; + bitmap_background = title_screen_bitmaps[1]; + + if (bitmap != NULL) + { + width = bitmap->width; + height = bitmap->height; + src_x = 0; + src_y = 0; + } + } + if (bitmap == NULL) return; @@ -1631,7 +1676,19 @@ static void DrawTitleScreenImage(int nr, boolean initial) ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE); - if (DrawingOnBackground(dst_x, dst_y) && draw_masked) + boolean draw_masked_final = (DrawingOnBackground(dst_x, dst_y) && draw_masked); + + if (bitmap_background != NULL) + { + int size = bitmap_background->height - bitmap->height; + int offset = frame_counter++ % size; + + BlitBitmap(bitmap_background, drawto, src_x, src_y + offset, width, height, dst_x, dst_y); + + draw_masked_final = TRUE; + } + + if (draw_masked_final) 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); @@ -2077,6 +2134,21 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) return_to_main_menu = TRUE; } } + else + { + tci = &title_controls[title_screen_nr]; + + // check for optional title screen of native BD style level set + if (tci->is_image && CheckTitleScreen_BD(tci->local_nr, tci->initial)) + { + Bitmap **title_screen_bitmaps = GetTitleScreenBitmaps_BD(); + + // if title screen is animated, draw title screen animation + if (title_screen_bitmaps[0] != NULL && + title_screen_bitmaps[1] != NULL) + DrawTitleScreenImage(tci->local_nr, tci->initial); + } + } if (return_to_main_menu) { @@ -4649,6 +4721,10 @@ static void drawChooseTreeText(TreeInfo *ti, int y, boolean active) char *pos_text = getHallOfFameRankText(pos, 3); int i; + // highlight all high score entries of the current player + if (strEqual(scores.entry[pos].name, setup.player_name)) + font_nr2 = FONT_TEXT_2_ACTIVE; + DrawText(startx1, starty, pos_text, font_nr1); for (i = 0; i < num_dots; i++) @@ -5012,6 +5088,14 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, return; } + else if (game_status == GAME_MODE_NAMES && dx == 1) + { + SetGameStatus(GAME_MODE_PSEUDO_TYPENAMES); + + DrawTypeName(); + + return; + } else if (dx == 1) { TreeInfo *node_first, *node_cursor; @@ -7863,10 +7947,11 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw) struct TokenInfo *si = &setup_info[si_pos]; boolean font_draw_xoffset_modified = FALSE; boolean scrollbar_needed = (num_setup_info < max_setup_info); + int mx_scrollbar = screen_gadget[SCREEN_CTRL_ID_SCROLL_VERTICAL]->x; + int mx_right_border = (scrollbar_needed ? mx_scrollbar : SX + SXSIZE); int font_draw_xoffset_old = -1; - int xoffset = (scrollbar_needed ? -1 : 0); + int xoffset = (scrollbar_needed ? 0 : 1); int menu_screen_value_xpos = MENU_SCREEN_VALUE_XPOS + xoffset; - int menu_screen_max_xpos = MENU_SCREEN_MAX_XPOS + xoffset; int xpos = menu_screen_value_xpos; int ypos = MENU_SCREEN_START_YPOS + screen_pos; int startx = mSX + xpos * 32; @@ -7877,7 +7962,6 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw) int font_nr_default = getSetupValueFont(type, value); int font_width_default = getFontWidth(font_nr_default); int font_nr = font_nr_default; - int i; if (value_string == NULL) return; @@ -7898,10 +7982,6 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw) if (strlen(value_string) > max_value_len) value_string[max_value_len] = '\0'; } - else if (type & TYPE_YES_NO_AUTO) - { - xpos = menu_screen_value_xpos - 1; - } else if (type & TYPE_PLAYER) { int displayed_player_nr = *(int *)value + 1; @@ -7912,28 +7992,9 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw) startx = mSX + xpos * 32; starty = mSY + ypos * 32; - // special check if right-side setup values moved left due to scrollbar - if (scrollbar_needed && xpos > MENU_SCREEN_START_XPOS) - { - int max_menu_text_length = 26; // maximum text length for classic menu - int font_xoffset = getFontDrawOffsetX(font_nr); - int text_startx = mSX + MENU_SCREEN_START_XPOS * 32; - int text_font_nr = getMenuTextFont(FONT_MENU_2); - int text_font_xoffset = getFontDrawOffsetX(text_font_nr); - int text_width = max_menu_text_length * getFontWidth(text_font_nr); - - if (startx + font_xoffset < text_startx + text_width + text_font_xoffset) - { - // when using narrow font, left-shifting text "auto" not needed - if (type & TYPE_YES_NO_AUTO) - xpos += 1; - - xpos += 1; - startx = mSX + xpos * 32; - - font_nr = getSetupValueFontNarrow(type, font_nr); - } - } + // always use narrow font for setup values on right screen side + if (xpos > MENU_SCREEN_START_XPOS) + font_nr = getSetupValueFontNarrow(type, font_nr); // downward compatibility correction for Juergen Bonhagen's menu settings if (setup_mode != SETUP_MODE_INPUT) @@ -7973,9 +8034,7 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw) } } - for (i = 0; i <= menu_screen_max_xpos - xpos; i++) - DrawText(startx + i * font_width_default, starty, " ", font_nr_default); - + DrawBackground(startx, starty, mx_right_border - startx, getFontHeight(font_nr)); DrawText(startx, starty, value_string, font_nr); if (type & TYPE_PLAYER) @@ -10500,7 +10559,7 @@ static void HandleScreenGadgets(struct GadgetInfo *gi) void HandleScreenGadgetKeys(Key key) { - if (key == setup.shortcut.tape_play) + if (key == setup.shortcut.tape_play || key == KSYM_Return) HandleScreenGadgets(screen_gadget[SCREEN_CTRL_ID_PLAY_TAPE]); }