mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 19:13:07 +01:00
Adapt SV6 import and export for peep path-finding data
This commit is contained in:
@@ -1343,10 +1343,27 @@ void S6Exporter::ExportEntityPeep(RCT2SpritePeep* dst, const Peep* src)
|
||||
dst->id = src->Id;
|
||||
dst->path_check_optimisation = src->PathCheckOptimisation;
|
||||
dst->peep_flags = src->PeepFlags;
|
||||
dst->pathfind_goal = src->PathfindGoal;
|
||||
if (src->PathfindGoal.isNull())
|
||||
{
|
||||
dst->pathfind_goal = { 0xFF, 0xFF, 0xFF, INVALID_DIRECTION };
|
||||
}
|
||||
else
|
||||
{
|
||||
dst->pathfind_goal = { static_cast<uint8_t>(src->PathfindGoal.x), static_cast<uint8_t>(src->PathfindGoal.y),
|
||||
static_cast<uint8_t>(src->PathfindGoal.z), src->PathfindGoal.direction };
|
||||
}
|
||||
for (size_t i = 0; i < std::size(src->PathfindHistory); i++)
|
||||
{
|
||||
dst->pathfind_history[i] = src->PathfindHistory[i];
|
||||
if (src->PathfindHistory[i].isNull())
|
||||
{
|
||||
dst->pathfind_history[i] = { 0xFF, 0xFF, 0xFF, INVALID_DIRECTION };
|
||||
}
|
||||
else
|
||||
{
|
||||
dst->pathfind_history[i] = { static_cast<uint8_t>(src->PathfindHistory[i].x),
|
||||
static_cast<uint8_t>(src->PathfindHistory[i].y),
|
||||
static_cast<uint8_t>(src->PathfindHistory[i].z), src->PathfindHistory[i].direction };
|
||||
}
|
||||
}
|
||||
dst->no_action_frame_num = src->WalkingFrameNum;
|
||||
}
|
||||
|
||||
@@ -1365,6 +1365,10 @@ public:
|
||||
|
||||
void ImportEntityPeep(Peep* dst, const RCT2SpritePeep* src)
|
||||
{
|
||||
const auto isNullLocation = [](const rct12_xyzd8& pos) {
|
||||
return pos.x == 0xFF && pos.y == 0xFF && pos.z == 0xFF && pos.direction == INVALID_DIRECTION;
|
||||
};
|
||||
|
||||
ImportEntityCommonProperties(static_cast<SpriteBase*>(dst), src);
|
||||
if (is_user_string_id(src->name_string_idx))
|
||||
{
|
||||
@@ -1401,10 +1405,28 @@ public:
|
||||
dst->Id = src->id;
|
||||
dst->PathCheckOptimisation = src->path_check_optimisation;
|
||||
dst->PeepFlags = src->peep_flags;
|
||||
dst->PathfindGoal = src->pathfind_goal;
|
||||
if (isNullLocation(src->pathfind_goal))
|
||||
{
|
||||
dst->PathfindGoal.setNull();
|
||||
dst->PathfindGoal.direction = INVALID_DIRECTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst->PathfindGoal = { src->pathfind_goal.x, src->pathfind_goal.y, src->pathfind_goal.z,
|
||||
src->pathfind_goal.direction };
|
||||
}
|
||||
for (size_t i = 0; i < std::size(src->pathfind_history); i++)
|
||||
{
|
||||
dst->PathfindHistory[i] = src->pathfind_history[i];
|
||||
if (isNullLocation(src->pathfind_history[i]))
|
||||
{
|
||||
dst->PathfindHistory[i].setNull();
|
||||
dst->PathfindHistory[i].direction = INVALID_DIRECTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst->PathfindHistory[i] = { src->pathfind_history[i].x, src->pathfind_history[i].y, src->pathfind_history[i].z,
|
||||
src->pathfind_history[i].direction };
|
||||
}
|
||||
}
|
||||
dst->WalkingFrameNum = src->no_action_frame_num;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user