コード例 #1
0
/**
 * 
 *  rct2: 0x006AB199
 */
static void window_editor_object_selection_close()
{
	rct_window* w;
	window_get_register(w);

	//if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_EDITOR))
	//	return;

	RCT2_CALLPROC_EBPSAFE(0x6ABB66);
	editor_load_selected_objects();
	reset_loaded_objects();
	object_free_scenario_text();
	RCT2_CALLPROC_EBPSAFE(0x6AB316);
	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_EDITOR) {
		research_populate_list_random();
		research_remove_non_separate_vehicle_types();
	}
	else {
		// Used for in-game object selection cheat
		research_reset_items();
		research_populate_list_researched();
		gSilentResearch = true;
		sub_684AC3();
		gSilentResearch = false;
	}
	window_new_ride_init_vars();
}
コード例 #2
0
ファイル: editor.c プロジェクト: Corsleutel/OpenRCT2
/**
 *
 *  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();
}
コード例 #3
0
ファイル: title.c プロジェクト: cdietschrun/OpenRCT2
/**
 *
 *  rct2: 0x0068E8DA
 */
void title_load()
{
	if (RCT2_GLOBAL(0x009DEA6E, uint8) & 1)
		RCT2_CALLPROC_X(0x00667C15, 0, 1, 0, 0, 0, 0, 0);

	RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO;

	reset_park_entrances();
	reset_saved_strings();
	RCT2_CALLPROC_EBPSAFE(0x0069EB13);
	ride_init_all();
	window_guest_list_init_vars_a();
	RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
	map_init();
	park_init();
	date_reset();
	RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0);
	RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
	window_new_ride_init_vars();
	window_guest_list_init_vars_b();
	window_staff_init_vars();
	RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
	RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
	viewport_init_all();
	news_item_init_queue();
	title_create_windows();
	title_init_showcase();
	gfx_invalidate_screen();
	RCT2_GLOBAL(0x009DEA66, uint16) = 0;
}
コード例 #4
0
ファイル: window_footpath.c プロジェクト: hexdec/OpenRCT2
/**
 *
 *  rct2: 0x006A852F
 */
static void window_footpath_close()
{
    rct_window *w;

    window_get_register(w);

    RCT2_CALLPROC_EBPSAFE(0x006A7831);
    viewport_set_visibility(0);
    RCT2_CALLPROC_EBPSAFE(0x0068AB1B);
    RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;
    window_invalidate_by_id(WC_TOP_TOOLBAR, 0);
    hide_gridlines();
}
コード例 #5
0
ファイル: window_map.c プロジェクト: jvlomax/OpenRCT2
/**
*
*  rct2: 0x0068C88A
*/
void window_map_open()
{
	rct_window* w;
	int* var;

	// Check if window is already open
	w = window_bring_to_front_by_id(WC_MAP, 0);
	if (w != NULL) {
		w->selected_tab = 0;
		w->var_490 = 0;
		return;
	}

	var = (int*)rct2_malloc(0x40000);
	if (var == NULL)
		return;

	RCT2_GLOBAL(0x00F1AD68, uint32) = (uint32)var;
	w = window_create_auto_pos(245, 259, (uint32*)window_map_events, WC_MAP, 0x0400);
	w->widgets = window_map_widgets;
	w->enabled_widgets =
		(1 << 2) |
		(1 << 4) |
		(1 << 5) |
		(1 << 8) |
		(1 << 9) |
		(1 << 14) |
		(1 << 15) |
		(1 << 10) |
		(1 << 16) |
		(1 << 17) |
		(1 << 18) |
		(1 << 19) |
		(1 << 11) |
		(1 << 20) |
		(1 << 12);
	//TODO: .text:0068C943                 or      dword ptr [esi+20h], 300h

	window_init_scroll_widgets(w);
	w->var_480 = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint16);

	RCT2_CALLPROC_EBPSAFE(0x0068CA6C);
	RCT2_GLOBAL(0x00F64F05, uint8) = 0;
	RCT2_CALLPROC_EBPSAFE(0x0068C990);

	w->colours[0] = 12;
	w->colours[1] = 24;
}
コード例 #6
0
ファイル: game.c プロジェクト: GokuMizuno/OpenRCT2
/**
 * 
 *  rct2: 0x0066B5C0 (part of 0x0066B3E8)
 */
