Ejemplo n.º 1
0
void window_player_overview_mouse_up(rct_window *w, rct_widgetindex widgetIndex)
{
    switch(widgetIndex){
    case WIDX_CLOSE:
        window_close(w);
        break;
    case WIDX_TAB_1:
    case WIDX_TAB_2:
        window_player_set_page(w, widgetIndex - WIDX_TAB_1);
        break;
    case WIDX_LOCATE:{
        rct_window* mainWindow = window_get_main();
        if (mainWindow != nullptr) {
            sint32 player = network_get_player_index((uint8)w->number);
            if (player == -1) {
                return;
            }
            LocationXYZ16 coord = network_get_player_last_action_coord(player);
            if (coord.x || coord.y || coord.z) {
                window_scroll_to_location(mainWindow, coord.x, coord.y, coord.z);
            }
        }
    }break;
    case WIDX_KICK:
        game_do_command(w->number, GAME_COMMAND_FLAG_APPLY, 0, 0, GAME_COMMAND_KICK_PLAYER, 0, 0);
        break;
    }
}
Ejemplo n.º 2
0
/**
 *
 *  rct2: 0x00672957
 */
void trackdesigner_load()
{
	rct_window *mainWindow;

	RCT2_CALLPROC_EBPSAFE(0x006A9CE8);
	map_init();
	set_all_land_owned();
	RCT2_CALLPROC_EBPSAFE(0x006B9CB0);
	RCT2_CALLPROC_EBPSAFE(0x00667104);
	RCT2_CALLPROC_EBPSAFE(0x006C4209);
	RCT2_CALLPROC_EBPSAFE(0x0069EB13);
	ride_init_all();
	RCT2_CALLPROC_EBPSAFE(0x0068F083); // window_guest_list_init_vars_a
	RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
	park_init();
	RCT2_CALLPROC_EBPSAFE(0x0069DEFB);
	date_reset();
	RCT2_CALLPROC_EBPSAFE(0x0068F050); // window_guest_list_init_vars_b
	RCT2_CALLPROC_EBPSAFE(0x006BD39C);
	RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_DESIGNER;
	RCT2_GLOBAL(0x0141F570, uint8) = 0;
	RCT2_CALLPROC_EBPSAFE(0x006ACA58);
	viewport_init_all();
	news_item_init_queue();
	RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create
	mainWindow = window_get_main();
	window_scroll_to_location(mainWindow, 2400, 2400, 112);
	mainWindow->flags &= ~0x08;
	RCT2_CALLPROC_EBPSAFE(0x006837E3);
	gfx_invalidate_screen();
	RCT2_GLOBAL(0x009DEA66, sint16) = 0;
	rct2_endupdate();
}
Ejemplo n.º 3
0
/**
 *
 *  rct2: 0x006729FD
 */
void trackmanager_load()
{
	rct_window *mainWindow;

	object_unload_all();
	map_init();
	set_all_land_owned();
	RCT2_CALLPROC_EBPSAFE(0x006B9CB0);
	reset_park_entrances();
	reset_saved_strings();
	reset_sprite_list();
	ride_init_all();
	window_guest_list_init_vars_a();
	sub_6BD3A4();
	park_init();
	finance_init();
	date_reset();
	window_guest_list_init_vars_b();
	window_staff_list_init_vars();
	RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_MANAGER;
	RCT2_GLOBAL(0x0141F570, uint8) = 0;
	window_new_ride_init_vars();
	viewport_init_all();
	news_item_init_queue();
	RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create
	mainWindow = window_get_main();
	window_scroll_to_location(mainWindow, 2400, 2400, 112);
	mainWindow->flags &= ~WF_SCROLLING_TO_LOCATION;
	RCT2_CALLPROC_EBPSAFE(0x006837E3);
	gfx_invalidate_screen();
	RCT2_GLOBAL(0x009DEA66, sint16) = 0;
	rct2_endupdate();
}
Ejemplo n.º 4
0
/**
 *
 *  rct2: 0x0066EAB8
 */
static void window_news_update(rct_window *w)
{
    sint32 i, j, x, y, z;

    if (w->news.var_480 == -1 ||
        --w->news.var_484 != 0)
    {
        return;
    }

    window_invalidate(w);
    audio_play_sound(SOUND_CLICK_2, 0, w->x + (w->width / 2));

    j = w->news.var_480;
    w->news.var_480 = -1;
    for (i = 11; i < 61; i++)
    {
        if (news_item_is_empty(i))
            return;

        if (j == 0)
        {
            NewsItem * const newsItem = news_item_get(i);
            if (newsItem->Flags & NEWS_FLAG_HAS_BUTTON)
                return;
            if (w->news.var_482 == 1)
            {
                news_item_open_subject(newsItem->Type, newsItem->Assoc);
                return;
            }
            else if (w->news.var_482 > 1)
            {
                news_item_get_subject_location(newsItem->Type, newsItem->Assoc, &x, &y, &z);
                if (x != LOCATION_NULL && (w = window_get_main()) != nullptr)
                {
                    window_scroll_to_location(w, x, y, z);
                }
                return;
            }
        }
        j--;
    }
}
Ejemplo n.º 5
0
/**
 * 
 *  rct2: 0x0066EAB8
 */
