Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions distribution/changelog.txt
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
63 changes: 25 additions & 38 deletions src/openrct2/entity/Guest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/entity/Guest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 15 additions & 0 deletions src/openrct2/entity/Peep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions src/openrct2/entity/Peep.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t, OpenRCT2::TileElement*> 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();
Expand Down
20 changes: 20 additions & 0 deletions src/openrct2/entity/Staff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -1830,7 +1847,10 @@ void Staff::UpdatePatrolling()
return;

if (ShouldWaitForLevelCrossing() && !IsMechanicHeadingToFixRideBlockingPath())
{
UpdateWaitingAtCrossing();
return;
}

const auto [pathingResult, _] = PerformNextAction();
if (!(pathingResult & PATHING_DESTINATION_REACHED))
Expand Down
1 change: 1 addition & 0 deletions src/openrct2/entity/Staff.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct Staff : Peep
bool HasPatrolArea() const;

private:
void UpdateWaitingAtCrossing();
void UpdatePatrolling();
void UpdateMowing();
void UpdateSweeping();
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/network/NetworkBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down