diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-21 12:37:47 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-21 12:37:47 +0100 |
commit | c49e460e3c20f7c31ea1068b7d6ac3987f3c4b3b (patch) | |
tree | 33a5ebe0541e9ffc648c7bb9b4aeec4d8d097c98 | |
parent | 82d4063e1d9dbf7eb0908d42cb13958aa884dc05 (diff) |
serialize: add depth offset anim_group parameter
-rw-r--r-- | serialize/anim.cpp | 4 | ||||
-rw-r--r-- | src/anim.hpp | 2 | ||||
-rw-r--r-- | src/scenery.cpp | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/serialize/anim.cpp b/serialize/anim.cpp index 4effc375..e8494dc2 100644 --- a/serialize/anim.cpp +++ b/serialize/anim.cpp @@ -48,6 +48,8 @@ static void to_json(nlohmann::json& j, const anim_group& val) j["offset"] = val.offset; if (val.z_offset != def.z_offset) j["z-offset"] = val.z_offset; + if (val.depth_offset != def.depth_offset) + j["depth-offset"] = val.depth_offset; } static void from_json(const nlohmann::json& j, anim_group& val) @@ -68,6 +70,8 @@ static void from_json(const nlohmann::json& j, anim_group& val) val.offset = j["offset"]; if (j.contains("z-offset")) val.z_offset = j["z-offset"]; + if (j.contains("depth-offset")) + val.depth_offset = j["depth-offset"]; } static void to_json(nlohmann::json& j, const anim_def& val) diff --git a/src/anim.hpp b/src/anim.hpp index 6264a070..c1bb7326 100644 --- a/src/anim.hpp +++ b/src/anim.hpp @@ -25,7 +25,7 @@ struct anim_group final String name, mirror_from; std::vector<anim_frame> frames; Vector2ui ground; // for use in anim-crop-tool only - Vector2s z_offset; + Vector2s z_offset, depth_offset; Vector3b offset; }; diff --git a/src/scenery.cpp b/src/scenery.cpp index 892104c2..9acc7944 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -97,7 +97,7 @@ Vector2 scenery::depth_offset() const const auto offset = rotate_point(door_offset, rotation::N, r); ret += Vector2(offset); } - ret += Vector2(atlas->group(r).z_offset); + ret += Vector2(atlas->group(r).depth_offset); return ret * inv_tile_size; } |