diff options
| author | Japa | 2011-02-18 05:30:00 +0000 |
|---|---|---|
| committer | Japa | 2011-02-18 05:30:00 +0000 |
| commit | 4757c2d4e449be85400fbccc53ec1391c84f8673 (patch) | |
| tree | e617912c61934017edc9c74d0321f6a240511ad9 /SpriteObjects.cpp | |
| parent | f67f437e90145b94ebd016c3b4c41f9ee5e7cdc3 (diff) | |
| download | stonesense-4757c2d4e449be85400fbccc53ec1391c84f8673.tar.gz stonesense-4757c2d4e449be85400fbccc53ec1391c84f8673.tar.bz2 stonesense-4757c2d4e449be85400fbccc53ec1391c84f8673.tar.xz | |
Got preliminary grass working.
Diffstat (limited to 'SpriteObjects.cpp')
| -rw-r--r-- | SpriteObjects.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/SpriteObjects.cpp b/SpriteObjects.cpp index de6aeed..43b34aa 100644 --- a/SpriteObjects.cpp +++ b/SpriteObjects.cpp @@ -159,6 +159,8 @@ void c_sprite::reset(void) bloodmax = -1;
mudmin = 0;
mudmax = -1;
+ grassmin = 0;
+ grassmax = -1;
needoutline=0;
defaultsheet=IMGObjectSheet;
tilelayout=BLOCKTILE;
@@ -417,6 +419,20 @@ void c_sprite::set_by_xml(TiXmlElement *elemSprite) }
else snowmax=atoi(spriteSnowMaxStr);
+ //Should the sprite be shown only when there is grass?
+ const char* spriteGrassMinStr = elemSprite->Attribute("grass_min");
+ if (spriteGrassMinStr == NULL || spriteGrassMinStr[0] == 0)
+ {
+ grassmin = 0;
+ }
+ else grassmin=atoi(spriteGrassMinStr);
+ const char* spriteGrassMaxStr = elemSprite->Attribute("grass_max");
+ if (spriteGrassMaxStr == NULL || spriteGrassMaxStr[0] == 0)
+ {
+ grassmax = -1;
+ }
+ else grassmax=atoi(spriteGrassMaxStr);
+
//Should the sprite be shown only when there is blood?
const char* spritebloodMinStr = elemSprite->Attribute("blood_min");
if (spritebloodMinStr == NULL || spritebloodMinStr[0] == 0)
@@ -555,6 +571,7 @@ void c_sprite::draw_world_offset(int x, int y, int z, int tileoffset, bool chop) (snowmax == -1 || snowmax >= b->snowlevel)) &&
(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.
)
{
|