void game_create_windows()
{
	window_main_open();
	window_game_top_toolbar_open();
	window_game_bottom_toolbar_open();
	RCT2_CALLPROC_EBPSAFE(0x0066B905);
}
コード例 #7
0
ファイル: editor.c プロジェクト: Corsleutel/OpenRCT2
static int editor_load_landscape_from_sc4(const char *path)
{
	FILE *fp;
	long fpLength;
	char *fpBuffer;

	// Open file
	fp = fopen(path, "rb");
	if (fp == NULL) {
		RCT2_GLOBAL(0x009AC31B, uint8) = 255;
		RCT2_GLOBAL(0x009AC31C, uint16) = 3011;
		return 0;
	}

	// Get length
	fseek(fp, 0, SEEK_END);
	fpLength = ftell(fp);
	rewind(fp);

	// Read whole file into a buffer
	fpBuffer = malloc(fpLength);
	fread(fpBuffer, fpLength, 1, fp);
	fclose(fp);

	editor_read_sc4(fpBuffer, fpLength);
	free(fpBuffer);

	RCT2_CALLPROC_EBPSAFE(0x006A2B62);
	return 1;
}
コード例 #8
0
ファイル: game.c プロジェクト: jvlomax/OpenRCT2
/**
 * 
 *  rct2: 0x0066DC0F
 */
static void load_landscape()
{
	if (open_landscape_file_dialog() == 0) {
		gfx_invalidate_screen();
	} else {
		// Set default filename
		char *esi = (char*)0x0141EF67;
		while (1) {
			esi++;
			if (*esi == '.')
				break;
			if (*esi != 0)
				continue;
			strcpy(esi, ".SC6");
			break;
		}
		strcpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)0x0141EF68);

		RCT2_CALLPROC_EBPSAFE(0x006758C0); // landscape_load
		if (1) {
			gfx_invalidate_screen();
			rct2_endupdate();
		} else {
			RCT2_GLOBAL(0x009DEA66, uint16) = 0;
			rct2_endupdate();
		}
	}
}
コード例 #9
0
ファイル: title.c プロジェクト: Achilleshiel/OpenRCT2
/**
 *
 *  rct2: 0x0068E8DA
 */
void title_load()
{
	if (RCT2_GLOBAL(0x009DEA6E, uint8) & 1)
		RCT2_CALLPROC_X(0x00667C15, 0, 1, 0, 0, 0, 0, 0);//Game pause toggle

	RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO;

	reset_park_entrances();
	user_string_clear_all();
	reset_sprite_list();
	ride_init_all();
	window_guest_list_init_vars_a();
	sub_6BD3A4(); // RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
	map_init();
	park_init();
	date_reset();
	climate_reset(CLIMATE_COOL_AND_WET);
	RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
	window_new_ride_init_vars();
	window_guest_list_init_vars_b();
	window_staff_list_init_vars();
	map_update_tile_pointers(); //RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
	reset_0x69EBE4();// RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
	viewport_init_all();
	news_item_init_queue();
	title_create_windows();
	title_init_showcase();
	gfx_invalidate_screen();
	RCT2_GLOBAL(0x009DEA66, uint16) = 0;
}
コード例 #10
0
ファイル: game.c プロジェクト: jvlomax/OpenRCT2
/**
 * 
 *  rct2: 0x006EA627
 */
