forked from rosebudai/OpenRCT2-Web
Rename fields of PeepAnimation
This commit is contained in:
14 files changed
+40
-40
No files matched your search
@@ -281,7 +281,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
uint32_t image_id_base = animObj->GetPeepAnimation(peep->AnimationGroup).base_image;
|
||||
uint32_t image_id_base = animObj->GetPeepAnimation(peep->AnimationGroup).baseImage;
|
||||
image_id_base += currentFrame & 0xFFFFFFFC;
|
||||
image_id_base++;
|
||||
|
||||
|
||||
@@ -569,7 +569,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
int32_t animationFrame = animObj->GetPeepAnimation(peep->AnimationGroup).base_image + 1;
|
||||
int32_t animationFrame = animObj->GetPeepAnimation(peep->AnimationGroup).baseImage + 1;
|
||||
int32_t animationFrameOffset = 0;
|
||||
|
||||
if (page == WINDOW_GUEST_OVERVIEW)
|
||||
@@ -904,7 +904,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Get pickup animation length
|
||||
const auto& pickAnim = animObj->GetPeepAnimation(peep->AnimationGroup, PeepAnimationType::Hanging);
|
||||
const auto pickAnimLength = pickAnim.frame_offsets.size();
|
||||
const auto pickAnimLength = pickAnim.frameOffsets.size();
|
||||
|
||||
// Update pickup animation, can only happen in this tab.
|
||||
pickedPeepFrame++;
|
||||
@@ -1006,7 +1006,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
auto baseImageId = animObj->GetPeepAnimation(peep->AnimationGroup, PeepAnimationType::Hanging).base_image;
|
||||
auto baseImageId = animObj->GetPeepAnimation(peep->AnimationGroup, PeepAnimationType::Hanging).baseImage;
|
||||
baseImageId += pickedPeepFrame >> 2;
|
||||
gPickupPeepImage = ImageId(baseImageId, peep->TshirtColour, peep->TrousersColour);
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Tab 1 image
|
||||
auto i = (_selectedTab == TabId::Individual ? _tabAnimationIndex & ~3 : 0);
|
||||
auto* animObj = findPeepAnimationsObjectForType(AnimationPeepType::guest);
|
||||
i += animObj->GetPeepAnimation(PeepAnimationGroup::Normal).base_image + 1;
|
||||
i += animObj->GetPeepAnimation(PeepAnimationGroup::Normal).baseImage + 1;
|
||||
GfxDrawSprite(
|
||||
rt, ImageId(i, COLOUR_GREY, COLOUR_DARK_OLIVE_GREEN),
|
||||
windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].midX(), widgets[WIDX_TAB_1].bottom - 6 });
|
||||
|
||||
@@ -527,7 +527,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
ImageIndex imageId = animObj->GetPeepAnimation(spriteType).base_image + 1;
|
||||
ImageIndex imageId = animObj->GetPeepAnimation(spriteType).baseImage + 1;
|
||||
auto image = ImageId(imageId, peep->TshirtColour, peep->TrousersColour);
|
||||
GfxDrawSprite(clippedRT, image, clipCoords);
|
||||
break;
|
||||
|
||||
@@ -1236,7 +1236,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto* animObj = findPeepAnimationsObjectForType(AnimationPeepType::guest);
|
||||
ImageId peepImage(
|
||||
animObj->GetPeepAnimation(PeepAnimationGroup::Normal).base_image + 1, COLOUR_BRIGHT_RED, COLOUR_TEAL);
|
||||
animObj->GetPeepAnimation(PeepAnimationGroup::Normal).baseImage + 1, COLOUR_BRIGHT_RED, COLOUR_TEAL);
|
||||
if (page == WINDOW_PARK_PAGE_GUESTS)
|
||||
peepImage = peepImage.WithIndexOffset(_peepAnimationFrame & 0xFFFFFFFC);
|
||||
|
||||
|
||||
@@ -1327,7 +1327,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
spriteIndex = pickedPeepFrame & ~3;
|
||||
|
||||
auto* animObj = findPeepAnimationsObjectForType(AnimationPeepType::guest);
|
||||
spriteIndex += animObj->GetPeepAnimation(PeepAnimationGroup::Normal).base_image + 1;
|
||||
spriteIndex += animObj->GetPeepAnimation(PeepAnimationGroup::Normal).baseImage + 1;
|
||||
|
||||
GfxDrawSprite(
|
||||
rt, ImageId(spriteIndex, COLOUR_BRIGHT_RED, COLOUR_TEAL),
|
||||
|
||||
@@ -612,7 +612,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (page == WINDOW_STAFF_OVERVIEW)
|
||||
animFrame = _tabAnimationOffset / 4;
|
||||
|
||||
auto imageIndex = anim.base_image + 1 + anim.frame_offsets[animFrame] * 4;
|
||||
auto imageIndex = anim.baseImage + 1 + anim.frameOffsets[animFrame] * 4;
|
||||
GfxDrawSprite(clippedRT, ImageId(imageIndex, staff->TshirtColour, staff->TrousersColour), screenCoords);
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Get walking animation length
|
||||
const auto& walkingAnim = animObj->GetPeepAnimation(staff->AnimationGroup, PeepAnimationType::Walking);
|
||||
const auto walkingAnimLength = walkingAnim.frame_offsets.size();
|
||||
const auto walkingAnimLength = walkingAnim.frameOffsets.size();
|
||||
|
||||
// Overview tab animation offset
|
||||
_tabAnimationOffset++;
|
||||
@@ -641,7 +641,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Get pickup animation length
|
||||
const auto& pickAnim = animObj->GetPeepAnimation(staff->AnimationGroup, PeepAnimationType::Hanging);
|
||||
const auto pickAnimLength = pickAnim.frame_offsets.size();
|
||||
const auto pickAnimLength = pickAnim.frameOffsets.size();
|
||||
|
||||
// Update pickup animation frame
|
||||
pickedPeepFrame++;
|
||||
@@ -695,7 +695,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(staff->AnimationObjectIndex);
|
||||
|
||||
auto& pickupAnim = animObj->GetPeepAnimation(staff->AnimationGroup, PeepAnimationType::Hanging);
|
||||
auto baseImageId = pickupAnim.base_image + pickupAnim.frame_offsets[pickedPeepFrame >> 2];
|
||||
auto baseImageId = pickupAnim.baseImage + pickupAnim.frameOffsets[pickedPeepFrame >> 2];
|
||||
gPickupPeepImage = ImageId(baseImageId, staff->TshirtColour, staff->TrousersColour);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto& anim = animObj->GetPeepAnimation(PeepAnimationGroup::Normal);
|
||||
_tabAnimationIndex++;
|
||||
|
||||
if (_tabAnimationIndex >= anim.frame_offsets.size() * 4)
|
||||
if (_tabAnimationIndex >= anim.frameOffsets.size() * 4)
|
||||
_tabAnimationIndex = 0;
|
||||
|
||||
invalidateWidget(WIDX_STAFF_LIST_HANDYMEN_TAB + _selectedTab);
|
||||
@@ -612,7 +612,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto frame = _selectedTab == tabIndex ? _tabAnimationIndex / 4 : 0;
|
||||
auto& anim = animObj->GetPeepAnimation(PeepAnimationGroup::Normal);
|
||||
auto imageId = anim.base_image + 1 + anim.frame_offsets[frame] * 4;
|
||||
auto imageId = anim.baseImage + 1 + anim.frameOffsets[frame] * 4;
|
||||
|
||||
GfxDrawSprite(
|
||||
rt, ImageId(imageId, colour),
|
||||
@@ -635,7 +635,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto frame = _selectedTab == tabIndex ? _tabAnimationIndex / 4 : 0;
|
||||
auto& anim = animObj->GetPeepAnimation(PeepAnimationGroup::Normal);
|
||||
auto imageId = anim.base_image + 1 + anim.frame_offsets[frame] * 4;
|
||||
auto imageId = anim.baseImage + 1 + anim.frameOffsets[frame] * 4;
|
||||
|
||||
GfxDrawSprite(clippedDpi, ImageId(imageId), { 15, 23 });
|
||||
}
|
||||
|
||||
@@ -480,12 +480,12 @@ bool Peep::UpdateActionAnimation()
|
||||
AnimationFrameNum++;
|
||||
|
||||
// If last frame of action
|
||||
if (AnimationFrameNum >= peepAnimation.frame_offsets.size())
|
||||
if (AnimationFrameNum >= peepAnimation.frameOffsets.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AnimationImageIdOffset = peepAnimation.frame_offsets[AnimationFrameNum];
|
||||
AnimationImageIdOffset = peepAnimation.frameOffsets[AnimationFrameNum];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -539,11 +539,11 @@ void Peep::UpdateWalkingAnimation()
|
||||
|
||||
WalkingAnimationFrameNum++;
|
||||
const PeepAnimation& peepAnimation = animObj->GetPeepAnimation(AnimationGroup, AnimationType);
|
||||
if (WalkingAnimationFrameNum >= peepAnimation.frame_offsets.size())
|
||||
if (WalkingAnimationFrameNum >= peepAnimation.frameOffsets.size())
|
||||
{
|
||||
WalkingAnimationFrameNum = 0;
|
||||
}
|
||||
AnimationImageIdOffset = peepAnimation.frame_offsets[WalkingAnimationFrameNum];
|
||||
AnimationImageIdOffset = peepAnimation.frameOffsets[WalkingAnimationFrameNum];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2762,7 +2762,7 @@ void Peep::Paint(PaintSession& session, int32_t imageDirection) const
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(AnimationObjectIndex);
|
||||
|
||||
uint32_t baseImageId = animObj->GetPeepAnimation(AnimationGroup, actionAnimationGroup).base_image;
|
||||
uint32_t baseImageId = animObj->GetPeepAnimation(AnimationGroup, actionAnimationGroup).baseImage;
|
||||
|
||||
// Offset frame onto the base image, using rotation except for the 'picked up' state
|
||||
if (actionAnimationGroup != PeepAnimationType::Hanging)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRCT2
|
||||
auto& requiredAnimationMap = getAnimationsByPeepType(_peepType);
|
||||
for (auto& [typeStr, typeEnum] : requiredAnimationMap)
|
||||
{
|
||||
group[typeEnum].base_image = _imageOffsetId + group[typeEnum].imageTableOffset;
|
||||
group[typeEnum].baseImage = _imageOffsetId + group[typeEnum].imageTableOffset;
|
||||
group[typeEnum].bounds = inferMaxAnimationDimensions(group[typeEnum]);
|
||||
|
||||
// Balloons, hats and umbrellas are painted separately, so the inference
|
||||
@@ -119,10 +119,10 @@ namespace OpenRCT2
|
||||
if (referenceAnim.imageTableOffset != 0)
|
||||
{
|
||||
LOG_VERBOSE("Copying animation '%s' from primary group", std::string(typeStr).c_str());
|
||||
std::vector<uint8_t> sequence = referenceAnim.frame_offsets;
|
||||
std::vector<uint8_t> sequence = referenceAnim.frameOffsets;
|
||||
group[typeEnum] = {
|
||||
.imageTableOffset = referenceAnim.imageTableOffset,
|
||||
.frame_offsets = sequence,
|
||||
.frameOffsets = sequence,
|
||||
};
|
||||
continue;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace OpenRCT2
|
||||
|
||||
group[typeEnum] = {
|
||||
.imageTableOffset = Json::GetNumber<uint16_t>(animJson["offset"]),
|
||||
.frame_offsets = sequence,
|
||||
.frameOffsets = sequence,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -299,10 +299,10 @@ namespace OpenRCT2
|
||||
.zoom_level = ZoomLevel{ 0 },
|
||||
};
|
||||
|
||||
const auto numImages = *(std::max_element(anim.frame_offsets.begin(), anim.frame_offsets.end())) + 1;
|
||||
const auto numImages = *(std::max_element(anim.frameOffsets.begin(), anim.frameOffsets.end())) + 1;
|
||||
for (int32_t i = 0; i < numImages; ++i)
|
||||
{
|
||||
GfxDrawSpriteSoftware(rt, ImageId(anim.base_image + i), { 0, 0 });
|
||||
GfxDrawSpriteSoftware(rt, ImageId(anim.baseImage + i), { 0, 0 });
|
||||
}
|
||||
|
||||
int32_t spriteWidth = -1;
|
||||
|
||||
@@ -46,8 +46,8 @@ namespace OpenRCT2
|
||||
struct PeepAnimation
|
||||
{
|
||||
ImageIndex imageTableOffset;
|
||||
std::vector<uint8_t> frame_offsets;
|
||||
uint32_t base_image{};
|
||||
std::vector<uint8_t> frameOffsets;
|
||||
uint32_t baseImage{};
|
||||
SpriteBounds bounds{};
|
||||
};
|
||||
|
||||
|
||||
@@ -873,9 +873,9 @@ namespace OpenRCT2::Scripting
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
const auto& animationGroup = animObj->GetPeepAnimation(peep->AnimationGroup, *animationType);
|
||||
for (auto frameOffset : animationGroup.frame_offsets)
|
||||
for (auto frameOffset : animationGroup.frameOffsets)
|
||||
{
|
||||
auto imageId = animationGroup.base_image;
|
||||
auto imageId = animationGroup.baseImage;
|
||||
if (animationType != PeepAnimationType::Hanging)
|
||||
imageId += rotation + frameOffset * 4;
|
||||
else
|
||||
@@ -930,7 +930,7 @@ namespace OpenRCT2::Scripting
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
const auto& animationGroup = animObj->GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
|
||||
peep->AnimationImageIdOffset = animationGroup.frame_offsets[offset];
|
||||
peep->AnimationImageIdOffset = animationGroup.frameOffsets[offset];
|
||||
peep->Invalidate();
|
||||
peep->UpdateSpriteBoundingBox();
|
||||
peep->Invalidate();
|
||||
@@ -960,7 +960,7 @@ namespace OpenRCT2::Scripting
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
const auto& animationGroup = animObj->GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
|
||||
auto length = animationGroup.frame_offsets.size();
|
||||
auto length = animationGroup.frameOffsets.size();
|
||||
offset %= length;
|
||||
|
||||
if (peep->IsActionWalking())
|
||||
@@ -968,7 +968,7 @@ namespace OpenRCT2::Scripting
|
||||
else
|
||||
peep->AnimationFrameNum = offset;
|
||||
|
||||
peep->AnimationImageIdOffset = animationGroup.frame_offsets[offset];
|
||||
peep->AnimationImageIdOffset = animationGroup.frameOffsets[offset];
|
||||
peep->UpdateSpriteBoundingBox();
|
||||
}
|
||||
|
||||
@@ -984,7 +984,7 @@ namespace OpenRCT2::Scripting
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
const auto& animationGroup = animObj->GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
|
||||
return static_cast<uint8_t>(animationGroup.frame_offsets.size());
|
||||
return static_cast<uint8_t>(animationGroup.frameOffsets.size());
|
||||
}
|
||||
|
||||
ScThought::ScThought(PeepThought backing)
|
||||
|
||||
@@ -295,9 +295,9 @@ namespace OpenRCT2::Scripting
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
const auto& animationGroup = animObj->GetPeepAnimation(peep->AnimationGroup, *animationType);
|
||||
for (auto frameOffset : animationGroup.frame_offsets)
|
||||
for (auto frameOffset : animationGroup.frameOffsets)
|
||||
{
|
||||
auto imageId = animationGroup.base_image;
|
||||
auto imageId = animationGroup.baseImage;
|
||||
if (animationType != PeepAnimationType::Hanging)
|
||||
imageId += rotation + frameOffset * 4;
|
||||
else
|
||||
@@ -346,7 +346,7 @@ namespace OpenRCT2::Scripting
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
const auto& animationGroup = animObj->GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
|
||||
peep->AnimationImageIdOffset = animationGroup.frame_offsets[offset];
|
||||
peep->AnimationImageIdOffset = animationGroup.frameOffsets[offset];
|
||||
peep->Invalidate();
|
||||
peep->UpdateSpriteBoundingBox();
|
||||
peep->Invalidate();
|
||||
@@ -376,7 +376,7 @@ namespace OpenRCT2::Scripting
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
const auto& animationGroup = animObj->GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
|
||||
auto length = animationGroup.frame_offsets.size();
|
||||
auto length = animationGroup.frameOffsets.size();
|
||||
offset %= length;
|
||||
|
||||
if (peep->IsActionWalking())
|
||||
@@ -384,7 +384,7 @@ namespace OpenRCT2::Scripting
|
||||
else
|
||||
peep->AnimationFrameNum = offset;
|
||||
|
||||
peep->AnimationImageIdOffset = animationGroup.frame_offsets[offset];
|
||||
peep->AnimationImageIdOffset = animationGroup.frameOffsets[offset];
|
||||
peep->Invalidate();
|
||||
peep->UpdateSpriteBoundingBox();
|
||||
peep->Invalidate();
|
||||
@@ -402,7 +402,7 @@ namespace OpenRCT2::Scripting
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
const auto& animationGroup = animObj->GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
|
||||
return static_cast<uint8_t>(animationGroup.frame_offsets.size());
|
||||
return static_cast<uint8_t>(animationGroup.frameOffsets.size());
|
||||
}
|
||||
|
||||
ScHandyman::ScHandyman(EntityId Id)
|
||||
|
||||
Reference in new issue
Block a user