forked from rosebudai/OpenRCT2-Web
Refactor slope flags
This commit is contained in:
35 files changed
+757
-790
No files matched your search
@@ -33,6 +33,7 @@
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Surface.h>
|
||||
#include <openrct2/world/tile_element/Slope.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
@@ -446,11 +447,11 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
|
||||
uint8_t slope = 0;
|
||||
if (gFootpathConstructSlope == 2)
|
||||
{
|
||||
slope = TILE_ELEMENT_SLOPE_N_CORNER_UP;
|
||||
slope = kTileSlopeNCornerUp;
|
||||
}
|
||||
else if (gFootpathConstructSlope == 6)
|
||||
{
|
||||
slope = TILE_ELEMENT_SLOPE_E_CORNER_UP;
|
||||
slope = kTileSlopeECornerUp;
|
||||
}
|
||||
|
||||
std::optional<uint32_t> baseImage;
|
||||
@@ -817,7 +818,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
|
||||
auto surfaceElement = info.Element->AsSurface();
|
||||
if (surfaceElement != nullptr)
|
||||
{
|
||||
slope = DefaultPathSlope[surfaceElement->GetSlope() & kTileElementSurfaceRaisedCornersMask];
|
||||
slope = DefaultPathSlope[surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -882,11 +883,11 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
|
||||
if (tileElement->GetType() == TileElementType::Surface)
|
||||
{
|
||||
uint8_t slope = tileElement->AsSurface()->GetSlope();
|
||||
if (slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
if (slope & kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
z += PATH_HEIGHT_STEP;
|
||||
} // Add 2 for a slope
|
||||
if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (slope & kTileSlopeDiagonalFlag)
|
||||
z += PATH_HEIGHT_STEP; // Add another 2 for a steep slope
|
||||
}
|
||||
|
||||
@@ -922,7 +923,7 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
|
||||
switch (info.SpriteType)
|
||||
{
|
||||
case ViewportInteractionItem::Terrain:
|
||||
slope = DefaultPathSlope[info.Element->AsSurface()->GetSlope() & kTileElementSurfaceRaisedCornersMask];
|
||||
slope = DefaultPathSlope[info.Element->AsSurface()->GetSlope() & kTileSlopeRaisedCornersMask];
|
||||
break;
|
||||
case ViewportInteractionItem::Footpath:
|
||||
slope = info.Element->AsPath()->GetSlopeDirection();
|
||||
@@ -985,12 +986,12 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
|
||||
// expect the path to be slightly raised as well.
|
||||
uint8_t slope = tileElement->AsSurface()->GetSlope();
|
||||
z = tileElement->GetBaseZ();
|
||||
if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (slope & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
// Steep diagonal slope
|
||||
z += 2 * PATH_HEIGHT_STEP;
|
||||
}
|
||||
else if (slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
else if (slope & kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
// Normal slope
|
||||
z += PATH_HEIGHT_STEP;
|
||||
@@ -1237,11 +1238,11 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
|
||||
|
||||
// Set pressed slope widget
|
||||
int32_t slope = gFootpathConstructSlope;
|
||||
if (slope == TILE_ELEMENT_SLOPE_SE_SIDE_UP)
|
||||
if (slope == kTileSlopeSESideUp)
|
||||
{
|
||||
pressedWidgets |= (1uLL << WIDX_SLOPEDOWN);
|
||||
}
|
||||
else if (slope == TILE_ELEMENT_SLOPE_FLAT)
|
||||
else if (slope == kTileSlopeFlat)
|
||||
{
|
||||
pressedWidgets |= (1uLL << WIDX_LEVEL);
|
||||
}
|
||||
@@ -1289,14 +1290,14 @@ static constexpr uint8_t ConstructionPreviewImages[][4] = {
|
||||
{
|
||||
*type = gFootpathSelection.GetSelectedSurface();
|
||||
}
|
||||
*slope = TILE_ELEMENT_SLOPE_FLAT;
|
||||
*slope = kTileSlopeFlat;
|
||||
if (gFootpathConstructSlope != 0)
|
||||
{
|
||||
*slope = _footpathConstructDirection | TILE_ELEMENT_SLOPE_S_CORNER_UP;
|
||||
*slope = _footpathConstructDirection | kTileSlopeSCornerUp;
|
||||
if (gFootpathConstructSlope != 2)
|
||||
{
|
||||
footpathLoc.z -= PATH_HEIGHT_STEP;
|
||||
*slope ^= TILE_ELEMENT_SLOPE_E_CORNER_UP;
|
||||
*slope ^= kTileSlopeECornerUp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
#include <openrct2/world/Surface.h>
|
||||
#include <openrct2/world/tile_element/Slope.h>
|
||||
#include <vector>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
@@ -584,10 +585,10 @@ static Widget window_map_widgets[] = {
|
||||
if (parkEntranceMapPosition.z == 0)
|
||||
{
|
||||
parkEntranceMapPosition.z = surfaceElement->GetBaseZ();
|
||||
if ((surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != 0)
|
||||
if ((surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask) != 0)
|
||||
{
|
||||
parkEntranceMapPosition.z += 16;
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
parkEntranceMapPosition.z += 16;
|
||||
}
|
||||
@@ -672,9 +673,9 @@ static Widget window_map_widgets[] = {
|
||||
int32_t mapZ = tileElement->GetBaseZ();
|
||||
if (tileElement->GetType() == TileElementType::Surface)
|
||||
{
|
||||
if ((tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != 0)
|
||||
if ((tileElement->AsSurface()->GetSlope() & kTileSlopeRaisedCornersMask) != 0)
|
||||
mapZ += 16;
|
||||
if (tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (tileElement->AsSurface()->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
mapZ += 16;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <openrct2/world/Scenery.h>
|
||||
#include <openrct2/world/Surface.h>
|
||||
#include <openrct2/world/TileInspector.h>
|
||||
#include <openrct2/world/tile_element/Slope.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
@@ -2177,7 +2178,7 @@ static uint64_t PageDisabledWidgets[] = {
|
||||
WIDX_SURFACE_CHECK_CORNER_W,
|
||||
tileElement->AsSurface()->GetSlope() & (1 << ((1 - GetCurrentRotation()) & 3)));
|
||||
SetCheckboxValue(
|
||||
WIDX_SURFACE_CHECK_DIAGONAL, tileElement->AsSurface()->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT);
|
||||
WIDX_SURFACE_CHECK_DIAGONAL, tileElement->AsSurface()->GetSlope() & kTileSlopeDiagonalFlag);
|
||||
break;
|
||||
|
||||
case TileElementType::Path:
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Surface.h>
|
||||
#include <openrct2/world/tile_element/Slope.h>
|
||||
#include <vector>
|
||||
|
||||
using namespace OpenRCT2::TrackMetaData;
|
||||
@@ -416,12 +417,12 @@ static Widget _trackPlaceWidgets[] = {
|
||||
auto z = surfaceElement->GetBaseZ();
|
||||
|
||||
// Increase Z above slope
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
z += 16;
|
||||
|
||||
// Increase Z above double slope
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
z += 16;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/Wall.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
@@ -153,8 +154,8 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertQuery(GameActions::R
|
||||
|
||||
// Do not attempt to build a crossing with a queue or a sloped path.
|
||||
auto isQueue = _constructFlags & PathConstructFlag::IsQueue;
|
||||
uint8_t crossingMode = isQueue || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
uint8_t crossingMode = isQueue || (_slope != kTileSlopeFlat) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), crossingMode);
|
||||
if (!entrancePath && canBuild.Error != GameActions::Status::Ok)
|
||||
@@ -224,8 +225,8 @@ GameActions::Result FootpathLayoutPlaceAction::ElementInsertExecute(GameActions:
|
||||
|
||||
// Do not attempt to build a crossing with a queue or a sloped path.
|
||||
auto isQueue = _constructFlags & PathConstructFlag::IsQueue;
|
||||
uint8_t crossingMode = isQueue || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
uint8_t crossingMode = isQueue || (_slope != kTileSlopeFlat) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(), crossingMode);
|
||||
if (!entrancePath && canBuild.Error != GameActions::Status::Ok)
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/TileElementsView.h"
|
||||
#include "../world/Wall.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -141,8 +142,7 @@ GameActions::Result FootpathPlaceAction::Execute() const
|
||||
auto zLow = _loc.z;
|
||||
auto zHigh = zLow + PATH_CLEARANCE;
|
||||
WallRemoveIntersectingWalls(
|
||||
{ _loc, zLow, zHigh + ((_slope & kTileElementSurfaceRaisedCornersMask) ? 16 : 0) },
|
||||
DirectionReverse(_direction));
|
||||
{ _loc, zLow, zHigh + ((_slope & kTileSlopeRaisedCornersMask) ? 16 : 0) }, DirectionReverse(_direction));
|
||||
WallRemoveIntersectingWalls(
|
||||
{ _loc.x - CoordsDirectionDelta[_direction].x, _loc.y - CoordsDirectionDelta[_direction].y, zLow, zHigh },
|
||||
_direction);
|
||||
@@ -303,8 +303,8 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result
|
||||
|
||||
// Do not attempt to build a crossing with a queue or a sloped path.
|
||||
auto isQueue = _constructFlags & PathConstructFlag::IsQueue;
|
||||
uint8_t crossingMode = isQueue || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
uint8_t crossingMode = isQueue || (_slope != kTileSlopeFlat) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GetFlags(), crossingMode);
|
||||
if (!entrancePath && canBuild.Error != GameActions::Status::Ok)
|
||||
@@ -373,8 +373,8 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul
|
||||
|
||||
// Do not attempt to build a crossing with a queue or a sloped.
|
||||
auto isQueue = _constructFlags & PathConstructFlag::IsQueue;
|
||||
uint8_t crossingMode = isQueue || (_slope != TILE_ELEMENT_SLOPE_FLAT) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
uint8_t crossingMode = isQueue || (_slope != kTileSlopeFlat) ? CREATE_CROSSING_MODE_NONE
|
||||
: CREATE_CROSSING_MODE_PATH_OVER_TRACK;
|
||||
auto canBuild = MapCanConstructWithClearAt(
|
||||
{ _loc, zLow, zHigh }, &MapPlaceNonSceneryClearFunc, quarterTile, GAME_COMMAND_FLAG_APPLY | GetFlags(), crossingMode);
|
||||
if (!entrancePath && canBuild.Error != GameActions::Status::Ok)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/SurfaceData.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
|
||||
LandLowerAction::LandLowerAction(const CoordsXY& coords, MapRange range, uint8_t selectionType)
|
||||
: _coords(coords)
|
||||
@@ -104,9 +105,9 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const
|
||||
withinOwnership = true;
|
||||
|
||||
uint8_t height = surfaceElement->BaseHeight;
|
||||
if (surfaceElement->GetSlope() & kTileElementSurfaceRaisedCornersMask)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask)
|
||||
height += 2;
|
||||
if (surfaceElement->GetSlope() & kTileElementSurfaceDiagonalFlag)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
height += 2;
|
||||
|
||||
if (height < maxHeight)
|
||||
@@ -118,7 +119,7 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const
|
||||
if (newSlope & SURFACE_STYLE_FLAG_RAISE_OR_LOWER_BASE_HEIGHT)
|
||||
height -= 2;
|
||||
|
||||
newSlope &= kTileElementSurfaceSlopeMask;
|
||||
newSlope &= kTileSlopeMask;
|
||||
|
||||
auto landSetHeightAction = LandSetHeightAction({ x, y }, height, newSlope);
|
||||
landSetHeightAction.SetFlags(GetFlags());
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/SurfaceData.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
|
||||
LandRaiseAction::LandRaiseAction(const CoordsXY& coords, MapRange range, uint8_t selectionType)
|
||||
: _coords(coords)
|
||||
@@ -122,7 +123,7 @@ GameActions::Result LandRaiseAction::QueryExecute(bool isExecuting) const
|
||||
height += 2;
|
||||
}
|
||||
}
|
||||
newSlope &= kTileElementSurfaceSlopeMask;
|
||||
newSlope &= kTileSlopeMask;
|
||||
|
||||
auto landSetHeightAction = LandSetHeightAction({ x, y }, height, newSlope);
|
||||
landSetHeightAction.SetFlags(GetFlags());
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/TileElementsView.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
@@ -127,10 +128,10 @@ GameActions::Result LandSetHeightAction::Query() const
|
||||
if (!GetGameState().Cheats.DisableClearanceChecks)
|
||||
{
|
||||
uint8_t zCorner = _height;
|
||||
if (_style & kTileElementSurfaceRaisedCornersMask)
|
||||
if (_style & kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
zCorner += 2;
|
||||
if (_style & kTileElementSurfaceDiagonalFlag)
|
||||
if (_style & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
zCorner += 2;
|
||||
}
|
||||
@@ -197,12 +198,12 @@ StringId LandSetHeightAction::CheckParameters() const
|
||||
return STR_TOO_HIGH;
|
||||
}
|
||||
|
||||
if (_height > kMaximumLandHeight - 2 && (_style & kTileElementSurfaceSlopeMask) != 0)
|
||||
if (_height > kMaximumLandHeight - 2 && (_style & kTileSlopeMask) != 0)
|
||||
{
|
||||
return STR_TOO_HIGH;
|
||||
}
|
||||
|
||||
if (_height == kMaximumLandHeight - 2 && (_style & kTileElementSurfaceDiagonalFlag))
|
||||
if (_height == kMaximumLandHeight - 2 && (_style & kTileSlopeDiagonalFlag))
|
||||
{
|
||||
return STR_TOO_HIGH;
|
||||
}
|
||||
@@ -302,10 +303,10 @@ TileElement* LandSetHeightAction::CheckFloatingStructures(TileElement* surfaceEl
|
||||
uint32_t waterHeight = surfaceElement->AsSurface()->GetWaterHeight();
|
||||
if (waterHeight != 0)
|
||||
{
|
||||
if (_style & kTileElementSurfaceSlopeMask)
|
||||
if (_style & kTileSlopeMask)
|
||||
{
|
||||
zCorner += 2;
|
||||
if (_style & kTileElementSurfaceDiagonalFlag)
|
||||
if (_style & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
zCorner += 2;
|
||||
}
|
||||
@@ -325,7 +326,7 @@ money64 LandSetHeightAction::GetSurfaceHeightChangeCost(SurfaceElement* surfaceE
|
||||
for (Direction i : ALL_DIRECTIONS)
|
||||
{
|
||||
int32_t cornerHeight = TileElementGetCornerHeight(surfaceElement, i);
|
||||
cornerHeight -= MapGetCornerHeight(_height, _style & kTileElementSurfaceSlopeMask, i);
|
||||
cornerHeight -= MapGetCornerHeight(_height, _style & kTileSlopeMask, i);
|
||||
cost += 2.50_GBP * abs(cornerHeight);
|
||||
}
|
||||
return cost;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "../world/ConstructionClearance.h"
|
||||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
@@ -374,10 +375,10 @@ int16_t LargeSceneryPlaceAction::GetMaxSurfaceHeight(LargeSceneryTile* tiles) co
|
||||
int32_t baseZ = surfaceElement->GetBaseZ();
|
||||
int32_t slope = surfaceElement->GetSlope();
|
||||
|
||||
if ((slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != TILE_ELEMENT_SLOPE_FLAT)
|
||||
if ((slope & kTileSlopeRaisedCornersMask) != kTileSlopeFlat)
|
||||
{
|
||||
baseZ += LAND_HEIGHT_STEP;
|
||||
if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (slope & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
baseZ += LAND_HEIGHT_STEP;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/TileElement.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "GameAction.h"
|
||||
#include "SmallSceneryRemoveAction.h"
|
||||
|
||||
@@ -205,8 +206,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const
|
||||
}
|
||||
|
||||
if (!GetGameState().Cheats.DisableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE))
|
||||
&& !supportsRequired && !isOnWater && surfaceElement != nullptr
|
||||
&& (surfaceElement->GetSlope() != TILE_ELEMENT_SLOPE_FLAT))
|
||||
&& !supportsRequired && !isOnWater && surfaceElement != nullptr && (surfaceElement->GetSlope() != kTileSlopeFlat))
|
||||
{
|
||||
return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LEVEL_LAND_REQUIRED);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "../world/ConstructionClearance.h"
|
||||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "RideSetSettingAction.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
@@ -340,9 +341,9 @@ GameActions::Result TrackPlaceAction::Query() const
|
||||
waterHeight -= LAND_HEIGHT_STEP;
|
||||
if (waterHeight == surfaceElement->GetBaseZ())
|
||||
{
|
||||
uint8_t slope = surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP;
|
||||
if (slope == TILE_ELEMENT_SLOPE_W_CORNER_DN || slope == TILE_ELEMENT_SLOPE_S_CORNER_DN
|
||||
|| slope == TILE_ELEMENT_SLOPE_E_CORNER_DN || slope == TILE_ELEMENT_SLOPE_N_CORNER_DN)
|
||||
uint8_t slope = surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask;
|
||||
if (slope == kTileSlopeWCornerDown || slope == kTileSlopeSCornerDown || slope == kTileSlopeECornerDown
|
||||
|| slope == kTileSlopeNCornerDown)
|
||||
{
|
||||
return GameActions::Result(
|
||||
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "../world/MapAnimation.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/Wall.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::TrackMetaData;
|
||||
@@ -170,7 +171,7 @@ GameActions::Result WallPlaceAction::Query() const
|
||||
GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
newEdge = (newEdge - 1) & 3;
|
||||
|
||||
@@ -201,7 +202,7 @@ GameActions::Result WallPlaceAction::Query() const
|
||||
GameActions::Status::Disallowed, STR_CANT_BUILD_THIS_HERE, STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND);
|
||||
}
|
||||
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
newEdge = (newEdge - 1) & 3;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "../world/Footpath.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "PatrolArea.h"
|
||||
#include "Peep.h"
|
||||
|
||||
@@ -412,7 +413,7 @@ uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const
|
||||
if (surfaceElement->GetSlope() != PathSlopeToLandSlope[GetNextDirection()])
|
||||
return INVALID_DIRECTION;
|
||||
}
|
||||
else if (surfaceElement->GetSlope() != TILE_ELEMENT_SLOPE_FLAT)
|
||||
else if (surfaceElement->GetSlope() != kTileSlopeFlat)
|
||||
return INVALID_DIRECTION;
|
||||
}
|
||||
|
||||
|
||||
@@ -583,6 +583,7 @@
|
||||
<ClInclude Include="windows\Intent.h" />
|
||||
<ClInclude Include="windows\TileInspectorGlobals.h" />
|
||||
<ClInclude Include="world\tile_element\TileElementType.h" />
|
||||
<ClInclude Include="world\tile_element\Slope.h" />
|
||||
<ClInclude Include="world\Banner.h" />
|
||||
<ClInclude Include="world\Climate.h" />
|
||||
<ClInclude Include="world\ConstructionClearance.h" />
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2024 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY = 1 << 5
|
||||
};
|
||||
@@ -13,9 +13,9 @@
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../util/Util.h"
|
||||
#include "../../world/Surface.h"
|
||||
#include "../../world/tile_element/Slope.h"
|
||||
#include "../Paint.SessionFlags.h"
|
||||
#include "../Paint.h"
|
||||
#include "Generic.h"
|
||||
|
||||
/** rct2: 0x0097AF20, 0x0097AF21 */
|
||||
// clang-format off
|
||||
@@ -295,7 +295,7 @@ bool MetalASupportsPaintSetup(
|
||||
segment = newSegment;
|
||||
}
|
||||
int16_t si = height;
|
||||
if (supportSegments[segment].slope & SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY || height - supportSegments[segment].height < 6
|
||||
if (supportSegments[segment].slope & kTileSlopeAboveTrackOrScenery || height - supportSegments[segment].height < 6
|
||||
|| _97B15C[supportType].base_id == 0)
|
||||
{
|
||||
height = supportSegments[segment].height;
|
||||
@@ -306,7 +306,7 @@ bool MetalASupportsPaintSetup(
|
||||
int8_t yOffset = SupportBoundBoxes[segment].y;
|
||||
|
||||
uint32_t imageIndex = _97B15C[supportType].base_id;
|
||||
imageIndex += metal_supports_slope_image_map[supportSegments[segment].slope & kTileElementSurfaceSlopeMask];
|
||||
imageIndex += metal_supports_slope_image_map[supportSegments[segment].slope & kTileSlopeMask];
|
||||
auto image_id = imageTemplate.WithIndex(imageIndex);
|
||||
|
||||
PaintAddImageAsParent(session, image_id, { xOffset, yOffset, supportSegments[segment].height }, { 0, 0, 5 });
|
||||
@@ -370,7 +370,7 @@ bool MetalASupportsPaintSetup(
|
||||
}
|
||||
|
||||
supportSegments[segment].height = unk9E3294;
|
||||
supportSegments[segment].slope = SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY;
|
||||
supportSegments[segment].slope = kTileSlopeAboveTrackOrScenery;
|
||||
|
||||
height = originalHeight;
|
||||
segment = originalSegment;
|
||||
@@ -506,14 +506,14 @@ bool MetalBSupportsPaintSetup(
|
||||
|
||||
int32_t si = baseHeight;
|
||||
|
||||
if ((supportSegments[segment].slope & SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY) || (baseHeight - supportSegments[segment].height < 6)
|
||||
if ((supportSegments[segment].slope & kTileSlopeAboveTrackOrScenery) || (baseHeight - supportSegments[segment].height < 6)
|
||||
|| (_97B15C[supportType].base_id == 0))
|
||||
{
|
||||
baseHeight = supportSegments[segment].height;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t imageOffset = metal_supports_slope_image_map[supportSegments[segment].slope & kTileElementSurfaceSlopeMask];
|
||||
uint32_t imageOffset = metal_supports_slope_image_map[supportSegments[segment].slope & kTileSlopeMask];
|
||||
uint32_t imageId = _97B15C[supportType].base_id + imageOffset;
|
||||
|
||||
PaintAddImageAsParent(
|
||||
@@ -576,7 +576,7 @@ bool MetalBSupportsPaintSetup(
|
||||
}
|
||||
|
||||
supportSegments[segment].height = _9E3294;
|
||||
supportSegments[segment].slope = SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY;
|
||||
supportSegments[segment].slope = kTileSlopeAboveTrackOrScenery;
|
||||
|
||||
if (special != 0)
|
||||
{
|
||||
@@ -674,14 +674,14 @@ bool PathPoleSupportsPaintSetup(
|
||||
|
||||
uint16_t baseHeight;
|
||||
|
||||
if ((supportSegments[segment].slope & SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY) || (height - supportSegments[segment].height < 6)
|
||||
if ((supportSegments[segment].slope & kTileSlopeAboveTrackOrScenery) || (height - supportSegments[segment].height < 6)
|
||||
|| !(pathPaintInfo.RailingFlags & RAILING_ENTRY_FLAG_HAS_SUPPORT_BASE_SPRITE))
|
||||
{
|
||||
baseHeight = supportSegments[segment].height;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t imageOffset = metal_supports_slope_image_map[supportSegments[segment].slope & kTileElementSurfaceSlopeMask];
|
||||
uint8_t imageOffset = metal_supports_slope_image_map[supportSegments[segment].slope & kTileSlopeMask];
|
||||
baseHeight = supportSegments[segment].height;
|
||||
|
||||
PaintAddImageAsParent(
|
||||
@@ -762,7 +762,7 @@ bool PathPoleSupportsPaintSetup(
|
||||
|
||||
// Loc6A34D8
|
||||
supportSegments[segment].height = 0xFFFF;
|
||||
supportSegments[segment].slope = SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY;
|
||||
supportSegments[segment].slope = kTileSlopeAboveTrackOrScenery;
|
||||
|
||||
if (isSloped)
|
||||
{
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Surface.h"
|
||||
#include "../../world/tile_element/Slope.h"
|
||||
#include "../Boundbox.h"
|
||||
#include "../Paint.SessionFlags.h"
|
||||
#include "../Paint.h"
|
||||
#include "Generic.h"
|
||||
|
||||
constexpr auto kNumWoodenSupportTypes = 2;
|
||||
constexpr auto kNumWoodenSupportSubTypes = 6;
|
||||
@@ -426,12 +426,12 @@ bool WoodenASupportsPaintSetup(
|
||||
|
||||
// Draw base support (usually shaped to the slope)
|
||||
auto slope = session.Support.slope;
|
||||
if (slope & SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY)
|
||||
if (slope & kTileSlopeAboveTrackOrScenery)
|
||||
{
|
||||
// Above scenery (just put a base piece above it)
|
||||
drawFlatPiece = true;
|
||||
}
|
||||
else if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
else if (slope & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
// Steep diagonal (place the correct shaped support for the slope)
|
||||
heightSteps -= 2;
|
||||
@@ -447,7 +447,7 @@ bool WoodenASupportsPaintSetup(
|
||||
}
|
||||
else
|
||||
{
|
||||
auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileElementSurfaceSlopeMask]);
|
||||
auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileSlopeMask]);
|
||||
|
||||
PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { { 0, 0, baseHeight + 2 }, { 32, 32, 11 } });
|
||||
PaintAddImageAsParent(
|
||||
@@ -459,7 +459,7 @@ bool WoodenASupportsPaintSetup(
|
||||
|
||||
baseHeight += 32;
|
||||
}
|
||||
else if ((slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != 0)
|
||||
else if ((slope & kTileSlopeRaisedCornersMask) != 0)
|
||||
{
|
||||
// 1 to 3 quarters up
|
||||
heightSteps--;
|
||||
@@ -475,7 +475,7 @@ bool WoodenASupportsPaintSetup(
|
||||
}
|
||||
else
|
||||
{
|
||||
auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileElementSurfaceSlopeMask]);
|
||||
auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileSlopeMask]);
|
||||
PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { { 0, 0, baseHeight + 2 }, { 32, 32, 11 } });
|
||||
hasSupports = true;
|
||||
}
|
||||
@@ -558,12 +558,12 @@ bool WoodenBSupportsPaintSetup(
|
||||
|
||||
// Draw base support (usually shaped to the slope)
|
||||
auto slope = session.Support.slope;
|
||||
if (slope & SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY)
|
||||
if (slope & kTileSlopeAboveTrackOrScenery)
|
||||
{
|
||||
// Above scenery (just put a base piece above it)
|
||||
drawFlatPiece = true;
|
||||
}
|
||||
else if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
else if (slope & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
// Steep diagonal (place the correct shaped support for the slope)
|
||||
heightSteps -= 2;
|
||||
@@ -579,7 +579,7 @@ bool WoodenBSupportsPaintSetup(
|
||||
}
|
||||
else
|
||||
{
|
||||
auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileElementSurfaceSlopeMask]);
|
||||
auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileSlopeMask]);
|
||||
|
||||
PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { { 0, 0, baseHeight + 2 }, { 32, 32, 11 } });
|
||||
PaintAddImageAsParent(
|
||||
@@ -591,7 +591,7 @@ bool WoodenBSupportsPaintSetup(
|
||||
|
||||
baseHeight += 32;
|
||||
}
|
||||
else if ((slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != 0)
|
||||
else if ((slope & kTileSlopeRaisedCornersMask) != 0)
|
||||
{
|
||||
// 1 to 3 quarters up
|
||||
heightSteps--;
|
||||
@@ -607,7 +607,7 @@ bool WoodenBSupportsPaintSetup(
|
||||
}
|
||||
else
|
||||
{
|
||||
auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileElementSurfaceSlopeMask]);
|
||||
auto imageId = imageTemplate.WithIndex(imageIndex + word_97B3C4[slope & kTileSlopeMask]);
|
||||
PaintAddImageAsParent(session, imageId, { 0, 0, baseHeight }, { { 0, 0, baseHeight + 2 }, { 32, 32, 3 } });
|
||||
hasSupports = true;
|
||||
}
|
||||
@@ -689,7 +689,7 @@ bool PathBoxSupportsPaintSetup(
|
||||
|
||||
int16_t heightSteps = supportLength / 16;
|
||||
|
||||
if (session.Support.slope & SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY)
|
||||
if (session.Support.slope & kTileSlopeAboveTrackOrScenery)
|
||||
{
|
||||
// save dx2
|
||||
PaintAddImageAsParent(
|
||||
@@ -704,7 +704,7 @@ bool PathBoxSupportsPaintSetup(
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t imageId = supportOrientationOffset + word_97B3C4[session.Support.slope & kTileElementSurfaceSlopeMask]
|
||||
uint32_t imageId = supportOrientationOffset + word_97B3C4[session.Support.slope & kTileSlopeMask]
|
||||
+ pathPaintInfo.BridgeImageId;
|
||||
|
||||
PaintAddImageAsParent(
|
||||
@@ -725,7 +725,7 @@ bool PathBoxSupportsPaintSetup(
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t ebx = supportOrientationOffset + word_97B3C4[session.Support.slope & kTileElementSurfaceSlopeMask]
|
||||
uint32_t ebx = supportOrientationOffset + word_97B3C4[session.Support.slope & kTileSlopeMask]
|
||||
+ pathPaintInfo.BridgeImageId;
|
||||
|
||||
PaintAddImageAsParent(
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "../../world/Scenery.h"
|
||||
#include "../../world/Surface.h"
|
||||
#include "../../world/TileInspector.h"
|
||||
#include "../../world/tile_element/Slope.h"
|
||||
#include "../Boundbox.h"
|
||||
#include "../Paint.SessionFlags.h"
|
||||
#include "../support/MetalSupports.h"
|
||||
@@ -47,10 +48,10 @@ using namespace OpenRCT2;
|
||||
bool gPaintWidePathsAsGhost = false;
|
||||
|
||||
const uint8_t PathSlopeToLandSlope[] = {
|
||||
TILE_ELEMENT_SLOPE_SW_SIDE_UP,
|
||||
TILE_ELEMENT_SLOPE_NW_SIDE_UP,
|
||||
TILE_ELEMENT_SLOPE_NE_SIDE_UP,
|
||||
TILE_ELEMENT_SLOPE_SE_SIDE_UP,
|
||||
kTileSlopeSWSideUp,
|
||||
kTileSlopeNWSideUp,
|
||||
kTileSlopeNESideUp,
|
||||
kTileSlopeSESideUp,
|
||||
};
|
||||
|
||||
static constexpr uint8_t Byte98D6E0[] = {
|
||||
@@ -723,7 +724,7 @@ static bool ShouldDrawSupports(PaintSession& session, const PathElement& pathEl,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (surface->GetSlope() != TILE_ELEMENT_SLOPE_FLAT)
|
||||
else if (surface->GetSlope() != kTileSlopeFlat)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "../../ride/TrackDesign.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/Surface.h"
|
||||
#include "../../world/tile_element/Slope.h"
|
||||
#include "../Boundbox.h"
|
||||
#include "../Paint.SessionFlags.h"
|
||||
#include "Paint.TileElement.h"
|
||||
@@ -384,8 +385,8 @@ static ImageId GetTunnelImage(const TerrainEdgeObject* edgeObject, uint8_t type,
|
||||
static uint8_t ViewportSurfacePaintSetupGetRelativeSlope(const SurfaceElement& surfaceElement, int32_t rotation)
|
||||
{
|
||||
const uint8_t slope = surfaceElement.GetSlope();
|
||||
const uint8_t slopeHeight = slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT;
|
||||
uint16_t slopeCorners = (slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) << rotation;
|
||||
const uint8_t slopeHeight = slope & kTileSlopeDiagonalFlag;
|
||||
uint16_t slopeCorners = (slope & kTileSlopeRaisedCornersMask) << rotation;
|
||||
slopeCorners = ((slopeCorners >> 4) | slopeCorners) & 0x0F;
|
||||
return slopeHeight | slopeCorners;
|
||||
}
|
||||
@@ -865,14 +866,14 @@ static std::pair<int32_t, int32_t> SurfaceGetHeightAboveWater(
|
||||
{
|
||||
localHeight += LAND_HEIGHT_STEP;
|
||||
|
||||
if (waterHeight != localHeight || !(localSurfaceShape & static_cast<int32_t>(kTileElementSurfaceDiagonalFlag)))
|
||||
if (waterHeight != localHeight || !(localSurfaceShape & static_cast<int32_t>(kTileSlopeDiagonalFlag)))
|
||||
{
|
||||
localHeight = waterHeight;
|
||||
localSurfaceShape = TILE_ELEMENT_SLOPE_FLAT;
|
||||
localSurfaceShape = kTileSlopeFlat;
|
||||
}
|
||||
else
|
||||
{
|
||||
localSurfaceShape = Numerics::ror4(surfaceShape ^ static_cast<int8_t>(kTileElementSurfaceRaisedCornersMask), 2);
|
||||
localSurfaceShape = Numerics::ror4(surfaceShape ^ static_cast<int8_t>(kTileSlopeRaisedCornersMask), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Scenery.h"
|
||||
#include "../../world/Surface.h"
|
||||
#include "../../world/tile_element/Slope.h"
|
||||
#include "../Paint.SessionFlags.h"
|
||||
#include "../Paint.h"
|
||||
#include "../VirtualFloor.h"
|
||||
#include "../support/Generic.h"
|
||||
#include "Paint.Surface.h"
|
||||
#include "Segment.h"
|
||||
|
||||
@@ -364,7 +364,7 @@ void PaintUtilSetGeneralSupportHeight(PaintSession& session, int16_t height)
|
||||
return;
|
||||
}
|
||||
|
||||
PaintUtilForceSetGeneralSupportHeight(session, height, SLOPE_FLAG_ABOVE_TRACK_OR_SCENERY);
|
||||
PaintUtilForceSetGeneralSupportHeight(session, height, kTileSlopeAboveTrackOrScenery);
|
||||
}
|
||||
|
||||
void PaintUtilForceSetGeneralSupportHeight(PaintSession& session, int16_t height, uint8_t slope)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/TileElement.h"
|
||||
#include "../world/Wall.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "EntryList.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
@@ -74,7 +75,7 @@ bool RCT12TileElementBase::IsGhost() const
|
||||
|
||||
uint8_t RCT12SurfaceElement::GetSlope() const
|
||||
{
|
||||
return (Slope & kTileElementSurfaceSlopeMask);
|
||||
return (Slope & kTileSlopeMask);
|
||||
}
|
||||
|
||||
uint32_t RCT12SurfaceElement::GetSurfaceStyle() const
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "../world/Scenery.h"
|
||||
#include "../world/Surface.h"
|
||||
#include "../world/Wall.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "Ride.h"
|
||||
#include "RideData.h"
|
||||
#include "Track.h"
|
||||
@@ -1524,10 +1525,10 @@ static GameActions::Result TrackDesignPlaceMaze(
|
||||
if (surfaceElement == nullptr)
|
||||
continue;
|
||||
int16_t surfaceZ = surfaceElement->GetBaseZ();
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
surfaceZ += LAND_HEIGHT_STEP;
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
surfaceZ += LAND_HEIGHT_STEP;
|
||||
}
|
||||
@@ -1690,10 +1691,10 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi
|
||||
}
|
||||
|
||||
int32_t surfaceZ = surfaceElement->GetBaseZ();
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
surfaceZ += LAND_HEIGHT_STEP;
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
surfaceZ += LAND_HEIGHT_STEP;
|
||||
}
|
||||
@@ -2111,7 +2112,7 @@ static void TrackDesignPreviewClearMap()
|
||||
auto* element = &tileElements.emplace_back();
|
||||
element->ClearAs(TileElementType::Surface);
|
||||
element->SetLastForTile(true);
|
||||
element->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||
element->AsSurface()->SetSlope(kTileSlopeFlat);
|
||||
element->AsSurface()->SetWaterHeight(0);
|
||||
element->AsSurface()->SetSurfaceObjectIndex(0);
|
||||
element->AsSurface()->SetEdgeObjectIndex(0);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "../../paint/track/Segment.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../../world/Surface.h"
|
||||
#include "../../world/tile_element/Slope.h"
|
||||
#include "../RideData.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
@@ -460,7 +461,7 @@ static bool MiniGolfPaintUtilShouldDrawFence(PaintSession& session, const TrackE
|
||||
return true;
|
||||
}
|
||||
|
||||
if (surfaceElement->GetSlope() != TILE_ELEMENT_SLOPE_FLAT)
|
||||
if (surfaceElement->GetSlope() != kTileSlopeFlat)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "../openrct2/Cheats.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../ride/RideData.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "Park.h"
|
||||
#include "Scenery.h"
|
||||
#include "Surface.h"
|
||||
@@ -202,8 +203,8 @@ GameActions::Result MapCanConstructWithClearAt(
|
||||
}
|
||||
|
||||
// Only allow building crossings directly on a flat surface tile.
|
||||
if (tileElement->GetType() == TileElementType::Surface
|
||||
&& (tileElement->AsSurface()->GetSlope()) == TILE_ELEMENT_SLOPE_FLAT && tileElement->GetBaseZ() == pos.baseZ)
|
||||
if (tileElement->GetType() == TileElementType::Surface && (tileElement->AsSurface()->GetSlope()) == kTileSlopeFlat
|
||||
&& tileElement->GetBaseZ() == pos.baseZ)
|
||||
{
|
||||
canBuildCrossing = true;
|
||||
}
|
||||
@@ -223,28 +224,28 @@ GameActions::Result MapCanConstructWithClearAt(
|
||||
auto southZ = northZ;
|
||||
auto westZ = northZ;
|
||||
const auto slope = tileElement->AsSurface()->GetSlope();
|
||||
if (slope & TILE_ELEMENT_SLOPE_N_CORNER_UP)
|
||||
if (slope & kTileSlopeNCornerUp)
|
||||
{
|
||||
northZ += LAND_HEIGHT_STEP;
|
||||
if (slope == (TILE_ELEMENT_SLOPE_S_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT))
|
||||
if (slope == (kTileSlopeSCornerDown | kTileSlopeDiagonalFlag))
|
||||
northZ += LAND_HEIGHT_STEP;
|
||||
}
|
||||
if (slope & TILE_ELEMENT_SLOPE_E_CORNER_UP)
|
||||
if (slope & kTileSlopeECornerUp)
|
||||
{
|
||||
eastZ += LAND_HEIGHT_STEP;
|
||||
if (slope == (TILE_ELEMENT_SLOPE_W_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT))
|
||||
if (slope == (kTileSlopeWCornerDown | kTileSlopeDiagonalFlag))
|
||||
eastZ += LAND_HEIGHT_STEP;
|
||||
}
|
||||
if (slope & TILE_ELEMENT_SLOPE_S_CORNER_UP)
|
||||
if (slope & kTileSlopeSCornerUp)
|
||||
{
|
||||
southZ += LAND_HEIGHT_STEP;
|
||||
if (slope == (TILE_ELEMENT_SLOPE_N_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT))
|
||||
if (slope == (kTileSlopeNCornerDown | kTileSlopeDiagonalFlag))
|
||||
southZ += LAND_HEIGHT_STEP;
|
||||
}
|
||||
if (slope & TILE_ELEMENT_SLOPE_W_CORNER_UP)
|
||||
if (slope & kTileSlopeWCornerUp)
|
||||
{
|
||||
westZ += LAND_HEIGHT_STEP;
|
||||
if (slope == (TILE_ELEMENT_SLOPE_E_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT))
|
||||
if (slope == (kTileSlopeECornerDown | kTileSlopeDiagonalFlag))
|
||||
westZ += LAND_HEIGHT_STEP;
|
||||
}
|
||||
const auto baseHeight = pos.baseZ + (4 * COORDS_Z_STEP);
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "../ride/Track.h"
|
||||
#include "../ride/TrackData.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "Location.hpp"
|
||||
#include "Map.h"
|
||||
#include "MapAnimation.h"
|
||||
@@ -180,8 +181,7 @@ money64 FootpathProvisionalSet(
|
||||
VirtualFloorSetHeight(0);
|
||||
}
|
||||
else if (
|
||||
gFootpathConstructSlope == TILE_ELEMENT_SLOPE_FLAT
|
||||
|| gProvisionalFootpath.Position.z < gFootpathConstructFromPosition.z)
|
||||
gFootpathConstructSlope == kTileSlopeFlat || gProvisionalFootpath.Position.z < gFootpathConstructFromPosition.z)
|
||||
{
|
||||
// Going either straight on, or down.
|
||||
VirtualFloorSetHeight(gProvisionalFootpath.Position.z);
|
||||
|
||||
+50
-49
@@ -42,6 +42,7 @@
|
||||
#include "../util/Util.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../world/TilePointerIndex.hpp"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "Banner.h"
|
||||
#include "Climate.h"
|
||||
#include "Footpath.h"
|
||||
@@ -163,7 +164,7 @@ static TileElement GetDefaultSurfaceElement()
|
||||
el.BaseHeight = 14;
|
||||
el.ClearanceHeight = 14;
|
||||
el.AsSurface()->SetWaterHeight(0);
|
||||
el.AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||
el.AsSurface()->SetSlope(kTileSlopeFlat);
|
||||
el.AsSurface()->SetGrassLength(GRASS_LENGTH_CLEAR_0);
|
||||
el.AsSurface()->SetOwnership(OWNERSHIP_UNOWNED);
|
||||
el.AsSurface()->SetParkFences(0);
|
||||
@@ -563,9 +564,9 @@ int16_t TileElementHeight(const CoordsXYZ& loc, uint8_t slope)
|
||||
|
||||
auto height = loc.z;
|
||||
|
||||
uint8_t extra_height = (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) >> 4; // 0x10 is the 5th bit - sets slope to double height
|
||||
uint8_t extra_height = (slope & kTileSlopeDiagonalFlag) >> 4; // 0x10 is the 5th bit - sets slope to double height
|
||||
// Remove the extra height bit
|
||||
slope &= TILE_ELEMENT_SLOPE_ALL_CORNERS_UP;
|
||||
slope &= kTileSlopeRaisedCornersMask;
|
||||
|
||||
int8_t quad = 0, quad_extra = 0; // which quadrant the element is in?
|
||||
// quad_extra is for extra height tiles
|
||||
@@ -585,21 +586,21 @@ int16_t TileElementHeight(const CoordsXYZ& loc, uint8_t slope)
|
||||
// We arbitrarily take the SW corner to be closest to the viewer
|
||||
|
||||
// One corner up
|
||||
if (slope == TILE_ELEMENT_SLOPE_N_CORNER_UP || slope == TILE_ELEMENT_SLOPE_E_CORNER_UP
|
||||
|| slope == TILE_ELEMENT_SLOPE_S_CORNER_UP || slope == TILE_ELEMENT_SLOPE_W_CORNER_UP)
|
||||
if (slope == kTileSlopeNCornerUp || slope == kTileSlopeECornerUp || slope == kTileSlopeSCornerUp
|
||||
|| slope == kTileSlopeWCornerUp)
|
||||
{
|
||||
switch (slope)
|
||||
{
|
||||
case TILE_ELEMENT_SLOPE_N_CORNER_UP:
|
||||
case kTileSlopeNCornerUp:
|
||||
quad = xl + yl - TILE_SIZE;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_E_CORNER_UP:
|
||||
case kTileSlopeECornerUp:
|
||||
quad = xl - yl;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_S_CORNER_UP:
|
||||
case kTileSlopeSCornerUp:
|
||||
quad = TILE_SIZE - yl - xl;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_W_CORNER_UP:
|
||||
case kTileSlopeWCornerUp:
|
||||
quad = yl - xl;
|
||||
break;
|
||||
}
|
||||
@@ -613,39 +614,39 @@ int16_t TileElementHeight(const CoordsXYZ& loc, uint8_t slope)
|
||||
// One side up
|
||||
switch (slope)
|
||||
{
|
||||
case TILE_ELEMENT_SLOPE_NE_SIDE_UP:
|
||||
case kTileSlopeNESideUp:
|
||||
height += xl / 2;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_SE_SIDE_UP:
|
||||
case kTileSlopeSESideUp:
|
||||
height += (TILE_SIZE - yl) / 2;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_NW_SIDE_UP:
|
||||
case kTileSlopeNWSideUp:
|
||||
height += yl / 2;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_SW_SIDE_UP:
|
||||
case kTileSlopeSWSideUp:
|
||||
height += (TILE_SIZE - xl) / 2;
|
||||
break;
|
||||
}
|
||||
|
||||
// One corner down
|
||||
if ((slope == TILE_ELEMENT_SLOPE_W_CORNER_DN) || (slope == TILE_ELEMENT_SLOPE_S_CORNER_DN)
|
||||
|| (slope == TILE_ELEMENT_SLOPE_E_CORNER_DN) || (slope == TILE_ELEMENT_SLOPE_N_CORNER_DN))
|
||||
if ((slope == kTileSlopeWCornerDown) || (slope == kTileSlopeSCornerDown) || (slope == kTileSlopeECornerDown)
|
||||
|| (slope == kTileSlopeNCornerDown))
|
||||
{
|
||||
switch (slope)
|
||||
{
|
||||
case TILE_ELEMENT_SLOPE_W_CORNER_DN:
|
||||
case kTileSlopeWCornerDown:
|
||||
quad_extra = xl + TILE_SIZE - yl;
|
||||
quad = xl - yl;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_S_CORNER_DN:
|
||||
case kTileSlopeSCornerDown:
|
||||
quad_extra = xl + yl;
|
||||
quad = xl + yl - TILE_SIZE;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_E_CORNER_DN:
|
||||
case kTileSlopeECornerDown:
|
||||
quad_extra = TILE_SIZE - xl + yl;
|
||||
quad = yl - xl;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_N_CORNER_DN:
|
||||
case kTileSlopeNCornerDown:
|
||||
quad_extra = (TILE_SIZE - xl) + (TILE_SIZE - yl);
|
||||
quad = TILE_SIZE - yl - xl;
|
||||
break;
|
||||
@@ -666,14 +667,14 @@ int16_t TileElementHeight(const CoordsXYZ& loc, uint8_t slope)
|
||||
}
|
||||
|
||||
// Valleys
|
||||
if ((slope == TILE_ELEMENT_SLOPE_W_E_VALLEY) || (slope == TILE_ELEMENT_SLOPE_N_S_VALLEY))
|
||||
if ((slope == kTileSlopeWEValley) || (slope == kTileSlopeNSValley))
|
||||
{
|
||||
switch (slope)
|
||||
{
|
||||
case TILE_ELEMENT_SLOPE_W_E_VALLEY:
|
||||
case kTileSlopeWEValley:
|
||||
quad = std::abs(xl - yl);
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_N_S_VALLEY:
|
||||
case kTileSlopeNSValley:
|
||||
quad = std::abs(xl + yl - TILE_SIZE);
|
||||
break;
|
||||
}
|
||||
@@ -886,40 +887,40 @@ int32_t MapGetCornerHeight(int32_t z, int32_t slope, int32_t direction)
|
||||
switch (direction)
|
||||
{
|
||||
case 0:
|
||||
if (slope & TILE_ELEMENT_SLOPE_N_CORNER_UP)
|
||||
if (slope & kTileSlopeNCornerUp)
|
||||
{
|
||||
z += 2;
|
||||
if (slope == (TILE_ELEMENT_SLOPE_S_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT))
|
||||
if (slope == (kTileSlopeSCornerDown | kTileSlopeDiagonalFlag))
|
||||
{
|
||||
z += 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (slope & TILE_ELEMENT_SLOPE_E_CORNER_UP)
|
||||
if (slope & kTileSlopeECornerUp)
|
||||
{
|
||||
z += 2;
|
||||
if (slope == (TILE_ELEMENT_SLOPE_W_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT))
|
||||
if (slope == (kTileSlopeWCornerDown | kTileSlopeDiagonalFlag))
|
||||
{
|
||||
z += 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (slope & TILE_ELEMENT_SLOPE_S_CORNER_UP)
|
||||
if (slope & kTileSlopeSCornerUp)
|
||||
{
|
||||
z += 2;
|
||||
if (slope == (TILE_ELEMENT_SLOPE_N_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT))
|
||||
if (slope == (kTileSlopeNCornerDown | kTileSlopeDiagonalFlag))
|
||||
{
|
||||
z += 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (slope & TILE_ELEMENT_SLOPE_W_CORNER_UP)
|
||||
if (slope & kTileSlopeWCornerUp)
|
||||
{
|
||||
z += 2;
|
||||
if (slope == (TILE_ELEMENT_SLOPE_E_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT))
|
||||
if (slope == (kTileSlopeECornerDown | kTileSlopeDiagonalFlag))
|
||||
{
|
||||
z += 2;
|
||||
}
|
||||
@@ -989,9 +990,9 @@ uint8_t MapGetHighestLandHeight(const MapRange& range)
|
||||
}
|
||||
|
||||
uint8_t BaseHeight = surfaceElement->BaseHeight;
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask)
|
||||
BaseHeight += 2;
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
BaseHeight += 2;
|
||||
if (max_height < BaseHeight)
|
||||
max_height = BaseHeight;
|
||||
@@ -1384,28 +1385,28 @@ static void MapExtendBoundarySurfaceExtendTile(const SurfaceElement& sourceTile,
|
||||
destTile.SetWaterHeight(sourceTile.GetWaterHeight());
|
||||
|
||||
auto z = sourceTile.BaseHeight;
|
||||
auto slope = sourceTile.GetSlope() & TILE_ELEMENT_SLOPE_NW_SIDE_UP;
|
||||
if (slope == TILE_ELEMENT_SLOPE_NW_SIDE_UP)
|
||||
auto slope = sourceTile.GetSlope() & kTileSlopeNWSideUp;
|
||||
if (slope == kTileSlopeNWSideUp)
|
||||
{
|
||||
z += 2;
|
||||
slope = TILE_ELEMENT_SLOPE_FLAT;
|
||||
if (sourceTile.GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
slope = kTileSlopeFlat;
|
||||
if (sourceTile.GetSlope() & kTileSlopeDiagonalFlag)
|
||||
{
|
||||
slope = TILE_ELEMENT_SLOPE_N_CORNER_UP;
|
||||
if (sourceTile.GetSlope() & TILE_ELEMENT_SLOPE_S_CORNER_UP)
|
||||
slope = kTileSlopeNCornerUp;
|
||||
if (sourceTile.GetSlope() & kTileSlopeSCornerUp)
|
||||
{
|
||||
slope = TILE_ELEMENT_SLOPE_W_CORNER_UP;
|
||||
if (sourceTile.GetSlope() & TILE_ELEMENT_SLOPE_E_CORNER_UP)
|
||||
slope = kTileSlopeWCornerUp;
|
||||
if (sourceTile.GetSlope() & kTileSlopeECornerUp)
|
||||
{
|
||||
slope = TILE_ELEMENT_SLOPE_FLAT;
|
||||
slope = kTileSlopeFlat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (slope & TILE_ELEMENT_SLOPE_N_CORNER_UP)
|
||||
slope |= TILE_ELEMENT_SLOPE_E_CORNER_UP;
|
||||
if (slope & TILE_ELEMENT_SLOPE_W_CORNER_UP)
|
||||
slope |= TILE_ELEMENT_SLOPE_S_CORNER_UP;
|
||||
if (slope & kTileSlopeNCornerUp)
|
||||
slope |= kTileSlopeECornerUp;
|
||||
if (slope & kTileSlopeWCornerUp)
|
||||
slope |= kTileSlopeSCornerUp;
|
||||
|
||||
destTile.SetSlope(slope);
|
||||
destTile.BaseHeight = z;
|
||||
@@ -1463,7 +1464,7 @@ static void ClearElementAt(const CoordsXY& loc, TileElement** elementPtr)
|
||||
element->BaseHeight = kMinimumLandHeight;
|
||||
element->ClearanceHeight = kMinimumLandHeight;
|
||||
element->Owner = 0;
|
||||
element->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||
element->AsSurface()->SetSlope(kTileSlopeFlat);
|
||||
element->AsSurface()->SetSurfaceObjectIndex(0);
|
||||
element->AsSurface()->SetEdgeObjectIndex(0);
|
||||
element->AsSurface()->SetGrassLength(GRASS_LENGTH_CLEAR_0);
|
||||
@@ -1573,9 +1574,9 @@ int32_t MapGetHighestZ(const CoordsXY& loc)
|
||||
auto z = surfaceElement->GetBaseZ();
|
||||
|
||||
// Raise z so that is above highest point of land and water on tile
|
||||
if ((surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) != TILE_ELEMENT_SLOPE_FLAT)
|
||||
if ((surfaceElement->GetSlope() & kTileSlopeRaisedCornersMask) != kTileSlopeFlat)
|
||||
z += LAND_HEIGHT_STEP;
|
||||
if ((surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) != 0)
|
||||
if ((surfaceElement->GetSlope() & kTileSlopeDiagonalFlag) != 0)
|
||||
z += LAND_HEIGHT_STEP;
|
||||
|
||||
z = std::max(z, surfaceElement->GetWaterHeight());
|
||||
@@ -1873,7 +1874,7 @@ bool MapSurfaceIsBlocked(const CoordsXY& mapCoords)
|
||||
|
||||
int16_t base_z = surfaceElement->BaseHeight;
|
||||
int16_t clear_z = surfaceElement->BaseHeight + 2;
|
||||
if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (surfaceElement->GetSlope() & kTileSlopeDiagonalFlag)
|
||||
clear_z += 2;
|
||||
|
||||
auto tileElement = reinterpret_cast<TileElement*>(surfaceElement);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "../object/TerrainSurfaceObject.h"
|
||||
#include "../platform/Platform.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "Map.h"
|
||||
#include "MapHelpers.h"
|
||||
#include "Scenery.h"
|
||||
@@ -496,13 +497,13 @@ static void MapGenSetHeight(MapGenSettings* settings)
|
||||
uint8_t currentSlope = surfaceElement->GetSlope();
|
||||
|
||||
if (q00 > baseHeight)
|
||||
currentSlope |= TILE_ELEMENT_SLOPE_S_CORNER_UP;
|
||||
currentSlope |= kTileSlopeSCornerUp;
|
||||
if (q01 > baseHeight)
|
||||
currentSlope |= TILE_ELEMENT_SLOPE_W_CORNER_UP;
|
||||
currentSlope |= kTileSlopeWCornerUp;
|
||||
if (q10 > baseHeight)
|
||||
currentSlope |= TILE_ELEMENT_SLOPE_E_CORNER_UP;
|
||||
currentSlope |= kTileSlopeECornerUp;
|
||||
if (q11 > baseHeight)
|
||||
currentSlope |= TILE_ELEMENT_SLOPE_N_CORNER_UP;
|
||||
currentSlope |= kTileSlopeNCornerUp;
|
||||
|
||||
surfaceElement->SetSlope(currentSlope);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "MapHelpers.h"
|
||||
|
||||
#include "../world/tile_element/Slope.h"
|
||||
#include "Map.h"
|
||||
#include "Surface.h"
|
||||
|
||||
@@ -34,7 +35,7 @@ int32_t MapSmooth(int32_t l, int32_t t, int32_t r, int32_t b)
|
||||
auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y });
|
||||
if (surfaceElement == nullptr)
|
||||
continue;
|
||||
surfaceElement->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||
surfaceElement->SetSlope(kTileSlopeFlat);
|
||||
|
||||
// Raise to edge height - 2
|
||||
highest = surfaceElement->BaseHeight;
|
||||
@@ -124,20 +125,20 @@ int32_t MapSmooth(int32_t l, int32_t t, int32_t r, int32_t b)
|
||||
|
||||
if (doubleCorner != -1)
|
||||
{
|
||||
uint8_t slope = surfaceElement->GetSlope() | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT;
|
||||
uint8_t slope = surfaceElement->GetSlope() | kTileSlopeDiagonalFlag;
|
||||
switch (doubleCorner)
|
||||
{
|
||||
case 0:
|
||||
slope |= TILE_ELEMENT_SLOPE_N_CORNER_DN;
|
||||
slope |= kTileSlopeNCornerDown;
|
||||
break;
|
||||
case 1:
|
||||
slope |= TILE_ELEMENT_SLOPE_W_CORNER_DN;
|
||||
slope |= kTileSlopeWCornerDown;
|
||||
break;
|
||||
case 2:
|
||||
slope |= TILE_ELEMENT_SLOPE_S_CORNER_DN;
|
||||
slope |= kTileSlopeSCornerDown;
|
||||
break;
|
||||
case 3:
|
||||
slope |= TILE_ELEMENT_SLOPE_E_CORNER_DN;
|
||||
slope |= kTileSlopeECornerDown;
|
||||
break;
|
||||
}
|
||||
surfaceElement->SetSlope(slope);
|
||||
@@ -148,41 +149,41 @@ int32_t MapSmooth(int32_t l, int32_t t, int32_t r, int32_t b)
|
||||
// Corners
|
||||
auto surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 1, y + 1 });
|
||||
if (surfaceElement2 != nullptr && surfaceElement2->BaseHeight > surfaceElement->BaseHeight)
|
||||
slope |= TILE_ELEMENT_SLOPE_N_CORNER_UP;
|
||||
slope |= kTileSlopeNCornerUp;
|
||||
|
||||
surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y + 1 });
|
||||
if (surfaceElement2 != nullptr && surfaceElement2->BaseHeight > surfaceElement->BaseHeight)
|
||||
slope |= TILE_ELEMENT_SLOPE_W_CORNER_UP;
|
||||
slope |= kTileSlopeWCornerUp;
|
||||
|
||||
surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 1, y - 1 });
|
||||
if (surfaceElement2 != nullptr && surfaceElement2->BaseHeight > surfaceElement->BaseHeight)
|
||||
slope |= TILE_ELEMENT_SLOPE_E_CORNER_UP;
|
||||
slope |= kTileSlopeECornerUp;
|
||||
|
||||
surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y - 1 });
|
||||
if (surfaceElement2 != nullptr && surfaceElement2->BaseHeight > surfaceElement->BaseHeight)
|
||||
slope |= TILE_ELEMENT_SLOPE_S_CORNER_UP;
|
||||
slope |= kTileSlopeSCornerUp;
|
||||
|
||||
// Sides
|
||||
surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 1, y + 0 });
|
||||
if (surfaceElement2 != nullptr && surfaceElement2->BaseHeight > surfaceElement->BaseHeight)
|
||||
slope |= TILE_ELEMENT_SLOPE_NE_SIDE_UP;
|
||||
slope |= kTileSlopeNESideUp;
|
||||
|
||||
surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y + 0 });
|
||||
if (surfaceElement2 != nullptr && surfaceElement2->BaseHeight > surfaceElement->BaseHeight)
|
||||
slope |= TILE_ELEMENT_SLOPE_SW_SIDE_UP;
|
||||
slope |= kTileSlopeSWSideUp;
|
||||
|
||||
surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 0, y - 1 });
|
||||
if (surfaceElement2 != nullptr && surfaceElement2->BaseHeight > surfaceElement->BaseHeight)
|
||||
slope |= TILE_ELEMENT_SLOPE_SE_SIDE_UP;
|
||||
slope |= kTileSlopeSESideUp;
|
||||
|
||||
surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 0, y + 1 });
|
||||
if (surfaceElement2 != nullptr && surfaceElement2->BaseHeight > surfaceElement->BaseHeight)
|
||||
slope |= TILE_ELEMENT_SLOPE_NW_SIDE_UP;
|
||||
slope |= kTileSlopeNWSideUp;
|
||||
|
||||
// Raise
|
||||
if (slope == TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
if (slope == kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
slope = TILE_ELEMENT_SLOPE_FLAT;
|
||||
slope = kTileSlopeFlat;
|
||||
surfaceElement->BaseHeight = surfaceElement->ClearanceHeight += 2;
|
||||
}
|
||||
surfaceElement->SetSlope(slope);
|
||||
@@ -262,19 +263,19 @@ int32_t TileSmooth(const TileCoordsXY& tileCoords)
|
||||
int8_t thresholdS = std::clamp(neighbourHeightOffset.SE, 0, 1) + std::clamp(neighbourHeightOffset.S, 0, 1)
|
||||
+ std::clamp(neighbourHeightOffset.SW, 0, 1);
|
||||
|
||||
uint8_t slope = TILE_ELEMENT_SLOPE_FLAT;
|
||||
uint8_t slope = kTileSlopeFlat;
|
||||
slope |= (thresholdW >= 1) ? SLOPE_W_THRESHOLD_FLAGS : 0;
|
||||
slope |= (thresholdN >= 1) ? SLOPE_N_THRESHOLD_FLAGS : 0;
|
||||
slope |= (thresholdE >= 1) ? SLOPE_E_THRESHOLD_FLAGS : 0;
|
||||
slope |= (thresholdS >= 1) ? SLOPE_S_THRESHOLD_FLAGS : 0;
|
||||
|
||||
// Set diagonal when three corners (one corner down) have been raised, and the middle one can be raised one more
|
||||
if ((slope == TILE_ELEMENT_SLOPE_W_CORNER_DN && neighbourHeightOffset.W >= 4)
|
||||
|| (slope == TILE_ELEMENT_SLOPE_S_CORNER_DN && neighbourHeightOffset.S >= 4)
|
||||
|| (slope == TILE_ELEMENT_SLOPE_E_CORNER_DN && neighbourHeightOffset.E >= 4)
|
||||
|| (slope == TILE_ELEMENT_SLOPE_N_CORNER_DN && neighbourHeightOffset.N >= 4))
|
||||
if ((slope == kTileSlopeWCornerDown && neighbourHeightOffset.W >= 4)
|
||||
|| (slope == kTileSlopeSCornerDown && neighbourHeightOffset.S >= 4)
|
||||
|| (slope == kTileSlopeECornerDown && neighbourHeightOffset.E >= 4)
|
||||
|| (slope == kTileSlopeNCornerDown && neighbourHeightOffset.N >= 4))
|
||||
{
|
||||
slope |= TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT;
|
||||
slope |= kTileSlopeDiagonalFlag;
|
||||
}
|
||||
|
||||
// Check if the calculated slope is the same already
|
||||
@@ -284,10 +285,10 @@ int32_t TileSmooth(const TileCoordsXY& tileCoords)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) == TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
if ((slope & kTileSlopeRaisedCornersMask) == kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
// All corners are raised, raise the entire tile instead.
|
||||
surfaceElement->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||
surfaceElement->SetSlope(kTileSlopeFlat);
|
||||
surfaceElement->BaseHeight = (surfaceElement->ClearanceHeight += 2);
|
||||
if (surfaceElement->GetWaterHeight() <= surfaceElement->GetBaseZ())
|
||||
{
|
||||
@@ -300,9 +301,9 @@ int32_t TileSmooth(const TileCoordsXY& tileCoords)
|
||||
surfaceElement->SetSlope(slope);
|
||||
|
||||
// Set correct clearance height
|
||||
if (slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (slope & kTileSlopeDiagonalFlag)
|
||||
surfaceElement->ClearanceHeight = surfaceElement->BaseHeight + 4;
|
||||
else if (slope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
else if (slope & kTileSlopeRaisedCornersMask)
|
||||
surfaceElement->ClearanceHeight = surfaceElement->BaseHeight + 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "Location.hpp"
|
||||
#include "Map.h"
|
||||
#include "tile_element/Slope.h"
|
||||
|
||||
ObjectEntryIndex SurfaceElement::GetSurfaceObjectIndex() const
|
||||
{
|
||||
@@ -135,7 +136,7 @@ void SurfaceElement::UpdateGrassLength(const CoordsXY& coords)
|
||||
|
||||
int32_t baseZ = GetBaseZ();
|
||||
int32_t clearZ = GetBaseZ() + LAND_HEIGHT_STEP;
|
||||
if (Slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)
|
||||
if (Slope & kTileSlopeDiagonalFlag)
|
||||
clearZ += LAND_HEIGHT_STEP;
|
||||
|
||||
// Check objects above grass
|
||||
|
||||
@@ -85,36 +85,5 @@ enum
|
||||
OWNERSHIP_AVAILABLE = (1 << 7)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TILE_ELEMENT_SLOPE_FLAT = 0x00,
|
||||
TILE_ELEMENT_SLOPE_ALL_CORNERS_UP = 0x0F,
|
||||
|
||||
TILE_ELEMENT_SLOPE_N_CORNER_UP = (1 << 0),
|
||||
TILE_ELEMENT_SLOPE_E_CORNER_UP = (1 << 1),
|
||||
TILE_ELEMENT_SLOPE_S_CORNER_UP = (1 << 2),
|
||||
TILE_ELEMENT_SLOPE_W_CORNER_UP = (1 << 3),
|
||||
TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT = (1 << 4),
|
||||
|
||||
TILE_ELEMENT_SLOPE_W_CORNER_DN = TILE_ELEMENT_SLOPE_ALL_CORNERS_UP & ~TILE_ELEMENT_SLOPE_W_CORNER_UP,
|
||||
TILE_ELEMENT_SLOPE_S_CORNER_DN = TILE_ELEMENT_SLOPE_ALL_CORNERS_UP & ~TILE_ELEMENT_SLOPE_S_CORNER_UP,
|
||||
TILE_ELEMENT_SLOPE_E_CORNER_DN = TILE_ELEMENT_SLOPE_ALL_CORNERS_UP & ~TILE_ELEMENT_SLOPE_E_CORNER_UP,
|
||||
TILE_ELEMENT_SLOPE_N_CORNER_DN = TILE_ELEMENT_SLOPE_ALL_CORNERS_UP & ~TILE_ELEMENT_SLOPE_N_CORNER_UP,
|
||||
|
||||
TILE_ELEMENT_SLOPE_NE_SIDE_UP = TILE_ELEMENT_SLOPE_N_CORNER_UP | TILE_ELEMENT_SLOPE_E_CORNER_UP,
|
||||
TILE_ELEMENT_SLOPE_SE_SIDE_UP = TILE_ELEMENT_SLOPE_E_CORNER_UP | TILE_ELEMENT_SLOPE_S_CORNER_UP,
|
||||
TILE_ELEMENT_SLOPE_NW_SIDE_UP = TILE_ELEMENT_SLOPE_N_CORNER_UP | TILE_ELEMENT_SLOPE_W_CORNER_UP,
|
||||
TILE_ELEMENT_SLOPE_SW_SIDE_UP = TILE_ELEMENT_SLOPE_S_CORNER_UP | TILE_ELEMENT_SLOPE_W_CORNER_UP,
|
||||
|
||||
TILE_ELEMENT_SLOPE_W_E_VALLEY = TILE_ELEMENT_SLOPE_E_CORNER_UP | TILE_ELEMENT_SLOPE_W_CORNER_UP,
|
||||
TILE_ELEMENT_SLOPE_N_S_VALLEY = TILE_ELEMENT_SLOPE_N_CORNER_UP | TILE_ELEMENT_SLOPE_S_CORNER_UP
|
||||
};
|
||||
|
||||
// Surface
|
||||
constexpr uint8_t kTileElementSurfaceDiagonalFlag = 0x10; // in TileElement.properties.surface.slope
|
||||
constexpr uint8_t kTileElementSurfaceRaisedCornersMask = 0x0F; // in TileElement.properties.surface.slope
|
||||
constexpr uint8_t kTileElementSurfaceSlopeMask
|
||||
= (kTileElementSurfaceDiagonalFlag | kTileElementSurfaceRaisedCornersMask); // in TileElement.properties.surface.slope
|
||||
|
||||
constexpr uint8_t kTileElementSurfaceOwnershipMask = 0xF0;
|
||||
constexpr uint8_t kTileElementSurfaceParkFenceMask = 0x0F;
|
||||
+498
-545
File diff suppressed because it is too large.
Load diff
@@ -18,6 +18,7 @@
|
||||
#include "Banner.h"
|
||||
#include "Location.hpp"
|
||||
#include "Scenery.h"
|
||||
#include "tile_element/Slope.h"
|
||||
|
||||
bool TileElementIsUnderground(TileElement* tileElement)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "Park.h"
|
||||
#include "Scenery.h"
|
||||
#include "Surface.h"
|
||||
#include "tile_element/Slope.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
@@ -523,24 +524,24 @@ namespace OpenRCT2::TileInspector
|
||||
uint8_t newSlope = surfaceElement->GetSlope() ^ (1 << cornerIndex);
|
||||
|
||||
// All corners are raised
|
||||
if ((newSlope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) == TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
if ((newSlope & kTileSlopeRaisedCornersMask) == kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
newSlope = TILE_ELEMENT_SLOPE_FLAT;
|
||||
if ((originalSlope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) != 0)
|
||||
newSlope = kTileSlopeFlat;
|
||||
if ((originalSlope & kTileSlopeDiagonalFlag) != 0)
|
||||
{
|
||||
switch (originalSlope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP)
|
||||
switch (originalSlope & kTileSlopeRaisedCornersMask)
|
||||
{
|
||||
case TILE_ELEMENT_SLOPE_S_CORNER_DN:
|
||||
newSlope |= TILE_ELEMENT_SLOPE_N_CORNER_UP;
|
||||
case kTileSlopeSCornerDown:
|
||||
newSlope |= kTileSlopeNCornerUp;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_W_CORNER_DN:
|
||||
newSlope |= TILE_ELEMENT_SLOPE_E_CORNER_UP;
|
||||
case kTileSlopeWCornerDown:
|
||||
newSlope |= kTileSlopeECornerUp;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_N_CORNER_DN:
|
||||
newSlope |= TILE_ELEMENT_SLOPE_S_CORNER_UP;
|
||||
case kTileSlopeNCornerDown:
|
||||
newSlope |= kTileSlopeSCornerUp;
|
||||
break;
|
||||
case TILE_ELEMENT_SLOPE_E_CORNER_DN:
|
||||
newSlope |= TILE_ELEMENT_SLOPE_W_CORNER_UP;
|
||||
case kTileSlopeECornerDown:
|
||||
newSlope |= kTileSlopeWCornerUp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -566,7 +567,7 @@ namespace OpenRCT2::TileInspector
|
||||
|
||||
if (isExecuting)
|
||||
{
|
||||
uint8_t newSlope = surfaceElement->GetSlope() ^ TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT;
|
||||
uint8_t newSlope = surfaceElement->GetSlope() ^ kTileSlopeDiagonalFlag;
|
||||
surfaceElement->SetSlope(newSlope);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2024 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
constexpr uint8_t kTileSlopeFlat = 0;
|
||||
constexpr uint8_t kTileSlopeNCornerUp = 0b00000001;
|
||||
constexpr uint8_t kTileSlopeECornerUp = 0b00000010;
|
||||
constexpr uint8_t kTileSlopeSCornerUp = 0b00000100;
|
||||
constexpr uint8_t kTileSlopeWCornerUp = 0b00001000;
|
||||
constexpr uint8_t kTileSlopeRaisedCornersMask = 0b00001111;
|
||||
constexpr uint8_t kTileSlopeDiagonalFlag = 0b00010000;
|
||||
constexpr uint8_t kTileSlopeMask = (kTileSlopeDiagonalFlag | kTileSlopeRaisedCornersMask);
|
||||
constexpr uint8_t kTileSlopeAboveTrackOrScenery = 0b00100000;
|
||||
|
||||
constexpr uint8_t kTileSlopeWCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeWCornerUp;
|
||||
constexpr uint8_t kTileSlopeSCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeSCornerUp;
|
||||
constexpr uint8_t kTileSlopeECornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeECornerUp;
|
||||
constexpr uint8_t kTileSlopeNCornerDown = kTileSlopeRaisedCornersMask & ~kTileSlopeNCornerUp;
|
||||
|
||||
constexpr uint8_t kTileSlopeNESideUp = kTileSlopeNCornerUp | kTileSlopeECornerUp;
|
||||
constexpr uint8_t kTileSlopeSESideUp = kTileSlopeECornerUp | kTileSlopeSCornerUp;
|
||||
constexpr uint8_t kTileSlopeNWSideUp = kTileSlopeNCornerUp | kTileSlopeWCornerUp;
|
||||
constexpr uint8_t kTileSlopeSWSideUp = kTileSlopeSCornerUp | kTileSlopeWCornerUp;
|
||||
|
||||
constexpr uint8_t kTileSlopeWEValley = kTileSlopeECornerUp | kTileSlopeWCornerUp;
|
||||
constexpr uint8_t kTileSlopeNSValley = kTileSlopeNCornerUp | kTileSlopeSCornerUp;
|
||||
Reference in new issue
Block a user