From d905e6df72c773e1943694b96710a2bc25cc863e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 17 Oct 2006 02:46:59 +0200 Subject: [PATCH] rnd-20061017-1-src * added highlighted menu text entries to menu navigation when selected --- ChangeLog | 5 +- src/conf_fnt.c | 8 ++ src/conf_gfx.c | 42 +++++--- src/conf_gfx.h | 140 +++++++++++++------------- src/conftime.h | 2 +- src/init.c | 50 +++++++++- src/main.c | 5 +- src/main.h | 75 ++++++++------ src/screens.c | 261 +++++++++++++++++++++++++++++++++++++++---------- src/tools.c | 18 ++-- 10 files changed, 426 insertions(+), 180 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b6f3cd8..6f3e66d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,12 @@ +2006-10-16 + * added highlighted menu text entries to menu navigation when selected + 2006-10-14 * fixed bug that prevented player from correctly being created in the top left corner by a custom element change in a level without player * fixed bug that prevented player from being killed when indestructible, non-walkable element is placed on player position by extended change - * added configurable main menu button and text positions + * added configurable menu button, text and input positions to main menu 2006-10-13 * added page fading effects for remaining info sub-screens diff --git a/src/conf_fnt.c b/src/conf_fnt.c index bc2f1d01..35d60b91 100644 --- a/src/conf_fnt.c +++ b/src/conf_fnt.c @@ -55,10 +55,18 @@ font_to_graphic[] = FONT_MENU_1, -1, IMG_FONT_MENU_1 }, + { + FONT_MENU_1_ACTIVE, -1, + IMG_FONT_MENU_1_ACTIVE + }, { FONT_MENU_2, -1, IMG_FONT_MENU_2 }, + { + FONT_MENU_2_ACTIVE, -1, + IMG_FONT_MENU_2_ACTIVE + }, { FONT_TEXT_1, -1, IMG_FONT_TEXT_1 diff --git a/src/conf_gfx.c b/src/conf_gfx.c index b1eec7f8..ef3231fb 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -4235,11 +4235,21 @@ struct ConfigInfo image_config[] = { "font.menu_1.y", "320" }, { "font.menu_1.width", "32" }, { "font.menu_1.height", "32" }, + { "font.menu_1.active", "RocksFontBig.pcx" }, + { "font.menu_1.active.x", "0" }, + { "font.menu_1.active.y", "480" }, + { "font.menu_1.active.width", "32" }, + { "font.menu_1.active.height", "32" }, { "font.menu_2", "RocksFontMedium.pcx" }, { "font.menu_2.x", "0" }, { "font.menu_2.y", "320" }, { "font.menu_2.width", "16" }, { "font.menu_2.height", "32" }, + { "font.menu_2.active", "RocksFontMedium.pcx" }, + { "font.menu_2.active.x", "0" }, + { "font.menu_2.active.y", "480" }, + { "font.menu_2.active.width", "16" }, + { "font.menu_2.active.height", "32" }, { "font.text_1", "RocksFontSmall.pcx" }, { "font.text_1.x", "0" }, @@ -4569,36 +4579,36 @@ struct ConfigInfo image_config[] = { "main.button.next_level.x", "448" }, { "main.button.next_level.y", "96" }, - { "main.text.name.x", "32" }, - { "main.text.name.y", "64" }, + { "main.text.name.x", "-1" }, + { "main.text.name.y", "-1" }, { "main.text.name.width", "-1" }, { "main.text.name.height", "-1" }, - { "main.text.levels.x", "32" }, - { "main.text.levels.y", "96" }, + { "main.text.levels.x", "-1" }, + { "main.text.levels.y", "-1" }, { "main.text.levels.width", "-1" }, { "main.text.levels.height", "-1" }, - { "main.text.scores.x", "32" }, - { "main.text.scores.y", "128" }, + { "main.text.scores.x", "-1" }, + { "main.text.scores.y", "-1" }, { "main.text.scores.width", "-1" }, { "main.text.scores.height", "-1" }, - { "main.text.editor.x", "32" }, - { "main.text.editor.y", "160" }, + { "main.text.editor.x", "-1" }, + { "main.text.editor.y", "-1" }, { "main.text.editor.width", "-1" }, { "main.text.editor.height", "-1" }, - { "main.text.info.x", "32" }, - { "main.text.info.y", "192" }, + { "main.text.info.x", "-1" }, + { "main.text.info.y", "-1" }, { "main.text.info.width", "-1" }, { "main.text.info.height", "-1" }, - { "main.text.game.x", "32" }, - { "main.text.game.y", "224" }, + { "main.text.game.x", "-1" }, + { "main.text.game.y", "-1" }, { "main.text.game.width", "-1" }, { "main.text.game.height", "-1" }, - { "main.text.setup.x", "32" }, - { "main.text.setup.y", "256" }, + { "main.text.setup.x", "-1" }, + { "main.text.setup.y", "-1" }, { "main.text.setup.width", "-1" }, { "main.text.setup.height", "-1" }, - { "main.text.quit.x", "32" }, - { "main.text.quit.y", "288" }, + { "main.text.quit.x", "-1" }, + { "main.text.quit.y", "-1" }, { "main.text.quit.width", "-1" }, { "main.text.quit.height", "-1" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 7c9d5286..1f0d5dc1 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1512,75 +1512,77 @@ #define IMG_FONT_TITLE_1 1491 #define IMG_FONT_TITLE_2 1492 #define IMG_FONT_MENU_1 1493 -#define IMG_FONT_MENU_2 1494 -#define IMG_FONT_TEXT_1 1495 -#define IMG_FONT_TEXT_1_LEVELS 1496 -#define IMG_FONT_TEXT_1_PREVIEW 1497 -#define IMG_FONT_TEXT_1_SCORES 1498 -#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1499 -#define IMG_FONT_TEXT_2 1500 -#define IMG_FONT_TEXT_2_LEVELS 1501 -#define IMG_FONT_TEXT_2_PREVIEW 1502 -#define IMG_FONT_TEXT_2_SCORES 1503 -#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1504 -#define IMG_FONT_TEXT_3 1505 -#define IMG_FONT_TEXT_3_LEVELS 1506 -#define IMG_FONT_TEXT_3_PREVIEW 1507 -#define IMG_FONT_TEXT_3_SCORES 1508 -#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1509 -#define IMG_FONT_TEXT_4 1510 -#define IMG_FONT_TEXT_4_LEVELS 1511 -#define IMG_FONT_TEXT_4_SCORES 1512 -#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1513 -#define IMG_FONT_ENVELOPE_1 1514 -#define IMG_FONT_ENVELOPE_2 1515 -#define IMG_FONT_ENVELOPE_3 1516 -#define IMG_FONT_ENVELOPE_4 1517 -#define IMG_FONT_INPUT_1 1518 -#define IMG_FONT_INPUT_1_MAIN 1519 -#define IMG_FONT_INPUT_1_ACTIVE 1520 -#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1521 -#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1522 -#define IMG_FONT_INPUT_2 1523 -#define IMG_FONT_INPUT_2_ACTIVE 1524 -#define IMG_FONT_OPTION_OFF 1525 -#define IMG_FONT_OPTION_ON 1526 -#define IMG_FONT_VALUE_1 1527 -#define IMG_FONT_VALUE_2 1528 -#define IMG_FONT_VALUE_OLD 1529 -#define IMG_FONT_LEVEL_NUMBER 1530 -#define IMG_FONT_TAPE_RECORDER 1531 -#define IMG_FONT_GAME_INFO 1532 -#define IMG_GLOBAL_BORDER 1533 -#define IMG_GLOBAL_DOOR 1534 -#define IMG_EDITOR_ELEMENT_BORDER 1535 -#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1536 -#define IMG_EDITOR_CASCADE_LIST 1537 -#define IMG_EDITOR_CASCADE_LIST_ACTIVE 1538 -#define IMG_BACKGROUND_ENVELOPE_1 1539 -#define IMG_BACKGROUND_ENVELOPE_2 1540 -#define IMG_BACKGROUND_ENVELOPE_3 1541 -#define IMG_BACKGROUND_ENVELOPE_4 1542 -#define IMG_TITLESCREEN_1 1543 -#define IMG_TITLESCREEN_2 1544 -#define IMG_TITLESCREEN_3 1545 -#define IMG_TITLESCREEN_4 1546 -#define IMG_TITLESCREEN_5 1547 -#define IMG_BACKGROUND 1548 -#define IMG_BACKGROUND_TITLE 1549 -#define IMG_BACKGROUND_MAIN 1550 -#define IMG_BACKGROUND_LEVELS 1551 -#define IMG_BACKGROUND_SCORES 1552 -#define IMG_BACKGROUND_EDITOR 1553 -#define IMG_BACKGROUND_INFO 1554 -#define IMG_BACKGROUND_INFO_ELEMENTS 1555 -#define IMG_BACKGROUND_INFO_MUSIC 1556 -#define IMG_BACKGROUND_INFO_CREDITS 1557 -#define IMG_BACKGROUND_INFO_PROGRAM 1558 -#define IMG_BACKGROUND_INFO_LEVELSET 1559 -#define IMG_BACKGROUND_SETUP 1560 -#define IMG_BACKGROUND_DOOR 1561 +#define IMG_FONT_MENU_1_ACTIVE 1494 +#define IMG_FONT_MENU_2 1495 +#define IMG_FONT_MENU_2_ACTIVE 1496 +#define IMG_FONT_TEXT_1 1497 +#define IMG_FONT_TEXT_1_LEVELS 1498 +#define IMG_FONT_TEXT_1_PREVIEW 1499 +#define IMG_FONT_TEXT_1_SCORES 1500 +#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1501 +#define IMG_FONT_TEXT_2 1502 +#define IMG_FONT_TEXT_2_LEVELS 1503 +#define IMG_FONT_TEXT_2_PREVIEW 1504 +#define IMG_FONT_TEXT_2_SCORES 1505 +#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1506 +#define IMG_FONT_TEXT_3 1507 +#define IMG_FONT_TEXT_3_LEVELS 1508 +#define IMG_FONT_TEXT_3_PREVIEW 1509 +#define IMG_FONT_TEXT_3_SCORES 1510 +#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1511 +#define IMG_FONT_TEXT_4 1512 +#define IMG_FONT_TEXT_4_LEVELS 1513 +#define IMG_FONT_TEXT_4_SCORES 1514 +#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1515 +#define IMG_FONT_ENVELOPE_1 1516 +#define IMG_FONT_ENVELOPE_2 1517 +#define IMG_FONT_ENVELOPE_3 1518 +#define IMG_FONT_ENVELOPE_4 1519 +#define IMG_FONT_INPUT_1 1520 +#define IMG_FONT_INPUT_1_MAIN 1521 +#define IMG_FONT_INPUT_1_ACTIVE 1522 +#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1523 +#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1524 +#define IMG_FONT_INPUT_2 1525 +#define IMG_FONT_INPUT_2_ACTIVE 1526 +#define IMG_FONT_OPTION_OFF 1527 +#define IMG_FONT_OPTION_ON 1528 +#define IMG_FONT_VALUE_1 1529 +#define IMG_FONT_VALUE_2 1530 +#define IMG_FONT_VALUE_OLD 1531 +#define IMG_FONT_LEVEL_NUMBER 1532 +#define IMG_FONT_TAPE_RECORDER 1533 +#define IMG_FONT_GAME_INFO 1534 +#define IMG_GLOBAL_BORDER 1535 +#define IMG_GLOBAL_DOOR 1536 +#define IMG_EDITOR_ELEMENT_BORDER 1537 +#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1538 +#define IMG_EDITOR_CASCADE_LIST 1539 +#define IMG_EDITOR_CASCADE_LIST_ACTIVE 1540 +#define IMG_BACKGROUND_ENVELOPE_1 1541 +#define IMG_BACKGROUND_ENVELOPE_2 1542 +#define IMG_BACKGROUND_ENVELOPE_3 1543 +#define IMG_BACKGROUND_ENVELOPE_4 1544 +#define IMG_TITLESCREEN_1 1545 +#define IMG_TITLESCREEN_2 1546 +#define IMG_TITLESCREEN_3 1547 +#define IMG_TITLESCREEN_4 1548 +#define IMG_TITLESCREEN_5 1549 +#define IMG_BACKGROUND 1550 +#define IMG_BACKGROUND_TITLE 1551 +#define IMG_BACKGROUND_MAIN 1552 +#define IMG_BACKGROUND_LEVELS 1553 +#define IMG_BACKGROUND_SCORES 1554 +#define IMG_BACKGROUND_EDITOR 1555 +#define IMG_BACKGROUND_INFO 1556 +#define IMG_BACKGROUND_INFO_ELEMENTS 1557 +#define IMG_BACKGROUND_INFO_MUSIC 1558 +#define IMG_BACKGROUND_INFO_CREDITS 1559 +#define IMG_BACKGROUND_INFO_PROGRAM 1560 +#define IMG_BACKGROUND_INFO_LEVELSET 1561 +#define IMG_BACKGROUND_SETUP 1562 +#define IMG_BACKGROUND_DOOR 1563 -#define NUM_IMAGE_FILES 1562 +#define NUM_IMAGE_FILES 1564 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index 02b85587..c33f5311 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-10-15 04:04]" +#define COMPILE_DATE_STRING "[2006-10-17 02:38]" diff --git a/src/init.c b/src/init.c index eb6b0374..b0d66991 100644 --- a/src/init.c +++ b/src/init.c @@ -250,7 +250,7 @@ void InitFontGraphicInfo() } } - /* initialize special element/graphic mapping from dynamic configuration */ + /* initialize special font/graphic mapping from dynamic configuration */ for (i = 0; i < num_property_mappings; i++) { int font_nr = property_mapping[i].base_index - MAX_NUM_ELEMENTS; @@ -268,6 +268,54 @@ void InitFontGraphicInfo() } } + /* reset non-redefined ".active" font graphics if normal font is redefined */ + /* (this different treatment is needed because normal and active fonts are + independently defined ("active" is not a property of font definitions!) */ + for (i = 0; i < NUM_FONTS; i++) + { + int font_nr_base = i; + int font_nr_active = FONT_ACTIVE(font_nr_base); + + /* check only those fonts with exist as normal and ".active" variant */ + if (font_nr_base != font_nr_active) + { + int base_graphic = font_info[font_nr_base].graphic; + int active_graphic = font_info[font_nr_active].graphic; + boolean base_redefined = + getImageListEntryFromImageID(base_graphic)->redefined; + boolean active_redefined = + getImageListEntryFromImageID(active_graphic)->redefined; + + /* if the base font ("font.menu_1", for example) has been redefined, + but not the active font ("font.menu_1.active", for example), do not + use an existing (in this case considered obsolete) active font + anymore, but use the automatically determined default font */ + if (base_redefined && !active_redefined) + font_info[font_nr_active].graphic = base_graphic; + + /* now also check each "special" font (which may be the same as above) */ + for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++) + { + int base_graphic = font_info[font_nr_base].special_graphic[j]; + int active_graphic = font_info[font_nr_active].special_graphic[j]; + boolean base_redefined = + getImageListEntryFromImageID(base_graphic)->redefined; + boolean active_redefined = + getImageListEntryFromImageID(active_graphic)->redefined; + + /* same as above, but check special graphic definitions, for example: + redefined "font.menu_1.MAIN" invalidates "font.menu_1.active.MAIN" */ + if (base_redefined && !active_redefined) + { + font_info[font_nr_active].special_graphic[j] = + font_info[font_nr_base].special_graphic[j]; + font_info[font_nr_active].special_bitmap_id[j] = + font_info[font_nr_base].special_bitmap_id[j]; + } + } + } + } + /* ---------- initialize font bitmap array ---------- */ if (font_bitmap_info != NULL) diff --git a/src/main.c b/src/main.c index 915ea749..bb45da54 100644 --- a/src/main.c +++ b/src/main.c @@ -4788,7 +4788,8 @@ struct TokenIntPtrInfo image_config_vars[] = /* ------------------------------------------------------------------------- */ /* Important: When one entry is a prefix of another entry, the longer entry - must come first, because the dynamic configuration does prefix matching! */ + must come first, because the dynamic configuration does prefix matching! + (These definitions must match the corresponding definitions in "main.h"!) */ struct FontInfo font_info[NUM_FONTS + 1] = { @@ -4798,6 +4799,8 @@ struct FontInfo font_info[NUM_FONTS + 1] = { "font.initial_4" }, { "font.title_1" }, { "font.title_2" }, + { "font.menu_1.active" }, + { "font.menu_2.active" }, { "font.menu_1" }, { "font.menu_2" }, { "font.text_1.active" }, diff --git a/src/main.h b/src/main.h index e8d5c40f..3c3a40fb 100644 --- a/src/main.h +++ b/src/main.h @@ -1658,44 +1658,59 @@ #define NUM_MUS_ARGS 1 -/* values for font configuration */ +/* values for font configuration (definitions must match those from main.c) */ #define FONT_INITIAL_1 0 #define FONT_INITIAL_2 1 #define FONT_INITIAL_3 2 #define FONT_INITIAL_4 3 #define FONT_TITLE_1 4 #define FONT_TITLE_2 5 -#define FONT_MENU_1 6 -#define FONT_MENU_2 7 -#define FONT_TEXT_1_ACTIVE 8 -#define FONT_TEXT_2_ACTIVE 9 -#define FONT_TEXT_3_ACTIVE 10 -#define FONT_TEXT_4_ACTIVE 11 -#define FONT_TEXT_1 12 -#define FONT_TEXT_2 13 -#define FONT_TEXT_3 14 -#define FONT_TEXT_4 15 -#define FONT_ENVELOPE_1 16 -#define FONT_ENVELOPE_2 17 -#define FONT_ENVELOPE_3 18 -#define FONT_ENVELOPE_4 19 -#define FONT_INPUT_1_ACTIVE 20 -#define FONT_INPUT_2_ACTIVE 21 -#define FONT_INPUT_1 22 -#define FONT_INPUT_2 23 -#define FONT_OPTION_OFF 24 -#define FONT_OPTION_ON 25 -#define FONT_VALUE_1 26 -#define FONT_VALUE_2 27 -#define FONT_VALUE_OLD 28 -#define FONT_LEVEL_NUMBER_ACTIVE 29 -#define FONT_LEVEL_NUMBER 30 -#define FONT_TAPE_RECORDER 31 -#define FONT_GAME_INFO 32 - -#define NUM_FONTS 33 +#define FONT_MENU_1_ACTIVE 6 +#define FONT_MENU_2_ACTIVE 7 +#define FONT_MENU_1 8 +#define FONT_MENU_2 9 +#define FONT_TEXT_1_ACTIVE 10 +#define FONT_TEXT_2_ACTIVE 11 +#define FONT_TEXT_3_ACTIVE 12 +#define FONT_TEXT_4_ACTIVE 13 +#define FONT_TEXT_1 14 +#define FONT_TEXT_2 15 +#define FONT_TEXT_3 16 +#define FONT_TEXT_4 17 +#define FONT_ENVELOPE_1 18 +#define FONT_ENVELOPE_2 19 +#define FONT_ENVELOPE_3 20 +#define FONT_ENVELOPE_4 21 +#define FONT_INPUT_1_ACTIVE 22 +#define FONT_INPUT_2_ACTIVE 23 +#define FONT_INPUT_1 24 +#define FONT_INPUT_2 25 +#define FONT_OPTION_OFF 26 +#define FONT_OPTION_ON 27 +#define FONT_VALUE_1 28 +#define FONT_VALUE_2 29 +#define FONT_VALUE_OLD 30 +#define FONT_LEVEL_NUMBER_ACTIVE 31 +#define FONT_LEVEL_NUMBER 32 +#define FONT_TAPE_RECORDER 33 +#define FONT_GAME_INFO 34 + +#define NUM_FONTS 35 #define NUM_INITIAL_FONTS 4 +#define FONT_ACTIVE(f) \ + ((f) == FONT_MENU_1 ? FONT_MENU_1_ACTIVE : \ + (f) == FONT_MENU_2 ? FONT_MENU_2_ACTIVE : \ + (f) == FONT_TEXT_1 ? FONT_TEXT_1_ACTIVE : \ + (f) == FONT_TEXT_2 ? FONT_TEXT_2_ACTIVE : \ + (f) == FONT_TEXT_3 ? FONT_TEXT_3_ACTIVE : \ + (f) == FONT_TEXT_4 ? FONT_TEXT_4_ACTIVE : \ + (f) == FONT_INPUT_1 ? FONT_INPUT_1_ACTIVE : \ + (f) == FONT_INPUT_2 ? FONT_INPUT_2_ACTIVE : \ + (f) == FONT_LEVEL_NUMBER ? FONT_LEVEL_NUMBER_ACTIVE : \ + (f)) + + /* values for game_status (must match special image configuration suffixes) */ #define GAME_MODE_DEFAULT 0 #define GAME_MODE_TITLE 1 diff --git a/src/screens.c b/src/screens.c index e8689508..be4f8a48 100644 --- a/src/screens.c +++ b/src/screens.c @@ -344,9 +344,9 @@ static void InitializeMainControls() struct Rect *pos_input = main_controls[i].pos_input; char *text = main_controls[i].text; char *input = main_controls[i].input; + int button_graphic = main_controls[i].button_graphic; int font_text = main_controls[i].font_text; int font_input = main_controls[i].font_input; - int button_graphic = main_controls[i].button_graphic; int font_text_width = (font_text != -1 ? getFontWidth(font_text) : 0); int font_text_height = (font_text != -1 ? getFontHeight(font_text) : 0); @@ -355,8 +355,10 @@ static void InitializeMainControls() int text_chars = (text != NULL ? strlen(text) : 0); int input_chars = (input != NULL ? strlen(input) : 0); - int button_width = graphic_info[button_graphic].width; - int button_height = graphic_info[button_graphic].height; + int button_width = + (button_graphic != -1 ? graphic_info[button_graphic].width : 0); + int button_height = + (button_graphic != -1 ? graphic_info[button_graphic].height : 0); int text_width = font_text_width * text_chars; int text_height = font_text_height; int input_width = font_input_width * input_chars; @@ -364,10 +366,12 @@ static void InitializeMainControls() if (nr == MAIN_CONTROL_NAME) { +#if 0 if (menu.main.input.name.x == -1) menu.main.input.name.x = menu.main.text.name.x + text_width; if (menu.main.input.name.y == -1) menu.main.input.name.y = menu.main.text.name.y; +#endif menu.main.input.name.width = font_input_width * MAX_PLAYER_NAME_LEN; menu.main.input.name.height = font_input_height; @@ -383,6 +387,11 @@ static void InitializeMainControls() if (pos_text != NULL) { + if (pos_text->x == -1 && pos_button != NULL) + pos_text->x = pos_button->x + pos_button->width; + if (pos_text->y == -1 && pos_button != NULL) + pos_text->y = pos_button->y; + if (pos_text->width == -1) pos_text->width = text_width; if (pos_text->height == -1) @@ -391,6 +400,11 @@ static void InitializeMainControls() if (pos_input != NULL) { + if (pos_input->x == -1 && pos_text != NULL) + pos_input->x = pos_text->x + pos_text->width; + if (pos_input->y == -1 && pos_text != NULL) + pos_input->y = pos_text->y; + if (pos_input->width == -1) pos_input->width = input_width; if (pos_input->height == -1) @@ -399,7 +413,7 @@ static void InitializeMainControls() } } -static void DrawMainControlButton(int pos, boolean active) +static void DrawCursorAndText_Main(int pos, boolean active) { int i; @@ -408,15 +422,26 @@ static void DrawMainControlButton(int pos, boolean active) if (main_controls[i].nr == pos) { struct Rect *pos_button = main_controls[i].pos_button; - int graphic = main_controls[i].button_graphic; - int x = mSX + pos_button->x; - int y = mSY + pos_button->y; + struct Rect *pos_text = main_controls[i].pos_text; + char *text = main_controls[i].text; + int font_text = main_controls[i].font_text; + int button_graphic = main_controls[i].button_graphic; + int button_x = mSX + pos_button->x; + int button_y = mSY + pos_button->y; + int text_x = mSX + pos_text->x; + int text_y = mSY + pos_text->y; if (active) - graphic = BUTTON_GRAPHIC_ACTIVE(graphic); + { + button_graphic = BUTTON_GRAPHIC_ACTIVE(button_graphic); + font_text = FONT_ACTIVE(font_text); + } - DrawBackground(x, y, pos_button->width, pos_button->height); - DrawGraphicThruMaskExt(drawto, x, y, graphic, 0); + DrawBackground(button_x, button_y, pos_button->width, pos_button->height); + DrawGraphicThruMaskExt(drawto, button_x, button_y, button_graphic, 0); + + DrawBackground(text_x, text_y, pos_text->width, pos_text->height); + DrawText(text_x, text_y, text, font_text); break; } @@ -430,50 +455,50 @@ static boolean insideRect(struct Rect *rect, int x, int y) y >= rect->y && y < rect->y + rect->height); } -static void drawCursorExt(int xpos, int ypos, int color, int g) +static void drawCursorExt(int xpos, int ypos, boolean active, int graphic) { static int cursor_array[SCR_FIELDY]; + int x = mSX + TILEX * xpos; + int y = mSY + TILEY * (MENU_SCREEN_START_YPOS + ypos); if (xpos == 0) { - if (g != 0) - cursor_array[ypos] = g; + if (graphic != -1) + cursor_array[ypos] = graphic; else - g = cursor_array[ypos]; + graphic = cursor_array[ypos]; } - if (color == FC_RED) - g = BUTTON_GRAPHIC_ACTIVE(g); - - ypos += MENU_SCREEN_START_YPOS; + if (active) + graphic = BUTTON_GRAPHIC_ACTIVE(graphic); - DrawBackground(mSX + xpos * TILEX, mSY + ypos * TILEY, TILEX, TILEY); - DrawGraphicThruMaskExt(drawto, mSX + xpos * TILEX, mSY + ypos * TILEY, g, 0); + DrawBackground(x, y, TILEX, TILEY); + DrawGraphicThruMaskExt(drawto, x, y, graphic, 0); } static void initCursor(int ypos, int graphic) { - drawCursorExt(0, ypos, FC_BLUE, graphic); + drawCursorExt(0, ypos, FALSE, graphic); } -static void drawCursor(int ypos, int color) +static void drawCursor(int ypos, boolean active) { - drawCursorExt(0, ypos, color, 0); + drawCursorExt(0, ypos, active, -1); } static void drawCursorXY(int xpos, int ypos, int graphic) { - drawCursorExt(xpos, ypos, -1, graphic); + drawCursorExt(xpos, ypos, FALSE, graphic); } -static void drawChooseTreeCursor(int ypos, int color) +static void drawChooseTreeCursor(int ypos, boolean active) { int last_game_status = game_status; /* save current game status */ /* force LEVELS draw offset on artwork setup screen */ game_status = GAME_MODE_LEVELS; - drawCursorExt(0, ypos, color, 0); + drawCursorExt(0, ypos, active, 0); game_status = last_game_status; /* restore current game status */ } @@ -644,9 +669,9 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) struct Rect *pos_input = main_controls[i].pos_input; char *text = main_controls[i].text; char *input = main_controls[i].input; + int button_graphic = main_controls[i].button_graphic; int font_text = main_controls[i].font_text; int font_input = main_controls[i].font_input; - int button_graphic = main_controls[i].button_graphic; if (pos_button != NULL) DrawGraphicThruMaskExt(drawto, mSX + pos_button->x, mSY + pos_button->y, @@ -931,7 +956,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) if (button == MB_MENU_INITIALIZE) { - DrawMainControlButton(choice, TRUE); + DrawCursorAndText_Main(choice, TRUE); return; } @@ -971,8 +996,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) { if (pos != choice) { - DrawMainControlButton(pos, TRUE); - DrawMainControlButton(choice, FALSE); + DrawCursorAndText_Main(choice, FALSE); + DrawCursorAndText_Main(pos, TRUE); choice = pos; } @@ -1063,7 +1088,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) if (button == MB_MENU_INITIALIZE) { - drawCursor(choice, FC_RED); + drawCursor(choice, TRUE); + return; } @@ -1096,8 +1122,9 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) { if (y != choice) { - drawCursor(y, FC_RED); - drawCursor(choice, FC_BLUE); + drawCursor(choice, FALSE); + drawCursor(y, TRUE); + choice = y; } } @@ -1237,6 +1264,21 @@ static struct TokenInfo info_info_main[] = { 0, NULL, NULL } }; +static void DrawCursorAndText_Info(int pos, boolean active) +{ + int xpos = MENU_SCREEN_START_XPOS; + int ypos = MENU_SCREEN_START_YPOS + pos; + int font_nr = FONT_MENU_1; + + if (active) + font_nr = FONT_ACTIVE(font_nr); + + DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[pos].text, font_nr); + + if (info_info[pos].type & ~TYPE_SKIP_ENTRY) + drawCursor(pos, active); +} + static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading) { int i; @@ -1253,11 +1295,11 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading) for (i = 0; info_info[i].type != 0 && i < NUM_MENU_ENTRIES_ON_SCREEN; i++) { +#if 0 int xpos = MENU_SCREEN_START_XPOS; int ypos = MENU_SCREEN_START_YPOS + i; int font_nr = FONT_MENU_1; - - DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[i].text, font_nr); +#endif if (info_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST)) initCursor(i, IMG_MENU_BUTTON_ENTER_MENU); @@ -1266,6 +1308,12 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading) else if (info_info[i].type & ~TYPE_SKIP_ENTRY) initCursor(i, IMG_MENU_BUTTON); +#if 1 + DrawCursorAndText_Info(i, FALSE); +#else + DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[i].text, font_nr); +#endif + num_info_info++; } @@ -1299,7 +1347,12 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button) choice++; choice_store[info_mode] = choice; - drawCursor(choice, FC_RED); +#if 1 + DrawCursorAndText_Info(choice, TRUE); +#else + drawCursor(choice, TRUE); +#endif + return; } else if (button == MB_MENU_LEAVE) @@ -1311,6 +1364,7 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button) void (*menu_callback_function)(void) = info_info[y].value; menu_callback_function(); + break; /* absolutely needed because function changes 'info_info'! */ } } @@ -1350,8 +1404,14 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button) { if (y != choice) { - drawCursor(y, FC_RED); - drawCursor(choice, FC_BLUE); +#if 1 + DrawCursorAndText_Info(choice, FALSE); + DrawCursorAndText_Info(y, TRUE); +#else + drawCursor(choice, FALSE); + drawCursor(y, TRUE); +#endif + choice = choice_store[info_mode] = y; } } @@ -3073,6 +3133,26 @@ static struct TokenInfo setup_info_artwork[] = { 0, NULL, NULL } }; +static struct TokenInfo setup_info_input[] = +{ + { TYPE_SWITCH, NULL, "Player:" }, + { TYPE_SWITCH, NULL, "Device:" }, + { TYPE_ENTER_MENU, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_LEAVE_MENU, execSetupMain, "Back" }, + + { 0, NULL, NULL } +}; + static struct TokenInfo setup_info_shortcut_1[] = { { TYPE_KEYTEXT, NULL, "Quick Save Game to Tape:", }, @@ -3289,6 +3369,24 @@ static void changeSetupValue(int pos) drawSetupValue(pos); } +static void DrawCursorAndText_Setup(int pos, boolean active) +{ + int xpos = MENU_SCREEN_START_XPOS; + int ypos = MENU_SCREEN_START_YPOS + pos; + int font_nr = getSetupTextFont(setup_info[pos].type); + + if (setup_info == setup_info_input) + font_nr = FONT_MENU_1; + + if (active) + font_nr = FONT_ACTIVE(font_nr); + + DrawText(mSX + xpos * 32, mSY + ypos * 32, setup_info[pos].text, font_nr); + + if (setup_info[pos].type & ~TYPE_SKIP_ENTRY) + drawCursor(pos, active); +} + static void DrawSetupScreen_Generic() { char *title_string = NULL; @@ -3346,9 +3444,12 @@ static void DrawSetupScreen_Generic() for (i = 0; setup_info[i].type != 0 && i < NUM_MENU_ENTRIES_ON_SCREEN; i++) { void *value_ptr = setup_info[i].value; +#if 1 +#else int xpos = MENU_SCREEN_START_XPOS; int ypos = MENU_SCREEN_START_YPOS + i; int font_nr; +#endif /* set some entries to "unchangeable" according to other variables */ if ((value_ptr == &setup.sound_simple && !audio.sound_available) || @@ -3358,10 +3459,6 @@ static void DrawSetupScreen_Generic() (value_ptr == &screen_mode_text && !video.fullscreen_available)) setup_info[i].type |= TYPE_GHOSTED; - font_nr = getSetupTextFont(setup_info[i].type); - - DrawText(mSX + xpos * 32, mSY + ypos * 32, setup_info[i].text, font_nr); - if (setup_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST)) initCursor(i, IMG_MENU_BUTTON_ENTER_MENU); else if (setup_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST)) @@ -3369,6 +3466,14 @@ static void DrawSetupScreen_Generic() else if (setup_info[i].type & ~TYPE_SKIP_ENTRY) initCursor(i, IMG_MENU_BUTTON); +#if 1 + DrawCursorAndText_Setup(i, FALSE); +#else + font_nr = getSetupTextFont(setup_info[i].type); + + DrawText(mSX + xpos * 32, mSY + ypos * 32, setup_info[i].text, font_nr); +#endif + if (setup_info[i].type & TYPE_VALUE) drawSetupValue(i); @@ -3400,7 +3505,11 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button) choice++; choice_store[setup_mode] = choice; - drawCursor(choice, FC_RED); +#if 1 + DrawCursorAndText_Setup(choice, TRUE); +#else + drawCursor(choice, TRUE); +#endif return; } @@ -3451,8 +3560,14 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button) { if (y != choice && setup_info[y].type & ~TYPE_SKIP_ENTRY) { - drawCursor(y, FC_RED); - drawCursor(choice, FC_BLUE); +#if 1 + DrawCursorAndText_Setup(choice, FALSE); + DrawCursorAndText_Setup(y, TRUE); +#else + drawCursor(choice, FALSE); + drawCursor(y, TRUE); +#endif + choice = choice_store[setup_mode] = y; } } @@ -3485,10 +3600,31 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button) void DrawSetupScreen_Input() { +#if 1 + int i; +#endif + ClearWindow(); +#if 1 + setup_info = setup_info_input; +#endif + DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, "Setup Input"); +#if 1 + for (i = 0; setup_info[i].type != 0 && i < NUM_MENU_ENTRIES_ON_SCREEN; i++) + { + if (setup_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST)) + initCursor(i, IMG_MENU_BUTTON_ENTER_MENU); + else if (setup_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST)) + initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU); + else if (setup_info[i].type & ~TYPE_SKIP_ENTRY) + initCursor(i, IMG_MENU_BUTTON); + + DrawCursorAndText_Setup(i, FALSE); + } +#else initCursor(0, IMG_MENU_BUTTON); initCursor(1, IMG_MENU_BUTTON); initCursor(2, IMG_MENU_BUTTON_ENTER_MENU); @@ -3497,6 +3633,7 @@ void DrawSetupScreen_Input() DrawText(mSX + 32, mSY + 2 * 32, "Player:", FONT_MENU_1); DrawText(mSX + 32, mSY + 3 * 32, "Device:", FONT_MENU_1); DrawText(mSX + 32, mSY + 15 * 32, "Back", FONT_MENU_1); +#endif #if 0 DeactivateJoystickForCalibration(); @@ -3539,7 +3676,7 @@ static void setJoystickDeviceToNr(char *device_name, int device_nr) strlen(device_name)); } -static void drawPlayerSetupInputInfo(int player_nr) +static void drawPlayerSetupInputInfo(int player_nr, boolean active) { int i; static struct SetupKeyboardInfo custom_key; @@ -3563,6 +3700,7 @@ static void drawPlayerSetupInputInfo(int player_nr) "Joystick3", "Joystick4" }; + int text_font_nr = (active ? FONT_MENU_1_ACTIVE : FONT_MENU_1); InitJoysticks(); @@ -3583,19 +3721,21 @@ static void drawPlayerSetupInputInfo(int player_nr) int font_nr = (joystick.fd[player_nr] < 0 ? FONT_VALUE_OLD : FONT_VALUE_1); DrawText(mSX + 8 * 32, mSY + 3 * 32, text, font_nr); - DrawText(mSX + 32, mSY + 4 * 32, "Calibrate", FONT_MENU_1); + DrawText(mSX + 32, mSY + 4 * 32, "Calibrate", text_font_nr); } else { DrawText(mSX + 8 * 32, mSY + 3 * 32, "Keyboard ", FONT_VALUE_1); - DrawText(mSX + 1 * 32, mSY + 4 * 32, "Customize", FONT_MENU_1); + DrawText(mSX + 1 * 32, mSY + 4 * 32, "Customize", text_font_nr); } DrawText(mSX + 32, mSY + 5 * 32, "Actual Settings:", FONT_MENU_1); + drawCursorXY(1, 4, IMG_MENU_BUTTON_LEFT); drawCursorXY(1, 5, IMG_MENU_BUTTON_RIGHT); drawCursorXY(1, 6, IMG_MENU_BUTTON_UP); drawCursorXY(1, 7, IMG_MENU_BUTTON_DOWN); + DrawText(mSX + 2 * 32, mSY + 6 * 32, ":", FONT_VALUE_OLD); DrawText(mSX + 2 * 32, mSY + 7 * 32, ":", FONT_VALUE_OLD); DrawText(mSX + 2 * 32, mSY + 8 * 32, ":", FONT_VALUE_OLD); @@ -3633,7 +3773,7 @@ void HandleSetupScreen_Input_Player(int step, int direction) { input_player_nr = new_player_nr; - drawPlayerSetupInputInfo(input_player_nr); + drawPlayerSetupInputInfo(input_player_nr, FALSE); } } @@ -3649,8 +3789,13 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) if (button == MB_MENU_INITIALIZE) { - drawPlayerSetupInputInfo(input_player_nr); - drawCursor(choice, FC_RED); + drawPlayerSetupInputInfo(input_player_nr, (choice == 2)); + +#if 1 + DrawCursorAndText_Setup(choice, TRUE); +#else + drawCursor(choice, TRUE); +#endif return; } @@ -3695,8 +3840,16 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) { if (y != choice) { - drawCursor(y, FC_RED); - drawCursor(choice, FC_BLUE); +#if 1 + DrawCursorAndText_Setup(choice, FALSE); + DrawCursorAndText_Setup(y, TRUE); + + drawPlayerSetupInputInfo(input_player_nr, (y == 2)); +#else + drawCursor(choice, FALSE); + drawCursor(y, TRUE); +#endif + choice = y; } } @@ -3724,7 +3877,7 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) setJoystickDeviceToNr(device_name, new_device_nr); } - drawPlayerSetupInputInfo(input_player_nr); + drawPlayerSetupInputInfo(input_player_nr, FALSE); } else if (y == 2) { diff --git a/src/tools.c b/src/tools.c index ff28a2c1..32f7b638 100644 --- a/src/tools.c +++ b/src/tools.c @@ -194,14 +194,20 @@ void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height) BlitBitmap(drawto, window, x, y, width, height, x, y); } +void DrawMaskedBorder_Rect(int x, int y, int width, int height) +{ + Bitmap *bitmap = graphic_info[IMG_GLOBAL_BORDER].bitmap; + + SetClipOrigin(bitmap, bitmap->stored_clip_gc, 0, 0); + BlitBitmapMasked(bitmap, backbuffer, x, y, width, height, x, y); +} + void DrawMaskedBorder_FIELD() { if (game_status >= GAME_MODE_TITLE && game_status <= GAME_MODE_PLAYING && border.draw_masked[game_status]) - BlitBitmapMasked(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer, - REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, - REAL_SX, REAL_SY); + DrawMaskedBorder_Rect(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); } void DrawMaskedBorder_DOOR_1() @@ -209,16 +215,14 @@ void DrawMaskedBorder_DOOR_1() if (border.draw_masked[GFX_SPECIAL_ARG_DOOR] && (game_status != GAME_MODE_EDITOR || border.draw_masked[GFX_SPECIAL_ARG_EDITOR])) - BlitBitmapMasked(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer, - DX, DY, DXSIZE, DYSIZE, DX, DY); + DrawMaskedBorder_Rect(DX, DY, DXSIZE, DYSIZE); } void DrawMaskedBorder_DOOR_2() { if (border.draw_masked[GFX_SPECIAL_ARG_DOOR] && game_status != GAME_MODE_EDITOR) - BlitBitmapMasked(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer, - VX, VY, VXSIZE, VYSIZE, VX, VY); + DrawMaskedBorder_Rect(VX, VY, VXSIZE, VYSIZE); } void DrawMaskedBorder_DOOR_3() -- 2.34.1