Example #1
0
void chat_draw()
{
	if (network_get_mode() == NETWORK_MODE_NONE || network_get_status() != NETWORK_STATUS_CONNECTED || network_get_authstatus() != NETWORK_AUTH_OK) {
		gChatOpen = false;
		return;
	}
	rct_drawpixelinfo *dpi = (rct_drawpixelinfo*)RCT2_ADDRESS_SCREEN_DPI;
	_chatLeft = 10;
	_chatTop = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 40 - ((CHAT_HISTORY_SIZE + 1) * 10);
	_chatRight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 10;
	_chatBottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 45;
	char lineBuffer[CHAT_INPUT_SIZE + 10];
	char* lineCh = lineBuffer;
	int x = _chatLeft;
	int y = _chatBottom - (15 * 2);
	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;
	for (int i = 0; i < CHAT_HISTORY_SIZE; i++, y -= 15) {
		if (!gChatOpen && SDL_TICKS_PASSED(SDL_GetTicks(), chat_history_get_time(i) + 10000)) {
			break;
		}
		safe_strcpy(lineBuffer, chat_history_get(i), CHAT_INPUT_SIZE + 10);
		gfx_set_dirty_blocks(x, y, x + gfx_get_string_width(lineBuffer), y + 12);
		gfx_draw_string(dpi, lineBuffer, 255, x, y);
	}
	if (gChatOpen) {
		lineCh = utf8_write_codepoint(lineCh, FORMAT_OUTLINE);
		lineCh = utf8_write_codepoint(lineCh, FORMAT_CELADON);
		safe_strcpy(lineCh, _chatCurrentLine, CHAT_INPUT_SIZE);
		y = _chatBottom - 15;
		gfx_set_dirty_blocks(x, y, x + gfx_get_string_width(lineBuffer) + 7, y + 12);
		gfx_draw_string(dpi, lineBuffer, 255, x, y);
		if (_chatCaretTicks < 15) {
			memcpy(lineBuffer, _chatCurrentLine, gTextInput.selection_offset);
			lineBuffer[gTextInput.selection_offset] = 0;
			int caretX = x + gfx_get_string_width(lineBuffer);
			int caretY = y + 15;

			gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, 0x38);
		}
	}
}
Example #2
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);
}
Example #3
0
void intro_draw(rct_drawpixelinfo *dpi)
{
	int screenWidth = gScreenWidth;

	switch (gIntroState) {
	case INTRO_STATE_DISCLAIMER_1:
	case INTRO_STATE_DISCLAIMER_2:
		break;
	case INTRO_STATE_PUBLISHER_BEGIN:
		gfx_clear(dpi, BACKROUND_COLOUR_DARK);
		break;
	case INTRO_STATE_PUBLISHER_SCROLL:
		gfx_clear(dpi, BACKROUND_COLOUR_DARK);

		// Draw a white rectangle for the logo background (gives a bit of white margin)
		gfx_fill_rect(dpi,
			(screenWidth / 2) - 320 + 50, _introStateCounter + 50,
			(screenWidth / 2) - 320 + 50 + 540, _introStateCounter + 50 + 425,
			BORDER_COLOUR_PUBLISHER);

		// Draw Infogrames logo
		gfx_draw_sprite(dpi, SPR_INTRO_INFOGRAMES_00, (screenWidth / 2) - 320 + 69, _introStateCounter + 69, 0);
		gfx_draw_sprite(dpi, SPR_INTRO_INFOGRAMES_10, (screenWidth / 2) - 320 + 319, _introStateCounter + 69, 0);
		gfx_draw_sprite(dpi, SPR_INTRO_INFOGRAMES_01, (screenWidth / 2) - 320 + 69, _introStateCounter + 319, 0);
		gfx_draw_sprite(dpi, SPR_INTRO_INFOGRAMES_11, (screenWidth / 2) - 320 + 319, _introStateCounter + 319, 0);
		break;
	case INTRO_STATE_DEVELOPER_BEGIN:
		gfx_clear(dpi, BACKROUND_COLOUR_DARK);
		gfx_transpose_palette(PALETTE_G1_IDX_DEVELOPER, 255);
		break;
	case INTRO_STATE_DEVELOPER_SCROLL:
		gfx_clear(dpi, BACKROUND_COLOUR_DARK);

		// Draw Chris Sawyer logo
		gfx_draw_sprite(dpi, SPR_INTRO_CHRIS_SAWYER_00, (screenWidth / 2) - 320 + 70, _introStateCounter, 0);
		gfx_draw_sprite(dpi, SPR_INTRO_CHRIS_SAWYER_10, (screenWidth / 2) - 320 + 320, _introStateCounter, 0);
		break;
	case INTRO_STATE_LOGO_FADE_IN:
		if (_introStateCounter <= 0xFF00) {
			gfx_transpose_palette(PALETTE_G1_IDX_LOGO, (_introStateCounter >> 8) & 0xFF);
		} else {
Example #4
0
/**
 *
 *  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);
}
Example #5
0
static void widget_vscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour)
{
	// Trough
	gfx_fill_rect(dpi, l, t + 10, r, b - 10, *((char*)(0x0141FC4B + (colour * 8))));
	gfx_fill_rect(dpi, l, t + 10, r, b - 10, 0x1000000 | *((char*)(0x0141FC47 + (colour * 8))));
	gfx_fill_rect(dpi, l + 2, t + 10, l + 2, b - 10, *((char*)(0x0141FC47 + (colour * 8))));
	gfx_fill_rect(dpi, l + 3, t + 10, l + 3, b - 10, *((char*)(0x0141FC4B + (colour * 8))));
	gfx_fill_rect(dpi, l + 7, t + 10, l + 7, b - 10, *((char*)(0x0141FC47 + (colour * 8))));
	gfx_fill_rect(dpi, l + 8, t + 10, l + 8, b - 10, *((char*)(0x0141FC4B + (colour * 8))));

	// Up button
	gfx_fill_rect_inset(dpi, l, t, r, t + 9, colour, (scroll->flags & VSCROLLBAR_UP_PRESSED ? 0x20 : 0));
	gfx_draw_string(dpi, (char*)0x009DED66, 0, l + 1, t - 1);

	// Thumb
	gfx_fill_rect_inset(dpi,
		l, max(t + 10, t + scroll->v_thumb_top - 1),
		r, min(b - 10, t + scroll->v_thumb_bottom - 1),
		colour, (scroll->flags & VSCROLLBAR_THUMB_PRESSED ? 0x20 : 0));

	// Down button
	gfx_fill_rect_inset(dpi, l, b - 9, r, b, colour, (scroll->flags & VSCROLLBAR_DOWN_PRESSED ? 0x20 : 0));
	gfx_draw_string(dpi, (char*)0x009DED69, 0, l + 1, b - 8);
}
Example #6
0
static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour)
{
	// Trough
	gfx_fill_rect(dpi, l + 10, t, r - 10, b, *((char*)(0x0141FC4B + (colour * 8))));
	gfx_fill_rect(dpi, l + 10, t, r - 10, b, 0x1000000 | *((char*)(0x0141FC47 + (colour * 8))));
	gfx_fill_rect(dpi, l + 10, t + 2, r - 10, t + 2, *((char*)(0x0141FC47 + (colour * 8))));
	gfx_fill_rect(dpi, l + 10, t + 3, r - 10, t + 3, *((char*)(0x0141FC4B + (colour * 8))));
	gfx_fill_rect(dpi, l + 10, t + 7, r - 10, t + 7, *((char*)(0x0141FC47 + (colour * 8))));
	gfx_fill_rect(dpi, l + 10, t + 8, r - 10, t + 8, *((char*)(0x0141FC4B + (colour * 8))));
	
	// Left button
	gfx_fill_rect_inset(dpi, l, t, l + 9, b, colour, (scroll->flags & HSCROLLBAR_LEFT_PRESSED ? 0x20 : 0));
	gfx_draw_string(dpi, (char*)0x009DED6C, 0, l + 1, t);
	
	// Thumb
	gfx_fill_rect_inset(dpi,
		max(l + 10, l + scroll->h_thumb_left - 1), t,
		min(r - 10, r + scroll->h_thumb_right - 1), t,
		colour, (scroll->flags & HSCROLLBAR_THUMB_PRESSED ? 0x20 : 0));

	// Right button
	gfx_fill_rect_inset(dpi, r - 9, t, r, b, colour, (scroll->flags & HSCROLLBAR_RIGHT_PRESSED ? 0x20 : 0));
	gfx_draw_string(dpi, (char*)0x009DED6F, 0, r - 6, t);
}
Example #7
0
/**
 * 
 *  rct2: 0x006EB2F9
 */
static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
	rct_widget* widget;
	int l, t, r, b, width, 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];

	// 
	if (w->var_4B8 != -1) {
		gfx_draw_sprite(dpi, *((char*)(0x013CA742 + w->var_4B8)) << 19, l + 1, t + 1);
		if (w->width > 638)
			gfx_draw_sprite(dpi, *((char*)(0x013CA742 + w->var_4B8)) << 19, l + 1 + 638, t + 1);
		if (w->var_4B9 != -1) {
			gfx_draw_sprite(dpi, *((char*)(0x013CA742 + w->var_4B9)) << 19, l + 1, t + 1);
			if (w->width > 638)
				gfx_draw_sprite(dpi, *((char*)(0x013CA742 + w->var_4B9)) << 19, l + 1 + 638, t + 1);
		}

		// 
		press = 0x70;
		if (w->flags & 0x0400)
			press |= 0x80;

		gfx_fill_rect_inset(dpi, l, t, r, b, colour, press);
		gfx_fill_rect(dpi, r + 1, t, r + 1, b, *((char*)(0x0141FC47 + (colour * 8))));
	} else {
		// 
		press = 0x60;
		if (w->flags & 0x0400)
			press |= 0x80;

		gfx_fill_rect_inset(dpi, l, t, r, b, colour, press);
		gfx_fill_rect(dpi, l + 1, t + 1, r - 1, b - 1, 0x2000000 | 47);
	}

	// Draw text
	if (widget->image == (uint32)-1)
		return;

	l = widget->left + w->x + 2;
	t = widget->top + w->y + 1;
	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->image, (void*)0x013CE952, 34, l, t, width);
}
/**
 * 
 *  rct2: 0x006AADA3
 */
