Example #1
0
/**
 * Opens the window/tab for the subject of the news item
 *
 *  rct2: 0x0066EBE6
 *
 */
void news_item_open_subject(sint32 type, sint32 subject)
{
    rct_peep* peep;
    rct_window* window;

    switch (type) {
    case NEWS_ITEM_RIDE:
        window_ride_main_open(subject);
        break;
    case NEWS_ITEM_PEEP_ON_RIDE:
    case NEWS_ITEM_PEEP:
        peep = GET_PEEP(subject);
        window_guest_open(peep);
        break;
    case NEWS_ITEM_MONEY:
        window_finances_open();
        break;
    case NEWS_ITEM_RESEARCH:
        if (subject >= 0x10000) {
            // Open ride list window
            window_new_ride_open();

            // Switch to right tab and scroll to ride location
            ride_list_item rideItem;
            rideItem.type = subject >> 8;
            rideItem.entry_index = subject & 0xFF;
            window_new_ride_focus(rideItem);
            break;
        }

        // Check if window is already open
        window = window_bring_to_front_by_class(WC_SCENERY);
        if (window == NULL) {
            window = window_find_by_class(WC_TOP_TOOLBAR);
            if (window != NULL) {
                window_invalidate(window);
                if (!tool_set(window, WC_TOP_TOOLBAR__WIDX_SCENERY, TOOL_ARROW)) {
                    input_set_flag(INPUT_FLAG_6, true);
                    window_scenery_open();
                }
            }
        }

        // Switch to new scenery tab
        window = window_find_by_class(WC_SCENERY);
        if (window != NULL)
            window_event_mouse_down_call(window, WC_SCENERY__WIDX_SCENERY_TAB_1 + subject);
        break;
    case NEWS_ITEM_PEEPS:
        window_guest_list_open_with_filter(GLFT_GUESTS_THINKING_X, subject);;
        break;
    case NEWS_ITEM_AWARD:
        window_park_awards_open();
        break;
    case NEWS_ITEM_GRAPH:
        window_park_rating_open();
        break;
    }
Example #2
0
/**
 *
 *  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;
    }
}
Example #3
0
/**
 *
 *  rct2: 0x00699D7D
 */
static void window_guest_list_scrollmousedown(rct_window *w, int scrollIndex, int x, int y)
{
	int i, spriteIndex;
	rct_peep *peep;

	switch (_window_guest_list_selected_tab) {
	case PAGE_INDIVIDUAL:
		i = y / 10;
		i += _window_guest_list_selected_page * 3173;
		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 (_window_guest_list_tracking_only && !(peep->flags & PEEP_FLAGS_TRACKING))
				continue;

			if (i == 0) {
				// Open guest window
				window_guest_open(peep);

				break;
			} else {
				i--;
			}
		}
		break;
	case PAGE_SUMMARISED:
		i = y / 21;
		if (i < _window_guest_list_num_groups) {
			RCT2_GLOBAL(0x00F1EDF6, uint32) = _window_guest_list_groups_argument_1[i];
			RCT2_GLOBAL(0x00F1EDFA, uint32) = _window_guest_list_groups_argument_2[i];
			_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;
	}
}
Example #4
0
int viewport_interaction_left_click(int x, int y)
{
	rct_sprite* spr;

	int eax = x, ebx = y, ecx = 0, esi = 0, edi = 0, ebp = 0;
	RCT2_CALLFUNC_X(0x006ED9D0, &eax, &ebx, &ecx, (int*)&spr, &esi, &edi, &ebp);
	if ((ebx & 0xFF) == 2){
					
		if (spr->unknown.sprite_identifier == SPRITE_IDENTIFIER_VEHICLE){
			//Open ride window
			RCT2_CALLPROC_X(0x6ACAC2, eax, ebx, ecx, (int)spr, esi, edi, ebp);
		}
		else if (spr->unknown.sprite_identifier == SPRITE_IDENTIFIER_PEEP){
			window_guest_open(&spr->peep);
		}
		else if (spr->unknown.sprite_identifier == SPRITE_IDENTIFIER_FLOATING_TEXT){
			//Unknown for now
			RCT2_CALLPROC_X(0x6E88D7, eax, ebx, ecx, (int)spr, esi, edi, ebp);
		}
		return 1;
	}
	else if ((ebx & 0xFF) == 3){
		rct_map_element* map_element = (rct_map_element*)spr;
		
		if (!((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_ENTRANCE)){
			eax = RCT2_ADDRESS(0x0099BA64, uint8)[16 * map_element->properties.track.type];
			if (!(eax & 0x10)){//If not station track
				//Open ride window in overview mode.
				window_ride_main_open(map_element->properties.track.ride_index);
				return;
			}
		}
		//Open ride window in station view
		RCT2_CALLPROC_X(0x6ACCCE, map_element->properties.track.ride_index, (map_element->properties.track.sequence & 0x70) >> 4, ecx, (int)map_element, esi, edi, ebp);
		return 1;
	}