예제 #1
0
파일: error.c 프로젝트: CraigCraig/OpenRCT2
/**
 *
 *  rct2: 0x00667AA3
 */
static void window_error_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	sint32 t, l, r, b;

	l = w->x;
	t = w->y;
	r = w->x + w->width - 1;
	b = w->y + w->height - 1;

	gfx_filter_rect(dpi, l + 1, t + 1, r - 1, b - 1, PALETTE_45);
	gfx_filter_rect(dpi, l, t, r, b, PALETTE_GLASS_SATURATED_RED);

	gfx_filter_rect(dpi, l, t + 2, l, b - 2, PALETTE_DARKEN_3);
	gfx_filter_rect(dpi, r, t + 2, r, b - 2, PALETTE_DARKEN_3);
	gfx_filter_rect(dpi, l + 2, b, r - 2, b, PALETTE_DARKEN_3);
	gfx_filter_rect(dpi, l + 2, t, r - 2, t, PALETTE_DARKEN_3);

	gfx_filter_rect(dpi, r + 1, t + 1, r + 1, t + 1, PALETTE_DARKEN_3);
	gfx_filter_rect(dpi, r - 1, t + 1, r - 1, t + 1, PALETTE_DARKEN_3);
	gfx_filter_rect(dpi, l + 1, b - 1, l + 1, b - 1, PALETTE_DARKEN_3);
	gfx_filter_rect(dpi, r - 1, b - 1, r - 1, b - 1, PALETTE_DARKEN_3);

	l = w->x + (w->width + 1) / 2 - 1;
	t = w->y + 1;
	draw_string_centred_raw(dpi, l, t, _window_error_num_lines, _window_error_text);
}
예제 #2
0
/**
*
*  rct2: 0x006BD785
*/
void window_themes_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex)
{
    sint32 y;

    if (_selected_tab == WINDOW_THEMES_TAB_SETTINGS || _selected_tab == WINDOW_THEMES_TAB_FEATURES)
        return;

    if ((w->colours[1] & 0x80) == 0)
        //gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ColourMapA[w->colours[1]].mid_light);
        gfx_clear(dpi, ColourMapA[w->colours[1]].mid_light);
    y = 0;
    for (sint32 i = 0; i < get_colour_scheme_tab_count(); i++) {
        if (y > dpi->y + dpi->height) {
            break;
        }
        if (y + _row_height >= dpi->y) {
            if (i + 1 < get_colour_scheme_tab_count()) {
                sint32 colour = w->colours[1];
                if (colour & COLOUR_FLAG_TRANSLUCENT) {
                    translucent_window_palette windowPalette = TranslucentWindowPalettes[BASE_COLOUR(colour)];

                    gfx_filter_rect(dpi, 0, y + _row_height - 2, window_themes_widgets[WIDX_THEMES_LIST].right, y + _row_height - 2, windowPalette.highlight);
                    gfx_filter_rect(dpi, 0, y + _row_height - 1, window_themes_widgets[WIDX_THEMES_LIST].right, y + _row_height - 1, windowPalette.shadow);
                }
                else {
                    colour = ColourMapA[w->colours[1]].mid_dark;
                    gfx_fill_rect(dpi, 0, y + _row_height - 2, window_themes_widgets[WIDX_THEMES_LIST].right, y + _row_height - 2, colour);
                    colour = ColourMapA[w->colours[1]].lightest;
                    gfx_fill_rect(dpi, 0, y + _row_height - 1, window_themes_widgets[WIDX_THEMES_LIST].right, y + _row_height - 1, colour);
                }
            }

            rct_windowclass wc = get_window_class_tab_index(i);
            sint32 numColours = theme_desc_get_num_colours(wc);
            for (uint8 j = 0; j < numColours; j++) {
                gfx_draw_string_left(dpi, theme_desc_get_name(wc), NULL, w->colours[1], 2, y + 4);

                uint8 colour = theme_get_colour(wc, j);
                uint32 image = SPRITE_ID_PALETTE_COLOUR_1(colour & ~COLOUR_FLAG_TRANSLUCENT) | IMAGE_TYPE_TRANSPARENT | SPR_PALETTE_BTN;
                if (i == _colour_index_1 && j == _colour_index_2) {
                    image = SPRITE_ID_PALETTE_COLOUR_1(colour & ~COLOUR_FLAG_TRANSLUCENT) | IMAGE_TYPE_TRANSPARENT | SPR_PALETTE_BTN_PRESSED;
                }
                gfx_draw_sprite(dpi, image, _button_offset_x + 12 * j, y + _button_offset_y, 0);

                gfx_fill_rect_inset(dpi, _button_offset_x + 12 * j, y + _check_offset_y, _button_offset_x + 12 * j + 9, y + _check_offset_y + 10, w->colours[1], INSET_RECT_F_E0);
                if (colour & COLOUR_FLAG_TRANSLUCENT) {
                    gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK;
                    gfx_draw_string(dpi, (char*)CheckBoxMarkString, w->colours[1] & 0x7F, _button_offset_x + 12 * j, y + _check_offset_y);
                }

            }
        }

        y += _row_height;
    }
}
예제 #3
0
/**
 *
 *  rct2: 0x006CF8CD
 */
