summaryrefslogtreecommitdiffhomepage
path: root/loader
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-11-22 09:54:43 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-11-22 09:54:43 +0100
commitcf1c5f4dcd59a45b2e03851d2a8e2a640c80d066 (patch)
tree3eefe59718f15fceb43b8f0842d78b7a95e05b0b /loader
parent28ba97727326c05c9347b50b0114f01c0ec8b1df (diff)
a
Diffstat (limited to 'loader')
-rw-r--r--loader/atlas.cpp10
-rw-r--r--loader/wall-atlas.cpp3
2 files changed, 5 insertions, 8 deletions
diff --git a/loader/atlas.cpp b/loader/atlas.cpp
index 3fd30e80..d71b85ad 100644
--- a/loader/atlas.cpp
+++ b/loader/atlas.cpp
@@ -79,14 +79,8 @@ ArrayView<const String> loader_impl::anim_atlas_list()
std::shared_ptr<anim_atlas> loader_impl::anim_atlas(StringView name, StringView dir) noexcept(false)
{
fm_soft_assert(dir && dir[dir.size()-1] == '/');
- char path_buf[FILENAME_MAX];
- name = Path::splitExtension(name).first();
- const auto dirsiz = dir.size(), namesiz = name.size();
- fm_soft_assert(dirsiz + namesiz + 1 < FILENAME_MAX);
- std::memcpy(path_buf, dir.data(), dirsiz);
- std::memcpy(&path_buf[dirsiz], name.data(), namesiz);
- path_buf[dirsiz + namesiz] = '\0';
- const StringView path = path_buf;
+ char buf[FILENAME_MAX];
+ auto path = make_atlas_path(buf, dir, name);
if (auto it = anim_atlas_map.find(path); it != anim_atlas_map.end())
return it->second;
diff --git a/loader/wall-atlas.cpp b/loader/wall-atlas.cpp
index 10f3524d..99727e86 100644
--- a/loader/wall-atlas.cpp
+++ b/loader/wall-atlas.cpp
@@ -9,6 +9,7 @@
#include "serialize/corrade-string.hpp"
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/ArrayViewStl.h>
+#include <Corrade/Containers/StringIterable.h>
#include <Corrade/Utility/Path.h>
#include <Magnum/Trade/ImageData.h>
#include <vector>
@@ -21,6 +22,8 @@ namespace floormat::loader_detail {
std::shared_ptr<wall_atlas> loader_impl::get_wall_atlas(StringView filename)
{
+ auto def = wall_atlas_def::deserialize(""_s.join({filename, ".json"_s}));
+ auto tex = texture(""_s, filename);
using namespace floormat::Wall;
using namespace floormat::Wall::detail;