/** * * rct2: 0x00699D7D */ static void window_guest_list_scrollmousedown(rct_window* w, int32_t scrollIndex, int32_t x, int32_t y) { int32_t i, spriteIndex; Peep* peep; switch (_window_guest_list_selected_tab) { case PAGE_INDIVIDUAL: i = y / SCROLLABLE_ROW_HEIGHT; i += _window_guest_list_selected_page * GUESTS_PER_PAGE; FOR_ALL_GUESTS (spriteIndex, peep) { if (peep->outside_of_park != 0) continue; if (_window_guest_list_selected_filter != -1) if (window_guest_list_is_peep_in_filter(peep)) continue; if (!guest_should_be_visible(peep)) continue; if (i == 0) { // Open guest window window_guest_open(peep); break; } else { i--; } } break; case PAGE_SUMMARISED: i = y / SUMMARISED_GUEST_ROW_HEIGHT; if (i < _window_guest_list_num_groups) { std::memcpy(_window_guest_list_filter_arguments + 0, &_window_guest_list_groups_argument_1[i], 4); std::memcpy(_window_guest_list_filter_arguments + 2, &_window_guest_list_groups_argument_2[i], 4); _window_guest_list_selected_filter = _window_guest_list_selected_view; _window_guest_list_selected_tab = PAGE_INDIVIDUAL; window_guest_list_widgets[WIDX_TRACKING].type = WWT_FLATBTN; window_invalidate(w); w->scrolls[0].v_top = 0; } break; } }
/** * * 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; }
/** * * rct2: 0x00699C55 */ static void window_guest_list_scrollgetsize(rct_window *w, sint32 scrollIndex, sint32 *width, sint32 *height) { sint32 i, y, numGuests, spriteIndex; rct_peep *peep; switch (_window_guest_list_selected_tab) { case PAGE_INDIVIDUAL: // Count the number of guests numGuests = 0; FOR_ALL_GUESTS(spriteIndex, peep) { if (peep->outside_of_park != 0) continue; if (_window_guest_list_selected_filter != -1) if (window_guest_list_is_peep_in_filter(peep)) continue; if (!guest_should_be_visible(peep)) continue; numGuests++; } w->var_492 = numGuests; y = numGuests * SCROLLABLE_ROW_HEIGHT; _window_guest_list_num_pages = (sint32) ceilf((float)numGuests / 3173); if (_window_guest_list_num_pages == 0) _window_guest_list_selected_page = 0; else if (_window_guest_list_selected_page >= _window_guest_list_num_pages) _window_guest_list_selected_page = _window_guest_list_num_pages - 1; break; case PAGE_SUMMARISED: // Find the groups window_guest_list_find_groups(); w->var_492 = _window_guest_list_num_groups; y = _window_guest_list_num_groups * SUMMARISED_GUEST_ROW_HEIGHT; break; default: log_error("Improper tab selected: %d, bailing out.", _window_guest_list_selected_tab); return; } i = _window_guest_list_selected_page; for (i = _window_guest_list_selected_page - 1; i >= 0; i--) y -= 0x7BF2; if (y < 0) y = 0; if (y > 0x7BF2) y = 0x7BF2; if (_window_guest_list_highlighted_index != -1) { _window_guest_list_highlighted_index = -1; window_invalidate(w); } i = y - window_guest_list_widgets[WIDX_GUEST_LIST].bottom + window_guest_list_widgets[WIDX_GUEST_LIST].top + 21; if (i < 0) i = 0; if (i < w->scrolls[0].v_top) { w->scrolls[0].v_top = i; window_invalidate(w); } *width = 447; *height = y; }
/** * * rct2: 0x00699C55 */ static void window_guest_list_scrollgetsize(rct_window* w, int32_t scrollIndex, int32_t* width, int32_t* height) { int32_t i, y, numGuests, spriteIndex; Peep* peep; switch (_window_guest_list_selected_tab) { case PAGE_INDIVIDUAL: // Count the number of guests numGuests = 0; FOR_ALL_GUESTS (spriteIndex, peep) { if (peep->outside_of_park != 0) continue; if (_window_guest_list_selected_filter != -1) if (window_guest_list_is_peep_in_filter(peep)) continue; if (!guest_should_be_visible(peep)) continue; numGuests++; } w->var_492 = numGuests; y = numGuests * SCROLLABLE_ROW_HEIGHT; _window_guest_list_num_pages = 1 + (numGuests - 1) / GUESTS_PER_PAGE; if (_window_guest_list_num_pages == 0) _window_guest_list_selected_page = 0; else if (_window_guest_list_selected_page >= _window_guest_list_num_pages) _window_guest_list_selected_page = _window_guest_list_num_pages - 1; break; case PAGE_SUMMARISED: // Find the groups window_guest_list_find_groups(); w->var_492 = _window_guest_list_num_groups; y = _window_guest_list_num_groups * SUMMARISED_GUEST_ROW_HEIGHT; break; default: log_error("Improper tab selected: %d, bailing out.", _window_guest_list_selected_tab); return; } y -= GUEST_PAGE_HEIGHT * _window_guest_list_selected_page; y = std::max(0, std::min(y, GUEST_PAGE_HEIGHT)); if (_window_guest_list_highlighted_index != -1) { _window_guest_list_highlighted_index = -1; window_invalidate(w); } i = y - window_guest_list_widgets[WIDX_GUEST_LIST].bottom + window_guest_list_widgets[WIDX_GUEST_LIST].top + 21; if (i < 0) i = 0; if (i < w->scrolls[0].v_top) { w->scrolls[0].v_top = i; window_invalidate(w); } *width = 447; *height = y; }