/** * * rct2: 0x006EBAD9 */ static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex) { // Get the widget rct_widget *widget = &w->widgets[widgetIndex]; // Resolve the absolute ltb sint32 l = w->x + widget->left; sint32 t = w->y + widget->top; sint32 b = w->y + widget->bottom; sint32 yMid = (b + t) / 2; // Get the colour uint8 colour = w->colours[widget->colour]; if (widget->type != WWT_24) { // checkbox gfx_fill_rect_inset(dpi, l, yMid - 5, l + 9, yMid + 4, colour, INSET_RECT_F_60); // fill it when checkbox is pressed if (widget_is_pressed(w, widgetIndex)) { gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM; gfx_draw_string(dpi, (char*)CheckBoxMarkString, NOT_TRANSLUCENT(colour), l, yMid - 5); } } // draw the text if (widget->text == STR_NONE) return; if (widget_is_disabled(w, widgetIndex)) { colour |= COLOUR_FLAG_INSET; } gfx_draw_string_left_centred(dpi, widget->text, gCommonFormatArgs, colour, l + 14, yMid); }
/** * * rct2: 0x006EB951 */ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex) { // Get the widget rct_widget *widget = &w->widgets[widgetIndex]; // Get the image sint32 image = widget->image; if (image == SPR_NONE) return; // Resolve the absolute ltrb sint32 l = w->x + widget->left; sint32 t = w->y + widget->top; // Get the colour uint8 colour = NOT_TRANSLUCENT(w->colours[widget->colour]); if (widget->type == WWT_4 || widget->type == WWT_COLOURBTN || widget->type == WWT_TRNBTN || widget->type == WWT_TAB) if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) image++; if (widget_is_disabled(w, widgetIndex)) { // Draw greyed out (light border bottom right shadow) colour = w->colours[widget->colour]; colour = ColourMapA[NOT_TRANSLUCENT(colour)].lighter; gfx_draw_sprite_solid(dpi, image, l + 1, t + 1, colour); // Draw greyed out (dark) colour = w->colours[widget->colour]; colour = ColourMapA[NOT_TRANSLUCENT(colour)].mid_light; gfx_draw_sprite_solid(dpi, image, l, t, colour); } else { if (image & IMAGE_TYPE_REMAP_2_PLUS) { // ? } if (image & IMAGE_TYPE_TRANSPARENT) image &= ~IMAGE_TYPE_TRANSPARENT; else image |= colour << 19; gfx_draw_sprite(dpi, image, l, t, 0); } }
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); } } } }
/** * * rct2: 0x0066F25C */ void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi) { bool drawPreviousButton = false; bool drawNextButton = false; if (gS6Info.editor_step == EDITOR_STEP_OBJECT_SELECTION) { drawNextButton = true; } else if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) { drawPreviousButton = true; } else if (gSpriteListCount[SPRITE_LIST_NULL] != MAX_SPRITES) { drawNextButton = true; } else if (gParkFlags & PARK_FLAGS_SPRITES_INITIALISED) { drawNextButton = true; } else { drawPreviousButton = true; } if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { if (drawPreviousButton) { gfx_filter_rect(dpi, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + w->y, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom + w->y, PALETTE_51); } if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_filter_rect(dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + w->y, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].bottom + w->y, PALETTE_51); } } window_draw_widgets(w, dpi); if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { if (drawPreviousButton) { gfx_fill_rect_inset(dpi, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 1 + w->y, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right - 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 + w->y, w->colours[1], INSET_RECT_F_30); } if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_fill_rect_inset(dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 1 + w->y, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].bottom - 1 + w->y, w->colours[1], INSET_RECT_F_30); } sint16 stateX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right + window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left) / 2 + w->x; sint16 stateY = w->height - 0x0C + w->y; gfx_draw_string_centred(dpi, EditorStepNames[gS6Info.editor_step], stateX, stateY, NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE, 0); if (drawPreviousButton) { gfx_draw_sprite(dpi, SPR_PREVIOUS, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 6 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->y, 0); sint32 textColour = NOT_TRANSLUCENT(w->colours[1]); if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON ) { textColour = COLOUR_WHITE; } sint16 textX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 30 + window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + w->x; sint16 textY = window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->y; rct_string_id stringId = EditorStepNames[gS6Info.editor_step - 1]; if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, textX, textY, textColour, NULL); gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, NULL); } if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_draw_sprite(dpi, SPR_NEXT, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 29 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->y, 0); sint32 textColour = NOT_TRANSLUCENT(w->colours[1]); if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON ) { textColour = COLOUR_WHITE; } sint16 textX = (window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + w->x; sint16 textY = window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->y; rct_string_id stringId = EditorStepNames[gS6Info.editor_step + 1]; if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, textX, textY, textColour, NULL); gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, NULL); } } }