static void window_editor_object_selection_scrollpaint()
{
	int x, y, i, colour, colour2, numObjects, type;
	short scrollIndex;
	rct_object_entry *entry;
	rct_object_filters *filter;
	rct_window *w;
	rct_drawpixelinfo *dpi;
	uint8 *itemFlags;
	uint8 source;

	window_scrollpaint_get_registers(w, dpi, scrollIndex);

	colour = RCT2_ADDRESS(0x0141FC48, uint8)[w->colours[1] * 8];
	colour = (colour << 24) | (colour << 16) | (colour << 8) | colour;
	gfx_clear(dpi, colour);

	numObjects = RCT2_GLOBAL(RCT2_ADDRESS_OBJECT_LIST_NO_ITEMS, sint32);
	entry = RCT2_GLOBAL(RCT2_ADDRESS_INSTALLED_OBJECT_LIST, rct_object_entry*);
	itemFlags = RCT2_GLOBAL(0x009ADAEC, uint8*);
	y = 0;
	for (i = 0; i < numObjects; i++) {
		filter = get_object_filter(i);
		type = entry->flags & 0x0F;
		source = (entry->flags & 0xF0) >> 4;
		if (type == w->selected_tab && !(*itemFlags & 0x20) && filter_source(entry) && filter_string(entry) && filter_chunks(entry, filter)) {
			if (y + 12 >= dpi->y && y <= dpi->y + dpi->height) {
				// Draw checkbox
				if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) && !(*itemFlags & 0x20))
					gfx_fill_rect_inset(dpi, 2, y, 11, y + 10, w->colours[1], 0xE0);

				// Highlight background
				colour = 142;
				if (entry == (rct_object_entry*)w->var_494 && !(*itemFlags & 0x20)) {
					gfx_fill_rect(dpi, 0, y, w->width, y + 11, 0x2000031);
					colour = 14;
				}

				// Draw checkmark
				if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) && (*itemFlags & 1)) {
					x = 2;
					RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = colour == 14 ? -2 : -1;
					colour2 = w->colours[1] & 0x7F;
					if (*itemFlags & 0x1C)
						colour2 |= 0x40;

					gfx_draw_string(dpi, (char*)0x009DED72, colour2, x, y);
				}

				// Draw text
				char *buffer = (char*)0x0141ED68;
				*buffer = colour;
				strcpy(buffer + 1, object_get_name(entry));
				if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
					while (*buffer != 0 && *buffer != 9)
						buffer++;

					*buffer = 0;
				}

				if (*itemFlags & 0x20) {
					colour = w->colours[1] & 0x7F;
					RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = -1;
				} else {
					colour = 0;
					RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, sint16) = 224;
				}
				x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 15;
				gfx_draw_string(dpi, (char*)0x0141ED68, colour, x, y);
			}
			y += 12;
		}

		entry = object_get_next(entry);
		itemFlags++;
	}
}
Example #9
0
void console_draw(rct_drawpixelinfo *dpi)
{
	if (!gConsoleOpen)
		return;
	int lines = 0;
	int maxLines = ((_consoleBottom - 22 - _consoleTop) / 10) - 1;
	char *ch = strchr(_consoleBuffer, 0);
	while (ch > _consoleBuffer) {
		ch--;
		if (*ch == '\n')
			lines++;
	}

	// Set font
	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = (gConfigInterface.console_small_font ? 0 : 224);
	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;

	// Background
	gfx_fill_rect(dpi, _consoleLeft, _consoleTop, _consoleRight, _consoleBottom, 10);

	int x = _consoleLeft + 4;
	int y = _consoleTop + 4;
	
	// Draw previous lines
	char lineBuffer[1 + 256];
	ch = _consoleViewBufferStart;
	int currentLine = 0;
	int drawLines = 0;
	while (*ch != 0) {
		// Find line break or null terminator
		char *nextLine = ch;
		while (*nextLine != 0 && *nextLine != '\n') {
			nextLine++;
		}

		currentLine++;
		if (currentLine < (lines - maxLines + 4) - _consoleScrollPos) {
			if (*nextLine == '\n') {
				ch = nextLine + 1;
				x = _consoleLeft + 4;
				//y += 10;
			}
			else {
				break;
			}
			continue;
		}

		if (drawLines >= maxLines)
			break;
		drawLines++;

		int lineLength = min(sizeof(lineBuffer) - 1, nextLine - ch);
		strncpy(lineBuffer + 1, ch, lineLength);
		lineBuffer[0] = FORMAT_GREEN;
		lineBuffer[1 + lineLength] = 0;

		gfx_draw_string(dpi, lineBuffer, 255, x, y);

		x = gLastDrawStringX;

		if (*nextLine == '\n') {
			ch = nextLine + 1;
			x = _consoleLeft + 4;
			y += 10;
		} else {
			break;
		}
	}
	x = _consoleLeft + 4;
	y = _consoleBottom - 15;
	// Draw current line
	strcpy(lineBuffer + 1, _consoleCurrentLine);
	lineBuffer[0] = FORMAT_GREEN;
	gfx_draw_string(dpi, lineBuffer, 255, x, y);

	// Draw caret
	if (_consoleCaretTicks < 15) {
		memcpy(lineBuffer, _consoleCurrentLine, gTextInputCursorPosition);
		lineBuffer[gTextInputCursorPosition] = 0;
		int caretX = x + gfx_get_string_width(lineBuffer);
		int caretY = y + 10;

		gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, FORMAT_GREEN);
	}
	gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 21, _consoleRight, _consoleBottom - 21, 14);
	gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 20, _consoleRight, _consoleBottom - 20, 11);

	gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 1, _consoleRight, _consoleBottom - 1, 14);
	gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 0, _consoleRight, _consoleBottom - 0, 12);
}
Example #10
0
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);
        }
    }
}
Example #11
0
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
				);
			}
		}
	}
}
Example #12
0
void gfx_draw_pixel(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 colour)
{
    gfx_fill_rect(dpi, x, y, x, y, colour);
}
Example #13
0
static void window_tile_inspector_scrollpaint()
{
	int x = 15, y = 11 * (window_tile_inspector_item_count - 1), i = 0;
	rct_window *w;
	rct_drawpixelinfo *dpi;
	char buffer[256];

	window_paint_get_registers(w, dpi);

	if (window_tile_inspector_tile_x == -1)
		return;

	rct_map_element *element = map_get_first_element_at(window_tile_inspector_tile_x, window_tile_inspector_tile_y);

	do {

		int type = map_element_get_type(element);
		char *type_name;
		int base_height = element->base_height;
		int clearance_height = element->clearance_height;

		if ((i & 1) != 0)
			gfx_fill_rect(dpi, x - 15, y, x + WW - 20, y + 11, RCT2_GLOBAL(0x0141FC4A + (w->colours[1] * 8), uint8) | 0x1000000);

		switch (type) {
			case MAP_ELEMENT_TYPE_SURFACE:
				sprintf(
					buffer,
					"Surface (%s, %s)",
					language_get_string(STR_TILE_INSPECTOR_TERRAIN_START + map_element_get_terrain(element)),
					language_get_string(STR_TILE_INSPECTOR_TERRAIN_EDGE_START + map_element_get_terrain_edge(element))
				);
				type_name = buffer;
				break;
			case MAP_ELEMENT_TYPE_PATH:
			{
				// TODO: use these
				uint8 pathType, pathDirection;
				pathType = element->properties.path.type >> 2;
				pathDirection = element->properties.path.type & 3;
			}
			sprintf(
				buffer,
				"Path (%s)",
				"" // TODO: queue? has bins? has benches? e.t.c.
			);
			type_name = buffer;
			break;
			case MAP_ELEMENT_TYPE_TRACK:
				type_name = "Track"; // TODO: show type?
				break;
			case MAP_ELEMENT_TYPE_SCENERY:
				sprintf(
					buffer,
					"Scenery (%s)",
					language_get_string(g_smallSceneryEntries[element->properties.scenery.type]->name)
				);
				type_name = buffer;
				break;
			case MAP_ELEMENT_TYPE_ENTRANCE:
				sprintf(
					buffer,
					"Entrance (%s)",
					language_get_string(STR_TILE_INSPECTOR_ENTRANCE_START + element->properties.entrance.type)
					);
				type_name = buffer;
				break;
			case MAP_ELEMENT_TYPE_FENCE:
				sprintf(
					buffer,
					"Fence (%s)",
					language_get_string(g_wallSceneryEntries[element->properties.scenery.type]->name)
					);
				type_name = buffer;
				break;
			case MAP_ELEMENT_TYPE_SCENERY_MULTIPLE:
				type_name = "Scenery multiple";
				break;
			case MAP_ELEMENT_TYPE_BANNER:
				sprintf(
					buffer,
					"Banner (%d)",
					element->properties.banner.index
				);
				type_name = buffer;
				break;
		}

		gfx_draw_string(dpi, type_name, 12, x, y);
		gfx_draw_string_left(dpi, 5182, &base_height, 12, x + 200, y);
		gfx_draw_string_left(dpi, 5182, &clearance_height, 12, x + 280, y);

		uint8 flags = element->flags;
		char j;

		buffer[8] = '\0';

		for (j = 7; j >= 0; j--, flags >>= 1) {
			buffer[j] = flags & 1 ? '1' : '0';
		}

		gfx_draw_string(dpi, buffer, 12, x + 390, y);

		y -= 11;
		i++;

	} while (!map_element_is_last_for_tile(element++));

}
Example #14
0
/**
 *
 *  rct2: 0x006CF8CD
 */
