radar.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/radar.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 10/27/01 11:36a $*
  29. * *
  30. * $Revision:: 26 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef RADAR_H
  36. #define RADAR_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef VECTOR3_H
  41. #include "vector3.h"
  42. #endif
  43. #ifndef VECTOR_H
  44. #include "vector.h"
  45. #endif
  46. #ifndef RECT_H
  47. #include "rect.h"
  48. #endif
  49. /*
  50. **
  51. */
  52. class ChunkSaveClass;
  53. class ChunkLoadClass;
  54. class Matrix3D;
  55. class Vector2;
  56. class Render2DClass;
  57. class PhysicalGameObj;
  58. class Render2DSentenceClass;
  59. /*
  60. ** Radar mode in multiplayer
  61. */
  62. enum RadarModeEnum {
  63. RADAR_NOBODY,
  64. RADAR_TEAMMATES,
  65. RADAR_ALL,
  66. };
  67. /*
  68. **
  69. */
  70. class RadarMarkerClass {
  71. public:
  72. RadarMarkerClass( void );
  73. bool operator == ( const RadarMarkerClass & other) const { return false; }
  74. bool operator != ( const RadarMarkerClass & other) const { return true; }
  75. bool Save( ChunkSaveClass &csave );
  76. bool Load( ChunkLoadClass &cload );
  77. int ID;
  78. int Type;
  79. int Color;
  80. Vector3 Position;
  81. float Intensity;
  82. };
  83. /*
  84. ** System to display the Radar
  85. */
  86. class RadarManager {
  87. public:
  88. static void Init( void );
  89. static void Shutdown( void );
  90. static bool Save( ChunkSaveClass &csave );
  91. static bool Load( ChunkLoadClass &cload );
  92. static void Update( const Matrix3D & player_tm, const Vector2 & offset_2d );
  93. static void Set_Bracket_Object( const PhysicalGameObj * obj ) { BracketObj = obj; }
  94. static void Render( void );
  95. static void Set_Hidden( bool onoff );
  96. static bool Is_Hidden( void ) { return IsHidden; }
  97. // Blip Types
  98. enum {
  99. BLIP_SHAPE_TYPE_NONE = 0,
  100. BLIP_SHAPE_TYPE_HUMAN,
  101. BLIP_SHAPE_TYPE_VEHICLE,
  102. BLIP_SHAPE_TYPE_STATIONARY,
  103. BLIP_SHAPE_TYPE_OBJECTIVE,
  104. NUM_BLIP_SHAPE_TYPES,
  105. BLIP_BRACKET = NUM_BLIP_SHAPE_TYPES,
  106. BLIP_SWEEP,
  107. NUM_BLIP_TYPES
  108. };
  109. static int Get_Num_Blip_Shape_Types( void ) { return NUM_BLIP_SHAPE_TYPES; }
  110. static const char * Get_Blip_Shape_Type_Name( int index );
  111. // Colors
  112. enum {
  113. BLIP_COLOR_TYPE_NOD = 0,
  114. BLIP_COLOR_TYPE_GDI,
  115. BLIP_COLOR_TYPE_NEUTRAL,
  116. BLIP_COLOR_TYPE_MUTANT,
  117. BLIP_COLOR_TYPE_RENEGADE,
  118. BLIP_COLOR_TYPE_PRIMARY_OBJECTIVE,
  119. BLIP_COLOR_TYPE_SECONDARY_OBJECTIVE,
  120. BLIP_COLOR_TYPE_TERTIARY_OBJECTIVE,
  121. NUM_BLIP_COLOR_TYPES
  122. };
  123. // Special Markers
  124. static void Clear_Marker( int id );
  125. static void Clear_Markers( void ) { Markers.Delete_All(); }
  126. static void Add_Marker( const RadarMarkerClass & marker ) { Markers.Add(marker); }
  127. static void Change_Marker_Color( int id, int color );
  128. // Multiplayer support
  129. static void Set_Radar_Mode(RadarModeEnum mode) { RadarMode = mode; }
  130. static RadarModeEnum Get_Radar_Mode(void) { return RadarMode; }
  131. private:
  132. static DynamicVectorClass<RadarMarkerClass> Markers;
  133. static Render2DClass * Renderer;
  134. static Render2DSentenceClass * CompassRenderers[8];
  135. static int CurrentCompassRendererIndex;
  136. static unsigned long BlipColors[ NUM_BLIP_COLOR_TYPES ];
  137. static const PhysicalGameObj * BracketObj;
  138. static RectClass BlipUV[ NUM_BLIP_TYPES ];
  139. static bool IsHidden;
  140. static float HiddenTimer;
  141. static RadarModeEnum RadarMode;
  142. // Possibily add a blip, return the new intensity
  143. static float Add_Blip( const Vector3 & pos, int shape_type, int color_type, float intensity, bool bracket, bool altitude_fade = false );
  144. };
  145. #endif