mirror of https://github.com/OpenRCT2/OpenRCT2.git
Compare commits
10 Commits
f44d42d34f
...
d4120fbd97
Author | SHA1 | Date |
---|---|---|
spacek531 | d4120fbd97 | |
Aaron van Geffen | 81e068c7b2 | |
Aaron van Geffen | a61a561d01 | |
Aaron van Geffen | a627cf7a1e | |
Aaron van Geffen | ca6f142a97 | |
Michael Steenbeek | ca1118c2f1 | |
Aaron van Geffen | 779e65d8b2 | |
Aaron van Geffen | 73c592b137 | |
Spacek531 | 8da2c36ea5 | |
Spacek531 | 9e30512cb9 |
|
@ -17,7 +17,6 @@
|
|||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/actions/CheatSetAction.h>
|
||||
#include <openrct2/actions/ParkSetDateAction.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/localisation/Date.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/localisation/Currency.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/actions/ParkSetLoanAction.h>
|
||||
#include <openrct2/actions/ParkSetResearchFundingAction.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/localisation/Date.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <openrct2/management/Finance.h>
|
||||
#include <openrct2/management/NewsItem.h>
|
||||
#include <openrct2/peep/PeepAnimationData.h>
|
||||
#include <openrct2/peep/PeepSpriteIds.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -296,15 +297,18 @@ static Widget window_game_bottom_toolbar_widgets[] =
|
|||
auto* guest = peep->As<Guest>();
|
||||
if (guest != nullptr)
|
||||
{
|
||||
if (image_id_base >= 0x2A1D && image_id_base < 0x2A3D)
|
||||
if (image_id_base >= kPeepSpriteBalloonStateWatchRideId
|
||||
&& image_id_base < kPeepSpriteBalloonStateSittingIdleId + 4)
|
||||
{
|
||||
GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->BalloonColour), clipCoords);
|
||||
}
|
||||
else if (image_id_base >= 0x2BBD && image_id_base < 0x2BDD)
|
||||
if (image_id_base >= kPeepSpriteUmbrellaStateNoneId
|
||||
&& image_id_base < kPeepSpriteUmbrellaStateSittingIdleId + 4)
|
||||
{
|
||||
GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->UmbrellaColour), clipCoords);
|
||||
}
|
||||
else if (image_id_base >= 0x29DD && image_id_base < 0x29FD)
|
||||
if (image_id_base >= kPeepSpriteHatStateWatchRideId
|
||||
&& image_id_base < kPeepSpriteHatStateSittingIdleId + 4)
|
||||
{
|
||||
GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->HatColour), clipCoords);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <openrct2/management/Marketing.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/peep/PeepAnimationData.h>
|
||||
#include <openrct2/peep/PeepSpriteIds.h>
|
||||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/ShopItem.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
|
@ -561,19 +562,21 @@ static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT);
|
|||
if (guest != nullptr)
|
||||
{
|
||||
// If holding a balloon
|
||||
if (animationFrame >= 0x2A1D && animationFrame < 0x2A3D)
|
||||
if (animationFrame >= kPeepSpriteBalloonStateWatchRideId
|
||||
&& animationFrame < kPeepSpriteBalloonStateSittingIdleId + 4)
|
||||
{
|
||||
GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->BalloonColour), screenCoords);
|
||||
}
|
||||
|
||||
// If holding umbrella
|
||||
if (animationFrame >= 0x2BBD && animationFrame < 0x2BDD)
|
||||
if (animationFrame >= kPeepSpriteUmbrellaStateNoneId
|
||||
&& animationFrame < kPeepSpriteUmbrellaStateSittingIdleId + 4)
|
||||
{
|
||||
GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->UmbrellaColour), screenCoords);
|
||||
}
|
||||
|
||||
// If wearing hat
|
||||
if (animationFrame >= 0x29DD && animationFrame < 0x29FD)
|
||||
if (animationFrame >= kPeepSpriteHatStateWatchRideId && animationFrame < kPeepSpriteHatStateSittingIdleId + 4)
|
||||
{
|
||||
GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->HatColour), screenCoords);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/entity/EntityRegistry.h>
|
||||
#include <openrct2/entity/Guest.h>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/actions/RideDemolishAction.h>
|
||||
#include <openrct2/actions/RideSetStatusAction.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
#include <openrct2/sprites.h>
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <openrct2/ParkImporter.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
#include <openrct2/actions/LoadOrQuitAction.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "GameState.h"
|
||||
#include "actions/CheatSetAction.h"
|
||||
#include "actions/ParkSetLoanAction.h"
|
||||
#include "config/Config.h"
|
||||
#include "core/DataSerialiser.h"
|
||||
#include "localisation/Localisation.h"
|
||||
#include "network/network.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "core/Path.hpp"
|
||||
#include "core/String.hpp"
|
||||
#include "platform/Platform.h"
|
||||
#include "util/Util.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "../Context.h"
|
||||
#include "../GameState.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/MemoryStream.h"
|
||||
#include "../drawing/Drawing.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../OpenRCT2.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../drawing/Font.h"
|
||||
#include "../platform/Platform.h"
|
||||
|
||||
#include <cstring>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "../Game.h"
|
||||
#include "../GameState.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../config/ConfigTypes.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../entity/EntityRegistry.h"
|
||||
#include "../network/network.h"
|
||||
|
|
|
@ -10,19 +10,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "../core/String.hpp"
|
||||
#include "../drawing/Drawing.h"
|
||||
#include "../localisation/Currency.h"
|
||||
#include "../localisation/CurrencyTypes.h"
|
||||
#include "ConfigTypes.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
|
||||
enum class MeasurementFormat : int32_t;
|
||||
enum class TemperatureUnit : int32_t;
|
||||
enum class ScaleQuality : int32_t;
|
||||
enum class Sort : int32_t;
|
||||
enum class VirtualFloorStyles : int32_t;
|
||||
enum class DrawingEngine : int32_t;
|
||||
enum class TitleMusicKind : int32_t;
|
||||
struct Gx;
|
||||
|
||||
struct GeneralConfiguration
|
||||
{
|
||||
|
@ -221,43 +215,6 @@ struct PluginConfiguration
|
|||
u8string AllowedHosts;
|
||||
};
|
||||
|
||||
enum class Sort : int32_t
|
||||
{
|
||||
NameAscending,
|
||||
NameDescending,
|
||||
DateAscending,
|
||||
DateDescending,
|
||||
};
|
||||
|
||||
enum class TemperatureUnit : int32_t
|
||||
{
|
||||
Celsius,
|
||||
Fahrenheit
|
||||
};
|
||||
|
||||
enum class ScaleQuality : int32_t
|
||||
{
|
||||
NearestNeighbour,
|
||||
Linear,
|
||||
SmoothNearestNeighbour
|
||||
};
|
||||
|
||||
enum class MeasurementFormat : int32_t
|
||||
{
|
||||
Imperial,
|
||||
Metric,
|
||||
SI
|
||||
};
|
||||
|
||||
enum class TitleMusicKind : int32_t
|
||||
{
|
||||
None,
|
||||
Random,
|
||||
OpenRCT2,
|
||||
RCT1,
|
||||
RCT2,
|
||||
};
|
||||
|
||||
extern GeneralConfiguration gConfigGeneral;
|
||||
extern InterfaceConfiguration gConfigInterface;
|
||||
extern SoundConfiguration gConfigSound;
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/*****************************************************************************
|
||||
* 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>
|
||||
|
||||
enum class MeasurementFormat : int32_t;
|
||||
enum class TemperatureUnit : int32_t;
|
||||
enum class CurrencyType : uint8_t;
|
||||
enum class ScaleQuality : int32_t;
|
||||
enum class Sort : int32_t;
|
||||
enum class VirtualFloorStyles : int32_t;
|
||||
enum class DrawingEngine : int32_t;
|
||||
enum class TitleMusicKind : int32_t;
|
||||
|
||||
enum class Sort : int32_t
|
||||
{
|
||||
NameAscending,
|
||||
NameDescending,
|
||||
DateAscending,
|
||||
DateDescending,
|
||||
};
|
||||
|
||||
enum class TemperatureUnit : int32_t
|
||||
{
|
||||
Celsius,
|
||||
Fahrenheit
|
||||
};
|
||||
|
||||
enum class ScaleQuality : int32_t
|
||||
{
|
||||
NearestNeighbour,
|
||||
Linear,
|
||||
SmoothNearestNeighbour
|
||||
};
|
||||
|
||||
enum class MeasurementFormat : int32_t
|
||||
{
|
||||
Imperial,
|
||||
Metric,
|
||||
SI
|
||||
};
|
||||
|
||||
enum class TitleMusicKind : int32_t
|
||||
{
|
||||
None,
|
||||
Random,
|
||||
OpenRCT2,
|
||||
RCT1,
|
||||
RCT2,
|
||||
};
|
|
@ -10,7 +10,6 @@
|
|||
#include "NewDrawing.h"
|
||||
|
||||
#include "../Context.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../drawing/Drawing.h"
|
||||
#include "../interface/Screenshot.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
# include "../OpenRCT2.h"
|
||||
# include "../core/Numerics.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../drawing/Font.h"
|
||||
# include "../localisation/LocalisationService.h"
|
||||
# include "../platform/Platform.h"
|
||||
# include "../util/Util.h"
|
||||
# include "DrawingLock.hpp"
|
||||
# include "TTF.h"
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include "../Input.h"
|
||||
#include "../actions/StaffSetOrdersAction.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/DataSerialiser.h"
|
||||
#include "../entity/EntityRegistry.h"
|
||||
#include "../interface/Viewport.h"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "../PlatformEnvironment.h"
|
||||
#include "../actions/CheatSetAction.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/File.h"
|
||||
#include "../core/Imaging.h"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../Context.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../config/ConfigTypes.h"
|
||||
#include "../platform/Platform.h"
|
||||
#include "../scripting/ScriptEngine.h"
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@
|
|||
<ClInclude Include="common.h" />
|
||||
<ClInclude Include="config\Config.h" />
|
||||
<ClInclude Include="config\ConfigEnum.hpp" />
|
||||
<ClInclude Include="config\ConfigTypes.h" />
|
||||
<ClInclude Include="config\IniReader.hpp" />
|
||||
<ClInclude Include="config\IniWriter.hpp" />
|
||||
<ClInclude Include="Context.h" />
|
||||
|
@ -278,6 +279,7 @@
|
|||
<ClInclude Include="Limits.h" />
|
||||
<ClInclude Include="localisation\ConversionTables.h" />
|
||||
<ClInclude Include="localisation\Currency.h" />
|
||||
<ClInclude Include="localisation\CurrencyTypes.h" />
|
||||
<ClInclude Include="localisation\Date.h" />
|
||||
<ClInclude Include="localisation\FormatCodes.h" />
|
||||
<ClInclude Include="localisation\Formatter.h" />
|
||||
|
@ -338,6 +340,7 @@
|
|||
<ClInclude Include="object\ObjectTypes.h" />
|
||||
<ClInclude Include="object\ResourceTable.h" />
|
||||
<ClInclude Include="object\RideObject.h" />
|
||||
<ClInclude Include="object\SceneryBoundingBox.h" />
|
||||
<ClInclude Include="object\SceneryGroupEntry.h" />
|
||||
<ClInclude Include="object\SceneryGroupObject.h" />
|
||||
<ClInclude Include="object\SceneryObject.h" />
|
||||
|
@ -848,6 +851,7 @@
|
|||
<ClCompile Include="object\ObjectTypes.cpp" />
|
||||
<ClCompile Include="object\ResourceTable.cpp" />
|
||||
<ClCompile Include="object\RideObject.cpp" />
|
||||
<ClCompile Include="object\SceneryBoundingBox.cpp" />
|
||||
<ClCompile Include="object\SceneryGroupObject.cpp" />
|
||||
<ClCompile Include="object\SmallSceneryObject.cpp" />
|
||||
<ClCompile Include="object\StationObject.cpp" />
|
||||
|
@ -1074,4 +1078,4 @@
|
|||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
</Project>
|
|
@ -12,38 +12,7 @@
|
|||
#include "../common.h"
|
||||
#include "../core/String.hpp"
|
||||
#include "../util/Util.h"
|
||||
|
||||
// List of currencies
|
||||
enum class CurrencyType : uint8_t
|
||||
{
|
||||
Pounds, // British Pound
|
||||
Dollars, // US Dollar
|
||||
Franc, // French Franc
|
||||
DeutscheMark, // Deutsche Mark
|
||||
Yen, // Japanese Yen
|
||||
Peseta, // Spanish Peseta
|
||||
Lira, // Italian Lira
|
||||
Guilders, // Dutch Gilder
|
||||
Krona, // Swedish Krona
|
||||
Euros, // Euro
|
||||
Won, // South Korean Won
|
||||
Rouble, // Russian Rouble
|
||||
CzechKoruna, // Czech koruna
|
||||
HKD, // Hong Kong Dollar
|
||||
TWD, // New Taiwan Dollar
|
||||
Yuan, // Chinese Yuan
|
||||
Forint, // Hungarian Forint
|
||||
|
||||
Custom, // Custom currency
|
||||
|
||||
Count // Last item
|
||||
};
|
||||
|
||||
enum class CurrencyAffix
|
||||
{
|
||||
Prefix,
|
||||
Suffix
|
||||
};
|
||||
#include "CurrencyTypes.h"
|
||||
|
||||
#define CURRENCY_SYMBOL_MAX_SIZE 8
|
||||
#define CURRENCY_RATE_MAX_NUM_DIGITS 9
|
||||
|
@ -62,6 +31,7 @@ struct CurrencyDescriptor
|
|||
};
|
||||
|
||||
// List of currency formats
|
||||
// TODO: refactor into getter
|
||||
extern CurrencyDescriptor CurrencyDescriptors[EnumValue(CurrencyType::Count)];
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*****************************************************************************
|
||||
* 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>
|
||||
|
||||
// List of currencies
|
||||
enum class CurrencyType : uint8_t
|
||||
{
|
||||
Pounds, // British Pound
|
||||
Dollars, // US Dollar
|
||||
Franc, // French Franc
|
||||
DeutscheMark, // Deutsche Mark
|
||||
Yen, // Japanese Yen
|
||||
Peseta, // Spanish Peseta
|
||||
Lira, // Italian Lira
|
||||
Guilders, // Dutch Gilder
|
||||
Krona, // Swedish Krona
|
||||
Euros, // Euro
|
||||
Won, // South Korean Won
|
||||
Rouble, // Russian Rouble
|
||||
CzechKoruna, // Czech koruna
|
||||
HKD, // Hong Kong Dollar
|
||||
TWD, // New Taiwan Dollar
|
||||
Yuan, // Chinese Yuan
|
||||
Forint, // Hungarian Forint
|
||||
|
||||
Custom, // Custom currency
|
||||
|
||||
Count // Last item
|
||||
};
|
||||
|
||||
enum class CurrencyAffix
|
||||
{
|
||||
Prefix,
|
||||
Suffix
|
||||
};
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../config/Config.h"
|
||||
#include "../util/Util.h"
|
||||
#include "Currency.h"
|
||||
#include "Formatter.h"
|
||||
#include "Localisation.h"
|
||||
#include "StringIds.h"
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "../management/Marketing.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../util/Util.h"
|
||||
#include "Currency.h"
|
||||
#include "Date.h"
|
||||
#include "Formatting.h"
|
||||
#include "Localisation.h"
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "../management/Marketing.h"
|
||||
#include "Currency.h"
|
||||
#include "Date.h"
|
||||
#include "FormatCodes.h"
|
||||
#include "Language.h"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "../common.h"
|
||||
#include "../interface/Cursors.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "../world/Scenery.h"
|
||||
#include "ObjectTypes.h"
|
||||
|
||||
struct LargeSceneryText;
|
||||
|
@ -23,6 +24,8 @@ struct LargeSceneryTile
|
|||
uint8_t z_clearance;
|
||||
// CCCC WWWW 0SS0 0000
|
||||
uint16_t flags;
|
||||
SceneryBoundBoxes boundBoxes = {};
|
||||
CoordsXYZ spriteOffset = {};
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
|
@ -19,9 +19,53 @@
|
|||
#include "../localisation/Language.h"
|
||||
#include "../world/Banner.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "SceneryBoundingBox.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
static DefaultBoundingBoxType boundBoxTypes[16] = {
|
||||
DefaultBoundingBoxType::FullTileBox, // 0000
|
||||
DefaultBoundingBoxType::FullTileSouthQuadrantBox, // 0001
|
||||
DefaultBoundingBoxType::FullTileWestQuadrantBox, // 0010
|
||||
DefaultBoundingBoxType::FullTileSouthwestSideBox, // 0011
|
||||
DefaultBoundingBoxType::FullTileNorthQuadrantBox, // 0100
|
||||
DefaultBoundingBoxType::FullTileBox, // 0101 (diagonal of South and North corners)
|
||||
DefaultBoundingBoxType::FullTileNorthwestSideBox, // 0110
|
||||
DefaultBoundingBoxType::FullTileBox, // 0111 (triangle of South, West, and North corners)
|
||||
DefaultBoundingBoxType::FullTileEastQuadrantBox, // 1000
|
||||
DefaultBoundingBoxType::FullTileSoutheastSideBox, // 1001
|
||||
DefaultBoundingBoxType::FullTileBox, // 1010 (diagonal of East and West corners)
|
||||
DefaultBoundingBoxType::FullTileBox, // 1011 (triangle of South, West, and East corners)
|
||||
DefaultBoundingBoxType::FullTileNortheastSideBox, // 1100
|
||||
DefaultBoundingBoxType::FullTileBox, // 1101 (triangle of South, West, and North corners)
|
||||
DefaultBoundingBoxType::FullTileBox, // 1110 (triangle of West, North, and East corners)
|
||||
DefaultBoundingBoxType::FullTileBox, // 1111
|
||||
};
|
||||
|
||||
static int32_t getBoundBoxHeight(uint8_t clearanceHeight)
|
||||
{
|
||||
return std::min<uint8_t>(clearanceHeight, 128) - 3;
|
||||
}
|
||||
|
||||
static void SetTileBoundingBox(LargeSceneryTile& tile)
|
||||
{
|
||||
if (tile.flags & 0xF00)
|
||||
{
|
||||
tile.boundBoxes = GetDefaultSceneryBoundBoxes(boundBoxTypes[(tile.flags & 0xF000) >> 12]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tile.boundBoxes = GetDefaultSceneryBoundBoxes(DefaultBoundingBoxType::FullTileLargeBox);
|
||||
}
|
||||
tile.spriteOffset = GetDefaultSpriteOffset(DefaultSpriteOffsetType::LargeSceneryOffset);
|
||||
|
||||
auto clearanceHeight = getBoundBoxHeight(tile.z_clearance);
|
||||
for (uint8_t i = 0; i < NumOrthogonalDirections; i++)
|
||||
{
|
||||
tile.boundBoxes[i].length.z = clearanceHeight;
|
||||
}
|
||||
}
|
||||
|
||||
static RCTLargeSceneryText ReadLegacy3DFont(OpenRCT2::IStream& stream)
|
||||
{
|
||||
RCTLargeSceneryText _3dFontLegacy = {};
|
||||
|
@ -167,6 +211,7 @@ std::vector<LargeSceneryTile> LargeSceneryObject::ReadTiles(OpenRCT2::IStream* s
|
|||
tile.z_offset = stream->ReadValue<int16_t>();
|
||||
tile.z_clearance = stream->ReadValue<uint8_t>();
|
||||
tile.flags = stream->ReadValue<uint16_t>();
|
||||
SetTileBoundingBox(tile);
|
||||
return tile;
|
||||
};
|
||||
|
||||
|
@ -255,6 +300,15 @@ std::vector<LargeSceneryTile> LargeSceneryObject::ReadJsonTiles(json_t& jTiles)
|
|||
|
||||
auto walls = Json::GetNumber<int16_t>(jTile["walls"]);
|
||||
tile.flags |= (walls & 0xFF) << 8;
|
||||
SetTileBoundingBox(tile);
|
||||
auto jBBox = jTile["boundingBox"];
|
||||
if (!jBBox.empty())
|
||||
{
|
||||
tile.boundBoxes = ReadBoundBoxes(jBBox, tile.boundBoxes[0].length.z, false);
|
||||
}
|
||||
auto jSpriteOffset = jTile["spriteOffsetCoordinates"];
|
||||
if (!jSpriteOffset.empty())
|
||||
tile.spriteOffset = ReadSpriteOffset(jSpriteOffset);
|
||||
|
||||
tiles.push_back(std::move(tile));
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "../OpenRCT2.h"
|
||||
#include "../PlatformEnvironment.h"
|
||||
#include "../common.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/DataSerialiser.h"
|
||||
#include "../core/FileIndex.hpp"
|
||||
|
|
|
@ -0,0 +1,261 @@
|
|||
/*****************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SceneryBoundingBox.h"
|
||||
|
||||
constexpr std::array<CoordsXYZ, DefaultSpriteOffsetType::CountOffset> DefaultSpriteOffsets = {
|
||||
CoordsXYZ(7, 7, 0), // quarter tile
|
||||
CoordsXYZ(15, 15, 0), // small scenery full tile w/o VOFFSET_CENTRE
|
||||
CoordsXYZ(3, 3, 0), // small scenery halftile/VOFFSET_CENTRE
|
||||
CoordsXYZ(1, 1, 0), // small scenery VOFFSET_CENTER+NO_WALLS
|
||||
CoordsXYZ(0, 0, 0), // large scenery
|
||||
};
|
||||
|
||||
constexpr SceneryBoundBoxes QuarterTile = {
|
||||
BoundBoxXYZ({ 7, 7, 0 }, { 2, 2, 0 }),
|
||||
BoundBoxXYZ({ 7, 7, 0 }, { 2, 2, 0 }),
|
||||
BoundBoxXYZ({ 7, 7, 0 }, { 2, 2, 0 }),
|
||||
BoundBoxXYZ({ 7, 7, 0 }, { 2, 2, 0 }),
|
||||
};
|
||||
|
||||
constexpr SceneryBoundBoxes HalfTile = {
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 26, 0 }),
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 26, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 26, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 26, 12, 0 }),
|
||||
};
|
||||
|
||||
// LargeSpecial corner/side match sub-fulltile large scenery boundboxes
|
||||
constexpr SceneryBoundBoxes FullTileNorthQuadrant = {
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 17, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 12, 0 }),
|
||||
};
|
||||
constexpr SceneryBoundBoxes FullTileNortheastSide = {
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 28, 0 }),
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 26, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 26, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 28, 12, 0 }),
|
||||
};
|
||||
constexpr SceneryBoundBoxes FullTileEastQuadrant = {
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 17, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 12, 0 }),
|
||||
};
|
||||
constexpr SceneryBoundBoxes FullTileSoutheastSide = {
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 26, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 26, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 28, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 28, 0 }),
|
||||
};
|
||||
constexpr SceneryBoundBoxes FullTileSouthQuadrant = {
|
||||
BoundBoxXYZ({ 17, 17, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 12, 12, 0 }),
|
||||
};
|
||||
constexpr SceneryBoundBoxes FullTileSouthwestSide = {
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 26, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 28, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 28, 0 }),
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 26, 12, 0 }),
|
||||
};
|
||||
constexpr SceneryBoundBoxes FullTileWestQuadrant = {
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 12, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 17, 0 }, { 12, 12, 0 }),
|
||||
};
|
||||
constexpr SceneryBoundBoxes FullTileNorthwestSide = {
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 28, 12, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 12, 28, 0 }),
|
||||
BoundBoxXYZ({ 3, 17, 0 }, { 26, 12, 0 }),
|
||||
BoundBoxXYZ({ 17, 3, 0 }, { 12, 26, 0 }),
|
||||
};
|
||||
|
||||
// LargeSpecialCenter matches large scenery with allowed walls and small scenery with SMALL_SCENERY_FLAG_VOFFSET_CENTRE
|
||||
constexpr SceneryBoundBoxes FullTile = {
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 26, 26, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 26, 26, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 26, 26, 0 }),
|
||||
BoundBoxXYZ({ 3, 3, 0 }, { 26, 26, 0 }),
|
||||
};
|
||||
|
||||
// Large matches large scenery and small scenery that do not allow walls.
|
||||
constexpr SceneryBoundBoxes FullTileLarge = {
|
||||
BoundBoxXYZ({ 1, 1, 0 }, { 30, 30, 0 }),
|
||||
BoundBoxXYZ({ 1, 1, 0 }, { 30, 30, 0 }),
|
||||
BoundBoxXYZ({ 1, 1, 0 }, { 30, 30, 0 }),
|
||||
BoundBoxXYZ({ 1, 1, 0 }, { 30, 30, 0 }),
|
||||
};
|
||||
|
||||
// Small Scenery without VOFFSET_CENTRE flag set
|
||||
constexpr SceneryBoundBoxes FullTileThin = {
|
||||
BoundBoxXYZ({ 15, 15, 0 }, { 2, 2, 0 }),
|
||||
BoundBoxXYZ({ 15, 15, 0 }, { 2, 2, 0 }),
|
||||
BoundBoxXYZ({ 15, 15, 0 }, { 2, 2, 0 }),
|
||||
BoundBoxXYZ({ 15, 15, 0 }, { 2, 2, 0 }),
|
||||
};
|
||||
|
||||
static const std::array<SceneryBoundBoxes, DefaultBoundingBoxType::CountBox> boundBoxes = {
|
||||
QuarterTile,
|
||||
HalfTile,
|
||||
FullTileNorthQuadrant,
|
||||
FullTileNortheastSide,
|
||||
FullTileEastQuadrant,
|
||||
FullTileSoutheastSide,
|
||||
FullTileSouthQuadrant,
|
||||
FullTileSouthwestSide,
|
||||
FullTileWestQuadrant,
|
||||
FullTileNorthwestSide,
|
||||
FullTile,
|
||||
FullTileLarge,
|
||||
FullTileThin,
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
static const EnumMap<DefaultBoundingBoxType> BBoxTypeLookup{
|
||||
{ "quarterTile", DefaultBoundingBoxType::QuarterTileBox },
|
||||
{ "halfTile", DefaultBoundingBoxType::HalfTileBox },
|
||||
{ "cornerNorth", DefaultBoundingBoxType::FullTileNorthQuadrantBox },
|
||||
{ "sideNortheast", DefaultBoundingBoxType::FullTileNortheastSideBox },
|
||||
{ "cornerEast", DefaultBoundingBoxType::FullTileEastQuadrantBox },
|
||||
{ "sideSoutheast", DefaultBoundingBoxType::FullTileSoutheastSideBox },
|
||||
{ "cornerSouth", DefaultBoundingBoxType::FullTileSouthQuadrantBox },
|
||||
{ "sideSouthwest", DefaultBoundingBoxType::FullTileSouthwestSideBox },
|
||||
{ "cornerEast", DefaultBoundingBoxType::FullTileWestQuadrantBox },
|
||||
{ "sideNorthwest", DefaultBoundingBoxType::FullTileNorthwestSideBox },
|
||||
{ "fullTile", DefaultBoundingBoxType::FullTileBox },
|
||||
{ "fullTileLarge", DefaultBoundingBoxType::FullTileLargeBox },
|
||||
{ "fullTileThin", DefaultBoundingBoxType::FullTileThinBox }
|
||||
};
|
||||
|
||||
static DefaultBoundingBoxType GetBoundingBoxTypeFromString(const std::string& s)
|
||||
{
|
||||
auto result = BBoxTypeLookup.find(s);
|
||||
return (result != BBoxTypeLookup.end()) ? result->second : DefaultBoundingBoxType::FullTileBox;
|
||||
}
|
||||
|
||||
SceneryBoundBoxes GetDefaultSceneryBoundBoxes(DefaultBoundingBoxType type)
|
||||
{
|
||||
if (type >= DefaultBoundingBoxType::CountBox)
|
||||
return boundBoxes[DefaultBoundingBoxType::FullTileBox];
|
||||
return boundBoxes[type];
|
||||
}
|
||||
|
||||
static BoundBoxXYZ ReadBoundBox(json_t& box)
|
||||
{
|
||||
auto jOffset = box["offset"];
|
||||
auto jLength = box["size"];
|
||||
|
||||
Guard::Assert(
|
||||
jOffset.is_array() && jLength.is_array() && jOffset.size() >= 3 && jLength.size() >= 3,
|
||||
"ReadBoundBox expects arrays 'offset' and 'size' with 3 elements");
|
||||
BoundBoxXYZ boundBox = {
|
||||
{
|
||||
Json::GetNumber<int32_t>(jOffset[0], 0),
|
||||
Json::GetNumber<int32_t>(jOffset[1], 0),
|
||||
Json::GetNumber<int32_t>(jOffset[2], 0),
|
||||
},
|
||||
{
|
||||
Json::GetNumber<int32_t>(jLength[0], 0),
|
||||
Json::GetNumber<int32_t>(jLength[1], 0),
|
||||
Json::GetNumber<int32_t>(jLength[2], 0),
|
||||
},
|
||||
};
|
||||
return boundBox;
|
||||
}
|
||||
|
||||
// Rotates a BoundBoxXYZ clockwise 90 degrees around the vertical axis.
|
||||
static BoundBoxXYZ RotateBoundBox(BoundBoxXYZ box, CoordsXY rotationCenter)
|
||||
{
|
||||
CoordsXYZ rotatedLength = { box.length.y, box.length.x, box.length.z };
|
||||
// equations are performed in double scale to avoid decimals
|
||||
CoordsXY relativeCentroid = box.offset * 2 + box.length - rotationCenter * 2;
|
||||
CoordsXY rotatedCentroid = { relativeCentroid.y, -relativeCentroid.x };
|
||||
CoordsXY newCorner = (rotatedCentroid - rotatedLength) / 2 + rotationCenter;
|
||||
return { { newCorner.x, newCorner.y, box.offset.z }, rotatedLength };
|
||||
}
|
||||
|
||||
SceneryBoundBoxes ReadBoundBoxes(json_t& jBBox, int32_t defaultHeight, bool fullTile)
|
||||
{
|
||||
SceneryBoundBoxes boxes;
|
||||
if (jBBox.is_array())
|
||||
{
|
||||
Guard::Assert(jBBox.size() >= 4, "boundBox arrays require four elements, one for each view angle");
|
||||
// array of four bboxes
|
||||
for (uint8_t i = 0; i < NumOrthogonalDirections; i++)
|
||||
boxes[i] = ReadBoundBox(jBBox[i]);
|
||||
}
|
||||
else if (jBBox.is_object())
|
||||
{
|
||||
// single box, rotated around (16, 16) if fulltile or (8,8) if quarter tile
|
||||
CoordsXY rotationCenter = { 8, 8 };
|
||||
if (fullTile)
|
||||
{
|
||||
rotationCenter = { 16, 16 };
|
||||
}
|
||||
auto bBox = ReadBoundBox(jBBox);
|
||||
boxes[0] = bBox;
|
||||
boxes[1] = RotateBoundBox(bBox, rotationCenter);
|
||||
boxes[2] = RotateBoundBox(boxes[1], rotationCenter);
|
||||
boxes[3] = RotateBoundBox(boxes[2], rotationCenter);
|
||||
}
|
||||
else
|
||||
{
|
||||
Guard::Assert(
|
||||
jBBox.is_string(),
|
||||
"boundBox must be an array of four boundBox objects, a single boundBox object, or a string matching the "
|
||||
"DefaultBoundingBoxType enum.");
|
||||
boxes = GetDefaultSceneryBoundBoxes(GetBoundingBoxTypeFromString(Json::GetString(jBBox)));
|
||||
for (uint8_t i = 0; i < NumOrthogonalDirections; i++)
|
||||
boxes[i].length.z = defaultHeight;
|
||||
}
|
||||
return boxes;
|
||||
}
|
||||
|
||||
static const EnumMap<DefaultSpriteOffsetType> SpriteOffsetLookup{
|
||||
{ "quarterTile", DefaultSpriteOffsetType::QuarterTileOffset },
|
||||
{ "fullTileThin", DefaultSpriteOffsetType::FullTileThinOffset },
|
||||
{ "halfTile", DefaultSpriteOffsetType::FullTileOffset },
|
||||
{ "fullTile", DefaultSpriteOffsetType::FullTileOffset },
|
||||
{ "fullTileLarge", DefaultSpriteOffsetType::FullTileLargeOffset },
|
||||
{ "largeScenery", DefaultSpriteOffsetType::LargeSceneryOffset },
|
||||
};
|
||||
|
||||
static DefaultSpriteOffsetType GetSpriteOffsetTypeFromString(const std::string& s)
|
||||
{
|
||||
auto result = SpriteOffsetLookup.find(s);
|
||||
return (result != SpriteOffsetLookup.end()) ? result->second : DefaultSpriteOffsetType::LargeSceneryOffset;
|
||||
}
|
||||
|
||||
CoordsXYZ GetDefaultSpriteOffset(DefaultSpriteOffsetType type)
|
||||
{
|
||||
if (type >= DefaultSpriteOffsetType::CountOffset)
|
||||
return DefaultSpriteOffsets[DefaultSpriteOffsetType::LargeSceneryOffset];
|
||||
return DefaultSpriteOffsets[type];
|
||||
}
|
||||
|
||||
CoordsXYZ ReadSpriteOffset(json_t& jCoords)
|
||||
{
|
||||
if (jCoords.is_string())
|
||||
{
|
||||
return DefaultSpriteOffsets[GetSpriteOffsetTypeFromString(Json::GetString(jCoords))];
|
||||
}
|
||||
Guard::Assert(jCoords.is_array() && jCoords.size() >= 3, "spriteOffsetCoordinates must be an array with three elements");
|
||||
CoordsXYZ coordinates = {
|
||||
Json::GetNumber<int32_t>(jCoords[0], 0),
|
||||
Json::GetNumber<int32_t>(jCoords[1], 0),
|
||||
Json::GetNumber<int32_t>(jCoords[2], 0),
|
||||
};
|
||||
return coordinates;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*****************************************************************************
|
||||
* 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 "../core/EnumMap.hpp"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
#include "../paint/Boundbox.h"
|
||||
#include "../world/Scenery.h"
|
||||
|
||||
enum DefaultBoundingBoxType : uint8_t
|
||||
{
|
||||
QuarterTileBox,
|
||||
HalfTileBox,
|
||||
FullTileNorthQuadrantBox,
|
||||
FullTileNortheastSideBox,
|
||||
FullTileEastQuadrantBox,
|
||||
FullTileSoutheastSideBox,
|
||||
FullTileSouthQuadrantBox,
|
||||
FullTileSouthwestSideBox,
|
||||
FullTileWestQuadrantBox,
|
||||
FullTileNorthwestSideBox,
|
||||
FullTileBox,
|
||||
FullTileLargeBox,
|
||||
FullTileThinBox,
|
||||
CountBox
|
||||
};
|
||||
|
||||
enum DefaultSpriteOffsetType : uint8_t
|
||||
{
|
||||
QuarterTileOffset,
|
||||
FullTileThinOffset,
|
||||
FullTileOffset,
|
||||
FullTileLargeOffset,
|
||||
LargeSceneryOffset,
|
||||
CountOffset
|
||||
};
|
||||
|
||||
SceneryBoundBoxes GetDefaultSceneryBoundBoxes(DefaultBoundingBoxType type);
|
||||
SceneryBoundBoxes ReadBoundBoxes(json_t& jBBox, int32_t defaultHeight, bool fullTile);
|
||||
CoordsXYZ GetDefaultSpriteOffset(DefaultSpriteOffsetType type);
|
||||
CoordsXYZ ReadSpriteOffset(json_t& jCoords);
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../common.h"
|
||||
#include "../interface/Cursors.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "ObjectTypes.h"
|
||||
|
||||
enum SMALL_SCENERY_FLAGS : uint32_t
|
||||
|
@ -67,6 +68,8 @@ struct SmallSceneryEntry
|
|||
uint16_t animation_mask;
|
||||
uint16_t num_frames;
|
||||
ObjectEntryIndex scenery_tab_id;
|
||||
SceneryBoundBoxes boundBoxes;
|
||||
CoordsXYZ spriteOffset;
|
||||
|
||||
constexpr bool HasFlag(const uint32_t _flags) const
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "../interface/Cursors.h"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../world/Scenery.h"
|
||||
#include "SceneryBoundingBox.h"
|
||||
|
||||
void SmallSceneryObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStream* stream)
|
||||
{
|
||||
|
@ -33,6 +34,7 @@ void SmallSceneryObject::ReadLegacy(IReadObjectContext* context, OpenRCT2::IStre
|
|||
_legacyType.animation_mask = stream->ReadValue<uint16_t>();
|
||||
_legacyType.num_frames = stream->ReadValue<uint16_t>();
|
||||
_legacyType.scenery_tab_id = OBJECT_ENTRY_INDEX_NULL;
|
||||
SetBoundingBoxFromFlags();
|
||||
|
||||
GetStringTable().Read(context, stream, ObjectStringID::NAME);
|
||||
|
||||
|
@ -245,6 +247,17 @@ void SmallSceneryObject::ReadJson(IReadObjectContext* context, json_t& root)
|
|||
}
|
||||
}
|
||||
}
|
||||
SetBoundingBoxFromFlags();
|
||||
auto jBBox = properties["boundingBox"];
|
||||
if (!jBBox.empty())
|
||||
{
|
||||
_legacyType.boundBoxes = ReadBoundBoxes(
|
||||
jBBox, _legacyType.boundBoxes[0].length.z,
|
||||
_legacyType.HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) || _legacyType.HasFlag(SMALL_SCENERY_FLAG_HALF_SPACE));
|
||||
}
|
||||
auto jSpriteOffset = properties["spriteOffsetCoordinates"];
|
||||
if (!jSpriteOffset.empty())
|
||||
_legacyType.spriteOffset = ReadSpriteOffset(jSpriteOffset);
|
||||
|
||||
auto jFrameOffsets = properties["frameOffsets"];
|
||||
if (jFrameOffsets.is_array())
|
||||
|
@ -269,3 +282,50 @@ std::vector<uint8_t> SmallSceneryObject::ReadJsonFrameOffsets(json_t& jFrameOffs
|
|||
}
|
||||
return offsets;
|
||||
}
|
||||
|
||||
static int32_t getBoundBoxHeight(uint8_t clearanceHeight)
|
||||
{
|
||||
int32_t height = clearanceHeight - 4;
|
||||
if (height > 128 || height < 0)
|
||||
{
|
||||
height = 128;
|
||||
}
|
||||
return height - 1;
|
||||
}
|
||||
|
||||
void SmallSceneryObject::SetBoundingBoxFromFlags()
|
||||
{
|
||||
DefaultBoundingBoxType boundBoxType = DefaultBoundingBoxType::QuarterTileBox;
|
||||
DefaultSpriteOffsetType spriteOffsetType = DefaultSpriteOffsetType::QuarterTileOffset;
|
||||
if (_legacyType.HasFlag(SMALL_SCENERY_FLAG_FULL_TILE))
|
||||
{
|
||||
boundBoxType = DefaultBoundingBoxType::FullTileThinBox;
|
||||
spriteOffsetType = DefaultSpriteOffsetType::FullTileThinOffset;
|
||||
if (_legacyType.HasFlag(SMALL_SCENERY_FLAG_HALF_SPACE))
|
||||
{
|
||||
spriteOffsetType = DefaultSpriteOffsetType::FullTileOffset;
|
||||
boundBoxType = DefaultBoundingBoxType::HalfTileBox;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_legacyType.HasFlag(SMALL_SCENERY_FLAG_VOFFSET_CENTRE))
|
||||
{
|
||||
boundBoxType = DefaultBoundingBoxType::FullTileBox;
|
||||
spriteOffsetType = DefaultSpriteOffsetType::FullTileOffset;
|
||||
if (_legacyType.HasFlag(SMALL_SCENERY_FLAG_NO_WALLS))
|
||||
{
|
||||
boundBoxType = DefaultBoundingBoxType::FullTileLargeBox;
|
||||
spriteOffsetType = DefaultSpriteOffsetType::FullTileLargeOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_legacyType.spriteOffset = GetDefaultSpriteOffset(spriteOffsetType);
|
||||
_legacyType.boundBoxes = GetDefaultSceneryBoundBoxes(boundBoxType);
|
||||
|
||||
auto clearanceHeight = getBoundBoxHeight(_legacyType.height);
|
||||
for (uint8_t i = 0; i < NumOrthogonalDirections; i++)
|
||||
{
|
||||
_legacyType.boundBoxes[i].length.z = clearanceHeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,4 +38,5 @@ private:
|
|||
static std::vector<uint8_t> ReadFrameOffsets(OpenRCT2::IStream* stream);
|
||||
static std::vector<uint8_t> ReadJsonFrameOffsets(json_t& jFrameOffsets);
|
||||
void PerformFixes();
|
||||
void SetBoundingBoxFromFlags();
|
||||
};
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../core/Guard.hpp"
|
||||
#include "../drawing/Drawing.h"
|
||||
#include "../interface/Viewport.h"
|
||||
#include "../localisation/Currency.h"
|
||||
#include "../localisation/Formatting.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../localisation/LocalisationService.h"
|
||||
|
|
|
@ -34,28 +34,6 @@
|
|||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
// clang-format off
|
||||
static constexpr BoundBoxXY LargeSceneryBoundBoxes[] = {
|
||||
{ { 3, 3 }, { 26, 26 } },
|
||||
{ { 17, 17 }, { 12, 12 } },
|
||||
{ { 17, 3 }, { 12, 12 } },
|
||||
{ { 17, 3 }, { 12, 26 } },
|
||||
{ { 3, 3 }, { 12, 12 } },
|
||||
{ { 3, 3 }, { 26, 26 } },
|
||||
{ { 3, 3 }, { 28, 12 } },
|
||||
{ { 3, 3 }, { 26, 26 } },
|
||||
{ { 3, 17 }, { 12, 12 } },
|
||||
{ { 3, 17 }, { 26, 12 } },
|
||||
{ { 3, 3 }, { 26, 26 } },
|
||||
{ { 3, 3 }, { 26, 26 } },
|
||||
{ { 3, 3 }, { 12, 28 } },
|
||||
{ { 3, 3 }, { 26, 26 } },
|
||||
{ { 3, 3 }, { 26, 26 } },
|
||||
{ { 3, 3 }, { 26, 26 } },
|
||||
{ { 1, 1 }, { 30, 30 } },
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static void PaintLargeScenerySupports(
|
||||
PaintSession& session, uint8_t direction, uint16_t height, const LargeSceneryElement& tileElement, ImageId imageTemplate,
|
||||
const LargeSceneryTile& tile)
|
||||
|
@ -388,20 +366,13 @@ void PaintLargeScenery(PaintSession& session, uint8_t direction, uint16_t height
|
|||
}
|
||||
}
|
||||
|
||||
auto boxlengthZ = std::min<uint8_t>(tile->z_clearance, 128) - 3;
|
||||
auto flags = tile->flags;
|
||||
auto bbIndex = 16;
|
||||
if (flags & 0xF00)
|
||||
{
|
||||
flags &= 0xF000;
|
||||
flags = Numerics::rol16(flags, direction);
|
||||
bbIndex = (flags & 0xF) | (flags >> 12);
|
||||
}
|
||||
const CoordsXYZ& bbOffset = { LargeSceneryBoundBoxes[bbIndex].offset, height };
|
||||
const CoordsXYZ& bbLength = { LargeSceneryBoundBoxes[bbIndex].length, boxlengthZ };
|
||||
auto boundBox = tile->boundBoxes[direction];
|
||||
auto offset = tile->spriteOffset;
|
||||
boundBox.offset.z += height;
|
||||
offset.z += height;
|
||||
|
||||
auto imageIndex = sceneryEntry->image + 4 + (sequenceNum << 2) + direction;
|
||||
PaintAddImageAsParent(session, imageTemplate.WithIndex(imageIndex), { 0, 0, height }, { bbOffset, bbLength });
|
||||
PaintAddImageAsParent(session, imageTemplate.WithIndex(imageIndex), offset, boundBox);
|
||||
|
||||
if (sceneryEntry->scrolling_mode != SCROLLING_MODE_NONE && direction != 1 && direction != 2)
|
||||
{
|
||||
|
@ -414,7 +385,8 @@ void PaintLargeScenery(PaintSession& session, uint8_t direction, uint16_t height
|
|||
auto sequenceDirection2 = (tileElement.GetSequenceIndex() - 1) & 3;
|
||||
if (sequenceDirection2 == direction)
|
||||
{
|
||||
PaintLargeSceneryScrollingText(session, *sceneryEntry, tileElement, direction, height, bbOffset, isGhost);
|
||||
PaintLargeSceneryScrollingText(
|
||||
session, *sceneryEntry, tileElement, direction, height, boundBox.offset, isGhost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "../../Game.h"
|
||||
#include "../../GameState.h"
|
||||
#include "../../config/Config.h"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../localisation/Date.h"
|
||||
#include "../../object/SmallSceneryEntry.h"
|
||||
|
@ -27,11 +26,11 @@
|
|||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
static constexpr CoordsXY lengths[] = {
|
||||
{ 12, 26 },
|
||||
{ 26, 12 },
|
||||
{ 12, 26 },
|
||||
{ 26, 12 },
|
||||
static constexpr CoordsXY newQuadrantOffsets[NumOrthogonalDirections] = {
|
||||
{ 0, 0 },
|
||||
{ 0, 16 },
|
||||
{ 16, 16 },
|
||||
{ 16, 0 },
|
||||
};
|
||||
|
||||
static void PaintSmallScenerySupports(
|
||||
|
@ -120,63 +119,17 @@ static void PaintSmallSceneryBody(
|
|||
{
|
||||
PROFILED_FUNCTION();
|
||||
|
||||
BoundBoxXYZ boundBox = { { 0, 0, height }, { 2, 2, 0 } };
|
||||
BoundBoxXYZ boundBox = sceneryEntry->boundBoxes[direction];
|
||||
CoordsXYZ offset = sceneryEntry->spriteOffset;
|
||||
boundBox.offset.z += height;
|
||||
offset.z += height;
|
||||
|
||||
CoordsXYZ offset = { 0, 0, height };
|
||||
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE))
|
||||
{
|
||||
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HALF_SPACE))
|
||||
{
|
||||
static constexpr CoordsXY sceneryHalfTileOffsets[] = {
|
||||
{ 3, 3 },
|
||||
{ 3, 17 },
|
||||
{ 17, 3 },
|
||||
{ 3, 3 },
|
||||
};
|
||||
boundBox.offset.x = sceneryHalfTileOffsets[direction].x;
|
||||
boundBox.offset.y = sceneryHalfTileOffsets[direction].y;
|
||||
boundBox.length.x = lengths[direction].x;
|
||||
boundBox.length.y = lengths[direction].y;
|
||||
offset.x = 3;
|
||||
offset.y = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset.x = 15;
|
||||
offset.y = 15;
|
||||
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_VOFFSET_CENTRE))
|
||||
{
|
||||
offset.x = 3;
|
||||
offset.y = 3;
|
||||
boundBox.length.x = 26;
|
||||
boundBox.length.y = 26;
|
||||
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_NO_WALLS))
|
||||
{
|
||||
offset.x = 1;
|
||||
offset.y = 1;
|
||||
boundBox.length.x = 30;
|
||||
boundBox.length.y = 30;
|
||||
}
|
||||
}
|
||||
boundBox.offset.x = offset.x;
|
||||
boundBox.offset.y = offset.y;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE))
|
||||
{
|
||||
uint8_t quadrant = (sceneryElement.GetSceneryQuadrant() + session.CurrentRotation) & 3;
|
||||
// -1 to maintain compatibility with existing CSOs in context of issue #17616
|
||||
offset.x = SceneryQuadrantOffsets[quadrant].x - 1;
|
||||
offset.y = SceneryQuadrantOffsets[quadrant].y - 1;
|
||||
boundBox.offset.x = offset.x;
|
||||
boundBox.offset.y = offset.y;
|
||||
boundBox.offset += newQuadrantOffsets[quadrant];
|
||||
offset += newQuadrantOffsets[quadrant];
|
||||
}
|
||||
boundBox.length.z = sceneryEntry->height - 4;
|
||||
if (boundBox.length.z > 128 || boundBox.length.z < 0)
|
||||
{
|
||||
boundBox.length.z = 128;
|
||||
}
|
||||
boundBox.length.z--;
|
||||
|
||||
ImageIndex baseImageIndex = sceneryEntry->image + direction;
|
||||
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_CAN_WITHER))
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
#include "../Context.h"
|
||||
#include "../Game.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/File.h"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../localisation/Currency.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "Platform.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
# include "../Date.h"
|
||||
# include "../core/Memory.hpp"
|
||||
# include "../core/Path.hpp"
|
||||
# include "../core/String.hpp"
|
||||
# include "../util/Util.h"
|
||||
|
||||
# include <cerrno>
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../config/ConfigTypes.h"
|
||||
#include "../core/String.hpp"
|
||||
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
|
@ -42,6 +43,7 @@ enum class SPECIAL_FOLDER
|
|||
|
||||
struct RealWorldDate;
|
||||
struct RealWorldTime;
|
||||
struct TTFFontDescriptor;
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "../GameState.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../ParkImporter.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/FileStream.h"
|
||||
#include "../core/IStream.hpp"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "../TrackImporter.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/FileStream.h"
|
||||
#include "../core/MemoryStream.h"
|
||||
#include "../core/Path.hpp"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "../Context.h"
|
||||
#include "../PlatformEnvironment.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Collections.hpp"
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/File.h"
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "../Context.h"
|
||||
#include "../Game.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../interface/Viewport.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../../config/Config.h"
|
||||
#include "../../entity/EntityRegistry.h"
|
||||
#include "../../entity/Guest.h"
|
||||
#include "../../interface/Viewport.h"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "../../common.h"
|
||||
#include "../../config/Config.h"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../paint/Paint.h"
|
||||
#include "../../paint/support/WoodenSupports.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../../config/Config.h"
|
||||
#include "../../entity/EntityRegistry.h"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../paint/Paint.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../drawing/X8DrawingEngine.h"
|
||||
#include "UiContext.h"
|
||||
#include "WindowManager.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "../Context.h"
|
||||
#include "../common.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../config/ConfigTypes.h"
|
||||
#include "../interface/Cursors.h"
|
||||
|
||||
#include <memory>
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "../actions/ParkEntranceRemoveAction.h"
|
||||
#include "../actions/WallRemoveAction.h"
|
||||
#include "../audio/audio.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../interface/Cursors.h"
|
||||
#include "../interface/Viewport.h"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "../GameState.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../actions/ParkSetParameterAction.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/Memory.hpp"
|
||||
#include "../core/String.hpp"
|
||||
#include "../entity/Litter.h"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "../paint/Boundbox.h"
|
||||
#include "Location.hpp"
|
||||
#include "ScenerySelection.h"
|
||||
|
||||
|
@ -18,6 +19,8 @@
|
|||
constexpr uint8_t kSceneryWitherAgeThreshold1 = 0x28;
|
||||
constexpr uint8_t kSceneryWitherAgeThreshold2 = 0x37;
|
||||
|
||||
using SceneryBoundBoxes = std::array<BoundBoxXYZ, NumOrthogonalDirections>;
|
||||
|
||||
enum
|
||||
{
|
||||
SCENERY_TYPE_SMALL,
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/ParkImporter.h>
|
||||
#include <openrct2/audio/AudioContext.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/Crypt.h>
|
||||
#include <openrct2/core/File.h>
|
||||
#include <openrct2/core/MemoryStream.h>
|
||||
|
|
Loading…
Reference in New Issue