/** * * rct2: 0x006EB951 */ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex) { int l, t, r, b, colour, image; rct_widget *widget; // Get the widget widget = &w->widgets[widgetIndex]; // Get the image image = widget->image; if (image == -1) return; // Resolve the absolute ltrb l = w->x + widget->left; t = w->y + widget->top; r = w->x + widget->right; b = w->y + widget->bottom; // Get the colour colour = w->colours[widget->colour]; if (widget->type == WWT_4 || widget->type == WWT_COLORBTN || 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 = RCT2_ADDRESS(0x00141FC4A, uint8)[(colour & 0x7F) * 8] & 0xFF; uint8 palette[256]; memset(palette, colour, 256); palette[0] = 0; RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000; image &= 0x7FFFF; gfx_draw_sprite_palette_set(dpi, image | 0x20000000, l + 1, t + 1, palette, NULL); // Draw greyed out (dark) colour = w->colours[widget->colour]; colour = RCT2_ADDRESS(0x00141FC48, uint8)[(colour & 0x7F) * 8] & 0xFF; memset(palette, colour, 256); palette[0] = 0; RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000; gfx_draw_sprite_palette_set(dpi, image | 0x20000000, l, t, palette, NULL); } else { if (image & 0x80000000) { // ? } if (image & 0x40000000) image &= ~0x40000000; else image |= colour << 19; gfx_draw_sprite(dpi, image, l, t); } }
/** * * rct2: 0x006EBBEB */ static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex) { rct_widget* widget; int l, t, r, b, press; uint8 colour; // Get the widget widget = &w->widgets[widgetIndex]; // Resolve the absolute ltrb l = w->x + widget->left; t = w->y + widget->top; r = w->x + widget->right; b = w->y + widget->bottom; // Get the colour colour = w->colours[widget->colour]; // Border press = widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex) ? 0x20 : 0; gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); // Text widget_text_unknown(dpi, w, widgetIndex); }
/** * * rct2: 0x006EBAD9 */ static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex) { rct_widget* widget; int l, t, b; uint8 colour; // Get the widget widget = &w->widgets[widgetIndex]; // Resolve the absolute ltb l = w->x + widget->left; t = w->y + widget->top; b = w->y + widget->bottom; // Get the colour colour = w->colours[widget->colour]; // checkbox gfx_fill_rect_inset(dpi, l, t, l + 9, b - 1, colour, 0x60); // fill it when checkbox is pressed if (widget_is_pressed(w, widgetIndex)) { RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224; gfx_draw_string(dpi, (char*)0x009DED72, colour & 0x7F, l, t); } // draw the text if (widget->image == -1) return; if (widget_is_disabled(w, widgetIndex)) { colour |= 0x40; } gfx_draw_string_left(dpi, widget->image, (char*)0x013CE952, colour, l + 14, t); }
/** * * rct2: 0x006EC1A6 */ static void widget_text_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex) { rct_widget* widget; int l, t, r, b, press; uint8 colour; // Get the widget widget = &w->widgets[widgetIndex]; // Resolve the absolute ltrb l = w->x + widget->left + 5; t = w->y + widget->top; r = w->x + widget->right; b = w->y + widget->bottom; // Get the colour colour = w->colours[widget->colour]; press = 0; if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) press |= 0x20; gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); // TODO gfx_fill_rect(dpi, l, t, r, b, colour); }
/** * * 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: 0x006EB8E5 */ static void widget_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex) { rct_widget* widget; int l, t, r, b, press; uint8 colour; // Get the widget widget = &w->widgets[widgetIndex]; // Resolve the absolute ltrb l = w->x + widget->left; t = w->y + widget->top; r = w->x + widget->right; b = w->y + widget->bottom; // Check if the button is pressed down press = widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex) ? 0x20 : 0; // Get the colour colour = w->colours[widget->colour]; if (widget->image == -2) { // Draw border with no fill gfx_fill_rect_inset(dpi, l, t, r, b, colour, press | 0x10); return; } // Draw the border with fill gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); widget_draw_image(dpi, w, widgetIndex); }
/** * * rct2: 0x006EBB85 */ static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex) { // Get the widget rct_widget *widget = &w->widgets[widgetIndex]; // Resolve the absolute ltrb sint32 l = w->x + widget->left; sint32 t = w->y + widget->top; sint32 r = w->x + widget->right; sint32 b = w->y + widget->bottom; // Check if the button is pressed down uint8 press = 0; if (w->flags & WF_10) press |= INSET_RECT_FLAG_FILL_MID_LIGHT; if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) press |= INSET_RECT_FLAG_BORDER_INSET; // Get the colour uint8 colour = w->colours[widget->colour]; // Draw the button gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); if (widget->text == STR_NONE) return; l = w->x + (widget->left + widget->right) / 2 - 1; t = w->y + max(widget->top, (widget->top + widget->bottom) / 2 - 5); if (widget_is_disabled(w, widgetIndex)) colour |= COLOUR_FLAG_INSET; gfx_draw_string_centred_clipped(dpi, widget->text, gCommonFormatArgs, colour, l, t, widget->right - widget->left - 2); }
/** * * rct2: 0x006EB861 */ static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex) { if (!widget_is_disabled(w, widgetIndex) && widget_is_highlighted(w, widgetIndex)) { widget_button_draw(dpi, w, widgetIndex); return; } // Get the widget rct_widget *widget = &w->widgets[widgetIndex]; // Resolve the absolute ltrb sint32 l = w->x + widget->left; sint32 t = w->y + widget->top; sint32 r = w->x + widget->right; sint32 b = w->y + widget->bottom; // Get the colour uint8 colour = w->colours[widget->colour]; // Check if the button is pressed down if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) { if (widget->image == -2) { // Draw border with no fill gfx_fill_rect_inset(dpi, l, t, r, b, colour, INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_NONE); return; } // Draw the border with fill gfx_fill_rect_inset(dpi, l, t, r, b, colour, INSET_RECT_FLAG_BORDER_INSET); } // Draw image widget_draw_image(dpi, w, widgetIndex); }
/** * * rct2: 0x006EBC41 */ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex) { rct_widget* widget; int l, t, r, b, stringId; uint8 colour; // Get the widget widget = &w->widgets[widgetIndex]; // Get the colour colour = w->colours[widget->colour]; // do not use widget color as this is already used as background for the text_button // colour = 2; // Resolve the absolute ltrb l = w->x + widget->left; t = w->y + widget->top; r = w->x + widget->right; b = w->y + widget->bottom; stringId = widget->image; if (stringId == -1) return; if (widget->type == WWT_11 && (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex))) stringId++; if (widget->type == WWT_13) { if (widget_is_disabled(w, widgetIndex)) colour |= 0x40; gfx_draw_string_left_clipped( dpi, stringId, (void*)0x013CE952, colour, l + 1, t, widget->right - widget->left - 2 ); } else { colour &= ~(1 << 7); if (widget_is_disabled(w, widgetIndex)) colour |= 0x40; gfx_draw_string_centred_clipped( dpi, stringId, (void*)0x013CE952, colour, (w->x + w->x + widget->left + widget->right + 1) / 2 - 1, t, widget->right - widget->left - 2 ); } }
/** * * rct2: 0x006EBC41 */ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex) { // Get the widget rct_widget *widget = &w->widgets[widgetIndex]; // Get the colour uint8 colour = w->colours[widget->colour]; // do not use widget colour as this is already used as background for the text_button // colour = 2; // Resolve the absolute ltrb sint32 l = w->x + widget->left; sint32 t = w->y + widget->top; rct_string_id stringId = widget->text; if (stringId == STR_NONE) return; if (widget->type == WWT_11 && (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex))) // TODO: remove string addition stringId++; if (widget->type == WWT_13) { if (widget_is_disabled(w, widgetIndex)) colour |= COLOUR_FLAG_INSET; gfx_draw_string_left_clipped( dpi, stringId, gCommonFormatArgs, colour, l + 1, t, widget->right - widget->left - 2 ); } else { colour &= ~(1 << 7); if (widget_is_disabled(w, widgetIndex)) colour |= COLOUR_FLAG_INSET; gfx_draw_string_centred_clipped( dpi, stringId, gCommonFormatArgs, colour, (w->x + w->x + widget->left + widget->right + 1) / 2 - 1, t, widget->right - widget->left - 2 ); } }
/** * * 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); } }
/** * * rct2: 0x0066C8EC */ static void window_game_top_toolbar_paint() { int x, y, imgId; rct_window *w; rct_drawpixelinfo *dpi; __asm mov w, esi __asm mov dpi, edi window_draw_widgets(w, dpi); // Draw staff button image (setting masks to the staff colours) x = w->x + window_game_top_toolbar_widgets[WIDX_STAFF].left; y = w->y + window_game_top_toolbar_widgets[WIDX_STAFF].top; imgId = 5627; if (widget_is_pressed(w, WIDX_STAFF)) imgId++; imgId |= (RCT2_GLOBAL(0x01357BCD, uint8) << 19) | 0xA0000000 | (RCT2_GLOBAL(0x01357BCE, uint8) << 24); gfx_draw_sprite(dpi, imgId, x, y); }
/** * * rct2: 0x006EBBEB */ static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex) { // Get the widget rct_widget *widget = &w->widgets[widgetIndex]; // Resolve the absolute ltrb sint32 l = w->x + widget->left; sint32 t = w->y + widget->top; sint32 r = w->x + widget->right; sint32 b = w->y + widget->bottom; // Get the colour uint8 colour = w->colours[widget->colour]; // Border uint8 press = widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex) ? INSET_RECT_FLAG_BORDER_INSET : 0; gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); // Text widget_text_unknown(dpi, w, widgetIndex); }
/** * * rct2: 0x006EBB85 */ static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex) { rct_widget* widget; int l, t, r, b, press; uint8 colour; // Get the widget widget = &w->widgets[widgetIndex]; // Resolve the absolute ltrb l = w->x + widget->left; t = w->y + widget->top; r = w->x + widget->right; b = w->y + widget->bottom; // Check if the button is pressed down press = 0; if (w->flags & 0x400) press |= 0x80; if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) press |= 0x20; // Get the colour colour = w->colours[widget->colour]; // Draw the button gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); if (widget->image == -1) return; l = w->x + (widget->left + widget->right) / 2 - 1; t = w->y + max(widget->top, (widget->top + widget->bottom) / 2 - 5); if (widget_is_disabled(w, widgetIndex)) colour |= 0x40; gfx_draw_string_centred_clipped(dpi, widget->image, (void*)0x013CE952, colour, l, t, widget->right - widget->left - 2); }
/** * * rct2: 0x006EC1A6 */ static void widget_text_draw(rct_drawpixelinfo *dpi, rct_window *w, rct_widgetindex widgetIndex) { // Get the widget rct_widget *widget = &w->widgets[widgetIndex]; // Resolve the absolute ltrb sint32 l = w->x + widget->left + 5; sint32 t = w->y + widget->top; sint32 r = w->x + widget->right; sint32 b = w->y + widget->bottom; // Get the colour uint8 colour = w->colours[widget->colour]; sint32 press = 0; if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex)) press |= INSET_RECT_FLAG_BORDER_INSET; gfx_fill_rect_inset(dpi, l, t, r, b, colour, press); // TODO gfx_fill_rect(dpi, l, t, r, b, colour); }