diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-16 07:59:59 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-16 07:59:59 +0100 |
| commit | 07716595e0c26ba6d19ee6c498280508ca5aa6c2 (patch) | |
| tree | da22b4d88e63419a366c48037cbef14f8f43a2b4 /loader | |
| parent | ae53b814c310d1996db0b818151ef7b205d03b7b (diff) | |
a
Diffstat (limited to 'loader')
| -rw-r--r-- | loader/atlas.cpp | 4 | ||||
| -rw-r--r-- | loader/vobj.cpp | 20 |
2 files changed, 15 insertions, 9 deletions
diff --git a/loader/atlas.cpp b/loader/atlas.cpp index f61502fe..100f638e 100644 --- a/loader/atlas.cpp +++ b/loader/atlas.cpp @@ -75,7 +75,7 @@ std::shared_ptr<anim_atlas> loader_impl::anim_atlas(StringView name, StringView [&](const anim_group& x) { return x.name == group.mirror_from; }); if (it == anim_info.groups.cend()) fm_throw("can't find group '{}' to mirror from '{}'"_cf, group.mirror_from, group.name); - group.frames = it->frames; + group.frames = array(arrayView(it->frames)); for (anim_frame& f : group.frames) f.ground = Vector2i((Int)f.size[0] - f.ground[0], f.ground[1]); } @@ -85,7 +85,7 @@ std::shared_ptr<anim_atlas> loader_impl::anim_atlas(StringView name, StringView fm_soft_assert(!anim_info.object_name.isEmpty()); fm_soft_assert(anim_info.pixel_size.product() > 0); - fm_soft_assert(!anim_info.groups.empty()); + fm_soft_assert(!anim_info.groups.isEmpty()); fm_soft_assert(anim_info.nframes > 0); fm_soft_assert(anim_info.nframes == 1 || anim_info.fps > 0); const auto size = tex.pixels().size(); diff --git a/loader/vobj.cpp b/loader/vobj.cpp index 637ba776..5f7fc2fe 100644 --- a/loader/vobj.cpp +++ b/loader/vobj.cpp @@ -57,13 +57,19 @@ std::shared_ptr<class anim_atlas> loader_impl::make_vobj_anim_atlas(StringView n def.pixel_size = { width, height }; def.nframes = 1; def.fps = 0; - def.groups = {{ - .name = "n"_s, - .frames = {{ - .ground = Vector2i(def.pixel_size/2), - .size = def.pixel_size - }} - }}; + { + auto group = anim_group { + .name = "n"_s, + .frames = { InPlaceInit, { + anim_frame { + .ground = Vector2i(def.pixel_size/2), + .size = def.pixel_size, + }}, + }, + }; + def.groups = Array<anim_group>{1}; + def.groups[0] = std::move(group); + } auto atlas = std::make_shared<class anim_atlas>(name, tex, std::move(def)); return atlas; } |
