diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-12-16 19:34:01 +0100 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-12-16 19:34:01 +0100 |
commit | ec38926a517e9c1cfab41cf9da1e334688d006a5 (patch) | |
tree | 5e7a61efd3708bbe57bb3d5d17e0e3559d1df876 /src/game/decos.cpp | |
parent | da4e3c6509fa6e00f5bbcb3a34607dd966650d1a (diff) |
Start refactoring decos.
Diffstat (limited to 'src/game/decos.cpp')
-rw-r--r-- | src/game/decos.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/game/decos.cpp b/src/game/decos.cpp index ae103ef..7f81bbb 100644 --- a/src/game/decos.cpp +++ b/src/game/decos.cpp @@ -31,27 +31,17 @@ static const struct { } }; -deco_t::deco_t(game::state_t *game_, deco_type_t type_) : entity_t(ET_DECO) +deco_t::deco_t(game::state_t *game_, deco_type_t type_) : game::entity_t(game_, ET_DECO) { - game = game_; type = type_; -} - -void deco_t::spawn(world::world_t *world, v2f_t x) -{ - v2f_t center, offset; - offset[0] = world->perlin.get(x, 0.17331f); - offset[1] = world->perlin.get(x, 0.19571f); - center = x + v2f_t(0.5f, 0.5f) + offset.norm() * 0.1; - - cmodel.bounds[0] = center + decos[type].mins; - cmodel.bounds[1] = center + decos[type].maxs; + size[0] = decos[type].mins; + size[1] = decos[type].maxs; + render_size[0] = decos[type].render_mins; + render_size[1] = decos[type].render_maxs; cmodel.cflags = decos[type].cflags; - render_bounds[0] = center + decos[type].render_mins; - render_bounds[1] = center + decos[type].render_maxs; - link(world); } + void deco_t::render_to(render::state_t *render) { render->render(game->now * decos[type].fps + phase_shift, |