static void window_track_list_scrollpaint()
{
	rct_window *w;
	rct_drawpixelinfo *dpi;
	rct_string_id stringId, stringId2;
	int i, x, y, colour;
	uint8 *trackDesignItem, *trackDesignList = RCT2_ADDRESS(RCT2_ADDRESS_TRACK_LIST, uint8);

	window_paint_get_registers(w, dpi);

	colour = RCT2_GLOBAL(0x00141FC48 + (w->colours[0] * 8), uint8);
	colour = (colour << 24) | (colour << 16) | (colour << 8) | colour;
	gfx_clear(dpi, colour);

	i = 0;
	x = 0;
	y = 0;

	trackDesignItem = trackDesignList;
	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
		if (*trackDesignItem == 0) {
			// No track designs
			gfx_draw_string_left(dpi, STR_NO_TRACK_DESIGNS_OF_THIS_TYPE, NULL, 0, x, y - 1);
			return;
		}
	} else {
		// Build custom track item
		if (i == w->track_list.var_482) {
			// Highlight
			gfx_fill_rect(dpi, x, y, w->width, y + 9, 0x2000000 | 49);
			stringId = 1193;
		} else {
			stringId = 1191;
		}

		stringId2 = STR_BUILD_CUSTOM_DESIGN;
		gfx_draw_string_left(dpi, stringId, &stringId2, 0, x, y - 1);
		y += 10;
		i++;
	}

	while (*trackDesignItem != 0) {
		if (y + 10 >= dpi->y && y < dpi->y + dpi->height) {
			if (i == w->track_list.var_482) {
				// Highlight
				gfx_fill_rect(dpi, x, y, w->width, y + 9, 0x2000000 | 49);
				stringId = 1193;
			} else {
				stringId = 1191;
			}

			// Draw track name
			window_track_list_format_name((char *)language_get_string(3165), trackDesignItem, 0, 1);
			stringId2 = 3165;
			gfx_draw_string_left(dpi, stringId, &stringId2, 0, x, y - 1);
		}
		y += 10;
		i++;
		trackDesignItem += 128;
	}
}
Example #15
0
static void window_dropdown_paint()
{
	rct_window *w;
	rct_drawpixelinfo *dpi;

	__asm mov w, esi
	__asm mov dpi, edi

	window_draw_widgets(w, dpi);

	_dropdown_highlighted_index = RCT2_GLOBAL(0x009DEBA2, sint16);
	{
		int i, cell_x, cell_y, l, t, r, b, item, image, colour;
		for (i = 0; i < _dropdown_num_items; 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,
						*((char*)(0x00141FC47 + (w->colours[0] * 8))));
					gfx_fill_rect(dpi, l, t + 1, r, b + 1,
						*((char*)(0x00141FC4B + (w->colours[0] * 8))));
				}
			} else {
				// 
				if (i == _dropdown_highlighted_index) {
					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 = gDropdownItemsArgs[i];
					if (item == (uint16)-2 && _dropdown_highlighted_index == i)
						image++;

					gfx_draw_sprite(
						dpi,
						image,
						w->x + 2 + (cell_x * _dropdown_item_width),
						w->y + 2 + (cell_y * _dropdown_item_height)
					);
				} else {
					// Text item
					if (i < 32)
						if (gDropdownItemsChecked & (1 << i))
							item++;

					// Calculate colour
					colour = w->colours[0] & 0x7F;
					if (i == _dropdown_highlighted_index)
						colour = 2;
					if (RCT2_GLOBAL(0x009DED34, uint32) & (1 << i))
						if (i < 32)
							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
					);
				}
			}
		}
	}
}
Example #16
0
static void window_title_editor_scrollpaint_commands(rct_window * w, rct_drawpixelinfo * dpi)
{
    sint32 position = -1;
    if (title_is_previewing_sequence() && _selectedTitleSequence == title_get_current_sequence())
    {
        ITitleSequencePlayer * player = window_title_editor_get_player();
        position = title_sequence_player_get_current_position(player);
    }

    sint32 x = 0;
    sint32 y = 0;
    for (sint32 i = 0; i < (sint32)_editingTitleSequence->NumCommands; i++, y += SCROLLABLE_ROW_HEIGHT)
    {
        TitleCommand * command = &_editingTitleSequence->Commands[i];
        bool selected = false;
        bool hover = false;
        bool error = false;
        if (i == w->selected_list_item)
        {
            selected = true;
            gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].dark);
        }
        else if (i == (sint32)_window_title_editor_highlighted_index || i == position)
        {
            hover = true;
            gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].mid_dark);
        }
        else if (i & 1)
        {
            gfx_fill_rect(dpi, x, y, x + SCROLL_WIDTH + 100, y + SCROLLABLE_ROW_HEIGHT - 1, ColourMapA[w->colours[1]].lighter | 0x1000000);
        }

        rct_string_id commandName = STR_NONE;
        switch (command->Type)
        {
        case TITLE_SCRIPT_LOAD:
            commandName = STR_TITLE_EDITOR_COMMAND_LOAD_FILE;
            if (command->SaveIndex == SAVE_INDEX_INVALID)
            {
                commandName = STR_TITLE_EDITOR_COMMAND_LOAD_NO_SAVE;
                error = true;
            }
            else
            {
                set_format_arg(0, uintptr_t, _editingTitleSequence->Saves[command->SaveIndex]);
            }
            break;
        case TITLE_SCRIPT_LOADMM:
            commandName = STR_TITLE_EDITOR_COMMAND_LOAD_SFMM;
            break;
        case TITLE_SCRIPT_LOCATION:
            commandName = STR_TITLE_EDITOR_COMMAND_LOCATION;
            set_format_arg(0, uint16, command->X);
            set_format_arg(2, uint16, command->Y);
            break;
        case TITLE_SCRIPT_ROTATE:
            commandName = STR_TITLE_EDITOR_COMMAND_ROTATE;
            set_format_arg(0, uint16, command->Rotations);
            break;
        case TITLE_SCRIPT_ZOOM:
            commandName = STR_TITLE_EDITOR_COMMAND_ZOOM;
            set_format_arg(0, uint16, command->Zoom);
            break;
        case TITLE_SCRIPT_SPEED:
            commandName = STR_TITLE_EDITOR_COMMAND_SPEED;
            set_format_arg(0, rct_string_id, SpeedNames[command->Speed - 1]);
            break;
        case TITLE_SCRIPT_FOLLOW:
            commandName = STR_TITLE_EDITOR_COMMAND_FOLLOW;
            if (command->SpriteIndex == SPRITE_INDEX_NULL)
            {
                commandName = STR_TITLE_EDITOR_COMMAND_FOLLOW_NO_SPRITE;
            }
            else
            {
                set_format_arg(0, uintptr_t, (uintptr_t)command->SpriteName);
            }
            break;
        case TITLE_SCRIPT_WAIT:
            commandName = STR_TITLE_EDITOR_COMMAND_WAIT;
            set_format_arg(0, uint16, command->Milliseconds);
            break;
        case TITLE_SCRIPT_RESTART:
            commandName = STR_TITLE_EDITOR_RESTART;
            break;
        case TITLE_SCRIPT_END:
            commandName = STR_TITLE_EDITOR_END;
            break;
        case TITLE_SCRIPT_LOADRCT1:
        {
            commandName = STR_TITLE_EDITOR_COMMAND_LOAD_FILE;
            const char * name = "";
            source_desc desc;
            if (scenario_get_source_desc_by_id(command->SaveIndex, &desc))
            {
                name = desc.title;
            }
            set_format_arg(0, uintptr_t, name);
            break;
        }
        case TITLE_SCRIPT_LOADSC:
        {
            commandName = STR_TITLE_EDITOR_COMMAND_LOAD_FILE;
            const char * name = "";
            auto scenario =
                GetScenarioRepository()->GetByInternalName(command->Scenario);
            if (command->Scenario[0] == '\0')
            {
                commandName = STR_TITLE_EDITOR_COMMAND_LOAD_NO_SCENARIO;
            }
            else if (scenario != nullptr)
            {
                name = scenario->name;
            }
            else
            {
                commandName = STR_TITLE_EDITOR_COMMAND_LOAD_MISSING_SCENARIO;
            }
            set_format_arg(0, uintptr_t, name);
            break;
        }
        default:
            log_warning("Unknown command %d", command->Type);
        }

        char buffer[256];
        if ((selected || hover) && !error)
        {
            format_string(buffer, 256, commandName, gCommonFormatArgs);
        }
        else
        {
            format_string(buffer + 1, 255, commandName, gCommonFormatArgs);
            buffer[0] = (utf8)(error ? ((selected || hover) ? FORMAT_LIGHTPINK : FORMAT_RED) : FORMAT_BLACK);
        }
        set_format_arg(0, uintptr_t, &buffer);
        gfx_draw_string_left(dpi, STR_STRING, gCommonFormatArgs, w->colours[1], x + 5, y);
    }
}
Example #17
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;
    }
