summaryrefslogtreecommitdiffhomepage
path: root/test/critter.cpp
blob: 6eb42315765775511223217307e61f02e7e0b8e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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