summaryrefslogtreecommitdiffhomepage
path: root/loader
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-11-22 10:04:57 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-11-22 10:04:57 +0100
commit1d8bbb932f0c148f58ecda3ff0d5ab6705fa88c1 (patch)
tree1fde4300004e8de1ff8536f9cfe2defc4c43a999 /loader
parentcf1c5f4dcd59a45b2e03851d2a8e2a640c80d066 (diff)
a
Diffstat (limited to 'loader')
-rw-r--r--loader/atlas.cpp5
-rw-r--r--loader/impl.hpp62
2 files changed, 36 insertions, 31 deletions
diff --git a/loader/atlas.cpp b/loader/atlas.cpp
index d71b85ad..acc1d069 100644
--- a/loader/atlas.cpp
+++ b/loader/atlas.cpp
@@ -18,11 +18,10 @@ namespace floormat {
StringView loader_::make_atlas_path(char(&buf)[FILENAME_MAX], StringView dir, StringView name)
{
fm_soft_assert(!dir || dir[dir.size()-1] == '/');
- auto name_noext = Path::splitExtension(name).first();
- const auto dirsiz = dir.size(), namesiz = name_noext.size();
+ const auto dirsiz = dir.size(), namesiz = name.size();
fm_soft_assert(dirsiz + namesiz + 1 < FILENAME_MAX);
std::memcpy(buf, dir.data(), dirsiz);
- std::memcpy(&buf[dirsiz], name_noext.data(), namesiz);
+ std::memcpy(&buf[dirsiz], name.data(), namesiz);
buf[dirsiz + namesiz] = '\0';
return StringView{buf};
}
diff --git a/loader/impl.hpp b/loader/impl.hpp
index 525a5ecc..4bb21159 100644
--- a/loader/impl.hpp
+++ b/loader/impl.hpp
@@ -19,14 +19,31 @@ namespace floormat::loader_detail {
struct loader_impl final : loader_
{
-// <-----< resources <-----<
- Optional<Utility::Resource> shader_res;
+ explicit loader_impl();
+ ~loader_impl() override;
+
+ // >-----> system >----->
+ String original_working_directory;
+
+ void set_application_working_directory();
+ StringView startup_directory() noexcept override;
+ static void system_init();
+ static bool chdir(StringView pathname);
+
+ // >-----> plugins >----->
Optional<PluginManager::Manager<Trade::AbstractImporter>> importer_plugins;
Containers::Pointer<Trade::AbstractImporter> image_importer;
Containers::Pointer<Trade::AbstractImporter> tga_importer;
-// >-----> resources >----->
-// <-----< walls <-----<
+ void ensure_plugins();
+
+ // >-----> resources >----->
+ Optional<Utility::Resource> shader_res;
+
+ StringView shader(StringView filename) noexcept override;
+ Trade::ImageData2D texture(StringView prefix, StringView filename) noexcept(false) override;
+
+ // >-----> walls >----->
struct wall_index { uint32_t val = (uint32_t)-1; };
tsl::robin_map<StringView, const wall_info*> wall_atlas_map;
std::vector<wall_info> wall_atlas_array;
@@ -35,30 +52,31 @@ struct loader_impl final : loader_
ArrayView<const wall_info> wall_atlas_list() override;
void get_wall_atlas_list();
std::shared_ptr<class wall_atlas> get_wall_atlas(StringView pathname);
-// >-----> walls >----->
+ // >-----> tile >----->
tsl::robin_map<StringView, std::shared_ptr<class tile_atlas>> tile_atlas_map;
+
+ std::shared_ptr<class tile_atlas> tile_atlas(StringView filename, Vector2ub size, Optional<pass_mode> pass) noexcept(false) override;
+ std::shared_ptr<class tile_atlas> tile_atlas(StringView filename) noexcept(false) override;
+
+ // >-----> anim >----->
tsl::robin_map<StringView, std::shared_ptr<class anim_atlas>> anim_atlas_map;
std::vector<String> anim_atlases;
+ ArrayView<const String> anim_atlas_list() override;
+ std::shared_ptr<class anim_atlas> anim_atlas(StringView name, StringView dir) noexcept(false) override;
+ static anim_def deserialize_anim(StringView filename);
+ void get_anim_atlas_list();
+
+ // >-----> scenery >----->
std::vector<serialized_scenery> sceneries_array;
tsl::robin_map<StringView, const serialized_scenery*> sceneries_map;
- String original_working_directory;
-
- StringView shader(StringView filename) noexcept override;
- Trade::ImageData2D texture(StringView prefix, StringView filename) noexcept(false) override;
- std::shared_ptr<class tile_atlas> tile_atlas(StringView filename, Vector2ub size, Optional<pass_mode> pass) noexcept(false) override;
- std::shared_ptr<class tile_atlas> tile_atlas(StringView filename) noexcept(false) override;
- ArrayView<const String> anim_atlas_list() override;
- std::shared_ptr<class anim_atlas> anim_atlas(StringView name, StringView dir) noexcept(false) override;
const std::vector<serialized_scenery>& sceneries() override;
const scenery_proto& scenery(StringView name) noexcept(false) override;
-
- void get_anim_atlas_list();
void get_scenery_list();
-// <-----< vobjs <-----<
+ // >-----> vobjs >----->
tsl::robin_map<StringView, const struct vobj_info*> vobj_atlas_map;
std::vector<struct vobj_info> vobjs;
@@ -66,18 +84,6 @@ struct loader_impl final : loader_
const struct vobj_info& vobj(StringView name) override;
ArrayView<const struct vobj_info> vobj_list() override;
void get_vobj_list();
-// >-----> vobjs >----->
-
- static anim_def deserialize_anim(StringView filename);
-
- void set_application_working_directory();
- StringView startup_directory() noexcept override;
- static void system_init();
- static bool chdir(StringView pathname);
- void ensure_plugins();
-
- explicit loader_impl();
- ~loader_impl() override;
};
} // namespace floormat::loader_detail