/** * * 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: 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: 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: 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: 0x006CD767 */ static void window_maze_construction_update(rct_window *w) { rct_ride *ride = get_ride(_currentRideIndex); if (ride == NULL || ride->status != RIDE_STATUS_CLOSED) { window_close(w); return; } switch (_rideConstructionState) { case RIDE_CONSTRUCTION_STATE_PLACE: if (!widget_is_active_tool(w, WIDX_MAZE_DIRECTION_GROUPBOX)) { window_close(w); return; } break; case RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT: if (!widget_is_active_tool(w, WIDX_MAZE_ENTRANCE) && !widget_is_active_tool(w, WIDX_MAZE_EXIT)) { _rideConstructionState = gRideEntranceExitPlacePreviousRideConstructionState; window_maze_construction_update_pressed_widgets(); } break; } switch (_rideConstructionState) { case RIDE_CONSTRUCTION_STATE_FRONT: case RIDE_CONSTRUCTION_STATE_BACK: case RIDE_CONSTRUCTION_STATE_SELECTED: if ( (input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_RIDE_CONSTRUCTION ) { tool_cancel(); } break; } sub_6C94D8(); }
/** * * 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: 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); }