void game_handle_input()
{
	rct_window *w;

	if (RCT2_GLOBAL(0x009DEA64, uint16) & 2) {
		RCT2_GLOBAL(0x009DEA64, uint16) &= ~2;
		RCT2_CALLPROC_X(0x006677F2, 0, 1, 0, 0, 5, 2, 0);
	}

	if (RCT2_GLOBAL(0x009ABDF2, uint8) != 0) {
		for (w = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window); w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
			RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, (int)w, 0, 0);

		RCT2_CALLPROC_EBPSAFE(0x006EA73F);
		RCT2_CALLPROC_EBPSAFE(0x006E8346); // update_cursor_position

		{
			// int eax, ebx, ecx, edx, esi, edi, ebp;
			int eax, ebx, ecx;

			for (;;) {
				game_get_next_input(&eax, &ebx, &ecx);
				if (ecx == 0)
					break;

				game_handle_input_mouse(eax, ebx, ecx & 0xFF);
				// RCT2_CALLPROC_X(0x006E8655, eax, ebx, ecx, 0, 0, 0, 0); // window_process_mouse_input
			}

			if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 5)) {
				game_handle_input_mouse(eax, ebx, ecx);
				// RCT2_CALLPROC_X(0x006E8655, eax, ebx, 0, 0, 0, 0, 0); // window_process_mouse_input
			} else if (eax != 0x80000000) {
				eax = clamp(0, eax, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 1);
				ebx = clamp(0, ebx, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 1);

				game_handle_input_mouse(eax, ebx, ecx);
				// RCT2_CALLPROC_X(0x006E8655, eax, ebx, 0, 0, 0, 0, 0); // window_process_mouse_input
				RCT2_CALLPROC_X(0x006ED833, eax, ebx, 0, 0, 0, 0, 0);
				RCT2_CALLPROC_EBPSAFE(0x006ED801);
			}
		}
	}

	for (w = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window); w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
		RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_08], 0, 0, 0, 0, (int)w, 0, 0);
}
コード例 #11
0
ファイル: fountain.c プロジェクト: Balletie/OpenRCT2
/**
 *
 *  rct2: 0x006646E1
 */
void fountain_update_all()
{
    int ignoreScreenFlags = SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER;
    if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & ignoreScreenFlags)
        return;

    // Probably not just fountains... may include scenery aging and grass growth.
    RCT2_CALLPROC_EBPSAFE(0x006646EE);
}
コード例 #12
0
ファイル: editor.c プロジェクト: ZedThree/OpenRCT2
/**
*
*  rct2: 0x006BD3A4
*/
void sub_6BD3A4() {
	for (short i = 0; i < 200; i++) {
		RCT2_ADDRESS(0x013CA672, uint8)[i] = 0;
	}
	for (short i = 200; i < 204; i++) {
		RCT2_ADDRESS(0x013CA672, uint8)[i] = 1;
	}
	RCT2_CALLPROC_EBPSAFE(0x006C0C3F);
}
コード例 #13
0
/**
 *
 *  rct2: 0x006AA64E
 */
void window_editor_object_selection_open()
{
	rct_window* window;

	window = window_bring_to_front_by_class(WC_EDITOR_OBJECT_SELECTION);
	if (window != NULL)
		return;

	RCT2_CALLPROC_EBPSAFE(0x006AB211);
	RCT2_CALLPROC_EBPSAFE(0x006AA770);

	// Not really where its called, but easy way to change default objects for now
	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)
		window_editor_object_selection_select_default_objects();

	window = window_create_centred(
		600,
		400,
		(uint32*)window_editor_object_selection_events,
		WC_EDITOR_OBJECT_SELECTION,
		WF_10
	);
	window->widgets = window_editor_object_selection_widgets;

	window->enabled_widgets =
		(1 << WIDX_DROPDOWN1) |
		(1 << WIDX_DROPDOWN2) |
		(1 << WIDX_FILTER_DROPDOWN) |
		(1 << WIDX_FILTER_STRING_BUTTON) |
		(1 << WIDX_FILTER_CLEAR_BUTTON) |
		(1 << WIDX_CLOSE);

	_filter_flags = FILTER_ALL;
	memset(_filter_string, 0, sizeof(_filter_string));

	for (int i = WIDX_TAB_1; i <= WIDX_TAB_11; i++)
		window->enabled_widgets |= (1LL << i);
	window_init_scroll_widgets(window);

	window->var_4AE = 0;
	window->selected_tab = 0;
	window->selected_list_item = -1;
	window->var_494 = 0xFFFFFFFF;
}
コード例 #14
0
/**
 * 
 *  rct2: 0x0066C9EA
 */
