crater.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //---------------------------------------------------------------------
  2. //
  3. // crater.h -- Crater/footprint manager for MechCommander 2
  4. //
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. #ifndef CRATER_H
  9. #define CRATER_H
  10. //---------------------------------------------------------------------
  11. // Include Files
  12. #ifndef HEAP_H
  13. #include "heap.h"
  14. #endif
  15. #ifndef PACKET_H
  16. #include "packet.h"
  17. #endif
  18. #include <stuff\stuff.hpp>
  19. //---------------------------------------------------------------------
  20. // Macro Definitions
  21. enum craterTypes
  22. {
  23. INVALID_CRATER = -1,
  24. SML_FOOTPRINT = 0,
  25. AVG_FOOTPRINT,
  26. BIG_FOOTPRINT,
  27. ULLER_FOOTPRINT,
  28. MADCAT_FOOTPRINT,
  29. LEFT_MASAKARI_FOOTPRINT,
  30. RIGHT_MASAKARI_FOOTPRINT,
  31. BUSH_FOOTPRINT,
  32. NOVACAT_FOOTPRINT,
  33. TURKINA_FOOTPRINT = 63,
  34. CRATER_1 = 64,
  35. CRATER_2,
  36. CRATER_3,
  37. CRATER_4,
  38. MAX_CRATER_SHAPES
  39. };
  40. #define FOOTPRINT_ROTATIONS 16
  41. #define BIG_CRATER_OFFSET 0
  42. #define SMALL_CRATER_OFFSET 1
  43. //---------------------------------------------------------------------
  44. // struct CraterData
  45. typedef struct _CraterData
  46. {
  47. long craterShapeId;
  48. Stuff::Vector3D position[4];
  49. Stuff::Vector4D screenPos[4];
  50. } CraterData;
  51. typedef CraterData *CraterDataPtr;
  52. //---------------------------------------------------------------------
  53. // class CraterManager
  54. class CraterManager
  55. {
  56. //Data Members
  57. //-------------
  58. protected:
  59. HeapManagerPtr craterPosHeap;
  60. UserHeapPtr craterShpHeap;
  61. unsigned long craterPosHeapSize;
  62. unsigned long craterShpHeapSize;
  63. PacketFilePtr craterFile;
  64. unsigned long maxCraters;
  65. unsigned long currentCrater;
  66. CraterDataPtr craterList;
  67. long numCraterTextures;
  68. DWORD *craterTextureIndices;
  69. DWORD *craterTextureHandles;
  70. //Member Functions
  71. //-----------------
  72. protected:
  73. public:
  74. void init (void)
  75. {
  76. craterPosHeap = NULL;
  77. craterShpHeap = NULL;
  78. craterPosHeapSize = craterShpHeapSize = 0;
  79. currentCrater = maxCraters = 0;
  80. craterList = NULL;
  81. numCraterTextures = 0;
  82. craterTextureHandles = NULL;
  83. craterTextureIndices = NULL;
  84. craterFile = NULL;
  85. }
  86. CraterManager (void)
  87. {
  88. init();
  89. }
  90. long init (long numCraters, unsigned long craterTypeSize, char *craterFileName);
  91. ~CraterManager (void)
  92. {
  93. destroy();
  94. }
  95. void destroy (void);
  96. long addCrater (long craterType, Stuff::Vector3D &position, float rotation);
  97. long update (void);
  98. void render (void);
  99. };
  100. //---------------------------------------------------------------------
  101. typedef CraterManager *CraterManagerPtr;
  102. extern CraterManagerPtr craterManager;
  103. //---------------------------------------------------------------------
  104. #endif