summaryrefslogtreecommitdiffstats
path: root/source/cTorch.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/cTorch.h')
-rw-r--r--source/cTorch.h120
1 files changed, 51 insertions, 69 deletions
diff --git a/source/cTorch.h b/source/cTorch.h
index c45916dbf..5d0b9ad0c 100644
--- a/source/cTorch.h
+++ b/source/cTorch.h
@@ -1,6 +1,11 @@
-#pragma once
+#pragma once
#include "Vector3i.h"
+#include "Defines.h"
+
+
+
+
class cTorch //tolua_export
{ //tolua_export
@@ -8,87 +13,64 @@ public:
static char DirectionToMetaData( char a_Direction ) //tolua_export
{ //tolua_export
- switch( a_Direction )
+ switch (a_Direction)
{
- case 0x0:
- return 0x0;
- case 0x1:
- return 0x5; //standing on floor
- case 0x2:
- return 0x4; // south
- case 0x3:
- return 0x3; // north
- case 0x4:
- return 0x2; // west
- case 0x5:
- return 0x1; // east
- default:
- break;
+ case BLOCK_FACE_BOTTOM: ASSERT(!"Shouldn't be getting this direction"); return 0;
+ case BLOCK_FACE_TOP: return E_META_TORCH_FLOOR;
+ case BLOCK_FACE_EAST: return E_META_TORCH_EAST;
+ case BLOCK_FACE_WEST: return E_META_TORCH_WEST;
+ case BLOCK_FACE_NORTH: return E_META_TORCH_NORTH;
+ case BLOCK_FACE_SOUTH: return E_META_TORCH_SOUTH;
+ default:
+ {
+ ASSERT(!"Unhandled torch direction!");
+ break;
+ }
};
return 0x0;
} //tolua_export
+
- static char MetaDataToDirection( char a_MetaData ) //tolua_export
+ static char MetaDataToDirection(char a_MetaData) //tolua_export
{ //tolua_export
- switch( a_MetaData )
+ switch (a_MetaData)
{
- case 0x0:
- return 0x0;
- case 0x1:
- return 0x5;
- case 0x2:
- return 0x4;
- case 0x3:
- return 0x3;
- case 0x4:
- return 0x2;
- case 0x5:
- return 0x1;
- default:
- break;
- };
- return 0x0;
+ case E_META_TORCH_FLOOR: return BLOCK_FACE_TOP;
+ case E_META_TORCH_EAST: return BLOCK_FACE_EAST;
+ case E_META_TORCH_WEST: return BLOCK_FACE_WEST;
+ case E_META_TORCH_NORTH: return BLOCK_FACE_NORTH;
+ case E_META_TORCH_SOUTH: return BLOCK_FACE_SOUTH;
+ default:
+ {
+ ASSERT(!"Unhandled torch metadata");
+ break;
+ }
+ }
+ return 0;
} //tolua_export
- static bool IsAttachedTo( const Vector3i & a_TorchPos, char a_TorchMeta, const Vector3i & a_BlockPos )
+
+ static bool IsAttachedTo(const Vector3i & a_TorchPos, char a_TorchMeta, const Vector3i & a_BlockPos)
{
- switch( a_TorchMeta )
+ switch (a_TorchMeta)
{
- case 0x0:
- case 0x5: // On floor
- if( (a_TorchPos - a_BlockPos).Equals( Vector3i(0, 1, 0 ) ) )
+ case 0x0:
+ case E_META_TORCH_FLOOR: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(0, 1, 0)));
+ case E_META_TORCH_EAST: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(0, 0, -1)));
+ case E_META_TORCH_WEST: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(0, 0, 1)));
+ case E_META_TORCH_NORTH: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(-1, 0, 0)));
+ case E_META_TORCH_SOUTH: return ((a_TorchPos - a_BlockPos).Equals(Vector3i(1, 0, 0)));
+ default:
{
- return true;
+ ASSERT(!"Unhandled torch meta!");
+ break;
}
- break;
- case 0x4: // South -Z
- if( (a_TorchPos - a_BlockPos).Equals( Vector3i(0, 0, -1 ) ) )
- {
- return true;
- }
- break;
- case 0x3: // North +Z
- if( (a_TorchPos - a_BlockPos).Equals( Vector3i(0, 0, 1 ) ) )
- {
- return true;
- }
- break;
- case 0x2: // West -X
- if( (a_TorchPos - a_BlockPos).Equals( Vector3i(-1, 0, 0 ) ) )
- {
- return true;
- }
- break;
- case 0x1: // East +X
- if( (a_TorchPos - a_BlockPos).Equals( Vector3i( 1, 0, 0 ) ) )
- {
- return true;
- }
- break;
- default:
- break;
- };
+ }
return false;
}
-}; //tolua_export \ No newline at end of file
+} ; //tolua_export
+
+
+
+