static void window_game_top_toolbar_dropdown()
{
	short widgetIndex, dropdownIndex;

	__asm mov widgetIndex, dx
	__asm mov dropdownIndex, ax

	if (widgetIndex == WIDX_FILE_MENU) {
		switch (dropdownIndex) {
		case 0:		// load game
			game_do_command(0, 1, 0, 0, 5, 0, 0);
			break;
		case 1:		// save game
			tool_cancel();
			{
				int eax, ebx, ecx, edx, esi, edi, ebp;
				RCT2_CALLFUNC_X(0x006750E9, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
				if (eax == 0) {
					gfx_invalidate_screen();
					break;
				}

				char *src = 0x0141EF67;
				do {
					src++;
				} while (*src != '.' && *src != '\0');
				strcpy(src, ".SV6");
				strcpy(0x009ABB37, 0x0141EF68);

				eax = 0;
				if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 8)
					eax |= 1;
				RCT2_CALLPROC_X(0x006754F5, eax, 0, 0, 0, 0, 0, 0);
				// check success?

				game_do_command(0, 1047, 0, -1, 0, 0, 0);
				gfx_invalidate_screen();
			}
			break;
		case 3:		// about
			window_about_open();
			break;
		case 4:		// options
			RCT2_CALLPROC_EBPSAFE(0x006BAC5B);
			break;
		case 5:		// screenshot
			RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;
			break;
		case 7:		// quit game
			game_do_command(0, 1, 0, 0, 5, 1, 0);
			break;
		}
	} else if (widgetIndex == WIDX_VIEW_MENU) {
		RCT2_CALLPROC_X(0x0066CF8A, dropdownIndex, 0, 0, 0, 0, 0, 0);
	}
}
コード例 #15
0
ファイル: title.c プロジェクト: benpye/OpenRCT2
/**
 * Creates the windows shown on the title screen; New game, load game,
 * tutorial, toolbox and exit.
 *  rct2: 0x0066B5C0 (part of 0x0066B3E8)
 */
static void title_create_windows()
{
	// RCT2_CALLPROC_EBPSAFE(0x0066B3E8);

	window_main_open();
	window_title_menu_open();
	window_title_exit_open();
	window_title_logo_open();
	RCT2_CALLPROC_EBPSAFE(0x0066B905);
}
コード例 #16
0
ファイル: screenshot.c プロジェクト: 69wolfblake69/OpenRCT2
/**
 * 
 *  rct2: 0x006E3AEC
 */
void screenshot_check()
{
	int screenshotIndex;

	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) != 0) {
		RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8)--;
		if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) == 0) {
			RCT2_CALLPROC_EBPSAFE(0x00684218);
			screenshotIndex = screenshot_dump();
			RCT2_GLOBAL(0x013CE952, uint16) = STR_SCR_BMP;
			RCT2_GLOBAL(0x013CE952 + 2, uint16) = screenshotIndex;
			RCT2_GLOBAL(0x009A8C29, uint8) |= 1;

			window_error_open(screenshotIndex == -1 ? STR_SCREENSHOT_FAILED : STR_SCREENSHOT_SAVED_AS, -1);
			RCT2_GLOBAL(0x009A8C29, uint8) &= ~1;
			RCT2_CALLPROC_EBPSAFE(0x006843DC);
		}
	}
}
コード例 #17
0
ファイル: window.c プロジェクト: GertS/OpenRCT2
/**
 * 
 *  rct2: 0x006ED7B0
 */
