Merge pull request #24912 from matheusvb3/crossing-changes

Change staff animation while waiting at level crossing
This commit is contained in:
Michael Steenbeek authored and GitHub committed 2025-12-08 21:44:13 +01:00
commit cc1e217a90
7 files changed
+49 -43

No files matched your search

+1
View File
@@ -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.
-38
View File
@@ -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
-1
View File
@@ -377,7 +377,6 @@ private:
void UpdateRide();
void UpdateOnRide() {}; // TODO
void UpdateWalking();
void UpdateWaitingAtCrossing();
void UpdateQueuing();
void UpdateSitting();
void UpdateEnteringPark();
+40
View File
@@ -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<Guest>();
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.
+4 -3
View File
@@ -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<uint8_t, OpenRCT2::TileElement*> 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();
+3
View File
@@ -1830,7 +1830,10 @@ void Staff::UpdatePatrolling()
return;
if (ShouldWaitForLevelCrossing() && !IsMechanicHeadingToFixRideBlockingPath())
{
UpdateWaitingAtCrossing();
return;
}
const auto [pathingResult, _] = PerformNextAction();
if (!(pathingResult & PATHING_DESTINATION_REACHED))
+1 -1
View File
@@ -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);