diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-09 13:53:50 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-03-09 13:53:50 +0100 |
commit | c2978a34576192d79c1fdc4664eafe316be49e51 (patch) | |
tree | 48db5c74ed757bfdf178a70e77eddff693c76a35 /src/Defines.h | |
parent | Hexified colours (diff) | |
parent | Updated Core (diff) | |
download | cuberite-c2978a34576192d79c1fdc4664eafe316be49e51.tar cuberite-c2978a34576192d79c1fdc4664eafe316be49e51.tar.gz cuberite-c2978a34576192d79c1fdc4664eafe316be49e51.tar.bz2 cuberite-c2978a34576192d79c1fdc4664eafe316be49e51.tar.lz cuberite-c2978a34576192d79c1fdc4664eafe316be49e51.tar.xz cuberite-c2978a34576192d79c1fdc4664eafe316be49e51.tar.zst cuberite-c2978a34576192d79c1fdc4664eafe316be49e51.zip |
Diffstat (limited to 'src/Defines.h')
-rw-r--r-- | src/Defines.h | 79 |
1 files changed, 51 insertions, 28 deletions
diff --git a/src/Defines.h b/src/Defines.h index ba2866f83..6ab2274a4 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -17,33 +17,6 @@ typedef std::vector<int> cSlotNums; // tolua_begin -/// How much light do the blocks emit on their own? -extern unsigned char g_BlockLightValue[]; - -/// How much light do the block consume? -extern unsigned char g_BlockSpreadLightFalloff[]; - -/// Is a block completely transparent? (light doesn't get decreased(?)) -extern bool g_BlockTransparent[]; - -/// Is a block destroyed after a single hit? -extern bool g_BlockOneHitDig[]; - -/// Can a piston break this block? -extern bool g_BlockPistonBreakable[256]; - -/// Can this block hold snow atop? -extern bool g_BlockIsSnowable[256]; - -/// Does this block require a tool to drop? -extern bool g_BlockRequiresSpecialTool[256]; - -/// Is this block solid (player cannot walk through)? -extern bool g_BlockIsSolid[256]; - -/// Does this block fully occupy it's voxel - is it a 'full' block? -extern bool g_BlockFullyOccupiesVoxel[256]; - /// Experience Orb setup enum { @@ -253,6 +226,56 @@ inline const char * ClickActionToString(eClickAction a_ClickAction) +/** Returns a blockface mirrored around the Y axis (doesn't change up/down). */ +inline eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace) +{ + switch (a_BlockFace) + { + case BLOCK_FACE_XM: return BLOCK_FACE_XP; + case BLOCK_FACE_XP: return BLOCK_FACE_XM; + case BLOCK_FACE_ZM: return BLOCK_FACE_ZP; + case BLOCK_FACE_ZP: return BLOCK_FACE_ZM; + default: return a_BlockFace; + } +} + + + + + +/** Returns a blockface rotated around the Y axis counter-clockwise. */ +inline eBlockFace RotateBlockFaceCCW(eBlockFace a_BlockFace) +{ + switch (a_BlockFace) + { + case BLOCK_FACE_XM: return BLOCK_FACE_ZP; + case BLOCK_FACE_XP: return BLOCK_FACE_ZM; + case BLOCK_FACE_ZM: return BLOCK_FACE_XM; + case BLOCK_FACE_ZP: return BLOCK_FACE_XP; + default: return a_BlockFace; + } +} + + + + + +inline eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace) +{ + switch (a_BlockFace) + { + case BLOCK_FACE_XM: return BLOCK_FACE_ZM; + case BLOCK_FACE_XP: return BLOCK_FACE_ZP; + case BLOCK_FACE_ZM: return BLOCK_FACE_XP; + case BLOCK_FACE_ZP: return BLOCK_FACE_XM; + default: return a_BlockFace; + } +} + + + + + inline bool IsValidBlock(int a_BlockType) { if ( @@ -654,7 +677,7 @@ namespace ItemCategory inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType) { if(!IsValidBlock(a_BlockType)) return false; - return g_BlockRequiresSpecialTool[a_BlockType]; + return cBlockInfo::RequiresSpecialTool(a_BlockType); } |