static void window_track_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex)
{
    uint8 paletteIndex = ColourMapA[w->colours[0]].mid_light;
    gfx_clear(dpi, paletteIndex);

    sint32 x = 0;
    sint32 y = 0;
    size_t listIndex = 0;
    if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) {
        if (_trackDesignsCount == 0) {
            // No track designs
            gfx_draw_string_left(dpi, STR_NO_TRACK_DESIGNS_OF_THIS_TYPE, NULL, COLOUR_BLACK, x, y - 1);
            return;
        }
    } else {
        // Build custom track item
        rct_string_id stringId;
        if (listIndex == (size_t)w->selected_list_item) {
            // Highlight
            gfx_filter_rect(dpi, x, y, w->width, y + 9, PALETTE_DARKEN_1);
            stringId = STR_WINDOW_COLOUR_2_STRINGID;
        } else {
            stringId = STR_BLACK_STRING;
        }

        rct_string_id stringId2 = STR_BUILD_CUSTOM_DESIGN;
        gfx_draw_string_left(dpi, stringId, &stringId2, COLOUR_BLACK, x, y - 1);
        y += 10;
        listIndex++;
    }

    for (size_t i = 0; i < _trackDesignsCount; i++, listIndex++) {
        if (y + 10 >= dpi->y && y < dpi->y + dpi->height) {
            rct_string_id stringId;
            if (listIndex == (size_t)w->selected_list_item) {
                // Highlight
                gfx_filter_rect(dpi, x, y, w->width, y + 9, PALETTE_DARKEN_1);
                stringId = STR_WINDOW_COLOUR_2_STRINGID;
            } else {
                stringId = STR_BLACK_STRING;
            }

            // Draw track name
            set_format_arg(0, rct_string_id, STR_TRACK_LIST_NAME_FORMAT);
            set_format_arg(2, utf8*, _trackDesigns[i].name);
            gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, COLOUR_BLACK, x, y - 1);
        }
        y += 10;
    }
예제 #4
0
/**
 *
 *  rct2: 0x006EA41D
 */
static void window_tooltip_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
    int32_t left = w->x;
    int32_t top = w->y;
    int32_t right = w->x + w->width - 1;
    int32_t bottom = w->y + w->height - 1;

    // Background
    gfx_filter_rect(dpi, left + 1, top + 1, right - 1, bottom - 1, PALETTE_45);
    gfx_filter_rect(dpi, left + 1, top + 1, right - 1, bottom - 1, PALETTE_GLASS_LIGHT_ORANGE);

    // Sides
    gfx_filter_rect(dpi, left + 0, top + 2, left + 0, bottom - 2, PALETTE_DARKEN_3);
    gfx_filter_rect(dpi, right + 0, top + 2, right + 0, bottom - 2, PALETTE_DARKEN_3);
    gfx_filter_rect(dpi, left + 2, bottom + 0, right - 2, bottom + 0, PALETTE_DARKEN_3);
    gfx_filter_rect(dpi, left + 2, top + 0, right - 2, top + 0, PALETTE_DARKEN_3);

    // Corners
    gfx_filter_pixel(dpi, left + 1, top + 1, PALETTE_DARKEN_3);
    gfx_filter_pixel(dpi, right - 1, top + 1, PALETTE_DARKEN_3);
    gfx_filter_pixel(dpi, left + 1, bottom - 1, PALETTE_DARKEN_3);
    gfx_filter_pixel(dpi, right - 1, bottom - 1, PALETTE_DARKEN_3);

    // Text
    left = w->x + ((w->width + 1) / 2) - 1;
    top = w->y + 1;
    draw_string_centred_raw(dpi, left, top, _tooltipNumLines, _tooltipText);
}
예제 #5
0
/**
 *
 *  rct2: 0x006EB2F9
 */
