mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Merge branch 'master' of https://github.com/IntelOrca/OpenRCT2
This commit is contained in:
@@ -84,6 +84,7 @@
|
||||
<ClCompile Include="..\src\widget.c" />
|
||||
<ClCompile Include="..\src\window.c" />
|
||||
<ClCompile Include="..\src\window_about.c" />
|
||||
<ClCompile Include="..\src\window_banner.c" />
|
||||
<ClCompile Include="..\src\window_cheats.c" />
|
||||
<ClCompile Include="..\src\window_clear_scenery.c" />
|
||||
<ClCompile Include="..\src\window_error.c" />
|
||||
@@ -95,7 +96,7 @@
|
||||
<ClCompile Include="..\src\window_park.c" />
|
||||
<ClCompile Include="..\src\window_finances.c" />
|
||||
<ClCompile Include="..\src\window_footpath.c" />
|
||||
<ClCompile Include="..\src\window_ride_construction.c" />
|
||||
<ClCompile Include="..\src\window_new_ride.c" />
|
||||
<ClCompile Include="..\src\window_ride_list.c" />
|
||||
<ClCompile Include="..\src\window_save_prompt.c" />
|
||||
<ClCompile Include="..\src\window_staff.c" />
|
||||
|
||||
@@ -281,15 +281,18 @@
|
||||
<ClCompile Include="..\src\finance.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_ride_construction.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_finances.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_staff.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_banner.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_new_ride.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\openrct2.exe">
|
||||
|
||||
@@ -208,8 +208,6 @@
|
||||
#define RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID 0x0141E9AE
|
||||
#define RCT2_ADDRESS_CURRENT_ROTATION 0x0141E9E0
|
||||
|
||||
#define RCT2_ADDRESS_SCENARIO_NAME 0x0141F5B8
|
||||
|
||||
#define RCT2_ADDRESS_WATER_RAISE_COST 0x0141F738
|
||||
#define RCT2_ADDRESS_WATER_LOWER_COST 0x0141F73C
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ void editor_load()
|
||||
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_ride_construction_init_vars();
|
||||
window_new_ride_init_vars();
|
||||
RCT2_GLOBAL(0x0141F571, uint8) = 4;
|
||||
viewport_init_all();
|
||||
news_item_init_queue();
|
||||
@@ -110,7 +110,7 @@ void trackdesigner_load()
|
||||
window_staff_init_vars();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_DESIGNER;
|
||||
RCT2_GLOBAL(0x0141F570, uint8) = 0;
|
||||
window_ride_construction_init_vars();
|
||||
window_new_ride_init_vars();
|
||||
viewport_init_all();
|
||||
news_item_init_queue();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create
|
||||
@@ -148,7 +148,7 @@ void trackmanager_load()
|
||||
window_staff_init_vars();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_MANAGER;
|
||||
RCT2_GLOBAL(0x0141F570, uint8) = 0;
|
||||
window_ride_construction_init_vars();
|
||||
window_new_ride_init_vars();
|
||||
viewport_init_all();
|
||||
news_item_init_queue();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create
|
||||
|
||||
230
src/game.c
230
src/game.c
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014 Ted John
|
||||
* Copyright (c) 2014 Ted John, Peter Hill
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* This file is part of OpenRCT2.
|
||||
@@ -866,6 +866,228 @@ int get_next_key()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handle_shortcut_command(int shortcutIndex)
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
switch (shortcutIndex) {
|
||||
case SHORTCUT_CLOSE_TOP_MOST_WINDOW:
|
||||
window_close_top();
|
||||
break;
|
||||
case SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2))
|
||||
window_close_all();
|
||||
else if (RCT2_ADDRESS(0x0141F570, uint8) == 1)
|
||||
window_close_top();
|
||||
break;
|
||||
case SHORTCUT_CANCEL_CONSTRUCTION_MODE:
|
||||
window = window_find_by_id(WC_ERROR, 0);
|
||||
if (window != NULL)
|
||||
window_close(window);
|
||||
else if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
|
||||
tool_cancel();
|
||||
break;
|
||||
case SHORTCUT_PAUSE_GAME:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 10)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 0, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_ZOOM_VIEW_OUT:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 2, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_ZOOM_VIEW_IN:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 3, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_ROTATE_VIEW:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 4, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_ROTATE_CONSTRUCTION_OBJECT:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006E4182);
|
||||
break;
|
||||
case SHORTCUT_UNDERGROUND_VIEW_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 0, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_REMOVE_BASE_LAND_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 1, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 2, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_SEE_THROUGH_RIDES_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 4, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 5, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 6, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_INVISIBLE_PEOPLE_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 7, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 9, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 10, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE:
|
||||
RCT2_CALLPROC_X(0x0066CF8A, 11, 0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SHORTCUT_ADJUST_LAND:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 7, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_ADJUST_WATER:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 8, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_BUILD_SCENERY:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 9, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_BUILD_PATHS:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 10, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_BUILD_NEW_RIDE:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 11, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_SHOW_FINANCIAL_INFORMATION:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C))
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800))
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069DDF1);
|
||||
break;
|
||||
case SHORTCUT_SHOW_RESEARCH_INFORMATION:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
// Open new ride window
|
||||
RCT2_CALLPROC_EBPSAFE(0x006B3CFF);
|
||||
window = window_find_by_id(WC_CONSTRUCT_RIDE, 0);
|
||||
if (window != NULL)
|
||||
window_event_helper(window, 10, WE_MOUSE_DOWN);
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_SHOW_RIDES_LIST:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 12, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_SHOW_PARK_INFORMATION:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 13, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_SHOW_GUEST_LIST:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 15, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_SHOW_STAFF_LIST:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 14, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_SHOW_RECENT_MESSAGES:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E))
|
||||
window_news_open();
|
||||
break;
|
||||
case SHORTCUT_SHOW_MAP:
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
|
||||
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
|
||||
if (window != NULL) {
|
||||
window_invalidate(window);
|
||||
window_event_helper(window, 6, WE_MOUSE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHORTCUT_SCREENSHOT:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006E4034); // set screenshot countdown to 2
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E3E68
|
||||
@@ -873,9 +1095,9 @@ int get_next_key()
|
||||
void handle_shortcut(int key)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 32; i++) {
|
||||
for (i = 0; i < SHORTCUT_COUNT; i++) {
|
||||
if (key == gShortcutKeys[i]) {
|
||||
RCT2_CALLPROC_EBPSAFE(RCT2_ADDRESS(0x006E3FB4, uint32)[i]);
|
||||
handle_shortcut_command(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1298,7 +1520,7 @@ int game_load_save()
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
window_ride_construction_init_vars();
|
||||
window_new_ride_init_vars();
|
||||
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
|
||||
if (RCT2_GLOBAL(0x0013587C4, uint32) == 0) // this check is not in scenario play
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069E869);
|
||||
|
||||
@@ -135,7 +135,7 @@ void rct2_init()
|
||||
date_reset();
|
||||
climate_reset(CLIMATE_COOL_AND_WET);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
window_ride_construction_init_vars();
|
||||
window_new_ride_init_vars();
|
||||
window_guest_list_init_vars_b();
|
||||
window_staff_init_vars();
|
||||
|
||||
|
||||
17
src/ride.c
17
src/ride.c
@@ -150,3 +150,20 @@ void ride_init_all()
|
||||
ride_measurement->var_00 = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B7A38
|
||||
*/
|
||||
void reset_all_ride_build_dates() {
|
||||
int i;
|
||||
rct_ride *ride;
|
||||
for (i = 0; i < MAX_RIDES; i++) {
|
||||
ride = GET_RIDE(i);
|
||||
if (ride->type != RIDE_TYPE_NULL) {
|
||||
//mov ax, current_month_year
|
||||
//sub [esi + 180h], ax
|
||||
ride->build_date -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,9 @@ typedef struct {
|
||||
uint8 var_14D;
|
||||
uint8 pad_14E[0x0A];
|
||||
uint16 var_158;
|
||||
uint8 pad_15A[0x3C];
|
||||
uint8 pad_15A[0x26];
|
||||
uint16 build_date;
|
||||
uint8 pad_182[0x14];
|
||||
uint16 var_196;
|
||||
uint8 pad_198;
|
||||
uint8 var_199;
|
||||
@@ -257,5 +259,6 @@ int ride_get_count();
|
||||
int ride_get_total_queue_length(rct_ride *ride);
|
||||
int ride_get_max_queue_time(rct_ride *ride);
|
||||
void ride_init_all();
|
||||
void reset_all_ride_build_dates();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -450,7 +450,7 @@ void scenario_load_and_play(rct_scenario_basic *scenario)
|
||||
window_invalidate(mainWindow);
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
window_ride_construction_init_vars();
|
||||
window_new_ride_init_vars();
|
||||
|
||||
RCT2_GLOBAL(0x00F663B0, sint32) = RCT2_GLOBAL(0x009AA0F0, sint32);
|
||||
RCT2_GLOBAL(0x00F663B4, sint32) = RCT2_GLOBAL(0x009AA0F4, sint32);
|
||||
@@ -513,7 +513,7 @@ void scenario_load_and_play(rct_scenario_basic *scenario)
|
||||
RCT2_GLOBAL(0x013587D8, uint16) = 63;
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069E869); // (loan related, called above already)
|
||||
RCT2_CALLPROC_EBPSAFE(0x0066729F); // reset history / finance / awards
|
||||
RCT2_CALLPROC_EBPSAFE(0x006B7A38); // reset_all_ride_build_dates
|
||||
reset_all_ride_build_dates();
|
||||
date_reset();
|
||||
RCT2_CALLPROC_EBPSAFE(0x00674576);
|
||||
park_calculate_size();
|
||||
|
||||
@@ -103,7 +103,7 @@ void title_load()
|
||||
date_reset();
|
||||
RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
window_ride_construction_init_vars();
|
||||
window_new_ride_init_vars();
|
||||
window_guest_list_init_vars_b();
|
||||
window_staff_init_vars();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
|
||||
@@ -191,7 +191,7 @@ static void title_update_showcase()
|
||||
|
||||
window_invalidate(w);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
window_ride_construction_init_vars();
|
||||
window_new_ride_init_vars();
|
||||
RCT2_CALLPROC_EBPSAFE(0x00684AC3);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
news_item_init_queue();
|
||||
|
||||
54
src/window.c
54
src/window.c
@@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014 Ted John
|
||||
* Copyright (c) 2014 Ted John, Peter Hill
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* This file is part of OpenRCT2.
|
||||
@@ -493,6 +493,47 @@ rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the top-most window
|
||||
*
|
||||
* rct2: 0x006E403C
|
||||
*/
|
||||
void window_close_top() {
|
||||
rct_window* w;
|
||||
|
||||
window_close_by_id(WC_DROPDOWN, 0);
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) {
|
||||
if (RCT2_ADDRESS(0x0141F570, uint8) != 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_LAST_WINDOW; w++){
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) {
|
||||
window_close(w);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all open windows
|
||||
*
|
||||
* rct2: 0x006EE927
|
||||
*/
|
||||
void window_close_all() {
|
||||
rct_window* w;
|
||||
|
||||
window_close_by_id(WC_DROPDOWN, 0);
|
||||
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_LAST_WINDOW; w++){
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) {
|
||||
window_close(w);
|
||||
w = RCT2_FIRST_WINDOW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006EA845
|
||||
@@ -1203,4 +1244,13 @@ void window_guest_list_init_vars_b() {
|
||||
RCT2_GLOBAL(0x00F1EE02, uint32) = 0xFFFFFFFF;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF;
|
||||
RCT2_GLOBAL(0x00F1AF20, uint16) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for window events so C functions can call them
|
||||
*/
|
||||
void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event) {
|
||||
|
||||
RCT2_CALLPROC_X(w->event_handlers[event], 0, 0, 0, widgetIndex, w, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
@@ -275,6 +275,7 @@ enum {
|
||||
WC_CHANGE_KEYBOARD_SHORTCUT = 37,
|
||||
WC_MAP = 38,
|
||||
WC_TITLE_LOGO = 39,
|
||||
WC_BANNER = 40,
|
||||
WC_EDITOR_OBJECT_SELECTION = 42,
|
||||
WC_EDITOR_INVENTION_LIST = 43,
|
||||
WC_EDITOR_SCENARIO_OPTIONS = 45,
|
||||
@@ -291,6 +292,8 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han
|
||||
rct_window *window_create_auto_pos(int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
void window_close(rct_window *window);
|
||||
void window_close_by_id(rct_windowclass cls, rct_windownumber number);
|
||||
void window_close_top();
|
||||
void window_close_all();
|
||||
rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number);
|
||||
rct_window *window_find_from_point(int x, int y);
|
||||
int window_find_widget_from_point(rct_window *w, int x, int y);
|
||||
@@ -349,13 +352,16 @@ void window_park_guests_open();
|
||||
void window_park_objective_open();
|
||||
void window_park_rating_open();
|
||||
void window_ride_list_open();
|
||||
void window_banner_open();
|
||||
void window_cheats_open();
|
||||
|
||||
void window_guest_list_init_vars_a();
|
||||
void window_guest_list_init_vars_b();
|
||||
|
||||
void window_ride_construction_init_vars();
|
||||
void window_new_ride_init_vars();
|
||||
|
||||
void window_staff_init_vars();
|
||||
|
||||
void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event);
|
||||
|
||||
#endif
|
||||
|
||||
234
src/window_banner.c
Normal file
234
src/window_banner.c
Normal file
@@ -0,0 +1,234 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014 Ted John, Dennis Devriendt
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* This file is part of OpenRCT2.
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "addresses.h"
|
||||
#include "config.h"
|
||||
#include "strings.h"
|
||||
#include "viewport.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
|
||||
static enum WINDOW_CLEAR_SCENERY_WIDGET_IDX {
|
||||
WIDX_BACKGROUND,
|
||||
WIDX_TITLE,
|
||||
WIDX_CLOSE,
|
||||
WIDX_VIEWPORT,
|
||||
WIDX_BANNER_TEXT,
|
||||
WIDX_BANNER_NO_ENTRY,
|
||||
WIDX_BANNER_DEMOLISH,
|
||||
WIDX_MAIN_COLOR,
|
||||
WIDX_TEXT_COLOR_DROPDOWN,
|
||||
WIDX_TEXT_COLOR_DROPDOWN_BUTTON
|
||||
};
|
||||
|
||||
static rct_widget window_banner_widgets[] = {
|
||||
{ WWT_FRAME, 0, 0, 112, 0, 95, 0x0FFFFFFFF, 65535}, // panel / background
|
||||
{ WWT_CAPTION, 0, 1, 111, 1, 14, 0xBA9, STR_WINDOW_TITLE_TIP}, // title bar
|
||||
{ WWT_CLOSEBOX, 0, 100, 110, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP}, // close x button
|
||||
{ WWT_VIEWPORT, 1, 3, 87, 17, 76, 0x0FFFFFFFE, 65535}, // tab content panel
|
||||
{ WWT_FLATBTN, 1, 88, 111, 19, 42, 0x1430, STR_CHANGE_BANNER_TEXT_TIP}, // change banner button
|
||||
{ WWT_FLATBTN, 1, 88, 111, 43, 66, 0x143A, STR_SET_AS_NO_ENTRY_BANNER_TIP}, // no entry button
|
||||
{ WWT_FLATBTN, 1, 88, 111, 67, 90, 0x142D, STR_DEMOLISH_BANNER_TIP}, // demolish button
|
||||
{ WWT_COLORBTN, 1, 5, 16, 80, 91, 0x0FFFFFFFF, STR_SELECT_MAIN_COLOR_TIP}, // high money
|
||||
{ WWT_DROPDOWN, 1, 43, 81, 80, 91, 0x0FFFFFFFF, 65535}, // high money
|
||||
{ WWT_DROPDOWN_BUTTON, 1, 70, 80, 81, 90, 0x36C, STR_SELECT_TEXT_COLOR_TIP}, // high money
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
static void window_banner_emptysub() { }
|
||||
static void window_banner_mouseup();
|
||||
static void window_banner_mousedown();
|
||||
static void window_banner_dropdown();
|
||||
static void window_banner_textinput();
|
||||
static void window_banner_invalidate();
|
||||
static void window_banner_paint();
|
||||
|
||||
static uint32 window_banner_events[] = {
|
||||
window_banner_emptysub,
|
||||
window_banner_mouseup,
|
||||
window_banner_emptysub,
|
||||
window_banner_mousedown,
|
||||
window_banner_dropdown,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_textinput,
|
||||
0x006BA7B5,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_emptysub,
|
||||
window_banner_invalidate,
|
||||
window_banner_paint,
|
||||
window_banner_emptysub
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006BA305
|
||||
*/
|
||||
void window_banner_open()
|
||||
{
|
||||
rct_windownumber windownumber;
|
||||
rct_window* w;
|
||||
rct_viewport *viewport;
|
||||
rct_widget *viewportWidget;
|
||||
|
||||
//__asm mov windownumber, ax // not quite right I think
|
||||
windownumber = 0;
|
||||
|
||||
// Check if window is already open
|
||||
w = window_bring_to_front_by_id(WC_BANNER, windownumber);
|
||||
if (w != NULL)
|
||||
return;
|
||||
|
||||
w = window_create_auto_pos(113, 96, window_banner_events, WC_BANNER, 0);
|
||||
w->widgets = window_banner_widgets;
|
||||
w->enabled_widgets =
|
||||
(1 << WIDX_CLOSE) |
|
||||
(1 << WIDX_BANNER_TEXT) |
|
||||
(1 << WIDX_BANNER_NO_ENTRY) |
|
||||
(1 << WIDX_BANNER_DEMOLISH) |
|
||||
(1 << WIDX_MAIN_COLOR) |
|
||||
(1 << WIDX_TEXT_COLOR_DROPDOWN) |
|
||||
(1 << WIDX_TEXT_COLOR_DROPDOWN_BUTTON);
|
||||
|
||||
w->number = windownumber;
|
||||
window_init_scroll_widgets(w);
|
||||
w->colours[0] = 24;
|
||||
w->colours[1] = 24;
|
||||
w->colours[2] = 24;
|
||||
|
||||
/*
|
||||
TODO: MISSING CODE 006BA377 -> 006BA3F6, need the banner map element
|
||||
*/
|
||||
|
||||
// Create viewport
|
||||
viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
|
||||
viewport_create(
|
||||
w,
|
||||
w->x + viewportWidget->left + 1,
|
||||
w->y + viewportWidget->top + 1,
|
||||
(viewportWidget->right - viewportWidget->left) - 2,
|
||||
(viewportWidget->bottom - viewportWidget->top) - 2,
|
||||
100, // TODO: needs banner map position
|
||||
100 // TODO: needs banner map position
|
||||
);
|
||||
|
||||
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
|
||||
w->flags |= WF_2 | WF_TRANSPARENT;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
static void window_banner_mouseup()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window *w;
|
||||
|
||||
__asm mov widgetIndex, dx
|
||||
__asm mov w, esi
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_CLOSE:
|
||||
window_close(w);
|
||||
break;
|
||||
case WIDX_BANNER_DEMOLISH:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA739);
|
||||
break;
|
||||
case WIDX_BANNER_TEXT:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA6BC);
|
||||
break;
|
||||
case WIDX_BANNER_NO_ENTRY:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA64D);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void window_banner_mousedown()
|
||||
{
|
||||
short widgetIndex;
|
||||
|
||||
__asm mov widgetIndex, dx
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_MAIN_COLOR:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA528);
|
||||
break;
|
||||
case WIDX_TEXT_COLOR_DROPDOWN_BUTTON:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA563);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void window_banner_dropdown()
|
||||
{
|
||||
short widgetIndex;
|
||||
|
||||
__asm mov widgetIndex, dx;
|
||||
|
||||
if (widgetIndex == WIDX_MAIN_COLOR)
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA548);
|
||||
else if (widgetIndex == WIDX_TEXT_COLOR_DROPDOWN_BUTTON)
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA5D0);
|
||||
}
|
||||
|
||||
static void window_banner_textinput()
|
||||
{
|
||||
short widgetIndex;
|
||||
|
||||
__asm mov widgetIndex, dx;
|
||||
|
||||
if (widgetIndex == WIDX_BANNER_TEXT) {
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA6D8);
|
||||
}
|
||||
}
|
||||
|
||||
static void window_banner_invalidate()
|
||||
{
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BA44D);
|
||||
}
|
||||
|
||||
static void window_banner_paint()
|
||||
{
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
|
||||
__asm mov w, esi
|
||||
__asm mov dpi, edi
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
|
||||
// Draw viewport
|
||||
if (w->viewport != NULL) {
|
||||
window_draw_viewport(dpi, w);
|
||||
}
|
||||
}
|
||||
@@ -208,9 +208,10 @@ static void window_game_top_toolbar_mouseup()
|
||||
}
|
||||
break;
|
||||
case WIDX_SCENERY:
|
||||
tool_set(w, WIDX_SCENERY, 0);
|
||||
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
|
||||
if (!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) {
|
||||
|
||||
@@ -142,7 +142,7 @@ void window_guest_list_open()
|
||||
rct_window* window;
|
||||
|
||||
// Check if window is already open
|
||||
window = window_bring_to_front_by_id(WC_RIDE_LIST, 0);
|
||||
window = window_bring_to_front_by_id(WC_GUEST_LIST, 0);
|
||||
if (window != NULL)
|
||||
return;
|
||||
|
||||
@@ -161,7 +161,7 @@ void window_guest_list_open()
|
||||
window_init_scroll_widgets(window);
|
||||
_window_guest_list_highlighted_index = -1;
|
||||
window->var_490 = 0;
|
||||
_window_guest_list_selected_tab = 1;
|
||||
_window_guest_list_selected_tab = PAGE_INDIVIDUAL;
|
||||
_window_guest_list_selected_filter = -1;
|
||||
_window_guest_list_selected_page = 0;
|
||||
_window_guest_list_num_pages = 1;
|
||||
@@ -994,4 +994,4 @@ static int get_guest_face_sprite_large(rct_peep* peep){
|
||||
}
|
||||
|
||||
return sprite;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,26 +24,26 @@
|
||||
#include "window.h"
|
||||
|
||||
enum {
|
||||
WINDOW_RIDE_CONSTRUCTION_TAB_TRANSPORT,
|
||||
WINDOW_RIDE_CONSTRUCTION_TAB_GENTLE,
|
||||
WINDOW_RIDE_CONSTRUCTION_TAB_ROLLER_COASTER,
|
||||
WINDOW_RIDE_CONSTRUCTION_TAB_THRILL,
|
||||
WINDOW_RIDE_CONSTRUCTION_TAB_WATER,
|
||||
WINDOW_RIDE_CONSTRUCTION_TAB_SHOP,
|
||||
WINDOW_RIDE_CONSTRUCTION_TAB_RESEARCH
|
||||
WINDOW_NEW_RIDE_TAB_TRANSPORT,
|
||||
WINDOW_NEW_RIDE_TAB_GENTLE,
|
||||
WINDOW_NEW_RIDE_TAB_ROLLER_COASTER,
|
||||
WINDOW_NEW_RIDE_TAB_THRILL,
|
||||
WINDOW_NEW_RIDE_TAB_WATER,
|
||||
WINDOW_NEW_RIDE_TAB_SHOP,
|
||||
WINDOW_NEW_RIDE_TAB_RESEARCH
|
||||
} WINDOW_RIDE_CONSTRUCTION_TAB;
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ACA58
|
||||
*/
|
||||
void window_ride_construction_init_vars() {
|
||||
void window_new_ride_init_vars() {
|
||||
// If we are in the track designer, default to the Roller Coaster tab
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_RIDE_CONSTRUCTION_TAB_ROLLER_COASTER;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_NEW_RIDE_TAB_ROLLER_COASTER;
|
||||
}
|
||||
else {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_RIDE_CONSTRUCTION_TAB_TRANSPORT;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_NEW_RIDE_TAB_TRANSPORT;
|
||||
}
|
||||
|
||||
for (short i = 0; i < 6; i++) {
|
||||
Reference in New Issue
Block a user