mirror of https://github.com/OpenRCT2/OpenRCT2.git
parent
463ef9d218
commit
f94970b059
|
@ -1377,8 +1377,11 @@ static void sub_6E1F34(
|
||||||
{
|
{
|
||||||
int16_t z = gSceneryCtrlPressZ;
|
int16_t z = gSceneryCtrlPressZ;
|
||||||
|
|
||||||
screen_get_map_xy_quadrant_with_z(x, y, z, grid_x, grid_y, &cl);
|
auto mapCoords = screen_get_map_xy_quadrant_with_z({ x, y }, z, &cl);
|
||||||
|
if (!mapCoords)
|
||||||
|
return;
|
||||||
|
*grid_x = mapCoords->x;
|
||||||
|
*grid_y = mapCoords->y;
|
||||||
// If SHIFT pressed
|
// If SHIFT pressed
|
||||||
if (gSceneryShiftPressed)
|
if (gSceneryShiftPressed)
|
||||||
{
|
{
|
||||||
|
@ -1556,7 +1559,11 @@ static void sub_6E1F34(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int16_t z = gSceneryCtrlPressZ;
|
int16_t z = gSceneryCtrlPressZ;
|
||||||
screen_get_map_xy_side_with_z(x, y, z, grid_x, grid_y, &cl);
|
auto mapCoords = screen_get_map_xy_side_with_z({ x, y }, z, &cl);
|
||||||
|
if (!mapCoords)
|
||||||
|
return;
|
||||||
|
*grid_x = mapCoords->x;
|
||||||
|
*grid_y = mapCoords->y;
|
||||||
|
|
||||||
// If SHIFT pressed
|
// If SHIFT pressed
|
||||||
if (gSceneryShiftPressed)
|
if (gSceneryShiftPressed)
|
||||||
|
|
|
@ -1843,16 +1843,14 @@ CoordsXY screen_get_map_xy_quadrant(ScreenCoordsXY screenCoords, uint8_t* quadra
|
||||||
*
|
*
|
||||||
* rct2: 0x0068964B
|
* rct2: 0x0068964B
|
||||||
*/
|
*/
|
||||||
void screen_get_map_xy_quadrant_with_z(
|
std::optional<CoordsXY> screen_get_map_xy_quadrant_with_z(ScreenCoordsXY screenCoords, int16_t z, uint8_t* quadrant)
|
||||||
int16_t screenX, int16_t screenY, int16_t z, int16_t* mapX, int16_t* mapY, uint8_t* quadrant)
|
|
||||||
{
|
{
|
||||||
auto coords = screen_get_map_xy_with_z({ screenX, screenY }, z);
|
auto mapCoords = screen_get_map_xy_with_z(screenCoords, z);
|
||||||
if (coords.x == LOCATION_NULL)
|
if (mapCoords.x == LOCATION_NULL)
|
||||||
return;
|
return std::nullopt;
|
||||||
|
|
||||||
*quadrant = map_get_tile_quadrant(coords.x, coords.y);
|
*quadrant = map_get_tile_quadrant(mapCoords.x, mapCoords.y);
|
||||||
*mapX = floor2(coords.x, 32);
|
return CoordsXY(floor2(mapCoords.x, 32), floor2(mapCoords.y, 32));
|
||||||
*mapY = floor2(coords.y, 32);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1873,15 +1871,14 @@ CoordsXY screen_get_map_xy_side(ScreenCoordsXY screenCoords, uint8_t* side)
|
||||||
*
|
*
|
||||||
* rct2: 0x006896DC
|
* rct2: 0x006896DC
|
||||||
*/
|
*/
|
||||||
void screen_get_map_xy_side_with_z(int16_t screenX, int16_t screenY, int16_t z, int16_t* mapX, int16_t* mapY, uint8_t* side)
|
std::optional<CoordsXY> screen_get_map_xy_side_with_z(ScreenCoordsXY screenCoords, int16_t z, uint8_t* side)
|
||||||
{
|
{
|
||||||
auto coords = screen_get_map_xy_with_z({ screenX, screenY }, z);
|
auto mapCoords = screen_get_map_xy_with_z(screenCoords, z);
|
||||||
if (coords.x == LOCATION_NULL)
|
if (mapCoords.x == LOCATION_NULL)
|
||||||
return;
|
return std::nullopt;
|
||||||
|
|
||||||
*side = map_get_tile_side(coords.x, coords.y);
|
*side = map_get_tile_side(mapCoords.x, mapCoords.y);
|
||||||
*mapX = floor2(coords.x, 32);
|
return CoordsXY(floor2(mapCoords.x, 32), floor2(mapCoords.y, 32));
|
||||||
*mapY = floor2(coords.y, 32);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef _VIEWPORT_H_
|
#ifndef _VIEWPORT_H_
|
||||||
#define _VIEWPORT_H_
|
#define _VIEWPORT_H_
|
||||||
|
|
||||||
|
#include "../core/Optional.hpp"
|
||||||
#include "../world/Location.hpp"
|
#include "../world/Location.hpp"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
|
||||||
|
@ -176,10 +177,9 @@ void viewport_invalidate(rct_viewport* viewport, int32_t left, int32_t top, int3
|
||||||
CoordsXY screen_get_map_xy(ScreenCoordsXY screenCoords, rct_viewport** viewport);
|
CoordsXY screen_get_map_xy(ScreenCoordsXY screenCoords, rct_viewport** viewport);
|
||||||
CoordsXY screen_get_map_xy_with_z(ScreenCoordsXY screenCoords, int16_t z);
|
CoordsXY screen_get_map_xy_with_z(ScreenCoordsXY screenCoords, int16_t z);
|
||||||
CoordsXY screen_get_map_xy_quadrant(ScreenCoordsXY screenCoords, uint8_t* quadrant);
|
CoordsXY screen_get_map_xy_quadrant(ScreenCoordsXY screenCoords, uint8_t* quadrant);
|
||||||
void screen_get_map_xy_quadrant_with_z(
|
std::optional<CoordsXY> screen_get_map_xy_quadrant_with_z(ScreenCoordsXY screenCoords, int16_t z, uint8_t* quadrant);
|
||||||
int16_t screenX, int16_t screenY, int16_t z, int16_t* mapX, int16_t* mapY, uint8_t* quadrant);
|
|
||||||
CoordsXY screen_get_map_xy_side(ScreenCoordsXY screenCoords, uint8_t* side);
|
CoordsXY screen_get_map_xy_side(ScreenCoordsXY screenCoords, uint8_t* side);
|
||||||
void screen_get_map_xy_side_with_z(int16_t screenX, int16_t screenY, int16_t z, int16_t* mapX, int16_t* mapY, uint8_t* side);
|
std::optional<CoordsXY> screen_get_map_xy_side_with_z(ScreenCoordsXY screenCoords, int16_t z, uint8_t* side);
|
||||||
|
|
||||||
uint8_t get_current_rotation();
|
uint8_t get_current_rotation();
|
||||||
int16_t get_height_marker_offset();
|
int16_t get_height_marker_offset();
|
||||||
|
|
Loading…
Reference in New Issue