static void widget_caption_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;

    // Get the colour
    uint8 colour = w->colours[widget->colour];

    uint8 press = INSET_RECT_F_60;
    if (w->flags & WF_10)
        press |= INSET_RECT_FLAG_FILL_MID_LIGHT;

    gfx_fill_rect_inset(dpi, l, t, r, b, colour, press);

    // Black caption bars look slightly green, this fixes that
    if (colour == 0)
        gfx_fill_rect(dpi, l + 1, t + 1, r - 1, b - 1, ColourMapA[colour].dark);
    else
        gfx_filter_rect(dpi, l + 1, t + 1, r - 1, b - 1, PALETTE_DARKEN_3);

    // Draw text
    if (widget->text == STR_NONE)
        return;

    l = widget->left + w->x + 2;
    t = widget->top + w->y + 1;
    sint32 width = widget->right - widget->left - 4;
    if ((widget + 1)->type == WWT_CLOSEBOX) {
        width -= 10;
        if ((widget + 2)->type == WWT_CLOSEBOX)
            width -= 10;
    }
    l += width / 2;
    gfx_draw_string_centred_clipped(dpi, widget->text, gCommonFormatArgs, COLOUR_WHITE | COLOUR_FLAG_OUTLINE, l, t, width);
}
예제 #6
0
파일: Chat.cpp 프로젝트: OpenRCT2/OpenRCT2
void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
{
    if (!chat_available())
    {
        gChatOpen = false;
        return;
    }

    _chatLeft = 10;
    _chatRight = std::min((context_get_width() - 10), CHAT_MAX_WINDOW_WIDTH);
    _chatWidth = _chatRight - _chatLeft;
    _chatBottom = context_get_height() - 45;
    _chatTop = _chatBottom - 10;

    char lineBuffer[CHAT_INPUT_SIZE + 10];
    char* lineCh = lineBuffer;
    char* inputLine = _chatCurrentLine;
    int32_t inputLineHeight = 10;

    // Draw chat window
    if (gChatOpen)
    {
        inputLineHeight = chat_string_wrapped_get_height((void*)&inputLine, _chatWidth - 10);
        _chatTop -= inputLineHeight;

        for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++)
        {
            if (strlen(chat_history_get(i)) == 0)
            {
                continue;
            }

            safe_strcpy(lineBuffer, chat_history_get(i), sizeof(lineBuffer));

            int32_t lineHeight = chat_string_wrapped_get_height((void*)&lineCh, _chatWidth - 10);
            _chatTop -= (lineHeight + 5);
        }

        _chatHeight = _chatBottom - _chatTop;

        if (_chatTop < 50)
        {
            _chatTop = 50;
        }
        else if (_chatHeight < 150)
        { // Min height
            _chatTop = _chatBottom - 150;
            _chatHeight = 150;
        }

        gfx_set_dirty_blocks(_chatLeft, _chatTop - 5, _chatRight, _chatBottom + 5);             // Background area + Textbox
        gfx_filter_rect(dpi, _chatLeft, _chatTop - 5, _chatRight, _chatBottom + 5, PALETTE_51); // Opaque gray background
        gfx_fill_rect_inset(
            dpi, _chatLeft, _chatTop - 5, _chatRight, _chatBottom + 5, chatBackgroundColor, INSET_RECT_FLAG_FILL_NONE);
        gfx_fill_rect_inset(
            dpi, _chatLeft + 1, _chatTop - 4, _chatRight - 1, _chatBottom - inputLineHeight - 6, chatBackgroundColor,
            INSET_RECT_FLAG_BORDER_INSET);
        gfx_fill_rect_inset(
            dpi, _chatLeft + 1, _chatBottom - inputLineHeight - 5, _chatRight - 1, _chatBottom + 4, chatBackgroundColor,
            INSET_RECT_FLAG_BORDER_INSET); // Textbox
    }

    int32_t x = _chatLeft + 5;
    int32_t y = _chatBottom - inputLineHeight - 20;
    int32_t stringHeight = 0;

    // Draw chat history
    for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++, y -= stringHeight)
    {
        uint32_t expireTime = chat_history_get_time(i) + 10000;
        if (!gChatOpen && platform_get_ticks() > expireTime)
        {
            break;
        }

        safe_strcpy(lineBuffer, chat_history_get(i), sizeof(lineBuffer));

        stringHeight = chat_history_draw_string(dpi, (void*)&lineCh, x, y, _chatWidth - 10) + 5;
        gfx_set_dirty_blocks(x, y - stringHeight, x + _chatWidth, y + 20);

        if ((y - stringHeight) < 50)
        {
            break;
        }
    }

    // Draw current chat input
    if (gChatOpen)
    {
        lineCh = utf8_write_codepoint(lineCh, FORMAT_OUTLINE);
        lineCh = utf8_write_codepoint(lineCh, FORMAT_CELADON);

        safe_strcpy(lineCh, _chatCurrentLine, sizeof(_chatCurrentLine));
        y = _chatBottom - inputLineHeight - 5;

        lineCh = lineBuffer;
        inputLineHeight = gfx_draw_string_left_wrapped(
            dpi, (void*)&lineCh, x, y + 3, _chatWidth - 10, STR_STRING, TEXT_COLOUR_255);
        gfx_set_dirty_blocks(x, y, x + _chatWidth, y + inputLineHeight + 15);

        // TODO: Show caret if the input text has multiple lines
        if (_chatCaretTicks < 15 && gfx_get_string_width(lineBuffer) < (_chatWidth - 10))
        {
            std::memcpy(lineBuffer, _chatCurrentLine, _chatTextInputSession->SelectionStart);
            lineBuffer[_chatTextInputSession->SelectionStart] = 0;
            int32_t caretX = x + gfx_get_string_width(lineBuffer);
            int32_t caretY = y + 14;

            gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, PALETTE_INDEX_56);
        }
    }
}
예제 #7
0
static void window_title_menu_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
    gfx_filter_rect(dpi, w->x, w->y, w->x + w->width - 1, w->y + 82 - 1, PALETTE_51);
    window_draw_widgets(w, dpi);
}
예제 #8
0
static void window_scenarioselect_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
{
	int colour;

	uint8 paletteIndex = ColourMapA[w->colours[1]].mid_light;
	gfx_clear(dpi, paletteIndex);

	rct_string_id highlighted_format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID;
	rct_string_id unhighlighted_format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_WHITE_STRING : STR_BLACK_STRING;

	bool wide = gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN;

	rct_widget *listWidget = &w->widgets[WIDX_SCENARIOLIST];
	int listWidth = listWidget->right - listWidget->left - 12;

	int y = 0;
	for (sc_list_item *listItem = _listItems; listItem->type != LIST_ITEM_TYPE_END; listItem++) {
		if (y > dpi->y + dpi->height) {
			continue;
		}

		switch (listItem->type) {
		case LIST_ITEM_TYPE_HEADING:;
			const int horizontalRuleMargin = 4;
			draw_category_heading(w, dpi, horizontalRuleMargin, listWidth - horizontalRuleMargin, y + 2, listItem->heading.string_id);
			y += 18;
			break;
		case LIST_ITEM_TYPE_SCENARIO:;
			// Draw hover highlight
			const scenario_index_entry *scenario = listItem->scenario.scenario;
			bool isHighlighted = w->highlighted_scenario == scenario;
			if (isHighlighted) {
				gfx_filter_rect(dpi, 0, y, w->width, y + 23, PALETTE_DARKEN_1);
			}

			bool isCompleted = scenario->highscore != NULL;
			bool isDisabled = listItem->scenario.is_locked;

			// Draw scenario name
			char buffer[64];
			safe_strcpy(buffer, scenario->name, sizeof(buffer));
			rct_string_id format = isDisabled ? STR_STRINGID : (isHighlighted ? highlighted_format : unhighlighted_format);
			set_format_arg(0, rct_string_id, STR_STRING);
			set_format_arg(2, char *, buffer);
			colour = isDisabled ? w->colours[1] | COLOUR_FLAG_INSET : COLOUR_BLACK;
			if (isDisabled) {
				gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK;
			}
			gfx_draw_string_centred(dpi, format, wide ? 270 : 210, y + 1, colour, gCommonFormatArgs);

			// Check if scenario is completed
			if (isCompleted) {
				// Draw completion tick
				gfx_draw_sprite(dpi, SPR_MENU_CHECKMARK, wide ? 500 : 395, y + 1, 0);

				// Draw completion score
				const utf8 *completedByName = "???";
				if (!str_is_null_or_empty(scenario->highscore->name)) {
					completedByName = scenario->highscore->name;
				}
				safe_strcpy(buffer, completedByName, 64);
				set_format_arg(0, rct_string_id, STR_COMPLETED_BY);
				set_format_arg(2, rct_string_id, STR_STRING);
				set_format_arg(4, char *, buffer);
				gfx_draw_string_centred(dpi, format, wide ? 270 : 210, y + 11, COLOUR_BLACK, gCommonFormatArgs);
			}

			y += 24;
			break;
		}
	}
}
예제 #9
0
파일: Drawing.cpp 프로젝트: Wirlie/OpenRCT2
void gfx_filter_pixel(rct_drawpixelinfo *dpi, sint32 x, sint32 y, FILTER_PALETTE_ID palette)
{
    gfx_filter_rect(dpi, x, y, x, y, palette);
}
예제 #10
0
static void window_multiplayer_players_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex)
{
	sint32 y;

	y = 0;
	for (sint32 i = 0; i < network_get_num_players(); i++) {
		if (y > dpi->y + dpi->height) {
			break;
		}

		if (y + 11 >= dpi->y) {
			char buffer[300];

			// Draw player name
			char* lineCh = buffer;
			sint32 colour = COLOUR_BLACK;
			if (i == w->selected_list_item) {
				gfx_filter_rect(dpi, 0, y, 800, y + 9, PALETTE_DARKEN_1);
				safe_strcpy(buffer, network_get_player_name(i), sizeof(buffer));
				colour = w->colours[2];
			} else {
				if (network_get_player_flags(i) & NETWORK_PLAYER_FLAG_ISSERVER) {
					lineCh = utf8_write_codepoint(lineCh, FORMAT_BABYBLUE);
				} else {
					lineCh = utf8_write_codepoint(lineCh, FORMAT_BLACK);
				}
				safe_strcpy(lineCh, network_get_player_name(i), sizeof(buffer) - (lineCh - buffer));
			}
			gfx_clip_string(buffer, 230);
			gfx_draw_string(dpi, buffer, colour, 0, y - 1);

			// Draw group name
			lineCh = buffer;
			sint32 group = network_get_group_index(network_get_player_group(i));
			if (group != -1) {
				lineCh = utf8_write_codepoint(lineCh, FORMAT_BLACK);
				safe_strcpy(lineCh, network_get_group_name(group), sizeof(buffer) - (lineCh - buffer));
				gfx_clip_string(buffer, 80);
				gfx_draw_string(dpi, buffer, colour, 173, y - 1);
			}

			// Draw last action
			sint32 action = network_get_player_last_action(i, 2000);
			set_format_arg(0, rct_string_id, STR_ACTION_NA);
			if (action != -999) {
				set_format_arg(0, rct_string_id, network_get_action_name_string_id(action));
			}
			gfx_draw_string_left_clipped(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, 256, y - 1, 100);

			// Draw ping
			lineCh = buffer;
			sint32 ping = network_get_player_ping(i);
			if (ping <= 100) {
				lineCh = utf8_write_codepoint(lineCh, FORMAT_GREEN);
			} else
			if (ping <= 250) {
				lineCh = utf8_write_codepoint(lineCh, FORMAT_YELLOW);
			} else {
				lineCh = utf8_write_codepoint(lineCh, FORMAT_RED);
			}
			snprintf(lineCh, sizeof(buffer) - (lineCh - buffer), "%d ms", ping);
			gfx_draw_string(dpi, buffer, colour, 356, y - 1);
		}
		y += 10;
	}
}
예제 #11
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);
            }
        }
    }
}
예제 #12
0
/**
*
*  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);

        }
    }
}
예제 #13
0
/**
 *
 *  rct2: 0x006850BD
 */
