mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #11520 from Gymnasiast/refactor/oein2
This commit is contained in:
commit
6f6ea6399d
|
@ -121,8 +121,8 @@ rct_window* window_land_open()
|
|||
window_push_others_below(window);
|
||||
|
||||
gLandToolSize = 1;
|
||||
gLandToolTerrainSurface = 255;
|
||||
gLandToolTerrainEdge = 255;
|
||||
gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL;
|
||||
gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL;
|
||||
gLandMountainMode = false;
|
||||
gLandPaintMode = false;
|
||||
_selectedFloorTexture = TERRAIN_GRASS;
|
||||
|
@ -223,7 +223,7 @@ static void window_land_dropdown(rct_window* w, rct_widgetindex widgetIndex, int
|
|||
|
||||
if (gLandToolTerrainSurface == type)
|
||||
{
|
||||
gLandToolTerrainSurface = 255;
|
||||
gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ static void window_land_dropdown(rct_window* w, rct_widgetindex widgetIndex, int
|
|||
|
||||
if (gLandToolTerrainEdge == type)
|
||||
{
|
||||
gLandToolTerrainEdge = 255;
|
||||
gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -316,9 +316,9 @@ static void window_land_invalidate(rct_window* w)
|
|||
}
|
||||
|
||||
w->pressed_widgets = (1 << WIDX_PREVIEW);
|
||||
if (gLandToolTerrainSurface != 255)
|
||||
if (gLandToolTerrainSurface != OBJECT_ENTRY_INDEX_NULL)
|
||||
w->pressed_widgets |= (1 << WIDX_FLOOR);
|
||||
if (gLandToolTerrainEdge != 255)
|
||||
if (gLandToolTerrainEdge != OBJECT_ENTRY_INDEX_NULL)
|
||||
w->pressed_widgets |= (1 << WIDX_WALL);
|
||||
if (gLandMountainMode)
|
||||
w->pressed_widgets |= (1 << WIDX_MOUNTAINMODE);
|
||||
|
@ -378,7 +378,7 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
// Draw paint price
|
||||
numTiles = gLandToolSize * gLandToolSize;
|
||||
price = 0;
|
||||
if (gLandToolTerrainSurface != 255)
|
||||
if (gLandToolTerrainSurface != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
const auto surfaceObj = static_cast<TerrainSurfaceObject*>(
|
||||
|
@ -389,7 +389,7 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
}
|
||||
}
|
||||
|
||||
if (gLandToolTerrainEdge != 255)
|
||||
if (gLandToolTerrainEdge != OBJECT_ENTRY_INDEX_NULL)
|
||||
price += numTiles * 100;
|
||||
|
||||
if (price != 0)
|
||||
|
|
|
@ -661,7 +661,7 @@ static void window_mapgen_base_dropdown(rct_window* w, rct_widgetindex widgetInd
|
|||
|
||||
if (gLandToolTerrainSurface == type)
|
||||
{
|
||||
gLandToolTerrainSurface = 255;
|
||||
gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -678,7 +678,7 @@ static void window_mapgen_base_dropdown(rct_window* w, rct_widgetindex widgetInd
|
|||
|
||||
if (gLandToolTerrainEdge == type)
|
||||
{
|
||||
gLandToolTerrainEdge = 255;
|
||||
gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -998,7 +998,7 @@ static void window_mapgen_simplex_dropdown(rct_window* w, rct_widgetindex widget
|
|||
|
||||
if (gLandToolTerrainSurface == type)
|
||||
{
|
||||
gLandToolTerrainSurface = 255;
|
||||
gLandToolTerrainSurface = OBJECT_ENTRY_INDEX_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1015,7 +1015,7 @@ static void window_mapgen_simplex_dropdown(rct_window* w, rct_widgetindex widget
|
|||
|
||||
if (gLandToolTerrainEdge == type)
|
||||
{
|
||||
gLandToolTerrainEdge = 255;
|
||||
gLandToolTerrainEdge = OBJECT_ENTRY_INDEX_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -203,7 +203,7 @@ static void init_scenery_entry(rct_scenery_entry* sceneryEntry, const ScenerySel
|
|||
Guard::ArgumentInRange<int32_t>(selection.EntryIndex, 0, WINDOW_SCENERY_TAB_SELECTION_UNDEFINED);
|
||||
if (scenery_is_invented(selection) || gCheatsIgnoreResearchStatus)
|
||||
{
|
||||
if (sceneryTabId != 0xFF)
|
||||
if (sceneryTabId != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
for (int32_t i = 0; i < SCENERY_ENTRIES_PER_TAB; i++)
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
MapRange validRange{ x0, y0, x1, y1 };
|
||||
|
||||
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
|
||||
if (_surfaceStyle != 0xFF)
|
||||
if (_surfaceStyle != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
if (_surfaceStyle > 0x1F)
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (_edgeStyle != 0xFF)
|
||||
if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
if (_edgeStyle > 0xF)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
if (_surfaceStyle != 0xFF)
|
||||
if (_surfaceStyle != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
uint8_t curSurfaceStyle = surfaceElement->GetSurfaceStyle();
|
||||
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (_edgeStyle != 0xFF)
|
||||
if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
uint8_t curEdgeStyle = surfaceElement->GetEdgeStyle();
|
||||
|
||||
|
@ -203,7 +203,7 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
if (_surfaceStyle != 0xFF)
|
||||
if (_surfaceStyle != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
uint8_t curSurfaceStyle = surfaceElement->GetSurfaceStyle();
|
||||
|
||||
|
@ -224,7 +224,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (_edgeStyle != 0xFF)
|
||||
if (_edgeStyle != OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
uint8_t curEdgeStyle = surfaceElement->GetEdgeStyle();
|
||||
|
||||
|
|
|
@ -1010,3 +1010,19 @@ bool RCT12ResearchItem::IsRandomEndMarker() const
|
|||
{
|
||||
return rawValue == RCT12_RESEARCHED_ITEMS_END_2;
|
||||
}
|
||||
|
||||
ObjectEntryIndex RCTEntryIndexToOpenRCT2EntryIndex(RCT12ObjectEntryIndex index)
|
||||
{
|
||||
if (index == RCT12_OBJECT_ENTRY_INDEX_NULL)
|
||||
return OBJECT_ENTRY_INDEX_NULL;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
RCT12ObjectEntryIndex OpenRCT2EntryIndexToRCTEntryIndex(ObjectEntryIndex index)
|
||||
{
|
||||
if (index == OBJECT_ENTRY_INDEX_NULL)
|
||||
return RCT12_OBJECT_ENTRY_INDEX_NULL;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
// Structures shared between both RCT1 and RCT2.
|
||||
|
||||
#include "../common.h"
|
||||
#include "../object/Object.h"
|
||||
#include "../world/Location.hpp"
|
||||
|
||||
#include <string>
|
||||
|
@ -49,7 +50,6 @@ constexpr uint16_t const RCT12_MAX_GOLF_HOLES = 31;
|
|||
constexpr uint16_t const RCT12_MAX_HELICES = 31;
|
||||
|
||||
constexpr uint8_t RCT12_BANNER_INDEX_NULL = std::numeric_limits<uint8_t>::max();
|
||||
constexpr const uint8_t RCT12_OBJECT_ENTRY_INDEX_NULL = 255;
|
||||
|
||||
constexpr const uint8_t RCT12_TILE_ELEMENT_SURFACE_EDGE_STYLE_MASK = 0xE0; // in RCT12TileElement.properties.surface.slope
|
||||
constexpr const uint8_t RCT12_TILE_ELEMENT_SURFACE_WATER_HEIGHT_MASK = 0x1F; // in RCT12TileElement.properties.surface.terrain
|
||||
|
@ -58,11 +58,11 @@ constexpr const uint8_t RCT12_TILE_ELEMENT_SURFACE_TERRAIN_MASK = 0xE0; //
|
|||
constexpr uint16_t const RCT12_XY8_UNDEFINED = 0xFFFF;
|
||||
|
||||
// Everything before this point has been researched
|
||||
#define RCT12_RESEARCHED_ITEMS_SEPARATOR 0xFFFFFFFF
|
||||
constexpr const uint32_t RCT12_RESEARCHED_ITEMS_SEPARATOR = 0xFFFFFFFF;
|
||||
// Everything before this point and after separator still requires research
|
||||
#define RCT12_RESEARCHED_ITEMS_END 0xFFFFFFFE
|
||||
constexpr const uint32_t RCT12_RESEARCHED_ITEMS_END = 0xFFFFFFFE;
|
||||
// Extra end of list entry. Leftover from RCT1.
|
||||
#define RCT12_RESEARCHED_ITEMS_END_2 0xFFFFFFFD
|
||||
constexpr const uint32_t RCT12_RESEARCHED_ITEMS_END_2 = 0xFFFFFFFD;
|
||||
|
||||
enum class RCT12TrackDesignVersion : uint8_t
|
||||
{
|
||||
|
@ -792,3 +792,9 @@ struct RCT12ResearchItem
|
|||
assert_struct_size(RCT12ResearchItem, 5);
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
using RCT12ObjectEntryIndex = uint8_t;
|
||||
constexpr const RCT12ObjectEntryIndex RCT12_OBJECT_ENTRY_INDEX_NULL = 255;
|
||||
|
||||
ObjectEntryIndex RCTEntryIndexToOpenRCT2EntryIndex(RCT12ObjectEntryIndex index);
|
||||
RCT12ObjectEntryIndex OpenRCT2EntryIndexToRCTEntryIndex(ObjectEntryIndex index);
|
||||
|
|
Loading…
Reference in New Issue