static void window_dropdown_paint(rct_window *w, rct_drawpixelinfo *dpi) { int cell_x, cell_y, l, t, r, b, item, image, colour; window_draw_widgets(w, dpi); int highlightedIndex = gDropdownHighlightedIndex; for (int i = 0; i < gDropdownNumItems; i++) { cell_x = i % _dropdown_num_columns; cell_y = i / _dropdown_num_columns; if (gDropdownItemsFormat[i] == DROPDOWN_SEPARATOR) { l = w->x + 2 + (cell_x * _dropdown_item_width); t = w->y + 2 + (cell_y * _dropdown_item_height); r = l + _dropdown_item_width - 1; t += (_dropdown_item_height / 2); b = t; if (w->colours[0] & 0x80) { gfx_fill_rect(dpi, l, t, r, b, (RCT2_ADDRESS(0x009DEDF4, uint8)[w->colours[0]] | 0x02000000) + 1); gfx_fill_rect(dpi, l, t + 1, r, b + 1, (RCT2_ADDRESS(0x009DEDF4, uint8)[w->colours[0]] | 0x02000000) + 2); } else { gfx_fill_rect(dpi, l, t, r, b, ColourMapA[w->colours[0]].mid_dark); gfx_fill_rect(dpi, l, t + 1, r, b + 1, ColourMapA[w->colours[0]].lightest); } } else { // if (i == highlightedIndex) { l = w->x + 2 + (cell_x * _dropdown_item_width); t = w->y + 2 + (cell_y * _dropdown_item_height); r = l + _dropdown_item_width - 1; b = t + _dropdown_item_height - 1; gfx_fill_rect(dpi, l, t, r, b, 0x2000000 | 0x2F); } item = gDropdownItemsFormat[i]; if (item == (uint16)-1 || item == (uint16)-2) { // Image item image = (uint32)gDropdownItemsArgs[i]; if (item == (uint16)-2 && highlightedIndex == i) image++; gfx_draw_sprite( dpi, image, w->x + 2 + (cell_x * _dropdown_item_width), w->y + 2 + (cell_y * _dropdown_item_height), 0 ); } else { // Text item if (i < 64) { if (dropdown_is_checked(i)) { item++; } } // Calculate colour colour = w->colours[0] & 0x7F; if (i == highlightedIndex) colour = 2; if (dropdown_is_disabled(i)) if (i < 64) colour = (w->colours[0] & 0x7F) | 0x40; // Draw item string gfx_draw_string_left_clipped( dpi, item, (void*)(&gDropdownItemsArgs[i]), colour, w->x + 2 + (cell_x * _dropdown_item_width), w->y + 1 + (cell_y * _dropdown_item_height), w->width - 5 ); } } } }
static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi) { int32_t cell_x, cell_y, l, t, r, b, item, image, colour; window_draw_widgets(w, dpi); int32_t highlightedIndex = gDropdownHighlightedIndex; for (int32_t i = 0; i < gDropdownNumItems; i++) { if (_dropdown_list_vertically) { cell_x = i / _dropdown_num_rows; cell_y = i % _dropdown_num_rows; } else { cell_x = i % _dropdown_num_columns; cell_y = i / _dropdown_num_columns; } if (gDropdownItemsFormat[i] == DROPDOWN_SEPARATOR) { l = w->x + 2 + (cell_x * _dropdown_item_width); t = w->y + 2 + (cell_y * _dropdown_item_height); r = l + _dropdown_item_width - 1; t += (_dropdown_item_height / 2); b = t; if (w->colours[0] & COLOUR_FLAG_TRANSLUCENT) { translucent_window_palette palette = TranslucentWindowPalettes[BASE_COLOUR(w->colours[0])]; gfx_filter_rect(dpi, l, t, r, b, palette.highlight); gfx_filter_rect(dpi, l, t + 1, r, b + 1, palette.shadow); } else { gfx_fill_rect(dpi, l, t, r, b, ColourMapA[w->colours[0]].mid_dark); gfx_fill_rect(dpi, l, t + 1, r, b + 1, ColourMapA[w->colours[0]].lightest); } } else { // if (i == highlightedIndex) { l = w->x + 2 + (cell_x * _dropdown_item_width); t = w->y + 2 + (cell_y * _dropdown_item_height); r = l + _dropdown_item_width - 1; b = t + _dropdown_item_height - 1; gfx_filter_rect(dpi, l, t, r, b, PALETTE_DARKEN_3); } item = gDropdownItemsFormat[i]; if (item == DROPDOWN_FORMAT_LAND_PICKER || item == DROPDOWN_FORMAT_COLOUR_PICKER) { // Image item image = (uint32_t)gDropdownItemsArgs[i]; if (item == DROPDOWN_FORMAT_COLOUR_PICKER && highlightedIndex == i) image++; gfx_draw_sprite( dpi, image, w->x + 2 + (cell_x * _dropdown_item_width), w->y + 2 + (cell_y * _dropdown_item_height), 0); } else { // Text item if (i < DROPDOWN_ITEMS_MAX_SIZE) { if (dropdown_is_checked(i)) { item++; } } // Calculate colour colour = NOT_TRANSLUCENT(w->colours[0]); if (i == highlightedIndex) colour = COLOUR_WHITE; if (dropdown_is_disabled(i)) if (i < DROPDOWN_ITEMS_MAX_SIZE) colour = NOT_TRANSLUCENT(w->colours[0]) | COLOUR_FLAG_INSET; // Draw item string gfx_draw_string_left_clipped( dpi, item, (void*)(&gDropdownItemsArgs[i]), colour, w->x + 2 + (cell_x * _dropdown_item_width), w->y + 2 + (cell_y * _dropdown_item_height), w->width - 5); } } } }