static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
{
    // Draw background
    uint8_t paletteIndex = ColourMapA[w->colours[1]].mid_light;
    gfx_clear(dpi, paletteIndex);

    rct_research_item* researchItem = gResearchItems;
    int32_t researchItemEndMarker;

    if (scrollIndex == 1)
    {
        // Skip pre-researched items
        for (; researchItem->rawValue != RESEARCHED_ITEMS_SEPARATOR; researchItem++)
        {
        }
        researchItem++;
        researchItemEndMarker = RESEARCHED_ITEMS_END;
    }
    else
    {
        researchItemEndMarker = RESEARCHED_ITEMS_SEPARATOR;
    }

    int16_t boxWidth = (w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right - w->widgets[WIDX_RESEARCH_ORDER_SCROLL].left);
    int16_t columnSplitOffset = boxWidth / 2;
    int32_t itemY = -SCROLLABLE_ROW_HEIGHT;
    do
    {
        itemY += SCROLLABLE_ROW_HEIGHT;
        if (itemY + SCROLLABLE_ROW_HEIGHT < dpi->y || itemY >= dpi->y + dpi->height)
            continue;

        if (w->research_item == researchItem)
        {
            int32_t top, bottom;
            if (_editorInventionsListDraggedItem == nullptr)
            {
                // Highlight
                top = itemY;
                bottom = itemY + SCROLLABLE_ROW_HEIGHT - 1;
            }
            else
            {
                // Drop horizontal rule
                top = itemY - 1;
                bottom = itemY;
            }

            gfx_filter_rect(dpi, 0, top, boxWidth, bottom, PALETTE_DARKEN_1);
        }

        if (researchItem->rawValue == RESEARCHED_ITEMS_SEPARATOR || researchItem->rawValue == RESEARCHED_ITEMS_END)
            continue;

        if (researchItem == _editorInventionsListDraggedItem)
            continue;

        utf8 groupNameBuffer[256], vehicleNameBuffer[256];
        utf8* groupNamePtr = groupNameBuffer;
        utf8* vehicleNamePtr = vehicleNameBuffer;

        uint8_t colour;
        if (research_item_is_always_researched(researchItem))
        {
            if (w->research_item == researchItem && _editorInventionsListDraggedItem == nullptr)
                gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_EXTRA_DARK;
            else
                gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK;
            colour = w->colours[1] | COLOUR_FLAG_INSET;
        }
        else
        {
            // TODO: this is actually just a black colour.
            colour = COLOUR_BRIGHT_GREEN | COLOUR_FLAG_TRANSLUCENT;
            gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;

            groupNamePtr = utf8_write_codepoint(groupNamePtr, colour);
            vehicleNamePtr = utf8_write_codepoint(vehicleNamePtr, colour);
        }

        rct_string_id itemNameId = research_item_get_name(researchItem);

        if (researchItem->type == RESEARCH_ENTRY_TYPE_RIDE
            && !RideGroupManager::RideTypeIsIndependent(researchItem->baseRideType))
        {
            const auto rideEntry = get_ride_entry(researchItem->entryIndex);
            const rct_string_id rideGroupName = get_ride_naming(researchItem->baseRideType, rideEntry).name;
            format_string(
                groupNamePtr, std::size(groupNameBuffer), STR_INVENTIONS_LIST_RIDE_AND_VEHICLE_NAME, (void*)&rideGroupName);
            format_string(vehicleNamePtr, std::size(vehicleNameBuffer), itemNameId, nullptr);
        }
        else
        {
            format_string(groupNamePtr, std::size(groupNameBuffer), itemNameId, nullptr);
            vehicleNamePtr = nullptr;
        }

        // Draw group name
        gfx_clip_string(groupNameBuffer, columnSplitOffset);
        gfx_draw_string(dpi, groupNameBuffer, colour, 1, itemY);

        // Draw vehicle name
        if (vehicleNamePtr)
        {
            gfx_clip_string(vehicleNameBuffer, columnSplitOffset - 11);
            gfx_draw_string(dpi, vehicleNameBuffer, colour, columnSplitOffset + 1, itemY);
        }
    } while (researchItem++->rawValue != researchItemEndMarker);
}
예제 #14
0
/**
 *
 *  rct2: 0x00699701
 */
