Exemplo n.º 1
0
void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dpi, int baseWidgetIndex)
{
    baseWidgetIndex = baseWidgetIndex - WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP;

    int x = w->x + 10;
    int y = w->y + w->widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP + baseWidgetIndex].top + 12;
    rct_string_id stringId;

    if (RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS_STAGE, uint8) == RESEARCH_STAGE_FINISHED_ALL) {
        stringId = STR_RESEARCH_UNKNOWN;
        gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 296, STR_RESEARCH_TYPE_LABEL, 0);
        y += 25;

        // Progress
        stringId = 2680;
        gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 296, STR_RESEARCH_PROGRESS_LABEL, 0);
        y += 15;

        RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_UNKNOWN;
        gfx_draw_string_left(dpi, STR_RESEARCH_EXPECTED_LABEL, (void*)0x013CE952, 0, x, y);
    } else {
        // Research type
        stringId = STR_RESEARCH_UNKNOWN;
        if (RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS_STAGE, uint8) != RESEARCH_STAGE_INITIAL_RESEARCH) {
            stringId = STR_TRANSPORT_RIDE + RCT2_GLOBAL(RCT2_ADDRESS_NEXT_RESEARCH_CATEGORY, uint8);
            if (RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS_STAGE, uint8) != RESEARCH_STAGE_DESIGNING) {
                uint32 typeId = RCT2_GLOBAL(RCT2_ADDRESS_NEXT_RESEARCH_ITEM, uint32);
                if (typeId >= 0x10000) {
                    rct_ride_type *rideEntry = RCT2_GLOBAL(0x009ACFA4 + (typeId & 0xFF) * 4, rct_ride_type*);
                    stringId = (rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) ?
                               rideEntry->name :
                               ((typeId >> 8) & 0xFF) + 2;
                } else {
static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	int i, x, y, format;
	rct_widget *widget;
	rct_scenario_basic *scenario;

	window_draw_widgets(w, dpi);

	format = (theme_get_preset()->features.rct1_scenario_font) ? 5138 : 1193;

	// Text for each tab
	for (i = 0; i < 5; i++) {
		widget = &window_scenarioselect_widgets[WIDX_TAB1 + i];
		if (widget->type == WWT_EMPTY)
			continue;

		x = (widget->left + widget->right) / 2 + w->x;
		y = (widget->top + widget->bottom) / 2 + w->y - 3;
		RCT2_GLOBAL(0x013CE952 + 0, short) = STR_BEGINNER_PARKS + i;
		gfx_draw_string_centred_wrapped(dpi, (void*)0x013CE952, x, y, 87, format, 10);
	}

	// Return if no scenario highlighted
	scenario = (rct_scenario_basic*)w->var_494;
	if (scenario == NULL)
		return;

	// Scenario name
	x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
	y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
	safe_strncpy((char*)0x009BC677, scenario->name, 64);
	RCT2_GLOBAL(0x013CE952 + 0, short) = 3165;
	gfx_draw_string_centred_clipped(dpi, 1193, (void*)0x013CE952, 0, x + 85, y, 170);
	y += 15;

	// Scenario details
	safe_strncpy((char*)0x009BC677, scenario->details, 256);
	RCT2_GLOBAL(0x013CE952 + 0, short) = 3165;
	y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 170, 1191, 0) + 5;

	// Scenario objective
	RCT2_GLOBAL(0x013CE952 + 0, short) = scenario->objective_type + STR_OBJECTIVE_NONE;
	RCT2_GLOBAL(0x013CE952 + 2, short) = scenario->objective_arg_3;
	RCT2_GLOBAL(0x013CE952 + 4, short) = date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1);
	RCT2_GLOBAL(0x013CE952 + 6, int) = scenario->objective_arg_2;
	y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 170, STR_OBJECTIVE, 0) + 5;

	// Scenario score
	if (scenario->flags & SCENARIO_FLAGS_COMPLETED) {
		safe_strncpy((char*)0x009BC677, scenario->completed_by, 64);
		RCT2_GLOBAL(0x013CE952 + 0, short) = 3165;
		RCT2_GLOBAL(0x013CE952 + 2, int) = scenario->company_value;
		y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, 0);
	}
