diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 0dcf24fb44..2a76ba1eaa 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.30 (in development) ------------------------------------------------------------------------ +- Improved: [#24912] Staff now use an appropriate standing animation while waiting at level crossings. - Improved: [#25529] The map selection grid no longer redraws every frame if it has not changed. - Improved: [#25530] Wall dragging can now be cancelled without closing the Scenery window. - Improved: [#25575] Updated the network protocol to a new format that supports larger packets, allowing clients to connect reliably to servers with many objects or large maps. diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 94b56e9fdb..848140a9a5 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -5697,44 +5697,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 diff --git a/src/openrct2/entity/Guest.h b/src/openrct2/entity/Guest.h index 0257f0c93c..f009227098 100644 --- a/src/openrct2/entity/Guest.h +++ b/src/openrct2/entity/Guest.h @@ -377,7 +377,6 @@ private: 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 603aee0819..68936d21a2 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -250,6 +250,46 @@ void PeepUpdateAllBoundingBoxes() } } +void Peep::UpdateWaitingAtCrossing() +{ + if (!IsActionInterruptable()) + { + UpdateAction(); + Invalidate(); + if (!IsActionWalking()) + return; + } + + Action = PeepActionType::idle; + NextAnimationType = PeepAnimationType::watchRide; + SwitchNextAnimationType(); + + auto* guest = As(); + if (guest != nullptr) + { + if (guest->IsActionInterruptable()) + { + if (guest->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(); +} + /* * 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 fefadec182..2eb783394d 100644 --- a/src/openrct2/entity/Peep.h +++ b/src/openrct2/entity/Peep.h @@ -421,15 +421,16 @@ public: // Peep // 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: + bool ShouldWaitForLevelCrossing() const; + bool IsOnLevelCrossing() const; + bool IsOnPathBlockedByVehicle() const; + void UpdateWaitingAtCrossing(); void UpdateFalling(); void Update1(); void UpdatePicked(); diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 21cf85b90e..f4f47a400f 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -1830,7 +1830,10 @@ void Staff::UpdatePatrolling() return; if (ShouldWaitForLevelCrossing() && !IsMechanicHeadingToFixRideBlockingPath()) + { + UpdateWaitingAtCrossing(); return; + } const auto [pathingResult, _] = PerformNextAction(); if (!(pathingResult & PATHING_DESTINATION_REACHED)) diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 4f8b3dad66..c3cbf6610b 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 = 3; +constexpr uint8_t kStreamVersion = 4; const std::string kStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kStreamVersion);