mirror of https://github.com/OpenRCT2/OpenRCT2.git
Change ride->overallview to an rct_xy8
This commit is contained in:
parent
d5732fdf38
commit
ec55224f38
|
@ -215,12 +215,12 @@ void news_item_get_subject_location(sint32 type, sint32 subject, sint32 *x, sint
|
|||
switch (type) {
|
||||
case NEWS_ITEM_RIDE:
|
||||
ride = get_ride(subject);
|
||||
if (ride->overall_view == 0xFFFF) {
|
||||
if (ride->overall_view.xy == RCT_XY8_UNDEFINED) {
|
||||
*x = SPRITE_LOCATION_NULL;
|
||||
break;
|
||||
}
|
||||
*x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
*y = (ride->overall_view >> 8) * 32 + 16;
|
||||
*x = ride->overall_view.x * 32 + 16;
|
||||
*y = ride->overall_view.y * 32 + 16;
|
||||
*z = map_element_height(*x, *y);
|
||||
break;
|
||||
case NEWS_ITEM_PEEP_ON_RIDE:
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef struct rct1_ride {
|
|||
uint16 name; // 0x022
|
||||
uint16 name_argument_ride; // 0x024
|
||||
uint16 name_argument_number; // 0x026
|
||||
uint16 overall_view; // 0x028
|
||||
rct_xy8 overall_view; // 0x028
|
||||
uint16 station_starts[RCT12_MAX_STATIONS_PER_RIDE]; // 0x02A
|
||||
uint8 station_height[RCT12_MAX_STATIONS_PER_RIDE]; // 0x032
|
||||
uint8 station_length[RCT12_MAX_STATIONS_PER_RIDE]; // 0x036
|
||||
|
|
|
@ -3991,10 +3991,10 @@ static money32 ride_set_setting(uint8 rideIndex, uint8 setting, uint8 value, uin
|
|||
}
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.x = ride->overall_view.x * 32 + 16;
|
||||
coord.y = ride->overall_view.y * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
@ -5517,10 +5517,10 @@ void game_command_set_ride_status(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32
|
|||
}
|
||||
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.x = ride->overall_view.x * 32 + 16;
|
||||
coord.y = ride->overall_view.y * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
@ -5680,10 +5680,10 @@ void game_command_set_ride_name(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *e
|
|||
network_append_server_log(log_msg);
|
||||
}
|
||||
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.x = ride->overall_view.x * 32 + 16;
|
||||
coord.y = ride->overall_view.y * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
@ -6064,7 +6064,7 @@ foundRideEntry:
|
|||
ride->type = type;
|
||||
ride->subtype = rideEntryIndex;
|
||||
ride_set_colour_preset(ride, *outRideColour & 0xFF);
|
||||
ride->overall_view = 0xFFFF;
|
||||
ride->overall_view.xy = RCT_XY8_UNDEFINED;
|
||||
|
||||
// Ride name
|
||||
if (rideEntryIndex == RIDE_ENTRY_INDEX_NULL)
|
||||
|
@ -6469,9 +6469,9 @@ void game_command_demolish_ride(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *e
|
|||
return;
|
||||
}
|
||||
sint32 x = 0, y = 0, z = 0;
|
||||
if(ride->overall_view != (uint16)-1){
|
||||
x = ((ride->overall_view & 0xFF) * 32) + 16;
|
||||
y = ((ride->overall_view >> 8) * 32) + 16;
|
||||
if(ride->overall_view.xy != RCT_XY8_UNDEFINED){
|
||||
x = (ride->overall_view.x * 32) + 16;
|
||||
y = (ride->overall_view.y * 32) + 16;
|
||||
z = map_element_height(x, y);
|
||||
gCommandPosition.x = x;
|
||||
gCommandPosition.y = y;
|
||||
|
@ -6483,10 +6483,10 @@ void game_command_demolish_ride(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *e
|
|||
return;
|
||||
}else{
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.x = ride->overall_view.x * 32 + 16;
|
||||
coord.y = ride->overall_view.y * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
@ -6619,10 +6619,10 @@ void game_command_set_ride_appearance(sint32 *eax, sint32 *ebx, sint32 *ecx, sin
|
|||
}
|
||||
|
||||
if (apply && gGameCommandNestLevel == 1) {
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.x = ride->overall_view.x * 32 + 16;
|
||||
coord.y = ride->overall_view.y * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
@ -6763,10 +6763,10 @@ void game_command_set_ride_price(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *
|
|||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
uint32 shop_item;
|
||||
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.x = ride->overall_view.x * 32 + 16;
|
||||
coord.y = ride->overall_view.y * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
@ -7977,10 +7977,10 @@ static money32 ride_set_vehicles(uint8 rideIndex, uint8 setting, uint8 value, ui
|
|||
ride->num_circuits = 1;
|
||||
ride_update_max_vehicles(rideIndex);
|
||||
|
||||
if (ride->overall_view != (uint16)-1) {
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED) {
|
||||
rct_xyz16 coord;
|
||||
coord.x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
coord.y = (ride->overall_view >> 8) * 32 + 16;
|
||||
coord.x = ride->overall_view.x * 32 + 16;
|
||||
coord.y = ride->overall_view.y * 32 + 16;
|
||||
coord.z = map_element_height(coord.x, coord.y);
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ typedef struct rct_ride {
|
|||
uint16 name_arguments_number; // 0x04E
|
||||
};
|
||||
};
|
||||
uint16 overall_view; // 0x050, 00XX = X, XX00 = Y (* 32 + 16)
|
||||
rct_xy8 overall_view; // 0x050
|
||||
uint16 station_starts[RCT12_MAX_STATIONS_PER_RIDE]; // 0x052
|
||||
uint8 station_heights[RCT12_MAX_STATIONS_PER_RIDE]; // 0x05A
|
||||
uint8 station_length[RCT12_MAX_STATIONS_PER_RIDE]; // 0x05E
|
||||
|
|
|
@ -1317,7 +1317,7 @@ static money32 track_place(sint32 rideIndex, sint32 type, sint32 originX, sint32
|
|||
}
|
||||
|
||||
entranceDirections = 0;
|
||||
if (ride->overall_view != 0xFFFF){
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED){
|
||||
if (!(flags & GAME_COMMAND_FLAG_5)){
|
||||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) {
|
||||
entranceDirections = FlatRideTrackSequenceProperties[type][0];
|
||||
|
@ -1327,8 +1327,9 @@ static money32 track_place(sint32 rideIndex, sint32 type, sint32 originX, sint32
|
|||
}
|
||||
}
|
||||
}
|
||||
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN || ride->overall_view == 0xFFFF){
|
||||
ride->overall_view = (x >> 5) | (y << 3);
|
||||
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN || ride->overall_view.xy == RCT_XY8_UNDEFINED){
|
||||
ride->overall_view.x = x / 32;
|
||||
ride->overall_view.y = y / 32;
|
||||
}
|
||||
|
||||
mapElement = map_element_insert(x / 32, y / 32, baseZ, bl & 0xF);
|
||||
|
@ -1879,7 +1880,8 @@ static money32 set_maze_track(uint16 x, uint8 flags, uint8 direction, uint16 y,
|
|||
|
||||
if (direction == 4) {
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
ride->overall_view = (flooredX >> 5) | (flooredY << 3);
|
||||
ride->overall_view.x = flooredX / 32;
|
||||
ride->overall_view.y = flooredY / 32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1674,7 +1674,8 @@ static money32 place_maze_design(uint8 flags, uint8 rideIndex, uint16 mazeEntry,
|
|||
ride->station_heights[0] = mapElement->base_height;
|
||||
ride->station_starts[0] = 0;
|
||||
if (ride->maze_tiles == 1) {
|
||||
ride->overall_view = (fx >> 5) | ((fy >> 5) << 8);
|
||||
ride->overall_view.x = fx / 32;
|
||||
ride->overall_view.y = fy / 32;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -742,8 +742,8 @@ void window_guest_viewport_init(rct_window* w){
|
|||
}
|
||||
if (peep->x == SPRITE_LOCATION_NULL && final_check){
|
||||
rct_ride *ride = get_ride(peep->current_ride);
|
||||
sint32 x = (ride->overall_view & 0xFF) * 32 + 16;
|
||||
sint32 y = (ride->overall_view >> 8) * 32 + 16;
|
||||
sint32 x = ride->overall_view.x * 32 + 16;
|
||||
sint32 y = ride->overall_view.y * 32 + 16;
|
||||
sint32 height = map_element_height(x, y);
|
||||
height += 32;
|
||||
focus.coordinate.x = x;
|
||||
|
|
|
@ -180,7 +180,7 @@ static void window_maze_construction_close(rct_window *w)
|
|||
|
||||
uint8 rideIndex = _currentRideIndex;
|
||||
rct_ride* ride = get_ride(rideIndex);
|
||||
if (ride->overall_view == 0xFFFF) {
|
||||
if (ride->overall_view.xy == RCT_XY8_UNDEFINED) {
|
||||
sint32 savedPausedState = gGamePaused;
|
||||
gGamePaused = 0;
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED, 0, rideIndex, GAME_COMMAND_DEMOLISH_RIDE, 0, 0);
|
||||
|
|
|
@ -1862,7 +1862,7 @@ static void window_ride_init_viewport(rct_window *w)
|
|||
w->viewport_focus_coordinates.height = w->height;
|
||||
|
||||
//rct2: 0x006aec9c only used here so brought it into the function
|
||||
if (!w->viewport && ride->overall_view != 0xFFFF){
|
||||
if (!w->viewport && ride->overall_view.xy != RCT_XY8_UNDEFINED){
|
||||
rct_widget* view_widget = &w->widgets[WIDX_VIEWPORT];
|
||||
|
||||
sint32 x = view_widget->left + 1 + w->x;
|
||||
|
|
|
@ -522,12 +522,12 @@ extern "C"
|
|||
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_SHOP))
|
||||
continue;
|
||||
|
||||
uint16 xy = ride->overall_view;
|
||||
if (xy == 0xFFFF)
|
||||
rct_xy8 location = ride->overall_view;
|
||||
if (location.xy == RCT_XY8_UNDEFINED)
|
||||
continue;
|
||||
|
||||
sint32 rideX = (xy & 0xFF) * 32;
|
||||
sint32 rideY = (xy >> 8) * 32;
|
||||
sint32 rideX = location.x * 32;
|
||||
sint32 rideY = location.y * 32;
|
||||
sint32 distance = abs(x - rideX) + abs(y - rideY);
|
||||
if (distance < resultDistance)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue