cevfx.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. //---------------------------------------------------------------------------
  2. //
  3. // cevfx.h - This file contains the class declarations for the VFX Shape Element
  4. //
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. #ifndef CEVFX_H
  9. #define CEVFX_H
  10. //---------------------------------------------------------------------------
  11. // Include files
  12. #ifndef CELEMENT_H
  13. #include "celement.h"
  14. #endif
  15. #include <float.h>
  16. #include <gameos.hpp>
  17. //---------------------------------------------------------------------------
  18. class VFXElement : public Element
  19. {
  20. public:
  21. MemoryPtr shapeTable;
  22. long frameNum;
  23. long x,y;
  24. bool reverse;
  25. MemoryPtr fadeTable;
  26. bool noScaleDraw;
  27. bool scaleUp;
  28. VFXElement (void)
  29. {
  30. shapeTable = NULL;
  31. frameNum = 0;
  32. x = y = 0;
  33. reverse = FALSE;
  34. fadeTable = NULL;
  35. noScaleDraw = FALSE;
  36. scaleUp = FALSE;
  37. }
  38. VFXElement (MemoryPtr _shape, long _x, long _y, long frame, bool rev, MemoryPtr fTable = NULL, bool noScale = FALSE, bool scaleUp = FALSE);
  39. VFXElement (MemoryPtr _shape, float _x, float _y, long frame, bool rev, MemoryPtr fTable = NULL, bool noScale = FALSE, bool scaleUp = FALSE);
  40. virtual void draw (void);
  41. };
  42. #define MAX_ELEMENT_SHAPES 4
  43. //---------------------------------------------------------------------------
  44. class VFXShapeElement : public Element
  45. {
  46. public:
  47. //---------------------------------------
  48. // This new element class combines all of
  49. // the shapes into a single Texture for
  50. // rendering. Can be used for vehicles
  51. // and mechs in MechCmdr 2.
  52. MemoryPtr shapeTable[MAX_ELEMENT_SHAPES];
  53. long frameNum[MAX_ELEMENT_SHAPES];
  54. bool reverse[MAX_ELEMENT_SHAPES];
  55. long x,y,xHS,yHS;
  56. unsigned long *fadeTable;
  57. DWORD textureMemoryHandle;
  58. long actualHeight;
  59. float textureFactor;
  60. DWORD lightRGB;
  61. DWORD fogRGB;
  62. float z,topZ;
  63. VFXShapeElement (void)
  64. {
  65. shapeTable[0] = shapeTable[1] = shapeTable[2] = shapeTable[3] = NULL;
  66. frameNum[0] = frameNum[1] = frameNum[2] = frameNum[3] = 0;
  67. x = y = 0;
  68. reverse[0] = reverse[1] = reverse[2] = reverse[3] = FALSE;
  69. fadeTable = NULL;
  70. textureMemoryHandle = 0xffffffff;
  71. actualHeight = -1;
  72. lightRGB = 0xffffffff; //Fully Lit
  73. fogRGB = 0xffffffff; //NO Fog
  74. }
  75. void init (MemoryPtr _shape, long _x, long _y, long frame, bool rev, unsigned long *fTable = NULL, float _z = 0.0, float tZ = 0.0);
  76. long getTextureHandle (long height = -1); //Return the block of memory so I store it for this mech/vehicle,etc.
  77. void setTextureHandle (DWORD handle, long height = -1);
  78. void setLight (DWORD light)
  79. {
  80. lightRGB = light;
  81. }
  82. void setFog (DWORD fog)
  83. {
  84. fogRGB = fog;
  85. }
  86. void drawShape (void);
  87. virtual void draw (void);
  88. };
  89. //---------------------------------------------------------------------------
  90. class TextureElement : public Element
  91. {
  92. public:
  93. //-----------------------------------------
  94. // This just draws a textured face.
  95. // Texture is passed in when inited.
  96. // For use with Cards. Not real 3D faces!
  97. long x, y, xHS, yHS;
  98. float tWidth;
  99. float z,topZ;
  100. DWORD textureMemoryHandle;
  101. DWORD lightRGB;
  102. DWORD fogRGB;
  103. TextureElement (void)
  104. {
  105. x = y = 0;
  106. topZ = z = 0.0;
  107. textureMemoryHandle = 0xffffffff;
  108. lightRGB = 0xffffffff;
  109. }
  110. void setLight (DWORD light)
  111. {
  112. lightRGB = light;
  113. }
  114. void setFog (DWORD fog)
  115. {
  116. fogRGB = fog;
  117. }
  118. void init (DWORD textureHandle, long _x, long _y, long hsx, long hsy, float tWidth, float _z, float tZ);
  119. virtual void draw (void);
  120. };
  121. //---------------------------------------------------------------------------
  122. class PolygonQuadElement : public Element
  123. {
  124. public:
  125. //--------------------------------
  126. // This draws any untextured face.
  127. // Useful for status bars, etc.
  128. gos_VERTEX vertices[4];
  129. PolygonQuadElement (void)
  130. {
  131. }
  132. void init (gos_VERTEX *v);
  133. virtual void draw (void);
  134. };
  135. //---------------------------------------------------------------------------
  136. class PolygonTriElement : public Element
  137. {
  138. public:
  139. //--------------------------------
  140. // This draws any untextured face.
  141. // Useful for status bars, etc.
  142. gos_VERTEX vertices[3];
  143. PolygonTriElement (void)
  144. {
  145. }
  146. void init (gos_VERTEX *v);
  147. virtual void draw (void);
  148. };
  149. //---------------------------------------------------------------------------
  150. class TexturedPolygonQuadElement : public PolygonQuadElement
  151. {
  152. public:
  153. //--------------------------------
  154. // This draws any untextured face.
  155. // Useful everywhere
  156. DWORD textureHandle;
  157. bool zWrite;
  158. bool zComp;
  159. TexturedPolygonQuadElement (void)
  160. {
  161. }
  162. void init (gos_VERTEX *v, DWORD tHandle, bool writeZ = true, bool compZ = true);
  163. virtual void draw (void);
  164. };
  165. //---------------------------------------------------------------------------
  166. class TexturedPolygonTriElement : public PolygonTriElement
  167. {
  168. public:
  169. //--------------------------------
  170. // This draws any textured face.
  171. // Useful everywhere.
  172. DWORD textureHandle;
  173. TexturedPolygonTriElement (void)
  174. {
  175. }
  176. void init (gos_VERTEX *v, DWORD tHandle);
  177. virtual void draw (void);
  178. };
  179. //---------------------------------------------------------------------------
  180. #endif