mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 05:53:02 +01:00
Extend BannerIndex to 16 bits
This commit is contained in:
@@ -599,7 +599,7 @@ static void viewport_interaction_remove_large_scenery(TileElement* tileElement,
|
||||
|
||||
if (sceneryEntry->large_scenery.scrolling_mode != SCROLLING_MODE_NONE)
|
||||
{
|
||||
BannerIndex bannerIndex = tileElement->AsLargeScenery()->GetBannerIndex();
|
||||
auto bannerIndex = tileElement->AsLargeScenery()->GetBannerIndex();
|
||||
context_open_detail_window(WD_SIGN, bannerIndex);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -170,7 +170,7 @@ rct_window* window_sign_open(rct_windownumber number)
|
||||
rct_scenery_entry* scenery_entry = tile_element->AsLargeScenery()->GetEntry();
|
||||
if (scenery_entry != nullptr && scenery_entry->large_scenery.scrolling_mode != SCROLLING_MODE_NONE)
|
||||
{
|
||||
BannerIndex bannerIndex = tile_element->AsLargeScenery()->GetBannerIndex();
|
||||
auto bannerIndex = tile_element->AsLargeScenery()->GetBannerIndex();
|
||||
|
||||
if (bannerIndex == w->number)
|
||||
break;
|
||||
@@ -227,7 +227,7 @@ static void window_sign_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
||||
rct_scenery_entry* scenery_entry = tile_element->AsLargeScenery()->GetEntry();
|
||||
if (scenery_entry->large_scenery.scrolling_mode != SCROLLING_MODE_NONE)
|
||||
{
|
||||
BannerIndex bannerIndex = tile_element->AsLargeScenery()->GetBannerIndex();
|
||||
auto bannerIndex = tile_element->AsLargeScenery()->GetBannerIndex();
|
||||
if (bannerIndex == w->number)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ DEFINE_GAME_ACTION(BannerSetStyleAction, GAME_COMMAND_SET_BANNER_STYLE, GameActi
|
||||
{
|
||||
private:
|
||||
uint8_t _type = static_cast<uint8_t>(BannerSetStyleType::Count);
|
||||
uint8_t _bannerIndex = BANNER_INDEX_NULL;
|
||||
BannerIndex _bannerIndex = BANNER_INDEX_NULL;
|
||||
uint8_t _parameter;
|
||||
|
||||
public:
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
DEFINE_GAME_ACTION(SignSetNameAction, GAME_COMMAND_SET_SIGN_NAME, GameActionResult)
|
||||
{
|
||||
private:
|
||||
int32_t _bannerIndex;
|
||||
BannerIndex _bannerIndex;
|
||||
std::string _name;
|
||||
|
||||
public:
|
||||
SignSetNameAction() = default;
|
||||
SignSetNameAction(int32_t bannerIndex, const std::string& name)
|
||||
SignSetNameAction(BannerIndex bannerIndex, const std::string& name)
|
||||
: _bannerIndex(bannerIndex)
|
||||
, _name(name)
|
||||
{
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
if ((BannerIndex)_bannerIndex >= MAX_BANNERS || _bannerIndex < 0)
|
||||
if (_bannerIndex >= MAX_BANNERS)
|
||||
{
|
||||
log_warning("Invalid game command for setting sign name, banner id = %d", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
DEFINE_GAME_ACTION(SignSetStyleAction, GAME_COMMAND_SET_SIGN_STYLE, GameActionResult)
|
||||
{
|
||||
private:
|
||||
int32_t _bannerIndex;
|
||||
BannerIndex _bannerIndex;
|
||||
uint8_t _mainColour;
|
||||
uint8_t _textColour;
|
||||
bool _isLarge;
|
||||
|
||||
public:
|
||||
SignSetStyleAction() = default;
|
||||
SignSetStyleAction(int32_t bannerIndex, uint8_t mainColour, uint8_t textColour, bool isLarge)
|
||||
SignSetStyleAction(BannerIndex bannerIndex, uint8_t mainColour, uint8_t textColour, bool isLarge)
|
||||
: _bannerIndex(bannerIndex)
|
||||
, _mainColour(mainColour)
|
||||
, _textColour(textColour)
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
if ((BannerIndex)_bannerIndex >= MAX_BANNERS || _bannerIndex < 0)
|
||||
if (_bannerIndex >= MAX_BANNERS)
|
||||
{
|
||||
log_warning("Invalid game command for setting sign style, banner id '%d' out of range", _bannerIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
if (_isLarge)
|
||||
{
|
||||
TileElement* tileElement = banner_get_tile_element((BannerIndex)_bannerIndex);
|
||||
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for setting sign style, banner id '%d' not found", _bannerIndex);
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
WallElement* wallElement = banner_get_scrolling_wall_tile_element(static_cast<BannerIndex>(_bannerIndex));
|
||||
WallElement* wallElement = banner_get_scrolling_wall_tile_element(_bannerIndex);
|
||||
|
||||
if (!wallElement)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
|
||||
if (_isLarge)
|
||||
{
|
||||
TileElement* tileElement = banner_get_tile_element((BannerIndex)_bannerIndex);
|
||||
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
|
||||
if (!map_large_scenery_sign_set_colour(
|
||||
{ coords, tileElement->GetBaseZ(), tileElement->GetDirection() },
|
||||
tileElement->AsLargeScenery()->GetSequenceIndex(), _mainColour, _textColour))
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
WallElement* wallElement = banner_get_scrolling_wall_tile_element(static_cast<BannerIndex>(_bannerIndex));
|
||||
WallElement* wallElement = banner_get_scrolling_wall_tile_element(_bannerIndex);
|
||||
|
||||
wallElement->SetPrimaryColour(_mainColour);
|
||||
wallElement->SetSecondaryColour(_textColour);
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
}
|
||||
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
|
||||
intent.putExtra(INTENT_EXTRA_BANNER_INDEX, (BannerIndex)_bannerIndex);
|
||||
intent.putExtra(INTENT_EXTRA_BANNER_INDEX, _bannerIndex);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
return MakeResult();
|
||||
|
||||
@@ -142,8 +142,6 @@ using money64 = fixed64_1dp;
|
||||
#define MONEY16_UNDEFINED (money16)(uint16_t) 0xFFFF
|
||||
#define MONEY32_UNDEFINED ((money32)0x80000000)
|
||||
|
||||
using BannerIndex = uint8_t;
|
||||
|
||||
using EMPTY_ARGS_VOID_POINTER = void();
|
||||
using rct_string_id = uint16_t;
|
||||
|
||||
|
||||
@@ -2195,7 +2195,10 @@ private:
|
||||
auto src2 = src->AsBanner();
|
||||
|
||||
uint8_t index = src2->GetIndex();
|
||||
dst2->SetIndex(index);
|
||||
if (index != RCT12_BANNER_INDEX_NULL)
|
||||
dst2->SetIndex(index);
|
||||
else
|
||||
dst2->SetIndex(BANNER_INDEX_NULL);
|
||||
dst2->SetPosition(src2->GetPosition());
|
||||
dst2->SetAllowedEdges(src2->GetAllowedEdges());
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ colour_t RCT12LargeSceneryElement::GetSecondaryColour() const
|
||||
return colour[1] & TILE_ELEMENT_COLOUR_MASK;
|
||||
}
|
||||
|
||||
BannerIndex RCT12LargeSceneryElement::GetBannerIndex() const
|
||||
uint8_t RCT12LargeSceneryElement::GetBannerIndex() const
|
||||
{
|
||||
return (type & 0xC0) | (((colour[0]) & ~TILE_ELEMENT_COLOUR_MASK) >> 2) | (((colour[1]) & ~TILE_ELEMENT_COLOUR_MASK) >> 5);
|
||||
}
|
||||
@@ -345,7 +345,7 @@ uint8_t RCT12WallElement::GetAnimationFrame() const
|
||||
return (animation >> 3) & 0xF;
|
||||
}
|
||||
|
||||
BannerIndex RCT12WallElement::GetBannerIndex() const
|
||||
uint8_t RCT12WallElement::GetBannerIndex() const
|
||||
{
|
||||
return banner_index;
|
||||
}
|
||||
@@ -413,7 +413,7 @@ uint8_t RCT12EntranceElement::GetPathType() const
|
||||
return pathType;
|
||||
}
|
||||
|
||||
BannerIndex RCT12BannerElement::GetIndex() const
|
||||
uint8_t RCT12BannerElement::GetIndex() const
|
||||
{
|
||||
return index;
|
||||
}
|
||||
@@ -480,19 +480,19 @@ uint8_t RCT12TileElement::GetBannerIndex()
|
||||
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
||||
sceneryEntry = get_large_scenery_entry(AsLargeScenery()->GetEntryIndex());
|
||||
if (sceneryEntry->large_scenery.scrolling_mode == SCROLLING_MODE_NONE)
|
||||
return BANNER_INDEX_NULL;
|
||||
return RCT12_BANNER_INDEX_NULL;
|
||||
|
||||
return AsLargeScenery()->GetBannerIndex();
|
||||
case TILE_ELEMENT_TYPE_WALL:
|
||||
sceneryEntry = get_wall_entry(AsWall()->GetEntryIndex());
|
||||
if (sceneryEntry == nullptr || sceneryEntry->wall.scrolling_mode == SCROLLING_MODE_NONE)
|
||||
return BANNER_INDEX_NULL;
|
||||
return RCT12_BANNER_INDEX_NULL;
|
||||
|
||||
return AsWall()->GetBannerIndex();
|
||||
case TILE_ELEMENT_TYPE_BANNER:
|
||||
return AsBanner()->GetIndex();
|
||||
default:
|
||||
return BANNER_INDEX_NULL;
|
||||
return RCT12_BANNER_INDEX_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ void RCT12LargeSceneryElement::SetSecondaryColour(colour_t newColour)
|
||||
colour[1] |= newColour;
|
||||
}
|
||||
|
||||
void RCT12LargeSceneryElement::SetBannerIndex(BannerIndex newIndex)
|
||||
void RCT12LargeSceneryElement::SetBannerIndex(uint8_t newIndex)
|
||||
{
|
||||
type |= newIndex & 0xC0;
|
||||
colour[0] |= (newIndex & 0x38) << 2;
|
||||
@@ -850,7 +850,7 @@ void RCT12WallElement::SetEntryIndex(uint8_t newIndex)
|
||||
entryIndex = newIndex;
|
||||
}
|
||||
|
||||
void RCT12WallElement::SetBannerIndex(BannerIndex newIndex)
|
||||
void RCT12WallElement::SetBannerIndex(uint8_t newIndex)
|
||||
{
|
||||
banner_index = newIndex;
|
||||
}
|
||||
@@ -929,7 +929,7 @@ void RCT12EntranceElement::SetStationIndex(uint8_t stationIndex)
|
||||
index |= (stationIndex << 4);
|
||||
}
|
||||
|
||||
void RCT12BannerElement::SetIndex(BannerIndex newIndex)
|
||||
void RCT12BannerElement::SetIndex(uint8_t newIndex)
|
||||
{
|
||||
index = newIndex;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@ constexpr uint16_t const RCT12_MAX_INVERSIONS = 31;
|
||||
constexpr uint16_t const RCT12_MAX_GOLF_HOLES = 31;
|
||||
constexpr uint16_t const RCT12_MAX_HELICES = 31;
|
||||
|
||||
constexpr uint8_t RCT12_BANNER_INDEX_NULL = (uint8_t)-1;
|
||||
|
||||
enum class RCT12TrackDesignVersion : uint8_t
|
||||
{
|
||||
TD4,
|
||||
@@ -415,13 +417,13 @@ public:
|
||||
uint16_t GetSequenceIndex() const;
|
||||
colour_t GetPrimaryColour() const;
|
||||
colour_t GetSecondaryColour() const;
|
||||
BannerIndex GetBannerIndex() const;
|
||||
uint8_t GetBannerIndex() const;
|
||||
|
||||
void SetEntryIndex(uint32_t newIndex);
|
||||
void SetSequenceIndex(uint16_t sequence);
|
||||
void SetPrimaryColour(colour_t colour);
|
||||
void SetSecondaryColour(colour_t colour);
|
||||
void SetBannerIndex(BannerIndex newIndex);
|
||||
void SetBannerIndex(uint8_t newIndex);
|
||||
};
|
||||
assert_struct_size(RCT12LargeSceneryElement, 8);
|
||||
struct RCT12WallElement : RCT12TileElementBase
|
||||
@@ -430,8 +432,8 @@ private:
|
||||
uint8_t entryIndex; // 4
|
||||
union
|
||||
{
|
||||
uint8_t colour_3; // 5
|
||||
BannerIndex banner_index; // 5
|
||||
uint8_t colour_3; // 5
|
||||
uint8_t banner_index; // 5
|
||||
};
|
||||
uint8_t colour_1; // 6 0b_2221_1111 2 = colour_2 (uses flags for rest of colour2), 1 = colour_1
|
||||
uint8_t animation; // 7 0b_dfff_ft00 d = direction, f = frame num, t = across track flag (not used)
|
||||
@@ -442,7 +444,7 @@ public:
|
||||
colour_t GetSecondaryColour() const;
|
||||
colour_t GetTertiaryColour() const;
|
||||
uint8_t GetAnimationFrame() const;
|
||||
BannerIndex GetBannerIndex() const;
|
||||
uint8_t GetBannerIndex() const;
|
||||
bool IsAcrossTrack() const;
|
||||
bool AnimationIsBackwards() const;
|
||||
uint32_t GetRawRCT1WallTypeData() const;
|
||||
@@ -455,7 +457,7 @@ public:
|
||||
void SetSecondaryColour(colour_t newColour);
|
||||
void SetTertiaryColour(colour_t newColour);
|
||||
void SetAnimationFrame(uint8_t frameNum);
|
||||
void SetBannerIndex(BannerIndex newIndex);
|
||||
void SetBannerIndex(uint8_t newIndex);
|
||||
void SetAcrossTrack(bool acrossTrack);
|
||||
void SetAnimationIsBackwards(bool isBackwards);
|
||||
};
|
||||
@@ -484,19 +486,19 @@ assert_struct_size(RCT12EntranceElement, 8);
|
||||
struct RCT12BannerElement : RCT12TileElementBase
|
||||
{
|
||||
private:
|
||||
BannerIndex index; // 4
|
||||
uint8_t position; // 5
|
||||
uint8_t flags; // 6
|
||||
uint8_t index; // 4
|
||||
uint8_t position; // 5
|
||||
uint8_t flags; // 6
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t unused; // 7
|
||||
#pragma clang diagnostic pop
|
||||
public:
|
||||
BannerIndex GetIndex() const;
|
||||
uint8_t GetIndex() const;
|
||||
uint8_t GetPosition() const;
|
||||
uint8_t GetAllowedEdges() const;
|
||||
|
||||
void SetIndex(BannerIndex newIndex);
|
||||
void SetIndex(uint8_t newIndex);
|
||||
void SetPosition(uint8_t newPosition);
|
||||
void SetAllowedEdges(uint8_t newEdges);
|
||||
};
|
||||
|
||||
@@ -1521,9 +1521,15 @@ void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
|
||||
dst2->SetSecondaryColour(src2->GetSecondaryColour());
|
||||
dst2->SetTertiaryColour(src2->GetTertiaryColour());
|
||||
dst2->SetAnimationFrame(src2->GetAnimationFrame());
|
||||
dst2->SetBannerIndex(src2->GetBannerIndex());
|
||||
dst2->SetAcrossTrack(src2->IsAcrossTrack());
|
||||
dst2->SetAnimationIsBackwards(src2->AnimationIsBackwards());
|
||||
|
||||
auto bannerIndex = src2->GetBannerIndex();
|
||||
if (bannerIndex != BANNER_INDEX_NULL)
|
||||
dst2->SetBannerIndex(bannerIndex);
|
||||
else
|
||||
dst2->SetBannerIndex(RCT12_BANNER_INDEX_NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
|
||||
@@ -1535,7 +1541,13 @@ void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
|
||||
dst2->SetSequenceIndex(src2->GetSequenceIndex());
|
||||
dst2->SetPrimaryColour(src2->GetPrimaryColour());
|
||||
dst2->SetSecondaryColour(src2->GetSecondaryColour());
|
||||
dst2->SetBannerIndex(src2->GetBannerIndex());
|
||||
|
||||
auto bannerIndex = src2->GetBannerIndex();
|
||||
if (bannerIndex != BANNER_INDEX_NULL)
|
||||
dst2->SetBannerIndex(bannerIndex);
|
||||
else
|
||||
dst2->SetBannerIndex(RCT12_BANNER_INDEX_NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case TILE_ELEMENT_TYPE_BANNER:
|
||||
@@ -1543,9 +1555,13 @@ void S6Exporter::ExportTileElement(RCT12TileElement* dst, TileElement* src)
|
||||
auto dst2 = dst->AsBanner();
|
||||
auto src2 = src->AsBanner();
|
||||
|
||||
dst2->SetIndex(src2->GetIndex());
|
||||
dst2->SetPosition(src2->GetPosition());
|
||||
dst2->SetAllowedEdges(src2->GetAllowedEdges());
|
||||
auto bannerIndex = src2->GetIndex();
|
||||
if (bannerIndex != BANNER_INDEX_NULL)
|
||||
dst2->SetIndex(bannerIndex);
|
||||
else
|
||||
dst2->SetIndex(RCT12_BANNER_INDEX_NULL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -651,8 +651,8 @@ void scenario_fix_ghosts(rct_s6_data* s6)
|
||||
{
|
||||
if (originalElement->IsGhost())
|
||||
{
|
||||
BannerIndex bannerIndex = originalElement->GetBannerIndex();
|
||||
if (bannerIndex != BANNER_INDEX_NULL)
|
||||
uint8_t bannerIndex = originalElement->GetBannerIndex();
|
||||
if (bannerIndex != RCT12_BANNER_INDEX_NULL)
|
||||
{
|
||||
auto banner = &s6->banners[bannerIndex];
|
||||
if (banner->type != BANNER_NULL)
|
||||
|
||||
@@ -288,7 +288,7 @@ void fix_duplicated_banners()
|
||||
tileElement->base_height);
|
||||
|
||||
// Banner index is already in use by another banner, so duplicate it
|
||||
BannerIndex newBannerIndex = create_new_banner(GAME_COMMAND_FLAG_APPLY);
|
||||
auto newBannerIndex = create_new_banner(GAME_COMMAND_FLAG_APPLY);
|
||||
if (newBannerIndex == BANNER_INDEX_NULL)
|
||||
{
|
||||
log_error("Failed to create new banner.");
|
||||
|
||||
@@ -10,7 +10,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "TileElement.h"
|
||||
#include "../ride/RideTypes.h"
|
||||
#include "Location.hpp"
|
||||
|
||||
struct TileElement;
|
||||
struct WallElement;
|
||||
|
||||
typedef uint16_t BannerIndex;
|
||||
|
||||
constexpr uint8_t BANNER_NULL = 255;
|
||||
constexpr size_t MAX_BANNERS = 250;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "../common.h"
|
||||
#include "../ride/RideTypes.h"
|
||||
#include "Banner.h"
|
||||
#include "Footpath.h"
|
||||
#include "Location.hpp"
|
||||
|
||||
@@ -389,9 +390,10 @@ struct LargeSceneryElement : TileElementBase
|
||||
{
|
||||
private:
|
||||
uint32_t EntryIndex;
|
||||
uint32_t BannerIndex;
|
||||
::BannerIndex BannerIndex;
|
||||
uint8_t SequenceIndex;
|
||||
uint8_t Colour[3];
|
||||
uint8_t pad[2];
|
||||
|
||||
public:
|
||||
uint32_t GetEntryIndex() const;
|
||||
@@ -426,7 +428,7 @@ private:
|
||||
uint8_t animation; // 0A 0b_dfff_ft00 d = direction, f = frame num, t = across track flag (not used)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t pad_0B[5];
|
||||
uint8_t pad_0C[4];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
public:
|
||||
@@ -502,7 +504,7 @@ private:
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
uint8_t flags; // 6
|
||||
uint8_t unused; // 7
|
||||
uint8_t pad_08[8];
|
||||
uint8_t pad_09[7];
|
||||
#pragma clang diagnostic pop
|
||||
public:
|
||||
Banner* GetBanner() const;
|
||||
|
||||
@@ -303,11 +303,11 @@ GameActionResult::Ptr tile_inspector_paste_element_at(CoordsXY loc, TileElement
|
||||
if (isExecuting)
|
||||
{
|
||||
// Check if the element to be pasted refers to a banner index
|
||||
BannerIndex bannerIndex = tile_element_get_banner_index(&element);
|
||||
auto bannerIndex = tile_element_get_banner_index(&element);
|
||||
if (bannerIndex != BANNER_INDEX_NULL)
|
||||
{
|
||||
// The element to be pasted refers to a banner index - make a copy of it
|
||||
BannerIndex newBannerIndex = create_new_banner(GAME_COMMAND_FLAG_APPLY);
|
||||
auto newBannerIndex = create_new_banner(GAME_COMMAND_FLAG_APPLY);
|
||||
if (newBannerIndex == BANNER_INDEX_NULL)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
|
||||
Reference in New Issue
Block a user