diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 7d75068a54..eea743b0ae 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -675,10 +675,10 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) for (i = 0; i < RCT_EXPENDITURE_TYPE_COUNT; i++) { // Darken every even row if (i % 2 == 0) - gfx_fill_rect(dpi, x, y - 1, x + 513 - 2, y + (ROW_HEIGHT - 2), ColourMapA[w->colours[1]].lighter | 0x1000000); + gfx_fill_rect(dpi, x, y - 1, x + 513 - 2, y + (TABLE_CELL_HEIGHT - 2), ColourMapA[w->colours[1]].lighter | 0x1000000); gfx_draw_string_left(dpi, window_finances_summary_row_labels[i], nullptr, COLOUR_BLACK, x, y - 1); - y += ROW_HEIGHT; + y += TABLE_CELL_HEIGHT; } // Expenditure / Income values for each month @@ -721,7 +721,7 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) y ); } - y += ROW_HEIGHT; + y += TABLE_CELL_HEIGHT; } y += 4; @@ -1132,7 +1132,7 @@ static void window_finances_marketing_invalidate(rct_window *w) if (gMarketingCampaignDaysLeft[i] != 0) numActiveCampaigns++; - sint32 y = Math::Max(1, numActiveCampaigns) * ROW_HEIGHT + 92; + sint32 y = Math::Max(1, numActiveCampaigns) * LIST_ROW_HEIGHT + 92; // Update group box positions window_finances_marketing_widgets[WIDX_ACTIVE_CAMPAIGNS_GROUP].bottom = y - 22; @@ -1153,8 +1153,8 @@ static void window_finances_marketing_invalidate(rct_window *w) campaignButton->type = WWT_DROPDOWN_BUTTON; campaignButton->top = y; - campaignButton->bottom = y + ROW_HEIGHT + 1; - y += ROW_HEIGHT + 2; + campaignButton->bottom = y + BUTTON_FACE_HEIGHT + 1; + y += BUTTON_FACE_HEIGHT + 2; } } @@ -1202,12 +1202,12 @@ static void window_finances_marketing_paint(rct_window *w, rct_drawpixelinfo *dp weeksRemaining = (gMarketingCampaignDaysLeft[i] % 128); gfx_draw_string_left(dpi, weeksRemaining == 1 ? STR_1_WEEK_REMAINING : STR_X_WEEKS_REMAINING, &weeksRemaining, COLOUR_BLACK, x + 304, y); - y += ROW_HEIGHT; + y += LIST_ROW_HEIGHT; } if (noCampaignsActive) { gfx_draw_string_left(dpi, STR_MARKETING_CAMPAIGNS_NONE, nullptr, COLOUR_BLACK, x + 4, y); - y += ROW_HEIGHT; + y += LIST_ROW_HEIGHT; } y += 34; @@ -1224,7 +1224,7 @@ static void window_finances_marketing_paint(rct_window *w, rct_drawpixelinfo *dp gfx_draw_string_left(dpi, MarketingCampaignNames[i][0], nullptr, COLOUR_BLACK, x + 4, y); gfx_draw_string_left(dpi, STR_MARKETING_PER_WEEK, &pricePerWeek, COLOUR_BLACK, x + 310, y); - y += ROW_HEIGHT + 2; + y += BUTTON_FACE_HEIGHT + 2; } } diff --git a/src/openrct2-ui/windows/ShortcutKeys.cpp b/src/openrct2-ui/windows/ShortcutKeys.cpp index e20c3659a1..ff12fb6c33 100644 --- a/src/openrct2-ui/windows/ShortcutKeys.cpp +++ b/src/openrct2-ui/windows/ShortcutKeys.cpp @@ -241,7 +241,7 @@ static void window_shortcut_tooltip(rct_window* w, rct_widgetindex widgetIndex, */ static void window_shortcut_scrollgetsize(rct_window *w, sint32 scrollIndex, sint32 *width, sint32 *height) { - *height = w->no_list_items * ROW_HEIGHT; + *height = w->no_list_items * SCROLLABLE_ROW_HEIGHT; } /** @@ -250,7 +250,7 @@ static void window_shortcut_scrollgetsize(rct_window *w, sint32 scrollIndex, sin */ static void window_shortcut_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y) { - sint32 selected_item = (y - 1) / ROW_HEIGHT; + sint32 selected_item = (y - 1) / SCROLLABLE_ROW_HEIGHT; if (selected_item >= w->no_list_items) return; @@ -263,7 +263,7 @@ static void window_shortcut_scrollmousedown(rct_window *w, sint32 scrollIndex, s */ static void window_shortcut_scrollmouseover(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y) { - sint32 selected_item = (y - 1) / ROW_HEIGHT; + sint32 selected_item = (y - 1) / SCROLLABLE_ROW_HEIGHT; if (selected_item >= w->no_list_items) return; @@ -282,13 +282,13 @@ static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, s for (sint32 i = 0; i < w->no_list_items; ++i) { - sint32 y = 1 + i * ROW_HEIGHT; + sint32 y = 1 + i * SCROLLABLE_ROW_HEIGHT; if (y > dpi->y + dpi->height) { break; } - if (y + ROW_HEIGHT < dpi->y) + if (y + SCROLLABLE_ROW_HEIGHT < dpi->y) { continue; } @@ -297,7 +297,7 @@ static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, s if (i == w->selected_list_item) { format = STR_WINDOW_COLOUR_2_STRINGID; - gfx_filter_rect(dpi, 0, y - 1, 800, y + (ROW_HEIGHT - 2), PALETTE_DARKEN_1); + gfx_filter_rect(dpi, 0, y - 1, 800, y + (SCROLLABLE_ROW_HEIGHT - 2), PALETTE_DARKEN_1); } char templateString[128]; diff --git a/src/openrct2-ui/windows/TitleEditor.cpp b/src/openrct2-ui/windows/TitleEditor.cpp index 463f5cb3da..13306b3a92 100644 --- a/src/openrct2-ui/windows/TitleEditor.cpp +++ b/src/openrct2-ui/windows/TitleEditor.cpp @@ -559,7 +559,7 @@ static void window_title_editor_scrollgetsize(rct_window *w, sint32 scrollIndex, lineCount = _editingTitleSequence->NumCommands; } - *height = (sint32)(lineCount * ROW_HEIGHT); + *height = (sint32)(lineCount * SCROLLABLE_ROW_HEIGHT); sint32 i = *height - window_title_editor_widgets[WIDX_TITLE_EDITOR_LIST].bottom + window_title_editor_widgets[WIDX_TITLE_EDITOR_LIST].top + 21; if (i < 0) { i = 0; @@ -574,7 +574,7 @@ static void window_title_editor_scrollgetsize(rct_window *w, sint32 scrollIndex, static void window_title_editor_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y) { - sint32 index = y / ROW_HEIGHT; + sint32 index = y / SCROLLABLE_ROW_HEIGHT; w->selected_list_item = -1; switch (w->selected_tab) { case WINDOW_TITLE_EDITOR_TAB_SAVES: @@ -594,7 +594,7 @@ static void window_title_editor_scrollmousedown(rct_window *w, sint32 scrollInde static void window_title_editor_scrollmouseover(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y) { - sint32 index = y / ROW_HEIGHT; + sint32 index = y / SCROLLABLE_ROW_HEIGHT; switch (w->selected_tab) { case WINDOW_TITLE_EDITOR_TAB_SAVES: if (index < (sint32)_editingTitleSequence->NumSaves) @@ -806,17 +806,17 @@ static void window_title_editor_scrollpaint_saves(rct_window *w, rct_drawpixelin if (_editingTitleSequence == nullptr) { return; } - for (sint32 i = 0; i < (sint32)_editingTitleSequence->NumSaves; i++, y += ROW_HEIGHT) { + for (sint32 i = 0; i < (sint32)_editingTitleSequence->NumSaves; i++, y += SCROLLABLE_ROW_HEIGHT) { bool selected = false; bool hover = false; if (i == w->selected_list_item) { selected = true; - gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].dark); + gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].dark); } else if (i == _window_title_editor_highlighted_index || i == currentSaveIndex) { hover = true; - gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].mid_dark); + gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].mid_dark); } else if (i & 1) { - gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000); + gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000); } char buffer[256]; @@ -842,19 +842,19 @@ static void window_title_editor_scrollpaint_commands(rct_window *w, rct_drawpixe sint32 x = 0; sint32 y = 0; - for (sint32 i = 0; i < (sint32)_editingTitleSequence->NumCommands; i++, y += ROW_HEIGHT) { + for (sint32 i = 0; i < (sint32)_editingTitleSequence->NumCommands; i++, y += SCROLLABLE_ROW_HEIGHT) { TitleCommand * command = &_editingTitleSequence->Commands[i]; bool selected = false; bool hover = false; bool error = false; if (i == w->selected_list_item) { selected = true; - gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].dark); + gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].dark); } else if (i == (sint32)_window_title_editor_highlighted_index || i == position) { hover = true; - gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].mid_dark); + gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].mid_dark); } else if (i & 1) { - gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000); + gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000); } rct_string_id commandName = STR_NONE; diff --git a/src/openrct2/interface/window.h b/src/openrct2/interface/window.h index 945efb47b1..f1371e15c4 100644 --- a/src/openrct2/interface/window.h +++ b/src/openrct2/interface/window.h @@ -35,7 +35,10 @@ struct TitleSequence; struct TextInputSession; typedef struct scenario_index_entry scenario_index_entry; -#define ROW_HEIGHT 12 +#define SCROLLABLE_ROW_HEIGHT 12 +#define LIST_ROW_HEIGHT 12 +#define TABLE_CELL_HEIGHT 12 +#define BUTTON_FACE_HEIGHT 12 #define TEXT_INPUT_SIZE 1024 #define TOP_TOOLBAR_HEIGHT 27