diff --git a/distribution/changelog.txt b/distribution/changelog.txt index f55b88530bc6..19ca63bfe5ac 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.28 (in development) ------------------------------------------------------------------------ +- Improved: [#24912] Staff now use an appropriate standing animation while waiting at level crossings. - Change: [#25089] Peep actions and animations that cause them to stop moving no longer trigger when they are on a level crossing. - Fix: [#25299] The Mine Train Coaster left large helix draws incorrect sprites at certain angles (original bug). diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index b821d36a471d..9a43ef314e1c 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -5698,44 +5698,6 @@ void Guest::UpdateWalking() } } -void Guest::UpdateWaitingAtCrossing() -{ - if (!IsActionInterruptable()) - { - UpdateAction(); - Invalidate(); - if (!IsActionWalking()) - return; - } - - Action = PeepActionType::idle; - NextAnimationType = PeepAnimationType::watchRide; - SwitchNextAnimationType(); - - if (HasFoodOrDrink()) - { - if ((ScenarioRand() & 0xFFFF) <= 1310) - { - Action = PeepActionType::eatFood; - AnimationFrameNum = 0; - AnimationImageIdOffset = 0; - } - - UpdateCurrentAnimationType(); - - return; - } - - if ((ScenarioRand() & 0xFFFF) <= 64) - { - Action = PeepActionType::wave2; - AnimationFrameNum = 0; - AnimationImageIdOffset = 0; - } - - UpdateCurrentAnimationType(); -} - /** * * rct2: 0x69185D @@ -7837,6 +7799,31 @@ void Guest::ThrowUp() OpenRCT2::Audio::Play3D(soundId, curLoc); } +void Guest::UpdateWaitingAtCrossing() +{ + Peep::UpdateWaitingAtCrossing(); + if (IsActionInterruptable()) + { + if (HasFoodOrDrink()) + { + if ((ScenarioRand() & 0xFFFF) <= 1310) + { + Action = PeepActionType::eatFood; + AnimationFrameNum = 0; + AnimationImageIdOffset = 0; + } + } + else if ((ScenarioRand() & 0xFFFF) <= 64) + { + Action = PeepActionType::wave2; + AnimationFrameNum = 0; + AnimationImageIdOffset = 0; + } + } + + UpdateCurrentAnimationType(); +} + void Guest::Serialise(DataSerialiser& stream) { Peep::Serialise(stream); diff --git a/src/openrct2/entity/Guest.h b/src/openrct2/entity/Guest.h index 0257f0c93c31..80f56583dc97 100644 --- a/src/openrct2/entity/Guest.h +++ b/src/openrct2/entity/Guest.h @@ -371,13 +371,13 @@ struct Guest : Peep void ThrowUp(); private: + void UpdateWaitingAtCrossing(); bool ShouldFindBench(); bool UpdateWalkingFindBin(); bool UpdateWalkingFindBench(); void UpdateRide(); void UpdateOnRide() {}; // TODO void UpdateWalking(); - void UpdateWaitingAtCrossing(); void UpdateQueuing(); void UpdateSitting(); void UpdateEnteringPark(); diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 6b8fdf34ad64..4850c1d15f35 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -258,6 +258,21 @@ void PeepUpdateAllBoundingBoxes() } } +void Peep::UpdateWaitingAtCrossing() +{ + if (!IsActionInterruptable()) + { + UpdateAction(); + Invalidate(); + if (!IsActionWalking()) + return; + } + + Action = PeepActionType::idle; + NextAnimationType = PeepAnimationType::watchRide; + SwitchNextAnimationType(); +} + /* * rct2: 0x68F3AE * Set peep state to falling if path below has gone missing, return true if current path is valid, false if peep starts falling. diff --git a/src/openrct2/entity/Peep.h b/src/openrct2/entity/Peep.h index 40140b6ac4a7..a42f42a1724c 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -404,15 +404,16 @@ struct Peep : EntityBase // TODO: Make these private again when done refactoring public: // Peep [[nodiscard]] bool CheckForPath(); - bool ShouldWaitForLevelCrossing() const; - bool IsOnLevelCrossing() const; - bool IsOnPathBlockedByVehicle() const; std::pair PerformNextAction(); [[nodiscard]] int32_t GetZOnSlope(int32_t tile_x, int32_t tile_y); void SwitchNextAnimationType(); [[nodiscard]] PeepAnimationType GetAnimationType(); protected: + void UpdateWaitingAtCrossing(); + bool ShouldWaitForLevelCrossing() const; + bool IsOnLevelCrossing() const; + bool IsOnPathBlockedByVehicle() const; void UpdateFalling(); void Update1(); void UpdatePicked(); diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 8759d11697aa..788b630d1f59 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -1010,6 +1010,23 @@ GameActions::Result StaffSetColour(StaffType staffType, colour_t value) return GameActions::Result(); } +void Staff::UpdateWaitingAtCrossing() +{ + Peep::UpdateWaitingAtCrossing(); + if (isEntertainer() && IsActionInterruptable()) + { + if ((ScenarioRand() & 0xFFFF) <= 1600) + { + Action = PeepActionType::wave2; + AnimationFrameNum = 0; + AnimationImageIdOffset = 0; + EntertainerUpdateNearbyPeeps(); + } + } + + UpdateCurrentAnimationType(); +} + /** rct2: 0x009929C8 */ static constexpr CoordsXY kMowingWaypoints[] = { { 28, 28 }, { 28, 4 }, { 20, 4 }, { 20, 28 }, { 12, 28 }, { 12, 4 }, { 4, 4 }, { 4, 28 }, @@ -1830,7 +1847,10 @@ void Staff::UpdatePatrolling() return; if (ShouldWaitForLevelCrossing() && !IsMechanicHeadingToFixRideBlockingPath()) + { + UpdateWaitingAtCrossing(); return; + } const auto [pathingResult, _] = PerformNextAction(); if (!(pathingResult & PATHING_DESTINATION_REACHED)) diff --git a/src/openrct2/entity/Staff.h b/src/openrct2/entity/Staff.h index 905f5d40250f..9be9b3d7dcfa 100644 --- a/src/openrct2/entity/Staff.h +++ b/src/openrct2/entity/Staff.h @@ -88,6 +88,7 @@ struct Staff : Peep bool HasPatrolArea() const; private: + void UpdateWaitingAtCrossing(); void UpdatePatrolling(); void UpdateMowing(); void UpdateSweeping(); diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 27b45a8232c5..8495c3df2bf9 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -47,7 +47,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -constexpr uint8_t kStreamVersion = 1; +constexpr uint8_t kStreamVersion = 2; const std::string kStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kStreamVersion);