Example #18
0
/**
 *
 *  rct2: 0x006CF387
 */
static void window_track_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
    window_draw_widgets(w, dpi);

    sint32 trackIndex = w->selected_list_item;
    if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) {
        if (_trackDesignsCount == 0 || trackIndex == -1) {
            return;
        }
    } else if (trackIndex-- == 0) {
        return;
    }

    // Track preview
    sint32 x, y, colour;
    rct_widget *widget = &window_track_list_widgets[WIDX_TRACK_PREVIEW];
    x = w->x + widget->left + 1;
    y = w->y + widget->top + 1;
    colour = ColourMapA[w->colours[0]].darkest;
    gfx_fill_rect(dpi, x, y, x + 369, y + 216, colour);

    if (_loadedTrackDesignIndex != trackIndex) {
        utf8 *path = _trackDesigns[trackIndex].path;
        if (track_list_load_design_for_preview(path)) {
            _loadedTrackDesignIndex = trackIndex;
        } else {
            _loadedTrackDesignIndex = TRACK_DESIGN_INDEX_UNLOADED;
            return;
        }
    }

    rct_track_td6 *td6 = _loadedTrackDesign;
    if (td6 == NULL) {
        return;
    }

    rct_g1_element *substituteElement = &g1Elements[SPR_TEMP];
    rct_g1_element tmpElement = *substituteElement;
    substituteElement->offset = _trackDesignPreviewPixels + (_currentTrackPieceDirection * TRACK_PREVIEW_IMAGE_SIZE);
    substituteElement->width = 370;
    substituteElement->height = 217;
    substituteElement->x_offset = 0;
    substituteElement->y_offset = 0;
    substituteElement->flags = G1_FLAG_BMP;
    gfx_draw_sprite(dpi, 0, x, y, 0);
    *substituteElement = tmpElement;

    x = w->x + (widget->left + widget->right) / 2;
    y = w->y + widget->bottom - 12;

    // Warnings
    if ((td6->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE) && !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) {
        // Vehicle design not available
        gfx_draw_string_centred_clipped(dpi, STR_VEHICLE_DESIGN_UNAVAILABLE, NULL, COLOUR_BLACK, x, y, 368);
        y -= 10;
    }

    if (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE) {
        if (!gTrackDesignSceneryToggle) {
            // Scenery not available
            gfx_draw_string_centred_clipped(dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, NULL, COLOUR_BLACK, x, y, 368);
            y -= 10;
        }
    }

    // Track design name
    utf8 *trackName = _trackDesigns[trackIndex].name;
    gfx_draw_string_centred_clipped(dpi, STR_TRACK_PREVIEW_NAME_FORMAT, &trackName, COLOUR_BLACK, x, y, 368);

    // Information
    x = w->x + widget->left + 1;
    y = w->y + widget->bottom + 2;

    // Stats
    fixed32_2dp rating = td6->excitement * 10;
    gfx_draw_string_left(dpi, STR_TRACK_LIST_EXCITEMENT_RATING, &rating, COLOUR_BLACK, x, y);
    y += 10;

    rating = td6->intensity * 10;
    gfx_draw_string_left(dpi, STR_TRACK_LIST_INTENSITY_RATING, &rating, COLOUR_BLACK, x, y);
    y += 10;

    rating = td6->nausea * 10;
    gfx_draw_string_left(dpi, STR_TRACK_LIST_NAUSEA_RATING, &rating, COLOUR_BLACK, x, y);
    y += 14;

    if (td6->type != RIDE_TYPE_MAZE) {
        if (td6->type == RIDE_TYPE_MINI_GOLF) {
            // Holes
            uint16 holes = td6->holes & 0x1F;
            gfx_draw_string_left(dpi, STR_HOLES, &holes, COLOUR_BLACK, x, y);
            y += 10;
        } else {
            // Maximum speed
            uint16 speed = ((td6->max_speed << 16) * 9) >> 18;
            gfx_draw_string_left(dpi, STR_MAX_SPEED, &speed, COLOUR_BLACK, x, y);
            y += 10;

            // Average speed
            speed = ((td6->average_speed << 16) * 9) >> 18;
            gfx_draw_string_left(dpi, STR_AVERAGE_SPEED, &speed, COLOUR_BLACK, x, y);
            y += 10;
        }

        // Ride length
        set_format_arg(0, rct_string_id, STR_RIDE_LENGTH_ENTRY);
        set_format_arg(2, uint16, td6->ride_length);
        gfx_draw_string_left_clipped(dpi, STR_TRACK_LIST_RIDE_LENGTH, gCommonFormatArgs, COLOUR_BLACK, x, y, 214);
        y += 10;
    }

    if (ride_type_has_flag(td6->type, RIDE_TYPE_FLAG_HAS_G_FORCES)) {
        // Maximum positive vertical Gs
        sint32 gForces = td6->max_positive_vertical_g * 32;
        gfx_draw_string_left(dpi, STR_MAX_POSITIVE_VERTICAL_G, &gForces, COLOUR_BLACK, x, y);
        y += 10;

        // Maximum negative vertical Gs
        gForces = td6->max_negative_vertical_g * 32;
        gfx_draw_string_left(dpi, STR_MAX_NEGATIVE_VERTICAL_G, &gForces, COLOUR_BLACK, x, y);
        y += 10;

        // Maximum lateral Gs
        gForces = td6->max_lateral_g * 32;
        gfx_draw_string_left(dpi, STR_MAX_LATERAL_G, &gForces, COLOUR_BLACK, x, y);
        y += 10;

        // If .TD6
        if (td6->version_and_colour_scheme / 4 >= 2) {
            if (td6->total_air_time != 0) {
                // Total air time
                sint32 airTime = td6->total_air_time * 25;
                gfx_draw_string_left(dpi, STR_TOTAL_AIR_TIME, &airTime, COLOUR_BLACK, x, y);
                y += 10;
            }
        }
    }

    if (ride_type_has_flag(td6->type, RIDE_TYPE_FLAG_HAS_DROPS)) {
        // Drops
        uint16 drops = td6->drops & 0x3F;
        gfx_draw_string_left(dpi, STR_DROPS, &drops, COLOUR_BLACK, x, y);
        y += 10;

        // Drop height is multiplied by 0.75
        uint16 highestDropHeight = (td6->highest_drop_height * 3) / 4;
        gfx_draw_string_left(dpi, STR_HIGHEST_DROP_HEIGHT, &highestDropHeight, COLOUR_BLACK, x, y);
        y += 10;
    }

    if (td6->type != RIDE_TYPE_MINI_GOLF) {
        uint16 inversions = td6->inversions & 0x1F;
        if (inversions != 0) {
            // Inversions
            gfx_draw_string_left(dpi, STR_INVERSIONS, &inversions, COLOUR_BLACK, x, y);
            y += 10;
        }
    }
    y += 4;

    if (td6->space_required_x != 0xFF) {
        // Space required
        set_format_arg(0, uint16, td6->space_required_x);
        set_format_arg(2, uint16, td6->space_required_y);
        gfx_draw_string_left(dpi, STR_TRACK_LIST_SPACE_REQUIRED, gCommonFormatArgs, COLOUR_BLACK, x, y);
        y += 10;
    }

    if (td6->cost != 0) {
        gfx_draw_string_left(dpi, STR_TRACK_LIST_COST_AROUND, &td6->cost, COLOUR_BLACK, x, y);
    }
}
/**
 *
 *  rct2: 0x00684EE0
 */