void window_dispatch_update_all()
{
	rct_window *w;

	RCT2_GLOBAL(0x01423604, sint32)++;
	RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, sint16)++;
	for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--)
		RCT2_CALLPROC_WE_UPDATE(w->event_handlers[WE_UPDATE], w);

	RCT2_CALLPROC_EBPSAFE(0x006EE411);	// handle_text_input
}
コード例 #18
0
static void shortcut_show_research_information()
{
	rct_window *window;

	if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
		// Open new ride window
		RCT2_CALLPROC_EBPSAFE(0x006B3CFF);
		window = window_find_by_class(WC_CONSTRUCT_RIDE);
		if (window != NULL)
			window_event_mouse_up_call(window, 10);
	}
}
コード例 #19
0
ファイル: osinterface.c プロジェクト: ZedThree/OpenRCT2
static void osinterface_resize(int width, int height)
{
	rct_drawpixelinfo *screenDPI;
	int newScreenBufferSize;
	void *newScreenBuffer;

	if (_surface != NULL)
		SDL_FreeSurface(_surface);
	if (_palette != NULL)
		SDL_FreePalette(_palette);

	_surface = SDL_CreateRGBSurface(0, width, height, 8, 0, 0, 0, 0);
	_palette = SDL_AllocPalette(256);

	SDL_SetSurfacePalette(_surface, _palette);

	newScreenBufferSize = _surface->pitch * _surface->h;
	newScreenBuffer = malloc(newScreenBufferSize);
	if (_screenBuffer == NULL) {
		memset(newScreenBuffer, 0, newScreenBufferSize);
	} else {
		memcpy(newScreenBuffer, _screenBuffer, min(_screenBufferSize, newScreenBufferSize));
		if (newScreenBufferSize - _screenBufferSize > 0)
			memset((uint8*)newScreenBuffer + _screenBufferSize, 0, newScreenBufferSize - _screenBufferSize);
		free(_screenBuffer);
	}

	_screenBuffer = newScreenBuffer;
	_screenBufferSize = newScreenBufferSize;

	RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) = width;
	RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) = height;

	screenDPI = RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo);
	screenDPI->bits = _screenBuffer;
	screenDPI->x = 0;
	screenDPI->y = 0;
	screenDPI->width = width;
	screenDPI->height = height;
	screenDPI->pitch = _surface->pitch - _surface->w;

	RCT2_GLOBAL(0x009ABDF0, uint8) = 6;
	RCT2_GLOBAL(0x009ABDF1, uint8) = 3;
	RCT2_GLOBAL(0x009ABDF2, uint8) = 1;
	RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_WIDTH, sint16) = 64;
	RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT, sint16) = 8;
	RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) = (width >> 6) + 1;
	RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, sint32) = (height >> 3) + 1;

	RCT2_CALLPROC_EBPSAFE(0x0066B905); // resize_gui()
	gfx_invalidate_screen();
}
コード例 #20
0
ファイル: object.c プロジェクト: cdietschrun/OpenRCT2
/**
 * 
 *  rct2: 0x006AA0C6
 */
void object_read_and_load_entries(HANDLE hFile)
{
	RCT2_CALLPROC_EBPSAFE(0x006AA0C6);

	// int i;
	// rct_object_entry *entries;
	// entries = malloc(721 * sizeof(rct_object_entry));
	// sawyercoding_read_chunk(hFile, entries);
	// for (i = 0; i < 721; i++) {
	// 	RCT2_CALLPROC_X(0x006A985D, 0, 0, i, 0, 0, 0, 0);
	// }
	// free(entries);
}
コード例 #21
0
ファイル: osinterface.c プロジェクト: ZedThree/OpenRCT2
static void osinterface_create_window()
{
	SDL_SysWMinfo wmInfo;
	HWND hWnd;
	int width, height;

	if (SDL_Init(SDL_INIT_VIDEO) < 0) {
		fprintf(stderr, "Error: SDL_Init\n");
		exit(-1);
	}

	// stuff
	{
		RCT2_CALLPROC_EBPSAFE(0x0068352C);
		RCT2_CALLPROC_EBPSAFE(0x0068371D);

		width = RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_RESOLUTION_WIDTH, sint16);
		height = RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_RESOLUTION_HEIGHT, sint16);

		width = 640;
		height = 480;
	}

	RCT2_GLOBAL(0x009E2D8C, sint32) = 0;


	_window = SDL_CreateWindow("OpenRCT2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_RESIZABLE);
	
	// Get the HWND context
	SDL_GetWindowWMInfo(_window, &wmInfo);
	hWnd = wmInfo.info.win.window;
	RCT2_GLOBAL(0x009E2D70, HWND) = hWnd;

	// Set the update palette function pointer
	RCT2_GLOBAL(0x009E2BE4, update_palette_func) = osinterface_update_palette;

	// Initialise the surface, palette and draw buffer
	osinterface_resize(width, height);
}
コード例 #22
0
ファイル: window_footpath.c プロジェクト: hexdec/OpenRCT2
/**
 *
 *  rct2: 0x006A7C43
 */
