CampaignManager.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. ** Command & Conquer Generals(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. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: CampaignManager.h /////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Electronic Arts Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2002 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // created: Jul 2002
  34. //
  35. // Filename: CampaignManager.h
  36. //
  37. // author: Chris Huybregts
  38. //
  39. // purpose:
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. #pragma once
  44. #ifndef __CAMPAIGN_MANAGER_H_
  45. #define __CAMPAIGN_MANAGER_H_
  46. //-----------------------------------------------------------------------------
  47. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  48. //-----------------------------------------------------------------------------
  49. //-----------------------------------------------------------------------------
  50. // USER INCLUDES //////////////////////////////////////////////////////////////
  51. //-----------------------------------------------------------------------------
  52. #include "Common/Snapshot.h"
  53. #include "Common/AudioEventRTS.h"
  54. //-----------------------------------------------------------------------------
  55. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  56. //-----------------------------------------------------------------------------
  57. class AsciiString;
  58. class Image;
  59. enum{ MAX_OBJECTIVE_LINES = 5 };
  60. enum{ MAX_DISPLAYED_UNITS = 3 };
  61. //-----------------------------------------------------------------------------
  62. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  63. //-----------------------------------------------------------------------------
  64. class Mission : public MemoryPoolObject
  65. {
  66. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Mission, "Mission" )
  67. public:
  68. Mission( void );
  69. //~Mission( void );
  70. public:
  71. AsciiString m_name;
  72. AsciiString m_mapName;
  73. AsciiString m_nextMission;
  74. AsciiString m_movieLabel;
  75. AsciiString m_missionObjectivesLabel[MAX_OBJECTIVE_LINES];
  76. AudioEventRTS m_briefingVoice;
  77. AsciiString m_locationNameLabel;
  78. AsciiString m_unitNames[MAX_DISPLAYED_UNITS];
  79. Int m_voiceLength;
  80. };
  81. class Campaign : public MemoryPoolObject
  82. {
  83. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Campaign, "Campaign" )
  84. public:
  85. Campaign( void );
  86. //~Campaign( void );
  87. Mission *newMission( AsciiString name );
  88. Mission *getNextMission( Mission *current);
  89. Mission *getMission( AsciiString missionName);
  90. AsciiString getFinalVictoryMovie( void );
  91. public:
  92. typedef std::list< Mission* > MissionList; ///< list of Shell Menu schemes
  93. typedef MissionList::iterator MissionListIt;
  94. AsciiString m_name;
  95. AsciiString m_firstMission;
  96. AsciiString m_campaignNameLabel; ///< campaign name label from string manager
  97. MissionList m_missions;
  98. AsciiString m_finalMovieName;
  99. };
  100. class CampaignManager : public Snapshot
  101. {
  102. public:
  103. CampaignManager( void );
  104. ~CampaignManager( void );
  105. // snapshot methods
  106. virtual void crc( Xfer *xfer ) { }
  107. virtual void xfer( Xfer *xfer );
  108. virtual void loadPostProcess( void ) { }
  109. void init( void );
  110. Campaign *getCurrentCampaign( void ); ///< Returns a point to the current Campaign
  111. Mission *getCurrentMission( void ); ///< Returns a point to the current mission
  112. Mission *gotoNextMission( void ); ///< Set the next mission as the current Mission, and returns a point to it
  113. void setCampaignAndMission( AsciiString campaign, AsciiString mission ); ///< Sets the campaing and Mission we're on
  114. void setCampaign( AsciiString campaign ); ///< sets the campaign and set's it's first mission
  115. AsciiString getCurrentMap( void ); ///< Get the map located in m_currentMission;
  116. enum { INVALID_MISSION_NUMBER = -1 };
  117. Int getCurrentMissionNumber( void ); ///< get mission number for the currently loaded level if we are in a campaign
  118. const FieldParse *getFieldParse( void ) const { return m_campaignFieldParseTable; } ///< returns the parsing fields
  119. static const FieldParse m_campaignFieldParseTable[]; ///< the parse table
  120. static void parseMissionPart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the Mission Part
  121. Campaign *newCampaign(AsciiString name);
  122. Bool isVictorious( void ) { return m_victorious; }
  123. void SetVictorious( Bool victory ) { m_victorious = victory; }
  124. void setRankPoints( Int rankPoints ) { m_currentRankPoints = rankPoints; }
  125. Int getRankPoints() const { return m_currentRankPoints; }
  126. GameDifficulty getGameDifficulty() const { return m_difficulty; }
  127. void setGameDifficulty(GameDifficulty d) { m_difficulty = d; }
  128. private:
  129. typedef std::list< Campaign* > CampaignList; ///< list of Shell Menu schemes
  130. typedef CampaignList::iterator CampaignListIt;
  131. CampaignList m_campaignList; ///< Our List of Campaigns
  132. Campaign *m_currentCampaign; ///< Our current Campaign
  133. Mission *m_currentMission; ///< our Current Mission
  134. Bool m_victorious;
  135. Int m_currentRankPoints;
  136. GameDifficulty m_difficulty;
  137. };
  138. //-----------------------------------------------------------------------------
  139. // INLINING ///////////////////////////////////////////////////////////////////
  140. //-----------------------------------------------------------------------------
  141. //-----------------------------------------------------------------------------
  142. // EXTERNALS //////////////////////////////////////////////////////////////////
  143. //-----------------------------------------------------------------------------
  144. extern CampaignManager *TheCampaignManager;
  145. #endif // __CAMPAIGN_MANAGER_H_