From e7a0b31884c24bdf3266c21e6ffac5d37363c549 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Mon, 19 Jan 2015 17:24:39 +0000 Subject: [PATCH 1/4] Ride locate now uses standard scroll_to_viewport.Fix #705 --- src/interface/window.c | 2 +- src/windows/ride.c | 35 +---------------------------------- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/interface/window.c b/src/interface/window.c index 8ccfc70b82..37dbd98615 100644 --- a/src/interface/window.c +++ b/src/interface/window.c @@ -1007,7 +1007,7 @@ rct_window *window_get_main() /** * Based on - * rct2: 0x696ee9 & 0x66842F + * rct2: 0x696ee9 & 0x66842F & 0x006AF3B3 * */ void window_scroll_to_viewport(rct_window *w) diff --git a/src/windows/ride.c b/src/windows/ride.c index c8f1e1d09b..fdb82255de 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -1552,39 +1552,6 @@ static void window_ride_rename(rct_window *w) window_text_input_open(w, WIDX_RENAME, STR_RIDE_ATTRACTION_NAME, STR_ENTER_NEW_NAME_FOR_THIS_RIDE_ATTRACTION, ride->name, ride->name_arguments, 32); } -/** - * - * rct2: 0x006AF3B3 - */ -static void window_ride_locate(rct_window *w) -{ - rct_window *mainWindow; - int xy, x, y, z; - - if (w->viewport->width == 0) - return; - - xy = w->ride.var_482; - z = w->ride.var_486; - if (xy == -1) - return; - - if (xy & 0x80000000) { - rct_sprite *sprite = &g_sprite_list[xy & 0xFFFF]; - x = sprite->unknown.x; - y = sprite->unknown.y; - z = sprite->unknown.z; - } else { - x = (xy & ~0xC0000000) & 0xFFFF; - y = (xy & ~0xC0000000) >> 16; - z = z >> 16; - } - - mainWindow = window_get_main(); - if (mainWindow != NULL) - window_scroll_to_location(mainWindow, x, y, z); -} - /** * * rct2: 0x006AF17E @@ -1619,7 +1586,7 @@ static void window_ride_main_mouseup() window_ride_rename(w); break; case WIDX_LOCATE: - window_ride_locate(w); + window_scroll_to_viewport(w); break; case WIDX_DEMOLISH: window_ride_demolish_prompt_open(w->number); From e9005027a5e76844134024b4b336b02404153f59 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Mon, 19 Jan 2015 17:58:01 +0000 Subject: [PATCH 2/4] Fix #706 right click incorrectly using mouse x,y instead of tile --- src/interface/viewport_interaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/viewport_interaction.c b/src/interface/viewport_interaction.c index ad3b10d566..8e303509a7 100644 --- a/src/interface/viewport_interaction.c +++ b/src/interface/viewport_interaction.c @@ -205,7 +205,7 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info } else if (mapElement->properties.track.type == 1 || mapElement->properties.track.type == 2 || mapElement->properties.track.type == 3) { RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = 1333; } else { - if (!map_is_location_owned(x, y, mapElement->base_height << 4)) + if (!map_is_location_owned(info->x, info->y, mapElement->base_height << 4)) return info->type = VIEWPORT_INTERACTION_ITEM_NONE; RCT2_GLOBAL(RCT2_ADDRESS_MAP_TOOLTIP_ARGS + 2, uint16) = ride->name; From 4e917de6cc731882fa1f2737d84b26674cb691b1 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Mon, 19 Jan 2015 18:13:25 +0000 Subject: [PATCH 3/4] Fix height markers. --- src/config.c | 3 +++ src/windows/options.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 5dd2b18a75..3a451e6e01 100644 --- a/src/config.c +++ b/src/config.c @@ -275,6 +275,9 @@ void config_apply_to_old_addresses() RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CONSTRUCTION_MARKER, uint8) = gGeneral_config.construction_marker_colour; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = gSound_config.sound_quality; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, sint8) = gSound_config.forced_software_buffering; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (gGeneral_config.measurement_format + 1) * 256; + if (gGeneral_config.show_height_as_units) + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0; int configFlags = 0; if (gGeneral_config.always_show_gridlines) diff --git a/src/windows/options.c b/src/windows/options.c index 33a926693c..216f3899b0 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -791,7 +791,7 @@ static void window_options_show_dropdown(rct_window *w, rct_widget *widget, int static void window_options_update_height_markers() { RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, uint16) = gGeneral_config.show_height_as_units ? - 0 : (gGeneral_config.show_height_as_units + 1) * 256; + 0 : (gGeneral_config.measurement_format + 1) * 256; config_save(); gfx_invalidate_screen(); } From c118b774779400f2957f0d445cfa531eef2a8188 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Mon, 19 Jan 2015 18:52:25 +0000 Subject: [PATCH 4/4] Add notes about obsolete addresses --- src/addresses.h | 2 ++ src/config.c | 13 +++++++------ src/object_list.c | 6 ++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/addresses.h b/src/addresses.h index 921c3d423f..23c3b00716 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -494,6 +494,8 @@ #define RCT2_ADDRESS_X_END_POINT_GLOBAL 0x9ABDA8 //sint16 #define RCT2_ADDRESS_X_START_POINT_GLOBAL 0xEDF80C //sint16 #define RCT2_ADDRESS_DPI_LINE_LENGTH_GLOBAL 0x9ABDB0 //uint16 width+pitch +#define RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS 0x009AA00D +#define RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG 0x009AB4C6 #pragma endregion diff --git a/src/config.c b/src/config.c index 3a451e6e01..52fba7185f 100644 --- a/src/config.c +++ b/src/config.c @@ -838,28 +838,29 @@ void config_dat_load() // return; - RCT2_GLOBAL(0x009AB4C6, sint8) = 1; // no idea on what this does + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG, sint8) = 1; // Marks config as first time loaded RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 2) * 256; if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; - RCT2_GLOBAL(0x009AA00D, sint8) = 0; + // No longer used (controls first time object load) + //RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, sint8) = 0; } } /* TODO: CLEANUP - if (RCT2_GLOBAL(0x009AB4C6, sint8) == 1) + if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG, sint8) == 1) return; - RCT2_GLOBAL(0x009AB4C6, sint8) = 1; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_CONFIG, sint8) = 1; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) = 0; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_TEMPERATURE, sint8) = 1; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_CURRENCY, sint8) = 1; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0; if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; - RCT2_GLOBAL(0x009AA00D, sint8) = 1; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, sint8) = 1; } } @@ -878,7 +879,7 @@ void config_dat_load() RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = 0; if (!(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS)) RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_HEIGHT_MARKERS, sint16) = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, sint8) + 1) * 256; - RCT2_GLOBAL(0x009AA00D, sint8) = 1; + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, sint8) = 1; } /** diff --git a/src/object_list.c b/src/object_list.c index 09cb0bcf1f..2edf1c88fa 100644 --- a/src/object_list.c +++ b/src/object_list.c @@ -194,8 +194,10 @@ void object_list_load() // Reload object list - if (RCT2_GLOBAL(0x9AA00D, uint8) != 0) - RCT2_GLOBAL(0x9AA00D, uint8) = 0; + // RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS used to control if this was the first time loading objects + // and display the starting RCT2 for the first time message. + //if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, uint8) != 0) + // RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FIRST_TIME_LOAD_OBJECTS, uint8) = 0; sub_6A9FC0();