From 1d8bbb932f0c148f58ecda3ff0d5ab6705fa88c1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 22 Nov 2023 10:04:57 +0100 Subject: a --- loader/atlas.cpp | 5 ++--- loader/impl.hpp | 62 +++++++++++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 31 deletions(-) (limited to 'loader') 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 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> importer_plugins; Containers::Pointer image_importer; Containers::Pointer tga_importer; -// >-----> resources >-----> -// <-----< walls <-----< + void ensure_plugins(); + + // >-----> resources >-----> + Optional 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 wall_atlas_map; std::vector wall_atlas_array; @@ -35,30 +52,31 @@ struct loader_impl final : loader_ ArrayView wall_atlas_list() override; void get_wall_atlas_list(); std::shared_ptr get_wall_atlas(StringView pathname); -// >-----> walls >-----> + // >-----> tile >-----> tsl::robin_map> tile_atlas_map; + + std::shared_ptr tile_atlas(StringView filename, Vector2ub size, Optional pass) noexcept(false) override; + std::shared_ptr tile_atlas(StringView filename) noexcept(false) override; + + // >-----> anim >-----> tsl::robin_map> anim_atlas_map; std::vector anim_atlases; + ArrayView anim_atlas_list() override; + std::shared_ptr anim_atlas(StringView name, StringView dir) noexcept(false) override; + static anim_def deserialize_anim(StringView filename); + void get_anim_atlas_list(); + + // >-----> scenery >-----> std::vector sceneries_array; tsl::robin_map 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 tile_atlas(StringView filename, Vector2ub size, Optional pass) noexcept(false) override; - std::shared_ptr tile_atlas(StringView filename) noexcept(false) override; - ArrayView anim_atlas_list() override; - std::shared_ptr anim_atlas(StringView name, StringView dir) noexcept(false) override; const std::vector& 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 vobj_atlas_map; std::vector vobjs; @@ -66,18 +84,6 @@ struct loader_impl final : loader_ const struct vobj_info& vobj(StringView name) override; ArrayView 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 -- cgit v1.2.3