static void window_news_update(rct_window *w)
{
	int i, j, x, y, z;
	rct_news_item *newsItems;

	if (w->var_480 == -1)
		return;
	if (--w->var_484 != 0)
		return;

	window_invalidate(w);
	sound_play_panned(5, w->x + (w->width / 2));

	newsItems = RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item);
	j = w->var_480;
	w->var_480 = -1;
	for (i = 11; i < 61; i++) {
		if (newsItems[i].type == NEWS_ITEM_NULL)
			return;

		if (j == 0) {
			if (newsItems[i].flags & 1)
				return;
			if (w->var_482 == 1) {
				news_item_open_subject(newsItems[i].type, newsItems[i].assoc);
				return;
			} else if (w->var_482 > 1) {
				news_item_get_subject_location(newsItems[i].type, newsItems[i].assoc, &x, &y, &z);
				if (x != SPRITE_LOCATION_NULL)
					if ((w = window_get_main()) != NULL)
						window_scroll_to_location(w, x, y, z);
				return;
			}
		}
		j--;
	}
}
Ejemplo n.º 6
0
/**
 *
 *  rct2: 0x0066EAB8
 */
static void window_news_update(rct_window *w)
{
	int i, j, x, y, z;

	if (w->news.var_480 == -1)
		return;
	if (--w->news.var_484 != 0)
		return;

	window_invalidate(w);
	audio_play_sound_panned(SOUND_CLICK_2, w->x + (w->width / 2), 0, 0, 0);

	j = w->news.var_480;
	w->news.var_480 = -1;
	for (i = 11; i < 61; i++) {
		if (news_item_is_empty(i))
			return;

		if (j == 0) {
			rct_news_item * const newsItem = news_item_get(i);
			if (newsItem->flags & 1)
				return;
			if (w->news.var_482 == 1) {
				news_item_open_subject(newsItem->type, newsItem->assoc);
				return;
			}
			else if (w->news.var_482 > 1) {
				news_item_get_subject_location(newsItem->type, newsItem->assoc, &x, &y, &z);
				if (x != SPRITE_LOCATION_NULL)
					if ((w = window_get_main()) != NULL)
						window_scroll_to_location(w, x, y, z);
				return;
			}
		}
		j--;
	}
}
Ejemplo n.º 7
0
/**
 *
 *  rct2: 0x0066FFE1
 */
void editor_load()
{
	rct_window *mainWindow;

	pause_sounds();
	unpause_sounds();
	object_unload_all();
	map_init();
	RCT2_CALLPROC_EBPSAFE(0x006B9CB0);
	reset_park_entrances();
	reset_saved_strings();
	reset_sprite_list();
	ride_init_all();
	window_guest_list_init_vars_a();
	sub_6BD3A4();
	park_init();
	finance_init();
	date_reset();
	window_guest_list_init_vars_b();
	window_staff_list_init_vars();
	RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_SCENARIO_EDITOR;
	RCT2_GLOBAL(0x0141F570, uint8) = 0;
	RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
	window_new_ride_init_vars();
	RCT2_GLOBAL(0x0141F571, uint8) = 4;
	viewport_init_all();
	news_item_init_queue();
	RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create
	mainWindow = window_get_main();
	window_scroll_to_location(mainWindow, 2400, 2400, 112);
	mainWindow->flags &= ~WF_SCROLLING_TO_LOCATION;
	RCT2_CALLPROC_EBPSAFE(0x006837E3);
	gfx_invalidate_screen();
	RCT2_GLOBAL(0x009DEA66, sint16) = 0;
	// rct2_endupdate();
}
Ejemplo n.º 8
0
/**
 *
 *  rct2: 0x00678761
 */
