Merge pull request #21985 from AaronVanGeffen/guest-constants

Use constants for balloon/umbrella/hat sprites in more places
This commit is contained in:
Michael Steenbeek 2024-05-08 22:23:22 +02:00 committed by GitHub
commit ca1118c2f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View File

@ -26,6 +26,7 @@
#include <openrct2/management/Finance.h>
#include <openrct2/management/NewsItem.h>
#include <openrct2/peep/PeepAnimationData.h>
#include <openrct2/peep/PeepSpriteIds.h>
#include <openrct2/sprites.h>
#include <openrct2/world/Park.h>
@ -296,15 +297,18 @@ static Widget window_game_bottom_toolbar_widgets[] =
auto* guest = peep->As<Guest>();
if (guest != nullptr)
{
if (image_id_base >= 0x2A1D && image_id_base < 0x2A3D)
if (image_id_base >= kPeepSpriteBalloonStateWatchRideId
&& image_id_base < kPeepSpriteBalloonStateSittingIdleId + 4)
{
GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->BalloonColour), clipCoords);
}
else if (image_id_base >= 0x2BBD && image_id_base < 0x2BDD)
if (image_id_base >= kPeepSpriteUmbrellaStateNoneId
&& image_id_base < kPeepSpriteUmbrellaStateSittingIdleId + 4)
{
GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->UmbrellaColour), clipCoords);
}
else if (image_id_base >= 0x29DD && image_id_base < 0x29FD)
if (image_id_base >= kPeepSpriteHatStateWatchRideId
&& image_id_base < kPeepSpriteHatStateSittingIdleId + 4)
{
GfxDrawSprite(cliped_dpi, ImageId(image_id_base + 32, guest->HatColour), clipCoords);
}

View File

@ -28,6 +28,7 @@
#include <openrct2/management/Marketing.h>
#include <openrct2/network/network.h>
#include <openrct2/peep/PeepAnimationData.h>
#include <openrct2/peep/PeepSpriteIds.h>
#include <openrct2/ride/RideData.h>
#include <openrct2/ride/ShopItem.h>
#include <openrct2/scenario/Scenario.h>
@ -561,19 +562,21 @@ static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT);
if (guest != nullptr)
{
// If holding a balloon
if (animationFrame >= 0x2A1D && animationFrame < 0x2A3D)
if (animationFrame >= kPeepSpriteBalloonStateWatchRideId
&& animationFrame < kPeepSpriteBalloonStateSittingIdleId + 4)
{
GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->BalloonColour), screenCoords);
}
// If holding umbrella
if (animationFrame >= 0x2BBD && animationFrame < 0x2BDD)
if (animationFrame >= kPeepSpriteUmbrellaStateNoneId
&& animationFrame < kPeepSpriteUmbrellaStateSittingIdleId + 4)
{
GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->UmbrellaColour), screenCoords);
}
// If wearing hat
if (animationFrame >= 0x29DD && animationFrame < 0x29FD)
if (animationFrame >= kPeepSpriteHatStateWatchRideId && animationFrame < kPeepSpriteHatStateSittingIdleId + 4)
{
GfxDrawSprite(clipDpi, ImageId(animationFrame + 32, guest->HatColour), screenCoords);
}