diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 0eabfa7e1a..2d0186395e 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -1164,17 +1164,6 @@ STR_1773 :Only one on-ride photo section allowed per ride STR_1774 :Only one cable lift hill allowed per ride STR_1777 :Ride music STR_1778 :{STRINGID} - - -STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} Panda costume -STR_1780 :{INLINE_SPRITE}{255}{19}{00}{00} Tiger costume -STR_1781 :{INLINE_SPRITE}{00}{20}{00}{00} Elephant costume -STR_1782 :{INLINE_SPRITE}{01}{20}{00}{00} Roman costume -STR_1783 :{INLINE_SPRITE}{02}{20}{00}{00} Gorilla costume -STR_1784 :{INLINE_SPRITE}{03}{20}{00}{00} Snowman costume -STR_1785 :{INLINE_SPRITE}{04}{20}{00}{00} Knight costume -STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} Astronaut costume -STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} Bandit costume -STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} Sheriff costume -STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} Pirate costume STR_1790 :Select uniform colour for this type of staff STR_1791 :{WINDOW_COLOUR_2}Uniform colour: STR_1792 :Responding to {STRINGID} breakdown call diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 1da6b076b3..1d0dea5b82 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -31,12 +31,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include using namespace OpenRCT2::Numerics; @@ -129,10 +131,18 @@ namespace OpenRCT2::Ui::Windows _staffStatsWidgets, }; + struct AvailableCostume + { + ObjectEntryIndex index; + PeepAnimationsObject* object; + std::string rawName; + std::string friendlyName; + }; + class StaffWindow final : public Window { private: - EntertainerCostume _availableCostumes[EnumValue(EntertainerCostume::Count)]{}; + std::vector _availableCostumes; uint16_t _tabAnimationOffset = 0; int32_t _pickedPeepOldX = kLocationNull; @@ -140,6 +150,41 @@ namespace OpenRCT2::Ui::Windows void Initialise(EntityId entityId) { number = entityId.ToUnderlying(); + + if (GetStaff()->AssignedStaffType == StaffType::Entertainer) + InitialiseCostumeList(); + } + + void InitialiseCostumeList() + { + auto availCostumeIndexes = findAllPeepAnimationsIndexesForType(AnimationPeepType::Entertainer); + auto availCostumeObjects = findAllPeepAnimationsObjectForType(AnimationPeepType::Entertainer); + + _availableCostumes = {}; + for (auto i = 0u; i < availCostumeObjects.size(); i++) + { + auto baseName = availCostumeObjects[i]->GetCostumeName(); + auto inlineImageId = availCostumeObjects[i]->GetInlineImageId(); + + // std::format doesn't appear to be available on macOS <13.3 + std::stringstream out{}; + out << "{INLINE_SPRITE}"; + for (auto b = 0; b < 32; b += 8) + out << '{' << ((inlineImageId >> b) & 0xFF) << '}'; + out << ' '; + out << baseName; + + _availableCostumes.push_back({ + .index = availCostumeIndexes[i], + .object = availCostumeObjects[i], + .rawName = baseName, + .friendlyName = out.str(), + }); + } + + std::sort(_availableCostumes.begin(), _availableCostumes.end(), [](const auto& a, const auto& b) { + return a.rawName < b.rawName; + }); } void OnOpen() override @@ -152,6 +197,12 @@ namespace OpenRCT2::Ui::Windows CancelTools(); } + void OnLanguageChange() override + { + if (GetStaff()->AssignedStaffType == StaffType::Entertainer) + InitialiseCostumeList(); + } + void OnMouseUp(WidgetIndex widgetIndex) override { if (widgetIndex <= WIDX_TAB_3) @@ -778,19 +829,18 @@ namespace OpenRCT2::Ui::Windows } int32_t checkedIndex = -1; - // This will be moved below where Items Checked is when all - // of dropdown related functions are finished. This prevents - // the dropdown from not working on first click. - int32_t numCostumes = StaffGetAvailableEntertainerCostumeList(_availableCostumes); - for (int32_t i = 0; i < numCostumes; i++) + auto numCostumes = _availableCostumes.size(); + for (auto i = 0u; i < numCostumes; i++) { - EntertainerCostume costume = _availableCostumes[i]; - if (staff->AnimationGroup == EntertainerCostumeToSprite(costume)) - { + // TODO: refactor this hack + auto* nameStr = _availableCostumes[i].friendlyName.c_str(); + std::memcpy(&gDropdownItems[i].Args, &nameStr, sizeof(const char*)); + gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM; + + // Remember what item to check for the end of this event function + auto costumeIndex = _availableCostumes[i].index; + if (staff->AnimationObjectIndex == costumeIndex) checkedIndex = i; - } - gDropdownItems[i].Args = StaffCostumeNames[EnumValue(costume)]; - gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; } auto ddPos = ScreenCoordsXY{ ddWidget->left + windowPos.x, ddWidget->top + windowPos.y }; @@ -798,11 +848,9 @@ namespace OpenRCT2::Ui::Windows int32_t ddWidth = ddWidget->width() - 3; WindowDropdownShowTextCustomWidth(ddPos, ddHeight, colours[1], 0, Dropdown::Flag::StayOpen, numCostumes, ddWidth); - // See above note. + // Set selection if (checkedIndex != -1) - { Dropdown::SetChecked(checkedIndex, true); - } } void OptionsOnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) @@ -815,7 +863,7 @@ namespace OpenRCT2::Ui::Windows if (dropdownIndex == -1) return; - EntertainerCostume costume = _availableCostumes[dropdownIndex]; + ObjectEntryIndex costume = _availableCostumes[dropdownIndex].index; auto staffSetCostumeAction = StaffSetCostumeAction(EntityId::FromUnderlying(number), costume); GameActions::Execute(&staffSetCostumeAction); } @@ -839,12 +887,23 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_COSTUME_BOX].type = WindowWidgetType::DropdownMenu; widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Button; - // TODO: retrieve string from object instead - auto costumeType = EnumValue(staff->AnimationGroup) - EnumValue(PeepAnimationGroup::EntertainerPanda); - if (costumeType >= 0) - widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[costumeType]; + auto pos = std::find_if(_availableCostumes.begin(), _availableCostumes.end(), [staff](auto costume) { + return costume.index == staff->AnimationObjectIndex; + }); + + if (pos != _availableCostumes.end()) + { + auto index = std::distance(_availableCostumes.begin(), pos); + auto name = _availableCostumes[index].friendlyName.c_str(); + widgets[WIDX_COSTUME_BOX].string = const_cast(name); + widgets[WIDX_COSTUME_BOX].flags |= WIDGET_FLAGS::TEXT_IS_STRING; + } else - widgets[WIDX_COSTUME_BOX].text = STR_UNKNOWN_OBJECT_TYPE; + { + widgets[WIDX_COSTUME_BOX].text = STR_EMPTY; + widgets[WIDX_COSTUME_BOX].flags &= ~WIDGET_FLAGS::TEXT_IS_STRING; + } + break; } case StaffType::Handyman: diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 701e6d63a4..24b5e02e7c 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -701,19 +701,6 @@ namespace OpenRCT2::Ui::Windows return closestPeep; } - static EntertainerCostume GetRandomEntertainerCostume() - { - auto result = EntertainerCostume::Panda; - EntertainerCostume costumeList[EnumValue(EntertainerCostume::Count)]; - int32_t numCostumes = StaffGetAvailableEntertainerCostumeList(costumeList); - if (numCostumes > 0) - { - int32_t index = UtilRand() % numCostumes; - result = costumeList[index]; - } - return result; - } - static constexpr StaffNamingConvention GetStaffNamingConvention(StaffType type) { switch (type) diff --git a/src/openrct2/actions/StaffHireNewAction.cpp b/src/openrct2/actions/StaffHireNewAction.cpp index dda0647f06..6650975a38 100644 --- a/src/openrct2/actions/StaffHireNewAction.cpp +++ b/src/openrct2/actions/StaffHireNewAction.cpp @@ -161,6 +161,10 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const auto& objManager = GetContext()->GetObjectManager(); auto* animObj = objManager.GetLoadedObject(animObjectIndex); + newPeep->PeepFlags &= ~PEEP_FLAGS_SLOW_WALK; + if (animObj->IsSlowWalking()) + newPeep->PeepFlags |= PEEP_FLAGS_SLOW_WALK; + const auto& spriteBounds = animObj->GetSpriteBounds(newPeep->AnimationGroup); newPeep->SpriteData.Width = spriteBounds.sprite_width; newPeep->SpriteData.HeightMin = spriteBounds.sprite_height_negative; diff --git a/src/openrct2/actions/StaffSetCostumeAction.cpp b/src/openrct2/actions/StaffSetCostumeAction.cpp index 6bf6db55ca..7eeb2f1c4e 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.cpp +++ b/src/openrct2/actions/StaffSetCostumeAction.cpp @@ -14,31 +14,13 @@ #include "../entity/EntityRegistry.h" #include "../interface/Window.h" #include "../localisation/StringIds.h" +#include "../object/ObjectManager.h" +#include "../object/PeepAnimationsObject.h" #include "../windows/Intent.h" using namespace OpenRCT2; -/** rct2: 0x00982134 */ -constexpr bool peep_slow_walking_types[] = { - false, // PeepAnimationGroup::Normal - false, // PeepAnimationGroup::Handyman - false, // PeepAnimationGroup::Mechanic - false, // PeepAnimationGroup::Security - false, // PeepAnimationGroup::EntertainerPanda - false, // PeepAnimationGroup::EntertainerTiger - false, // PeepAnimationGroup::EntertainerElephant - false, // PeepAnimationGroup::EntertainerRoman - false, // PeepAnimationGroup::EntertainerGorilla - false, // PeepAnimationGroup::EntertainerSnowman - false, // PeepAnimationGroup::EntertainerKnight - true, // PeepAnimationGroup::EntertainerAstronaut - false, // PeepAnimationGroup::EntertainerBandit - false, // PeepAnimationGroup::EntertainerSheriff - true, // PeepAnimationGroup::EntertainerPirate - true, // PeepAnimationGroup::Balloon -}; - -StaffSetCostumeAction::StaffSetCostumeAction(EntityId spriteIndex, EntertainerCostume costume) +StaffSetCostumeAction::StaffSetCostumeAction(EntityId spriteIndex, ObjectEntryIndex costume) : _spriteIndex(spriteIndex) , _costume(costume) { @@ -78,8 +60,11 @@ GameActions::Result StaffSetCostumeAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } - auto spriteType = EntertainerCostumeToSprite(_costume); - if (EnumValue(spriteType) > std::size(peep_slow_walking_types)) + auto& objManager = GetContext()->GetObjectManager(); + auto* animObj = objManager.GetLoadedObject(_costume); + + auto animPeepType = AnimationPeepType(static_cast(staff->AssignedStaffType) + 1); + if (animObj->GetPeepType() != animPeepType) { LOG_ERROR("Invalid entertainer costume %u", _costume); return GameActions::Result( @@ -97,13 +82,16 @@ GameActions::Result StaffSetCostumeAction::Execute() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND); } - auto spriteType = EntertainerCostumeToSprite(_costume); - staff->AnimationGroup = spriteType; + staff->AnimationObjectIndex = _costume; + staff->AnimationGroup = PeepAnimationGroup::Normal; + + auto& objManager = GetContext()->GetObjectManager(); + auto* animObj = objManager.GetLoadedObject(_costume); + staff->PeepFlags &= ~PEEP_FLAGS_SLOW_WALK; - if (peep_slow_walking_types[EnumValue(spriteType)]) - { + if (animObj->IsSlowWalking()) staff->PeepFlags |= PEEP_FLAGS_SLOW_WALK; - } + staff->AnimationFrameNum = 0; staff->UpdateCurrentAnimationType(); staff->Invalidate(); diff --git a/src/openrct2/actions/StaffSetCostumeAction.h b/src/openrct2/actions/StaffSetCostumeAction.h index 1eefeacfd7..0912663bb1 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.h +++ b/src/openrct2/actions/StaffSetCostumeAction.h @@ -16,11 +16,11 @@ class StaffSetCostumeAction final : public GameActionBase(entertainerType); - PeepAnimationGroup newAnimationGroup = static_cast( - value + EnumValue(PeepAnimationGroup::EntertainerPanda)); - return newAnimationGroup; -} - colour_t StaffGetColour(StaffType staffType) { const auto& gameState = GetGameState(); @@ -1011,42 +987,6 @@ GameActions::Result StaffSetColour(StaffType staffType, colour_t value) return GameActions::Result(); } -uint32_t StaffGetAvailableEntertainerCostumes() -{ - uint32_t entertainerCostumes = 0; - for (int32_t i = 0; i < kMaxSceneryGroupObjects; i++) - { - if (SceneryGroupIsInvented(i)) - { - const auto sgEntry = OpenRCT2::ObjectManager::GetObjectEntry(i); - entertainerCostumes |= sgEntry->entertainer_costumes; - } - } - - // For some reason the flags are +4 from the actual costume IDs - entertainerCostumes >>= 4; - - // Fix #6593: force enable the default costumes, which normally get enabled through the default scenery groups. - entertainerCostumes |= (1 << static_cast(EntertainerCostume::Panda)) - | (1 << static_cast(EntertainerCostume::Tiger)) | (1 << static_cast(EntertainerCostume::Elephant)); - - return entertainerCostumes; -} - -int32_t StaffGetAvailableEntertainerCostumeList(EntertainerCostume* costumeList) -{ - uint32_t availableCostumes = StaffGetAvailableEntertainerCostumes(); - int32_t numCostumes = 0; - for (uint8_t i = 0; i < static_cast(EntertainerCostume::Count); i++) - { - if (availableCostumes & (1 << i)) - { - costumeList[numCostumes++] = static_cast(i); - } - } - return numCostumes; -} - /** rct2: 0x009929C8 */ static constexpr CoordsXY _MowingWaypoints[] = { { 28, 28 }, { 28, 4 }, { 20, 4 }, { 20, 28 }, { 12, 28 }, { 12, 4 }, { 4, 4 }, { 4, 28 }, diff --git a/src/openrct2/entity/Staff.h b/src/openrct2/entity/Staff.h index d58d392722..bc1b7737bf 100644 --- a/src/openrct2/entity/Staff.h +++ b/src/openrct2/entity/Staff.h @@ -155,12 +155,8 @@ enum class EntertainerCostume : uint8_t Count }; -extern const StringId StaffCostumeNames[EnumValue(EntertainerCostume::Count)]; - colour_t StaffGetColour(StaffType staffType); OpenRCT2::GameActions::Result StaffSetColour(StaffType staffType, colour_t value); -uint32_t StaffGetAvailableEntertainerCostumes(); -int32_t StaffGetAvailableEntertainerCostumeList(EntertainerCostume* costumeList); money64 GetStaffWage(StaffType type); PeepAnimationGroup EntertainerCostumeToSprite(EntertainerCostume entertainerType); diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 06d04c8cf4..6a885d46a1 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -53,6 +53,7 @@ #include "../object/ObjectList.h" #include "../object/ObjectManager.h" #include "../object/ObjectRepository.h" +#include "../object/PeepAnimationsObject.h" #include "../platform/Platform.h" #include "../profiling/Profiling.h" #include "../ride/Ride.h" @@ -476,14 +477,15 @@ static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t& { console.WriteFormatLine("staff set energy "); console.WriteFormatLine("staff set costume "); - for (int32_t i = 0; i < static_cast(EntertainerCostume::Count); i++) + + auto _availableCostumeIndexes = findAllPeepAnimationsIndexesForType(AnimationPeepType::Entertainer); + auto _availableCostumeObjects = findAllPeepAnimationsObjectForType(AnimationPeepType::Entertainer); + + for (auto i = 0u; i < _availableCostumeIndexes.size(); i++) { - char costume_name[128] = { 0 }; - StringId costume = StaffCostumeNames[i]; - OpenRCT2::FormatStringLegacy(costume_name, 128, STR_STRINGID, &costume); - // That's a terrible hack here. Costume names include inline sprites - // that don't work well with the console, so manually skip past them. - console.WriteFormatLine(" costume %i: %s", i, costume_name + 7); + auto index = _availableCostumeIndexes[i]; + auto name = _availableCostumeObjects[i]->GetCostumeName(); + console.WriteFormatLine(" costume %i: %s", index, name.c_str()); } return; } @@ -526,13 +528,14 @@ static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t& console.WriteLineError("Specified staff is not entertainer"); return; } - if (!int_valid[1] || int_val[1] < 0 || int_val[1] >= static_cast(EntertainerCostume::Count)) + auto& objManager = GetContext()->GetObjectManager(); + if (!int_valid[1] || int_val[1] < 0 || objManager.GetLoadedObject(int_val[1]) == nullptr) { console.WriteLineError("Invalid costume ID"); return; } - EntertainerCostume costume = static_cast(int_val[1]); + auto costume = static_cast(int_val[1]); auto staffSetCostumeAction = StaffSetCostumeAction(EntityId::FromUnderlying(int_val[0]), costume); GameActions::Execute(&staffSetCostumeAction); } diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 09b06435c2..3a5e7af55f 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -602,17 +602,17 @@ enum : StringId // STR_OPTIONS_RIDE_MUSIC_OFF = 1775, // STR_OPTIONS_RIDE_MUSIC_ON = 1776, STR_SCROLLING_SIGN_TEXT = 1778, - STR_STAFF_OPTION_COSTUME_PANDA = 1779, - STR_STAFF_OPTION_COSTUME_TIGER = 1780, - STR_STAFF_OPTION_COSTUME_ELEPHANT = 1781, - STR_STAFF_OPTION_COSTUME_ROMAN = 1782, - STR_STAFF_OPTION_COSTUME_GORILLA = 1783, - STR_STAFF_OPTION_COSTUME_SNOWMAN = 1784, - STR_STAFF_OPTION_COSTUME_KNIGHT = 1785, - STR_STAFF_OPTION_COSTUME_ASTRONAUT = 1786, - STR_STAFF_OPTION_COSTUME_BANDIT = 1787, - STR_STAFF_OPTION_COSTUME_SHERIFF = 1788, - STR_STAFF_OPTION_COSTUME_PIRATE = 1789, + // STR_STAFF_OPTION_COSTUME_PANDA = 1779, + // STR_STAFF_OPTION_COSTUME_TIGER = 1780, + // STR_STAFF_OPTION_COSTUME_ELEPHANT = 1781, + // STR_STAFF_OPTION_COSTUME_ROMAN = 1782, + // STR_STAFF_OPTION_COSTUME_GORILLA = 1783, + // STR_STAFF_OPTION_COSTUME_SNOWMAN = 1784, + // STR_STAFF_OPTION_COSTUME_KNIGHT = 1785, + // STR_STAFF_OPTION_COSTUME_ASTRONAUT = 1786, + // STR_STAFF_OPTION_COSTUME_BANDIT = 1787, + // STR_STAFF_OPTION_COSTUME_SHERIFF = 1788, + // STR_STAFF_OPTION_COSTUME_PIRATE = 1789, STR_RESPONDING_TO_RIDE_BREAKDOWN_CALL = 1792, STR_HEADING_TO_RIDE_FOR_INSPECTION = 1793, STR_FIXING_RIDE = 1794, diff --git a/src/openrct2/object/PeepAnimationsObject.cpp b/src/openrct2/object/PeepAnimationsObject.cpp index afd02d1736..d778056671 100644 --- a/src/openrct2/object/PeepAnimationsObject.cpp +++ b/src/openrct2/object/PeepAnimationsObject.cpp @@ -60,6 +60,9 @@ void PeepAnimationsObject::ReadJson(IReadObjectContext* context, json_t& root) Guard::Assert(root["peepType"].is_string(), "PeepAnimationsObject::ReadJson expects peepType to be a string"); _peepType = animationPeepTypeMap[Json::GetString(root["peepType"])]; + Guard::Assert(root["isSlowWalking"].is_boolean(), "PeepAnimationsObject::ReadJson expects isSlowWalking to be a boolean"); + _slowWalking = Json::GetBoolean(root["isSlowWalking"]); + auto& requiredAnimationMap = getAnimationsByPeepType(_peepType); _animationGroups.clear(); @@ -105,6 +108,11 @@ void PeepAnimationsObject::ReadJson(IReadObjectContext* context, json_t& root) } } +std::string PeepAnimationsObject::GetCostumeName() const +{ + return GetStringTable().GetString(ObjectStringID::NAME); +} + ImageIndex PeepAnimationsObject::GetInlineImageId() const { return _imageOffsetId; diff --git a/src/openrct2/object/PeepAnimationsObject.h b/src/openrct2/object/PeepAnimationsObject.h index b46e110c91..e8f131f179 100644 --- a/src/openrct2/object/PeepAnimationsObject.h +++ b/src/openrct2/object/PeepAnimationsObject.h @@ -20,6 +20,7 @@ class PeepAnimationsObject final : public Object private: ImageIndex _imageOffsetId; OpenRCT2::AnimationPeepType _peepType; + bool _slowWalking; std::vector _animationGroups; public: @@ -29,7 +30,9 @@ public: void Load() override; void Unload() override; + std::string GetCostumeName() const; ImageIndex GetInlineImageId() const; + const OpenRCT2::PeepAnimation& GetPeepAnimation( PeepAnimationGroup animGroup, PeepAnimationType animType = PeepAnimationType::Walking) const; const OpenRCT2::SpriteBounds& GetSpriteBounds( @@ -39,5 +42,10 @@ public: size_t GetNumAnimationGroups() const; PeepAnimationGroup GetLegacyPosition(PeepAnimationGroup animGroup) const; + bool IsSlowWalking() + { + return _slowWalking; + }; + void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override; }; diff --git a/src/openrct2/object/SceneryGroupObject.cpp b/src/openrct2/object/SceneryGroupObject.cpp index 4445c3e961..3310c2103c 100644 --- a/src/openrct2/object/SceneryGroupObject.cpp +++ b/src/openrct2/object/SceneryGroupObject.cpp @@ -154,7 +154,7 @@ void SceneryGroupObject::ReadJson(IReadObjectContext* context, json_t& root) if (properties.is_object()) { _legacyType.priority = Json::GetNumber(properties["priority"], 40); - _legacyType.entertainer_costumes = ReadJsonEntertainerCostumes(properties["entertainerCostumes"]); + _legacyType.entertainer_costumes = 0; _items = ReadJsonEntries(context, properties["entries"]); } @@ -162,45 +162,6 @@ void SceneryGroupObject::ReadJson(IReadObjectContext* context, json_t& root) PopulateTablesFromJson(context, root); } -uint32_t SceneryGroupObject::ReadJsonEntertainerCostumes(json_t& jCostumes) -{ - uint32_t costumes = 0; - for (auto& jCostume : jCostumes) - { - auto entertainer = ParseEntertainerCostume(Json::GetString(jCostume)); - auto peepSprite = EntertainerCostumeToSprite(entertainer); - costumes |= 1 << (static_cast(peepSprite)); - } - return costumes; -} - -EntertainerCostume SceneryGroupObject::ParseEntertainerCostume(const std::string& s) -{ - if (s == "panda") - return EntertainerCostume::Panda; - if (s == "tiger") - return EntertainerCostume::Tiger; - if (s == "elephant") - return EntertainerCostume::Elephant; - if (s == "roman") - return EntertainerCostume::Roman; - if (s == "gorilla") - return EntertainerCostume::Gorilla; - if (s == "snowman") - return EntertainerCostume::Snowman; - if (s == "knight") - return EntertainerCostume::Knight; - if (s == "astronaut") - return EntertainerCostume::Astronaut; - if (s == "bandit") - return EntertainerCostume::Bandit; - if (s == "sheriff") - return EntertainerCostume::Sheriff; - if (s == "pirate") - return EntertainerCostume::Pirate; - return EntertainerCostume::Panda; -} - std::vector SceneryGroupObject::ReadJsonEntries(IReadObjectContext* context, json_t& jEntries) { std::vector entries; diff --git a/src/openrct2/object/SceneryGroupObject.h b/src/openrct2/object/SceneryGroupObject.h index f3be895992..c1d6d75e9a 100644 --- a/src/openrct2/object/SceneryGroupObject.h +++ b/src/openrct2/object/SceneryGroupObject.h @@ -16,8 +16,6 @@ struct ObjectRepositoryItem; -enum class EntertainerCostume : uint8_t; - class SceneryGroupObject final : public Object { private: @@ -47,7 +45,5 @@ public: private: static std::vector ReadItems(OpenRCT2::IStream* stream); - static uint32_t ReadJsonEntertainerCostumes(json_t& jCostumes); - static EntertainerCostume ParseEntertainerCostume(const std::string& s); static std::vector ReadJsonEntries(IReadObjectContext* context, json_t& jEntries); };