Move various to use CoordsXYZ funcs instead of LocationXYZ

This commit is contained in:
duncanspumpkin 2019-08-18 08:32:20 +01:00
parent 6da5eb9d30
commit 37ef48890f
3 changed files with 13 additions and 12 deletions

View File

@ -187,14 +187,14 @@ void lightfx_prepare_light_list()
continue;
}
LocationXYZ16 coord_3d = { /* .x = */ entry->x,
/* .y = */ entry->y,
/* .z = */ entry->z };
CoordsXYZ coord_3d = { /* .x = */ entry->x,
/* .y = */ entry->y,
/* .z = */ entry->z };
LocationXY16 coord_2d = coordinate_3d_to_2d(&coord_3d, _current_view_rotation_front);
auto screenCoords = translate_3d_to_2d_with_z(_current_view_rotation_front, coord_3d);
entry->x = coord_2d.x; // - (_current_view_x_front);
entry->y = coord_2d.y; // - (_current_view_y_front);
entry->x = screenCoords.x; // - (_current_view_x_front);
entry->y = screenCoords.y; // - (_current_view_y_front);
int32_t posOnScreenX = entry->x - _current_view_x_front;
int32_t posOnScreenY = entry->y - _current_view_y_front;

View File

@ -95,6 +95,7 @@ void viewport_init_all()
textinput_cancel();
}
// TODO: Return ScreenCoords, takein CoordsXYZ
/**
* Converts between 3d point of a sprite to 2d coordinates for centring on that
* sprite
@ -109,9 +110,9 @@ void centre_2d_coordinates(int32_t x, int32_t y, int32_t z, int32_t* out_x, int3
{
int32_t start_x = x;
LocationXYZ16 coord_3d = { (int16_t)x, (int16_t)y, (int16_t)z };
CoordsXYZ coord_3d = { x, y, z };
LocationXY16 coord_2d = coordinate_3d_to_2d(&coord_3d, get_current_rotation());
auto coord_2d = translate_3d_to_2d_with_z(get_current_rotation(), coord_3d);
// If the start location was invalid
// propagate the invalid location to the output.

View File

@ -808,7 +808,7 @@ rct_window* window_get_main()
*/
void window_scroll_to_location(rct_window* w, int32_t x, int32_t y, int32_t z)
{
LocationXYZ16 location_3d = { (int16_t)x, (int16_t)y, (int16_t)z };
CoordsXYZ location_3d = { x, y, z };
assert(w != nullptr);
@ -834,7 +834,7 @@ void window_scroll_to_location(rct_window* w, int32_t x, int32_t y, int32_t z)
}
}
LocationXY16 map_coordinate = coordinate_3d_to_2d(&location_3d, get_current_rotation());
auto screenCoords = translate_3d_to_2d_with_z(get_current_rotation(), location_3d);
int32_t i = 0;
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
@ -878,8 +878,8 @@ void window_scroll_to_location(rct_window* w, int32_t x, int32_t y, int32_t z)
{
if (!(w->flags & WF_NO_SCROLLING))
{
w->saved_view_x = map_coordinate.x - (int16_t)(w->viewport->view_width * window_scroll_locations[i][0]);
w->saved_view_y = map_coordinate.y - (int16_t)(w->viewport->view_height * window_scroll_locations[i][1]);
w->saved_view_x = screenCoords.x - (int16_t)(w->viewport->view_width * window_scroll_locations[i][0]);
w->saved_view_y = screenCoords.y - (int16_t)(w->viewport->view_height * window_scroll_locations[i][1]);
w->flags |= WF_SCROLLING_TO_LOCATION;
}
}