void window_footpath_open()
{
    rct_window* window;

    // Check if window is already open
    window = window_bring_to_front_by_id(WC_FOOTPATH, 0);
    if (window != NULL)
        return;

    window = window_create(
                 0,
                 29,
                 106,
                 381,
                 (uint32*)window_footpath_events,
                 WC_FOOTPATH,
                 0
             );
    window->widgets = window_footpath_widgets;
    window->enabled_widgets =
        (1 << WIDX_CLOSE) |
        (1 << WIDX_FOOTPATH_TYPE) |
        (1 << WIDX_QUEUELINE_TYPE) |
        (1 << WIDX_DIRECTION_NW) |
        (1 << WIDX_DIRECTION_NE) |
        (1 << WIDX_DIRECTION_SW) |
        (1 << WIDX_DIRECTION_SE) |
        (1 << WIDX_SLOPEDOWN) |
        (1 << WIDX_LEVEL) |
        (1 << WIDX_SLOPEUP) |
        (1 << WIDX_CONSTRUCT) |
        (1 << WIDX_REMOVE) |
        (1 << WIDX_CONSTRUCT_ON_LAND) |
        (1 << WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL);

    window_init_scroll_widgets(window);
    window_push_others_right(window);
    show_gridlines();
    window->colours[0] = 24;
    window->colours[1] = 24;
    window->colours[2] = 24;

    tool_cancel();
    RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_LAND;
    tool_set(window, WIDX_CONSTRUCT_ON_LAND, 17);
    RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
    RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) = 0;
    RCT2_CALLPROC_EBPSAFE(0x006A855C);
}
コード例 #23
0
ファイル: editor.c プロジェクト: Corsleutel/OpenRCT2
/**
 *
 *  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();
}
コード例 #24
0
ファイル: window_map.c プロジェクト: jvlomax/OpenRCT2
/**
*
*  rct2: 0x006BAFCA
*/
static void window_map_mouseup()
{
	RCT2_CALLPROC_EBPSAFE(0x006BAFCA);
	/*short widgetIndex;
	rct_window *w;

	__asm mov widgetIndex, dx
	__asm mov w, esi

	switch (widgetIndex) {
	case WIDX_CLOSE:
		window_close(w);
		break;
	}*/
}
コード例 #25
0
ファイル: window_footpath.c プロジェクト: hexdec/OpenRCT2
/**
 *
 *  rct2: 0x006A7F18
 */