Exemplo n.º 3
0
static void window_multiplayer_information_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	window_draw_widgets(w, dpi);
	window_multiplayer_draw_tab_images(w, dpi);

	rct_drawpixelinfo clippedDPI;
	if (clip_drawpixelinfo(&clippedDPI, dpi, w->x, w->y, w->width, w->height)) {
		dpi = &clippedDPI;

		sint32 x = 3;
		sint32 y = 50;
		sint32 width = w->width - 6;

		const utf8 * name = network_get_server_name();
		{
			gfx_draw_string_left_wrapped(dpi, (void*)&name, x, y, width, STR_STRING, w->colours[1]);
			y += 11;
		}
		y += 3;

		const utf8 * description = network_get_server_description();
		if (!str_is_null_or_empty(description)) {
			gfx_draw_string_left_wrapped(dpi, (void*)&description, x, y, width, STR_STRING, w->colours[1]);
			y += 11;
		}
		y += 8;

		const utf8 * providerName = network_get_server_provider_name();
		if (!str_is_null_or_empty(providerName)) {
			gfx_draw_string_left(dpi, STR_PROVIDER_NAME, (void*)&providerName, COLOUR_BLACK, x, y);
			y += 11;
		}

		const utf8 * providerEmail = network_get_server_provider_email();
		if (!str_is_null_or_empty(providerEmail)) {
			gfx_draw_string_left(dpi, STR_PROVIDER_EMAIL, (void*)&providerEmail, COLOUR_BLACK, x, y);
			y += 11;
		}

		const utf8 * providerWebsite = network_get_server_provider_website();
		if (!str_is_null_or_empty(providerWebsite)) {
			gfx_draw_string_left(dpi, STR_PROVIDER_WEBSITE, (void*)&providerWebsite, COLOUR_BLACK, x, y);
		}
	}
}
Exemplo n.º 4
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);
        }
    }
}
Exemplo n.º 5
0
static void window_scenarioselect_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	int i, x, y, format;
	rct_widget *widget;
	const scenario_index_entry *scenario;

	window_draw_widgets(w, dpi);

	format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_SMALL_WINDOW_COLOUR_2_STRINGID : STR_WINDOW_COLOUR_2_STRINGID;

	// Text for each tab
	for (i = 0; i < 8; i++) {
		widget = &window_scenarioselect_widgets[WIDX_TAB1 + i];
		if (widget->type == WWT_EMPTY)
			continue;

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

		if (gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN) {
			set_format_arg(0, rct_string_id, ScenarioOriginStringIds[i]);
		} else { // old-style
			set_format_arg(0, rct_string_id, ScenarioCategoryStringIds[i]);
		}
		gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, 87, format, COLOUR_AQUAMARINE);
	}

	// Return if no scenario highlighted
	scenario = w->highlighted_scenario;
	if (scenario == NULL) {
		if (_showLockedInformation) {
			// Show locked information
			x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
			y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
			gfx_draw_string_centred_clipped(dpi, STR_SCENARIO_LOCKED, NULL, COLOUR_BLACK, x + 85, y, 170);
			y += 15;
			y += gfx_draw_string_left_wrapped(dpi, NULL, x, y, 170, STR_SCENARIO_LOCKED_DESC, COLOUR_BLACK) + 5;
		}
		return;
	}

	// Scenario path
	if (gConfigGeneral.debugging_tools) {
		utf8 path[MAX_PATH];

		gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
		shorten_path(path, sizeof(path), scenario->path, w->width - 6);

		const utf8 *pathPtr = path;
		gfx_draw_string_left(dpi, STR_STRING, (void*)&pathPtr, w->colours[1], w->x + 3, w->y + w->height - 3 - 11);
	}

	// Scenario name
	x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
	y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
	set_format_arg(0, rct_string_id, STR_STRING);
	set_format_arg(2, const char *, scenario->name);
	gfx_draw_string_centred_clipped(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, x + 85, y, 170);
	y += 15;

	// Scenario details
	set_format_arg(0, rct_string_id, STR_STRING);
	set_format_arg(2, const char *, scenario->details);
	y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_BLACK_STRING, COLOUR_BLACK) + 5;

	// Scenario objective
	set_format_arg(0, rct_string_id, ObjectiveNames[scenario->objective_type]);
	set_format_arg(2, short, scenario->objective_arg_3);
	set_format_arg(4, short, date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1));
	set_format_arg(6, int, scenario->objective_arg_2);
	y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_OBJECTIVE, COLOUR_BLACK) + 5;

	// Scenario score
	if (scenario->highscore != NULL) {
		// TODO: Should probably be translateable
		const utf8 *completedByName = "???";
		if (!str_is_null_or_empty(scenario->highscore->name)) {
			completedByName = scenario->highscore->name;
		}
		set_format_arg(0, rct_string_id, STR_STRING);
		set_format_arg(2, const char *, completedByName);
		set_format_arg(2 + sizeof(const char *), money32, scenario->highscore->company_value);
		y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, x, y, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, COLOUR_BLACK);
	}
}
Exemplo n.º 6
0
/**
 *
 *  rct2: 0x0066E4EE
 */
