summaryrefslogtreecommitdiffhomepage
path: root/src/hole.cpp
blob: 783fa5eeecf3433146a6cb863e48cea2431c30d1 (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
#include "hole.hpp"
#include "chunk.hpp"
#include "tile-constants.hpp"
#include "shaders/shader.hpp"

namespace floormat {
namespace {

} // namespace

hole::hole(object_id id, floormat::chunk& c, const hole_proto& proto):
    object{id, c, proto}
{
}

hole::~hole() noexcept
{
    c->mark_ground_modified();
    c->mark_walls_modified();
    c->mark_passability_modified();
}

void hole::update(const std::shared_ptr<object>& ptr, size_t& i, const Ns& dt)
{
}

hole::operator hole_proto() const
{
    hole_proto ret;
    static_cast<object_proto&>(ret) = object_proto(*this);
    ret.max_distance = max_distance;
    ret.color = color;
    ret.falloff = falloff;
    ret.enabled = enabled;
    return ret;
}

float hole::depth_offset() const
{
    constexpr auto ret = 4 / tile_shader::depth_tile_size;
    return ret;
}

Vector2 hole::ordinal_offset(Vector2b) const
{
    constexpr auto ret = Vector2(TILE_COUNT, TILE_COUNT) * TILE_SIZE2;
    return ret;
}

object_type hole::type() const noexcept { return object_type::hole; }
bool hole::is_virtual() const { return true; }
bool hole::is_dynamic() const { return false; }

} // namespace floormat