static void window_footpath_dropdown()
{
    int i, j, pathId;
    short dropdownIndex;
    short widgetIndex;
    rct_window *w;
    rct_path_type *pathType;

    window_dropdown_get_registers(w, widgetIndex, dropdownIndex);

    if (widgetIndex == WIDX_FOOTPATH_TYPE)
        RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_TYPE, uint8) = SELECTED_PATH_TYPE_NORMAL;
    else if (widgetIndex == WIDX_QUEUELINE_TYPE)
        RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_TYPE, uint8) = SELECTED_PATH_TYPE_QUEUE;
    else
        return;

    // Get path id
    pathId = dropdownIndex;
    if (pathId == -1) {
        pathId = RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_ID, sint16);
    } else {
        int flags = 4;
        if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)
            flags = 0;

        j = 0;
        for (i = 0; i < 16; i++) {
            pathType = RCT2_ADDRESS(RCT2_ADDRESS_PATH_TYPES, rct_path_type*)[i];
            if (pathType == (rct_path_type*)-1)
                continue;
            if (pathType->flags & flags)
                continue;

            if (j == pathId)
                break;
            j++;
        }
        pathId = i;
    }

    // Set selected path id
    RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_ID, sint16) = pathId;
    RCT2_CALLPROC_EBPSAFE(0x006A7831);
    _window_footpath_cost = 0x80000000;
    window_invalidate(w);
}
コード例 #26
0
ファイル: osinterface.c プロジェクト: jcdavis/OpenRCT2
static void osinterface_create_window()
{
	SDL_SysWMinfo wmInfo;
	HWND hWnd;
	int width, height;

	if (SDL_Init(SDL_INIT_VIDEO) < 0) {
		RCT2_ERROR("SDL_Init %s", SDL_GetError());
		exit(-1);
	}

	// stuff
	{
		osinterface_load_cursors();
		RCT2_CALLPROC_EBPSAFE(0x0068371D);

		width = gGeneral_config.window_width;
		height = gGeneral_config.window_height;

		if (width == -1) width = 640;
		if (height == -1) height = 480;
	}

	RCT2_GLOBAL(0x009E2D8C, sint32) = 0;

	_window = SDL_CreateWindow("OpenRCT2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height,
		_fullscreen_modes[gGeneral_config.fullscreen_mode] | SDL_WINDOW_RESIZABLE);
	if (!_window) {
		RCT2_ERROR("SDL_CreateWindow failed %s", SDL_GetError());
		exit(-1);
	}

	SDL_VERSION(&wmInfo.version);
	// Get the HWND context
	if (SDL_GetWindowWMInfo(_window, &wmInfo) != SDL_TRUE) {
		RCT2_ERROR("SDL_GetWindowWMInfo failed %s", SDL_GetError());
		exit(-1);
	}
	hWnd = wmInfo.info.win.window;
	RCT2_GLOBAL(0x009E2D70, HWND) = hWnd;

	// Set the update palette function pointer
	RCT2_GLOBAL(0x009E2BE4, update_palette_func) = osinterface_update_palette;

	// Initialise the surface, palette and draw buffer
	osinterface_resize(width, height);
}
コード例 #27
0
ファイル: save_prompt.c プロジェクト: Aitchwing/OpenRCT2
/**
 *
 *  rct2: 0x0066DDF2
 */
static void window_save_prompt_mouseup(rct_window *w, int widgetIndex)
{
	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
		switch (widgetIndex) {
		case WQIDX_OK:
			game_load_or_quit_no_save_prompt();
			break;
		case WQIDX_CLOSE:
		case WQIDX_CANCEL:
			window_close(w);
			break;
		}
		return;
	} else {
		switch (widgetIndex) {
		case WIDX_SAVE:
			save_game_as();
			window_close(w);
			gLoadSaveCallback = window_save_prompt_callback;
			break;
		case WIDX_DONT_SAVE:
			game_load_or_quit_no_save_prompt();
			return;
		case WIDX_CLOSE:
		case WIDX_CANCEL:
			window_close(w);
			return;
		}
	}

	if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 0) {
		if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 1) {
			RCT2_CALLPROC_EBPSAFE(0x0066EE54);
			game_load_or_quit_no_save_prompt();
			return;
		} else {
			tutorial_stop();
			game_load_or_quit_no_save_prompt();
			return;
		}
	}
}
コード例 #28
0
ファイル: window_footpath.c プロジェクト: hexdec/OpenRCT2
/**
 *
 *  rct2: 0x006A7E92
 */
