Rename ActionFrame to AnimationFrameNum

This commit is contained in:
Aaron van Geffen committed 2024-09-22 16:12:04 +02:00
1 parent ee7bb61bb0
commit 24b36915ef
14 files changed
+60 -59

No files matched your search

+1 -1
View File
@@ -285,7 +285,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
COMPARE_FIELD(Peep, NextAnimationType);
COMPARE_FIELD(Peep, ActionSpriteImageOffset);
COMPARE_FIELD(Peep, Action);
COMPARE_FIELD(Peep, ActionFrame);
COMPARE_FIELD(Peep, AnimationFrameNum);
COMPARE_FIELD(Peep, StepProgress);
COMPARE_FIELD(Peep, MazeLastEdge);
COMPARE_FIELD(Peep, InteractionRideIndex);
@@ -104,7 +104,7 @@ GameActions::Result StaffSetCostumeAction::Execute() const
{
staff->PeepFlags |= PEEP_FLAGS_SLOW_WALK;
}
staff->ActionFrame = 0;
staff->AnimationFrameNum = 0;
staff->UpdateCurrentAnimationType();
staff->Invalidate();
+20 -20
View File
@@ -512,7 +512,7 @@ void Guest::GivePassingPeepsPizza(Guest* passingPeep)
if (passingPeep->IsActionInterruptable())
{
passingPeep->Action = PeepActionType::Wave2;
passingPeep->ActionFrame = 0;
passingPeep->AnimationFrameNum = 0;
passingPeep->ActionSpriteImageOffset = 0;
passingPeep->UpdateCurrentAnimationType();
}
@@ -527,7 +527,7 @@ void Guest::MakePassingPeepsSick(Guest* passingPeep)
if (passingPeep->IsActionInterruptable())
{
passingPeep->Action = PeepActionType::ThrowUp;
passingPeep->ActionFrame = 0;
passingPeep->AnimationFrameNum = 0;
passingPeep->ActionSpriteImageOffset = 0;
passingPeep->UpdateCurrentAnimationType();
}
@@ -575,7 +575,7 @@ void Guest::UpdateEasterEggInteractions()
if (IsActionInterruptable())
{
Action = PeepActionType::Joy;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
}
@@ -780,7 +780,7 @@ void Guest::UpdateMotivesIdle()
if (IsActionInterruptable())
{
Action = PeepActionType::ThrowUp;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
}
@@ -1322,7 +1322,7 @@ void Guest::UpdateSitting()
return;
}
Action = PeepActionType::SittingEatFood;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
return;
@@ -1350,7 +1350,7 @@ void Guest::UpdateSitting()
{
Action = PeepActionType::SittingCheckWatch;
}
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
return;
@@ -2398,7 +2398,7 @@ void Guest::ReadMap()
if (IsActionInterruptable() && !IsOnLevelCrossing())
{
Action = PeepActionType::ReadMap;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
}
@@ -3391,7 +3391,7 @@ void Guest::UpdateBuying()
else
{
Action = PeepActionType::WithdrawMoney;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -4911,7 +4911,7 @@ void Guest::UpdateRideMazePathfinding()
if (Energy > 80 && !(PeepFlags & PEEP_FLAGS_SLOW_WALK) && !ClimateIsRaining() && (ScenarioRand() & 0xFFFF) <= 2427)
{
Action = PeepActionType::Jump;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
}
@@ -5311,7 +5311,7 @@ void Guest::UpdateWalking()
if (PeepFlags & PEEP_FLAGS_WAVING && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936)
{
Action = PeepActionType::Wave2;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -5320,7 +5320,7 @@ void Guest::UpdateWalking()
if (PeepFlags & PEEP_FLAGS_PHOTO && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936)
{
Action = PeepActionType::TakePhoto;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -5329,7 +5329,7 @@ void Guest::UpdateWalking()
if (PeepFlags & PEEP_FLAGS_PAINTING && IsActionInterruptable() && (0xFFFF & ScenarioRand()) < 936)
{
Action = PeepActionType::DrawPicture;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -5561,7 +5561,7 @@ void Guest::UpdateWaitingAtCrossing()
if ((ScenarioRand() & 0xFFFF) <= 1310)
{
Action = PeepActionType::EatFood;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
}
@@ -5573,7 +5573,7 @@ void Guest::UpdateWaitingAtCrossing()
if ((ScenarioRand() & 0xFFFF) <= 64)
{
Action = PeepActionType::Wave2;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
}
@@ -5638,7 +5638,7 @@ void Guest::UpdateQueuing()
{
// Eat Food/Look at watch
Action = PeepActionType::EatFood;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
}
@@ -5678,7 +5678,7 @@ void Guest::UpdateQueuing()
case PeepSpriteType::Sandwich:
// Eat food
Action = PeepActionType::EatFood;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
break;
@@ -5815,7 +5815,7 @@ void Guest::UpdateWatching()
if ((ScenarioRand() & 0xFFFF) <= 1310)
{
Action = PeepActionType::EatFood;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
return;
@@ -5825,7 +5825,7 @@ void Guest::UpdateWatching()
if ((ScenarioRand() & 0xFFFF) <= 655)
{
Action = PeepActionType::TakePhoto;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
return;
@@ -5836,7 +5836,7 @@ void Guest::UpdateWatching()
if ((ScenarioRand() & 0xFFFF) <= 655)
{
Action = PeepActionType::Wave;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
return;
@@ -6970,7 +6970,7 @@ void Guest::InsertNewThought(PeepThoughtType thoughtType, uint16_t thoughtArgume
if (newAction != PeepActionType::Walking && IsActionInterruptable())
{
Action = newAction;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
}
+7 -7
View File
@@ -441,7 +441,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
// 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();
}
@@ -452,15 +452,15 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
bool Peep::UpdateActionAnimation()
{
const PeepAnimation& peepAnimation = GetPeepAnimation(SpriteType, AnimationType);
ActionFrame++;
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];
ActionSpriteImageOffset = peepAnimation.frame_offsets[AnimationFrameNum];
return true;
}
@@ -816,7 +816,7 @@ void Peep::UpdateFalling()
}
Action = PeepActionType::Drowning;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -1381,7 +1381,7 @@ void PeepApplause()
if ((peep->State == PeepState::Walking || peep->State == PeepState::Queuing) && peep->IsActionInterruptable())
{
peep->Action = PeepActionType::Clap;
peep->ActionFrame = 0;
peep->AnimationFrameNum = 0;
peep->ActionSpriteImageOffset = 0;
peep->UpdateCurrentAnimationType();
}
@@ -2811,7 +2811,7 @@ void Peep::Serialise(DataSerialiser& stream)
stream << NextAnimationType;
stream << ActionSpriteImageOffset;
stream << Action;
stream << ActionFrame;
stream << AnimationFrameNum;
stream << StepProgress;
stream << PeepDirection;
stream << InteractionRideIndex;
+1 -1
View File
@@ -358,7 +358,7 @@ struct Peep : EntityBase
PeepAnimationType NextAnimationType;
uint8_t ActionSpriteImageOffset;
PeepActionType Action;
uint8_t ActionFrame;
uint8_t AnimationFrameNum;
uint8_t StepProgress;
union
{
+18 -17
View File
@@ -915,7 +915,7 @@ bool Staff::DoEntertainerPathFinding()
if (((ScenarioRand() & 0xFFFF) <= 0x4000) && IsActionInterruptable())
{
Action = (ScenarioRand() & 1) ? PeepActionType::Wave2 : PeepActionType::Joy;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -1113,7 +1113,7 @@ void Staff::UpdateWatering()
Orientation = (Var37 & 3) << 3;
Action = PeepActionType::StaffWatering;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -1177,7 +1177,7 @@ void Staff::UpdateEmptyingBin()
Orientation = (Var37 & 3) << 3;
Action = PeepActionType::StaffEmptyBin;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -1194,7 +1194,7 @@ void Staff::UpdateEmptyingBin()
UpdateAction();
Invalidate();
if (ActionFrame != 11)
if (AnimationFrameNum != 11)
return;
TileElement* tile_element = MapGetFirstElementAt(NextLoc);
@@ -1248,7 +1248,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,7 +1266,7 @@ void Staff::UpdateSweeping()
if (Var37 != 2)
{
Action = PeepActionType::StaffSweep;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
return;
@@ -1394,7 +1394,7 @@ void Staff::UpdateAnswering()
if (SubState == 0)
{
Action = PeepActionType::StaffAnswerCall;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -2093,7 +2093,7 @@ bool Staff::UpdateFixingFixVehicle(bool firstRun, const Ride& ride)
Action = (ScenarioRand() & 1) ? PeepActionType::StaffFix2 : PeepActionType::StaffFix;
ActionSpriteImageOffset = 0;
ActionFrame = 0;
AnimationFrameNum = 0;
UpdateCurrentAnimationType();
}
@@ -2106,7 +2106,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;
}
@@ -2134,7 +2134,7 @@ bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride)
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffFix3;
ActionSpriteImageOffset = 0;
ActionFrame = 0;
AnimationFrameNum = 0;
UpdateCurrentAnimationType();
}
@@ -2147,7 +2147,7 @@ bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride)
UpdateAction();
Invalidate();
if (ActionFrame != 0x65)
if (AnimationFrameNum != 0x65)
{
return false;
}
@@ -2239,7 +2239,7 @@ bool Staff::UpdateFixingFixStationEnd(bool firstRun)
{
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffCheckboard;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -2354,7 +2354,7 @@ bool Staff::UpdateFixingFixStationStart(bool firstRun, const Ride& ride)
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffFix;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -2382,7 +2382,7 @@ bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride& ride)
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffFixGround;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
@@ -2396,13 +2396,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,7 +2473,7 @@ bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride& r
Orientation = PeepDirection << 3;
Action = PeepActionType::StaffAnswerCall2;
ActionFrame = 0;
AnimationFrameNum = 0;
ActionSpriteImageOffset = 0;
UpdateCurrentAnimationType();
+1 -1
View File
@@ -1791,7 +1791,7 @@ namespace OpenRCT2
cs.ReadWrite(entity.NextAnimationType);
cs.ReadWrite(entity.ActionSpriteImageOffset);
cs.ReadWrite(entity.Action);
cs.ReadWrite(entity.ActionFrame);
cs.ReadWrite(entity.AnimationFrameNum);
cs.ReadWrite(entity.StepProgress);
if (version <= 1)
+1 -1
View File
@@ -607,7 +607,7 @@ namespace OpenRCT2::RCT1
uint8_t NextAnimationType; // 0x6F
uint8_t ActionSpriteImageOffset; // 0x70
uint8_t Action; // 0x71
uint8_t ActionFrame; // 0x72
uint8_t AnimationFrameNum; // 0x72
uint8_t StepProgress;
union
{
+1 -1
View File
@@ -1305,7 +1305,7 @@ namespace OpenRCT2::RCT1
dst->ActionSpriteImageOffset = src->ActionSpriteImageOffset;
dst->WalkingAnimationFrameNum = src->NoActionFrameNum;
dst->AnimationType = static_cast<PeepAnimationType>(src->AnimationType);
dst->ActionFrame = src->ActionFrame;
dst->AnimationFrameNum = src->AnimationFrameNum;
const SpriteBounds* spriteBounds = &GetSpriteBounds(dst->SpriteType, dst->AnimationType);
dst->SpriteData.Width = spriteBounds->sprite_width;
+1 -1
View File
@@ -597,7 +597,7 @@ namespace OpenRCT2::RCT2
uint8_t NextAnimationType; // 0x6F
uint8_t ActionSpriteImageOffset; // 0x70
uint8_t Action; // 0x71
uint8_t ActionFrame; // 0x72
uint8_t AnimationFrameNum; // 0x72
uint8_t StepProgress; // 0x73
union
{
+1 -1
View File
@@ -1633,7 +1633,7 @@ namespace OpenRCT2::RCT2
dst->NextAnimationType = static_cast<PeepAnimationType>(src->NextAnimationType);
dst->ActionSpriteImageOffset = src->ActionSpriteImageOffset;
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);
@@ -944,7 +944,7 @@ namespace OpenRCT2::Scripting
if (peep->IsActionWalking())
peep->WalkingAnimationFrameNum = offset;
else
peep->ActionFrame = offset;
peep->AnimationFrameNum = offset;
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->AnimationType);
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
@@ -962,7 +962,7 @@ namespace OpenRCT2::Scripting
if (peep->IsActionWalking())
return peep->WalkingAnimationFrameNum;
else
return peep->ActionFrame;
return peep->AnimationFrameNum;
}
void ScGuest::animationOffset_set(uint8_t offset)
@@ -978,7 +978,7 @@ namespace OpenRCT2::Scripting
if (peep->IsActionWalking())
peep->WalkingAnimationFrameNum = offset;
else
peep->ActionFrame = offset;
peep->AnimationFrameNum = offset;
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
peep->UpdateSpriteBoundingBox();
@@ -386,7 +386,7 @@ namespace OpenRCT2::Scripting
if (peep->IsActionWalking())
peep->WalkingAnimationFrameNum = offset;
else
peep->ActionFrame = offset;
peep->AnimationFrameNum = offset;
auto& animationGroup = GetPeepAnimation(peep->SpriteType, peep->AnimationType);
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
@@ -404,7 +404,7 @@ namespace OpenRCT2::Scripting
if (peep->IsActionWalking())
return peep->WalkingAnimationFrameNum;
else
return peep->ActionFrame;
return peep->AnimationFrameNum;
}
void ScStaff::animationOffset_set(uint8_t offset)
@@ -420,7 +420,7 @@ namespace OpenRCT2::Scripting
if (peep->IsActionWalking())
peep->WalkingAnimationFrameNum = offset;
else
peep->ActionFrame = offset;
peep->AnimationFrameNum = offset;
peep->ActionSpriteImageOffset = animationGroup.frame_offsets[offset];
peep->UpdateSpriteBoundingBox();
+1 -1
View File
@@ -210,7 +210,7 @@ static bool MapAnimationInvalidateSmallScenery(const CoordsXYZ& loc)
continue;
peep->Action = PeepActionType::CheckTime;
peep->ActionFrame = 0;
peep->AnimationFrameNum = 0;
peep->ActionSpriteImageOffset = 0;
peep->UpdateCurrentAnimationType();
peep->Invalidate();