2014-03-01 15:04:17 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-01 19:34:19 +00:00
|
|
|
class cBlockInfo
|
2014-03-01 15:04:17 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2014-03-01 19:34:19 +00:00
|
|
|
cBlockInfo();
|
2014-03-01 15:04:17 +00:00
|
|
|
|
|
|
|
/** (Re-)Initializes the internal BlockInfo structures. */
|
|
|
|
static void Initialize(void);
|
|
|
|
|
|
|
|
/** Returns the associated BlockInfo structure. */
|
2014-03-01 19:34:19 +00:00
|
|
|
static cBlockInfo & GetById(unsigned int a_ID);
|
2014-03-01 15:04:17 +00:00
|
|
|
|
2014-03-01 19:34:19 +00:00
|
|
|
|
|
|
|
/** How much light do the blocks emit on their own? */
|
2014-03-01 15:04:17 +00:00
|
|
|
NIBBLETYPE m_LightValue;
|
2014-03-01 19:34:19 +00:00
|
|
|
|
|
|
|
/** How much light do the blocks consume? */
|
2014-03-01 15:04:17 +00:00
|
|
|
NIBBLETYPE m_SpreadLightFalloff;
|
|
|
|
|
2014-03-01 19:34:19 +00:00
|
|
|
/** Is a block completely transparent? (light doesn't get decreased(?)) */
|
2014-03-01 15:04:17 +00:00
|
|
|
bool m_Transparent;
|
2014-03-01 19:34:19 +00:00
|
|
|
|
|
|
|
/** Is a block destroyed after a single hit? */
|
2014-03-01 15:04:17 +00:00
|
|
|
bool m_OneHitDig;
|
2014-03-01 19:34:19 +00:00
|
|
|
|
|
|
|
/** Can a piston break this block? */
|
2014-03-01 15:04:17 +00:00
|
|
|
bool m_PistonBreakable;
|
2014-03-01 19:34:19 +00:00
|
|
|
|
|
|
|
/** Can this block hold snow atop? */
|
2014-03-01 15:04:17 +00:00
|
|
|
bool m_IsSnowable;
|
2014-03-01 19:34:19 +00:00
|
|
|
|
|
|
|
/** Does this block require a tool to drop? */
|
2014-03-01 15:04:17 +00:00
|
|
|
bool m_RequiresSpecialTool;
|
2014-03-01 19:34:19 +00:00
|
|
|
|
|
|
|
/** Is this block solid (player cannot walk through)? */
|
2014-03-01 15:04:17 +00:00
|
|
|
bool m_IsSolid;
|
2014-03-01 19:34:19 +00:00
|
|
|
|
|
|
|
/** Does this block fully occupy it's voxel - is it a 'full' block? */
|
2014-03-01 15:04:17 +00:00
|
|
|
bool m_FullyOccupiesVoxel;
|
|
|
|
|
|
|
|
|
|
|
|
inline static NIBBLETYPE GetLightValue (unsigned int a_ID) { return GetById(a_ID).m_LightValue; }
|
|
|
|
inline static NIBBLETYPE GetSpreadLightFalloff(unsigned int a_ID) { return GetById(a_ID).m_SpreadLightFalloff; }
|
|
|
|
inline static bool IsTransparent (unsigned int a_ID) { return GetById(a_ID).m_Transparent; }
|
|
|
|
inline static bool IsOneHitDig (unsigned int a_ID) { return GetById(a_ID).m_OneHitDig; }
|
2014-03-01 19:34:19 +00:00
|
|
|
inline static bool IsPistonBreakable (unsigned int a_ID) { return GetById(a_ID).m_PistonBreakable; }
|
2014-03-01 15:04:17 +00:00
|
|
|
inline static bool IsSnowable (unsigned int a_ID) { return GetById(a_ID).m_IsSnowable; }
|
|
|
|
inline static bool RequiresSpecialTool (unsigned int a_ID) { return GetById(a_ID).m_RequiresSpecialTool; }
|
|
|
|
inline static bool IsSolid (unsigned int a_ID) { return GetById(a_ID).m_IsSolid; }
|
|
|
|
inline static bool FullyOccupiesVoxel (unsigned int a_ID) { return GetById(a_ID).m_FullyOccupiesVoxel; }
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// TODO xdot: Change to std::vector to support dynamic block IDs
|
2014-03-01 19:34:19 +00:00
|
|
|
static cBlockInfo ms_Info[256];
|
2014-03-01 15:04:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|