From 2386d7954154d48d0c8b66d7e8f77f56319e26e8 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 14 Mar 2012 21:45:04 +0000 Subject: Anvil support: Added a debugging section for inverting terrain (So that MC cave generator can be seen in action). Commented out, so that it doesn't make it into the release versions git-svn-id: http://mc-server.googlecode.com/svn/trunk@414 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/WSSAnvil.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/WSSAnvil.cpp b/source/WSSAnvil.cpp index ddb9a6be6..0a13ea899 100644 --- a/source/WSSAnvil.cpp +++ b/source/WSSAnvil.cpp @@ -258,6 +258,30 @@ bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, cNBTTag & a_NBT) BLOCKTYPE * ChunkData = BlockData; #endif // else AXIS_ORDER_YZX + //* + // Delete the comment above for really cool stuff :) + // DEBUG magic: Invert the underground, so that we can see the MC generator in action :) + bool ShouldInvert[cChunkDef::Width * cChunkDef::Width]; + memset(ShouldInvert, 0, sizeof(ShouldInvert)); + for (int y = cChunkDef::Height - 1; y >= 0; y--) + { + for (int x = 0; x < cChunkDef::Width; x++) for (int z = 0; z < cChunkDef::Width; z++) + { + int Index = cChunkDef::MakeIndexNoCheck(x, y, z); + if (ShouldInvert[x + cChunkDef::Width * z]) + { + ChunkData[Index] = (ChunkData[Index] == E_BLOCK_AIR) ? E_BLOCK_STONE : E_BLOCK_AIR; + } + else + { + ShouldInvert[x + cChunkDef::Width * z] = (ChunkData[Index] != E_BLOCK_AIR); + } + } + } // for y + // Set everything alight, so that we can see: + memset(ChunkData + cChunkDef::SkyLightOffset, 0xff, cChunkDef::NumBlocks / 2); + //*/ + m_World->ChunkDataLoaded( a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ, ChunkData, -- cgit v1.2.3