2017-11-20 11:13:55 +01:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2017-11-20 11:13:55 +01:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2017-11-20 11:13:55 +01:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2017-11-20 11:13:55 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "LargeScenery.h"
|
2018-06-22 23:17:03 +02:00
|
|
|
|
2018-09-14 12:12:22 +02:00
|
|
|
#include "../Context.h"
|
2018-09-15 10:56:35 +02:00
|
|
|
#include "../common.h"
|
2021-03-07 00:08:51 +01:00
|
|
|
#include "../object/LargeSceneryObject.h"
|
2018-09-14 12:12:22 +02:00
|
|
|
#include "../object/ObjectManager.h"
|
2019-07-25 17:51:22 +01:00
|
|
|
#include "../world/Banner.h"
|
2018-05-01 19:12:54 +02:00
|
|
|
#include "TileElement.h"
|
2017-11-20 11:13:55 +01:00
|
|
|
|
2018-09-14 12:12:22 +02:00
|
|
|
colour_t LargeSceneryElement::GetPrimaryColour() const
|
2017-11-20 11:13:55 +01:00
|
|
|
{
|
2019-08-30 22:07:07 +02:00
|
|
|
return Colour[0];
|
2017-11-20 11:13:55 +01:00
|
|
|
}
|
|
|
|
|
|
2018-09-14 12:12:22 +02:00
|
|
|
colour_t LargeSceneryElement::GetSecondaryColour() const
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2019-08-30 22:07:07 +02:00
|
|
|
return Colour[1];
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
2018-09-14 12:12:22 +02:00
|
|
|
void LargeSceneryElement::SetPrimaryColour(colour_t newColour)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2018-09-14 12:12:22 +02:00
|
|
|
assert(newColour <= 31);
|
2019-08-30 22:07:07 +02:00
|
|
|
Colour[0] = newColour;
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
2018-09-14 12:12:22 +02:00
|
|
|
void LargeSceneryElement::SetSecondaryColour(colour_t newColour)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2018-09-14 12:12:22 +02:00
|
|
|
assert(newColour <= 31);
|
2019-08-30 22:07:07 +02:00
|
|
|
Colour[1] = newColour;
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
2019-07-25 17:51:22 +01:00
|
|
|
Banner* LargeSceneryElement::GetBanner() const
|
|
|
|
|
{
|
2019-07-26 17:24:19 +01:00
|
|
|
return ::GetBanner(GetBannerIndex());
|
2019-07-25 17:51:22 +01:00
|
|
|
}
|
|
|
|
|
|
2018-09-14 12:12:22 +02:00
|
|
|
BannerIndex LargeSceneryElement::GetBannerIndex() const
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2019-08-30 22:07:07 +02:00
|
|
|
return BannerIndex;
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
2019-08-30 22:07:07 +02:00
|
|
|
void LargeSceneryElement::SetBannerIndex(::BannerIndex newIndex)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2019-08-30 22:07:07 +02:00
|
|
|
this->BannerIndex = newIndex;
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
2019-02-26 09:08:22 +00:00
|
|
|
bool LargeSceneryElement::IsAccounted() const
|
|
|
|
|
{
|
2020-03-04 21:47:34 +01:00
|
|
|
return (Flags2 & LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED) != 0;
|
2019-02-26 09:08:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LargeSceneryElement::SetIsAccounted(bool isAccounted)
|
|
|
|
|
{
|
|
|
|
|
if (isAccounted)
|
|
|
|
|
{
|
2020-03-04 21:47:34 +01:00
|
|
|
Flags2 |= LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED;
|
2019-02-26 09:08:22 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-03-04 21:47:34 +01:00
|
|
|
Flags2 &= ~LARGE_SCENERY_ELEMENT_FLAGS2_ACCOUNTED;
|
2019-02-26 09:08:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-25 00:10:47 +02:00
|
|
|
ObjectEntryIndex LargeSceneryElement::GetEntryIndex() const
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2019-08-30 22:07:07 +02:00
|
|
|
return EntryIndex;
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
2018-09-14 12:12:22 +02:00
|
|
|
rct_scenery_entry* LargeSceneryElement::GetEntry() const
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2018-09-14 12:12:22 +02:00
|
|
|
return get_large_scenery_entry(GetEntryIndex());
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
2021-03-07 00:08:51 +01:00
|
|
|
const LargeSceneryObject* LargeSceneryElement::GetObject() const
|
|
|
|
|
{
|
|
|
|
|
return static_cast<const LargeSceneryObject*>(object_entry_get_object(ObjectType::LargeScenery, GetEntryIndex()));
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-30 22:07:07 +02:00
|
|
|
uint8_t LargeSceneryElement::GetSequenceIndex() const
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2019-08-30 22:07:07 +02:00
|
|
|
return SequenceIndex;
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-25 00:10:47 +02:00
|
|
|
void LargeSceneryElement::SetEntryIndex(ObjectEntryIndex newIndex)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2019-08-30 22:07:07 +02:00
|
|
|
EntryIndex = newIndex;
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2018-09-14 12:12:22 +02:00
|
|
|
|
2019-08-30 22:07:07 +02:00
|
|
|
void LargeSceneryElement::SetSequenceIndex(uint8_t sequence)
|
2018-09-14 12:12:22 +02:00
|
|
|
{
|
2019-08-30 22:07:07 +02:00
|
|
|
SequenceIndex = sequence;
|
2018-09-14 12:12:22 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-25 00:10:47 +02:00
|
|
|
rct_scenery_entry* get_large_scenery_entry(ObjectEntryIndex entryIndex)
|
2018-09-14 12:12:22 +02:00
|
|
|
{
|
|
|
|
|
rct_scenery_entry* result = nullptr;
|
|
|
|
|
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
|
2020-11-09 10:36:37 +01:00
|
|
|
auto obj = objMgr.GetLoadedObject(ObjectType::LargeScenery, entryIndex);
|
2018-09-14 12:12:22 +02:00
|
|
|
if (obj != nullptr)
|
|
|
|
|
{
|
2020-04-17 16:08:22 -03:00
|
|
|
result = static_cast<rct_scenery_entry*>(obj->GetLegacyData());
|
2018-09-14 12:12:22 +02:00
|
|
|
}
|
|
|
|
|
return result;
|
2018-12-15 20:30:20 +01:00
|
|
|
}
|