static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex)
{
    sint32 lineHeight = font_get_line_height(gCurrentFontSpriteBase);
    sint32 itemHeight = window_news_get_item_height();
    sint32 i, x, y, yy, press;

    y = 0;
    for (i = 11; i < 61; i++)
    {
        NewsItem * const newsItem = news_item_get(i);
        if (news_item_is_empty(i))
            break;
        if (y >= dpi->y + dpi->height)
            break;
        if (y + itemHeight < dpi->y)
        {
            y += itemHeight;
            continue;
        }

        // Background
        gfx_fill_rect_inset(dpi, -1, y, 383, y + itemHeight - 1, w->colours[1], (INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_GREY));

        // Date text
        set_format_arg(0, rct_string_id, DateDayNames[newsItem->Day - 1]);
        set_format_arg(2, rct_string_id, DateGameMonthNames[date_get_month(newsItem->MonthYear)]);
        gfx_draw_string_left(dpi, STR_NEWS_DATE_FORMAT, gCommonFormatArgs, COLOUR_WHITE, 2, y);

        // Item text
        utf8 *text = newsItem->Text;
        gfx_draw_string_left_wrapped(dpi, &text, 2, y + lineHeight, 325, STR_BOTTOM_TOOLBAR_NEWS_TEXT, COLOUR_BRIGHT_GREEN);

        // Subject button
        if ((news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_SUBJECT) && !(newsItem->Flags & NEWS_FLAG_HAS_BUTTON))
        {
            x = 328;
            yy = y + lineHeight + 4;

            press = 0;
            if (w->news.var_480 != -1) {
                const uint8 idx = 11 + w->news.var_480;
                news_item_is_valid_idx(idx);
                if (i == idx && w->news.var_482 == 1)
                    press = INSET_RECT_FLAG_BORDER_INSET;
            }
            gfx_fill_rect_inset(dpi, x, yy, x + 23, yy + 23, w->colours[2], press);

            switch (newsItem->Type) {
            case NEWS_ITEM_RIDE:
                gfx_draw_sprite(dpi, SPR_RIDE, x, yy, 0);
                break;
            case NEWS_ITEM_PEEP:
            case NEWS_ITEM_PEEP_ON_RIDE:
            {
                rct_drawpixelinfo cliped_dpi;
                if (!clip_drawpixelinfo(&cliped_dpi, dpi, x + 1, yy + 1, 22, 22)) {
                    break;
                }

                rct_peep* peep = GET_PEEP(newsItem->Assoc);
                sint32 clip_x = 10, clip_y = 19;

                // If normal peep set sprite to normal (no food)
                // If staff set sprite to staff sprite
                sint32 sprite_type = 0;
                if (peep->type == PEEP_TYPE_STAFF){
                    sprite_type = peep->sprite_type;
                    if (peep->staff_type == STAFF_TYPE_ENTERTAINER){
                        clip_y += 3;
                    }
                }

                uint32 image_id = g_peep_animation_entries[sprite_type].sprite_animation->base_image;
                image_id += 0xA0000001;
                image_id |= (peep->tshirt_colour << 19) | (peep->trousers_colour << 24);

                gfx_draw_sprite(&cliped_dpi, image_id, clip_x, clip_y, 0);
                break;
            }
            case NEWS_ITEM_MONEY:
                gfx_draw_sprite(dpi, SPR_FINANCE, x, yy, 0);
                break;
            case NEWS_ITEM_RESEARCH:
                gfx_draw_sprite(dpi, newsItem->Assoc < 0x10000 ? SPR_NEW_SCENERY : SPR_NEW_RIDE, x, yy, 0);
                break;
            case NEWS_ITEM_PEEPS:
                gfx_draw_sprite(dpi, SPR_GUESTS, x, yy, 0);
                break;
            case NEWS_ITEM_AWARD:
                gfx_draw_sprite(dpi, SPR_AWARD, x, yy, 0);
                break;
            case NEWS_ITEM_GRAPH:
                gfx_draw_sprite(dpi, SPR_GRAPH, x, yy, 0);
                break;
            }
        }

        // Location button
        if ((news_type_properties[newsItem->Type] & NEWS_TYPE_HAS_LOCATION) && !(newsItem->Flags & NEWS_FLAG_HAS_BUTTON))
        {
            x = 352;
            yy = y + lineHeight + 4;

            press = 0;
            if (w->news.var_480 != -1) {
                const uint8 idx = 11 + w->news.var_480;
                news_item_is_valid_idx(idx);
                if (i == idx && w->news.var_482 == 2)
                    press = 0x20;
            }
            gfx_fill_rect_inset(dpi, x, yy, x + 23, yy + 23, w->colours[2], press);
            gfx_draw_sprite(dpi, SPR_LOCATE, x, yy, 0);
        }

        y += itemHeight;
    }
}
Exemplo n.º 7
0
/**
 * 
 *  rct2: 0x0066E4EE
 */