static void window_guest_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex)
{
    sint32 spriteIndex, numGuests, i, j, y;
    rct_string_id format;
    rct_peep *peep;
    rct_peep_thought *thought;
    uint32 argument_1, argument_2;

    // Background fill
    gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ColourMapA[w->colours[1]].mid_light);

    switch (_window_guest_list_selected_tab) {
    case PAGE_INDIVIDUAL:
        i = 0;
        y = _window_guest_list_selected_page * -0x7BF2;

        // For each guest
        FOR_ALL_GUESTS(spriteIndex, peep) {
            sprite_set_flashing((rct_sprite*)peep, false);
            if (peep->outside_of_park != 0)
                continue;
            if (_window_guest_list_selected_filter != -1) {
                if (window_guest_list_is_peep_in_filter(peep))
                    continue;
                gWindowMapFlashingFlags |= (1 << 0);
                sprite_set_flashing((rct_sprite*)peep, true);
            }
            if (!guest_should_be_visible(peep))
                continue;

            // Check if y is beyond the scroll control
            if (y + SCROLLABLE_ROW_HEIGHT + 1 >= -0x7FFF &&
                y + SCROLLABLE_ROW_HEIGHT + 1 > dpi->y &&
                y < 0x7FFF &&
                y < dpi->y + dpi->height) {

                // Highlight backcolour and text colour (format)
                format = STR_BLACK_STRING;
                if (i == _window_guest_list_highlighted_index) {
                    gfx_filter_rect(dpi, 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1, PALETTE_DARKEN_1);
                    format = STR_WINDOW_COLOUR_2_STRINGID;
                }

                // Guest name
                set_format_arg(0, rct_string_id, peep->name_string_idx);
                set_format_arg(2, uint32, peep->id);
                gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, 0, y, 113);

                switch (_window_guest_list_selected_view) {
                case VIEW_ACTIONS:
                    // Guest face
                    gfx_draw_sprite(dpi, get_peep_face_sprite_small(peep), 118, y + 1, 0);

                    // Tracking icon
                    if (peep->peep_flags & PEEP_FLAGS_TRACKING)
                        gfx_draw_sprite(dpi, STR_ENTER_SELECTION_SIZE, 112, y + 1, 0);

                    // Action

                    get_arguments_from_action(peep, &argument_1, &argument_2);

                    set_format_arg(0, uint32, argument_1);
                    set_format_arg(4, uint32, argument_2);
                    gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, 133, y, 314);
                    break;
                case VIEW_THOUGHTS:
                    // For each thought
                    for (j = 0; j < PEEP_MAX_THOUGHTS; j++) {
                        thought = &peep->thoughts[j];
                        if (thought->type == PEEP_THOUGHT_TYPE_NONE)
                            break;
                        if (thought->var_2 == 0)
                            continue;
                        if (thought->var_2 > 5)
                            break;

                        peep_thought_set_format_args(&peep->thoughts[j]);
                        gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, 118, y, 329);
                        break;
                    }
                    break;
                }
            }

            // Increment list item index and y
            i++;
            y += SCROLLABLE_ROW_HEIGHT;
        }
        break;
    case PAGE_SUMMARISED:
        y = 0;

        // For each group of guests
        for (i = 0; i < _window_guest_list_num_groups; i++) {
            // Check if y is beyond the scroll control
            if (y + SUMMARISED_GUEST_ROW_HEIGHT + 1 >= dpi->y) {
                // Check if y is beyond the scroll control
                if (y >= dpi->y + dpi->height)
                    break;

                // Highlight backcolour and text colour (format)
                format = STR_BLACK_STRING;
                if (i == _window_guest_list_highlighted_index) {
                    gfx_filter_rect(dpi, 0, y, 800, y + SUMMARISED_GUEST_ROW_HEIGHT, PALETTE_DARKEN_1);
                    format = STR_WINDOW_COLOUR_2_STRINGID;
                }

                // Draw guest faces
                numGuests = _window_guest_list_groups_num_guests[i];
                for (j = 0; j < 56 && j < numGuests; j++)
                    gfx_draw_sprite(dpi, _window_guest_list_groups_guest_faces[i * 56 + j] + SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY, j * 8, y + 12, 0);

                // Draw action
                set_format_arg(0, uint32, _window_guest_list_groups_argument_1[i]);
                set_format_arg(4, uint32, _window_guest_list_groups_argument_2[i]);
                set_format_arg(10, uint32, numGuests);
                gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, 0, y, 414);

                // Draw guest count
                set_format_arg(8, rct_string_id, STR_GUESTS_COUNT_COMMA_SEP);
                gfx_draw_string_right(dpi, format, gCommonFormatArgs + 8, COLOUR_BLACK, 326, y);
            }
            y += SUMMARISED_GUEST_ROW_HEIGHT;
        }
        break;
    }