diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-22 11:24:28 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-22 11:24:28 +0200 |
commit | 3385ed56b86a7816892e199fdda177ebb3a33966 (patch) | |
tree | e4ebda8e1fc245e9a84c3c4b363c05bbbad3a85f /src/Defines.h | |
parent | Suggestions (diff) | |
parent | Updated prefabs to current Gallery content. (diff) | |
download | cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.gz cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.bz2 cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.lz cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.xz cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.zst cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.zip |
Diffstat (limited to 'src/Defines.h')
-rw-r--r-- | src/Defines.h | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/Defines.h b/src/Defines.h index f57e63c7f..9f66cbf9b 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -470,18 +470,7 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B { int Y = a_BlockY; AddFaceDirection(a_BlockX, Y, a_BlockZ, a_BlockFace, a_bInverse); - if (Y < 0) - { - a_BlockY = 0; - } - else if (Y > 255) - { - a_BlockY = 255; - } - else - { - a_BlockY = (unsigned char)Y; - } + a_BlockY = Clamp<unsigned char>((unsigned char)Y, 0, 255); } @@ -490,9 +479,9 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B inline void EulerToVector(double a_Pan, double a_Pitch, double & a_X, double & a_Y, double & a_Z) { - // a_X = sinf ( a_Pan / 180 * PI ) * cosf ( a_Pitch / 180 * PI ); - // a_Y = -sinf ( a_Pitch / 180 * PI ); - // a_Z = -cosf ( a_Pan / 180 * PI ) * cosf ( a_Pitch / 180 * PI ); + // a_X = sinf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI); + // a_Y = -sinf ( a_Pitch / 180 * PI); + // a_Z = -cosf ( a_Pan / 180 * PI) * cosf ( a_Pitch / 180 * PI); a_X = cos(a_Pan / 180 * PI) * cos(a_Pitch / 180 * PI); a_Y = sin(a_Pan / 180 * PI) * cos(a_Pitch / 180 * PI); a_Z = sin(a_Pitch / 180 * PI); @@ -530,7 +519,7 @@ inline float GetSignf(float a_Val) -inline float GetSpecialSignf( float a_Val ) +inline float GetSpecialSignf( float a_Val) { return (a_Val <= 0.f) ? -1.f : 1.f; } @@ -651,11 +640,11 @@ namespace ItemCategory inline bool IsTool(short a_ItemID) { - return IsPickaxe( a_ItemID ) - || IsAxe ( a_ItemID ) - || IsSword ( a_ItemID ) - || IsHoe ( a_ItemID ) - || IsShovel ( a_ItemID ); + return IsPickaxe( a_ItemID) + || IsAxe ( a_ItemID) + || IsSword ( a_ItemID) + || IsHoe ( a_ItemID) + || IsShovel ( a_ItemID); } @@ -728,7 +717,7 @@ namespace ItemCategory inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType) { - if(!IsValidBlock(a_BlockType)) return false; + if (!IsValidBlock(a_BlockType)) return false; return cBlockInfo::RequiresSpecialTool(a_BlockType); } |