1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 18:25:16 +01:00

Infer peep animation sprite bounds at runtime (#23235)

This commit is contained in:
Aaron van Geffen
2024-12-04 00:00:54 +01:00
committed by GitHub
parent 15192cc56c
commit f9fdac2769
3 changed files with 438 additions and 309 deletions

View File

@@ -57,6 +57,7 @@
#include "object/ObjectRepository.h"
#include "paint/Painter.h"
#include "park/ParkFile.h"
#include "peep/PeepAnimationData.h"
#include "platform/Crash.h"
#include "platform/Platform.h"
#include "profiling/Profiling.h"
@@ -1006,6 +1007,7 @@ namespace OpenRCT2
return result;
}
// TODO: move function elsewhere?
bool LoadBaseGraphics()
{
if (!GfxLoadG1(*_env))
@@ -1015,6 +1017,7 @@ namespace OpenRCT2
GfxLoadG2();
GfxLoadCsg();
FontSpriteInitialiseCharacters();
inferMaxPeepSpriteDimensions();
return true;
}

File diff suppressed because it is too large Load Diff

View File

@@ -17,8 +17,16 @@ namespace OpenRCT2
struct PeepAnimation
{
uint32_t base_image;
SpriteBounds bounds;
std::span<const uint8_t> frame_offsets;
SpriteBounds bounds{};
constexpr PeepAnimation() = default;
PeepAnimation(uint32_t baseImage, std::span<const uint8_t> frameOffsets)
: base_image(baseImage)
, frame_offsets(frameOffsets)
{
}
};
struct PeepAnimations
@@ -41,4 +49,6 @@ namespace OpenRCT2
PeepAnimationGroup spriteType, PeepAnimationType actionAnimationGroup = PeepAnimationType::None);
const SpriteBounds& GetSpriteBounds(
PeepAnimationGroup spriteType, PeepAnimationType actionAnimationGroup = PeepAnimationType::None);
void inferMaxPeepSpriteDimensions();
} // namespace OpenRCT2