static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
    rct_widget* widget;
    rct_research_item* researchItem;
    rct_string_id stringId;
    int32_t x, y, width;

    window_draw_widgets(w, dpi);

    // Tab image
    x = w->x + w->widgets[WIDX_TAB_1].left;
    y = w->y + w->widgets[WIDX_TAB_1].top;
    gfx_draw_sprite(dpi, SPR_TAB_FINANCES_RESEARCH_0 + (w->frame_no / 2) % 8, x, y, 0);

    // Pre-researched items label
    x = w->x + w->widgets[WIDX_PRE_RESEARCHED_SCROLL].left;
    y = w->y + w->widgets[WIDX_PRE_RESEARCHED_SCROLL].top - 11;
    gfx_draw_string_left(dpi, STR_INVENTION_PREINVENTED_ITEMS, nullptr, COLOUR_BLACK, x, y - 1);

    // Research order label
    x = w->x + w->widgets[WIDX_RESEARCH_ORDER_SCROLL].left;
    y = w->y + w->widgets[WIDX_RESEARCH_ORDER_SCROLL].top - 11;
    gfx_draw_string_left(dpi, STR_INVENTION_TO_BE_INVENTED_ITEMS, nullptr, COLOUR_BLACK, x, y - 1);

    // Preview background
    widget = &w->widgets[WIDX_PREVIEW];
    gfx_fill_rect(
        dpi, w->x + widget->left + 1, w->y + widget->top + 1, w->x + widget->right - 1, w->y + widget->bottom - 1,
        ColourMapA[w->colours[1]].darkest);

    researchItem = _editorInventionsListDraggedItem;
    if (researchItem == nullptr)
        researchItem = w->research_item;
    // If the research item is null or a list separator.
    if (researchItem == nullptr || researchItem->rawValue < 0)
        return;

    // Preview image
    int32_t objectEntryType = OBJECT_TYPE_SCENERY_GROUP;
    if (researchItem->type == RESEARCH_ENTRY_TYPE_RIDE)
        objectEntryType = OBJECT_TYPE_RIDE;

    auto chunk = object_entry_get_chunk(objectEntryType, researchItem->entryIndex);
    if (chunk == nullptr)
        return;

    auto entry = object_entry_get_entry(objectEntryType, researchItem->entryIndex);

    // Draw preview
    widget = &w->widgets[WIDX_PREVIEW];

    void* object = object_manager_get_loaded_object(entry);
    if (object != nullptr)
    {
        rct_drawpixelinfo clipDPI;
        x = w->x + widget->left + 1;
        y = w->y + widget->top + 1;
        width = widget->right - widget->left - 1;
        int32_t height = widget->bottom - widget->top - 1;
        if (clip_drawpixelinfo(&clipDPI, dpi, x, y, width, height))
        {
            object_draw_preview(object, &clipDPI, width, height);
        }
    }

    // Item name
    x = w->x + ((widget->left + widget->right) / 2) + 1;
    y = w->y + widget->bottom + 3;
    width = w->width - w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right - 6;

    rct_string_id drawString = window_editor_inventions_list_prepare_name(researchItem, false);
    gfx_draw_string_centred_clipped(dpi, drawString, gCommonFormatArgs, COLOUR_BLACK, x, y, width);
    y += 15;

    // Item category
    x = w->x + w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right + 4;
    stringId = EditorInventionsResearchCategories[researchItem->category];
    gfx_draw_string_left(dpi, STR_INVENTION_RESEARCH_GROUP, &stringId, COLOUR_BLACK, x, y);
}
Example #20
0
static void window_text_input_paint(){
	rct_window *w;
	rct_drawpixelinfo *dpi;

	window_paint_get_registers(w, dpi);

	window_draw_widgets(w, dpi);

	int y = w->y + 25;
	
	int no_lines = 0;
	int font_height = 0;
	

	gfx_draw_string_centred(dpi, input_text_description, w->x + WW / 2, y, w->colours[1], &TextInputDescriptionArgs);

	y += 25;

	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;

	char wrapped_string[512];
	strcpy(wrapped_string, text_input);

	// String length needs to add 12 either side of box
	// +13 for cursor when max length.
	gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height);

	gfx_fill_rect_inset(dpi, w->x + 10, y, w->x + WW - 10, y + 10 * (no_lines + 1) + 3, w->colours[1], 0x60);

	y += 1;

	char* wrap_pointer = wrapped_string;
	int char_count = 0;
	uint8 cur_drawn = 0;

	for (int line = 0; line <= no_lines; ++line){
		gfx_draw_string(dpi, wrap_pointer, w->colours[1], w->x + 12, y);

		int string_length = get_string_length(wrap_pointer);

		if (!cur_drawn && (gTextInputCursorPosition <= char_count + string_length)){
			// Make a copy of the string for measuring the width.
			char temp_string[512] = { 0 };
			memcpy(temp_string, wrap_pointer, gTextInputCursorPosition - char_count);
			int cur_x = w->x + 13 + gfx_get_string_width(temp_string);

			int width = 6;
			if ((uint32)gTextInputCursorPosition < strlen(text_input)){
				// Make a new 1 character wide string for measuring the width
				// of the character that the cursor is under.
				temp_string[1] = '\0';
				temp_string[0] = text_input[gTextInputCursorPosition];
				width = max(gfx_get_string_width(temp_string) - 2, 4);
			}

			if (w->frame_no > 15){
				uint8 colour = RCT2_ADDRESS(0x0141FC48, uint8)[w->colours[1] * 8];
				gfx_fill_rect(dpi, cur_x, y + 9, cur_x + width, y + 9, colour + 5);
			}

			cur_drawn++;
		}
		
		wrap_pointer += string_length + 1;

		if (text_input[char_count + string_length] == ' ')char_count++;
		char_count += string_length;

		y += 10;
	}
}
Example #21
0
static void
draw_player_face(int x, int y, int player, frame_t *frame)
{
	gfx_fill_rect(8*x, y, 48, 72, game.player[player]->color, frame);
	draw_icon(x+1, y+4, get_player_face_sprite(game.pl_init[player].face), frame);
}
Example #22
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);
            }
        }
    }
}
Example #23
0
/**
 *
 *  rct2: 0x006D3B1F
 */
