mirror of https://github.com/OpenRCT2/OpenRCT2.git
Split off ride_get_rotated_coords()
This commit is contained in:
parent
c77c15e4de
commit
887ec16b53
|
@ -3494,27 +3494,7 @@ sint32 ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, u
|
|||
{
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gGameSoundsOff && g_music_tracking_viewport != NULL)
|
||||
{
|
||||
LocationXY16 rotatedCoords = {0, 0};
|
||||
|
||||
switch (get_current_rotation())
|
||||
{
|
||||
case 0:
|
||||
rotatedCoords.x = y - x;
|
||||
rotatedCoords.y = ((y + x) / 2) - z;
|
||||
break;
|
||||
case 1:
|
||||
rotatedCoords.x = -x - y;
|
||||
rotatedCoords.y = ((y - x) / 2) - z;
|
||||
break;
|
||||
case 2:
|
||||
rotatedCoords.x = x - y;
|
||||
rotatedCoords.y = ((-y - x) / 2) - z;
|
||||
break;
|
||||
case 3:
|
||||
rotatedCoords.x = y + x;
|
||||
rotatedCoords.y = ((x - y) / 2) - z;
|
||||
break;
|
||||
}
|
||||
const LocationXY16 rotatedCoords = ride_get_rotated_coords(x, y, z);
|
||||
rct_viewport * viewport = g_music_tracking_viewport;
|
||||
sint16 view_width = viewport->view_width;
|
||||
sint16 view_width2 = view_width * 2;
|
||||
|
@ -8219,3 +8199,30 @@ sint32 ride_get_entry_index(sint32 rideType, sint32 rideSubType)
|
|||
|
||||
return subType;
|
||||
}
|
||||
|
||||
LocationXY16 ride_get_rotated_coords(sint16 x, sint16 y, sint16 z)
|
||||
{
|
||||
LocationXY16 rotatedCoords = { 0, 0 };
|
||||
|
||||
switch (get_current_rotation())
|
||||
{
|
||||
case 0:
|
||||
rotatedCoords.x = y - x;
|
||||
rotatedCoords.y = ((y + x) / 2) - z;
|
||||
break;
|
||||
case 1:
|
||||
rotatedCoords.x = -x - y;
|
||||
rotatedCoords.y = ((y - x) / 2) - z;
|
||||
break;
|
||||
case 2:
|
||||
rotatedCoords.x = x - y;
|
||||
rotatedCoords.y = ((-y - x) / 2) - z;
|
||||
break;
|
||||
case 3:
|
||||
rotatedCoords.x = y + x;
|
||||
rotatedCoords.y = ((x - y) / 2) - z;
|
||||
break;
|
||||
}
|
||||
|
||||
return rotatedCoords;
|
||||
}
|
||||
|
|
|
@ -1212,6 +1212,8 @@ sint32 ride_get_entry_index(sint32 rideType, sint32 rideSubType);
|
|||
void ride_demolish(sint32 rideIndex, sint32 flags);
|
||||
void ride_stop_peeps_queuing(sint32 rideIndex);
|
||||
|
||||
LocationXY16 ride_get_rotated_coords(sint16 x, sint16 y, sint16 z);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2283,25 +2283,10 @@ static void window_ride_construction_draw_track_piece(
|
|||
TrackDefinitions[trackType].preview_z_offset;
|
||||
z -= previewZOffset;
|
||||
|
||||
sint32 start_x = x;
|
||||
switch (get_current_rotation()) {
|
||||
case 0:
|
||||
x = y - x;
|
||||
y = (y + start_x) / 2 - z;
|
||||
break;
|
||||
case 1:
|
||||
x = -x - y;
|
||||
y = (y - start_x) / 2 - z;
|
||||
break;
|
||||
case 2:
|
||||
x -= y;
|
||||
y = (-y - start_x) / 2 - z;
|
||||
break;
|
||||
case 3:
|
||||
x += y;
|
||||
y = (-y + start_x) / 2 - z;
|
||||
break;
|
||||
}
|
||||
const LocationXY16 rotatedCoords = ride_get_rotated_coords(x, y, z);
|
||||
x = rotatedCoords.x;
|
||||
y = rotatedCoords.y;
|
||||
|
||||
dpi->x += x - width / 2;
|
||||
dpi->y += y - height / 2 - 16;
|
||||
uint32 d = unknown << 16;
|
||||
|
|
Loading…
Reference in New Issue