summaryrefslogtreecommitdiffstats
path: root/source/Defines.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-08 11:45:07 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-08 11:45:07 +0200
commit7cbf36bf17df70d325d03e4cd40859ac31b4c2e2 (patch)
tree09675adda6e35bab168cecb497849a870dfb4956 /source/Defines.h
parentPlease keep the lists alpha-sorted (diff)
downloadcuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.gz
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.bz2
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.lz
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.xz
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.zst
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.zip
Diffstat (limited to '')
-rw-r--r--source/Defines.h172
1 files changed, 137 insertions, 35 deletions
diff --git a/source/Defines.h b/source/Defines.h
index c90416003..e92568d78 100644
--- a/source/Defines.h
+++ b/source/Defines.h
@@ -5,6 +5,10 @@
typedef unsigned char Byte;
+
+
+
+
// tolua_begin
/// How much light do the blocks emit on their own?
@@ -23,7 +27,7 @@ extern bool g_BlockOneHitDig[];
-// Block face constants, used in PlayerDigging and PlayerBlockPlacement packets
+/// Block face constants, used in PlayerDigging and PlayerBlockPlacement packets
enum
{
BLOCK_FACE_NONE = -1, // Interacting with no block face - swinging the item in the air
@@ -35,7 +39,11 @@ enum
BLOCK_FACE_EAST = 5, // Interacting with the eastern face of the block
} ;
-// PlayerDigging status constants:
+
+
+
+
+/// PlayerDigging status constants
enum
{
DIG_STATUS_STARTED = 0,
@@ -44,14 +52,131 @@ enum
DIG_STATUS_DROP_HELD = 4,
DIG_STATUS_SHOOT_EAT = 5,
} ;
-// tolua_end
-inline bool IsValidBlock(int a_BlockType) // tolua_export
-{ // tolua_export
+/// Individual actions sent in the WindowClick packet
+enum eClickAction
+{
+ // Sorted by occurrence in the 1.5 protocol
+ caLeftClick,
+ caRightClick,
+ caShiftLeftClick,
+ caShiftRightClick,
+ caNumber1,
+ caNumber2,
+ caNumber3,
+ caNumber4,
+ caNumber5,
+ caNumber6,
+ caNumber7,
+ caNumber8,
+ caNumber9,
+ caMiddleClick,
+ caDropKey,
+ caCtrlDropKey,
+ caLeftClickOutside,
+ caRightClickOutside,
+ caLeftClickOutsideHoldNothing,
+ caRightClickOutsideHoldNothing,
+ caLeftPaintBegin,
+ caRightPaintBegin,
+ caLeftPaintProgress,
+ caRightPaintProgress,
+ caLeftPaintEnd,
+ caRightPaintEnd,
+ caDblClick,
+ // Add new actions here
+ caUnknown = 255,
+
+ // Keep this list in sync with ClickActionToString() function below!
+} ;
+
+
+
+
+
+enum eGameMode
+{
+ eGameMode_NotSet = -1,
+ eGameMode_Survival = 0,
+ eGameMode_Creative = 1,
+ eGameMode_Adventure = 2,
+
+ // Easier-to-use synonyms:
+ gmNotSet = eGameMode_NotSet,
+ gmSurvival = eGameMode_Survival,
+ gmCreative = eGameMode_Creative,
+ gmAdventure = eGameMode_Adventure,
+} ;
+
+
+
+
+
+enum eWeather
+{
+ eWeather_Sunny = 0,
+ eWeather_Rain = 1,
+ eWeather_ThunderStorm = 2,
+
+ // Easier-to-use synonyms:
+ wSunny = eWeather_Sunny,
+ wRain = eWeather_Rain,
+ wThunderstorm = eWeather_ThunderStorm,
+ wStorm = wThunderstorm,
+} ;
+
+
+
+
+
+inline const char * ClickActionToString(eClickAction a_ClickAction)
+{
+ switch (a_ClickAction)
+ {
+ case caLeftClick: return "caLeftClick";
+ case caRightClick: return "caRightClick";
+ case caShiftLeftClick: return "caShiftLeftClick";
+ case caShiftRightClick: return "caShiftRightClick";
+ case caNumber1: return "caNumber1";
+ case caNumber2: return "caNumber2";
+ case caNumber3: return "caNumber3";
+ case caNumber4: return "caNumber4";
+ case caNumber5: return "caNumber5";
+ case caNumber6: return "caNumber6";
+ case caNumber7: return "caNumber7";
+ case caNumber8: return "caNumber8";
+ case caNumber9: return "caNumber9";
+ case caMiddleClick: return "caMiddleClick";
+ case caDropKey: return "caDropKey";
+ case caCtrlDropKey: return "caCtrlDropKey";
+ case caLeftClickOutside: return "caLeftClickOutside";
+ case caRightClickOutside: return "caRightClickOutside";
+ case caLeftClickOutsideHoldNothing: return "caLeftClickOutsideHoldNothing";
+ case caRightClickOutsideHoldNothing: return "caRightClickOutsideHoldNothing";
+ case caLeftPaintBegin: return "caLeftPaintBegin";
+ case caRightPaintBegin: return "caRightPaintBegin";
+ case caLeftPaintProgress: return "caLeftPaintProgress";
+ case caRightPaintProgress: return "caRightPaintProgress";
+ case caLeftPaintEnd: return "caLeftPaintEnd";
+ case caRightPaintEnd: return "caRightPaintEnd";
+ case caDblClick: return "caDblClick";
+
+ case caUnknown: return "caUnknown";
+ }
+ ASSERT(!"Unknown click action");
+ return "caUnknown";
+}
+
+
+
+
+
+inline bool IsValidBlock(int a_BlockType)
+{
if (
(a_BlockType > -1) &&
(a_BlockType <= E_BLOCK_MAX_TYPE_ID) &&
@@ -62,14 +187,14 @@ inline bool IsValidBlock(int a_BlockType) // tolua_export
return true;
}
return false;
-} // tolua_export
+}
-inline bool IsValidItem(int a_ItemType) // tolua_export
-{ // tolua_export
+inline bool IsValidItem(int a_ItemType)
+{
if (
((a_ItemType >= E_ITEM_FIRST) && (a_ItemType <= E_ITEM_MAX_CONSECUTIVE_TYPE_ID)) || // Basic items range
((a_ItemType >= E_ITEM_FIRST_DISC) && (a_ItemType <= E_ITEM_LAST_DISC)) // Music discs' special range
@@ -84,7 +209,9 @@ inline bool IsValidItem(int a_ItemType) // tolua_export
}
return IsValidBlock(a_ItemType);
-} // tolua_export
+}
+
+// tolua_end
@@ -202,8 +329,7 @@ inline void AddFaceDirection(int & a_BlockX, unsigned char & a_BlockY, int & a_B
#include <math.h>
#define PI 3.14159265358979323846264338327950288419716939937510582097494459072381640628620899862803482534211706798f
-#define MIN(a,b) (((a)>(b))?(b):(a))
-#define MAX(a,b) (((a)>(b))?(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 );
@@ -381,30 +507,6 @@ inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType)
}
-// tolua_begin
-enum eGameMode
-{
- eGameMode_NotSet = -1,
- eGameMode_Survival = 0,
- eGameMode_Creative = 1,
- eGameMode_Adventure = 2
-};
-
-
-
-
-
-enum eWeather
-{
- eWeather_Sunny = 0,
- eWeather_Rain = 1,
- eWeather_ThunderStorm = 2
-};
-
-
-
-
-// tolua_end