static void window_install_track_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
    window_draw_widgets(w, dpi);

    // Track preview
    rct_widget* widget = &window_install_track_widgets[WIDX_TRACK_PREVIEW];
    int32_t x = w->x + widget->left + 1;
    int32_t y = w->y + widget->top + 1;
    int32_t colour = ColourMapA[w->colours[0]].darkest;
    gfx_fill_rect(dpi, x, y, x + 369, y + 216, colour);

    rct_g1_element g1temp = {};
    g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * TRACK_PREVIEW_IMAGE_SIZE);
    g1temp.width = 370;
    g1temp.height = 217;
    g1temp.flags = G1_FLAG_BMP;
    gfx_set_g1_element(SPR_TEMP, &g1temp);
    gfx_draw_sprite(dpi, SPR_TEMP, x, y, 0);

    x = w->x + (widget->left + widget->right) / 2;
    y = w->y + widget->bottom - 12;

    // Warnings
    rct_track_td6* td6 = _trackDesign;
    if (td6->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)
    {
        if (!gTrackDesignSceneryToggle)
        {
            // Scenery not available
            gfx_draw_string_centred_clipped(
                dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, nullptr, COLOUR_BLACK, x, y, 368);
            y -= LIST_ROW_HEIGHT;
        }
    }

    // Information
    x = w->x + widget->left + 1;
    y = w->y + widget->bottom + 4;
    // 0x006D3CF1 -- 0x006d3d71 missing

    // Track design name & type
    auto trackName = _trackName.c_str();
    gfx_draw_string_left(dpi, STR_TRACK_DESIGN_NAME, &trackName, COLOUR_BLACK, x - 1, y);
    y += LIST_ROW_HEIGHT;

    rct_ride_name rideName;
    rct_string_id friendlyTrackName;

    void* objectEntry = object_manager_load_object(&td6->vehicle_object);
    if (objectEntry != nullptr)
    {
        int32_t groupIndex = object_manager_get_loaded_object_entry_index(objectEntry);
        rideName = get_ride_naming(td6->type, get_ride_entry(groupIndex));
        friendlyTrackName = rideName.name;
    }
    else
    {
        // Fall back on the technical track name if the vehicle object cannot be loaded
        friendlyTrackName = RideNaming[td6->type].name;
    }

    gfx_draw_string_left(dpi, STR_TRACK_DESIGN_TYPE, &friendlyTrackName, COLOUR_BLACK, x, y);
    y += LIST_ROW_HEIGHT + 4;

    // Stats
    fixed32_2dp rating = td6->excitement * 10;
    gfx_draw_string_left(dpi, STR_TRACK_LIST_EXCITEMENT_RATING, &rating, COLOUR_BLACK, x, y);
    y += LIST_ROW_HEIGHT;

    rating = td6->intensity * 10;
    gfx_draw_string_left(dpi, STR_TRACK_LIST_INTENSITY_RATING, &rating, COLOUR_BLACK, x, y);
    y += LIST_ROW_HEIGHT;

    rating = td6->nausea * 10;
    gfx_draw_string_left(dpi, STR_TRACK_LIST_NAUSEA_RATING, &rating, COLOUR_BLACK, x, y);
    y += LIST_ROW_HEIGHT + 4;

    if (td6->type != RIDE_TYPE_MAZE)
    {
        if (td6->type == RIDE_TYPE_MINI_GOLF)
        {
            // Holes
            uint16_t holes = td6->holes & 0x1F;
            gfx_draw_string_left(dpi, STR_HOLES, &holes, COLOUR_BLACK, x, y);
            y += LIST_ROW_HEIGHT;
        }
        else
        {
            // Maximum speed
            uint16_t speed = ((td6->max_speed << 16) * 9) >> 18;
            gfx_draw_string_left(dpi, STR_MAX_SPEED, &speed, COLOUR_BLACK, x, y);
            y += LIST_ROW_HEIGHT;

            // Average speed
            speed = ((td6->average_speed << 16) * 9) >> 18;
            gfx_draw_string_left(dpi, STR_AVERAGE_SPEED, &speed, COLOUR_BLACK, x, y);
            y += LIST_ROW_HEIGHT;
        }

        // Ride length
        set_format_arg(0, rct_string_id, STR_RIDE_LENGTH_ENTRY);
        set_format_arg(2, uint16_t, td6->ride_length);
        gfx_draw_string_left_clipped(dpi, STR_TRACK_LIST_RIDE_LENGTH, gCommonFormatArgs, COLOUR_BLACK, x, y, 214);
        y += LIST_ROW_HEIGHT;
    }

    if (ride_type_has_flag(td6->type, RIDE_TYPE_FLAG_HAS_G_FORCES))
    {
        // Maximum positive vertical Gs
        int32_t gForces = td6->max_positive_vertical_g * 32;
        gfx_draw_string_left(dpi, STR_MAX_POSITIVE_VERTICAL_G, &gForces, COLOUR_BLACK, x, y);
        y += LIST_ROW_HEIGHT;

        // Maximum negative vertical Gs
        gForces = td6->max_negative_vertical_g * 32;
        gfx_draw_string_left(dpi, STR_MAX_NEGATIVE_VERTICAL_G, &gForces, COLOUR_BLACK, x, y);
        y += LIST_ROW_HEIGHT;

        // Maximum lateral Gs
        gForces = td6->max_lateral_g * 32;
        gfx_draw_string_left(dpi, STR_MAX_LATERAL_G, &gForces, COLOUR_BLACK, x, y);
        y += LIST_ROW_HEIGHT;

        // If .TD6
        if (td6->version_and_colour_scheme / 4 >= 2)
        {
            if (td6->total_air_time != 0)
            {
                // Total air time
                int32_t airTime = td6->total_air_time * 25;
                gfx_draw_string_left(dpi, STR_TOTAL_AIR_TIME, &airTime, COLOUR_BLACK, x, y);
                y += LIST_ROW_HEIGHT;
            }
        }
    }

    if (ride_type_has_flag(td6->type, RIDE_TYPE_FLAG_HAS_DROPS))
    {
        // Drops
        uint16_t drops = td6->drops & 0x3F;
        gfx_draw_string_left(dpi, STR_DROPS, &drops, COLOUR_BLACK, x, y);
        y += LIST_ROW_HEIGHT;

        // Drop height is multiplied by 0.75
        gfx_draw_string_left(dpi, STR_HIGHEST_DROP_HEIGHT, &drops, COLOUR_BLACK, x, y);
        y += LIST_ROW_HEIGHT;
    }

    if (td6->type != RIDE_TYPE_MINI_GOLF)
    {
        uint16_t inversions = td6->inversions & 0x1F;
        if (inversions != 0)
        {
            // Inversions
            gfx_draw_string_left(dpi, STR_INVERSIONS, &inversions, COLOUR_BLACK, x, y);
            y += LIST_ROW_HEIGHT;
        }
    }
    y += 4;

    if (td6->space_required_x != 0xFF)
    {
        // Space required
        set_format_arg(0, uint16_t, td6->space_required_x);
        set_format_arg(2, uint16_t, td6->space_required_y);
        gfx_draw_string_left(dpi, STR_TRACK_LIST_SPACE_REQUIRED, gCommonFormatArgs, COLOUR_BLACK, x, y);
        y += LIST_ROW_HEIGHT;
    }

    if (td6->cost != 0)
    {
        gfx_draw_string_left(dpi, STR_TRACK_LIST_COST_AROUND, &td6->cost, COLOUR_BLACK, x, y);
    }
}
Example #24
0
static void window_text_input_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	window_draw_widgets(w, dpi);

	sint32 y = w->y + 25;

	sint32 no_lines = 0;
	sint32 font_height = 0;


	gfx_draw_string_centred(dpi, input_text_description, w->x + WW / 2, y, w->colours[1], &TextInputDescriptionArgs);

	y += 25;

	gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
	gCurrentFontFlags = 0;

	char wrapped_string[512];
	safe_strcpy(wrapped_string, text_input, 512);

	// String length needs to add 12 either side of box
	// +13 for cursor when max length.
	gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height);

	gfx_fill_rect_inset(dpi, w->x + 10, y, w->x + WW - 10, y + 10 * (no_lines + 1) + 3, w->colours[1], INSET_RECT_F_60);

	y += 1;

	char* wrap_pointer = wrapped_string;
	size_t char_count = 0;
	uint8 cur_drawn = 0;

	sint32 cursorX = 0, cursorY = 0;
	for (sint32 line = 0; line <= no_lines; line++) {
		gfx_draw_string(dpi, wrap_pointer, w->colours[1], w->x + 12, y);

		size_t string_length = get_string_size(wrap_pointer) - 1;

		if (!cur_drawn && (gTextInput.selection_offset <= char_count + string_length)) {
			// Make a copy of the string for measuring the width.
			char temp_string[512] = { 0 };
			memcpy(temp_string, wrap_pointer, gTextInput.selection_offset - char_count);
			cursorX = w->x + 13 + gfx_get_string_width(temp_string);
			cursorY = y;

			sint32 width = 6;
			if (gTextInput.selection_offset < strlen(text_input)){
				// Make a 1 utf8-character wide string for measuring the width
				// of the currently selected character.
				utf8 tmp[5] = { 0 }; // This is easier than setting temp_string[0..5]
				uint32 codepoint = utf8_get_next(text_input + gTextInput.selection_offset, NULL);
				utf8_write_codepoint(tmp, codepoint);
				width = max(gfx_get_string_width(tmp) - 2, 4);
			}

			if (w->frame_no > 15){
				uint8 colour = ColourMapA[w->colours[1]].mid_light;
				gfx_fill_rect(dpi, cursorX, y + 9, cursorX + width, y + 9, colour + 5);
			}

			cur_drawn++;
		}

		wrap_pointer += string_length + 1;

		if (text_input[char_count + string_length] == ' ')char_count++;
		char_count += string_length;

		y += 10;
	}

	if (!cur_drawn) {
		cursorX = gLastDrawStringX;
		cursorY = y - 10;
	}

	// IME composition
	if (gTextInputCompositionActive) {
		draw_ime_composition(dpi, cursorX, cursorY);
	}
}
Example #25
0
static void window_text_input_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	window_draw_widgets(w, dpi);

	int y = w->y + 25;

	int no_lines = 0;
	int font_height = 0;


	gfx_draw_string_centred(dpi, input_text_description, w->x + WW / 2, y, w->colours[1], &TextInputDescriptionArgs);

	y += 25;

	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
	RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0;

	char wrapped_string[512];
	safe_strcpy(wrapped_string, text_input, 512);

	// String length needs to add 12 either side of box
	// +13 for cursor when max length.
	gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height);

	gfx_fill_rect_inset(dpi, w->x + 10, y, w->x + WW - 10, y + 10 * (no_lines + 1) + 3, w->colours[1], 0x60);

	y += 1;

	char* wrap_pointer = wrapped_string;
	int char_count = 0;
	uint8 cur_drawn = 0;

	int cursorX, cursorY;
	for (int line = 0; line <= no_lines; line++) {
		gfx_draw_string(dpi, wrap_pointer, w->colours[1], w->x + 12, y);

		int string_length = get_string_size(wrap_pointer) - 1;

		if (!cur_drawn && (gTextInput.selection_offset <= (size_t)(char_count + string_length))) {
			// Make a copy of the string for measuring the width.
			char temp_string[512] = { 0 };
			memcpy(temp_string, wrap_pointer, gTextInput.selection_offset - char_count);
			cursorX = w->x + 13 + gfx_get_string_width(temp_string);
			cursorY = y;

			int width = 6;
			if ((uint32)gTextInput.selection_offset < strlen(text_input)){
				// Make a new 1 character wide string for measuring the width
				// of the character that the cursor is under.
				temp_string[1] = '\0';
				temp_string[0] = text_input[gTextInput.selection_offset];
				width = max(gfx_get_string_width(temp_string) - 2, 4);
			}

			if (w->frame_no > 15){
				uint8 colour = ColourMapA[w->colours[1]].mid_light;
				gfx_fill_rect(dpi, cursorX, y + 9, cursorX + width, y + 9, colour + 5);
			}

			cur_drawn++;
		}

		wrap_pointer += string_length + 1;

		if (text_input[char_count + string_length] == ' ')char_count++;
		char_count += string_length;

		y += 10;
	}

	if (!cur_drawn) {
		cursorX = gLastDrawStringX;
		cursorY = y - 10;
	}

	// IME composition
	if (gTextInputCompositionActive) {
		int compositionWidth = gfx_get_string_width(gTextInputComposition);
		int x = cursorX - (compositionWidth / 2);
		int y = cursorY + 13;
		int w = compositionWidth;
		int h = 10;

		gfx_fill_rect(dpi, x - 1, y - 1, x + w + 1, y + h + 1, 12);
		gfx_fill_rect(dpi, x, y, x + w, y + h, 0);
		gfx_draw_string(dpi, gTextInputComposition, 12, x, y);
	}
}
Example #26
0
/**
 *
 *  rct2: 0x00699701
 */
