summaryrefslogtreecommitdiff
path: root/Block.cpp
diff options
context:
space:
mode:
authorJapa2011-08-21 15:08:04 +0000
committerJapa2011-08-21 15:08:04 +0000
commit5b813e32b57ea085c0eb04b1b5f528b3698a167d (patch)
treef379955486124c7f2674c8e4db220ab2baa6dc76 /Block.cpp
parent6f96b930653206ca09fa79985126921cfe8fb03f (diff)
downloadstonesense-5b813e32b57ea085c0eb04b1b5f528b3698a167d.tar.gz
stonesense-5b813e32b57ea085c0eb04b1b5f528b3698a167d.tar.bz2
stonesense-5b813e32b57ea085c0eb04b1b5f528b3698a167d.tar.xz
Diffstat (limited to 'Block.cpp')
-rw-r--r--Block.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/Block.cpp b/Block.cpp
index 8a3d24e..7de4bc3 100644
--- a/Block.cpp
+++ b/Block.cpp
@@ -54,6 +54,7 @@ Block::Block(WorldSegment* ownerSegment)
lightborders = 255;
creature = 0;
engraving_character = 0;
+ visible = true;
}
@@ -94,7 +95,10 @@ inline ALLEGRO_BITMAP* imageSheet(t_subSprite sprite, ALLEGRO_BITMAP* defaultBmp
}
}
-void Block::Draw(){
+void Block::Draw()
+{
+ if(!visible)
+ return;
if((material.type == INORGANIC) && (material.index == -1))
{
material.index = 0;
@@ -115,21 +119,20 @@ void Block::Draw(){
if(x == ownerSegment->x || x == ownerSegment->x + ownerSegment->sizex - 1) return;
if(y == ownerSegment->y || y == ownerSegment->y + ownerSegment->sizey - 1) return;
}*/
- int32_t drawx = x;
- int32_t drawy = y;
- int32_t drawz = z; //- ownerSegment->sizez + 1;
+
+ drawx = x;
+ drawy = y;
+ drawz = z; //- ownerSegment->sizez + 1;
correctBlockForSegmetOffset( drawx, drawy, drawz);
correctBlockForRotation( drawx, drawy, drawz, ownerSegment->rotation);
- int32_t viewx = drawx;
- int32_t viewy = drawy;
- int32_t viewz = drawz;
pointToScreen((int*)&drawx, (int*)&drawy, drawz);
drawx -= TILEWIDTH>>1;
if(((drawx + TILEWIDTH) < 0) || (drawx > al_get_bitmap_width(al_get_target_bitmap())) || ((drawy + TILEHEIGHT + WALLHEIGHT + FLOORHEIGHT) < 0) || (drawy > al_get_bitmap_height(al_get_target_bitmap())))
- return;
+ visible = false;
+ else visible = true;
bool chopThisBlock = 0;
@@ -483,7 +486,10 @@ void Block::Drawcreaturetext(){
}
-void Block::DrawRamptops(){
+void Block::DrawRamptops()
+{
+ if(!visible)
+ return;
if (ramp.type > 0)
{