objectives.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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/objectives.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 12/12/01 11:51a $*
  29. * *
  30. * $Revision:: 21 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef OBJECTIVES_H
  36. #define OBJECTIVES_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef VECTOR3_H
  41. #include "vector3.h"
  42. #endif
  43. #include "wwstring.h"
  44. #include "widestring.h"
  45. #include "simplevec.h"
  46. #include "objectivesviewer.h"
  47. #include "gameobjref.h"
  48. class ChunkSaveClass;
  49. class ChunkLoadClass;
  50. class ScriptableGameObj;
  51. class PhysicalGameObj;
  52. /*
  53. **
  54. */
  55. struct Objective {
  56. int ID;
  57. int Type;
  58. int Status;
  59. int LongDescriptionID;
  60. int ShortDescriptionID;
  61. StringClass DescriptionSoundFilename;
  62. StringClass HUDPogTextureName;
  63. int HUDMessageStringID;
  64. float HUDPriority;
  65. bool DrawBlip;
  66. Vector3 Position;
  67. float BlipIntensity;
  68. GameObjReference Object;
  69. float Age;
  70. Objective( void );
  71. ~Objective( void );
  72. bool Save( ChunkSaveClass &csave );
  73. bool Load( ChunkLoadClass &cload );
  74. const Vector3 & Type_To_Color( void );
  75. const Vector3 & Type_To_Base_Color( void );
  76. const WCHAR * Type_To_Name( void );
  77. const WCHAR * Status_To_Name( void );
  78. const Vector3 & Status_To_Color( void );
  79. int Radar_Blip_Color_Type( void );
  80. void Set_Object( PhysicalGameObj * object );
  81. void Update_Object_Blip( void );
  82. Vector3 Get_Position( void );
  83. };
  84. /*
  85. **
  86. */
  87. class ObjectiveManager
  88. {
  89. public:
  90. enum {
  91. TYPE_PRIMARY = 1,
  92. TYPE_SECONDARY,
  93. TYPE_TERTIARY,
  94. STATUS_IS_PENDING = 0,
  95. STATUS_ACCOMPLISHED,
  96. STATUS_FAILED,
  97. STATUS_HIDDEN,
  98. };
  99. static void Init( void );
  100. static void Shutdown( void );
  101. static void Reset( void );
  102. static void Update( float dt );
  103. static bool Save( ChunkSaveClass &csave );
  104. static bool Load( ChunkLoadClass &cload );
  105. static void Add_Objective( int id, int type, int status, int short_description_id, int long_description_id, char * description_sound_filename );
  106. static void Remove_Objective( int id );
  107. static void Set_Objective_Status( int id, int status );
  108. static void Change_Objective_Type( int id, int type );
  109. static void Set_Objective_Radar_Blip( int id, Vector3 position );
  110. static void Set_Objective_Radar_Blip( int id, PhysicalGameObj * object );
  111. static void Set_Objective_HUD_Info( int id, float priority, const char * texture_name, int message_id );
  112. static void Set_Objective_HUD_Info( int id, float priority, const char * texture_name, int message_id, const Vector3 & position );
  113. static int Get_Objective_Count( void ) { return ObjectiveList.Count(); }
  114. static Objective * Get_Objective( int index ) { return ObjectiveList[ index ]; }
  115. static bool Is_Objective_Debug_Mode_Enabled (void) { return DebugMode; }
  116. static void Enable_Objective_Debug_Mode (bool onoff) { DebugMode = onoff; Viewer.Update (); }
  117. static bool Is_Viewer_Displayed( void ) { return Viewer.Is_Displayed (); }
  118. static void Display_Viewer( bool onoff ) { Viewer.Display (onoff); }
  119. static void Page_Down_Viewer( void ) { Viewer.Page_Down (); }
  120. static void Render_Viewer( void ) { Viewer.Render (); }
  121. static void Reload_Viewer( void ) { Viewer.Initialize (); }
  122. static int Get_Num_Objectives( int type );
  123. static int Get_Num_Completed_Objectives( int type );
  124. static void Set_Num_Specified_Tertiary_Objectives( int count ) { NumSpecifiedTertiaryObjectives = count; }
  125. // HUD interface
  126. static int Get_Num_HUD_Objectives( void );
  127. static const char * Get_HUD_Objectives_Pog_Texture_Name( int index );
  128. static const WCHAR * Get_HUD_Objectives_Message( int index );
  129. static Vector3 Get_HUD_Objectives_Location( int index );
  130. static float Get_HUD_Objectives_Age( int index );
  131. static bool Are_HUD_Objectives_Changed( void ) { return HUDUpdate; }
  132. static void Clear_HUD_Objectives_Changed( void ) { HUDUpdate = false; }
  133. protected:
  134. static Objective * Add_Loadable_Objective( void );
  135. static Objective * Find_Objective( int id );
  136. static SimpleDynVecClass<Objective*> ObjectiveList;
  137. private:
  138. static ObjectivesViewerClass Viewer;
  139. static bool DebugMode;
  140. static bool HUDUpdate;
  141. static int NumSpecifiedTertiaryObjectives;
  142. static int __cdecl ObjectiveSortCallback( const void *elem1, const void *elem2 );
  143. static void Sort_Objectives( void );
  144. friend class ObjectivesViewerClass;
  145. };
  146. #endif // OBJECTIVES_H