Merge pull request #22812 from AaronVanGeffen/name-peep-var

Rename Peep properties to better distinguish Actions and Animations
This commit is contained in:
Aaron van Geffen authored and GitHub committed 2024-09-22 21:47:10 +02:00
commit 30fa3128a6
48 files changed
+1156 -1152

No files matched your search

@@ -87,22 +87,22 @@ namespace OpenRCT2::Ui
screenCoords,
EnumsToFlags(
ViewportInteractionItem::Entity, ViewportInteractionItem::Ride, ViewportInteractionItem::ParkEntrance));
auto tileElement = info.SpriteType != ViewportInteractionItem::Entity ? info.Element : nullptr;
// Only valid when info.SpriteType == ViewportInteractionItem::Entity, but can't assign nullptr without compiler
auto tileElement = info.interactionType != ViewportInteractionItem::Entity ? info.Element : nullptr;
// Only valid when info.interactionType == ViewportInteractionItem::Entity, but can't assign nullptr without compiler
// complaining
auto sprite = info.Entity;
// Allows only balloons to be popped and ducks to be quacked in title screen
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
{
if (info.SpriteType == ViewportInteractionItem::Entity && (sprite->Is<Balloon>() || sprite->Is<Duck>()))
if (info.interactionType == ViewportInteractionItem::Entity && (sprite->Is<Balloon>() || sprite->Is<Duck>()))
return info;
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Entity:
switch (sprite->Type)
@@ -113,7 +113,7 @@ namespace OpenRCT2::Ui
if (vehicle != nullptr && !vehicle->IsCableLift())
vehicle->SetMapToolbar();
else
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
}
break;
case EntityType::Guest:
@@ -126,7 +126,7 @@ namespace OpenRCT2::Ui
}
else
{
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
}
}
break;
@@ -150,18 +150,18 @@ namespace OpenRCT2::Ui
break;
}
default:
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
break;
}
// If nothing is under cursor, find a close by peep
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
auto peep = ViewportInteractionGetClosestPeep(screenCoords, 32);
if (peep != nullptr)
{
info.Entity = peep;
info.SpriteType = ViewportInteractionItem::Entity;
info.interactionType = ViewportInteractionItem::Entity;
info.Loc.x = peep->x;
info.Loc.y = peep->y;
PeepSetMapTooltip(peep);
@@ -175,7 +175,7 @@ namespace OpenRCT2::Ui
{
auto info = ViewportInteractionGetItemLeft(screenCoords);
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Entity:
case ViewportInteractionItem::Ride:
@@ -190,7 +190,7 @@ namespace OpenRCT2::Ui
{
auto info = ViewportInteractionGetItemLeft(screenCoords);
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Entity:
{
@@ -275,21 +275,21 @@ namespace OpenRCT2::Ui
info = GetMapCoordinatesFromPos(screenCoords, flags);
auto tileElement = info.Element;
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Entity:
{
auto sprite = info.Entity;
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || sprite->Type != EntityType::Vehicle)
{
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
auto vehicle = sprite->As<Vehicle>();
if (vehicle == nullptr)
{
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
ride = GetRide(vehicle->ride);
@@ -306,19 +306,19 @@ namespace OpenRCT2::Ui
{
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
{
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
if (tileElement->GetType() == TileElementType::Path)
{
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
ride = GetRide(tileElement->GetRideIndex());
if (ride == nullptr)
{
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
@@ -373,7 +373,7 @@ namespace OpenRCT2::Ui
// FIXME: Why does it *2 the value?
if (!GetGameState().Cheats.SandboxMode && !MapIsLocationOwned({ info.Loc, tileElement->GetBaseZ() * 2 }))
{
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
@@ -464,13 +464,13 @@ namespace OpenRCT2::Ui
if (WindowFindByClass(WindowClass::RideConstruction) == nullptr
&& WindowFindByClass(WindowClass::Footpath) == nullptr)
{
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
}
auto ft = Formatter();
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Scenery:
{
@@ -533,7 +533,7 @@ namespace OpenRCT2::Ui
break;
}
info.SpriteType = ViewportInteractionItem::None;
info.interactionType = ViewportInteractionItem::None;
return info;
}
@@ -541,7 +541,7 @@ namespace OpenRCT2::Ui
{
auto info = ViewportInteractionGetItemRight(screenCoords);
return info.SpriteType != ViewportInteractionItem::None;
return info.interactionType != ViewportInteractionItem::None;
}
/**
@@ -553,7 +553,7 @@ namespace OpenRCT2::Ui
CoordsXYE tileElement;
auto info = ViewportInteractionGetItemRight(screenCoords);
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::None:
case ViewportInteractionItem::Terrain:
@@ -791,14 +791,14 @@ namespace OpenRCT2::Ui
window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
auto initialPos = info.Loc;
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
initialPos.SetNull();
return initialPos;
}
int16_t waterHeight = 0;
if (info.SpriteType == ViewportInteractionItem::Water)
if (info.interactionType == ViewportInteractionItem::Water)
{
waterHeight = info.Element->AsSurface()->GetWaterHeight();
}
@@ -809,7 +809,7 @@ namespace OpenRCT2::Ui
for (int32_t i = 0; i < 5; i++)
{
int16_t z = waterHeight;
if (info.SpriteType != ViewportInteractionItem::Water)
if (info.interactionType != ViewportInteractionItem::Water)
{
z = TileElementHeight(mapPos);
}
+6 -6
View File
@@ -42,12 +42,12 @@ namespace OpenRCT2::Ui
}
auto viewport = window->viewport;
auto info = GetMapCoordinatesFromPosWindow(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Footpath));
if (info.SpriteType != ViewportInteractionItem::Footpath
if (info.interactionType != ViewportInteractionItem::Footpath
|| !(viewport->flags & (VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL)))
{
info = GetMapCoordinatesFromPosWindow(
window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
auto position = info.Loc;
position.SetNull();
@@ -60,7 +60,7 @@ namespace OpenRCT2::Ui
auto myTileElement = info.Element;
auto position = info.Loc.ToTileCentre();
auto z = 0;
if (info.SpriteType == ViewportInteractionItem::Footpath)
if (info.interactionType == ViewportInteractionItem::Footpath)
{
z = myTileElement->GetBaseZ();
if (myTileElement->AsPath()->IsSloped())
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui
for (int32_t i = 0; i < 5; i++)
{
if (info.SpriteType != ViewportInteractionItem::Footpath)
if (info.interactionType != ViewportInteractionItem::Footpath)
{
z = TileElementHeight(position);
}
@@ -141,7 +141,7 @@ namespace OpenRCT2::Ui
auto viewport = window->viewport;
auto info = GetMapCoordinatesFromPosWindow(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Ride));
*tileElement = info.Element;
if (info.SpriteType == ViewportInteractionItem::Ride
if (info.interactionType == ViewportInteractionItem::Ride
&& viewport->flags & (VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL)
&& (*tileElement)->GetType() == TileElementType::Entrance)
{
@@ -160,7 +160,7 @@ namespace OpenRCT2::Ui
info = GetMapCoordinatesFromPosWindow(
window, screenCoords,
EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath, ViewportInteractionItem::Ride));
if (info.SpriteType == ViewportInteractionItem::Ride && (*tileElement)->GetType() == TileElementType::Entrance)
if (info.interactionType == ViewportInteractionItem::Ride && (*tileElement)->GetType() == TileElementType::Entrance)
{
uint32_t directions = (*tileElement)->AsEntrance()->GetDirections();
if (directions & 0x0F)
+1 -1
View File
@@ -117,7 +117,7 @@ namespace OpenRCT2
gRideEntranceExitPlaceDirection = INVALID_DIRECTION;
// determine if the mouse is hovering over a station - that's the station to add the entrance to
auto info = GetMapCoordinatesFromPos(screenCoords, EnumsToFlags(ViewportInteractionItem::Ride));
if (info.SpriteType != ViewportInteractionItem::None)
if (info.interactionType != ViewportInteractionItem::None)
{
if (info.Element->GetType() == TileElementType::Track)
{
+1 -1
View File
@@ -195,7 +195,7 @@ namespace OpenRCT2::Scripting
obj.Set("screenCoords", ToDuk(ctx, screenCoords));
obj.Set("mapCoords", ToDuk(ctx, info.Loc));
if (info.SpriteType == ViewportInteractionItem::Entity && info.Entity != nullptr)
if (info.interactionType == ViewportInteractionItem::Entity && info.Entity != nullptr)
{
obj.Set("entityId", info.Entity->Id.ToUnderlying());
}
+6 -6
View File
@@ -817,7 +817,7 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::LargeScenery);
auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags);
if (info.SpriteType != ViewportInteractionItem::None)
if (info.interactionType != ViewportInteractionItem::None)
{
const bool allowInvalidHeights = GetGameState().Cheats.AllowTrackPlaceInvalidHeights;
const auto heightStep = kCoordsZStep * (!allowInvalidHeights ? 2 : 1);
@@ -872,7 +872,7 @@ namespace OpenRCT2::Ui::Windows
auto info = GetMapCoordinatesFromPos(
screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Footpath));
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
return std::nullopt;
mapCoords = info.Loc;
@@ -918,14 +918,14 @@ namespace OpenRCT2::Ui::Windows
int32_t FootpathGetSlopeFromInfo(const InteractionInfo& info)
{
if (info.SpriteType == ViewportInteractionItem::None || info.Element == nullptr)
if (info.interactionType == ViewportInteractionItem::None || info.Element == nullptr)
{
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
FootpathUpdateProvisional();
return kTileSlopeFlat;
}
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Terrain:
{
@@ -959,12 +959,12 @@ namespace OpenRCT2::Ui::Windows
int32_t FootpathGetBaseZFromInfo(const InteractionInfo& info)
{
if (info.SpriteType == ViewportInteractionItem::None || info.Element == nullptr)
if (info.interactionType == ViewportInteractionItem::None || info.Element == nullptr)
{
return 0;
}
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Terrain:
{
@@ -285,7 +285,7 @@ namespace OpenRCT2::Ui::Windows
clipCoords.y += 3;
}
uint32_t image_id_base = GetPeepAnimation(peep->SpriteType).base_image;
uint32_t image_id_base = GetPeepAnimation(peep->AnimationGroup).base_image;
image_id_base += frame_no & 0xFFFFFFFC;
image_id_base++;
+3 -3
View File
@@ -555,7 +555,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
int32_t animationFrame = GetPeepAnimation(peep->SpriteType).base_image + 1;
int32_t animationFrame = GetPeepAnimation(peep->AnimationGroup).base_image + 1;
int32_t animationFrameOffset = 0;
@@ -945,7 +945,7 @@ namespace OpenRCT2::Ui::Windows
gPickupPeepImage = ImageId();
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll);
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
return;
gPickupPeepX = screenCoords.x - 1;
@@ -957,7 +957,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
auto baseImageId = GetPeepAnimation(peep->SpriteType, PeepActionSpriteType::Ui).base_image;
auto baseImageId = GetPeepAnimation(peep->AnimationGroup, PeepAnimationType::Hanging).base_image;
baseImageId += picked_peep_frame >> 2;
gPickupPeepImage = ImageId(baseImageId, peep->TshirtColour, peep->TrousersColour);
}
+1 -1
View File
@@ -650,7 +650,7 @@ namespace OpenRCT2::Ui::Windows
{
// Tab 1 image
auto i = (_selectedTab == TabId::Individual ? _tabAnimationIndex & ~3 : 0);
i += GetPeepAnimation(PeepSpriteType::Normal).base_image + 1;
i += GetPeepAnimation(PeepAnimationGroup::Normal).base_image + 1;
GfxDrawSprite(
dpi, ImageId(i, COLOUR_GREY, COLOUR_DARK_OLIVE_GREEN),
windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_1].midX(), widgets[WIDX_TAB_1].bottom - 6 });
+1 -1
View File
@@ -462,7 +462,7 @@ namespace OpenRCT2::Ui::Windows
auto info = GetMapCoordinatesFromPos(
screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
if (_landRightsCost != kMoney64Undefined)
{
+2 -2
View File
@@ -251,11 +251,11 @@ namespace OpenRCT2::Ui::Windows
// If normal peep set sprite to normal (no food)
// If staff set sprite to staff sprite
auto spriteType = PeepSpriteType::Normal;
auto spriteType = PeepAnimationGroup::Normal;
auto* staff = peep->As<Staff>();
if (staff != nullptr)
{
spriteType = staff->SpriteType;
spriteType = staff->AnimationGroup;
if (staff->AssignedStaffType == StaffType::Entertainer)
{
clipCoords.y += 3;
+1 -1
View File
@@ -1265,7 +1265,7 @@ namespace OpenRCT2::Ui::Windows
spriteIdx = spriteIdx.WithIndexOffset((frame_no / 8) % 8);
GfxDrawSprite(dpi, spriteIdx, windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_3].left, widgets[WIDX_TAB_3].top });
ImageId peepImage(GetPeepAnimation(PeepSpriteType::Normal).base_image + 1, COLOUR_BRIGHT_RED, COLOUR_TEAL);
ImageId peepImage(GetPeepAnimation(PeepAnimationGroup::Normal).base_image + 1, COLOUR_BRIGHT_RED, COLOUR_TEAL);
if (page == WINDOW_PARK_PAGE_GUESTS)
peepImage = peepImage.WithIndexOffset(_peepAnimationFrame & 0xFFFFFFFC);
+6 -6
View File
@@ -1327,7 +1327,7 @@ namespace OpenRCT2::Ui::Windows
if (page == WINDOW_RIDE_PAGE_CUSTOMER)
spriteIndex = picked_peep_frame & ~3;
spriteIndex += GetPeepAnimation(PeepSpriteType::Normal).base_image + 1;
spriteIndex += GetPeepAnimation(PeepAnimationGroup::Normal).base_image + 1;
GfxDrawSprite(
dpi, ImageId(spriteIndex, COLOUR_BRIGHT_RED, COLOUR_TEAL),
@@ -4205,7 +4205,7 @@ namespace OpenRCT2::Ui::Windows
auto newColourScheme = static_cast<uint8_t>(_rideColour);
auto info = GetMapCoordinatesFromPos(screenPos, EnumsToFlags(ViewportInteractionItem::Ride));
if (info.SpriteType != ViewportInteractionItem::Ride)
if (info.interactionType != ViewportInteractionItem::Ride)
return;
if (info.Element->GetType() != TileElementType::Track)
return;
@@ -5554,14 +5554,14 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
ViewportInteractionItem::LargeScenery);
auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags);
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Scenery:
case ViewportInteractionItem::LargeScenery:
case ViewportInteractionItem::Wall:
case ViewportInteractionItem::Footpath:
_collectTrackDesignScenery = !TrackDesignSaveContainsTileElement(info.Element);
TrackDesignSaveSelectTileElement(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery);
TrackDesignSaveSelectTileElement(info.interactionType, info.Loc, info.Element, _collectTrackDesignScenery);
break;
default:
break;
@@ -5579,13 +5579,13 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::Scenery, ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall,
ViewportInteractionItem::LargeScenery);
auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags);
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Scenery:
case ViewportInteractionItem::LargeScenery:
case ViewportInteractionItem::Wall:
case ViewportInteractionItem::Footpath:
TrackDesignSaveSelectTileElement(info.SpriteType, info.Loc, info.Element, _collectTrackDesignScenery);
TrackDesignSaveSelectTileElement(info.interactionType, info.Loc, info.Element, _collectTrackDesignScenery);
break;
default:
break;
+1 -1
View File
@@ -2936,7 +2936,7 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::Label, ViewportInteractionItem::Banner);
auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags);
if (info.SpriteType != ViewportInteractionItem::None)
if (info.interactionType != ViewportInteractionItem::None)
{
_trackPlaceCtrlZ = info.Element->GetBaseZ();
_trackPlaceCtrlState = true;
+6 -6
View File
@@ -2204,7 +2204,7 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
ViewportInteractionItem::Banner);
auto info = GetMapCoordinatesFromPos(screenCoords, flag);
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Scenery:
{
@@ -2281,7 +2281,7 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::Scenery, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery,
ViewportInteractionItem::Banner, ViewportInteractionItem::PathAddition);
auto info = GetMapCoordinatesFromPos(screenCoords, flag);
switch (info.SpriteType)
switch (info.interactionType)
{
case ViewportInteractionItem::Scenery:
{
@@ -2374,7 +2374,7 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::LargeScenery);
auto info = GetMapCoordinatesFromPos(screenPos, flag);
if (info.SpriteType != ViewportInteractionItem::None)
if (info.interactionType != ViewportInteractionItem::None)
{
gSceneryCtrlPressed = true;
gSceneryCtrlPressZ = info.Element->GetBaseZ();
@@ -2551,7 +2551,7 @@ namespace OpenRCT2::Ui::Windows
auto info = GetMapCoordinatesFromPos(screenPos, flag);
gridPos = info.Loc;
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
gridPos.SetNull();
return;
@@ -2644,7 +2644,7 @@ namespace OpenRCT2::Ui::Windows
auto info = GetMapCoordinatesFromPos(screenPos, flag);
gridPos = info.Loc;
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
gridPos.SetNull();
return;
@@ -2868,7 +2868,7 @@ namespace OpenRCT2::Ui::Windows
auto info = GetMapCoordinatesFromPos(screenPos, flag);
gridPos = info.Loc;
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
gridPos.SetNull();
return;
+5 -5
View File
@@ -575,7 +575,7 @@ namespace OpenRCT2::Ui::Windows
if (staff->Is<Staff>() && staff->AssignedStaffType == StaffType::Entertainer)
screenCoords.y++;
int32_t imageIndex = GetPeepAnimation(staff->SpriteType).base_image + 1;
int32_t imageIndex = GetPeepAnimation(staff->AnimationGroup).base_image + 1;
int32_t offset = 0;
@@ -669,7 +669,7 @@ namespace OpenRCT2::Ui::Windows
gPickupPeepImage = ImageId();
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll);
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
return;
gPickupPeepX = screenCoords.x - 1;
@@ -681,7 +681,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
auto baseImageId = GetPeepAnimation(staff->SpriteType, PeepActionSpriteType::Ui).base_image;
auto baseImageId = GetPeepAnimation(staff->AnimationGroup, PeepAnimationType::Hanging).base_image;
baseImageId += picked_peep_frame >> 2;
gPickupPeepImage = ImageId(baseImageId, staff->TshirtColour, staff->TrousersColour);
}
@@ -776,7 +776,7 @@ namespace OpenRCT2::Ui::Windows
for (int32_t i = 0; i < numCostumes; i++)
{
EntertainerCostume costume = _availableCostumes[i];
if (staff->SpriteType == EntertainerCostumeToSprite(costume))
if (staff->AnimationGroup == EntertainerCostumeToSprite(costume))
{
checkedIndex = i;
}
@@ -831,7 +831,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_COSTUME_BTN].type = WindowWidgetType::Button;
// TODO: retrieve string from object instead
auto costumeType = EnumValue(staff->SpriteType) - EnumValue(PeepSpriteType::EntertainerPanda);
auto costumeType = EnumValue(staff->AnimationGroup) - EnumValue(PeepAnimationGroup::EntertainerPanda);
if (costumeType >= 0)
widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[costumeType];
else
+20 -20
View File
@@ -456,7 +456,7 @@ namespace OpenRCT2::Ui::Windows
}
else
{
GfxDrawSprite(dpi, ImageId(GetEntertainerCostumeSprite(peep->SpriteType)), { staffOrderIcon_x, y });
GfxDrawSprite(dpi, ImageId(GetEntertainerCostumeSprite(peep->AnimationGroup)), { staffOrderIcon_x, y });
}
}
@@ -599,13 +599,13 @@ namespace OpenRCT2::Ui::Windows
void DrawTabImages(DrawPixelInfo& dpi) const
{
const auto& gameState = GetGameState();
DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_HANDYMEN, PeepSpriteType::Handyman, gameState.StaffHandymanColour);
DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_MECHANICS, PeepSpriteType::Mechanic, gameState.StaffMechanicColour);
DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_SECURITY, PeepSpriteType::Security, gameState.StaffSecurityColour);
DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_ENTERTAINERS, PeepSpriteType::EntertainerElephant);
DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_HANDYMEN, PeepAnimationGroup::Handyman, gameState.StaffHandymanColour);
DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_MECHANICS, PeepAnimationGroup::Mechanic, gameState.StaffMechanicColour);
DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_SECURITY, PeepAnimationGroup::Security, gameState.StaffSecurityColour);
DrawTabImage(dpi, WINDOW_STAFF_LIST_TAB_ENTERTAINERS, PeepAnimationGroup::EntertainerElephant);
}
void DrawTabImage(DrawPixelInfo& dpi, int32_t tabIndex, PeepSpriteType type, colour_t colour) const
void DrawTabImage(DrawPixelInfo& dpi, int32_t tabIndex, PeepAnimationGroup type, colour_t colour) const
{
auto widgetIndex = WIDX_STAFF_LIST_HANDYMEN_TAB + tabIndex;
const auto& widget = widgets[widgetIndex];
@@ -616,7 +616,7 @@ namespace OpenRCT2::Ui::Windows
windowPos + ScreenCoordsXY{ (widget.left + widget.right) / 2, widget.bottom - 6 });
}
void DrawTabImage(DrawPixelInfo& dpi, int32_t tabIndex, PeepSpriteType type) const
void DrawTabImage(DrawPixelInfo& dpi, int32_t tabIndex, PeepAnimationGroup type) const
{
auto widgetIndex = WIDX_STAFF_LIST_HANDYMEN_TAB + tabIndex;
const auto& widget = widgets[widgetIndex];
@@ -723,33 +723,33 @@ namespace OpenRCT2::Ui::Windows
}
}
static uint32_t GetEntertainerCostumeSprite(PeepSpriteType type)
static uint32_t GetEntertainerCostumeSprite(PeepAnimationGroup type)
{
switch (type)
{
case PeepSpriteType::EntertainerPanda:
case PeepAnimationGroup::EntertainerPanda:
return SPR_STAFF_COSTUME_PANDA;
case PeepSpriteType::EntertainerTiger:
case PeepAnimationGroup::EntertainerTiger:
return SPR_STAFF_COSTUME_TIGER;
case PeepSpriteType::EntertainerElephant:
case PeepAnimationGroup::EntertainerElephant:
return SPR_STAFF_COSTUME_ELEPHANT;
case PeepSpriteType::EntertainerRoman:
case PeepAnimationGroup::EntertainerRoman:
return SPR_STAFF_COSTUME_ROMAN;
case PeepSpriteType::EntertainerGorilla:
case PeepAnimationGroup::EntertainerGorilla:
return SPR_STAFF_COSTUME_GORILLA;
case PeepSpriteType::EntertainerSnowman:
case PeepAnimationGroup::EntertainerSnowman:
return SPR_STAFF_COSTUME_SNOWMAN;
case PeepSpriteType::EntertainerKnight:
case PeepAnimationGroup::EntertainerKnight:
return SPR_STAFF_COSTUME_KNIGHT;
case PeepSpriteType::EntertainerAstronaut:
case PeepAnimationGroup::EntertainerAstronaut:
return SPR_STAFF_COSTUME_ASTRONAUT;
case PeepSpriteType::EntertainerBandit:
case PeepAnimationGroup::EntertainerBandit:
return SPR_STAFF_COSTUME_BANDIT;
case PeepSpriteType::EntertainerSheriff:
case PeepAnimationGroup::EntertainerSheriff:
return SPR_STAFF_COSTUME_SHERIFF;
case PeepSpriteType::EntertainerPirate:
case PeepAnimationGroup::EntertainerPirate:
return SPR_STAFF_COSTUME_PIRATE;
case PeepSpriteType::Normal:
case PeepAnimationGroup::Normal:
default:
return SPR_PEEP_SMALL_FACE_HAPPY;
}
+1 -1
View File
@@ -464,7 +464,7 @@ namespace OpenRCT2::Ui::Windows
ViewportInteractionItem::Footpath, ViewportInteractionItem::Wall, ViewportInteractionItem::LargeScenery);
auto info = GetMapCoordinatesFromPos(screenCoords, interactionFlags);
if (info.SpriteType == ViewportInteractionItem::Terrain)
if (info.interactionType == ViewportInteractionItem::Terrain)
{
_trackPlaceCtrlZ = Floor2(surfaceElement->GetBaseZ(), kCoordsZStep);
+1 -1
View File
@@ -328,7 +328,7 @@ namespace OpenRCT2::Ui::Windows
auto info = GetMapCoordinatesFromPos(
screenPos, EnumsToFlags(ViewportInteractionItem::Terrain, ViewportInteractionItem::Water));
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
if (_waterToolRaiseCost != kMoney64Undefined || _waterToolLowerCost != kMoney64Undefined)
{
+6 -6
View File
@@ -265,7 +265,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
COMPARE_FIELD(Peep, NextFlags);
COMPARE_FIELD(Peep, State);
COMPARE_FIELD(Peep, SubState);
COMPARE_FIELD(Peep, SpriteType);
COMPARE_FIELD(Peep, AnimationGroup);
COMPARE_FIELD(Peep, TshirtColour);
COMPARE_FIELD(Peep, TrousersColour);
COMPARE_FIELD(Peep, DestinationX);
@@ -281,11 +281,11 @@ struct GameStateSnapshots final : public IGameStateSnapshots
COMPARE_FIELD(Peep, CurrentTrain);
COMPARE_FIELD(Peep, TimeToSitdown);
COMPARE_FIELD(Peep, SpecialSprite);
COMPARE_FIELD(Peep, ActionSpriteType);
COMPARE_FIELD(Peep, NextActionSpriteType);
COMPARE_FIELD(Peep, ActionSpriteImageOffset);
COMPARE_FIELD(Peep, AnimationType);
COMPARE_FIELD(Peep, NextAnimationType);
COMPARE_FIELD(Peep, AnimationImageIdOffset);
COMPARE_FIELD(Peep, Action);
COMPARE_FIELD(Peep, ActionFrame);
COMPARE_FIELD(Peep, AnimationFrameNum);
COMPARE_FIELD(Peep, StepProgress);
COMPARE_FIELD(Peep, MazeLastEdge);
COMPARE_FIELD(Peep, InteractionRideIndex);
@@ -302,7 +302,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
COMPARE_FIELD(Peep, PathfindHistory[i].z);
COMPARE_FIELD(Peep, PathfindHistory[i].direction);
}
COMPARE_FIELD(Peep, WalkingFrameNum);
COMPARE_FIELD(Peep, WalkingAnimationFrameNum);
COMPARE_FIELD(Peep, PeepFlags);
}
+3 -3
View File
@@ -669,7 +669,7 @@ void CheatSetAction::SetGuestParameter(int32_t parameter, int32_t value) const
peep->Intensity = IntensityRange(value, 15);
break;
}
peep->UpdateSpriteType();
peep->UpdateAnimationGroup();
}
}
@@ -688,12 +688,12 @@ void CheatSetAction::GiveObjectToGuests(int32_t object) const
case OBJECT_BALLOON:
peep->GiveItem(ShopItem::Balloon);
peep->BalloonColour = ScenarioRandMax(COLOUR_NUM_NORMAL);
peep->UpdateSpriteType();
peep->UpdateAnimationGroup();
break;
case OBJECT_UMBRELLA:
peep->GiveItem(ShopItem::Umbrella);
peep->UmbrellaColour = ScenarioRandMax(COLOUR_NUM_NORMAL);
peep->UpdateSpriteType();
peep->UpdateAnimationGroup();
break;
}
}
+10 -10
View File
@@ -33,11 +33,11 @@
using namespace OpenRCT2;
/* rct2: 0x009929FC */
static constexpr PeepSpriteType spriteTypes[] = {
PeepSpriteType::Handyman,
PeepSpriteType::Mechanic,
PeepSpriteType::Security,
PeepSpriteType::EntertainerPanda,
static constexpr PeepAnimationGroup spriteTypes[] = {
PeepAnimationGroup::Handyman,
PeepAnimationGroup::Mechanic,
PeepAnimationGroup::Security,
PeepAnimationGroup::EntertainerPanda,
};
StaffHireNewAction::StaffHireNewAction(
@@ -132,9 +132,9 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const
newPeep->WindowInvalidateFlags = 0;
newPeep->Action = PeepActionType::Walking;
newPeep->SpecialSprite = 0;
newPeep->ActionSpriteImageOffset = 0;
newPeep->WalkingFrameNum = 0;
newPeep->ActionSpriteType = PeepActionSpriteType::None;
newPeep->AnimationImageIdOffset = 0;
newPeep->WalkingAnimationFrameNum = 0;
newPeep->AnimationType = PeepAnimationType::None;
newPeep->PathCheckOptimisation = 0;
newPeep->PeepFlags = 0;
newPeep->StaffLawnsMown = 0;
@@ -163,13 +163,13 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const
newPeep->PeepId = newStaffId;
newPeep->AssignedStaffType = static_cast<StaffType>(_staffType);
PeepSpriteType spriteType = spriteTypes[_staffType];
PeepAnimationGroup spriteType = spriteTypes[_staffType];
if (_staffType == static_cast<uint8_t>(StaffType::Entertainer))
{
spriteType = EntertainerCostumeToSprite(_entertainerType);
}
newPeep->Name = nullptr;
newPeep->SpriteType = spriteType;
newPeep->AnimationGroup = spriteType;
const SpriteBounds* spriteBounds = &GetSpriteBounds(spriteType);
newPeep->SpriteData.Width = spriteBounds->sprite_width;
+19 -19
View File
@@ -20,22 +20,22 @@ using namespace OpenRCT2;
/** rct2: 0x00982134 */
constexpr bool peep_slow_walking_types[] = {
false, // PeepSpriteType::Normal
false, // PeepSpriteType::Handyman
false, // PeepSpriteType::Mechanic
false, // PeepSpriteType::Security
false, // PeepSpriteType::EntertainerPanda
false, // PeepSpriteType::EntertainerTiger
false, // PeepSpriteType::EntertainerElephant
false, // PeepSpriteType::EntertainerRoman
false, // PeepSpriteType::EntertainerGorilla
false, // PeepSpriteType::EntertainerSnowman
false, // PeepSpriteType::EntertainerKnight
true, // PeepSpriteType::EntertainerAstronaut
false, // PeepSpriteType::EntertainerBandit
false, // PeepSpriteType::EntertainerSheriff
true, // PeepSpriteType::EntertainerPirate
true, // PeepSpriteType::Balloon
false, // PeepAnimationGroup::Normal
false, // PeepAnimationGroup::Handyman
false, // PeepAnimationGroup::Mechanic
false, // PeepAnimationGroup::Security
false, // PeepAnimationGroup::EntertainerPanda
false, // PeepAnimationGroup::EntertainerTiger
false, // PeepAnimationGroup::EntertainerElephant
false, // PeepAnimationGroup::EntertainerRoman
false, // PeepAnimationGroup::EntertainerGorilla
false, // PeepAnimationGroup::EntertainerSnowman
false, // PeepAnimationGroup::EntertainerKnight
true, // PeepAnimationGroup::EntertainerAstronaut
false, // PeepAnimationGroup::EntertainerBandit
false, // PeepAnimationGroup::EntertainerSheriff
true, // PeepAnimationGroup::EntertainerPirate
true, // PeepAnimationGroup::Balloon
};
StaffSetCostumeAction::StaffSetCostumeAction(EntityId spriteIndex, EntertainerCostume costume)
@@ -98,14 +98,14 @@ GameActions::Result StaffSetCostumeAction::Execute() const
}
auto spriteType = EntertainerCostumeToSprite(_costume);
staff->SpriteType = spriteType;
staff->AnimationGroup = spriteType;
staff->PeepFlags &= ~PEEP_FLAGS_SLOW_WALK;
if (peep_slow_walking_types[EnumValue(spriteType)])
{
staff->PeepFlags |= PEEP_FLAGS_SLOW_WALK;
}
staff->ActionFrame = 0;
staff->UpdateCurrentActionSpriteType();
staff->AnimationFrameNum = 0;
staff->UpdateCurrentAnimationType();
staff->Invalidate();
WindowInvalidateByNumber(WindowClass::Peep, _spriteIndex);
+1 -1
View File
@@ -316,7 +316,7 @@ void LightFXPrepareLightList()
mapCoord = info.Loc;
mapCoord.x += tileOffsetX;
mapCoord.y += tileOffsetY;
interactionType = info.SpriteType;
interactionType = info.interactionType;
tileElement = info.Element;
}
+170 -170
View File
@@ -512,9 +512,9 @@ void Guest::GivePassingPeepsPizza(Guest* passingPeep)
if (passingPeep->IsActionInterruptable())
{
passingPeep->Action = PeepActionType::Wave2;
passingPeep->ActionFrame = 0;
passingPeep->ActionSpriteImageOffset = 0;
passingPeep->UpdateCurrentActionSpriteType();
passingPeep->AnimationFrameNum = 0;
passingPeep->AnimationImageIdOffset = 0;
passingPeep->UpdateCurrentAnimationType();
}
}
}
@@ -527,9 +527,9 @@ void Guest::MakePassingPeepsSick(Guest* passingPeep)
if (passingPeep->IsActionInterruptable())
{
passingPeep->Action = PeepActionType::ThrowUp;
passingPeep->ActionFrame = 0;
passingPeep->ActionSpriteImageOffset = 0;
passingPeep->UpdateCurrentActionSpriteType();
passingPeep->AnimationFrameNum = 0;
passingPeep->AnimationImageIdOffset = 0;
passingPeep->UpdateCurrentAnimationType();
}
}
@@ -539,7 +539,7 @@ void Guest::GivePassingPeepsIceCream(Guest* passingPeep)
return;
passingPeep->GiveItem(ShopItem::IceCream);
passingPeep->UpdateSpriteType();
passingPeep->UpdateAnimationGroup();
}
/**
@@ -575,9 +575,9 @@ void Guest::UpdateEasterEggInteractions()
if (IsActionInterruptable())
{
Action = PeepActionType::Joy;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
}
}
}
@@ -780,9 +780,9 @@ void Guest::UpdateMotivesIdle()
if (IsActionInterruptable())
{
Action = PeepActionType::ThrowUp;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
}
}
}
@@ -826,7 +826,7 @@ void Guest::UpdateConsumptionMotives()
}
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
UpdateSpriteType();
UpdateAnimationGroup();
}
}
}
@@ -984,7 +984,7 @@ void Guest::Tick128UpdateGuest(uint32_t index)
if (!(PeepFlags & PEEP_FLAGS_ANIMATION_FROZEN))
{
UpdateSpriteType();
UpdateAnimationGroup();
}
if (State == PeepState::OnRide || State == PeepState::EnteringRide)
@@ -1250,7 +1250,7 @@ void Guest::TryGetUpFromSitting()
// Set destination to the centre of the tile.
auto destination = GetLocation().ToTileCentre();
SetDestination(destination, 5);
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
/**
@@ -1276,8 +1276,8 @@ void Guest::UpdateSitting()
Orientation = ((Var37 + 2) & 3) * 8;
Action = PeepActionType::Idle;
NextActionSpriteType = PeepActionSpriteType::SittingIdle;
SwitchNextActionSpriteType();
NextAnimationType = PeepAnimationType::SittingIdle;
SwitchNextAnimationType();
SittingSubState = PeepSittingSubState::SatDown;
@@ -1304,11 +1304,11 @@ void Guest::UpdateSitting()
// Set destination to the centre of the tile
auto destination = GetLocation().ToTileCentre();
SetDestination(destination, 5);
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
return;
}
if (SpriteType == PeepSpriteType::Umbrella)
if (AnimationGroup == PeepAnimationGroup::Umbrella)
{
TryGetUpFromSitting();
return;
@@ -1322,9 +1322,9 @@ void Guest::UpdateSitting()
return;
}
Action = PeepActionType::SittingEatFood;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
return;
}
@@ -1334,7 +1334,7 @@ void Guest::UpdateSitting()
TryGetUpFromSitting();
return;
}
if (SpriteType == PeepSpriteType::Balloon || SpriteType == PeepSpriteType::Hat)
if (AnimationGroup == PeepAnimationGroup::Balloon || AnimationGroup == PeepAnimationGroup::Hat)
{
TryGetUpFromSitting();
return;
@@ -1350,9 +1350,9 @@ void Guest::UpdateSitting()
{
Action = PeepActionType::SittingCheckWatch;
}
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
return;
}
}
@@ -1669,7 +1669,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, const ShopItem shopItem, money64 price)
Photo4RideRef = ride.id;
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
UpdateSpriteType();
UpdateAnimationGroup();
if (PeepFlags & PEEP_FLAGS_TRACKING)
{
auto ft = Formatter();
@@ -2398,9 +2398,9 @@ void Guest::ReadMap()
if (IsActionInterruptable() && !IsOnLevelCrossing())
{
Action = PeepActionType::ReadMap;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
}
}
@@ -3391,10 +3391,10 @@ void Guest::UpdateBuying()
else
{
Action = PeepActionType::WithdrawMoney;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
ride->no_primary_items_sold++;
}
@@ -4138,11 +4138,11 @@ void Guest::UpdateRideLeaveVehicle()
return;
}
ActionSpriteImageOffset++;
if (ActionSpriteImageOffset & 3)
AnimationImageIdOffset++;
if (AnimationImageIdOffset & 3)
return;
ActionSpriteImageOffset = 0;
AnimationImageIdOffset = 0;
vehicle->num_peeps--;
vehicle->ApplyMass(-Mass);
@@ -4911,9 +4911,9 @@ void Guest::UpdateRideMazePathfinding()
if (Energy > 80 && !(PeepFlags & PEEP_FLAGS_SLOW_WALK) && !ClimateIsRaining() && (ScenarioRand() & 0xFFFF) <= 2427)
{
Action = PeepActionType::Jump;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
}
}
@@ -5311,28 +5311,28 @@ void Guest::UpdateWalking()
if (PeepFlags & PEEP_FLAGS_WAVING && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936)
{
Action = PeepActionType::Wave2;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
if (PeepFlags & PEEP_FLAGS_PHOTO && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936)
{
Action = PeepActionType::TakePhoto;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
if (PeepFlags & PEEP_FLAGS_PAINTING && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936)
{
Action = PeepActionType::DrawPicture;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
}
@@ -5374,7 +5374,7 @@ void Guest::UpdateWalking()
}
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
UpdateSpriteType();
UpdateAnimationGroup();
const auto loc = GetLocation();
int32_t litterX = loc.x + (ScenarioRand() & 0x7) - 3;
@@ -5553,19 +5553,19 @@ void Guest::UpdateWaitingAtCrossing()
}
Action = PeepActionType::Idle;
NextActionSpriteType = PeepActionSpriteType::WatchRide;
SwitchNextActionSpriteType();
NextAnimationType = PeepAnimationType::WatchRide;
SwitchNextAnimationType();
if (HasFoodOrDrink())
{
if ((ScenarioRand() & 0xFFFF) <= 1310)
{
Action = PeepActionType::EatFood;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
}
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
return;
}
@@ -5573,11 +5573,11 @@ void Guest::UpdateWaitingAtCrossing()
if ((ScenarioRand() & 0xFFFF) <= 64)
{
Action = PeepActionType::Wave2;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
}
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
/**
@@ -5632,15 +5632,15 @@ void Guest::UpdateQueuing()
PerformNextAction(pathingResult);
if (!IsActionInterruptable())
return;
if (SpriteType == PeepSpriteType::Normal)
if (AnimationGroup == PeepAnimationGroup::Normal)
{
if (TimeInQueue >= 2000 && (0xFFFF & ScenarioRand()) <= 119)
{
// Eat Food/Look at watch
Action = PeepActionType::EatFood;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
}
if (TimeInQueue >= 3500 && (0xFFFF & ScenarioRand()) <= 93)
{
@@ -5650,37 +5650,37 @@ void Guest::UpdateQueuing()
}
else
{
if (!(TimeInQueue & 0x3F) && IsActionIdle() && NextActionSpriteType == PeepActionSpriteType::WatchRide)
if (!(TimeInQueue & 0x3F) && IsActionIdle() && NextAnimationType == PeepAnimationType::WatchRide)
{
switch (SpriteType)
switch (AnimationGroup)
{
case PeepSpriteType::IceCream:
case PeepSpriteType::Chips:
case PeepSpriteType::Burger:
case PeepSpriteType::Drink:
case PeepSpriteType::Candyfloss:
case PeepSpriteType::Pizza:
case PeepSpriteType::Popcorn:
case PeepSpriteType::HotDog:
case PeepSpriteType::Tentacle:
case PeepSpriteType::ToffeeApple:
case PeepSpriteType::Doughnut:
case PeepSpriteType::Coffee:
case PeepSpriteType::Chicken:
case PeepSpriteType::Lemonade:
case PeepSpriteType::Pretzel:
case PeepSpriteType::SuJongkwa:
case PeepSpriteType::Juice:
case PeepSpriteType::FunnelCake:
case PeepSpriteType::Noodles:
case PeepSpriteType::Sausage:
case PeepSpriteType::Soup:
case PeepSpriteType::Sandwich:
case PeepAnimationGroup::IceCream:
case PeepAnimationGroup::Chips:
case PeepAnimationGroup::Burger:
case PeepAnimationGroup::Drink:
case PeepAnimationGroup::Candyfloss:
case PeepAnimationGroup::Pizza:
case PeepAnimationGroup::Popcorn:
case PeepAnimationGroup::HotDog:
case PeepAnimationGroup::Tentacle:
case PeepAnimationGroup::ToffeeApple:
case PeepAnimationGroup::Doughnut:
case PeepAnimationGroup::Coffee:
case PeepAnimationGroup::Chicken:
case PeepAnimationGroup::Lemonade:
case PeepAnimationGroup::Pretzel:
case PeepAnimationGroup::SuJongkwa:
case PeepAnimationGroup::Juice:
case PeepAnimationGroup::FunnelCake:
case PeepAnimationGroup::Noodles:
case PeepAnimationGroup::Sausage:
case PeepAnimationGroup::Soup:
case PeepAnimationGroup::Sandwich:
// Eat food
Action = PeepActionType::EatFood;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
break;
default:
break;
@@ -5788,14 +5788,14 @@ void Guest::UpdateWatching()
Orientation = (Var37 & 3) * 8;
Action = PeepActionType::Idle;
NextActionSpriteType = PeepActionSpriteType::WatchRide;
NextAnimationType = PeepAnimationType::WatchRide;
SwitchNextActionSpriteType();
SwitchNextAnimationType();
SubState++;
TimeToStand = std::clamp(((129 - Energy) * 16 + 50) / 2, 0, 255);
UpdateSpriteType();
UpdateAnimationGroup();
}
else if (SubState == 1)
{
@@ -5815,9 +5815,9 @@ void Guest::UpdateWatching()
if ((ScenarioRand() & 0xFFFF) <= 1310)
{
Action = PeepActionType::EatFood;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
return;
}
}
@@ -5825,9 +5825,9 @@ void Guest::UpdateWatching()
if ((ScenarioRand() & 0xFFFF) <= 655)
{
Action = PeepActionType::TakePhoto;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
return;
}
@@ -5836,9 +5836,9 @@ void Guest::UpdateWatching()
if ((ScenarioRand() & 0xFFFF) <= 655)
{
Action = PeepActionType::Wave;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
return;
}
}
@@ -5853,12 +5853,12 @@ void Guest::UpdateWatching()
return;
SetState(PeepState::Walking);
UpdateSpriteType();
UpdateAnimationGroup();
// Send peep to the centre of current tile.
auto destination = GetLocation().ToTileCentre();
SetDestination(destination, 5);
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
}
@@ -5943,7 +5943,7 @@ void Guest::UpdateUsingBin()
spaceLeftInBin--;
RemoveItem(item);
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
UpdateSpriteType();
UpdateAnimationGroup();
continue;
}
@@ -5956,7 +5956,7 @@ void Guest::UpdateUsingBin()
RemoveItem(item);
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
UpdateSpriteType();
UpdateAnimationGroup();
}
uint8_t additionStatus = foundElement->GetAdditionStatus();
@@ -6732,81 +6732,81 @@ static bool PeepFindRideToLookAt(Peep* peep, uint8_t edge, RideId* rideToView, u
}
/* Part of 0x0069B8CC rct2: 0x0069BC31 */
void Guest::SetSpriteType(PeepSpriteType new_sprite_type)
void Guest::SetAnimationGroup(PeepAnimationGroup new_sprite_type)
{
if (SpriteType == new_sprite_type)
if (AnimationGroup == new_sprite_type)
return;
SpriteType = new_sprite_type;
ActionSpriteImageOffset = 0;
WalkingFrameNum = 0;
AnimationGroup = new_sprite_type;
AnimationImageIdOffset = 0;
WalkingAnimationFrameNum = 0;
if (IsActionInterruptable())
Action = PeepActionType::Walking;
PeepFlags &= ~PEEP_FLAGS_SLOW_WALK;
Guard::Assert(EnumValue(new_sprite_type) < std::size(gSpriteTypeToSlowWalkMap));
if (gSpriteTypeToSlowWalkMap[EnumValue(new_sprite_type)])
Guard::Assert(EnumValue(new_sprite_type) < std::size(gAnimationGroupToSlowWalkMap));
if (gAnimationGroupToSlowWalkMap[EnumValue(new_sprite_type)])
{
PeepFlags |= PEEP_FLAGS_SLOW_WALK;
}
ActionSpriteType = PeepActionSpriteType::Invalid;
UpdateCurrentActionSpriteType();
AnimationType = PeepAnimationType::Invalid;
UpdateCurrentAnimationType();
if (State == PeepState::Sitting)
{
Action = PeepActionType::Idle;
NextActionSpriteType = PeepActionSpriteType::SittingIdle;
SwitchNextActionSpriteType();
NextAnimationType = PeepAnimationType::SittingIdle;
SwitchNextAnimationType();
}
if (State == PeepState::Watching)
{
Action = PeepActionType::Idle;
NextActionSpriteType = PeepActionSpriteType::WatchRide;
SwitchNextActionSpriteType();
NextAnimationType = PeepAnimationType::WatchRide;
SwitchNextAnimationType();
}
}
struct ItemPref
{
ShopItem item;
PeepSpriteType sprite_type;
PeepAnimationGroup sprite_type;
};
// clang-format off
static ItemPref item_order_preference[] = {
{ ShopItem::IceCream, PeepSpriteType::IceCream },
{ ShopItem::Chips, PeepSpriteType::Chips },
{ ShopItem::Pizza, PeepSpriteType::Pizza },
{ ShopItem::Burger, PeepSpriteType::Burger },
{ ShopItem::Drink, PeepSpriteType::Drink },
{ ShopItem::Coffee, PeepSpriteType::Coffee },
{ ShopItem::Chicken, PeepSpriteType::Chicken },
{ ShopItem::Lemonade, PeepSpriteType::Lemonade },
{ ShopItem::Candyfloss, PeepSpriteType::Candyfloss },
{ ShopItem::Popcorn, PeepSpriteType::Popcorn },
{ ShopItem::HotDog, PeepSpriteType::HotDog },
{ ShopItem::Tentacle, PeepSpriteType::Tentacle },
{ ShopItem::ToffeeApple, PeepSpriteType::ToffeeApple },
{ ShopItem::Doughnut, PeepSpriteType::Doughnut },
{ ShopItem::Pretzel, PeepSpriteType::Pretzel },
{ ShopItem::Cookie, PeepSpriteType::Pretzel },
{ ShopItem::Chocolate, PeepSpriteType::Coffee },
{ ShopItem::IcedTea, PeepSpriteType::Coffee },
{ ShopItem::FunnelCake, PeepSpriteType::FunnelCake },
{ ShopItem::BeefNoodles, PeepSpriteType::Noodles },
{ ShopItem::FriedRiceNoodles, PeepSpriteType::Noodles },
{ ShopItem::WontonSoup, PeepSpriteType::Soup },
{ ShopItem::MeatballSoup, PeepSpriteType::Soup },
{ ShopItem::FruitJuice, PeepSpriteType::Juice },
{ ShopItem::SoybeanMilk, PeepSpriteType::SuJongkwa },
{ ShopItem::Sujeonggwa, PeepSpriteType::SuJongkwa },
{ ShopItem::SubSandwich, PeepSpriteType::Sandwich },
{ ShopItem::RoastSausage, PeepSpriteType::Sausage },
{ ShopItem::Balloon, PeepSpriteType::Balloon },
{ ShopItem::Hat, PeepSpriteType::Hat },
{ ShopItem::Sunglasses, PeepSpriteType::Sunglasses },
{ ShopItem::IceCream, PeepAnimationGroup::IceCream },
{ ShopItem::Chips, PeepAnimationGroup::Chips },
{ ShopItem::Pizza, PeepAnimationGroup::Pizza },
{ ShopItem::Burger, PeepAnimationGroup::Burger },
{ ShopItem::Drink, PeepAnimationGroup::Drink },
{ ShopItem::Coffee, PeepAnimationGroup::Coffee },
{ ShopItem::Chicken, PeepAnimationGroup::Chicken },
{ ShopItem::Lemonade, PeepAnimationGroup::Lemonade },
{ ShopItem::Candyfloss, PeepAnimationGroup::Candyfloss },
{ ShopItem::Popcorn, PeepAnimationGroup::Popcorn },
{ ShopItem::HotDog, PeepAnimationGroup::HotDog },
{ ShopItem::Tentacle, PeepAnimationGroup::Tentacle },
{ ShopItem::ToffeeApple, PeepAnimationGroup::ToffeeApple },
{ ShopItem::Doughnut, PeepAnimationGroup::Doughnut },
{ ShopItem::Pretzel, PeepAnimationGroup::Pretzel },
{ ShopItem::Cookie, PeepAnimationGroup::Pretzel },
{ ShopItem::Chocolate, PeepAnimationGroup::Coffee },
{ ShopItem::IcedTea, PeepAnimationGroup::Coffee },
{ ShopItem::FunnelCake, PeepAnimationGroup::FunnelCake },
{ ShopItem::BeefNoodles, PeepAnimationGroup::Noodles },
{ ShopItem::FriedRiceNoodles, PeepAnimationGroup::Noodles },
{ ShopItem::WontonSoup, PeepAnimationGroup::Soup },
{ ShopItem::MeatballSoup, PeepAnimationGroup::Soup },
{ ShopItem::FruitJuice, PeepAnimationGroup::Juice },
{ ShopItem::SoybeanMilk, PeepAnimationGroup::SuJongkwa },
{ ShopItem::Sujeonggwa, PeepAnimationGroup::SuJongkwa },
{ ShopItem::SubSandwich, PeepAnimationGroup::Sandwich },
{ ShopItem::RoastSausage, PeepAnimationGroup::Sausage },
{ ShopItem::Balloon, PeepAnimationGroup::Balloon },
{ ShopItem::Hat, PeepAnimationGroup::Hat },
{ ShopItem::Sunglasses, PeepAnimationGroup::Sunglasses },
};
// clang-format on
@@ -6814,9 +6814,9 @@ static ItemPref item_order_preference[] = {
*
* rct2: 0x0069B8CC
*/
void Guest::UpdateSpriteType()
void Guest::UpdateAnimationGroup()
{
if (SpriteType == PeepSpriteType::Balloon && (ScenarioRand() & 0xFFFF) <= 327)
if (AnimationGroup == PeepAnimationGroup::Balloon && (ScenarioRand() & 0xFFFF) <= 327)
{
bool isBalloonPopped = false;
if (x != kLocationNull)
@@ -6848,7 +6848,7 @@ void Guest::UpdateSpriteType()
if (tileElement->IsLastForTile())
{
SetSpriteType(PeepSpriteType::Umbrella);
SetAnimationGroup(PeepAnimationGroup::Umbrella);
return;
}
tileElement++;
@@ -6860,48 +6860,48 @@ void Guest::UpdateSpriteType()
{
if (HasItem(itemPref.item))
{
SetSpriteType(itemPref.sprite_type);
SetAnimationGroup(itemPref.sprite_type);
return;
}
}
if (State == PeepState::Watching && StandingFlags & (1 << 1))
{
SetSpriteType(PeepSpriteType::Watching);
SetAnimationGroup(PeepAnimationGroup::Watching);
return;
}
if (Nausea > 170)
{
SetSpriteType(PeepSpriteType::VeryNauseous);
SetAnimationGroup(PeepAnimationGroup::VeryNauseous);
return;
}
if (Nausea > 140)
{
SetSpriteType(PeepSpriteType::Nauseous);
SetAnimationGroup(PeepAnimationGroup::Nauseous);
return;
}
if (Energy <= 64 && Happiness < 128)
{
SetSpriteType(PeepSpriteType::HeadDown);
SetAnimationGroup(PeepAnimationGroup::HeadDown);
return;
}
if (Energy <= 80 && Happiness < 128)
{
SetSpriteType(PeepSpriteType::ArmsCrossed);
SetAnimationGroup(PeepAnimationGroup::ArmsCrossed);
return;
}
if (Toilet > 220)
{
SetSpriteType(PeepSpriteType::RequireToilet);
SetAnimationGroup(PeepAnimationGroup::RequireToilet);
return;
}
SetSpriteType(PeepSpriteType::Normal);
SetAnimationGroup(PeepAnimationGroup::Normal);
}
bool Guest::HeadingForRideOrParkExit() const
@@ -6970,9 +6970,9 @@ void Guest::InsertNewThought(PeepThoughtType thoughtType, uint16_t thoughtArgume
if (newAction != PeepActionType::Walking && IsActionInterruptable())
{
Action = newAction;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
}
for (int32_t i = 0; i < kPeepMaxThoughts; ++i)
@@ -7119,19 +7119,19 @@ Guest* Guest::Generate(const CoordsXYZ& coords)
auto& gameState = GetGameState();
Guest* peep = CreateEntity<Guest>();
peep->SpriteType = PeepSpriteType::Normal;
peep->AnimationGroup = PeepAnimationGroup::Normal;
peep->OutsideOfPark = true;
peep->State = PeepState::Falling;
peep->Action = PeepActionType::Walking;
peep->SpecialSprite = 0;
peep->ActionSpriteImageOffset = 0;
peep->WalkingFrameNum = 0;
peep->ActionSpriteType = PeepActionSpriteType::None;
peep->AnimationImageIdOffset = 0;
peep->WalkingAnimationFrameNum = 0;
peep->AnimationType = PeepAnimationType::None;
peep->PeepFlags = 0;
peep->FavouriteRide = RideId::GetNull();
peep->FavouriteRideRating = 0;
const SpriteBounds* spriteBounds = &GetSpriteBounds(peep->SpriteType, peep->ActionSpriteType);
const SpriteBounds* spriteBounds = &GetSpriteBounds(peep->AnimationGroup, peep->AnimationType);
peep->SpriteData.Width = spriteBounds->sprite_width;
peep->SpriteData.HeightMin = spriteBounds->sprite_height_negative;
peep->SpriteData.HeightMax = spriteBounds->sprite_height_positive;
@@ -7467,7 +7467,7 @@ bool Guest::UpdateQueuePosition(PeepActionType previous_action)
return true;
Action = PeepActionType::Idle;
NextActionSpriteType = PeepActionSpriteType::WatchRide;
NextAnimationType = PeepAnimationType::WatchRide;
if (previous_action != PeepActionType::Idle)
Invalidate();
return true;
+2 -2
View File
@@ -329,7 +329,7 @@ public:
bool HasEmptyContainer() const;
void OnEnterRide(Ride& ride);
void OnExitRide(Ride& ride);
void UpdateSpriteType();
void UpdateAnimationGroup();
bool HeadingForRideOrParkExit() const;
void StopPurchaseThought(ride_type_t rideType);
void TryGetUpFromSitting();
@@ -354,7 +354,7 @@ public:
void CheckCantFindRide();
void CheckCantFindExit();
bool DecideAndBuyItem(Ride& ride, ShopItem shopItem, money64 price);
void SetSpriteType(PeepSpriteType new_sprite_type);
void SetAnimationGroup(PeepAnimationGroup new_sprite_type);
void HandleEasterEggName();
int32_t GetEasterEggNameId() const;
void UpdateEasterEggInteractions();
+99 -99
View File
@@ -70,54 +70,54 @@
using namespace OpenRCT2;
using namespace OpenRCT2::Audio;
static uint8_t _unk_F1AEF0;
static uint8_t _backupAnimationImageIdOffset;
static TileElement* _peepRideEntranceExitElement;
static std::shared_ptr<IAudioChannel> _crowdSoundChannel = nullptr;
static void GuestReleaseBalloon(Guest* peep, int16_t spawn_height);
static PeepActionSpriteType PeepSpecialSpriteToSpriteTypeMap[] = {
PeepActionSpriteType::None,
PeepActionSpriteType::HoldMat,
PeepActionSpriteType::StaffMower,
static PeepAnimationType PeepSpecialSpriteToAnimationGroupMap[] = {
PeepAnimationType::None,
PeepAnimationType::HoldMat,
PeepAnimationType::StaffMower,
};
static PeepActionSpriteType PeepActionToSpriteTypeMap[] = {
PeepActionSpriteType::CheckTime,
PeepActionSpriteType::EatFood,
PeepActionSpriteType::ShakeHead,
PeepActionSpriteType::EmptyPockets,
PeepActionSpriteType::SittingEatFood,
PeepActionSpriteType::SittingLookAroundLeft,
PeepActionSpriteType::SittingLookAroundRight,
PeepActionSpriteType::Wow,
PeepActionSpriteType::ThrowUp,
PeepActionSpriteType::Jump,
PeepActionSpriteType::StaffSweep,
PeepActionSpriteType::Drowning,
PeepActionSpriteType::StaffAnswerCall,
PeepActionSpriteType::StaffAnswerCall2,
PeepActionSpriteType::StaffCheckboard,
PeepActionSpriteType::StaffFix,
PeepActionSpriteType::StaffFix2,
PeepActionSpriteType::StaffFixGround,
PeepActionSpriteType::StaffFix3,
PeepActionSpriteType::StaffWatering,
PeepActionSpriteType::Joy,
PeepActionSpriteType::ReadMap,
PeepActionSpriteType::Wave,
PeepActionSpriteType::StaffEmptyBin,
PeepActionSpriteType::Wave2,
PeepActionSpriteType::TakePhoto,
PeepActionSpriteType::Clap,
PeepActionSpriteType::Disgust,
PeepActionSpriteType::DrawPicture,
PeepActionSpriteType::BeingWatched,
PeepActionSpriteType::WithdrawMoney,
static PeepAnimationType PeepActionToAnimationGroupMap[] = {
PeepAnimationType::CheckTime,
PeepAnimationType::EatFood,
PeepAnimationType::ShakeHead,
PeepAnimationType::EmptyPockets,
PeepAnimationType::SittingEatFood,
PeepAnimationType::SittingLookAroundLeft,
PeepAnimationType::SittingLookAroundRight,
PeepAnimationType::Wow,
PeepAnimationType::ThrowUp,
PeepAnimationType::Jump,
PeepAnimationType::StaffSweep,
PeepAnimationType::Drowning,
PeepAnimationType::StaffAnswerCall,
PeepAnimationType::StaffAnswerCall2,
PeepAnimationType::StaffCheckBoard,
PeepAnimationType::StaffFix,
PeepAnimationType::StaffFix2,
PeepAnimationType::StaffFixGround,
PeepAnimationType::StaffFix3,
PeepAnimationType::StaffWatering,
PeepAnimationType::Joy,
PeepAnimationType::ReadMap,
PeepAnimationType::Wave,
PeepAnimationType::StaffEmptyBin,
PeepAnimationType::Wave2,
PeepAnimationType::TakePhoto,
PeepAnimationType::Clap,
PeepAnimationType::Disgust,
PeepAnimationType::DrawPicture,
PeepAnimationType::BeingWatched,
PeepAnimationType::WithdrawMoney,
};
const bool gSpriteTypeToSlowWalkMap[] = {
const bool gAnimationGroupToSlowWalkMap[] = {
false, false, false, false, false, false, false, false, false, false, false, true, false, false, true, true,
true, true, true, false, true, false, true, true, true, false, false, true, true, false, false, true,
true, true, true, true, true, true, false, true, false, true, true, true, true, true, true, true,
@@ -314,40 +314,40 @@ bool Peep::IsOnPathBlockedByVehicle()
return FootpathIsBlockedByVehicle(curPos);
}
PeepActionSpriteType Peep::GetActionSpriteType()
PeepAnimationType Peep::GetAnimationType()
{
if (IsActionInterruptable())
{ // PeepActionType::None1 or PeepActionType::None2
return PeepSpecialSpriteToSpriteTypeMap[SpecialSprite];
return PeepSpecialSpriteToAnimationGroupMap[SpecialSprite];
}
if (EnumValue(Action) < std::size(PeepActionToSpriteTypeMap))
if (EnumValue(Action) < std::size(PeepActionToAnimationGroupMap))
{
return PeepActionToSpriteTypeMap[EnumValue(Action)];
return PeepActionToAnimationGroupMap[EnumValue(Action)];
}
Guard::Assert(
EnumValue(Action) >= std::size(PeepActionToSpriteTypeMap) && Action < PeepActionType::Idle, "Invalid peep action %u",
EnumValue(Action));
return PeepActionSpriteType::None;
EnumValue(Action) >= std::size(PeepActionToAnimationGroupMap) && Action < PeepActionType::Idle,
"Invalid peep action %u", EnumValue(Action));
return PeepAnimationType::None;
}
/*
* rct2: 0x00693B58
*/
void Peep::UpdateCurrentActionSpriteType()
void Peep::UpdateCurrentAnimationType()
{
if (EnumValue(SpriteType) >= EnumValue(PeepSpriteType::Count))
if (EnumValue(AnimationGroup) >= EnumValue(PeepAnimationGroup::Count))
{
return;
}
PeepActionSpriteType newActionSpriteType = GetActionSpriteType();
if (ActionSpriteType == newActionSpriteType)
PeepAnimationType newAnimationType = GetAnimationType();
if (AnimationType == newAnimationType)
{
return;
}
ActionSpriteType = newActionSpriteType;
AnimationType = newAnimationType;
UpdateSpriteBoundingBox();
}
@@ -356,7 +356,7 @@ void Peep::UpdateSpriteBoundingBox()
{
Invalidate();
const SpriteBounds* spriteBounds = &GetSpriteBounds(SpriteType, ActionSpriteType);
const SpriteBounds* spriteBounds = &GetSpriteBounds(AnimationGroup, AnimationType);
SpriteData.Width = spriteBounds->sprite_width;
SpriteData.HeightMin = spriteBounds->sprite_height_negative;
SpriteData.HeightMax = spriteBounds->sprite_height_positive;
@@ -374,9 +374,9 @@ void Peep::SwitchToSpecialSprite(uint8_t special_sprite_id)
if (IsActionInterruptable())
{
ActionSpriteImageOffset = 0;
AnimationImageIdOffset = 0;
}
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
void Peep::StateReset()
@@ -411,7 +411,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
{
PROFILED_FUNCTION();
_unk_F1AEF0 = ActionSpriteImageOffset;
_backupAnimationImageIdOffset = AnimationImageIdOffset;
if (Action == PeepActionType::Idle)
{
Action = PeepActionType::Walking;
@@ -433,15 +433,15 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
if (!UpdateActionAnimation())
{
ActionSpriteImageOffset = 0;
AnimationImageIdOffset = 0;
Action = PeepActionType::Walking;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
return { { x, y } };
}
// Should we throw up, and are we at the frame where sick appears?
auto* guest = As<Guest>();
if (Action == PeepActionType::ThrowUp && ActionFrame == 15 && guest != nullptr)
if (Action == PeepActionType::ThrowUp && AnimationFrameNum == 15 && guest != nullptr)
{
ThrowUp();
}
@@ -451,16 +451,16 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
bool Peep::UpdateActionAnimation()
{
const PeepAnimation& peepAnimation = GetPeepAnimation(SpriteType, ActionSpriteType);
ActionFrame++;
const PeepAnimation& peepAnimation = GetPeepAnimation(AnimationGroup, AnimationType);
AnimationFrameNum++;
// If last frame of action
if (ActionFrame >= peepAnimation.frame_offsets.size())
if (AnimationFrameNum >= peepAnimation.frame_offsets.size())
{
return false;
}
ActionSpriteImageOffset = peepAnimation.frame_offsets[ActionFrame];
AnimationImageIdOffset = peepAnimation.frame_offsets[AnimationFrameNum];
return true;
}
@@ -509,13 +509,13 @@ std::optional<CoordsXY> Peep::UpdateWalkingAction(const CoordsXY& differenceLoc,
void Peep::UpdateWalkingAnimation()
{
WalkingFrameNum++;
const PeepAnimation& peepAnimation = GetPeepAnimation(SpriteType, ActionSpriteType);
if (WalkingFrameNum >= peepAnimation.frame_offsets.size())
WalkingAnimationFrameNum++;
const PeepAnimation& peepAnimation = GetPeepAnimation(AnimationGroup, AnimationType);
if (WalkingAnimationFrameNum >= peepAnimation.frame_offsets.size())
{
WalkingFrameNum = 0;
WalkingAnimationFrameNum = 0;
}
ActionSpriteImageOffset = peepAnimation.frame_offsets[WalkingFrameNum];
AnimationImageIdOffset = peepAnimation.frame_offsets[WalkingAnimationFrameNum];
}
void Peep::ThrowUp()
@@ -621,8 +621,8 @@ void Peep::PickupAbort(int32_t old_x)
SetState(PeepState::Falling);
Action = PeepActionType::Walking;
SpecialSprite = 0;
ActionSpriteImageOffset = 0;
ActionSpriteType = PeepActionSpriteType::None;
AnimationImageIdOffset = 0;
AnimationType = PeepAnimationType::None;
PathCheckOptimisation = 0;
}
@@ -670,16 +670,16 @@ GameActions::Result Peep::Place(const TileCoordsXYZ& location, bool apply)
SetState(PeepState::Falling);
Action = PeepActionType::Walking;
SpecialSprite = 0;
ActionSpriteImageOffset = 0;
ActionSpriteType = PeepActionSpriteType::None;
AnimationImageIdOffset = 0;
AnimationType = PeepAnimationType::None;
PathCheckOptimisation = 0;
EntityTweener::Get().Reset();
auto* guest = As<Guest>();
if (guest != nullptr)
{
ActionSpriteType = PeepActionSpriteType::Invalid;
AnimationType = PeepAnimationType::Invalid;
guest->HappinessTarget = std::max(guest->HappinessTarget - 10, 0);
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
}
@@ -816,10 +816,10 @@ void Peep::UpdateFalling()
}
Action = PeepActionType::Drowning;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
PeepWindowStateUpdate(this);
return;
}
@@ -1381,9 +1381,9 @@ void PeepApplause()
if ((peep->State == PeepState::Walking || peep->State == PeepState::Queuing) && peep->IsActionInterruptable())
{
peep->Action = PeepActionType::Clap;
peep->ActionFrame = 0;
peep->ActionSpriteImageOffset = 0;
peep->UpdateCurrentActionSpriteType();
peep->AnimationFrameNum = 0;
peep->AnimationImageIdOffset = 0;
peep->UpdateCurrentAnimationType();
}
}
@@ -1702,14 +1702,14 @@ void PeepSetMapTooltip(Peep* peep)
/**
* rct2: 0x00693BAB
*/
void Peep::SwitchNextActionSpriteType()
void Peep::SwitchNextAnimationType()
{
// TBD: Add nextActionSpriteType as function parameter and make peep->NextActionSpriteType obsolete?
if (NextActionSpriteType != ActionSpriteType)
// TBD: Add nextAnimationType as function parameter and make peep->NextAnimationType obsolete?
if (NextAnimationType != AnimationType)
{
Invalidate();
ActionSpriteType = NextActionSpriteType;
const SpriteBounds* spriteBounds = &GetSpriteBounds(SpriteType, NextActionSpriteType);
AnimationType = NextAnimationType;
const SpriteBounds* spriteBounds = &GetSpriteBounds(AnimationGroup, NextAnimationType);
SpriteData.Width = spriteBounds->sprite_width;
SpriteData.HeightMin = spriteBounds->sprite_height_negative;
SpriteData.HeightMax = spriteBounds->sprite_height_positive;
@@ -1790,7 +1790,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
{
// Guest is in the ride queue.
guest->RideSubState = PeepRideSubState::AtQueueFront;
guest->ActionSpriteImageOffset = _unk_F1AEF0;
guest->AnimationImageIdOffset = _backupAnimationImageIdOffset;
return true;
}
@@ -1820,7 +1820,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
}
// Guest has decided to go on the ride.
guest->ActionSpriteImageOffset = _unk_F1AEF0;
guest->AnimationImageIdOffset = _backupAnimationImageIdOffset;
guest->InteractionRideIndex = rideIndex;
auto& station = ride->GetStation(stationNum);
@@ -2399,7 +2399,7 @@ static bool PeepInteractWithShop(Peep* peep, const CoordsXYE& coords)
{
if (guest->GuestHeadingToRideId == rideIndex)
guest->GuestHeadingToRideId = RideId::GetNull();
guest->ActionSpriteImageOffset = _unk_F1AEF0;
guest->AnimationImageIdOffset = _backupAnimationImageIdOffset;
guest->SetState(PeepState::Buying);
guest->CurrentRide = rideIndex;
guest->SubState = 0;
@@ -2739,11 +2739,11 @@ static void GuestReleaseBalloon(Guest* peep, int16_t spawn_height)
{
peep->RemoveItem(ShopItem::Balloon);
if (peep->SpriteType == PeepSpriteType::Balloon && peep->x != kLocationNull)
if (peep->AnimationGroup == PeepAnimationGroup::Balloon && peep->x != kLocationNull)
{
Balloon::Create({ peep->x, peep->y, spawn_height }, peep->BalloonColour, false);
peep->WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
peep->UpdateSpriteType();
peep->UpdateAnimationGroup();
}
}
}
@@ -2790,7 +2790,7 @@ void Peep::Serialise(DataSerialiser& stream)
stream << NextFlags;
stream << State;
stream << SubState;
stream << SpriteType;
stream << AnimationGroup;
stream << TshirtColour;
stream << TrousersColour;
stream << DestinationX;
@@ -2807,11 +2807,11 @@ void Peep::Serialise(DataSerialiser& stream)
stream << CurrentCar;
stream << CurrentSeat;
stream << SpecialSprite;
stream << ActionSpriteType;
stream << NextActionSpriteType;
stream << ActionSpriteImageOffset;
stream << AnimationType;
stream << NextAnimationType;
stream << AnimationImageIdOffset;
stream << Action;
stream << ActionFrame;
stream << AnimationFrameNum;
stream << StepProgress;
stream << PeepDirection;
stream << InteractionRideIndex;
@@ -2819,7 +2819,7 @@ void Peep::Serialise(DataSerialiser& stream)
stream << PathCheckOptimisation;
stream << PathfindGoal;
stream << PathfindHistory;
stream << WalkingFrameNum;
stream << WalkingAnimationFrameNum;
stream << PeepFlags;
}
@@ -2859,21 +2859,21 @@ void Peep::Paint(PaintSession& session, int32_t imageDirection) const
return;
}
PeepActionSpriteType actionSpriteType = ActionSpriteType;
uint8_t imageOffset = ActionSpriteImageOffset;
PeepAnimationType actionAnimationGroup = AnimationType;
uint8_t imageOffset = AnimationImageIdOffset;
if (Action == PeepActionType::Idle)
{
actionSpriteType = NextActionSpriteType;
actionAnimationGroup = NextAnimationType;
imageOffset = 0;
}
// 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 = GetPeepAnimation(SpriteType, actionSpriteType).base_image;
uint32_t baseImageId = GetPeepAnimation(AnimationGroup, actionAnimationGroup).base_image;
// Offset frame onto the base image, using rotation except for the 'picked up' state
if (actionSpriteType != PeepActionSpriteType::Ui)
if (actionAnimationGroup != PeepAnimationType::Hanging)
baseImageId += (imageDirection >> 3) + imageOffset * 4;
else
baseImageId += imageOffset;
+16 -16
View File
@@ -129,7 +129,7 @@ enum class PeepActionType : uint8_t
Drowning = 11,
StaffAnswerCall = 12,
StaffAnswerCall2 = 13,
StaffCheckboard = 14,
StaffCheckBoard = 14,
StaffFix = 15,
StaffFix2 = 16,
StaffFixGround = 17,
@@ -151,7 +151,7 @@ enum class PeepActionType : uint8_t
Walking = 255,
};
enum class PeepActionSpriteType : uint8_t
enum class PeepAnimationType : uint8_t
{
None = 0,
CheckTime = 1,
@@ -164,7 +164,7 @@ enum class PeepActionSpriteType : uint8_t
SittingEatFood = 8,
SittingLookAroundLeft = 9,
SittingLookAroundRight = 10,
Ui = 11,
Hanging = 11,
StaffMower = 12,
Wow = 13,
ThrowUp = 14,
@@ -173,7 +173,7 @@ enum class PeepActionSpriteType : uint8_t
Drowning = 17,
StaffAnswerCall = 18,
StaffAnswerCall2 = 19,
StaffCheckboard = 20,
StaffCheckBoard = 20,
StaffFix = 21,
StaffFix2 = 22,
StaffFixGround = 23,
@@ -240,7 +240,7 @@ enum PeepNextFlags
PEEP_NEXT_FLAG_UNUSED = (1 << 4),
};
enum class PeepSpriteType : uint8_t
enum class PeepAnimationGroup : uint8_t
{
Normal = 0,
Handyman = 1,
@@ -322,7 +322,7 @@ struct Peep : EntityBase
PeepRideSubState RideSubState;
PeepUsingBinSubState UsingBinSubState;
};
PeepSpriteType SpriteType;
PeepAnimationGroup AnimationGroup;
uint8_t TshirtColour;
uint8_t TrousersColour;
uint16_t DestinationX; // Location that the peep is trying to get to
@@ -352,13 +352,13 @@ struct Peep : EntityBase
};
// Normally 0, 1 for carrying sliding board on spiral slide ride, 2 for carrying lawn mower
uint8_t SpecialSprite;
PeepActionSpriteType ActionSpriteType;
// Seems to be used like a local variable, as it's always set before calling SwitchNextActionSpriteType, which
PeepAnimationType AnimationType;
// Seems to be used like a local variable, as it's always set before calling SwitchNextAnimationType, which
// reads this again
PeepActionSpriteType NextActionSpriteType;
uint8_t ActionSpriteImageOffset;
PeepAnimationType NextAnimationType;
uint8_t AnimationImageIdOffset;
PeepActionType Action;
uint8_t ActionFrame;
uint8_t AnimationFrameNum;
uint8_t StepProgress;
union
{
@@ -370,7 +370,7 @@ struct Peep : EntityBase
uint8_t PathCheckOptimisation; // see peep.checkForPath
TileCoordsXYZD PathfindGoal;
std::array<TileCoordsXYZD, 4> PathfindHistory;
uint8_t WalkingFrameNum;
uint8_t WalkingAnimationFrameNum;
uint32_t PeepFlags;
public: // Peep
@@ -383,7 +383,7 @@ public: // Peep
void ThrowUp();
void SetState(PeepState new_state);
void Remove();
void UpdateCurrentActionSpriteType();
void UpdateCurrentAnimationType();
void UpdateSpriteBoundingBox();
void SwitchToSpecialSprite(uint8_t special_sprite_id);
void StateReset();
@@ -424,8 +424,8 @@ public: // Peep
void PerformNextAction(uint8_t& pathing_result);
void PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result);
[[nodiscard]] int32_t GetZOnSlope(int32_t tile_x, int32_t tile_y);
void SwitchNextActionSpriteType();
[[nodiscard]] PeepActionSpriteType GetActionSpriteType();
void SwitchNextAnimationType();
[[nodiscard]] PeepAnimationType GetAnimationType();
private:
void UpdateFalling();
@@ -441,7 +441,7 @@ enum
PATHING_RIDE_ENTRANCE = 1 << 3,
};
extern const bool gSpriteTypeToSlowWalkMap[48];
extern const bool gAnimationGroupToSlowWalkMap[48];
int32_t PeepGetStaffCount();
void PeepUpdateAll();
+54 -52
View File
@@ -915,10 +915,10 @@ bool Staff::DoEntertainerPathFinding()
if (((ScenarioRand() & 0xFFFF) <= 0x4000) && IsActionInterruptable())
{
Action = (ScenarioRand() & 1) ? PeepActionType::Wave2 : PeepActionType::Joy;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
EntertainerUpdateNearbyPeeps();
}
@@ -958,11 +958,12 @@ int32_t Staff::GetHireDate() const
return HireDate;
}
PeepSpriteType EntertainerCostumeToSprite(EntertainerCostume entertainerType)
PeepAnimationGroup EntertainerCostumeToSprite(EntertainerCostume entertainerType)
{
uint8_t value = static_cast<uint8_t>(entertainerType);
PeepSpriteType newSpriteType = static_cast<PeepSpriteType>(value + EnumValue(PeepSpriteType::EntertainerPanda));
return newSpriteType;
PeepAnimationGroup newAnimationGroup = static_cast<PeepAnimationGroup>(
value + EnumValue(PeepAnimationGroup::EntertainerPanda));
return newAnimationGroup;
}
colour_t StaffGetColour(StaffType staffType)
@@ -1113,9 +1114,9 @@ void Staff::UpdateWatering()
Orientation = (Var37 & 3) << 3;
Action = PeepActionType::StaffWatering;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
SubState = 1;
}
@@ -1177,9 +1178,9 @@ void Staff::UpdateEmptyingBin()
Orientation = (Var37 & 3) << 3;
Action = PeepActionType::StaffEmptyBin;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
SubState = 1;
}
@@ -1194,7 +1195,7 @@ void Staff::UpdateEmptyingBin()
UpdateAction();
Invalidate();
if (ActionFrame != 11)
if (AnimationFrameNum != 11)
return;
TileElement* tile_element = MapGetFirstElementAt(NextLoc);
@@ -1248,7 +1249,7 @@ void Staff::UpdateSweeping()
if (!CheckForPath())
return;
if (Action == PeepActionType::StaffSweep && ActionFrame == 8)
if (Action == PeepActionType::StaffSweep && AnimationFrameNum == 8)
{
// Remove sick at this location
Litter::RemoveAt(GetLocation());
@@ -1266,9 +1267,9 @@ void Staff::UpdateSweeping()
if (Var37 != 2)
{
Action = PeepActionType::StaffSweep;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentActionSpriteType();
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentAnimationType();
return;
}
StateReset();
@@ -1394,10 +1395,10 @@ void Staff::UpdateAnswering()
if (SubState == 0)
{
Action = PeepActionType::StaffAnswerCall;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
SubState = 1;
PeepWindowStateUpdate(this);
@@ -1691,27 +1692,27 @@ void Staff::Tick128UpdateStaff()
if (AssignedStaffType != StaffType::Security)
return;
PeepSpriteType newSpriteType = PeepSpriteType::SecurityAlt;
PeepAnimationGroup newAnimationGroup = PeepAnimationGroup::SecurityAlt;
if (State != PeepState::Patrolling)
newSpriteType = PeepSpriteType::Security;
newAnimationGroup = PeepAnimationGroup::Security;
if (SpriteType == newSpriteType)
if (AnimationGroup == newAnimationGroup)
return;
SpriteType = newSpriteType;
ActionSpriteImageOffset = 0;
WalkingFrameNum = 0;
AnimationGroup = newAnimationGroup;
AnimationImageIdOffset = 0;
WalkingAnimationFrameNum = 0;
if (Action < PeepActionType::Idle)
Action = PeepActionType::Walking;
PeepFlags &= ~PEEP_FLAGS_SLOW_WALK;
if (gSpriteTypeToSlowWalkMap[EnumValue(newSpriteType)])
if (gAnimationGroupToSlowWalkMap[EnumValue(newAnimationGroup)])
{
PeepFlags |= PEEP_FLAGS_SLOW_WALK;
}
ActionSpriteType = PeepActionSpriteType::Invalid;
UpdateCurrentActionSpriteType();
AnimationType = PeepAnimationType::Invalid;
UpdateCurrentAnimationType();
}
bool Staff::IsMechanic() const
@@ -2092,9 +2093,9 @@ bool Staff::UpdateFixingFixVehicle(bool firstRun, const Ride& ride)
Orientation = PeepDirection << 3;
Action = (ScenarioRand() & 1) ? PeepActionType::StaffFix2 : PeepActionType::StaffFix;
ActionSpriteImageOffset = 0;
ActionFrame = 0;
UpdateCurrentActionSpriteType();
AnimationImageIdOffset = 0;
AnimationFrameNum = 0;
UpdateCurrentAnimationType();
}
if (IsActionWalking())
@@ -2106,7 +2107,7 @@ bool Staff::UpdateFixingFixVehicle(bool firstRun, const Ride& ride)
Invalidate();
uint8_t actionFrame = (Action == PeepActionType::StaffFix) ? 0x25 : 0x50;
if (ActionFrame != actionFrame)
if (AnimationFrameNum != actionFrame)
{
return false;
}
@@ -2133,10 +2134,10 @@ bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride)
{
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffFix3;
ActionSpriteImageOffset = 0;
ActionFrame = 0;
AnimationImageIdOffset = 0;
AnimationFrameNum = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
if (IsActionWalking())
@@ -2147,7 +2148,7 @@ bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride)
UpdateAction();
Invalidate();
if (ActionFrame != 0x65)
if (AnimationFrameNum != 0x65)
{
return false;
}
@@ -2238,11 +2239,11 @@ bool Staff::UpdateFixingFixStationEnd(bool firstRun)
if (!firstRun)
{
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffCheckboard;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
Action = PeepActionType::StaffCheckBoard;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
if (IsActionWalking())
@@ -2354,10 +2355,10 @@ bool Staff::UpdateFixingFixStationStart(bool firstRun, const Ride& ride)
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffFix;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
if (IsActionWalking())
@@ -2382,10 +2383,10 @@ bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride& ride)
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffFixGround;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
if (IsActionWalking())
@@ -2396,13 +2397,14 @@ bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride& ride)
UpdateAction();
Invalidate();
if (ActionFrame == 0x28)
if (AnimationFrameNum == 0x28)
{
ride.mechanic_status = RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES;
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE;
}
if (ActionFrame == 0x13 || ActionFrame == 0x19 || ActionFrame == 0x1F || ActionFrame == 0x25 || ActionFrame == 0x2B)
if (AnimationFrameNum == 0x13 || AnimationFrameNum == 0x19 || AnimationFrameNum == 0x1F || AnimationFrameNum == 0x25
|| AnimationFrameNum == 0x2B)
{
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::MechanicFix, GetLocation());
}
@@ -2472,10 +2474,10 @@ bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride& r
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffAnswerCall2;
ActionFrame = 0;
ActionSpriteImageOffset = 0;
AnimationFrameNum = 0;
AnimationImageIdOffset = 0;
UpdateCurrentActionSpriteType();
UpdateCurrentAnimationType();
}
if (!IsActionWalking())
+1 -1
View File
@@ -147,6 +147,6 @@ uint32_t StaffGetAvailableEntertainerCostumes();
int32_t StaffGetAvailableEntertainerCostumeList(EntertainerCostume* costumeList);
money64 GetStaffWage(StaffType type);
PeepSpriteType EntertainerCostumeToSprite(EntertainerCostume entertainerType);
PeepAnimationGroup EntertainerCostumeToSprite(EntertainerCostume entertainerType);
const PatrolArea& GetMergedPatrolArea(const StaffType type);
+7 -5
View File
@@ -69,7 +69,7 @@ InteractionInfo::InteractionInfo(const PaintStruct* ps)
: Loc(ps->MapPos)
, Element(ps->Element)
, Entity(ps->Entity)
, SpriteType(ps->InteractionItem)
, interactionType(ps->InteractionItem)
{
}
@@ -1561,7 +1561,7 @@ VisibilityKind GetPaintStructVisibility(const PaintStruct* ps, uint32_t viewFlag
/**
* Checks if a PaintStruct sprite type is in the filter mask.
*/
static bool PSSpriteTypeIsInFilter(PaintStruct* ps, uint16_t filter)
static bool PSInteractionTypeIsInFilter(PaintStruct* ps, uint16_t filter)
{
if (ps->InteractionItem != ViewportInteractionItem::None && ps->InteractionItem != ViewportInteractionItem::Label
&& ps->InteractionItem <= ViewportInteractionItem::Banner)
@@ -1745,7 +1745,8 @@ InteractionInfo SetInteractionInfoFromPaintSession(PaintSession* session, uint32
ps = next_ps;
if (IsSpriteInteractedWith(session->DPI, ps->image_id, ps->ScreenPos))
{
if (PSSpriteTypeIsInFilter(ps, filter) && GetPaintStructVisibility(ps, viewFlags) == VisibilityKind::Visible)
if (PSInteractionTypeIsInFilter(ps, filter)
&& GetPaintStructVisibility(ps, viewFlags) == VisibilityKind::Visible)
{
info = { ps };
}
@@ -1759,7 +1760,8 @@ InteractionInfo SetInteractionInfoFromPaintSession(PaintSession* session, uint32
{
if (IsSpriteInteractedWith(session->DPI, attached_ps->image_id, ps->ScreenPos + attached_ps->RelativePos))
{
if (PSSpriteTypeIsInFilter(ps, filter) && GetPaintStructVisibility(ps, viewFlags) == VisibilityKind::Visible)
if (PSInteractionTypeIsInFilter(ps, filter)
&& GetPaintStructVisibility(ps, viewFlags) == VisibilityKind::Visible)
{
info = { ps };
}
@@ -1911,7 +1913,7 @@ std::optional<CoordsXY> ScreenGetMapXY(const ScreenCoordsXY& screenCoords, Viewp
}
auto myViewport = window->viewport;
auto info = GetMapCoordinatesFromPosWindow(window, screenCoords, EnumsToFlags(ViewportInteractionItem::Terrain));
if (info.SpriteType == ViewportInteractionItem::None)
if (info.interactionType == ViewportInteractionItem::None)
{
return std::nullopt;
}
+1 -1
View File
@@ -112,7 +112,7 @@ struct InteractionInfo
CoordsXY Loc;
TileElement* Element{};
EntityBase* Entity{};
ViewportInteractionItem SpriteType = ViewportInteractionItem::None;
ViewportInteractionItem interactionType = ViewportInteractionItem::None;
};
constexpr int32_t kMaxViewportCount = kWindowLimitMax;
+6 -6
View File
@@ -1663,7 +1663,7 @@ namespace OpenRCT2
cs.ReadWrite(entity.State);
cs.ReadWrite(entity.SubState);
cs.ReadWrite(entity.SpriteType);
cs.ReadWrite(entity.AnimationGroup);
if (version <= 1)
{
@@ -1787,11 +1787,11 @@ namespace OpenRCT2
cs.ReadWrite(entity.CurrentTrain);
cs.ReadWrite(entity.TimeToSitdown);
cs.ReadWrite(entity.SpecialSprite);
cs.ReadWrite(entity.ActionSpriteType);
cs.ReadWrite(entity.NextActionSpriteType);
cs.ReadWrite(entity.ActionSpriteImageOffset);
cs.ReadWrite(entity.AnimationType);
cs.ReadWrite(entity.NextAnimationType);
cs.ReadWrite(entity.AnimationImageIdOffset);
cs.ReadWrite(entity.Action);
cs.ReadWrite(entity.ActionFrame);
cs.ReadWrite(entity.AnimationFrameNum);
cs.ReadWrite(entity.StepProgress);
if (version <= 1)
@@ -1919,7 +1919,7 @@ namespace OpenRCT2
cs.ReadWrite(entity.PathfindHistory[i].z);
cs.ReadWrite(entity.PathfindHistory[i].direction);
}
cs.ReadWrite(entity.WalkingFrameNum);
cs.ReadWrite(entity.WalkingAnimationFrameNum);
if (version <= 1)
{
File diff suppressed because it is too large. Load diff
+5 -5
View File
@@ -20,14 +20,14 @@ namespace OpenRCT2
std::span<const uint8_t> frame_offsets;
};
struct PeepAnimationGroup
struct PeepAnimations
{
public:
constexpr PeepAnimation& operator[](PeepActionSpriteType n)
constexpr PeepAnimation& operator[](PeepAnimationType n)
{
return animations[EnumValue(n)];
}
constexpr const PeepAnimation& operator[](PeepActionSpriteType n) const
constexpr const PeepAnimation& operator[](PeepAnimationType n) const
{
return animations[EnumValue(n)];
}
@@ -37,7 +37,7 @@ namespace OpenRCT2
};
const PeepAnimation& GetPeepAnimation(
PeepSpriteType spriteType, PeepActionSpriteType actionSpriteType = PeepActionSpriteType::None);
PeepAnimationGroup spriteType, PeepAnimationType actionAnimationGroup = PeepAnimationType::None);
const SpriteBounds& GetSpriteBounds(
PeepSpriteType spriteType, PeepActionSpriteType actionSpriteType = PeepActionSpriteType::None);
PeepAnimationGroup spriteType, PeepAnimationType actionAnimationGroup = PeepAnimationType::None);
} // namespace OpenRCT2
+16 -16
View File
@@ -22,7 +22,7 @@ namespace OpenRCT2
kPeepSpriteNormalStateSittingEatFoodId = 6629,
kPeepSpriteNormalStateSittingLookAroundLeftId = 6637,
kPeepSpriteNormalStateSittingLookAroundRightId = 6645,
kPeepSpriteNormalStateUiId = 6813,
kPeepSpriteNormalStateHangingId = 6813,
kPeepSpriteNormalStateWowId = 6825,
kPeepSpriteNormalStateThrowUpId = 6845,
kPeepSpriteNormalStateJumpId = 6909,
@@ -40,7 +40,7 @@ namespace OpenRCT2
kHandymanSpriteStateNoneId = 11261,
kHandymanSpriteStateWatchRideId = 11285,
kHandymanSpriteStateUiId = 11289,
kHandymanSpriteStateHangingId = 11289,
kHandymanSpriteStateStaffMowerId = 11301,
kHandymanSpriteStateStaffSweepId = 11325,
kHandymanSpriteStateDrowningId = 11345,
@@ -49,86 +49,86 @@ namespace OpenRCT2
kMechanicSpriteStateNoneId = 11441,
kMechanicSpriteStateWatchRideId = 11465,
kMechanicSpriteStateUiId = 11469,
kMechanicSpriteStateHangingId = 11469,
kMechanicSpriteStateDrowningId = 11481,
kMechanicSpriteStateStaffAnswerCallId = 11513,
kMechanicSpriteStateStaffCheckboardId = 11597,
kMechanicSpriteStateStaffCheckBoardId = 11597,
kMechanicSpriteStateStaffFixId = 11669,
kMechanicSpriteStateStaffFixGroundId = 11801,
kSecuritySpriteStateNoneId = 11881,
kSecuritySpriteStateWatchRideId = 11905,
kSecuritySpriteStateUiId = 11909,
kSecuritySpriteStateHangingId = 11909,
kSecuritySpriteStateDrowningId = 11921,
kEntertainerSpritePandaStateNoneId = 11973,
kEntertainerSpritePandaStateWatchRideId = 11997,
kEntertainerSpritePandaStateWaveId = 12041,
kEntertainerSpritePandaStateUiId = 12001,
kEntertainerSpritePandaStateHangingId = 12001,
kEntertainerSpritePandaStateDrowningId = 12013,
kEntertainerSpritePandaStateJoyId = 12065,
kEntertainerSpriteTigerStateNoneId = 12129,
kEntertainerSpriteTigerStateWatchRideId = 12153,
kEntertainerSpriteTigerStateWaveId = 12197,
kEntertainerSpriteTigerStateUiId = 12157,
kEntertainerSpriteTigerStateHangingId = 12157,
kEntertainerSpriteTigerStateDrowningId = 12169,
kEntertainerSpriteTigerStateJoyId = 12221,
kEntertainerSpriteElephantStateNoneId = 12325,
kEntertainerSpriteElephantStateWatchRideId = 12349,
kEntertainerSpriteElephantStateWaveId = 12365,
kEntertainerSpriteElephantStateUiId = 12353,
kEntertainerSpriteElephantStateHangingId = 12353,
kEntertainerSpriteElephantStateDrowningId = 12393,
kEntertainerSpriteElephantStateJoyId = 12433,
kEntertainerSpriteRomanStateNoneId = 13897,
kEntertainerSpriteRomanStateWatchRideId = 13921,
kEntertainerSpriteRomanStateWaveId = 13937,
kEntertainerSpriteRomanStateUiId = 13925,
kEntertainerSpriteRomanStateHangingId = 13925,
kEntertainerSpriteRomanStateDrowningId = 13969,
kEntertainerSpriteRomanStateJoyId = 14029,
kEntertainerSpriteGorillaStateNoneId = 12549,
kEntertainerSpriteGorillaStateWatchRideId = 12545,
kEntertainerSpriteGorillaStateWaveId = 12573,
kEntertainerSpriteGorillaStateUiId = 12665,
kEntertainerSpriteGorillaStateHangingId = 12665,
kEntertainerSpriteGorillaStateDrowningId = 12617,
kEntertainerSpriteSnowmanStateNoneId = 12681,
kEntertainerSpriteSnowmanStateWatchRideId = 12677,
kEntertainerSpriteSnowmanStateWaveId = 12705,
kEntertainerSpriteSnowmanStateUiId = 12881,
kEntertainerSpriteSnowmanStateHangingId = 12881,
kEntertainerSpriteSnowmanStateDrowningId = 12841,
kEntertainerSpriteKnightStateNoneId = 12897,
kEntertainerSpriteKnightStateWatchRideId = 12893,
kEntertainerSpriteKnightStateWaveId = 12993,
kEntertainerSpriteKnightStateUiId = 12981,
kEntertainerSpriteKnightStateHangingId = 12981,
kEntertainerSpriteKnightStateDrowningId = 12921,
kEntertainerSpriteAstronautStateNoneId = 13769,
kEntertainerSpriteAstronautStateWatchRideId = 13765,
kEntertainerSpriteAstronautStateWaveId = 13857,
kEntertainerSpriteAstronautStateUiId = 13845,
kEntertainerSpriteAstronautStateHangingId = 13845,
kEntertainerSpriteAstronautStateDrowningId = 13793,
kEntertainerSpriteBanditStateNoneId = 13109,
kEntertainerSpriteBanditStateWatchRideId = 13105,
kEntertainerSpriteBanditStateWaveId = 13209,
kEntertainerSpriteBanditStateUiId = 13197,
kEntertainerSpriteBanditStateHangingId = 13197,
kEntertainerSpriteBanditStateDrowningId = 13133,
kEntertainerSpriteSheriffStateNoneId = 13613,
kEntertainerSpriteSheriffStateWatchRideId = 13609,
kEntertainerSpriteSheriffStateWaveId = 13713,
kEntertainerSpriteSheriffStateUiId = 13701,
kEntertainerSpriteSheriffStateHangingId = 13701,
kEntertainerSpriteSheriffStateDrowningId = 13637,
kEntertainerSpritePirateStateNoneId = 13381,
kEntertainerSpritePirateStateWatchRideId = 13377,
kEntertainerSpritePirateStateWaveId = 13481,
kEntertainerSpritePirateStateUiId = 13469,
kEntertainerSpritePirateStateHangingId = 13469,
kEntertainerSpritePirateStateDrowningId = 13405,
kPeepSpriteIceCreamStateNoneId = 7505,
+18 -18
View File
@@ -509,7 +509,7 @@ namespace OpenRCT2::RCT1
}
};
enum class PeepSpriteType : uint8_t
enum class PeepAnimationGroup : uint8_t
{
Normal = 0,
Handyman = 1,
@@ -544,16 +544,16 @@ namespace OpenRCT2::RCT1
struct Peep : RCT12EntityBase
{
uint8_t Pad1F[3];
StringId NameStringID; // 0x22
uint16_t NextX; // 0x24
uint16_t NextY; // 0x26
uint8_t NextZ; // 0x28
uint8_t NextFlags; // 0x29
uint8_t OutsideOfPark; // 0x2A
uint8_t State; // 0x2B
uint8_t SubState; // 0x2C
PeepSpriteType SpriteType; // 0x2D
RCT12PeepType PeepType; // 0x2E
StringId NameStringID; // 0x22
uint16_t NextX; // 0x24
uint16_t NextY; // 0x26
uint8_t NextZ; // 0x28
uint8_t NextFlags; // 0x29
uint8_t OutsideOfPark; // 0x2A
uint8_t State; // 0x2B
uint8_t SubState; // 0x2C
PeepAnimationGroup AnimationGroup; // 0x2D
RCT12PeepType PeepType; // 0x2E
union
{
uint8_t StaffType; // 0x2F
@@ -600,14 +600,14 @@ namespace OpenRCT2::RCT1
};
};
// Normally 0, 1 for carrying sliding board on spiral slide ride, 2 for carrying lawn mower
uint8_t SpecialSprite; // 0x6D
uint8_t ActionSpriteType; // 0x6E
// Seems to be used like a local variable, as it's always set before calling SwitchNextActionSpriteType, which reads
uint8_t SpecialSprite; // 0x6D
uint8_t AnimationType; // 0x6E
// Seems to be used like a local variable, as it's always set before calling SwitchNextAnimationType, which reads
// this again
uint8_t NextActionSpriteType; // 0x6F
uint8_t ActionSpriteImageOffset; // 0x70
uint8_t Action; // 0x71
uint8_t ActionFrame; // 0x72
uint8_t NextAnimationType; // 0x6F
uint8_t AnimationImageIdOffset; // 0x70
uint8_t Action; // 0x71
uint8_t AnimationFrameNum; // 0x72
uint8_t StepProgress;
union
{
+7 -7
View File
@@ -1298,16 +1298,16 @@ namespace OpenRCT2::RCT1
void ImportPeep(::Peep* dst, const RCT1::Peep* src)
{
// Peep vs. staff (including which kind)
dst->SpriteType = RCT1::GetPeepSpriteType(src->SpriteType);
dst->AnimationGroup = RCT1::GetPeepAnimationGroup(src->AnimationGroup);
dst->Action = static_cast<PeepActionType>(src->Action);
dst->SpecialSprite = src->SpecialSprite;
dst->NextActionSpriteType = static_cast<PeepActionSpriteType>(src->NextActionSpriteType);
dst->ActionSpriteImageOffset = src->ActionSpriteImageOffset;
dst->WalkingFrameNum = src->NoActionFrameNum;
dst->ActionSpriteType = static_cast<PeepActionSpriteType>(src->ActionSpriteType);
dst->ActionFrame = src->ActionFrame;
dst->NextAnimationType = static_cast<PeepAnimationType>(src->NextAnimationType);
dst->AnimationImageIdOffset = src->AnimationImageIdOffset;
dst->WalkingAnimationFrameNum = src->NoActionFrameNum;
dst->AnimationType = static_cast<PeepAnimationType>(src->AnimationType);
dst->AnimationFrameNum = src->AnimationFrameNum;
const SpriteBounds* spriteBounds = &GetSpriteBounds(dst->SpriteType, dst->ActionSpriteType);
const SpriteBounds* spriteBounds = &GetSpriteBounds(dst->AnimationGroup, dst->AnimationType);
dst->SpriteData.Width = spriteBounds->sprite_width;
dst->SpriteData.HeightMin = spriteBounds->sprite_height_negative;
dst->SpriteData.HeightMax = spriteBounds->sprite_height_positive;
+41 -41
View File
@@ -68,52 +68,52 @@ namespace OpenRCT2::RCT1
return map[colour];
}
::PeepSpriteType GetPeepSpriteType(RCT1::PeepSpriteType rct1SpriteType)
::PeepAnimationGroup GetPeepAnimationGroup(RCT1::PeepAnimationGroup rct1AnimationGroup)
{
static constexpr ::PeepSpriteType map[] =
static constexpr ::PeepAnimationGroup map[] =
{
::PeepSpriteType::Normal, // 0x00
::PeepSpriteType::Handyman, // 0x01
::PeepSpriteType::Mechanic, // 0x02
::PeepSpriteType::Security, // 0x03
::PeepSpriteType::EntertainerPanda, // 0x04
::PeepSpriteType::EntertainerTiger, // 0x05
::PeepSpriteType::EntertainerElephant, // 0x06
::PeepSpriteType::EntertainerRoman, // 0x07
::PeepSpriteType::EntertainerGorilla, // 0x08
::PeepSpriteType::EntertainerSnowman, // 0x09
::PeepSpriteType::EntertainerKnight, // 0x0A
::PeepSpriteType::EntertainerAstronaut, // 0x0B
::PeepSpriteType::IceCream, // 0x0C
::PeepSpriteType::Chips, // 0x0D
::PeepSpriteType::Burger, // 0x0E
::PeepSpriteType::Drink, // 0x0F
::PeepSpriteType::Balloon, // 0x10
::PeepSpriteType::Candyfloss, // 0x11
::PeepSpriteType::Umbrella, // 0x12
::PeepSpriteType::Pizza, // 0x13
::PeepSpriteType::SecurityAlt, // 0x14
::PeepSpriteType::Popcorn, // 0x15
::PeepSpriteType::ArmsCrossed, // 0x16
::PeepSpriteType::HeadDown, // 0x17
::PeepSpriteType::Nauseous, // 0x18
::PeepSpriteType::VeryNauseous, // 0x19
::PeepSpriteType::RequireToilet, // 0x1A
::PeepSpriteType::Hat, // 0x1B
::PeepSpriteType::HotDog, // 0x1C
::PeepSpriteType::Tentacle, // 0x1D
::PeepSpriteType::ToffeeApple, // 0x1E
::PeepSpriteType::Doughnut, // 0x1F
::PeepSpriteType::Coffee, // 0x20
::PeepSpriteType::Chicken, // 0x21
::PeepSpriteType::Lemonade, // 0x22
::PeepAnimationGroup::Normal, // 0x00
::PeepAnimationGroup::Handyman, // 0x01
::PeepAnimationGroup::Mechanic, // 0x02
::PeepAnimationGroup::Security, // 0x03
::PeepAnimationGroup::EntertainerPanda, // 0x04
::PeepAnimationGroup::EntertainerTiger, // 0x05
::PeepAnimationGroup::EntertainerElephant, // 0x06
::PeepAnimationGroup::EntertainerRoman, // 0x07
::PeepAnimationGroup::EntertainerGorilla, // 0x08
::PeepAnimationGroup::EntertainerSnowman, // 0x09
::PeepAnimationGroup::EntertainerKnight, // 0x0A
::PeepAnimationGroup::EntertainerAstronaut, // 0x0B
::PeepAnimationGroup::IceCream, // 0x0C
::PeepAnimationGroup::Chips, // 0x0D
::PeepAnimationGroup::Burger, // 0x0E
::PeepAnimationGroup::Drink, // 0x0F
::PeepAnimationGroup::Balloon, // 0x10
::PeepAnimationGroup::Candyfloss, // 0x11
::PeepAnimationGroup::Umbrella, // 0x12
::PeepAnimationGroup::Pizza, // 0x13
::PeepAnimationGroup::SecurityAlt, // 0x14
::PeepAnimationGroup::Popcorn, // 0x15
::PeepAnimationGroup::ArmsCrossed, // 0x16
::PeepAnimationGroup::HeadDown, // 0x17
::PeepAnimationGroup::Nauseous, // 0x18
::PeepAnimationGroup::VeryNauseous, // 0x19
::PeepAnimationGroup::RequireToilet, // 0x1A
::PeepAnimationGroup::Hat, // 0x1B
::PeepAnimationGroup::HotDog, // 0x1C
::PeepAnimationGroup::Tentacle, // 0x1D
::PeepAnimationGroup::ToffeeApple, // 0x1E
::PeepAnimationGroup::Doughnut, // 0x1F
::PeepAnimationGroup::Coffee, // 0x20
::PeepAnimationGroup::Chicken, // 0x21
::PeepAnimationGroup::Lemonade, // 0x22
};
if (EnumValue(rct1SpriteType) >= std::size(map))
if (EnumValue(rct1AnimationGroup) >= std::size(map))
{
LOG_WARNING("Unsupported RCT1 peep sprite type: %d.", EnumValue(rct1SpriteType));
return ::PeepSpriteType::Normal;
LOG_WARNING("Unsupported RCT1 peep sprite type: %d.", EnumValue(rct1AnimationGroup));
return ::PeepAnimationGroup::Normal;
}
return map[EnumValue(rct1SpriteType)];
return map[EnumValue(rct1AnimationGroup)];
}
std::string_view GetTerrainSurfaceObject(uint8_t terrainSurface)
+2 -2
View File
@@ -22,10 +22,10 @@ namespace OpenRCT2::RCT1
};
enum class RideType : uint8_t;
enum class PeepSpriteType : uint8_t;
enum class PeepAnimationGroup : uint8_t;
colour_t GetColour(colour_t colour);
::PeepSpriteType GetPeepSpriteType(PeepSpriteType rct1SpriteType);
::PeepAnimationGroup GetPeepAnimationGroup(PeepAnimationGroup rct1AnimationGroup);
uint8_t GetRideType(RideType rideType, VehicleType vehicleType);
VehicleColourSchemeCopyDescriptor GetColourSchemeCopyDescriptor(VehicleType vehicleType);
+8 -8
View File
@@ -541,7 +541,7 @@ namespace OpenRCT2::RCT2
uint8_t OutsideOfPark; // 0x2A
uint8_t State; // 0x2B
uint8_t SubState; // 0x2C
uint8_t SpriteType; // 0x2D
uint8_t AnimationGroup; // 0x2D
uint8_t PeepType; // 0x2E
union
{
@@ -592,13 +592,13 @@ namespace OpenRCT2::RCT2
uint8_t StandingFlags; // 0x6C
};
};
uint8_t SpecialSprite; // 0x6D
uint8_t ActionSpriteType; // 0x6E
uint8_t NextActionSpriteType; // 0x6F
uint8_t ActionSpriteImageOffset; // 0x70
uint8_t Action; // 0x71
uint8_t ActionFrame; // 0x72
uint8_t StepProgress; // 0x73
uint8_t SpecialSprite; // 0x6D
uint8_t AnimationType; // 0x6E
uint8_t NextAnimationType; // 0x6F
uint8_t AnimationImageIdOffset; // 0x70
uint8_t Action; // 0x71
uint8_t AnimationFrameNum; // 0x72
uint8_t StepProgress; // 0x73
union
{
uint16_t MechanicTimeSinceCall;
+6 -6
View File
@@ -1613,7 +1613,7 @@ namespace OpenRCT2::RCT2
dst->NextFlags = src->NextFlags;
dst->State = static_cast<PeepState>(src->State);
dst->SubState = src->SubState;
dst->SpriteType = static_cast<PeepSpriteType>(src->SpriteType);
dst->AnimationGroup = static_cast<PeepAnimationGroup>(src->AnimationGroup);
dst->TshirtColour = src->TshirtColour;
dst->TrousersColour = src->TrousersColour;
dst->DestinationX = src->DestinationX;
@@ -1629,11 +1629,11 @@ namespace OpenRCT2::RCT2
dst->CurrentTrain = src->CurrentTrain;
dst->TimeToSitdown = src->TimeToSitdown;
dst->SpecialSprite = src->SpecialSprite;
dst->ActionSpriteType = static_cast<PeepActionSpriteType>(src->ActionSpriteType);
dst->NextActionSpriteType = static_cast<PeepActionSpriteType>(src->NextActionSpriteType);
dst->ActionSpriteImageOffset = src->ActionSpriteImageOffset;
dst->AnimationType = static_cast<PeepAnimationType>(src->AnimationType);
dst->NextAnimationType = static_cast<PeepAnimationType>(src->NextAnimationType);
dst->AnimationImageIdOffset = src->AnimationImageIdOffset;
dst->Action = static_cast<PeepActionType>(src->Action);
dst->ActionFrame = src->ActionFrame;
dst->AnimationFrameNum = src->AnimationFrameNum;
dst->StepProgress = src->StepProgress;
dst->PeepDirection = src->Direction;
dst->InteractionRideIndex = RCT12RideIdToOpenRCT2RideId(src->InteractionRideIndex);
@@ -1663,7 +1663,7 @@ namespace OpenRCT2::RCT2
src->PathfindHistory[i].direction };
}
}
dst->WalkingFrameNum = src->NoActionFrameNum;
dst->WalkingAnimationFrameNum = src->NoActionFrameNum;
}
constexpr EntityType GetEntityTypeFromRCT2Sprite(const RCT12EntityBase* src)
+6 -6
View File
@@ -7181,7 +7181,7 @@ Loc6DAEB9:
// Loc6DB706
const auto moveInfo = GetMoveInfo();
trackType = GetTrackType();
uint8_t moveInfovehicleSpriteType;
uint8_t moveInfovehicleAnimationGroup;
{
auto nextVehiclePosition = TrackLocation
+ CoordsXYZ{ moveInfo->x, moveInfo->y, moveInfo->z + GetRideTypeDescriptor(curRide.type).Heights.VehicleZOffset };
@@ -7224,7 +7224,7 @@ Loc6DAEB9:
bank_rotation = moveInfo->bank_rotation;
Pitch = moveInfo->Pitch;
moveInfovehicleSpriteType = moveInfo->Pitch;
moveInfovehicleAnimationGroup = moveInfo->Pitch;
if ((carEntry->flags & CAR_ENTRY_FLAG_WOODEN_WILD_MOUSE_SWING) && moveInfo->Pitch != 0)
{
@@ -7289,7 +7289,7 @@ Loc6DAEB9:
return true;
}
acceleration += AccelerationFromPitch[moveInfovehicleSpriteType];
acceleration += AccelerationFromPitch[moveInfovehicleAnimationGroup];
_vehicleUnkF64E10++;
goto Loc6DAEB9;
}
@@ -7511,7 +7511,7 @@ bool Vehicle::UpdateTrackMotionBackwards(const CarEntry* carEntry, const Ride& c
// Loc6DBD42
track_progress = newTrackProgress;
uint8_t moveInfoVehicleSpriteType;
uint8_t moveInfoVehicleAnimationGroup;
{
const VehicleInfo* moveInfo = GetMoveInfo();
auto nextVehiclePosition = TrackLocation
@@ -7537,7 +7537,7 @@ bool Vehicle::UpdateTrackMotionBackwards(const CarEntry* carEntry, const Ride& c
Orientation = moveInfo->direction;
bank_rotation = moveInfo->bank_rotation;
Pitch = moveInfo->Pitch;
moveInfoVehicleSpriteType = moveInfo->Pitch;
moveInfoVehicleAnimationGroup = moveInfo->Pitch;
if ((carEntry->flags & CAR_ENTRY_FLAG_WOODEN_WILD_MOUSE_SWING) && Pitch != 0)
{
@@ -7598,7 +7598,7 @@ bool Vehicle::UpdateTrackMotionBackwards(const CarEntry* carEntry, const Ride& c
{
return true;
}
acceleration += AccelerationFromPitch[moveInfoVehicleSpriteType];
acceleration += AccelerationFromPitch[moveInfoVehicleAnimationGroup];
_vehicleUnkF64E10++;
}
}
@@ -147,33 +147,33 @@ namespace OpenRCT2::Scripting
{ "here_we_are", PeepThoughtType::HereWeAre },
});
static const DukEnumMap<PeepActionSpriteType> availableGuestAnimations({
{ "walking", PeepActionSpriteType::None },
{ "checkTime", PeepActionSpriteType::CheckTime },
{ "watchRide", PeepActionSpriteType::WatchRide },
{ "eatFood", PeepActionSpriteType::EatFood },
{ "shakeHead", PeepActionSpriteType::ShakeHead },
{ "emptyPockets", PeepActionSpriteType::EmptyPockets },
{ "holdMat", PeepActionSpriteType::HoldMat },
{ "sittingIdle", PeepActionSpriteType::SittingIdle },
{ "sittingEatFood", PeepActionSpriteType::SittingEatFood },
{ "sittingLookAroundLeft", PeepActionSpriteType::SittingLookAroundLeft },
{ "sittingLookAroundRight", PeepActionSpriteType::SittingLookAroundRight },
{ "hanging", PeepActionSpriteType::Ui },
{ "wow", PeepActionSpriteType::Wow },
{ "throwUp", PeepActionSpriteType::ThrowUp },
{ "jump", PeepActionSpriteType::Jump },
{ "drowning", PeepActionSpriteType::Drowning },
{ "joy", PeepActionSpriteType::Joy },
{ "readMap", PeepActionSpriteType::ReadMap },
{ "wave", PeepActionSpriteType::Wave },
{ "wave2", PeepActionSpriteType::Wave2 },
{ "takePhoto", PeepActionSpriteType::TakePhoto },
{ "clap", PeepActionSpriteType::Clap },
{ "disgust", PeepActionSpriteType::Disgust },
{ "drawPicture", PeepActionSpriteType::DrawPicture },
{ "beingWatched", PeepActionSpriteType::BeingWatched },
{ "withdrawMoney", PeepActionSpriteType::WithdrawMoney },
static const DukEnumMap<PeepAnimationType> availableGuestAnimations({
{ "walking", PeepAnimationType::None },
{ "checkTime", PeepAnimationType::CheckTime },
{ "watchRide", PeepAnimationType::WatchRide },
{ "eatFood", PeepAnimationType::EatFood },
{ "shakeHead", PeepAnimationType::ShakeHead },
{ "emptyPockets", PeepAnimationType::EmptyPockets },
{ "holdMat", PeepAnimationType::HoldMat },
{ "sittingIdle", PeepAnimationType::SittingIdle },
{ "sittingEatFood", PeepAnimationType::SittingEatFood },
{ "sittingLookAroundLeft", PeepAnimationType::SittingLookAroundLeft },
{ "sittingLookAroundRight", PeepAnimationType::SittingLookAroundRight },
{ "hanging", PeepAnimationType::Hanging },
{ "wow", PeepAnimationType::Wow },
{ "throwUp", PeepAnimationType::ThrowUp },
{ "jump", PeepAnimationType::Jump },
{ "drowning", PeepAnimationType::Drowning },
{ "joy", PeepAnimationType::Joy },
{ "readMap", PeepAnimationType::ReadMap },
{ "wave", PeepAnimationType::Wave },
{ "wave2", PeepAnimationType::Wave2 },
{ "takePhoto", PeepAnimationType::TakePhoto },
{ "clap", PeepAnimationType::Clap },
{ "disgust", PeepAnimationType::Disgust },
{ "drawPicture", PeepAnimationType::DrawPicture },
{ "beingWatched", PeepAnimationType::BeingWatched },
{ "withdrawMoney", PeepAnimationType::WithdrawMoney },
});
ScGuest::ScGuest(EntityId id)
@@ -845,7 +845,7 @@ namespace OpenRCT2::Scripting
}
peep->GiveItem(*shopItem);
peep->UpdateSpriteType();
peep->UpdateAnimationGroup();
}
void ScGuest::remove_item(const DukValue& item) const
@@ -856,7 +856,7 @@ namespace OpenRCT2::Scripting
// Since guests can only have one item of a type and this item matches, remove it.
auto peep = GetGuest();
peep->RemoveItem(ShopItemMap[item["type"].as_string()]);
peep->UpdateSpriteType();
peep->UpdateAnimationGroup();
}
}
@@ -867,7 +867,7 @@ namespace OpenRCT2::Scripting
if (peep != nullptr)
{
peep->RemoveAllItems();
peep->UpdateSpriteType();
peep->UpdateAnimationGroup();
}
}
@@ -894,11 +894,11 @@ namespace OpenRCT2::Scripting
auto peep = GetPeep();
if (peep != nullptr)
{
auto& animationGroup = GetPeepAnimation(peep->SpriteType, *animationType);
auto& animationGroup = GetPeepAnimation(peep->AnimationGroup, *animationType);
for (auto frameOffset : animationGroup.frame_offsets)
{
auto imageId = animationGroup.base_image;
if (animationType != PeepActionSpriteType::Ui)
if (animationType != PeepAnimationType::Hanging)
imageId += rotation + frameOffset * 4;
else
imageId += frameOffset;
@@ -917,12 +917,12 @@ namespace OpenRCT2::Scripting
return nullptr;
}
std::string_view action = availableGuestAnimations[peep->ActionSpriteType];
std::string_view action = availableGuestAnimations[peep->AnimationType];
// Special consideration for sitting peeps
// TODO: something funky going on in the state machine
if (peep->ActionSpriteType == PeepActionSpriteType::None && peep->State == PeepState::Sitting)
action = availableGuestAnimations[PeepActionSpriteType::SittingIdle];
if (peep->AnimationType == PeepAnimationType::None && peep->State == PeepState::Sitting)
action = availableGuestAnimations[PeepAnimationType::SittingIdle];
return std::string(action);
}
@@ -938,16 +938,16 @@ namespace OpenRCT2::Scripting
}
auto* peep = GetGuest();
peep->ActionSpriteType = peep->NextActionSpriteType = *newType;
peep->AnimationType = peep->NextAnimationType = *newType;
auto offset = 0;
if (peep->IsActionWalking())
peep->WalkingFrameNum = offset;
peep->WalkingAnimationFrameNum = offset;
else
peep->ActionFrame = offset;
peep->AnimationFrameNum = offset;
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
auto& animationGroup = GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
peep->AnimationImageIdOffset = animationGroup.frame_offsets[offset];
peep->UpdateSpriteBoundingBox();
}
@@ -960,9 +960,9 @@ namespace OpenRCT2::Scripting
}
if (peep->IsActionWalking())
return peep->WalkingFrameNum;
return peep->WalkingAnimationFrameNum;
else
return peep->ActionFrame;
return peep->AnimationFrameNum;
}
void ScGuest::animationOffset_set(uint8_t offset)
@@ -971,16 +971,16 @@ namespace OpenRCT2::Scripting
auto* peep = GetGuest();
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
auto& animationGroup = GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
auto length = animationGroup.frame_offsets.size();
offset %= length;
if (peep->IsActionWalking())
peep->WalkingFrameNum = offset;
peep->WalkingAnimationFrameNum = offset;
else
peep->ActionFrame = offset;
peep->AnimationFrameNum = offset;
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
peep->AnimationImageIdOffset = animationGroup.frame_offsets[offset];
peep->UpdateSpriteBoundingBox();
}
@@ -992,7 +992,7 @@ namespace OpenRCT2::Scripting
return 0;
}
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
auto& animationGroup = GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
return static_cast<uint8_t>(animationGroup.frame_offsets.size());
}
@@ -15,7 +15,7 @@
# include "../../../management/Marketing.h"
# include "ScPeep.hpp"
enum class PeepActionSpriteType : uint8_t;
enum class PeepAnimationType : uint8_t;
namespace OpenRCT2::Scripting
{
@@ -17,46 +17,46 @@
namespace OpenRCT2::Scripting
{
static const DukEnumMap<PeepActionSpriteType> availableHandymanAnimations({
{ "walking", PeepActionSpriteType::None },
{ "watchRide", PeepActionSpriteType::WatchRide },
{ "hanging", PeepActionSpriteType::Ui },
{ "staffMower", PeepActionSpriteType::StaffMower },
{ "staffSweep", PeepActionSpriteType::StaffSweep },
{ "drowning", PeepActionSpriteType::Drowning },
{ "staffWatering", PeepActionSpriteType::StaffWatering },
{ "staffEmptyBin", PeepActionSpriteType::StaffEmptyBin },
static const DukEnumMap<PeepAnimationType> availableHandymanAnimations({
{ "walking", PeepAnimationType::None },
{ "watchRide", PeepAnimationType::WatchRide },
{ "hanging", PeepAnimationType::Hanging },
{ "staffMower", PeepAnimationType::StaffMower },
{ "staffSweep", PeepAnimationType::StaffSweep },
{ "drowning", PeepAnimationType::Drowning },
{ "staffWatering", PeepAnimationType::StaffWatering },
{ "staffEmptyBin", PeepAnimationType::StaffEmptyBin },
});
static const DukEnumMap<PeepActionSpriteType> availableMechanicAnimations({
{ "walking", PeepActionSpriteType::None },
{ "watchRide", PeepActionSpriteType::WatchRide },
{ "hanging", PeepActionSpriteType::Ui },
{ "drowning", PeepActionSpriteType::Drowning },
{ "staffAnswerCall", PeepActionSpriteType::StaffAnswerCall },
{ "staffAnswerCall2", PeepActionSpriteType::StaffAnswerCall2 },
{ "staffCheckBoard", PeepActionSpriteType::StaffCheckboard },
{ "staffFix", PeepActionSpriteType::StaffFix },
{ "staffFix2", PeepActionSpriteType::StaffFix2 },
{ "staffFixGround", PeepActionSpriteType::StaffFixGround },
{ "staffFix3", PeepActionSpriteType::StaffFix3 },
static const DukEnumMap<PeepAnimationType> availableMechanicAnimations({
{ "walking", PeepAnimationType::None },
{ "watchRide", PeepAnimationType::WatchRide },
{ "hanging", PeepAnimationType::Hanging },
{ "drowning", PeepAnimationType::Drowning },
{ "staffAnswerCall", PeepAnimationType::StaffAnswerCall },
{ "staffAnswerCall2", PeepAnimationType::StaffAnswerCall2 },
{ "staffCheckBoard", PeepAnimationType::StaffCheckBoard },
{ "staffFix", PeepAnimationType::StaffFix },
{ "staffFix2", PeepAnimationType::StaffFix2 },
{ "staffFixGround", PeepAnimationType::StaffFixGround },
{ "staffFix3", PeepAnimationType::StaffFix3 },
});
static const DukEnumMap<PeepActionSpriteType> availableSecurityAnimations({
{ "walking", PeepActionSpriteType::None },
{ "watchRide", PeepActionSpriteType::WatchRide },
{ "hanging", PeepActionSpriteType::Ui },
{ "drowning", PeepActionSpriteType::Drowning },
static const DukEnumMap<PeepAnimationType> availableSecurityAnimations({
{ "walking", PeepAnimationType::None },
{ "watchRide", PeepAnimationType::WatchRide },
{ "hanging", PeepAnimationType::Hanging },
{ "drowning", PeepAnimationType::Drowning },
});
static const DukEnumMap<PeepActionSpriteType> availableEntertainerAnimations({
{ "walking", PeepActionSpriteType::None },
{ "watchRide", PeepActionSpriteType::WatchRide },
{ "wave", PeepActionSpriteType::EatFood }, // NB: this not a typo
{ "hanging", PeepActionSpriteType::Ui },
{ "drowning", PeepActionSpriteType::Drowning },
{ "joy", PeepActionSpriteType::Joy },
{ "wave2", PeepActionSpriteType::Wave2 },
static const DukEnumMap<PeepAnimationType> availableEntertainerAnimations({
{ "walking", PeepAnimationType::None },
{ "watchRide", PeepAnimationType::WatchRide },
{ "wave", PeepAnimationType::EatFood }, // NB: this not a typo
{ "hanging", PeepAnimationType::Hanging },
{ "drowning", PeepAnimationType::Drowning },
{ "joy", PeepAnimationType::Joy },
{ "wave2", PeepAnimationType::Wave2 },
});
ScStaff::ScStaff(EntityId Id)
@@ -116,27 +116,27 @@ namespace OpenRCT2::Scripting
if (value == "handyman" && peep->AssignedStaffType != StaffType::Handyman)
{
peep->AssignedStaffType = StaffType::Handyman;
peep->SpriteType = PeepSpriteType::Handyman;
peep->AnimationGroup = PeepAnimationGroup::Handyman;
}
else if (value == "mechanic" && peep->AssignedStaffType != StaffType::Mechanic)
{
peep->AssignedStaffType = StaffType::Mechanic;
peep->SpriteType = PeepSpriteType::Mechanic;
peep->AnimationGroup = PeepAnimationGroup::Mechanic;
}
else if (value == "security" && peep->AssignedStaffType != StaffType::Security)
{
peep->AssignedStaffType = StaffType::Security;
peep->SpriteType = PeepSpriteType::Security;
peep->AnimationGroup = PeepAnimationGroup::Security;
}
else if (value == "entertainer" && peep->AssignedStaffType != StaffType::Entertainer)
{
peep->AssignedStaffType = StaffType::Entertainer;
peep->SpriteType = PeepSpriteType::EntertainerPanda;
peep->AnimationGroup = PeepAnimationGroup::EntertainerPanda;
}
// Reset state to walking to prevent invalid actions from carrying over
peep->Action = PeepActionType::Walking;
peep->ActionSpriteType = peep->NextActionSpriteType = PeepActionSpriteType::None;
peep->AnimationType = peep->NextAnimationType = PeepAnimationType::None;
}
}
@@ -157,35 +157,35 @@ namespace OpenRCT2::Scripting
}
}
static const DukEnumMap<PeepSpriteType> availableHandymanCostumes({
{ "handyman", PeepSpriteType::Handyman },
static const DukEnumMap<PeepAnimationGroup> availableHandymanCostumes({
{ "handyman", PeepAnimationGroup::Handyman },
});
static const DukEnumMap<PeepSpriteType> availableMechanicCostumes({
{ "mechanic", PeepSpriteType::Mechanic },
static const DukEnumMap<PeepAnimationGroup> availableMechanicCostumes({
{ "mechanic", PeepAnimationGroup::Mechanic },
});
static const DukEnumMap<PeepSpriteType> availableSecurityCostumes({
{ "security1", PeepSpriteType::Security },
{ "security2", PeepSpriteType::SecurityAlt },
static const DukEnumMap<PeepAnimationGroup> availableSecurityCostumes({
{ "security1", PeepAnimationGroup::Security },
{ "security2", PeepAnimationGroup::SecurityAlt },
});
static const DukEnumMap<PeepSpriteType> availableEntertainerCostumes({
{ "none", PeepSpriteType::Normal },
{ "panda", PeepSpriteType::EntertainerPanda },
{ "tiger", PeepSpriteType::EntertainerTiger },
{ "elephant", PeepSpriteType::EntertainerElephant },
{ "roman", PeepSpriteType::EntertainerRoman },
{ "gorilla", PeepSpriteType::EntertainerGorilla },
{ "snowman", PeepSpriteType::EntertainerSnowman },
{ "knight", PeepSpriteType::EntertainerKnight },
{ "astronaut", PeepSpriteType::EntertainerAstronaut },
{ "bandit", PeepSpriteType::EntertainerBandit },
{ "sheriff", PeepSpriteType::EntertainerSheriff },
{ "pirate", PeepSpriteType::EntertainerPirate },
static const DukEnumMap<PeepAnimationGroup> availableEntertainerCostumes({
{ "none", PeepAnimationGroup::Normal },
{ "panda", PeepAnimationGroup::EntertainerPanda },
{ "tiger", PeepAnimationGroup::EntertainerTiger },
{ "elephant", PeepAnimationGroup::EntertainerElephant },
{ "roman", PeepAnimationGroup::EntertainerRoman },
{ "gorilla", PeepAnimationGroup::EntertainerGorilla },
{ "snowman", PeepAnimationGroup::EntertainerSnowman },
{ "knight", PeepAnimationGroup::EntertainerKnight },
{ "astronaut", PeepAnimationGroup::EntertainerAstronaut },
{ "bandit", PeepAnimationGroup::EntertainerBandit },
{ "sheriff", PeepAnimationGroup::EntertainerSheriff },
{ "pirate", PeepAnimationGroup::EntertainerPirate },
});
static const DukEnumMap<PeepSpriteType>& costumesByStaffType(StaffType staffType)
static const DukEnumMap<PeepAnimationGroup>& costumesByStaffType(StaffType staffType)
{
switch (staffType)
{
@@ -225,7 +225,7 @@ namespace OpenRCT2::Scripting
auto& availableCostumes = costumesByStaffType(peep->AssignedStaffType);
auto costume = availableCostumes.find(peep->SpriteType);
auto costume = availableCostumes.find(peep->AnimationGroup);
if (costume != availableCostumes.end())
{
return std::string(costume->first);
@@ -250,19 +250,19 @@ namespace OpenRCT2::Scripting
if (value.type() == DukValue::Type::STRING)
{
std::string newCostume = value.as_string();
auto newSpriteType = availableCostumes.TryGet(newCostume);
if (newSpriteType != std::nullopt)
auto newAnimationGroup = availableCostumes.TryGet(newCostume);
if (newAnimationGroup != std::nullopt)
{
peep->SpriteType = *newSpriteType;
peep->AnimationGroup = *newAnimationGroup;
return;
}
}
else if (value.type() == DukValue::Type::NUMBER)
{
auto newSpriteType = PeepSpriteType(value.as_uint() + EnumValue(PeepSpriteType::EntertainerPanda));
if (availableCostumes.find(newSpriteType) != availableCostumes.end())
auto newAnimationGroup = PeepAnimationGroup(value.as_uint() + EnumValue(PeepAnimationGroup::EntertainerPanda));
if (availableCostumes.find(newAnimationGroup) != availableCostumes.end())
{
peep->SpriteType = newSpriteType;
peep->AnimationGroup = newAnimationGroup;
return;
}
}
@@ -291,7 +291,7 @@ namespace OpenRCT2::Scripting
}
}
const DukEnumMap<PeepActionSpriteType>& ScStaff::animationsByStaffType(StaffType staffType) const
const DukEnumMap<PeepAnimationType>& ScStaff::animationsByStaffType(StaffType staffType) const
{
switch (staffType)
{
@@ -340,11 +340,11 @@ namespace OpenRCT2::Scripting
return spriteIds;
}
auto& animationGroup = GetPeepAnimation(peep->SpriteType, *animationType);
auto& animationGroup = GetPeepAnimation(peep->AnimationGroup, *animationType);
for (auto frameOffset : animationGroup.frame_offsets)
{
auto imageId = animationGroup.base_image;
if (animationType != PeepActionSpriteType::Ui)
if (animationType != PeepAnimationType::Hanging)
imageId += rotation + frameOffset * 4;
else
imageId += frameOffset;
@@ -364,7 +364,7 @@ namespace OpenRCT2::Scripting
}
auto& animationGroups = animationsByStaffType(peep->AssignedStaffType);
std::string_view action = animationGroups[peep->ActionSpriteType];
std::string_view action = animationGroups[peep->AnimationType];
return std::string(action);
}
@@ -380,16 +380,16 @@ namespace OpenRCT2::Scripting
throw DukException() << "Invalid animation for this staff member (" << groupKey << ")";
}
peep->ActionSpriteType = peep->NextActionSpriteType = *newType;
peep->AnimationType = peep->NextAnimationType = *newType;
auto offset = 0;
if (peep->IsActionWalking())
peep->WalkingFrameNum = offset;
peep->WalkingAnimationFrameNum = offset;
else
peep->ActionFrame = offset;
peep->AnimationFrameNum = offset;
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
auto& animationGroup = GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
peep->AnimationImageIdOffset = animationGroup.frame_offsets[offset];
peep->UpdateSpriteBoundingBox();
}
@@ -402,9 +402,9 @@ namespace OpenRCT2::Scripting
}
if (peep->IsActionWalking())
return peep->WalkingFrameNum;
return peep->WalkingAnimationFrameNum;
else
return peep->ActionFrame;
return peep->AnimationFrameNum;
}
void ScStaff::animationOffset_set(uint8_t offset)
@@ -413,16 +413,16 @@ namespace OpenRCT2::Scripting
auto* peep = GetStaff();
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
auto& animationGroup = GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
auto length = animationGroup.frame_offsets.size();
offset %= length;
if (peep->IsActionWalking())
peep->WalkingFrameNum = offset;
peep->WalkingAnimationFrameNum = offset;
else
peep->ActionFrame = offset;
peep->AnimationFrameNum = offset;
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
peep->AnimationImageIdOffset = animationGroup.frame_offsets[offset];
peep->UpdateSpriteBoundingBox();
}
@@ -434,7 +434,7 @@ namespace OpenRCT2::Scripting
return 0;
}
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->ActionSpriteType);
auto& animationGroup = GetPeepAnimation(peep->AnimationGroup, peep->AnimationType);
return static_cast<uint8_t>(animationGroup.frame_offsets.size());
}
@@ -15,7 +15,7 @@
# include <memory>
enum class PeepActionSpriteType : uint8_t;
enum class PeepAnimationType : uint8_t;
enum class StaffType : uint8_t;
namespace OpenRCT2::Scripting
@@ -68,7 +68,7 @@ namespace OpenRCT2::Scripting
uint8_t orders_get() const;
void orders_set(uint8_t value);
const DukEnumMap<PeepActionSpriteType>& animationsByStaffType(StaffType staffType) const;
const DukEnumMap<PeepAnimationType>& animationsByStaffType(StaffType staffType) const;
std::vector<uint32_t> getAnimationSpriteIds(std::string groupKey, uint8_t rotation) const;
std::vector<std::string> availableAnimations_get() const;
std::string animation_get() const;
+1 -1
View File
@@ -159,7 +159,7 @@ void FootpathInterruptPeeps(const CoordsXYZ& footpathPos)
auto destination = location.ToTileCentre();
peep->SetState(PeepState::Walking);
peep->SetDestination(destination, 5);
peep->UpdateCurrentActionSpriteType();
peep->UpdateCurrentAnimationType();
}
}
}
+3 -3
View File
@@ -210,9 +210,9 @@ static bool MapAnimationInvalidateSmallScenery(const CoordsXYZ& loc)
continue;
peep->Action = PeepActionType::CheckTime;
peep->ActionFrame = 0;
peep->ActionSpriteImageOffset = 0;
peep->UpdateCurrentActionSpriteType();
peep->AnimationFrameNum = 0;
peep->AnimationImageIdOffset = 0;
peep->UpdateCurrentAnimationType();
peep->Invalidate();
break;
}