Clone of Akilla's ac2d @ https://github.com/deregtd/AC2D

stdafx.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. // stdafx.h : include file for standard system include files,
  2. // or project specific include files that are used frequently, but
  3. // are changed infrequently
  4. //
  5. #pragma once
  6. #pragma warning( disable : 4996 )
  7. typedef unsigned __int64 QWORD;
  8. #define _WIN32_WINNT 0x500
  9. #define _WIN32_WINDOWS 0x500
  10. //#define TerrainOnly
  11. #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
  12. // Windows Header Files:
  13. //#include "malloc.h"
  14. #include <windows.h>
  15. // C RunTime Header Files
  16. #include <stdlib.h>
  17. #include <malloc.h>
  18. #include <memory.h>
  19. #include <tchar.h>
  20. #include <gl/gl.h> // Header File For The OpenGL32 Library
  21. #include <gl/glu.h> // Header File For The GLu32 Library
  22. #include "gl/glext.h" // Header File For The GLu32 Library
  23. //#include <gl/glprocs.h>
  24. #define _USE_MATH_DEFINES
  25. #include <math.h>
  26. #include <time.h>
  27. #include <unordered_set>
  28. #include <unordered_map>
  29. #include <vector>
  30. #include <list>
  31. #include <map>
  32. #include <string>
  33. #include <winsock2.h>
  34. #include "zlib\zlib.h"
  35. #define _CRTDBG_MAPALLOC
  36. #define _CRTDBG_MAP_ALLOC
  37. #include <stdlib.h>
  38. #include <crtdbg.h>
  39. #define NEW_INLINE_WORKAROUND new ( _NORMAL_BLOCK ,\
  40. __FILE__ , __LINE__ )
  41. #define new NEW_INLINE_WORKAROUND
  42. struct stTransitHeader //20 bytes
  43. {
  44. DWORD m_dwSequence;
  45. DWORD m_dwFlags;
  46. DWORD m_dwCRC;
  47. WORD m_wID;
  48. WORD m_wTime;
  49. WORD m_wSize;
  50. WORD m_wTable;
  51. };
  52. struct stFragmentHeader //16 bytes
  53. {
  54. DWORD m_dwSequence;
  55. DWORD m_dwID;
  56. WORD m_wCount;
  57. WORD m_wSize;
  58. WORD m_wIndex;
  59. WORD m_wGroup;
  60. };
  61. enum eColor {
  62. eGreen = 0x00,
  63. eGreen2 = 0x01,
  64. eWhite = 0x02,
  65. eYellow = 0x03,
  66. eLightBrown = 0x04,
  67. eMagenta = 0x05,
  68. eRed = 0x06,
  69. eLightBlue = 0x07,
  70. ePink = 0x08,
  71. eLightPink = 0x09,
  72. eYellow2 = 0x0A,
  73. eLightBrown2= 0x0B,
  74. eGrey = 0x0C,
  75. eCyan = 0x0D,
  76. eAquamarine = 0x0E,
  77. eRed2 = 0x0F,
  78. eGreen4 = 0x10,
  79. eBlue = 0x11,
  80. };
  81. const BYTE cColor[][3] = {
  82. { 123, 255, 115 }, //0
  83. { 123, 255, 115 },
  84. { 247, 255, 247 },
  85. { 247, 255, 49 },
  86. { 206, 207, 90 }, //4
  87. { 247, 121, 247 },
  88. { 247, 56, 49 },
  89. { 49, 190, 247 },
  90. { 247, 150, 140 }, //8
  91. { 214, 158, 156 },
  92. { 247, 255, 49 },
  93. { 206, 207, 90 },
  94. { 206, 207, 198 }, //12
  95. { 49, 223, 214 },
  96. { 173, 223, 239 },
  97. { 247, 56, 49 },
  98. { 123, 255, 115 }, //16
  99. { 49, 190, 247 },
  100. { 123, 255, 115 },
  101. { 123, 255, 115 },
  102. { 247, 121, 247 }, //20
  103. { 247, 56, 49 },
  104. { 239, 113, 107 },
  105. { 123, 255, 115 }
  106. /*
  107. { 0x00, 0xFF, 0x00 }, //00 - eGreen
  108. { 0x00, 0xFF, 0x00 }, //01 - eGreen2
  109. { 0xFF, 0xFF, 0xFF }, //02 - eWhite
  110. { 0xFF, 0xFF, 0x00 }, //03 - eYellow
  111. { 0x80, 0x80, 0x00 }, //04 - eLightBrown
  112. { 0xFF, 0x00, 0xFF }, //05 - eMagenta
  113. { 0xFF, 0x00, 0x00 }, //06 - eRed
  114. { 0x00, 0x00, 0xFF }, //07 - eLightBlue
  115. { 0xC0, 0x40, 0x40 }, //08 - ePink
  116. { 0xFF, 0x80, 0x80 }, //09 - eLightPink
  117. { 0xFF, 0xFF, 0x00 }, //0A - eYellow2
  118. { 0x80, 0x80, 0x00 }, //0B - eLightBrown2
  119. { 0xA0, 0xA0, 0xA0 }, //0C - eGrey
  120. { 0x00, 0xFF, 0xFF }, //0D - eCyan
  121. { 0x40, 0x00, 0x00 }, //0E - eAquamarine???
  122. { 0xFF, 0x00, 0x00 }, //0F - eRed2
  123. { 0x00, 0xFF, 0x00 }, //10 - eGreen4
  124. { 0x00, 0x00, 0xFF }, //11 - eBlue*/
  125. };
  126. struct stLocation { //32 bytes
  127. DWORD landblock;
  128. float xOffset, yOffset, zOffset;
  129. float wHeading;
  130. float aHeading;
  131. float bHeading;
  132. float cHeading;
  133. };
  134. struct stMoveInfo { //8 bytes
  135. WORD numLogins;
  136. WORD moveCount;
  137. WORD numPortals;
  138. WORD numOverride;
  139. };
  140. // defined in AC2DTest.cpp
  141. extern void _ODS( const char *fmt, ... );
  142. class cSectorFile
  143. {
  144. public:
  145. cSectorFile()
  146. {
  147. pos = 0;
  148. data = NULL;
  149. length = 0;
  150. }
  151. ~cSectorFile()
  152. {
  153. if (data)
  154. {
  155. delete [] data;
  156. data = NULL;
  157. length = 0;
  158. }
  159. }
  160. void Dump(char *Filename)
  161. {
  162. FILE *out = fopen(Filename,"wb");
  163. if (out)
  164. {
  165. fwrite(data, length, 1, out);
  166. // for (int i=3;i<pf->length;i+=4)
  167. // fprintf(out, "%04X - %08X - %f\r\n", i, *((DWORD *) (pf->data + i)), *((float *) (pf->data + i)));
  168. fclose(out);
  169. }
  170. }
  171. DWORD pos;
  172. BYTE *data;
  173. DWORD length;
  174. };
  175. class cPortalFile : public cSectorFile
  176. {
  177. public:
  178. DWORD id;
  179. cPortalFile()
  180. {
  181. id = 0;
  182. }
  183. };
  184. struct POINTf {
  185. POINTf(float nx, float ny) { x = nx; y = ny; }
  186. POINTf() { }
  187. float x, y;
  188. };
  189. struct stPaletteSwap {
  190. DWORD newPalette;
  191. BYTE offset;
  192. BYTE length;
  193. };
  194. struct stTextureSwap {
  195. BYTE modelIndex;
  196. DWORD oldTexture;
  197. DWORD newTexture;
  198. };
  199. struct stModelSwap {
  200. BYTE modelIndex;
  201. DWORD newModel;
  202. };
  203. #include "cPortal.h"
  204. extern cPortal *m_Portal;
  205. #include "cCellManager.h"
  206. extern cCellManager *m_Cell;