From 0bc4eaebc6cb4410c5dbf3d89ae02634cfe72e27 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Fri, 20 Apr 2018 13:57:56 +0200 Subject: Add the crystal deco. --- src/game/assets.cpp | 2 ++ src/game/decos.cpp | 15 +++++++++++++++ src/game/game.hpp | 5 ++++- src/game/worldgen.cpp | 8 +++++++- 4 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/game/assets.cpp b/src/game/assets.cpp index 0148e27..d7ba653 100644 --- a/src/game/assets.cpp +++ b/src/game/assets.cpp @@ -100,6 +100,8 @@ void load(void) deco.spike_broken.load("assets/deco/spike_broken_", 1); deco.spike_small.load("assets/deco/spike_small_", 1); deco.wart.load("assets/deco/wart_", 1); + deco.crystal.load("assets/deco/crystal_", 3); + deco.crystal_broken.load("assets/deco/crystal_broken_", 0); unit_selected.load("assets/units/selected_", 1); unit_selected_halo.load("assets/units/selected_halo_", 1); diff --git a/src/game/decos.cpp b/src/game/decos.cpp index 53e9b88..eaa6c6b 100644 --- a/src/game/decos.cpp +++ b/src/game/decos.cpp @@ -70,6 +70,16 @@ static const struct { &assets::deco.wart, {-0.2f, +0.1f}, {+0.2f, +0.2f}, CF_DECOS, {-0.2f, -0.2f}, {+0.2f, +0.2f}, 0.0 + }, + { + &assets::deco.crystal, + {-0.4f, -0.4f}, {+0.4f, +0.4f}, CF_SOLID, + {-0.4f, -0.4f}, {+0.4f, +0.4f}, 0.0 + }, + { + &assets::deco.crystal_broken, + {-0.4f, -0.4f}, {+0.4f, +0.4f}, CF_DECOS, + {-0.4f, -0.4f}, {+0.4f, +0.4f}, 0.0 } }; @@ -105,9 +115,14 @@ void deco_t::damage(int points, unit_t *attacker) type = DECO_SPIKE_BROKEN; break; + case DECO_CRYSTAL: + type = DECO_CRYSTAL_BROKEN; + break; + case DECO_STONE_CRACKED: case DECO_EYETHING_DEAD: case DECO_SPIKE_BROKEN: + case DECO_CRYSTAL_BROKEN: break; default: diff --git a/src/game/game.hpp b/src/game/game.hpp index 1a28413..8d13b17 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -95,6 +95,7 @@ namespace game { render::animated_texture_t eyething, eyething_dead; render::animated_texture_t spike, spike_broken, spike_small; render::animated_texture_t wart; + render::animated_texture_t crystal, crystal_broken; } deco_assets_t; extern soldier_assets_t soldier; @@ -411,7 +412,9 @@ namespace game { DECO_SPIKE, DECO_SPIKE_BROKEN, DECO_SPIKE_SMALL, - DECO_WART + DECO_WART, + DECO_CRYSTAL, + DECO_CRYSTAL_BROKEN } deco_type_t; class deco_t : public game::entity_t { diff --git a/src/game/worldgen.cpp b/src/game/worldgen.cpp index 574d0cd..9d6ccd3 100644 --- a/src/game/worldgen.cpp +++ b/src/game/worldgen.cpp @@ -78,7 +78,11 @@ just_decos: break; case TILE_DIRT: - if (noise > 0.33) + if (noise > 0.37) + type = DECO_CRYSTAL; + else if (noise > 0.36) + type = DECO_CRYSTAL_BROKEN; + else if (noise > 0.33) type = DECO_STONE; else if (noise > 0.26) type = DECO_SPIKE; @@ -92,6 +96,8 @@ just_decos: case TILE_GRAVEL: if (noise > 0.30) + type = DECO_CRYSTAL; + else if (noise > 0.25) type = DECO_STONE; else if (noise > 0.13) type = DECO_STONE_SMALL; -- cgit