/**
 *
 *  rct2: 0x006CD811
 */
static void window_maze_construction_close(rct_window *w)
{
    ride_construction_invalidate_current_track();
    viewport_set_visibility(0);

    map_invalidate_map_selection_tiles();
    gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;

    // In order to cancel the yellow arrow correctly the
    // selection tool should be cancelled.
    tool_cancel();

    hide_gridlines();

    uint8 rideIndex = _currentRideIndex;
    rct_ride* ride = get_ride(rideIndex);
    if (ride->overall_view.xy == RCT_XY8_UNDEFINED) {
        sint32 savedPausedState = gGamePaused;
        gGamePaused = 0;
        game_do_command(0, GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED, 0, rideIndex, GAME_COMMAND_DEMOLISH_RIDE, 0, 0);
        gGamePaused = savedPausedState;
    } else {
        window_ride_main_open(rideIndex);
    }
}
Beispiel #2
0
void window_construction_maze_close(){
	rct_window *w;

	window_get_register(w);

	sub_6C9627();
	viewport_set_visibility(0);

	map_invalidate_map_selection_tiles();
	RCT2_GLOBAL(0x9DE58A, uint16) &= 0xFFFD;

	hide_gridlines();
	
	uint8 ride_id = RCT2_GLOBAL(0xF440A7, uint8);

	rct_ride* ride = GET_RIDE(ride_id);

	if (ride->overall_view == 0xFFFF){
		int eax = RCT2_GLOBAL(0x009DEA6E, uint8);

		RCT2_GLOBAL(0x009DEA6E, uint8) = 0;
		game_do_command(0, 9, 0, ride_id, GAME_COMMAND_7, 0, 0);

		RCT2_GLOBAL(0x009DEA6E, uint8) = eax;
		return;
	}

	window_ride_main_open(ride_id);
}
Beispiel #3
0
void window_construction_close(){
	rct_window *w;

	window_get_register(w);

	sub_6C9627();
	viewport_set_visibility(0);

	map_invalidate_map_selection_tiles();
	RCT2_GLOBAL(0x9DE58A, uint16) &= 0xFFFD;

	hide_gridlines();

	int x, y;
	uint8 ride_id = RCT2_GLOBAL(0xF440A7, uint8);
	rct_map_element* map_element = sub_6CAF80(ride_id, &x, &y);

	if ((int)map_element == -1){
		int eax = RCT2_GLOBAL(0x009DEA6E, uint8);

		RCT2_GLOBAL(0x009DEA6E, uint8) = 0;
		game_do_command(0, 9, 0, ride_id, GAME_COMMAND_7, 0, 0);

		RCT2_GLOBAL(0x009DEA6E, uint8) = eax;
		return;
	}

	window_ride_main_open(ride_id);
}
Beispiel #4
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;
    }
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;
	}