Example #1
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 #2
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;
	}
/**
 * 
 *  rct2: 0x006AAB56
 */
static void window_editor_object_selection_paint()
{
	int i, x, y, width, numSelected, totalSelectable, type;
	rct_window *w;
	rct_drawpixelinfo *dpi;
	rct_widget *widget;
	rct_object_entry *highlightedEntry;
	rct_string_id stringId;
	uint8 *text, source;
	char *datName, *name, *stringBuffer;

	window_paint_get_registers(w, dpi);

	/*if (w->selected_tab == WINDOW_OBJECT_SELECTION_PAGE_RIDE_VEHICLES_ATTRACTIONS) {
		gfx_fill_rect_inset(dpi,
			w->x + w->widgets[WIDX_FILTER_RIDE_TAB_ALL].left - 1,
			w->y + w->widgets[WIDX_FILTER_RIDE_TAB_ALL].bottom,
			w->x + w->widgets[WIDX_FILTER_RIDE_TAB_STALL].right + 1,
			w->y + w->widgets[WIDX_FILTER_RIDE_TAB_ALL].bottom + 2,
			w->colours[1],
			0x10
			);
	}*/

	window_draw_widgets(w, dpi);

	// Draw tabs
	for (i = 0; i < WINDOW_OBJECT_SELECTION_PAGE_COUNT; i++) {
		widget = &w->widgets[WIDX_TAB_1 + i];
		if (widget->type == WWT_EMPTY)
			continue;

		x = w->x + widget->left;
		y = w->y + widget->top;
		gfx_draw_sprite(dpi, 5458 + i, x, y, 0);
	}

	const int ride_tabs[] = { 5458, 0x200015A1, 5542, 0x200015AA, 5557 + 5, 5551, 5530, 5327 };

	// Draw ride tabs
	if (w->selected_tab == WINDOW_OBJECT_SELECTION_PAGE_RIDE_VEHICLES_ATTRACTIONS) {
		for (i = 0; i < 7; i++) {
		widget = &w->widgets[WIDX_FILTER_RIDE_TAB_ALL + i];
			if (widget->type == WWT_EMPTY)
				continue;

			x = w->x + widget->left;
			y = w->y + widget->top;
			gfx_draw_sprite(dpi, ride_tabs[i] | (w->colours[1] << 19), x, y, 0);
		}

	}

	// 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,
		RCT2_ADDRESS(0x0141FC44, uint8)[w->colours[1] * 8]
	);

	// Draw number of selected items
	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) {
		x = w->x + 3;
		y = w->y + w->height - 13;

		numSelected = RCT2_ADDRESS(0x00F433F7, uint16)[w->selected_tab];
		totalSelectable = object_entry_group_counts[w->selected_tab];
		if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER)
			totalSelectable = 4;

		RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint16) = numSelected;
		RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = totalSelectable;
		gfx_draw_string_left(dpi, 3164, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, 0, x, y);
	}

	rct_stex_entry* stex_entry = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TEXT_TEMP_CHUNK, rct_stex_entry*);

	/*gfx_fill_rect_inset(dpi,
		w->x + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].left,
		w->y + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].top,
		w->x + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].right,
		w->y + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].bottom,
		w->colours[1],
		0x30
		);

	RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 0, uint32) = (uint32)&_filter_string;
	gfx_draw_string_left_clipped(
		dpi,
		1170,
		(void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS,
		w->colours[1],
		w->x + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].left + 1,
		w->y + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].top,
		w->x + window_editor_object_selection_widgets[WIDX_FILTER_STRING_BUTTON].right
		);*/

	if (w->selected_list_item == -1 || stex_entry == NULL)
		return;

	highlightedEntry = (rct_object_entry*)w->var_494;
	type = highlightedEntry->flags & 0x0F;

	// Draw preview
	widget = &w->widgets[WIDX_PREVIEW];
	x = w->x + (widget->left + widget->right) / 2 + 1;
	y = w->y + (widget->top + widget->bottom) / 2 + 1;
	object_paint(type, 3, type, x, y, 0, (int)dpi, (int)stex_entry);

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

	// Skip object dat name
	text = (char*)(highlightedEntry + 1);
	datName = text;
	do {
		text++;
	} while (*(text - 1) != 0);
	text += 4;
	name = text;

	RCT2_GLOBAL(0x009BC677, uint8) = 14;

	stringId = 3165;
	stringBuffer = (char*)language_get_string(3165) + 1;
	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
		// Skip name
		do {
			text++;
		} while (*(text - 1) != 0);
		text += 4;
		text += *text * 16 + 1;
		text += *text * 16 + 1;

		if (RCT2_GLOBAL(text, uint32) & 0x1000000) {
			strcpy(stringBuffer, name);
		} else {
			int eax = *text;
			if (*text == 0xFF) {
				eax = *(text + 1);
				if (*(text + 1) == 0xFF)
					eax = *(text + 2);
			}
			format_string(stringBuffer, eax + 2, NULL);
		}
	} else {
		strcpy(stringBuffer, name);
	}
	gfx_draw_string_centred_clipped(dpi, stringId, NULL, 0, x, y, width);
	
	// Draw description of object
	x = w->x + w->widgets[WIDX_LIST].right + 4;
	y += 15;
	object_paint(type, 259, type, x, y, (int)w, (int)dpi, (int)stex_entry);

	// Draw object source
	source = (highlightedEntry->flags & 0xF0) >> 4;
	switch (source) {
	case 8: stringId = 2741; break;
	case 1: stringId = 5262; break;
	case 2: stringId = 5263; break;
	default: stringId = 5264; break;
	}
	gfx_draw_string_right(dpi, stringId, NULL, 2, w->x + w->width - 5, w->y + w->height - 3 - 12 - 14);

	// 
	if (w->selected_tab == WINDOW_OBJECT_SELECTION_PAGE_RIDE_VEHICLES_ATTRACTIONS) {
		y = w->y + w->height - 3 - 12 - 14 - 14;

		rct_ride_type *rideType = (rct_ride_type*)stex_entry;
		for (int i = 0; i < 3; i++) {
			if (rideType->ride_type[i] == 255)
				continue;

			stringId = 2 + rideType->ride_type[i];
			gfx_draw_string_right(dpi, stringId, NULL, 2, w->x + w->width - 5, y);
			y -= 11;
		}
	}

	//stringId = highlightedEntry->checksum
	// gfx_draw_string_right(dpi, stringId, NULL, 2, w->x + w->width - 5, w->y + w->height - 3 - 12 - 14);

	// Draw object dat name
	stringId = 3165;
	strcpy(stringBuffer, datName);
	gfx_draw_string_right(dpi, stringId, NULL, 0, w->x + w->width - 5, w->y + w->height - 3 - 12);
}