mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Add checks to ensure an animation object is selected for each peep type
This commit is contained in:
@@ -3781,3 +3781,9 @@ STR_6714 :Filename
|
||||
STR_6715 :Date modified
|
||||
STR_6716 :File size
|
||||
STR_6717 :File size {STRINGID}
|
||||
STR_6718 :Peep Animations
|
||||
STR_6719 :At least one guest peep animations object must be selected
|
||||
STR_6720 :At least one handyman peep animations object must be selected
|
||||
STR_6721 :At least one mechanic peep animations object must be selected
|
||||
STR_6722 :At least one security peep animations object must be selected
|
||||
STR_6723 :At least one entertainer peep animations object must be selected
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
static ObjectSubTab kPeepObjectSubTabs[] = {
|
||||
{ STR_OBJECT_SELECTION_PEEP_NAMES, ObjectType::PeepAnimations, FILTER_NONE, SPR_G2_PEEP_ANIMATIONS, 1, 1 },
|
||||
{ STR_OBJECT_SELECTION_PEEP_ANIMATIONS, ObjectType::PeepAnimations, FILTER_NONE, SPR_G2_PEEP_ANIMATIONS, 1, 1 },
|
||||
{ STR_OBJECT_SELECTION_PEEP_NAMES, ObjectType::PeepNames, FILTER_NONE, SPR_TAB_GUESTS_0, 1, 1 },
|
||||
};
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "object/DefaultObjects.h"
|
||||
#include "object/ObjectManager.h"
|
||||
#include "object/ObjectRepository.h"
|
||||
#include "peep/PeepAnimations.h"
|
||||
#include "rct1/RCT1.h"
|
||||
#include "scenario/Scenario.h"
|
||||
#include "ui/UiContext.h"
|
||||
@@ -447,6 +448,23 @@ namespace OpenRCT2::Editor
|
||||
}
|
||||
}
|
||||
|
||||
using OpenRCT2::AnimationPeepType;
|
||||
constexpr std::pair<AnimationPeepType, StringId> kPeepCheckPairs[] = {
|
||||
{ AnimationPeepType::Guest, STR_AT_LEAST_ONE_GUEST_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED },
|
||||
{ AnimationPeepType::Handyman, STR_AT_LEAST_ONE_HANDYMAN_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED },
|
||||
{ AnimationPeepType::Mechanic, STR_AT_LEAST_ONE_MECHANIC_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED },
|
||||
{ AnimationPeepType::Security, STR_AT_LEAST_ONE_SECURITY_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED },
|
||||
{ AnimationPeepType::Entertainer, STR_AT_LEAST_ONE_ENTERTAINER_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED },
|
||||
};
|
||||
|
||||
for (auto& pair : kPeepCheckPairs)
|
||||
{
|
||||
if (!EditorCheckObjectGroupAtLeastOneOfPeepTypeSelected(EnumValue(pair.first)))
|
||||
{
|
||||
return { ObjectType::PeepAnimations, pair.second };
|
||||
}
|
||||
}
|
||||
|
||||
return { ObjectType::None, STR_NONE };
|
||||
}
|
||||
|
||||
|
||||
@@ -687,6 +687,23 @@ bool EditorCheckObjectGroupAtLeastOneSelected(ObjectType checkObjectType)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EditorCheckObjectGroupAtLeastOneOfPeepTypeSelected(uint8_t peepType)
|
||||
{
|
||||
auto numObjects = std::min(ObjectRepositoryGetItemsCount(), _objectSelectionFlags.size());
|
||||
const ObjectRepositoryItem* items = ObjectRepositoryGetItems();
|
||||
|
||||
for (size_t i = 0; i < numObjects; i++)
|
||||
{
|
||||
const auto isAnimObjectType = items[i].Type == ObjectType::PeepAnimations;
|
||||
const bool isSelected = _objectSelectionFlags[i] & ObjectSelectionFlags::Selected;
|
||||
if (isAnimObjectType && isSelected && items[i].PeepAnimationsInfo.PeepType == peepType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EditorCheckObjectGroupAtLeastOneSurfaceSelected(bool queue)
|
||||
{
|
||||
auto numObjects = std::min(ObjectRepositoryGetItemsCount(), _objectSelectionFlags.size());
|
||||
|
||||
@@ -29,6 +29,7 @@ extern std::vector<uint8_t> _objectSelectionFlags;
|
||||
extern uint32_t _numSelectedObjectsForType[EnumValue(ObjectType::Count)];
|
||||
|
||||
bool EditorCheckObjectGroupAtLeastOneSelected(ObjectType checkObjectType);
|
||||
bool EditorCheckObjectGroupAtLeastOneOfPeepTypeSelected(uint8_t peepType);
|
||||
bool EditorCheckObjectGroupAtLeastOneSurfaceSelected(bool queue);
|
||||
void EditorObjectFlagsFree();
|
||||
void UnloadUnselectedObjects();
|
||||
|
||||
@@ -1696,6 +1696,13 @@ enum : StringId
|
||||
|
||||
STR_AT_LEAST_ONE_PEEP_NAMES_OBJECT_MUST_BE_SELECTED = 6676,
|
||||
|
||||
STR_OBJECT_SELECTION_PEEP_ANIMATIONS = 6718,
|
||||
STR_AT_LEAST_ONE_GUEST_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED = 6719,
|
||||
STR_AT_LEAST_ONE_HANDYMAN_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED = 6720,
|
||||
STR_AT_LEAST_ONE_MECHANIC_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED = 6721,
|
||||
STR_AT_LEAST_ONE_SECURITY_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED = 6722,
|
||||
STR_AT_LEAST_ONE_ENTERTAINER_PEEP_ANIMATIONS_OBJECT_MUST_BE_SELECTED = 6723,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ class ObjectFileIndex final : public FileIndex<ObjectRepositoryItem>
|
||||
{
|
||||
private:
|
||||
static constexpr uint32_t MAGIC_NUMBER = 0x5844494F; // OIDX
|
||||
static constexpr uint16_t VERSION = 29;
|
||||
static constexpr uint16_t VERSION = 30;
|
||||
static constexpr auto PATTERN = "*.dat;*.pob;*.json;*.parkobj";
|
||||
|
||||
IObjectRepository& _objectRepository;
|
||||
@@ -160,6 +160,9 @@ protected:
|
||||
case ObjectType::FootpathSurface:
|
||||
ds << item.FootpathSurfaceInfo.Flags;
|
||||
break;
|
||||
case ObjectType::PeepAnimations:
|
||||
ds << item.PeepAnimationsInfo.PeepType;
|
||||
break;
|
||||
default:
|
||||
// Switch processes only ObjectType::Ride and ObjectType::SceneryGroup
|
||||
break;
|
||||
|
||||
@@ -63,6 +63,10 @@ struct ObjectRepositoryItem
|
||||
{
|
||||
uint8_t Flags{};
|
||||
} FootpathSurfaceInfo;
|
||||
struct
|
||||
{
|
||||
uint8_t PeepType{};
|
||||
} PeepAnimationsInfo;
|
||||
|
||||
[[nodiscard]] ObjectSourceGame GetFirstSourceGame() const
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "../core/Json.hpp"
|
||||
#include "../peep/PeepAnimations.h"
|
||||
#include "../rct12/RCT12.h"
|
||||
#include "ObjectRepository.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
@@ -155,3 +156,8 @@ void PeepAnimationsObject::DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_
|
||||
GfxDrawSprite(dpi, ImageId(_imageOffsetId + 1, COLOUR_BRIGHT_RED, COLOUR_TEAL), centre + ScreenCoordsXY{ +32, -24 });
|
||||
GfxDrawSprite(dpi, ImageId(_imageOffsetId + 3, COLOUR_BRIGHT_RED, COLOUR_TEAL), centre + ScreenCoordsXY{ -32, +32 });
|
||||
}
|
||||
|
||||
void PeepAnimationsObject::SetRepositoryItem(ObjectRepositoryItem* item) const
|
||||
{
|
||||
item->PeepAnimationsInfo.PeepType = EnumValue(_peepType);
|
||||
}
|
||||
|
||||
@@ -48,4 +48,5 @@ public:
|
||||
};
|
||||
|
||||
void DrawPreview(DrawPixelInfo& dpi, int32_t width, int32_t height) const override;
|
||||
void SetRepositoryItem(ObjectRepositoryItem* item) const override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user