/** * * rct: 0x0069C5D0 */ void money_effect_create(money32 value) { rct_window *mainWindow; rct_viewport *mainViewport; rct_xyz16 mapPosition; mapPosition.x = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16); mapPosition.y = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16); mapPosition.z = RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16); if (mapPosition.x == (sint16)0x8000) { mainWindow = window_get_main(); if (mainWindow == NULL) return; mainViewport = mainWindow->viewport; screen_get_map_xy( mainViewport->x + (mainViewport->width / 2), mainViewport->y + (mainViewport->height / 2), &mapPosition.x, &mapPosition.y, NULL ); if (mapPosition.x == (sint16)0x8000) return; mapPosition.z = map_element_height(mapPosition.x, mapPosition.y) & 0xFFFF; } mapPosition.z += 10; money_effect_create_at(-value, mapPosition.x, mapPosition.y, mapPosition.z); }
/** * * 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(); }
/** * * 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(); }
static void game_handle_key_scroll() { rct_window * mainWindow; sint32 scrollX, scrollY; mainWindow = window_get_main(); if (mainWindow == nullptr) return; if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))) return; if (mainWindow->viewport == nullptr) return; rct_window * textWindow; textWindow = window_find_by_class(WC_TEXTINPUT); if (textWindow || gUsingWidgetTextBox) return; if (gChatOpen) return; scrollX = 0; scrollY = 0; const uint8 * keysState = context_get_keys_state(); get_keyboard_map_scroll(keysState, &scrollX, &scrollY); if (scrollX != 0 || scrollY != 0) { window_unfollow_sprite(mainWindow); } input_scroll_viewport(scrollX, scrollY); }
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; } }
/** * * rct2: 0x0066C957 */ static void window_editor_top_toolbar_mouseup() { short widgetIndex; rct_window *w, *mainWindow; window_widget_get_registers(w, widgetIndex); switch (widgetIndex) { case WIDX_ZOOM_IN: if ((mainWindow = window_get_main()) != NULL) window_zoom_in(mainWindow); break; case WIDX_ZOOM_OUT: if ((mainWindow = window_get_main()) != NULL) window_zoom_out(mainWindow); break; case WIDX_ROTATE: if ((mainWindow = window_get_main()) != NULL) window_rotate_camera(mainWindow); break; case WIDX_SCENERY: if (!tool_set(w, WIDX_SCENERY, 0)) { RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6); window_scenery_open(); } break; case WIDX_PATH: toggle_footpath_window(); break; case WIDX_LAND: toggle_land_window(w, WIDX_LAND); break; case WIDX_CLEAR_SCENERY: toggle_clear_scenery_window(w, WIDX_CLEAR_SCENERY); break; case WIDX_WATER: toggle_water_window(w, WIDX_WATER); break; case WIDX_MAP: window_map_open(); break; case WIDX_CONSTRUCT_RIDE: window_new_ride_open(); break; } }
static void toggle_view_flag(int viewportFlag) { rct_window *window; window = window_get_main(); if (window != NULL) { window->viewport->flags ^= viewportFlag; window_invalidate(window); } }
/** * * rct2: 0x006646B4 */ void hide_gridlines() { rct_window *mainWindow; RCT2_GLOBAL(0x009E32B0, uint8)--; if (RCT2_GLOBAL(0x009E32B0, uint8) == 0) { if ((mainWindow = window_get_main()) != NULL) { if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES)) { mainWindow->viewport->flags &= ~VIEWPORT_FLAG_GRIDLINES; window_invalidate(mainWindow); } } } }
/** * * rct2: 0x00664E8E */ void show_land_rights() { rct_window *mainWindow; if (RCT2_GLOBAL(0x009E32B2, uint8) != 0) { if ((mainWindow = window_get_main()) != NULL) { if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_LAND_OWNERSHIP)) { mainWindow->viewport->flags |= VIEWPORT_FLAG_LAND_OWNERSHIP; window_invalidate(mainWindow); } } } RCT2_GLOBAL(0x009E32B2, uint8)++; }
/** * * rct2: 0x00664E8E */ void hide_land_rights() { rct_window *mainWindow; RCT2_GLOBAL(0x009E32B2, uint8)--; if (RCT2_GLOBAL(0x009E32B2, uint8) == 0) { if ((mainWindow = window_get_main()) != NULL) { if (mainWindow->viewport->flags & VIEWPORT_FLAG_LAND_OWNERSHIP) { mainWindow->viewport->flags &= ~VIEWPORT_FLAG_LAND_OWNERSHIP; window_invalidate(mainWindow); } } } }
/** * * rct2: 0x00664EDD */ void show_construction_rights() { rct_window *mainWindow; if (RCT2_GLOBAL(0x009E32B3, uint8) != 0) { if ((mainWindow = window_get_main()) != NULL) { if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_CONSTRUCTION_RIGHTS)) { mainWindow->viewport->flags |= VIEWPORT_FLAG_CONSTRUCTION_RIGHTS; window_invalidate(mainWindow); } } } RCT2_GLOBAL(0x009E32B3, uint8)++; }
/** * * rct2: 0x00664F08 */ void hide_construction_rights() { rct_window *mainWindow; RCT2_GLOBAL(0x009E32B3, uint8)--; if (RCT2_GLOBAL(0x009E32B3, uint8) == 0) { if ((mainWindow = window_get_main()) != NULL) { if (mainWindow->viewport->flags & VIEWPORT_FLAG_CONSTRUCTION_RIGHTS) { mainWindow->viewport->flags &= ~VIEWPORT_FLAG_CONSTRUCTION_RIGHTS; window_invalidate(mainWindow); } } } }
/** * * rct2: 0x00664689 */ void show_gridlines() { rct_window *mainWindow; if (RCT2_GLOBAL(0x009E32B0, uint8) == 0) { if ((mainWindow = window_get_main()) != NULL) { if (!(mainWindow->viewport->flags & VIEWPORT_FLAG_GRIDLINES)) { mainWindow->viewport->flags |= VIEWPORT_FLAG_GRIDLINES; window_invalidate(mainWindow); } } } RCT2_GLOBAL(0x009E32B0, uint8)++; }
/** * * rct2: 0x0066FADA */ static void window_editor_top_toolbar_resize() { rct_window *mainWindow = window_get_main(); rct_window *w; window_get_register(w); int eax = 0; if ((w->disabled_widgets & 0xFF) == 0) eax |= (1 << 3); if ((w->disabled_widgets & 0xFF) == 3) eax |= (1 << 2); RCT2_CALLPROC_X(0x006ECE14, 0, 0, 0, 0, (int)w, 0, 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--; } }
void game_handle_edge_scroll() { rct_window *mainWindow; sint32 scrollX, scrollY; mainWindow = window_get_main(); if (mainWindow == NULL) return; if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))) return; if (mainWindow->viewport == NULL) return; uint32 window_flags = SDL_GetWindowFlags(gWindow); if ((window_flags & SDL_WINDOW_INPUT_FOCUS) == 0) return; scrollX = 0; scrollY = 0; // Scroll left / right if (gCursorState.x == 0) scrollX = -1; else if (gCursorState.x >= gScreenWidth - 1) scrollX = 1; // Scroll up / down if (gCursorState.y == 0) scrollY = -1; else if (gCursorState.y >= gScreenHeight - 1) scrollY = 1; // Scroll viewport if (scrollX != 0) { mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom); _inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING; } if (scrollY != 0) { mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom); _inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING; } }
void game_handle_edge_scroll() { rct_window *mainWindow; int scrollX, scrollY; mainWindow = window_get_main(); if (mainWindow == NULL) return; if ((mainWindow->flags & WF_NO_SCROLLING) || (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 9)) return; if (mainWindow->viewport == NULL) return; uint32 window_flags = SDL_GetWindowFlags(gWindow); if ((window_flags & SDL_WINDOW_INPUT_FOCUS) == 0) return; scrollX = 0; scrollY = 0; // Scroll left / right if (gCursorState.x == 0) scrollX = -1; else if (gCursorState.x == RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 1) scrollX = 1; // Scroll up / down if (gCursorState.y == 0) scrollY = -1; else if (gCursorState.y == RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 1) scrollY = 1; // Scroll viewport if (scrollX != 0) { mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom); gInputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING; } if (scrollY != 0) { mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom); gInputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING; } }
void console_update() { if (!_consoleInitialised) console_init(); _consoleLeft = 0; _consoleTop = 0; _consoleRight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16); _consoleBottom = 322; if (gConsoleOpen) { console_invalidate(); // When scrolling the map, the console pixels get copied... therefore invalidate the screen rct_window *mainWindow = window_get_main(); if (mainWindow != NULL) { rct_viewport *mainViewport = mainWindow->viewport; if (mainViewport != NULL) { if (_lastMainViewportX != mainViewport->view_x || _lastMainViewportY != mainViewport->view_y) { _lastMainViewportX = mainViewport->view_x; _lastMainViewportY = mainViewport->view_y; gfx_invalidate_screen(); } } } // Remove unwated characters in console input unsigned char *ch = (unsigned char*)_consoleCurrentLine; while (*ch != 0) { if (*ch < 32 || *ch > 126) *ch = ' '; ch++; } } // Flash the caret _consoleCaretTicks = (_consoleCaretTicks + 1) % 30; }
void game_handle_edge_scroll() { rct_window *mainWindow; int scrollX, scrollY; mainWindow = window_get_main(); if (mainWindow == NULL) return; if ((mainWindow->flags & WF_2) || (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 9)) return; if (mainWindow->viewport == NULL) return; scrollX = 0; scrollY = 0; // Scroll left / right if (gCursorState.x == 0) scrollX = -1; else if (gCursorState.x == RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 1) scrollX = 1; // Scroll up / down if (gCursorState.y == 0) scrollY = -1; else if (gCursorState.y == RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 1) scrollY = 1; // Scroll viewport if (scrollX != 0) { mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7); } if (scrollY != 0) { mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7); } }
void game_handle_key_scroll() { rct_window *mainWindow; int scrollX, scrollY; mainWindow = window_get_main(); if (mainWindow == NULL) return; if ((mainWindow->flags & WF_2) || (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 9)) return; if (mainWindow->viewport == NULL) return; scrollX = 0; scrollY = 0; // Scroll left / right if (gKeysState[SDL_SCANCODE_LEFT]) scrollX = -1; else if (gKeysState[SDL_SCANCODE_RIGHT]) scrollX = 1; // Scroll up / down if (gKeysState[SDL_SCANCODE_UP]) scrollY = -1; else if (gKeysState[SDL_SCANCODE_DOWN]) scrollY = 1; // Scroll viewport if (scrollX != 0) { mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7); } if (scrollY != 0) { mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7); } }
static int title_load_park(const char *path) { rct_window* w; int successfulLoad = 0; if (_strcmpi(path_get_extension(path), ".sv6") == 0) { SDL_RWops* rw = SDL_RWFromFile(path, "rb"); if (rw != NULL) { successfulLoad = game_load_sv6(rw); SDL_RWclose(rw); } } else { successfulLoad = scenario_load(path); } if (!successfulLoad) return 0; 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(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF) - w->viewport->zoom; w->viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF; *((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, 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; } }
/** * * 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--; } }
/** * * 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--; } }
/** * * rct2: 0x00678282 * scenario (ebx) */ void scenario_load_and_play(const rct_scenario_basic *scenario) { rct_window *mainWindow; rct_s6_info *s6Info = (rct_s6_info*)0x0141F570; // Create the scenario pseduo-random seeds using the current time uint32 srand0, srand1; srand0 = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32) ^ timeGetTime(); srand1 = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_1, uint32) ^ timeGetTime(); RCT2_CALLPROC_EBPSAFE(0x006CBCC3); subsitute_path( RCT2_ADDRESS(0x0141EF68, char), RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char), scenario->path ); scenario_load((char*)0x0141EF68); RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING; viewport_init_all(); game_create_windows(); mainWindow = window_get_main(); mainWindow->viewport_target_sprite = -1; mainWindow->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16); mainWindow->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16); uint8 _cl = (RCT2_GLOBAL(0x0138869E, sint16) & 0xFF) - mainWindow->viewport->zoom; mainWindow->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; mainWindow->viewport->view_width >>= _cl; mainWindow->viewport->view_height >>= _cl; } else {
/** * * 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(); }
/** * * rct2: 0x00675E1B */ int game_load_save() { rct_window *mainWindow; HANDLE hFile; char *path; int i, j; path = (char*)0x0141EF68; hFile = CreateFile( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS | FILE_ATTRIBUTE_NORMAL, NULL ); if (hFile == NULL) { RCT2_GLOBAL(0x009AC31B, uint8) = 255; RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, uint16) = STR_FILE_CONTAINS_INVALID_DATA; return 0; } RCT2_GLOBAL(0x009E382C, HANDLE) = hFile; if (!sawyercoding_validate_checksum(hFile)) { CloseHandle(hFile); RCT2_GLOBAL(0x009AC31B, uint8) = 255; RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, uint16) = STR_FILE_CONTAINS_INVALID_DATA; return 0; } rct_s6_header *s6Header = (rct_s6_header*)0x009E34E4; rct_s6_info *s6Info = (rct_s6_info*)0x0141F570; // Read first chunk sawyercoding_read_chunk(hFile, (uint8*)s6Header); if (s6Header->type == S6_TYPE_SAVEDGAME) { // Read packed objects if (s6Header->num_packed_objects > 0) { j = 0; for (i = 0; i < s6Header->num_packed_objects; i++) j += object_load_packed(); if (j > 0) object_load_list(); } } object_read_and_load_entries(hFile); // Read flags (16 bytes) sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_CURRENT_MONTH_YEAR); // Read map elements memset((void*)RCT2_ADDRESS_MAP_ELEMENTS, 0, MAX_MAP_ELEMENTS * sizeof(rct_map_element)); sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_MAP_ELEMENTS); // Read game data, including sprites sawyercoding_read_chunk(hFile, (uint8*)0x010E63B8); CloseHandle(hFile); // Check expansion pack // RCT2_CALLPROC_EBPSAFE(0x006757E6); // The rest is the same as in scenario load and play RCT2_CALLPROC_EBPSAFE(0x006A9FC0); map_update_tile_pointers(); RCT2_CALLPROC_EBPSAFE(0x0069EBE4); RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING; viewport_init_all(); game_create_windows(); mainWindow = window_get_main(); mainWindow->var_4B0 = -1; mainWindow->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16); mainWindow->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16); uint8 _cl = (RCT2_GLOBAL(0x0138869E, sint16) & 0xFF) - mainWindow->viewport->zoom; mainWindow->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; mainWindow->viewport->view_width >>= _cl; mainWindow->viewport->view_height >>= _cl; } else {
/** * * rct2: 0x0066CA3B */ static void window_game_top_toolbar_mousedown() { short widgetIndex; rct_window *w; rct_widget *widget; rct_viewport *mainViewport; __asm mov widgetIndex, dx __asm mov w, esi __asm mov widget, edi if (widgetIndex == WIDX_FILE_MENU) { gDropdownItemsFormat[0] = 882; gDropdownItemsFormat[1] = 883; gDropdownItemsFormat[2] = 0; gDropdownItemsFormat[3] = 847; gDropdownItemsFormat[4] = 2327; gDropdownItemsFormat[5] = 891; gDropdownItemsFormat[6] = 0; gDropdownItemsFormat[7] = 886; window_dropdown_show_text( w->x + widget->left, w->y + widget->top, widget->bottom - widget->top + 1, w->colours[0] | 0x80, 0x80, 8 ); } else if (widgetIndex == WIDX_VIEW_MENU) { gDropdownItemsFormat[0] = 1156; gDropdownItemsFormat[1] = 1156; gDropdownItemsFormat[2] = 1156; gDropdownItemsFormat[3] = 0; gDropdownItemsFormat[4] = 1156; gDropdownItemsFormat[5] = 1156; gDropdownItemsFormat[6] = 1156; gDropdownItemsFormat[7] = 1156; gDropdownItemsFormat[8] = 0; gDropdownItemsFormat[9] = 1156; gDropdownItemsFormat[10] = 1156; gDropdownItemsFormat[11] = 1156; gDropdownItemsArgs[0] = 939; gDropdownItemsArgs[1] = 940; gDropdownItemsArgs[2] = 941; gDropdownItemsArgs[4] = 942; gDropdownItemsArgs[5] = 943; gDropdownItemsArgs[6] = 1051; gDropdownItemsArgs[7] = 1052; gDropdownItemsArgs[9] = 1154; gDropdownItemsArgs[10] = 1153; gDropdownItemsArgs[11] = 1155; window_dropdown_show_text( w->x + widget->left, w->y + widget->top, widget->bottom - widget->top + 1, w->colours[1] | 0x80, 0, 12 ); // Set checkmarks mainViewport = window_get_main()->viewport; if (mainViewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) gDropdownItemsChecked |= (1 << 0); if (mainViewport->flags & VIEWPORT_FLAG_HIDE_BASE) gDropdownItemsChecked |= (1 << 1); if (mainViewport->flags & VIEWPORT_FLAG_HIDE_VERTICAL) gDropdownItemsChecked |= (1 << 2); if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_RIDES) gDropdownItemsChecked |= (1 << 4); if (mainViewport->flags & VIEWPORT_FLAG_SEETHROUGH_SCENERY) gDropdownItemsChecked |= (1 << 5); if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) gDropdownItemsChecked |= (1 << 6); if (mainViewport->flags & VIEWPORT_FLAG_INVISIBLE_PEEPS) gDropdownItemsChecked |= (1 << 7); if (mainViewport->flags & VIEWPORT_FLAG_LAND_HEIGHTS) gDropdownItemsChecked |= (1 << 9); if (mainViewport->flags & VIEWPORT_FLAG_TRACK_HEIGHTS) gDropdownItemsChecked |= (1 << 10); if (mainViewport->flags & VIEWPORT_FLAG_PATH_HEIGHTS) gDropdownItemsChecked |= (1 << 11); } }
/** * * rct2: 0x0066C957 */ static void window_game_top_toolbar_mouseup() { short widgetIndex; rct_window *w, *mainWindow; __asm mov widgetIndex, dx __asm mov w, esi switch (widgetIndex) { case WIDX_PAUSE: game_do_command(0, 1, 0, 0, 2, 0, 0); break; case WIDX_FASTFORWARD: window_cheats_open(); break; case WIDX_ZOOM_OUT: if ((mainWindow = window_get_main()) != NULL) window_zoom_out(mainWindow); break; case WIDX_ZOOM_IN: if ((mainWindow = window_get_main()) != NULL) window_zoom_in(mainWindow); break; case WIDX_ROTATE: if ((mainWindow = window_get_main()) != NULL) window_rotate_camera(mainWindow); break; case WIDX_MAP: RCT2_CALLPROC_EBPSAFE(0x0068C88A); break; case WIDX_CLEAR_SCENERY: if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 16) { tool_cancel(); } else { show_gridlines(); tool_set(w, WIDX_CLEAR_SCENERY, 12); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6); RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 2; window_clear_scenery_open(); } break; case WIDX_LAND: if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 7) { tool_cancel(); } else { show_gridlines(); tool_set(w, WIDX_LAND, 18); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6); RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; window_land_open(); } break; case WIDX_WATER: if ((RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3)) && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, uint8) == 1 && RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16) == 8) { tool_cancel(); } else { show_gridlines(); tool_set(w, WIDX_WATER, 19); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6); RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) = 1; window_water_open(); } break; case WIDX_SCENERY: tool_set(w, WIDX_SCENERY, 0); RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6); RCT2_CALLPROC_EBPSAFE(0x006E0FEF); break; case WIDX_PATH: if (window_find_by_id(WC_FOOTPATH, 0) == NULL) { window_footpath_open(); } else { tool_cancel(); window_close_by_id(0x80 | WC_FOOTPATH, 0); } break; case WIDX_CONSTRUCT_RIDE: RCT2_CALLPROC_EBPSAFE(0x006B3CFF); break; case WIDX_RIDES: window_ride_list_open(); break; case WIDX_PARK: window_park_entrance_open(); break; case WIDX_STAFF: RCT2_CALLPROC_EBPSAFE(0x006BD3CC); break; case WIDX_GUESTS: RCT2_CALLPROC_EBPSAFE(0x006992E3); break; } }
void game_handle_key_scroll() { rct_window *mainWindow; sint32 scrollX, scrollY; mainWindow = window_get_main(); if (mainWindow == NULL) return; if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))) return; if (mainWindow->viewport == NULL) return; rct_window *textWindow; textWindow = window_find_by_class(WC_TEXTINPUT); if (textWindow || gUsingWidgetTextBox) return; if (gChatOpen) return; scrollX = 0; scrollY = 0; for (sint32 shortcutId = SHORTCUT_SCROLL_MAP_UP; shortcutId <= SHORTCUT_SCROLL_MAP_RIGHT; shortcutId++) { uint16 shortcutKey = gShortcutKeys[shortcutId]; uint8 scancode = shortcutKey & 0xFF; if (shortcutKey == 0xFFFF) continue; if (!gKeysState[scancode]) continue; if (shortcutKey & SHIFT) { if (!gKeysState[SDL_SCANCODE_LSHIFT] && !gKeysState[SDL_SCANCODE_RSHIFT]) continue; } if (shortcutKey & CTRL) { if (!gKeysState[SDL_SCANCODE_LCTRL] && !gKeysState[SDL_SCANCODE_RCTRL]) continue; } if (shortcutKey & ALT) { if (!gKeysState[SDL_SCANCODE_LALT] && !gKeysState[SDL_SCANCODE_RALT]) continue; } #ifdef __MACOSX__ if (shortcutKey & CMD) { if (!gKeysState[SDL_SCANCODE_LGUI] && !gKeysState[SDL_SCANCODE_RGUI]) continue; } #endif switch (shortcutId) { case SHORTCUT_SCROLL_MAP_UP: scrollY = -1; break; case SHORTCUT_SCROLL_MAP_LEFT: scrollX = -1; break; case SHORTCUT_SCROLL_MAP_DOWN: scrollY = 1; break; case SHORTCUT_SCROLL_MAP_RIGHT: scrollX = 1; break; } } // Scroll viewport if (scrollX != 0) { mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom); _inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING; } if (scrollY != 0) { mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom); _inputFlags |= INPUT_FLAG_VIEWPORT_SCROLLING; } }
/** * * 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);