static void title_update_showcase()
{
	rct_window* w;
	uint8 script_opcode, script_operand;
	short x, y;
	int i, _edx;

	if (_scriptWaitCounter <= 0) {
		do {
			script_opcode = *_currentScript++;
			switch (script_opcode) {
			case TITLE_SCRIPT_WAIT:
				_scriptWaitCounter = (*_currentScript++) * 32;
				break;
			case TITLE_SCRIPT_LOAD:
				scenario_load(get_file_path(PATH_ID_SIXFLAGS_MAGICMOUNTAIN));

				w = window_get_main();
				w->var_4B0 = -1;
				w->var_4B2 = RCT2_GLOBAL(0x0138869A, sint16);
				w->var_4B4 = RCT2_GLOBAL(0x0138869C, sint16);

				{
					char _cl = (RCT2_GLOBAL(0x0138869E, sint16) & 0xFF) - w->viewport->zoom;
					w->viewport->zoom = RCT2_GLOBAL(0x0138869E, sint16) & 0xFF;
					*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(0x0138869E, sint16) >> 8;
					if (_cl != 0) {
						if (_cl < 0) {
							_cl = -_cl;
							w->viewport->view_width >>= _cl;
							w->viewport->view_height >>= _cl;
						} else {
							w->viewport->view_width <<= _cl;
							w->viewport->view_height <<= _cl;
						}
					}
					w->var_4B2 -= w->viewport->view_width >> 1;
					w->var_4B4 -= w->viewport->view_height >> 1;
				}

				window_invalidate(w);
				RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
				RCT2_CALLPROC_EBPSAFE(0x006ACA58);
				RCT2_CALLPROC_EBPSAFE(0x00684AC3);
				RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
				news_item_init_queue();
				gfx_invalidate_screen();
				RCT2_GLOBAL(0x009DEA66, sint16) = 0;
				RCT2_GLOBAL(0x009DEA5C, sint16) = 0x0D6D8;
				break;
			case TITLE_SCRIPT_LOCATION:
				x = (*_currentScript++) * 32 + 16;
				y = (*_currentScript++) * 32 + 16;

				// Set location
				int eax, ebx, ecx, edx, esi, edi, ebp;
				eax = x;
				ecx = y;
				RCT2_CALLFUNC_X(0x00662783, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
				_edx = edx;

				// Update viewport
				w = window_get_main();
				if (w != NULL) {
					window_scroll_to_location(w, x, y, _edx);
					w->flags &= ~0x08;
					viewport_update_position(w);
				}
				break;
			case TITLE_SCRIPT_ROTATE:
				script_operand = (*_currentScript++);
				w = window_get_main();
				if (w != NULL)
					for (i = 0; i < script_operand; i++)
						window_rotate_camera(w);
				break;
			case TITLE_SCRIPT_RESTART:
				_currentScript = _magicMountainScript;
				if (gRandomShowcase) {
					if (_currentScript != NULL)
						free(_currentScript);
					_currentScript = generate_random_script();
				}
				break;
			}
		} while (_scriptWaitCounter == 0);
Ejemplo n.º 9
0
/**
 *
 *  rct2: 0x00678761
 */
static void title_update_showcase()
{
	rct_window* w;
	uint8 script_opcode, script_operand;
	short x, y, z;
	int i;

	if (_scriptWaitCounter <= 0) {
		do {
			script_opcode = *_currentScript++;
			switch (script_opcode) {
			case TITLE_SCRIPT_WAIT:
				_scriptWaitCounter = (*_currentScript++) * 32;
				break;
			case TITLE_SCRIPT_LOAD:
				if (!scenario_load(get_file_path(PATH_ID_SIXFLAGS_MAGICMOUNTAIN))) {
					log_fatal("OpenRCT2 can not currently cope when unable to load title screen scenario.");
					exit(-1);
				}

				w = window_get_main();
				w->viewport_target_sprite = -1;
				w->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
				w->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);

				{
					char _cl = (RCT2_GLOBAL(0x0138869E, sint16) & 0xFF) - w->viewport->zoom;
					w->viewport->zoom = RCT2_GLOBAL(0x0138869E, sint16) & 0xFF;
					*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(0x0138869E, sint16) >> 8;
					if (_cl != 0) {
						if (_cl < 0) {
							_cl = -_cl;
							w->viewport->view_width >>= _cl;
							w->viewport->view_height >>= _cl;
						} else {
							w->viewport->view_width <<= _cl;
							w->viewport->view_height <<= _cl;
						}
					}
					w->saved_view_x -= w->viewport->view_width >> 1;
					w->saved_view_y -= w->viewport->view_height >> 1;
				}

				window_invalidate(w);
				sub_69E9A7();
				window_new_ride_init_vars();
				sub_684AC3();
				RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
				news_item_init_queue();
				gfx_invalidate_screen();
				RCT2_GLOBAL(0x009DEA66, sint16) = 0;
				RCT2_GLOBAL(0x009DEA5C, sint16) = 0x0D6D8;
				break;
			case TITLE_SCRIPT_LOCATION:
				x = (*_currentScript++) * 32 + 16;
				y = (*_currentScript++) * 32 + 16;
				z = map_element_height(x, y);

				// Update viewport
				w = window_get_main();
				if (w != NULL) {
					window_scroll_to_location(w, x, y, z);
					w->flags &= ~0x08;
					viewport_update_position(w);
				}
				break;
			case TITLE_SCRIPT_ROTATE:
				script_operand = (*_currentScript++);
				w = window_get_main();
				if (w != NULL)
					for (i = 0; i < script_operand; i++)
						window_rotate_camera(w);
				break;
			case TITLE_SCRIPT_RESTART:
				_currentScript = _magicMountainScript;
				if (gRandomShowcase) {
					if (_currentScript != NULL)
						free((uint8*)_currentScript);
					_currentScript = generate_random_script();
				}
				break;
			}
		} while (_scriptWaitCounter == 0);