static void window_news_scrollpaint()
{
	int i, x, y, yy, press;
	rct_window *w;
	rct_drawpixelinfo *dpi;
	rct_news_item *newsItems, *newsItem, *newsItem2;

	__asm mov w, esi
	__asm mov dpi, edi

	y = 0;
	newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
	for (i = 11; i < 61; i++) {
		newsItem = &newsItems[i];
		if (newsItem->type == NEWS_ITEM_NULL)
			break;
		if (y >= dpi->y + dpi->height)
			break;
		if (y + 42 < dpi->y) {
			y += 42;
			continue;
		}

		// Background
		gfx_fill_rect_inset(dpi, -1, y, 383, y + 41, w->colours[1], 0x24);

		// Date text
		RCT2_GLOBAL(0x013CE952, uint16) = STR_DATE_DAY_1 + newsItem->day - 1;
		RCT2_GLOBAL(0x013CE952 + 2, uint16) = STR_MONTH_MARCH + (newsItem->month_year % 8);
		gfx_draw_string_left(dpi, 2235, (void*)0x013CE952, 2, 4, y);

		// Item text
		RCT2_GLOBAL(0x009B5F2C, uint8) = newsItem->colour;
		strcpy((char*)0x009B5F2D, newsItem->text);
		gfx_draw_string_left_wrapped(dpi, 0, 2, y + 10, 325, 1926, 14);

		// Subject button
		if ((RCT2_ADDRESS(0x0097BE7C, uint8)[newsItem->type] & 2) && !(newsItem->flags & 1)) {
			x = 328;
			yy = y + 14;

			press = 0;
			if (w->var_480 != -1) {
				newsItem2 = &newsItems[11 + w->var_480];
				if (newsItem == newsItem2 && w->var_482 == 1)
					press = 0x20;
			}
			gfx_fill_rect_inset(dpi, x, yy, x + 23, yy + 23, w->colours[2], press);

			switch (newsItem->type) {
			case NEWS_ITEM_RIDE:
				gfx_draw_sprite(dpi, SPR_RIDE, x, yy);
				break;
			case NEWS_ITEM_PEEP_ON_RIDE:
				// TODO
				break;
			case NEWS_ITEM_PEEP:
				// TODO
				break;
			case NEWS_ITEM_MONEY:
				gfx_draw_sprite(dpi, SPR_FINANCE, x, yy);
				break;
			case NEWS_ITEM_RESEARCH:
				gfx_draw_sprite(dpi, newsItem->assoc < 0x10000 ? SPR_NEW_RIDE : SPR_SCENERY, x, yy);
				break;
			case NEWS_ITEM_PEEPS:
				gfx_draw_sprite(dpi, SPR_GUESTS, x, yy);
				break;
			case NEWS_ITEM_AWARD:
				gfx_draw_sprite(dpi, SPR_AWARD, x, yy);
				break;
			case NEWS_ITEM_GRAPH:
				gfx_draw_sprite(dpi, SPR_GRAPH, x, yy);
				break;
			}
		}

		// Location button
		if ((RCT2_ADDRESS(0x0097BE7C, uint8)[newsItem->type] & 1) && !(newsItem->flags & 1)) {
			x = 352;
			yy = y + 14;

			press = 0;
			if (w->var_480 != -1) {
				newsItem2 = &newsItems[11 + w->var_480];
				if (newsItem == newsItem2 && w->var_482 == 2)
					press = 0x20;
			}
			gfx_fill_rect_inset(dpi, x, yy, x + 23, yy + 23, w->colours[2], press);
			gfx_draw_sprite(dpi, SPR_LOCATE, x, yy);
		}

		y += 42;
	}
}
Exemplo n.º 8
0
/**
 *
 *  rct2: 0x0066E4EE
 */
