summaryrefslogtreecommitdiff
path: root/SpriteObjects.cpp
diff options
context:
space:
mode:
authorJapa2011-02-26 18:17:58 +0000
committerJapa2011-02-26 18:17:58 +0000
commit58daeeda7db523124663c6ecd0d74e216fa73ed4 (patch)
treefa1811780fcde4617de779220a09a4559ef7d632 /SpriteObjects.cpp
parenta09db4ce3b65f033257ed8b2c819358d7e7f9e28 (diff)
downloadstonesense-58daeeda7db523124663c6ecd0d74e216fa73ed4.tar.gz
stonesense-58daeeda7db523124663c6ecd0d74e216fa73ed4.tar.bz2
stonesense-58daeeda7db523124663c6ecd0d74e216fa73ed4.tar.xz
Added in support for dry and dead grass.
Diffstat (limited to 'SpriteObjects.cpp')
-rw-r--r--SpriteObjects.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/SpriteObjects.cpp b/SpriteObjects.cpp
index 7b75f4d..58b139f 100644
--- a/SpriteObjects.cpp
+++ b/SpriteObjects.cpp
@@ -162,6 +162,7 @@ void c_sprite::reset(void)
grassmin = 0;
grassmax = -1;
grasstype = -1;
+ grass_growth = GRASS_GROWTH_ANY;
needoutline=0;
defaultsheet=IMGObjectSheet;
tilelayout=BLOCKTILE;
@@ -368,6 +369,29 @@ void c_sprite::set_by_xml(TiXmlElement *elemSprite)
isoutline = OUTLINEBOTTOM;
}
+ //Grass states
+ const char* grass_growth_string = elemSprite->Attribute("grass_state");
+ if (grass_growth_string == NULL || grass_growth_string[0] == 0)
+ {
+ grass_growth = GRASS_GROWTH_ANY;
+ }
+ else if( strcmp(grass_growth_string, "any") == 0)
+ {
+ grass_growth = GRASS_GROWTH_ANY;
+ }
+ else if( strcmp(grass_growth_string, "green") == 0)
+ {
+ grass_growth = GRASS_GROWTH_NORMAL;
+ }
+ else if( strcmp(grass_growth_string, "dry") == 0)
+ {
+ grass_growth = GRASS_GROWTH_DRY;
+ }
+ else if( strcmp(grass_growth_string, "dead") == 0)
+ {
+ grass_growth = GRASS_GROWTH_DEAD;
+ }
+
//do bodyparts
const char* bodyPartStr = elemSprite->Attribute("bodypart");
//clear old bodypart string
@@ -582,7 +606,22 @@ void c_sprite::draw_world_offset(int x, int y, int z, Block * b, int tileoffset,
(mudmin <= b->mudlevel && (mudmax == -1 || mudmax >= b->mudlevel)) &&
(grassmin <= b->grasslevel && (grassmax == -1 || grassmax >= b->grasslevel)) &&
((light==LIGHTANY) || ((light==LIGHTYES) && b->designation.bits.skyview) || ((light==LIGHTNO) && !(b->designation.bits.skyview))) &&//only bother with this tile if it's in the light, or not.
- ((grasstype == -1) || (grasstype == b->grassmat))
+ ((grasstype == -1) || (grasstype == b->grassmat)) &&
+ (
+ (grass_growth == GRASS_GROWTH_ANY) ||
+ (
+ (grass_growth == GRASS_GROWTH_NORMAL) &&
+ ((tileTypeTable[b->tileType].m == GRASS) || (tileTypeTable[b->tileType].m == GRASS2))
+ ) ||
+ (
+ (grass_growth == GRASS_GROWTH_DRY) &&
+ (tileTypeTable[b->tileType].m == GRASS_DRY)
+ ) ||
+ (
+ (grass_growth == GRASS_GROWTH_DEAD) &&
+ (tileTypeTable[b->tileType].m == GRASS_DEAD)
+ )
+ )
)
{
int32_t drawx = x;