Commit is being made to allow additions of GPL3+ code previously un-addable. With these changes, contributions back to cuberite are possible with the backporting exemtion, as well as adding stuff in minetest with minetest code properly being read through and implimented to upgrade it to GPL3 from GPL2. project still has Apache2.0 license and credits to all its contributers, but now has the freedom of GPL3+ and all the code that can be implimented and shared with it.
97 lines
3.0 KiB
C++
97 lines
3.0 KiB
C++
|
|
/*
|
|
* Copyright 2011-2022 Cuberite Contributors
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
// HeightBiomeMap.h
|
|
|
|
// Declares the cHeightBiomeMap class representing a stats module that produces an image of heights and biomes combined
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "ImageComposingCallback.h"
|
|
|
|
|
|
|
|
|
|
|
|
class cHeightBiomeMap :
|
|
public cImageComposingCallback
|
|
{
|
|
typedef cImageComposingCallback super;
|
|
|
|
public:
|
|
// Minima and maxima for the regions processed through this callback
|
|
int m_MinRegionX, m_MaxRegionX;
|
|
int m_MinRegionZ, m_MaxRegionZ;
|
|
|
|
cHeightBiomeMap(void);
|
|
|
|
protected:
|
|
int m_CurrentChunkX; // Absolute chunk coords
|
|
int m_CurrentChunkZ;
|
|
int m_CurrentChunkRelX; // Chunk offset from the start of the region
|
|
int m_CurrentChunkRelZ;
|
|
|
|
/** Biome-map for the current chunk */
|
|
char m_ChunkBiomes[16 * 16];
|
|
/** Height-map for the current chunk */
|
|
int m_ChunkHeight[16 * 16];
|
|
/** Block data for the current chunk (between OnSection() and OnSectionsFinished()) */
|
|
BLOCKTYPE m_BlockTypes [16 * 16 * 256];
|
|
|
|
// cCallback overrides:
|
|
virtual bool OnNewRegion(int a_RegionX, int a_RegionZ) override;
|
|
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 CALLBACK_CONTINUE; }
|
|
virtual bool OnCompressedDataSizePos(int a_CompressedDataSize, int a_DataOffset, char a_CompressionMethod) override { return CALLBACK_CONTINUE; }
|
|
virtual bool OnDecompressedData(const char * a_DecompressedNBT, int a_DataSize) override { return CALLBACK_CONTINUE; }
|
|
virtual bool OnRealCoords(int a_ChunkX, int a_ChunkZ) override { return CALLBACK_CONTINUE; }
|
|
virtual bool OnLastUpdate(Int64 a_LastUpdate) override { return CALLBACK_CONTINUE; }
|
|
virtual bool OnTerrainPopulated(bool a_Populated) override { return a_Populated ? CALLBACK_CONTINUE : CALLBACK_ABORT; } // If not populated, we don't want it!
|
|
virtual bool OnBiomes(const unsigned char * a_BiomeData) override;
|
|
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;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
class cHeightBiomeMapFactory :
|
|
public cCallbackFactory
|
|
{
|
|
public:
|
|
virtual ~cHeightBiomeMapFactory();
|
|
|
|
virtual cCallback * CreateNewCallback(void) override
|
|
{
|
|
return new cHeightBiomeMap;
|
|
}
|
|
} ;
|