static void window_footpath_mouseup()
{
    short widgetIndex;
    rct_window *w;

    window_widget_get_registers(w, widgetIndex);

    switch (widgetIndex) {
    case WIDX_CLOSE:
        window_close(w);
        break;
    case WIDX_CONSTRUCT:
        window_footpath_construct();
        break;
    case WIDX_REMOVE:
        window_footpath_remove();
        break;
    case WIDX_CONSTRUCT_ON_LAND:
        if (RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) == PATH_CONSTRUCTION_MODE_LAND)
            break;

        _window_footpath_cost = 0x80000000;
        tool_cancel();
        RCT2_CALLPROC_EBPSAFE(0x006A7831);
        RCT2_CALLPROC_EBPSAFE(0x0068AB1B);
        RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;
        RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_LAND;
        tool_set(w, WIDX_CONSTRUCT_ON_LAND, 17);
        RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
        RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) = 0;
        RCT2_CALLPROC_EBPSAFE(0x006A855C);
        break;
    case WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL:
        if (RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL)
            break;

        _window_footpath_cost = 0x80000000;
        tool_cancel();
        RCT2_CALLPROC_EBPSAFE(0x006A7831);
        RCT2_CALLPROC_EBPSAFE(0x0068AB1B);
        RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;
        RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL;
        tool_set(w, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, 12);
        RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
        RCT2_GLOBAL(RCT2_ADDRESS_PATH_ERROR_OCCURED, uint8) = 0;
        RCT2_CALLPROC_EBPSAFE(0x006A855C);
        break;
    }
}
コード例 #29
0
ファイル: banner.c プロジェクト: deadspaceXD/OpenRCT2
/* rct2: 0x6ba4d6*/
static void window_banner_mouseup()
{
	short widgetIndex;
	rct_window *w;

	window_widget_get_registers(w, widgetIndex);

	rct_banner* banner = &gBanners[w->number];
	int x = banner->x << 5;
	int y = banner->y << 5;

	rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(((y << 8) | x) >> 5);

	while (1){
		if (((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_BANNER) &&
			(map_element->properties.banner.index == w->number)) break;
		map_element++;
	}

	switch (widgetIndex) {
	case WIDX_CLOSE:
		window_close(w);
		break;
	case WIDX_BANNER_DEMOLISH:
		game_do_command(x, 1, y, map_element->base_height | (map_element->properties.banner.position << 8), GAME_COMMAND_51, 0, 0);
		break;
	case WIDX_BANNER_TEXT:
		window_text_input_open(w, WIDX_BANNER_TEXT, 2982, 2983, gBanners[w->number].string_idx, 0);
		break;
	case WIDX_BANNER_NO_ENTRY:
		RCT2_CALLPROC_EBPSAFE(0x006EE3C3);
		banner->flags ^= BANNER_FLAG_NO_ENTRY;
		window_invalidate(w);

		map_element->properties.banner.flags = 0xFF;
		if (banner->flags & BANNER_FLAG_NO_ENTRY){
			map_element->properties.banner.flags &= ~(1 << map_element->properties.banner.position);
		}
		break;
	}
}
コード例 #30
0
ファイル: window_track_list.c プロジェクト: Xaon60/OpenRCT2
/**
 *
 *  rct2: 0x006CF1A2
 */
void window_track_list_open(ride_list_item item)
{
	rct_window *w;
	int x, y;
	void *mem;

	window_close_construction_windows();
	_window_track_list_item = item;

	if (RCT2_GLOBAL(0x00F635ED, uint8) & 1)
		window_error_open(STR_WARNING, STR_TOO_MANY_TRACK_DESIGNS_OF_THIS_TYPE);

	mem = malloc(1285292);
	if (mem == NULL)
		return;

	RCT2_GLOBAL(0x00F44105, void*) = mem;
	RCT2_CALLPROC_EBPSAFE(0x006D1DCE);

	if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
		x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 300;
		y = max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 200);
	} else {
		x = 0;
		y = 29;
	}
	w = window_create(0, 29, 600, 400, (uint32*)window_track_list_events, WC_TRACK_DESIGN_LIST, 0);
	w->widgets = window_track_list_widgets;
	w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_ROTATE) | (1 << WIDX_TOGGLE_SCENERY);
	window_init_scroll_widgets(w);
	w->colours[0] = 26;
	w->colours[1] = 26;
	w->colours[2] = 26;
	w->track_list.var_480 = 0xFFFF;
	w->track_list.var_482 = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ? 1 : 0;
	w->track_list.var_484 = 0;
	RCT2_GLOBAL(0x00F44152, uint8) = 0;
	window_push_others_right(w);
	RCT2_GLOBAL(0x00F440AE, uint8) = 2;
}