diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-02 10:20:40 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-02 10:20:40 +0100 |
commit | 9ff017f1d4c1502fca9797aa4b38351c97e57982 (patch) | |
tree | 5b122d52ddec31c988e23a70531a968466e73bf6 /test | |
parent | 58d95d559276b556f584411d5c3ea0a986f3fbc4 (diff) |
a
Diffstat (limited to 'test')
-rw-r--r-- | test/app.cpp | 3 | ||||
-rw-r--r-- | test/app.hpp | 1 | ||||
-rw-r--r-- | test/critter.cpp | 55 |
3 files changed, 58 insertions, 1 deletions
diff --git a/test/app.cpp b/test/app.cpp index 4677de39..8bccfbbd 100644 --- a/test/app.cpp +++ b/test/app.cpp @@ -51,6 +51,7 @@ int test_app::exec() FM_TEST(test_entity), FM_TEST(test_iptr), FM_TEST(test_hash), + FM_TEST(test_critter), FM_TEST(test_raycast), FM_TEST(test_json), FM_TEST(test_time), @@ -111,7 +112,7 @@ int test_app::exec() fm_assert(num_tabs <= tab_limit); for (auto i = 0uz; i < num_tabs; i++) std::fputc('\t', s); - std::fprintf(s, "% 12.3f ms\n", (double)ms); + std::fprintf(s, "%12.3f ms\n", (double)ms); std::fflush(s); } } diff --git a/test/app.hpp b/test/app.hpp index d100ab13..e7db04cb 100644 --- a/test/app.hpp +++ b/test/app.hpp @@ -25,6 +25,7 @@ struct test_app final : private FM_APPLICATION static void test_astar_pool(); static void test_bitmask(); static void test_coords(); + static void test_critter(); static void test_dijkstra(); static void test_entity(); static void test_hash(); diff --git a/test/critter.cpp b/test/critter.cpp new file mode 100644 index 00000000..6eb42315 --- /dev/null +++ b/test/critter.cpp @@ -0,0 +1,55 @@ +#include "app.hpp" +#include "compat/shared-ptr-wrapper.hpp" +#include "src/critter.hpp" +#include "src/world.hpp" +#include "src/wall-atlas.hpp" +#include "loader/loader.hpp" + +namespace floormat { + +namespace { + +/* ***** TEST 1 ***** + * + * wall n 0x0 - 8:9 + * wall n 0x1 - 8:0 + * + * npc speed=5 bbox-offset=0 bbox-size=32x32 + * + * before chunk=0x0 tile=8:15 offset=-8:8 + * after chunk=0x0 tile=8:9 offset=-8:-16 +*/ + +template<typename F> void test1(F&& make_dt) +{ + const auto W = wall_image_proto{ loader.wall_atlas("empty"), 0 }; + + auto w = world(); + w[{{0,0,0}, {8,9}}].t.wall_north() = W; + w[{{0,1,0}, {8,0}}].t.wall_north() = W; + + critter_proto cproto; + cproto.name = "Player"_s; + cproto.speed = 10; + cproto.playable = true; + + object_id id = 0; + w.ensure_player_character(id, move(cproto)); + + w[chunk_coords_{0,0,0}].mark_modified(); + w[chunk_coords_{0,1,0}].mark_modified(); +} + +template<typename F> void test2(F&& make_dt) +{ + // TODO diagonal! +} + +} // namespace + +void test_app::test_critter() +{ + +} + +} // namespace floormat |