diff options
| author | Japa | 2011-02-19 19:11:19 +0000 |
|---|---|---|
| committer | Japa | 2011-02-19 19:11:19 +0000 |
| commit | f1cd36716229dd3f0795824197b14dcd0d979540 (patch) | |
| tree | a9391276cc5f0c569fe531996964a6cb57d2263e /WorldSegment.cpp | |
| parent | d8523cd32f9aea85ce0ef0c6fb12c8562922dad2 (diff) | |
| parent | c2f73a1f356890e8ed6ada37a4613ce4836d4712 (diff) | |
| download | stonesense-f1cd36716229dd3f0795824197b14dcd0d979540.tar.gz stonesense-f1cd36716229dd3f0795824197b14dcd0d979540.tar.bz2 stonesense-f1cd36716229dd3f0795824197b14dcd0d979540.tar.xz | |
merged in the multithreaded branch.
Diffstat (limited to 'WorldSegment.cpp')
| -rw-r--r-- | WorldSegment.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/WorldSegment.cpp b/WorldSegment.cpp index 00c1c06..e9c3a74 100644 --- a/WorldSegment.cpp +++ b/WorldSegment.cpp @@ -26,7 +26,7 @@ Block* WorldSegment::getBlock(int32_t x, int32_t y, int32_t z){ ly -= this->y;
lz -= this->z;
- correctBlockForRotation( (int32_t&)lx,(int32_t&)ly,(int32_t&)lz );
+ correctBlockForRotation( (int32_t&)lx,(int32_t&)ly,(int32_t&)lz , rotation);
uint32_t index = lx + (ly * this->sizex) + ((lz) * this->sizex * this->sizey);
return blocksAsPointerVolume[index];
@@ -41,7 +41,7 @@ Block* WorldSegment::getBlockRelativeTo(uint32_t x, uint32_t y, uint32_t z, dir ly -= this->y;
lz -= this->z;
- correctBlockForRotation( (int32_t&)lx,(int32_t&)ly,(int32_t&)lz );
+ correctBlockForRotation( (int32_t&)lx,(int32_t&)ly,(int32_t&)lz, rotation );
switch (direction){
case eUp:
ly--; break;
@@ -83,7 +83,7 @@ Block* WorldSegment::getBlockRelativeTo(uint32_t x, uint32_t y, uint32_t z, dir ly -= this->y;
lz -= this->z;
- correctBlockForRotation( (int32_t&)lx,(int32_t&)ly,(int32_t&)lz );
+ correctBlockForRotation( (int32_t&)lx,(int32_t&)ly,(int32_t&)lz, rotation);
switch (direction){
case eUp:
ly-= distance; break;
@@ -130,21 +130,21 @@ Block* WorldSegment::getBlock(uint32_t index){ return blocks[index];
}
-void correctBlockForRotation(int32_t& x, int32_t& y, int32_t& z){
+void correctBlockForRotation(int32_t& x, int32_t& y, int32_t& z, unsigned char rot){
int32_t oldx = x;
int32_t oldy = y;
int w = config.segmentSize.x;
int h = config.segmentSize.y;
- if(DisplayedRotation == 1){
+ if(rot == 1){
x = h - oldy -1;
y = oldx;
}
- if(DisplayedRotation == 2){
+ if(rot == 2){
x = w - oldx -1;
y = h - oldy -1;
}
- if(DisplayedRotation == 3){
+ if(rot == 3){
x = oldy;
y = w - oldx -1;
}
@@ -163,7 +163,7 @@ void WorldSegment::addBlock(Block* b){ z -= this->z;
//rotate
- correctBlockForRotation( (int32_t&)x, (int32_t&)y, (int32_t&)z );
+ correctBlockForRotation( (int32_t&)x, (int32_t&)y, (int32_t&)z, rotation);
uint32_t index = x + (y * this->sizex) + ((z) * this->sizex * this->sizey);
//assert( x < sizex && x >=0);
@@ -190,6 +190,8 @@ viewedSegment->blocks[i]->Draw(target); }*/
void WorldSegment::drawAllBlocks(){
+ if(!loaded)
+ return;
// x,y,z print pricess
ALLEGRO_BITMAP * temp = al_get_target_bitmap();
|
