2017-10-13 22:23:07 +02:00
|
|
|
#pragma region Copyright (c) 2017 OpenRCT2 Developers
|
|
|
|
/*****************************************************************************
|
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
|
|
|
*****************************************************************************/
|
|
|
|
#pragma endregion
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../common.h"
|
|
|
|
|
|
|
|
#define LOCATION_NULL ((sint16)(uint16)0x8000)
|
|
|
|
#define RCT_XY8_UNDEFINED 0xFFFF
|
|
|
|
#define MakeXY16(x, y) {(sint16)(x), (sint16)(y)}
|
|
|
|
|
|
|
|
#pragma pack(push, 1)
|
2018-02-14 09:42:26 +01:00
|
|
|
struct LocationXY8 {
|
2017-10-13 22:23:07 +02:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
uint8 x, y;
|
|
|
|
};
|
|
|
|
uint16 xy;
|
|
|
|
};
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2017-10-13 22:23:07 +02:00
|
|
|
assert_struct_size(LocationXY8, 2);
|
|
|
|
|
2018-03-03 11:21:42 +01:00
|
|
|
struct sLocationXY8 {
|
|
|
|
sint8 x, y;
|
|
|
|
};
|
|
|
|
assert_struct_size(sLocationXY8, 2);
|
|
|
|
|
2018-02-14 09:42:26 +01:00
|
|
|
struct LocationXY16 {
|
2017-10-13 22:23:07 +02:00
|
|
|
sint16 x, y;
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2017-10-13 22:23:07 +02:00
|
|
|
assert_struct_size(LocationXY16, 4);
|
|
|
|
|
|
|
|
|
2018-02-14 09:42:26 +01:00
|
|
|
struct LocationXYZ16 {
|
2017-10-13 22:23:07 +02:00
|
|
|
sint16 x, y, z;
|
2018-02-14 09:42:26 +01:00
|
|
|
};
|
2017-10-13 22:23:07 +02:00
|
|
|
assert_struct_size(LocationXYZ16, 6);
|
2018-02-14 09:42:26 +01:00
|
|
|
#pragma pack(pop)
|
2018-02-14 11:31:49 +01:00
|
|
|
|
2018-03-07 19:10:50 +01:00
|
|
|
constexpr sint32 COORDS_NULL = -1;
|
|
|
|
|
|
|
|
|
2018-02-14 11:31:49 +01:00
|
|
|
/*
|
2018-02-15 17:42:53 +01:00
|
|
|
* Tile coordinates use 1 x/y increment per tile.
|
|
|
|
* Regular ('big', 'sprite') coordinates use 32 x/y increments per tile.
|
2018-02-14 11:31:49 +01:00
|
|
|
* */
|
2018-03-10 21:35:24 +01:00
|
|
|
struct CoordsXY
|
2018-02-14 11:31:49 +01:00
|
|
|
{
|
|
|
|
sint32 x, y;
|
|
|
|
};
|
|
|
|
|
2018-03-10 21:35:24 +01:00
|
|
|
struct TileCoordsXY
|
2018-02-14 11:31:49 +01:00
|
|
|
{
|
2018-03-10 21:35:24 +01:00
|
|
|
TileCoordsXY() = default;
|
|
|
|
TileCoordsXY(sint32 x_, sint32 y_) : x(x_), y(y_) {}
|
|
|
|
explicit TileCoordsXY(CoordsXY c) : x(c.x / 32), y(c.y / 32) {}
|
2018-04-18 20:34:34 +02:00
|
|
|
TileCoordsXY& operator+=(const TileCoordsXY rhs)
|
|
|
|
{
|
|
|
|
x += rhs.x;
|
|
|
|
y += rhs.y;
|
|
|
|
}
|
2018-03-10 21:35:24 +01:00
|
|
|
sint32 x = 0, y = 0;
|
2018-02-14 11:31:49 +01:00
|
|
|
};
|
|
|
|
|
2018-03-10 21:35:24 +01:00
|
|
|
struct CoordsXYZ
|
2018-02-14 11:31:49 +01:00
|
|
|
{
|
|
|
|
sint32 x, y, z;
|
|
|
|
};
|
|
|
|
|
2018-03-10 21:35:24 +01:00
|
|
|
struct TileCoordsXYZ
|
2018-02-14 11:31:49 +01:00
|
|
|
{
|
2018-03-10 21:35:24 +01:00
|
|
|
TileCoordsXYZ() = default;
|
|
|
|
TileCoordsXYZ(sint32 x_, sint32 y_, sint32 z_) : x(x_), y(y_), z(z_) {}
|
|
|
|
explicit TileCoordsXYZ(CoordsXYZ c) : x(c.x / 32), y(c.y / 32), z(c.z / 8) {}
|
|
|
|
sint32 x = 0, y = 0, z = 0;
|
2018-02-14 11:31:49 +01:00
|
|
|
};
|
|
|
|
|
2018-02-15 17:42:53 +01:00
|
|
|
struct TileCoordsXYZD
|
2018-02-14 11:31:49 +01:00
|
|
|
{
|
|
|
|
sint32 x, y, z;
|
|
|
|
uint8 direction;
|
2018-03-07 19:10:50 +01:00
|
|
|
|
|
|
|
bool isNull() const { return x == COORDS_NULL; };
|
2018-02-14 11:31:49 +01:00
|
|
|
};
|
|
|
|
|
2018-02-15 17:42:53 +01:00
|
|
|
struct CoordsXYZD
|
2018-02-14 11:31:49 +01:00
|
|
|
{
|
|
|
|
sint32 x, y, z;
|
|
|
|
uint8 direction;
|
2018-03-07 19:10:50 +01:00
|
|
|
|
|
|
|
bool isNull() const { return x == COORDS_NULL; };
|
2018-02-14 11:31:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|