diff options
| author | Japa | 2011-02-27 18:25:16 +0000 |
|---|---|---|
| committer | Japa | 2011-02-27 18:25:16 +0000 |
| commit | c7054ff4be0177fd32bd5283055463b6b800ef9c (patch) | |
| tree | 00b7ed07e00a2aedc4100973f5aacbf5832290b9 /BlockTree.cpp | |
| parent | 663aa547439c9c2dc977bb3601d91f11e176b83a (diff) | |
| download | stonesense-c7054ff4be0177fd32bd5283055463b6b800ef9c.tar.gz stonesense-c7054ff4be0177fd32bd5283055463b6b800ef9c.tar.bz2 stonesense-c7054ff4be0177fd32bd5283055463b6b800ef9c.tar.xz | |
Made the tops of the trees not get shaded when the bottoms aren't.
Diffstat (limited to 'BlockTree.cpp')
| -rw-r--r-- | BlockTree.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/BlockTree.cpp b/BlockTree.cpp index fd331ea..59704c5 100644 --- a/BlockTree.cpp +++ b/BlockTree.cpp @@ -10,7 +10,7 @@ c_block_tree_twig::~c_block_tree_twig() {
}
-void c_block_tree_twig::insert_sprites(WorldSegment *w, int x, int y, int z)
+void c_block_tree_twig::insert_sprites(WorldSegment *w, int x, int y, int z, Block * parent)
{
if(w->CoordinateInsideSegment(x,y,z))
if(own_sprite.get_sheetindex() >= 0)
@@ -26,6 +26,7 @@ void c_block_tree_twig::insert_sprites(WorldSegment *w, int x, int y, int z) }
b_orig->building.sprites.push_back(own_sprite);
b_orig->building.info.type = BUILDINGTYPE_TREE;
+ b_orig->building.parent = parent;
}
for(int i = 0; i < eastward_growth.size(); i++)
{
@@ -49,6 +50,7 @@ void c_block_tree_twig::insert_sprites(WorldSegment *w, int x, int y, int z) }
b_orig->building.sprites.push_back(eastward_growth[i]);
b_orig->building.info.type = BUILDINGTYPE_TREE;
+ b_orig->building.parent = parent;
}
}
for(int i = 0; i < westward_growth.size(); i++)
@@ -73,6 +75,7 @@ void c_block_tree_twig::insert_sprites(WorldSegment *w, int x, int y, int z) }
b_orig->building.sprites.push_back(westward_growth[i]);
b_orig->building.info.type = BUILDINGTYPE_TREE;
+ b_orig->building.parent = parent;
}
}
}
@@ -146,22 +149,22 @@ void c_block_tree_branch::add_sprite(int x, int y, c_sprite sprite) }
}
-void c_block_tree_branch::insert_sprites(WorldSegment *w, int x, int y, int z)
+void c_block_tree_branch::insert_sprites(WorldSegment *w, int x, int y, int z, Block * parent)
{
- own_twig.insert_sprites(w, x, y, z);
+ own_twig.insert_sprites(w, x, y, z, parent);
for(int i = 0; i < northward_growth.size(); i++)
{
Block * b = w->getBlock(x, y + i + 1, z);
if(b && (b->wallType || b->stairType))
break;
- northward_growth[i].insert_sprites(w, x, y + i + 1, z);
+ northward_growth[i].insert_sprites(w, x, y + i + 1, z, parent);
}
for(int i = 0; i < southward_growth.size(); i++)
{
Block * b = w->getBlock(x, y - i - 1, z);
if(b && (b->wallType || b->stairType))
break;
- southward_growth[i].insert_sprites(w, x, y - i - 1, z);
+ southward_growth[i].insert_sprites(w, x, y - i - 1, z, parent);
}
}
@@ -200,15 +203,15 @@ void c_block_tree::add_sprite(int x, int y, int z, c_sprite sprite) }
}
-void c_block_tree::insert_sprites(WorldSegment *w, int x, int y, int z)
+void c_block_tree::insert_sprites(WorldSegment *w, int x, int y, int z, Block * parent)
{
- own_branch.insert_sprites(w, x, y, z);
+ own_branch.insert_sprites(w, x, y, z, parent);
for(int i = 0; i < upward_growth.size(); i++)
{
Block * b = w->getBlock(x, y, z + i + 1);
if((b && (b->floorType || b->wallType || b->stairType)) || ((z + i + 1) > w->z + w->sizez))
break;
- upward_growth[i].insert_sprites(w, x, y, z + i + 1);
+ upward_growth[i].insert_sprites(w, x, y, z + i + 1, parent);
}
}
|