static void window_news_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
{
	int i, x, y, yy, press;

	y = 0;
	for (i = 11; i < 61; i++) {
		rct_news_item * const newsItem = news_item_get(i);
		if (news_item_is_empty(i))
			break;
		if (y >= dpi->y + dpi->height)
			break;
		if (y + 42 < dpi->y) {
			y += 42;
			continue;
		}

		// Background
		gfx_fill_rect_inset(dpi, -1, y, 383, y + 41, w->colours[1], 0x24);

		// Date text
		RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = STR_DATE_DAY_1 + newsItem->day - 1;
		RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = STR_MONTH_MARCH + (newsItem->month_year % 8);
		gfx_draw_string_left(dpi, 2235, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 2, 4, y);

		// Item text
		utf8 buffer[400];
		utf8 *ch = buffer;
		ch = utf8_write_codepoint(ch, FORMAT_SMALLFONT);
		memcpy(ch, newsItem->text, 256);
		ch = buffer;
		gfx_draw_string_left_wrapped(dpi, &ch, 2, y + 10, 325, 1170, 14);

		// Subject button
		if ((RCT2_ADDRESS(0x0097BE7C, uint8)[newsItem->type] & 2) && !(newsItem->flags & 1)) {
			x = 328;
			yy = y + 14;

			press = 0;
			if (w->news.var_480 != -1) {
				const uint8 idx = 11 + w->news.var_480;
				news_item_is_valid_idx(idx);
				if (i == idx && w->news.var_482 == 1)
					press = 0x20;
			}
			gfx_fill_rect_inset(dpi, x, yy, x + 23, yy + 23, w->colours[2], press);

			switch (newsItem->type) {
			case NEWS_ITEM_RIDE:
				gfx_draw_sprite(dpi, SPR_RIDE, x, yy, 0);
				break;
			case NEWS_ITEM_PEEP:
			case NEWS_ITEM_PEEP_ON_RIDE:
			{
				rct_drawpixelinfo cliped_dpi;
				if (!clip_drawpixelinfo(&cliped_dpi, dpi, x + 1, yy + 1, 22, 22)) {
					break;
				}

				rct_peep* peep = GET_PEEP(newsItem->assoc);
				int clip_x = 10, clip_y = 19;

				// If normal peep set sprite to normal (no food)
				// If staff set sprite to staff sprite
				int sprite_type = 0;
				if (peep->type == PEEP_TYPE_STAFF){
					sprite_type = peep->sprite_type;
					if (peep->staff_type == STAFF_TYPE_ENTERTAINER){
						clip_y += 3;
					}
				}

				uint32 image_id = g_sprite_entries[sprite_type].sprite_image->base_image;
				image_id += 0xA0000001;
				image_id |= (peep->tshirt_colour << 19) | (peep->trousers_colour << 24);

				gfx_draw_sprite(&cliped_dpi, image_id, clip_x, clip_y, 0);
				break;
			}
			case NEWS_ITEM_MONEY:
				gfx_draw_sprite(dpi, SPR_FINANCE, x, yy, 0);
				break;
			case NEWS_ITEM_RESEARCH:
				gfx_draw_sprite(dpi, newsItem->assoc < 0x10000 ? SPR_NEW_RIDE : SPR_SCENERY, x, yy, 0);
				break;
			case NEWS_ITEM_PEEPS:
				gfx_draw_sprite(dpi, SPR_GUESTS, x, yy, 0);
				break;
			case NEWS_ITEM_AWARD:
				gfx_draw_sprite(dpi, SPR_AWARD, x, yy, 0);
				break;
			case NEWS_ITEM_GRAPH:
				gfx_draw_sprite(dpi, SPR_GRAPH, x, yy, 0);
				break;
			}
		}

		// Location button
		if ((RCT2_ADDRESS(0x0097BE7C, uint8)[newsItem->type] & 1) && !(newsItem->flags & 1)) {
			x = 352;
			yy = y + 14;

			press = 0;
			if (w->news.var_480 != -1) {
				const uint8 idx = 11 + w->news.var_480;
				news_item_is_valid_idx(idx);
				if (i == idx && w->news.var_482 == 2)
					press = 0x20;
			}
			gfx_fill_rect_inset(dpi, x, yy, x + 23, yy + 23, w->colours[2], press);
			gfx_draw_sprite(dpi, SPR_LOCATE, x, yy, 0);
		}

		y += 42;
	}
}