summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--loader/atlas.cpp4
-rw-r--r--loader/impl.hpp2
-rw-r--r--loader/json.cpp2
-rw-r--r--loader/loader.cpp1
-rw-r--r--loader/loader.hpp4
-rw-r--r--scenery/door-close.json (renamed from anim/scenery/door-close.json)0
-rw-r--r--scenery/door-close.tga (renamed from anim/scenery/door-close.tga)bin4613654 -> 4613654 bytes
-rw-r--r--scenery/door.blend (renamed from anim/scenery/door.blend)bin1018604 -> 1018604 bytes
-rw-r--r--scenery/scenery.json (renamed from anim/scenery.json)0
-rw-r--r--serialize/scenery.cpp5
11 files changed, 10 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8e2c929..ef050d54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -193,7 +193,7 @@ add_subdirectory(main)
add_subdirectory(editor)
add_subdirectory(test)
-install(DIRECTORY images anim DESTINATION "share/floormat")
+install(DIRECTORY images anim scenery DESTINATION "share/floormat")
fm_run_hook(fm-userconfig-post)
get_cmake_property(_variableNames VARIABLES)
diff --git a/loader/atlas.cpp b/loader/atlas.cpp
index f68ca820..584d6b5a 100644
--- a/loader/atlas.cpp
+++ b/loader/atlas.cpp
@@ -29,7 +29,7 @@ ArrayView<String> loader_impl::anim_atlas_list()
return anim_atlases;
}
-std::shared_ptr<anim_atlas> loader_impl::anim_atlas(StringView name)
+std::shared_ptr<anim_atlas> loader_impl::anim_atlas(StringView name, StringView dir)
{
fm_assert(check_atlas_name(name));
@@ -37,7 +37,7 @@ std::shared_ptr<anim_atlas> loader_impl::anim_atlas(StringView name)
return it->second;
else
{
- const auto path = Path::join(ANIM_PATH, Path::splitExtension(name).first());
+ const auto path = Path::join(dir, Path::splitExtension(name).first());
auto anim_info = deserialize_anim(path + ".json");
for (anim_group& group : anim_info.groups)
diff --git a/loader/impl.hpp b/loader/impl.hpp
index 04b9733f..6a49269f 100644
--- a/loader/impl.hpp
+++ b/loader/impl.hpp
@@ -29,7 +29,7 @@ struct loader_impl final : loader_
Trade::ImageData2D texture(StringView prefix, StringView filename);
std::shared_ptr<struct tile_atlas> tile_atlas(StringView filename, Vector2ub size) override;
ArrayView<String> anim_atlas_list() override;
- std::shared_ptr<struct anim_atlas> anim_atlas(StringView name) override;
+ std::shared_ptr<struct anim_atlas> anim_atlas(StringView name, StringView dir) override;
void get_anim_atlas_list();
diff --git a/loader/json.cpp b/loader/json.cpp
index 7ee661f7..1a698a38 100644
--- a/loader/json.cpp
+++ b/loader/json.cpp
@@ -23,7 +23,7 @@ std::vector<std::shared_ptr<struct tile_atlas>> loader_::tile_atlases(StringView
std::vector<Serialize::serialized_scenery> loader_::sceneries()
{
- return json_helper::from_json<std::vector<Serialize::serialized_scenery>>(Path::join(ANIM_PATH, "scenery.json"));
+ return json_helper::from_json<std::vector<Serialize::serialized_scenery>>(Path::join(SCENERY_PATH, "scenery.json"));
}
} // namespace floormat
diff --git a/loader/loader.cpp b/loader/loader.cpp
index a2fcd161..a07f96be 100644
--- a/loader/loader.cpp
+++ b/loader/loader.cpp
@@ -24,5 +24,6 @@ loader_::~loader_() = default;
const StringView loader_::IMAGE_PATH = "share/floormat/images/"_s;
const StringView loader_::ANIM_PATH = "share/floormat/anim/"_s;
+const StringView loader_::SCENERY_PATH = "share/floormat/scenery/"_s;
} // namespace floormat
diff --git a/loader/loader.hpp b/loader/loader.hpp
index b8ac12e2..93ac5654 100644
--- a/loader/loader.hpp
+++ b/loader/loader.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <memory>
#include <vector>
+#include <Corrade/Containers/StringView.h>
namespace Magnum { using Vector2ub = Math::Vector2<unsigned char>; }
namespace floormat::Serialize { struct serialized_scenery; }
@@ -16,7 +17,7 @@ struct loader_
virtual StringView shader(StringView filename) = 0;
virtual std::shared_ptr<struct tile_atlas> tile_atlas(StringView filename, Vector2ub size) = 0;
virtual ArrayView<String> anim_atlas_list() = 0;
- virtual std::shared_ptr<struct anim_atlas> anim_atlas(StringView name) = 0;
+ virtual std::shared_ptr<struct anim_atlas> anim_atlas(StringView name, StringView dir = ANIM_PATH) = 0;
static void destroy();
static loader_& default_loader() noexcept;
static std::vector<std::shared_ptr<struct tile_atlas>> tile_atlases(StringView filename);
@@ -29,6 +30,7 @@ struct loader_
static const StringView IMAGE_PATH;
static const StringView ANIM_PATH;
+ static const StringView SCENERY_PATH;
protected:
loader_();
diff --git a/anim/scenery/door-close.json b/scenery/door-close.json
index e0f92396..e0f92396 100644
--- a/anim/scenery/door-close.json
+++ b/scenery/door-close.json
diff --git a/anim/scenery/door-close.tga b/scenery/door-close.tga
index 62aaaa69..62aaaa69 100644
--- a/anim/scenery/door-close.tga
+++ b/scenery/door-close.tga
Binary files differ
diff --git a/anim/scenery/door.blend b/scenery/door.blend
index 5aa0998c..5aa0998c 100644
--- a/anim/scenery/door.blend
+++ b/scenery/door.blend
Binary files differ
diff --git a/anim/scenery.json b/scenery/scenery.json
index 0d4f101c..0d4f101c 100644
--- a/anim/scenery.json
+++ b/scenery/scenery.json
diff --git a/serialize/scenery.cpp b/serialize/scenery.cpp
index 0089e411..e12df693 100644
--- a/serialize/scenery.cpp
+++ b/serialize/scenery.cpp
@@ -3,10 +3,7 @@
#include "compat/assert.hpp"
#include "loader/loader.hpp"
#include "serialize/corrade-string.hpp"
-#include "serialize/json-helper.hpp"
-#include <array>
#include <Corrade/Containers/StringStlView.h>
-#include <Corrade/Utility/Path.h>
#include <nlohmann/json.hpp>
namespace {
@@ -106,7 +103,7 @@ void adl_serializer<scenery_proto>::from_json(const json& j, scenery_proto& val)
StringView atlas_name = j["atlas-name"];
fm_assert(!atlas_name.isEmpty());
- auto atlas = loader.anim_atlas(Path::join("scenery", atlas_name));
+ auto atlas = loader.anim_atlas(atlas_name, loader_::SCENERY_PATH);
auto& f = val.frame;
f = {};