ltbasetypes.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #ifndef __LTBASETYPES_H__
  2. #define __LTBASETYPES_H__
  3. #include <math.h>
  4. // Portable integer types.
  5. typedef unsigned int uint; // This is guaranteed to be 16 bits or larger.
  6. typedef char int8;
  7. typedef unsigned char uint8;
  8. typedef short int16;
  9. typedef unsigned short uint16;
  10. typedef long int32;
  11. typedef unsigned long uint32;
  12. typedef __int64 int64;
  13. typedef unsigned __int64 uint64;
  14. // Base types.
  15. typedef unsigned int LTBOOL;
  16. typedef float LTFLOAT;
  17. typedef double LTDFLOAT;
  18. typedef uint32 LTRESULT;
  19. // Base type values (enumeration emulation)
  20. // LTBOOL
  21. #define LTFALSE 0
  22. #define LTTRUE 1
  23. // LTRESULT (defined in ltcodes.h)
  24. // Forward declaration of LTObject
  25. class LTObject;
  26. // Handles
  27. // Object handle definition.
  28. typedef LTObject* HOBJECT;
  29. typedef LTObject* HLOCALOBJ;
  30. // Model handles
  31. typedef unsigned long HMODELPIECE;
  32. #define INVALID_MODEL_PIECE ((HMODELPIECE)-1)
  33. typedef unsigned long HMODELSOCKET;
  34. #define INVALID_MODEL_SOCKET ((HMODELNODE)-1)
  35. typedef unsigned long HMODELNODE;
  36. #define INVALID_MODEL_NODE ((HMODELNODE)-1)
  37. typedef unsigned long HMODELWEIGHTSET;
  38. #define INVALID_MODEL_WEIGHTSET ((HMODELWEIGHTSET)-1)
  39. typedef unsigned long HMODELANIM;
  40. #define INVALID_MODEL_ANIM ((HMODELANIM)-1)
  41. // Poly reference
  42. typedef unsigned long HPOLY;
  43. #define INVALID_HPOLY 0xFFFFFFFF
  44. // Globally unique identifier.
  45. struct LTGUID
  46. {
  47. unsigned long a;
  48. unsigned short b;
  49. unsigned short c;
  50. unsigned char d[8];
  51. };
  52. // More complicated types
  53. #include "ltvector.h"
  54. #include "ltbbox.h"
  55. #include "ltrotation.h"
  56. #include "ltplane.h"
  57. #include "ltrect.h"
  58. #include "ltmatrix.h"
  59. #include "ltlink.h"
  60. // Structures
  61. struct PGColor
  62. {
  63. float x, y, z; // RGB 0-255
  64. float a; // Alpha 0-255
  65. };
  66. struct LTFloatPt
  67. {
  68. float x, y;
  69. };
  70. struct LTIntPt
  71. {
  72. LTIntPt(int a = 0, int b = 0) : x(a), y(b) {}
  73. int x, y;
  74. };
  75. struct LTWarpPt
  76. {
  77. float source_x, source_y;
  78. float dest_x, dest_y;
  79. };
  80. struct ArgList
  81. {
  82. char **argv;
  83. int argc;
  84. };
  85. // This class represents a position and rotation. The ILTTransform class
  86. // can be used to work with them.
  87. class LTransform
  88. {
  89. public:
  90. LTVector m_Pos;
  91. LTRotation m_Rot;
  92. };
  93. // Surface data.
  94. struct SurfaceData
  95. {
  96. LTVector O, P, Q; // Texture vectors.
  97. void *m_pInternalWorld; // Don't touch! (MainWorld* on init).
  98. void *m_pInternalWorldBsp; // Don't touch! (WorldBsp* on init).
  99. void *m_pInternalSurface; // Don't touch! (Surface*)
  100. };
  101. // Sky definition.
  102. struct SkyDef
  103. {
  104. LTVector m_Min, m_Max; // Box corners (in world coordinates).
  105. LTVector m_ViewMin, m_ViewMax; // View min and max. The viewer's position
  106. // in the main world is squished into this
  107. // box so you can get a tiny amount of parallax.
  108. };
  109. typedef void (*ConsoleProgramFn)(int argc, char **argv);
  110. typedef void (*NodeControlFn)(HOBJECT hObj, HMODELNODE hNode, LTMatrix *pGlobalMat, void *pUserData);
  111. // This is used to distinguish between flag types.
  112. enum ObjFlagType
  113. {
  114. OFT_Flags = 0, // FLAG_ #defines
  115. OFT_Flags2 // FLAG2_ #defines
  116. };
  117. #endif // __LTBASETYPES_H__