static void window_guest_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
{
	int spriteIndex, format, numGuests, i, j, y;
	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) {
			peep->var_0C &= ~0x200;
			if (peep->outside_of_park != 0)
				continue;
			if (_window_guest_list_selected_filter != -1) {
				if (window_guest_list_is_peep_in_filter(peep))
					continue;
				RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_MAP_FLASHING_FLAGS, uint16) |= (1 << 0);
				peep->var_0C |= 0x200;
			}
			if (_window_guest_list_tracking_only && !(peep->flags & PEEP_FLAGS_TRACKING))
				continue;

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

				// Highlight backcolour and text colour (format)
				format = 1191;
				if (i == _window_guest_list_highlighted_index) {
					gfx_fill_rect(dpi, 0, y, 800, y + 9, 0x02000031);
					format = 1193;
				}

				// Guest name
				RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = peep->name_string_idx;
				RCT2_GLOBAL(0x013CE954, uint32) = peep->id;
				gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 0, y - 1, 113);

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

					// Tracking icon
					if (peep->flags & PEEP_FLAGS_TRACKING)
						gfx_draw_sprite(dpi, 5129, 112, y, 0);

					// Action

					get_arguments_from_action(peep, &argument_1, &argument_2);

					RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument_1;
					RCT2_GLOBAL(0x013CE952 + 4, uint32) = argument_2;
					gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 133, y - 1, 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;

						get_arguments_from_thought(peep->thoughts[j], &argument_1, &argument_2);

						RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = argument_1;
						RCT2_GLOBAL(0x013CE952 + 4, uint32) = argument_2;
						gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 118, y - 1, 329);
						break;
					}
					break;
				}
			}

			// Increment list item index and y
			i++;
			y += 10;
		}
		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 + 22 >= dpi->y) {
				// Check if y is beyond the scroll control
				if (y >= dpi->y + dpi->height)
					break;

				// Highlight backcolour and text colour (format)
				format = 1191;
				if (i == _window_guest_list_highlighted_index) {
					gfx_fill_rect(dpi, 0, y, 800, y + 20, 0x02000031);
					format = 1193;
				}

				// 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] + 5486, j * 8, y + 9, 0);

				// Draw action
				RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint32) = _window_guest_list_groups_argument_1[i];
				RCT2_GLOBAL(0x013CE952 + 4, uint32) = _window_guest_list_groups_argument_2[i];
				RCT2_GLOBAL(0x013CE952 + 10, uint32) = numGuests;
				gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 0, y - 1, 414);

				// Draw guest count
				RCT2_GLOBAL(0x013CE95A, uint16) = STR_GUESTS_COUNT_COMMA_SEP;
				gfx_draw_string_right(dpi, format, (void*)0x0013CE95A, 0, 326, y - 1);
			}
			y += 21;
		}
		break;
	}
Example #27
0
static void
game_init_box_draw(game_init_box_t *box, frame_t *frame)
{
	/* Background */
	gfx_fill_rect(0, 0, box->obj.width, box->obj.height, 1, frame);

	const int layout[] = {
		251, 0, 40, 252, 0, 112, 253, 0, 48,
		254, 5, 48, 255, 9, 48,
		251, 10, 40, 252, 10, 112, 253, 10, 48,
		254, 15, 48, 255, 19, 48,
		251, 20, 40, 252, 20, 112, 253, 20, 48,
		254, 25, 48, 255, 29, 48,
		251, 30, 40, 252, 30, 112, 253, 30, 48,
		254, 35, 48, 255, 39, 48,

		266, 0, 0, 267, 31, 0, 316, 36, 0,
		-1
	};

	const int *i = layout;
	while (i[0] >= 0) {
		draw_box_icon(i[1], i[2], i[0], frame);
		i += 3;
	}

	/* Game type settings */
	if (box->game_mission < 0) {
		draw_box_icon(5, 0, 263, frame);

		char map_size[4] = {0};
		sprintf(map_size, "%d", box->map_size);

		draw_box_string(10, 0, frame, "Start new game");
		draw_box_string(10, 14, frame, "Map size:");
		draw_box_string(20, 14, frame, map_size);
	} else {
		draw_box_icon(5, 0, 260, frame);

		char level[4] = {0};
		sprintf(level, "%d", box->game_mission+1);

		draw_box_string(10, 0, frame, "Start mission");
		draw_box_string(10, 14, frame, "Mission:");
		draw_box_string(20, 14, frame, level);
	}

	draw_box_icon(28, 0, 237, frame);
	draw_box_icon(28, 16, 240, frame);

	/* Game info */
	if (box->game_mission < 0) {
		for (int i = 0; i < 4; i++) {
			int face = i == 0 ? 12 : 0;
			draw_box_icon(10*i+1, 48, get_player_face_sprite(face), frame);
			draw_box_icon(10*i+6, 48, 282, frame);

			int intelligence = i == 0 ? 40 : 0;
			gfx_fill_rect(80*i+78, 124-intelligence, 4, intelligence, 30, frame);

			int supplies = i == 0 ? 40 : 0;
			gfx_fill_rect(80*i+72, 124-supplies, 4, supplies, 67, frame);

			int reproduction = i == 0 ? 40 : 0;
			gfx_fill_rect(80*i+84, 124-reproduction, 4, reproduction, 75, frame);
		}
	} else {
		int m = box->game_mission;
		for (int i = 0; i < 4; i++) {
			int face = i == 0 ? 12 : mission[m].player[i].face;
			draw_box_icon(10*i+1, 48, get_player_face_sprite(face), frame);
			draw_box_icon(10*i+6, 48, 282, frame);

			int intelligence = i == 0 ? 40 : mission[m].player[i].intelligence;
			gfx_fill_rect(80*i+78, 124-intelligence, 4, intelligence, 30, frame);

			int supplies = mission[m].player[i].supplies;
			gfx_fill_rect(80*i+72, 124-supplies, 4, supplies, 67, frame);

			int reproduction = mission[m].player[i].reproduction;
			gfx_fill_rect(80*i+84, 124-reproduction, 4, reproduction, 75, frame);
		}
	}

	draw_box_icon(38, 128, 60, frame); /* exit */
}
Example #28
0
/**
*
*  rct2: 0x0068CDA9
*/
static void window_map_paint()
{
	//RCT2_CALLPROC_EBPSAFE(0x0068CDA9);
	rct_window *w;
	rct_drawpixelinfo *dpi;
	int image_id;
	int i, x, y;

	__asm mov w, esi
	__asm mov dpi, edi

	window_draw_widgets(w, dpi);

	// guest tab image (animated)
	image_id = SPR_TAB_GUESTS_0;
	if (w->selected_tab == 0)
		image_id += w->var_490 / 4;

	gfx_draw_sprite(dpi, image_id, 
		w->x + w->widgets[WIDX_PEOPLE_TAB].left, 
		w->y + w->widgets[WIDX_PEOPLE_TAB].top);

	// ride/stall tab image (animated)
	image_id = SPR_TAB_RIDE_0;
	if (w->selected_tab == 1)
		image_id += w->var_490 / 4;

	gfx_draw_sprite(dpi, image_id,
		w->x + w->widgets[WIDX_RIDES_TAB].left,
		w->y + w->widgets[WIDX_RIDES_TAB].top);

	// people starting position (scenario editor only)
	if (w->widgets[WIDX_PEOPLE_STARTING_POSITION].type != 0) {
		gfx_draw_sprite(dpi, 0x0B6E0190A,
			w->x + w->widgets[WIDX_PEOPLE_STARTING_POSITION].left + 12,
			w->y + w->widgets[WIDX_PEOPLE_STARTING_POSITION].top + 18);
	}

	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)) {
		// render the map legend
		if (w->selected_tab != 0) {
			x = w->x + 4;
			y = w->y + w->widgets[WIDX_MAP].bottom + 2;

			for (i = 0; i < 8; i++) {
				gfx_fill_rect(dpi, x, y + 2, x + 6, y + 8, RCT2_GLOBAL(0x00981BCC+ 2 * i, uint8));
				gfx_draw_string_left(dpi, STR_MAP_RIDE + i, w, 0, x + 10, y);
				y += 10;
				if (i == 3) {
					x += 118;
					y -= 40;
				}
			}
		}

		if ((RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) != WC_MAP) &&
			(RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint8) != WIDX_BUY_LAND))
			return;
	}

	gfx_draw_string_left(dpi, STR_MAP_SIZE, 0, 0, w->x + 4, w->y + w->widgets[WIDX_MAP_SIZE_SPINNER].top + 1);
}
Example #29
0
/**
 *
 *  rct2: 0x006CF387
 */
