summaryrefslogtreecommitdiff
path: root/WorldSegment.cpp
diff options
context:
space:
mode:
authorJonas Ask2009-10-30 16:58:33 +0000
committerJonas Ask2009-10-30 16:58:33 +0000
commite26c9dddec01ccf7ac7b0467407afeaec8aeabe5 (patch)
treef7a890a0e7ea0892a92ad9aff20eab9546c8f1cd /WorldSegment.cpp
parenta17037974d9053650558f86d527720c9e843d283 (diff)
downloadstonesense-e26c9dddec01ccf7ac7b0467407afeaec8aeabe5.tar.gz
stonesense-e26c9dddec01ccf7ac7b0467407afeaec8aeabe5.tar.bz2
stonesense-e26c9dddec01ccf7ac7b0467407afeaec8aeabe5.tar.xz
Reinstated floating buildings. With some cost to rendering
Diffstat (limited to 'WorldSegment.cpp')
-rw-r--r--WorldSegment.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/WorldSegment.cpp b/WorldSegment.cpp
index 6f6e460..3ebe7f9 100644
--- a/WorldSegment.cpp
+++ b/WorldSegment.cpp
@@ -68,21 +68,38 @@ void WorldSegment::addBlock(Block* b){
}*/
}
-
+/*
void WorldSegment::drawAllBlocks(BITMAP* target){
uint32_t numblocks = (uint32_t)this->blocks.size();
for(uint32_t i=0; i < numblocks; i++){
viewedSegment->blocks[i]->Draw(target);
}
-}
+}*/
+void WorldSegment::drawAllBlocks(BITMAP* target){
+ // x,y,z print pricess
+ uint32_t vsxmax = viewedSegment->x + viewedSegment->sizex;
+ uint32_t vsymax = viewedSegment->y + viewedSegment->sizey;
+ uint32_t vszmax = viewedSegment->y + viewedSegment->sizez;
+ for(uint32_t vsx=viewedSegment->x; vsx < vsxmax; vsx++){
+ for(uint32_t vsy=viewedSegment->y; vsy < vsymax; vsy++){
+ for(uint32_t vsz=viewedSegment->z; vsz < vszmax; vsz++){
+ Block *b = getBlock(vsx,vsy,vsz);
+ if (b)
+ {
+ b->Draw(target);
+ }
+ }
+ }
+ }
+}
bool WorldSegment::CoordinateInsideSegment(uint32_t x, uint32_t y, uint32_t z){
/*if( x < 0 || (int32_t)x >= this->regionSize.x) return false;
if( y < 0 || (int32_t)y >= this->regionSize.y) return false;
if( z < 0 || (int32_t)z >= this->regionSize.z) return false;*/
- if( x < this->x || (int32_t)x >= this->x + this->sizex) return false;
- if( y < this->y || (int32_t)y >= this->y + this->sizey) return false;
- if( z < this->z || (int32_t)z >= this->z + this->sizez) return false;
+ if( (int32_t)x < this->x || (int32_t)x >= this->x + this->sizex) return false;
+ if( (int32_t)y < this->y || (int32_t)y >= this->y + this->sizey) return false;
+ if( (int32_t)z < this->z || (int32_t)z >= this->z + this->sizez) return false;
return true;
} \ No newline at end of file