From d0061c0c66133267ed38aec41a97541c047a5c1a Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 16 Dec 2017 17:09:34 +0100 Subject: Add nests (as decorations for now). --- src/game/assets.cpp | 1 + src/game/decos.cpp | 5 +++++ src/game/game.hpp | 5 +++-- src/game/worldgen.cpp | 4 +++- 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/game/assets.cpp b/src/game/assets.cpp index a908962..e5fee38 100644 --- a/src/game/assets.cpp +++ b/src/game/assets.cpp @@ -25,6 +25,7 @@ void load(void) deco.stone.load("assets/deco/stone_", 1); deco.eyething.load("assets/deco/eyething_", 2); + deco.nest.load("assets/deco/nest_", 5); world::register_tile(TILE_DIRT, 0); render::register_tile(TILE_DIRT, "assets/tiles/dirt.png"); diff --git a/src/game/decos.cpp b/src/game/decos.cpp index 63780fa..ae103ef 100644 --- a/src/game/decos.cpp +++ b/src/game/decos.cpp @@ -23,6 +23,11 @@ static const struct { &assets::deco.eyething, {-0.4f, +0.1f}, {+0.4f, +0.4f}, CF_SOLID, {-0.4f, -1.2f}, {+0.4f, +0.4f}, 0.3 + }, + { + &assets::deco.nest, + {-0.6f, +0.2f}, {+0.6f, +0.6f}, CF_SOLID, + {-0.6f, -0.6f}, {+0.6f, +0.6f}, 1.0 } }; diff --git a/src/game/game.hpp b/src/game/game.hpp index e1eca84..4cc1077 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -44,7 +44,7 @@ namespace game { } fx_assets_t; typedef struct { - render::animated_texture_t stone, eyething; + render::animated_texture_t stone, eyething, nest; } deco_assets_t; extern human_assets_t human; @@ -185,7 +185,8 @@ namespace game { typedef enum { DECO_STONE, DECO_STONE_SMALL, - DECO_EYETHING + DECO_EYETHING, + DECO_NEST } deco_type_t; class deco_t : public world::entity_t { diff --git a/src/game/worldgen.cpp b/src/game/worldgen.cpp index 74a07c7..01b05ca 100644 --- a/src/game/worldgen.cpp +++ b/src/game/worldgen.cpp @@ -12,7 +12,9 @@ void add_decoration(world_t *world, state_t *game, v2f_t x, float noise) if (noise < 0.3) return; - if (noise > 0.45) + if (noise > 0.5) + type = DECO_NEST; + else if (noise > 0.40) type = DECO_EYETHING; else if (noise > 0.35) type = DECO_STONE; -- cgit