mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-11 10:02:27 +01:00
Merge pull request #709 from duncanspumpkin/fix_ride_locate
Fix ride bugs and height markers
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
16
src/config.c
16
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)
|
||||
@@ -835,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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -875,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user