static void window_track_list_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	rct_widget *widget;
	rct_track_design *trackDesign = NULL;
	uint8 *image;
	utf8 *trackDesignList = RCT2_ADDRESS(RCT2_ADDRESS_TRACK_LIST, utf8);
	uint16 holes, speed, drops, dropHeight, inversions;
	fixed32_2dp rating;
	int trackIndex, x, y, colour, gForces, airTime;
	rct_g1_element tmpElement, *substituteElement;

	window_draw_widgets(w, dpi);

	trackIndex = w->track_list.var_482;
	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
		if (*trackDesignList == 0 || trackIndex == -1)
			return;
	} else if (trackIndex-- == 0) {
		return;
	}

	// Track preview
	widget = &window_track_list_widgets[WIDX_TRACK_PREVIEW];
	x = w->x + widget->left + 1;
	y = w->y + widget->top + 1;
	colour = ColourMapA[w->colours[0]].darkest;
	gfx_fill_rect(dpi, x, y, x + 369, y + 216, colour);

	trackDesign = track_get_info(trackIndex, &image);
	if (trackDesign == NULL)
		return;

	rct_track_td6* track_td6 = &trackDesign->track_td6;

	substituteElement = &g1Elements[0];
	tmpElement = *substituteElement;
	substituteElement->offset = image;
	substituteElement->width = 370;
	substituteElement->height = 217;
	substituteElement->x_offset = 0;
	substituteElement->y_offset = 0;
	substituteElement->flags = G1_FLAG_BMP;
	gfx_draw_sprite(dpi, 0, x, y, 0);
	*substituteElement = tmpElement;

	x = w->x + (widget->left + widget->right) / 2;
	y = w->y + widget->bottom - 12;

	RCT2_GLOBAL(0x00F44153, uint8) = 0;
	// Warnings
	if ((track_td6->track_flags & 4) && !(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) {
		// Vehicle design not available
		gfx_draw_string_centred_clipped(dpi, STR_VEHICLE_DESIGN_UNAVAILABLE, NULL, 0, x, y, 368);
		y -= 10;
	}

	if (track_td6->track_flags & 1) {
		RCT2_GLOBAL(0x00F44153, uint8) = 1;
		if (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) == 0) {
			// Scenery not available
			gfx_draw_string_centred_clipped(dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, NULL, 0, x, y, 368);
			y -= 10;
		}
	}

	// Track design name
	window_track_list_format_name((char*)0x009BC677, trackDesignList + (trackIndex * 128), FORMAT_WINDOW_COLOUR_1, 1);
	gfx_draw_string_centred_clipped(dpi, 3165, NULL, 0, x, y, 368);

	// Information
	x = w->x + widget->left + 1;
	y = w->y + widget->bottom + 2;

	// Stats
	rating = track_td6->excitement * 10;
	gfx_draw_string_left(dpi, STR_TRACK_LIST_EXCITEMENT_RATING, &rating, 0, x, y);
	y += 10;

	rating = track_td6->intensity * 10;
	gfx_draw_string_left(dpi, STR_TRACK_LIST_INTENSITY_RATING, &rating, 0, x, y);
	y += 10;

	rating = track_td6->nausea * 10;
	gfx_draw_string_left(dpi, STR_TRACK_LIST_NAUSEA_RATING, &rating, 0, x, y);
	y += 14;

	if (track_td6->type != RIDE_TYPE_MAZE) {
		if (track_td6->type == RIDE_TYPE_MINI_GOLF) {
			// Holes
			holes = track_td6->holes & 0x1F;
			gfx_draw_string_left(dpi, STR_HOLES, &holes, 0, x, y);
			y += 10;
		} else {
			// Maximum speed
			speed = ((track_td6->max_speed << 16) * 9) >> 18;
			gfx_draw_string_left(dpi, STR_MAX_SPEED, &speed, 0, x, y);
			y += 10;

			// Average speed
			speed = ((track_td6->average_speed << 16) * 9) >> 18;
			gfx_draw_string_left(dpi, STR_AVERAGE_SPEED, &speed, 0, x, y);
			y += 10;
		}

		// Ride length
		RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = 1345;
		RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = track_td6->ride_length;
		gfx_draw_string_left_clipped(dpi, STR_TRACK_LIST_RIDE_LENGTH, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y, 214);
		y += 10;
	}

	if (ride_type_has_flag(track_td6->type, RIDE_TYPE_FLAG_HAS_G_FORCES)) {
		// Maximum positive vertical Gs
		gForces = track_td6->max_positive_vertical_g * 32;
		gfx_draw_string_left(dpi, STR_MAX_POSITIVE_VERTICAL_G, &gForces, 0, x, y);
		y += 10;

		// Maximum negative verical Gs
		gForces = track_td6->max_negative_vertical_g * 32;
		gfx_draw_string_left(dpi, STR_MAX_NEGATIVE_VERTICAL_G, &gForces, 0, x, y);
		y += 10;

		// Maximum lateral Gs
		gForces = track_td6->max_lateral_g * 32;
		gfx_draw_string_left(dpi, STR_MAX_LATERAL_G, &gForces, 0, x, y);
		y += 10;

		// If .TD6
		if (track_td6->version_and_colour_scheme / 4 >= 2) {
			if (track_td6->total_air_time != 0) {
				// Total air time
				airTime = track_td6->total_air_time * 25;
				gfx_draw_string_left(dpi, STR_TOTAL_AIR_TIME, &airTime, 0, x, y);
				y += 10;
			}
		}
	}

	if (ride_type_has_flag(track_td6->type, RIDE_TYPE_FLAG_HAS_DROPS)) {
		// Drops
		drops = track_td6->drops & 0x3F;
		gfx_draw_string_left(dpi, STR_DROPS, &drops, 0, x, y);
		y += 10;

		// Drop height is multiplied by 0.75
		dropHeight = (track_td6->highest_drop_height + (track_td6->highest_drop_height / 2)) / 2;
		gfx_draw_string_left(dpi, STR_HIGHEST_DROP_HEIGHT, &drops, 0, x, y);
		y += 10;
	}

	if (track_td6->type != RIDE_TYPE_MINI_GOLF) {
		inversions = track_td6->inversions & 0x1F;
		if (inversions != 0) {
			// Inversions
			gfx_draw_string_left(dpi, STR_INVERSIONS, &inversions, 0, x, y);
			y += 10;
		}
	}
	y += 4;

	if (track_td6->space_required_x != 0xFF) {
		// Space required
		RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = track_td6->space_required_x;
		RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = track_td6->space_required_y;
		gfx_draw_string_left(dpi, STR_TRACK_LIST_SPACE_REQUIRED, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y);
		y += 10;
	}

	if (track_td6->cost != 0) {
		gfx_draw_string_left(dpi, STR_TRACK_LIST_COST_AROUND, &track_td6->cost, 0, x, y);
		y += 14;
	}
}
/**
*
*  rct2: 0x0066F25C
*/
void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	bool drawPreviousButton = false;
	bool drawNextButton = false;

	if (g_editor_step == EDITOR_STEP_OBJECT_SELECTION) {
		drawNextButton = true;
	}
	else if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) {
		drawPreviousButton = true;
	}
	else if (RCT2_GLOBAL(0x13573C8, uint16) != 0x2710) {
		drawNextButton = true;
	}
	else if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_18) {
		drawNextButton = true;
	}
	else {
		drawPreviousButton = true;
	}

	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) {
		if (drawPreviousButton) {
			gfx_fill_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, 0x2000033);
		}

		if ((drawPreviousButton || drawNextButton) && g_editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) {
			gfx_fill_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, 0x2000033);
		}
	}

	window_draw_widgets(w, dpi);

	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 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], 0x30);
		}

		if ((drawPreviousButton || drawNextButton) && g_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], 0x30);
		}

		short stateX =
			(window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right +
			window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left) / 2 + w->x;
		short stateY = w->height - 0x0C + w->y;
		gfx_draw_string_centred(dpi, STR_OBJECT_SELECTION_STEP + g_editor_step,
			stateX, stateY, (w->colours[2] & 0x7F) | 0x20, 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);

			int textColour = w->colours[1] & 0x7F;
			if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR &&
				gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON
			) {
				textColour = 2;
			}

			short textX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 30 +
				window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + w->x;
			short textY = window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->y;

			short stringId = STR_OBJECT_SELECTION_STEP + g_editor_step - 1;
			if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER)
				stringId = STR_OBJECT_SELECTION_STEP;

			gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, textX, textY, textColour, 0);
			gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, 0);
		}

		if ((drawPreviousButton || drawNextButton) && g_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);

			int textColour = w->colours[1] & 0x7F;

			if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR &&
				gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON
			) {
				textColour = 2;
			}

			short textX = (window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left +
				window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + w->x;
			short textY = window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->y;

			short stringId = STR_OBJECT_SELECTION_STEP + g_editor_step + 1;
			if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER)
				stringId = STR_ROLLERCOASTER_DESIGNER_STEP;

			gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, textX, textY, textColour, 0);
			gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, 0);

		}
	}
}