summaryrefslogtreecommitdiffstats
path: root/Tools/AnvilStats/HeightMap.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-06 21:56:03 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-06 21:56:03 +0200
commit8f18510dec4eab5f00e0ff311cf31ae2ce4f2d4d (patch)
tree786de8ccf882511206a8113eb3cad5b7e19a80b3 /Tools/AnvilStats/HeightMap.h
parentProtoProxy: moved into the Tools folder (diff)
downloadcuberite-8f18510dec4eab5f00e0ff311cf31ae2ce4f2d4d.tar
cuberite-8f18510dec4eab5f00e0ff311cf31ae2ce4f2d4d.tar.gz
cuberite-8f18510dec4eab5f00e0ff311cf31ae2ce4f2d4d.tar.bz2
cuberite-8f18510dec4eab5f00e0ff311cf31ae2ce4f2d4d.tar.lz
cuberite-8f18510dec4eab5f00e0ff311cf31ae2ce4f2d4d.tar.xz
cuberite-8f18510dec4eab5f00e0ff311cf31ae2ce4f2d4d.tar.zst
cuberite-8f18510dec4eab5f00e0ff311cf31ae2ce4f2d4d.zip
Diffstat (limited to 'Tools/AnvilStats/HeightMap.h')
-rw-r--r--Tools/AnvilStats/HeightMap.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/Tools/AnvilStats/HeightMap.h b/Tools/AnvilStats/HeightMap.h
new file mode 100644
index 000000000..4f9e702d5
--- /dev/null
+++ b/Tools/AnvilStats/HeightMap.h
@@ -0,0 +1,81 @@
+
+// HeightMap.h
+
+// Declares the cHeightMap class representing a cCallback descendant that draws a B&W map of heights for the world
+
+
+
+
+
+#pragma once
+
+#include "Callback.h"
+
+
+
+
+
+class cHeightMap :
+ public cCallback
+{
+public:
+ cHeightMap(void);
+
+ void Finish(void);
+
+protected:
+ int m_CurrentChunkX; // Absolute chunk coords
+ int m_CurrentChunkZ;
+ int m_CurrentChunkOffX; // Chunk offset from the start of the region
+ int m_CurrentChunkOffZ;
+ int m_CurrentRegionX;
+ int m_CurrentRegionZ;
+ bool m_IsCurrentRegionValid;
+ int m_Height[16 * 32 * 16 * 32]; ///< Height-map of the entire current region [x + 16 * 32 * z]
+ BLOCKTYPE m_BlockTypes[16 * 16 * 256]; ///< Block data of the currently processed chunk (between OnSection() and OnSectionsFinished() )
+
+ // cCallback overrides:
+ virtual bool OnNewChunk(int a_ChunkX, int a_ChunkZ) override;
+ virtual bool OnHeader(int a_FileOffset, unsigned char a_NumSectors, int a_Timestamp) override { return false; }
+ virtual bool OnCompressedDataSizePos(int a_CompressedDataSize, int a_DataOffset, char a_CompressionMethod) override { return false; }
+ virtual bool OnDecompressedData(const char * a_DecompressedNBT, int a_DataSize) override { return false; }
+ virtual bool OnRealCoords(int a_ChunkX, int a_ChunkZ) override { return false; }
+ virtual bool OnLastUpdate(Int64 a_LastUpdate) override { return false; }
+ virtual bool OnTerrainPopulated(bool a_Populated) override { return !a_Populated; } // If not populated, we don't want it!
+ virtual bool OnBiomes(const unsigned char * a_BiomeData) { return false; }
+ virtual bool OnHeightMap(const int * a_HeightMapBE) override;
+ virtual bool OnSection(
+ unsigned char a_Y,
+ const BLOCKTYPE * a_BlockTypes,
+ const NIBBLETYPE * a_BlockAdditional,
+ const NIBBLETYPE * a_BlockMeta,
+ const NIBBLETYPE * a_BlockLight,
+ const NIBBLETYPE * a_BlockSkyLight
+ ) override;
+ virtual bool OnSectionsFinished(void) override;
+
+ void StartNewRegion(int a_RegionX, int a_RegionZ);
+
+ static bool IsGround(BLOCKTYPE a_BlockType);
+} ;
+
+
+
+
+
+class cHeightMapFactory :
+ public cCallbackFactory
+{
+public:
+ virtual ~cHeightMapFactory();
+
+ virtual cCallback * CreateNewCallback(void) override
+ {
+ return new cHeightMap;
+ }
+
+} ;
+
+
+
+