mirror of https://github.com/OpenRCT2/OpenRCT2.git
Compare commits
8 Commits
f5c68cfdf5
...
637ca6ba44
Author | SHA1 | Date |
---|---|---|
Aaron van Geffen | 637ca6ba44 | |
Aaron van Geffen | ca2080f408 | |
Aaron van Geffen | d8d91c7170 | |
Aaron van Geffen | fde4d9ac17 | |
Aaron van Geffen | ba32881a7f | |
Aaron van Geffen | f3ffcd65dc | |
Aaron van Geffen | 2fa26cc8a1 | |
Aaron van Geffen | fc3b597969 |
|
@ -36,6 +36,7 @@
|
|||
#include "../paint/Paint.h"
|
||||
#include "../peep/GuestPathfinding.h"
|
||||
#include "../peep/PeepAnimationData.h"
|
||||
#include "../peep/PeepSpriteIds.h"
|
||||
#include "../profiling/Profiling.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../ride/RideData.h"
|
||||
|
@ -344,9 +345,15 @@ void Peep::UpdateCurrentActionSpriteType()
|
|||
return;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
ActionSpriteType = newActionSpriteType;
|
||||
|
||||
UpdateSpriteBoundingBox();
|
||||
}
|
||||
|
||||
void Peep::UpdateSpriteBoundingBox()
|
||||
{
|
||||
Invalidate();
|
||||
|
||||
const SpriteBounds* spriteBounds = &GetSpriteBounds(SpriteType, ActionSpriteType);
|
||||
SpriteData.Width = spriteBounds->sprite_width;
|
||||
SpriteData.HeightMin = spriteBounds->sprite_height_negative;
|
||||
|
@ -2792,7 +2799,14 @@ void Peep::Paint(PaintSession& session, int32_t imageDirection) const
|
|||
|
||||
// In the following 4 calls to PaintAddImageAsParent/PaintAddImageAsChild, we add 5 (instead of 3) to the
|
||||
// bound_box_offset_z to make sure peeps are drawn on top of railways
|
||||
uint32_t baseImageId = (imageDirection >> 3) + GetPeepAnimation(SpriteType, actionSpriteType).base_image + imageOffset * 4;
|
||||
uint32_t baseImageId = GetPeepAnimation(SpriteType, actionSpriteType).base_image;
|
||||
|
||||
// Offset frame onto the base image, using rotation except for the 'picked up' state
|
||||
if (actionSpriteType != PeepActionSpriteType::Ui)
|
||||
baseImageId += (imageDirection >> 3) + imageOffset * 4;
|
||||
else
|
||||
baseImageId += imageOffset;
|
||||
|
||||
auto imageId = ImageId(baseImageId, TshirtColour, TrousersColour);
|
||||
|
||||
auto bb = BoundBoxXYZ{ { 0, 0, z + 5 }, { 1, 1, 11 } };
|
||||
|
@ -2802,21 +2816,21 @@ void Peep::Paint(PaintSession& session, int32_t imageDirection) const
|
|||
auto* guest = As<Guest>();
|
||||
if (guest != nullptr)
|
||||
{
|
||||
if (baseImageId >= 10717 && baseImageId < 10749)
|
||||
if (baseImageId >= kPeepSpriteHatStateWatchRideId && baseImageId < (kPeepSpriteHatStateSittingIdleId + 4))
|
||||
{
|
||||
imageId = ImageId(baseImageId + 32, guest->HatColour);
|
||||
PaintAddImageAsChild(session, imageId, offset, bb);
|
||||
return;
|
||||
}
|
||||
|
||||
if (baseImageId >= 10781 && baseImageId < 10813)
|
||||
if (baseImageId >= kPeepSpriteBalloonStateWatchRideId && baseImageId < (kPeepSpriteBalloonStateSittingIdleId + 4))
|
||||
{
|
||||
imageId = ImageId(baseImageId + 32, guest->BalloonColour);
|
||||
PaintAddImageAsChild(session, imageId, offset, bb);
|
||||
return;
|
||||
}
|
||||
|
||||
if (baseImageId >= 11197 && baseImageId < 11229)
|
||||
if (baseImageId >= kPeepSpriteUmbrellaStateNoneId && baseImageId < (kPeepSpriteUmbrellaStateSittingIdleId + 4))
|
||||
{
|
||||
imageId = ImageId(baseImageId + 32, guest->UmbrellaColour);
|
||||
PaintAddImageAsChild(session, imageId, offset, bb);
|
||||
|
|
|
@ -379,6 +379,7 @@ public: // Peep
|
|||
void SetState(PeepState new_state);
|
||||
void Remove();
|
||||
void UpdateCurrentActionSpriteType();
|
||||
void UpdateSpriteBoundingBox();
|
||||
void SwitchToSpecialSprite(uint8_t special_sprite_id);
|
||||
void StateReset();
|
||||
[[nodiscard]] uint8_t GetNextDirection() const;
|
||||
|
|
|
@ -858,12 +858,17 @@ namespace OpenRCT2::Scripting
|
|||
}
|
||||
|
||||
auto* peep = GetGuest();
|
||||
peep->ActionSpriteType = *newType;
|
||||
peep->ActionFrame = 0;
|
||||
peep->ActionSpriteType = peep->NextActionSpriteType = *newType;
|
||||
|
||||
auto offset = 0;
|
||||
if (peep->IsActionWalking())
|
||||
peep->WalkingFrameNum = offset;
|
||||
else
|
||||
peep->ActionFrame = offset;
|
||||
|
||||
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
|
||||
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[peep->ActionFrame];
|
||||
peep->UpdateCurrentActionSpriteType();
|
||||
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
|
||||
peep->UpdateSpriteBoundingBox();
|
||||
}
|
||||
|
||||
uint8_t ScGuest::animationOffset_get() const
|
||||
|
@ -885,9 +890,15 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
|
||||
auto length = animationGroup.frame_offsets.size();
|
||||
offset %= length;
|
||||
|
||||
peep->ActionFrame = offset % length;
|
||||
peep->UpdateCurrentActionSpriteType();
|
||||
if (peep->IsActionWalking())
|
||||
peep->WalkingFrameNum = offset;
|
||||
else
|
||||
peep->ActionFrame = offset;
|
||||
|
||||
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
|
||||
peep->UpdateSpriteBoundingBox();
|
||||
}
|
||||
|
||||
uint8_t ScGuest::animationLength_get() const
|
||||
|
|
|
@ -248,12 +248,17 @@ namespace OpenRCT2::Scripting
|
|||
return;
|
||||
}
|
||||
|
||||
peep->ActionSpriteType = *newType;
|
||||
peep->ActionFrame = 0;
|
||||
peep->ActionSpriteType = peep->NextActionSpriteType = *newType;
|
||||
|
||||
auto offset = 0;
|
||||
if (peep->IsActionWalking())
|
||||
peep->WalkingFrameNum = offset;
|
||||
else
|
||||
peep->ActionFrame = offset;
|
||||
|
||||
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
|
||||
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[peep->ActionFrame];
|
||||
peep->UpdateCurrentActionSpriteType();
|
||||
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
|
||||
peep->UpdateSpriteBoundingBox();
|
||||
}
|
||||
|
||||
uint8_t ScStaff::animationOffset_get() const
|
||||
|
@ -275,9 +280,15 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
|
||||
auto length = animationGroup.frame_offsets.size();
|
||||
offset %= length;
|
||||
|
||||
peep->ActionFrame = offset % length;
|
||||
peep->UpdateCurrentActionSpriteType();
|
||||
if (peep->IsActionWalking())
|
||||
peep->WalkingFrameNum = offset;
|
||||
else
|
||||
peep->ActionFrame = offset;
|
||||
|
||||
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
|
||||
peep->UpdateSpriteBoundingBox();
|
||||
}
|
||||
|
||||
uint8_t ScStaff::animationLength_get() const
|
||||
|
|
Loading…
Reference in New Issue