MechIcon.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. #ifndef MECHICON_H
  2. #define MECHICON_H
  3. /*************************************************************************************************\
  4. MechIcon.h : Interface for the MechIcon component.
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. \*************************************************************************************************/
  9. #ifndef MCLIB_H
  10. #include "McLib.h"
  11. #endif
  12. #ifndef AFONT_H
  13. #include "aFont.h"
  14. #endif
  15. #ifndef MC2movie_H
  16. #include "mc2movie.h"
  17. #endif
  18. //*************************************************************************************************
  19. class Mover;
  20. class MechWarrior;
  21. #define NUM_DEATH_INFOS 6
  22. /**************************************************************************************************
  23. CLASS DESCRIPTION
  24. MechIcon:
  25. **************************************************************************************************/
  26. class PilotIcon
  27. {
  28. public:
  29. static const long DEAD_PILOT_INDEX;
  30. PilotIcon();
  31. static void swapResolutions(bool bForce = 0);
  32. void setPilot( MechWarrior* pWarrior );
  33. void setTextureIndex( int newIndex ) { pilotTextureIndex = newIndex; }
  34. void render( float left, float top, float right, float bottom );
  35. private:
  36. unsigned long pilotTextureIndex;
  37. static float pilotIconX;
  38. static float pilotIconY;
  39. static unsigned long s_pilotTextureHandle;
  40. static unsigned long s_pilotTextureWidth;
  41. friend class ForceGroupIcon;
  42. friend class MechIcon;
  43. friend class Mission;
  44. };
  45. class ForceGroupIcon
  46. {
  47. public:
  48. ForceGroupIcon();
  49. virtual ~ForceGroupIcon();
  50. virtual void update() = 0;
  51. virtual void render();
  52. void renderUnitIcon( float left, float top, float right, float bottom );
  53. virtual void renderUnitIconBack( float left, float top, float right, float bottom );
  54. void renderPilotIcon( float left, float top, float right, float bottom );
  55. virtual bool init( Mover* pMover ){ return false; }
  56. void init();
  57. bool inRegion( int x, int y );
  58. void click( bool shiftDn );
  59. void rightClick();
  60. virtual void setDrawBack( bool bSet) { };
  61. static int __cdecl sort( const void* p1, const void* p2 );
  62. const char* getPilotName();
  63. static void init( FitIniFile& file, int which );
  64. void swapResolutions(bool bForce);
  65. static void resetResolution(bool bForce);
  66. void setLocationIndex( int i );
  67. void beginDeathAnimation( ){ deathAnimationTime = .0001f; }
  68. bool deathAnimationOver(){ return deathAnimationTime > animationInfos[NUM_DEATH_INFOS-1].time; }
  69. bool isAnimatingDeath() { return deathAnimationTime ? 1 : 0; }
  70. protected:
  71. static long damageColors[4][3];
  72. static unsigned long s_textureHandle[5];
  73. static bool s_slotUsed[240];
  74. static TGAFileHeader* s_textureMemory;
  75. static float unitIconX;
  76. static float unitIconY;
  77. static int curScreenWidth;
  78. static StaticInfo* jumpJetIcon;
  79. static aFont* gosFontHandle;
  80. static gos_VERTEX bmpLocation[17][5]; // in screen coords
  81. static GUI_RECT textArea[17];
  82. static GUI_RECT pilotRect[17];
  83. static GUI_RECT selectionRect[17];
  84. static GUI_RECT healthBar[17];
  85. static long pilotTextTop[17];
  86. static float pilotLocation[17][4];
  87. Mover* unit;
  88. static long ForceGroupColors[11];
  89. void drawBar( float barStatus );
  90. static void setIconVariables();
  91. friend class ForceGroupBar;
  92. friend void TerminateGameEngine(void);
  93. bool bDrawBack;
  94. int damageIconIndex;
  95. int backDamageIndex;
  96. int locationIndex;
  97. float deathAnimationTime;
  98. struct AnimationInfo
  99. {
  100. float time;
  101. long color;
  102. };
  103. static AnimationInfo animationInfos[NUM_DEATH_INFOS];
  104. void drawDeathEffect();
  105. PilotIcon pilotIcon;
  106. float msgPlayTime;
  107. static MC2MoviePtr bMovie;
  108. static DWORD pilotVideoTexture;
  109. static MechWarrior* pilotVideoPilot;
  110. };
  111. class MechIcon : public ForceGroupIcon
  112. {
  113. public:
  114. MechIcon(){}
  115. ~MechIcon(){}
  116. virtual bool init( Mover* pMover );
  117. virtual void update();
  118. static TGAFileHeader* s_MechTextures;
  119. void doDraw( char* newDamage, char* oldDamage, unsigned long handle, unsigned long where);
  120. virtual void setDrawBack( bool bSet);
  121. private:
  122. char damage[8];
  123. char backDamage[8];
  124. bool init( long whichIndex );
  125. bool initTextures();
  126. };
  127. class VehicleIcon : public ForceGroupIcon
  128. {
  129. public:
  130. VehicleIcon(){}
  131. ~VehicleIcon(){}
  132. virtual void renderUnitIconBack( float left, float top, float right, float bottom ){}
  133. virtual void update();
  134. virtual bool init( Mover* pMover );
  135. static TGAFileHeader* s_VehicleTextures;
  136. private:
  137. char damage[5];
  138. };
  139. //*************************************************************************************************
  140. #endif // end of file ( MechIcon.h )