summaryrefslogtreecommitdiff
path: root/SpriteObjects.cpp
diff options
context:
space:
mode:
authorJapa2011-02-18 09:17:32 +0000
committerJapa2011-02-18 09:17:32 +0000
commitfcb4aa62ec08a1639cb396a88a81262ad40aee65 (patch)
treead8f944453e914ff8d967ab76bf447a856eab9c4 /SpriteObjects.cpp
parent4757c2d4e449be85400fbccc53ec1391c84f8673 (diff)
downloadstonesense-fcb4aa62ec08a1639cb396a88a81262ad40aee65.tar.gz
stonesense-fcb4aa62ec08a1639cb396a88a81262ad40aee65.tar.bz2
stonesense-fcb4aa62ec08a1639cb396a88a81262ad40aee65.tar.xz
more work on grass
Diffstat (limited to 'SpriteObjects.cpp')
-rw-r--r--SpriteObjects.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/SpriteObjects.cpp b/SpriteObjects.cpp
index 43b34aa..ac3f3c5 100644
--- a/SpriteObjects.cpp
+++ b/SpriteObjects.cpp
@@ -161,6 +161,7 @@ void c_sprite::reset(void)
mudmax = -1;
grassmin = 0;
grassmax = -1;
+ grasstype = -1;
needoutline=0;
defaultsheet=IMGObjectSheet;
tilelayout=BLOCKTILE;
@@ -433,6 +434,14 @@ void c_sprite::set_by_xml(TiXmlElement *elemSprite)
}
else grassmax=atoi(spriteGrassMaxStr);
+ //does the sprite match a particular grass type?
+ const char* idstr = elemSprite->Attribute("grass_type");
+ int grasstype = INVALID_INDEX;
+ if (idstr && idstr[0])
+ {
+ grasstype = lookupIndexedType(idstr,contentLoader.organic);
+ }
+
//Should the sprite be shown only when there is blood?
const char* spritebloodMinStr = elemSprite->Attribute("blood_min");
if (spritebloodMinStr == NULL || spritebloodMinStr[0] == 0)
@@ -572,7 +581,8 @@ void c_sprite::draw_world_offset(int x, int y, int z, int tileoffset, bool chop)
(bloodmin <= b->bloodlevel && (bloodmax == -1 || bloodmax >= b->bloodlevel)) &&
(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.
+ ((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))
)
{
int32_t drawx = x;