ChallengeGenerals.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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: ChallengeGenerals.h //////////////////////////////////////////////////////////////////////
  24. // Author: Steve Copeland, 6/24/2003
  25. // Desc: This is a manager for data pertaining to the Generals' Challenge personas and related GUI.
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __CHALLENGEGENERALS_H_
  29. #define __CHALLENGEGENERALS_H_
  30. // INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/GameType.h"
  32. #include "Common/Overridable.h"
  33. // DEFINES ////////////////////////////////////////////////////////////////////////////////////////
  34. //static const Int NUM_GENERALS = 12; // ChallengeMenu.wnd dependent
  35. #define NUM_GENERALS (12)
  36. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  37. // CLASS DEFINITIONS //////////////////////////////////////////////////////////////////////////////
  38. class GeneralPersona
  39. {
  40. friend class ChallengeGenerals;
  41. private:
  42. Bool m_bStartsEnabled;
  43. AsciiString m_strBioName;
  44. AsciiString m_strBioDOB;
  45. AsciiString m_strBioBirthplace;
  46. AsciiString m_strBioStrategy;
  47. AsciiString m_strBioRank;
  48. AsciiString m_strBioBranch;
  49. AsciiString m_strBioClassNumber;
  50. Image *m_imageBioPortraitSmall;
  51. Image *m_imageBioPortraitLarge;
  52. AsciiString m_strCampaign;
  53. AsciiString m_strPlayerTemplateName;
  54. AsciiString m_strPortraitMovieLeftName;
  55. AsciiString m_strPortraitMovieRightName;
  56. Image *m_imageDefeated;
  57. Image *m_imageVictorious;
  58. AsciiString m_strDefeated;
  59. AsciiString m_strVictorious;
  60. AsciiString m_strSelectionSound;
  61. AsciiString m_strTauntSound1;
  62. AsciiString m_strTauntSound2;
  63. AsciiString m_strTauntSound3;
  64. AsciiString m_strWinSound;
  65. AsciiString m_strLossSound;
  66. AsciiString m_strPreviewSound;
  67. AsciiString m_strNameSound ;
  68. public:
  69. GeneralPersona( void ) :
  70. m_imageBioPortraitSmall(NULL),
  71. m_imageBioPortraitLarge(NULL)
  72. {
  73. }
  74. // ~GeneralPersona( void );
  75. const Bool isStartingEnabled() const { return m_bStartsEnabled; }
  76. const AsciiString& getBioName() const { return m_strBioName; }
  77. const AsciiString& getBioDOB() const { return m_strBioDOB; }
  78. const AsciiString& getBioBirthplace() const { return m_strBioBirthplace; }
  79. const AsciiString& getBioStrategy() const { return m_strBioStrategy; }
  80. const AsciiString& getBioRank() const { return m_strBioRank; }
  81. const AsciiString& getBioClassNumber() const { return m_strBioClassNumber; }
  82. const AsciiString& getBioBranch() const { return m_strBioBranch; }
  83. const Image *getBioPortraitSmall() const { return m_imageBioPortraitSmall; }
  84. const Image *getBioPortraitLarge() const { return m_imageBioPortraitLarge; }
  85. const AsciiString& getPortraitMovieLeftName() const { return m_strPortraitMovieLeftName; }
  86. const AsciiString& getPortraitMovieRightName() const { return m_strPortraitMovieRightName; }
  87. const AsciiString& getCampaign() const { return m_strCampaign; }
  88. const AsciiString& getPlayerTemplateName() const { return m_strPlayerTemplateName; } // template name, as parsed in from ini
  89. const Image *getImageDefeated() const { return m_imageDefeated; }
  90. const Image *getImageVictorious() const { return m_imageVictorious; }
  91. const AsciiString& getStringDefeated() const { return m_strDefeated; }
  92. const AsciiString& getStringVictorious() const { return m_strVictorious; }
  93. const AsciiString& getSelectionSound() const { return m_strSelectionSound; }
  94. const AsciiString& getRandomTauntSound() const {
  95. switch (rand()%3) // don't care about distribution or exactly how random this is
  96. {
  97. case 0: return m_strTauntSound1;
  98. case 1: return m_strTauntSound2;
  99. }
  100. return m_strTauntSound3;
  101. }
  102. const AsciiString& getWinSound() const { return m_strWinSound; }
  103. const AsciiString& getLossSound() const { return m_strLossSound; }
  104. const AsciiString& getPreviewSound() const { return m_strPreviewSound; }
  105. const AsciiString& getNameSound() const { return m_strNameSound; }
  106. };
  107. class ChallengeGenerals
  108. {
  109. private:
  110. /*const*/ GeneralPersona m_position[ NUM_GENERALS ];
  111. Int m_PlayerTemplateNum; // the template number as ThePlayerTemplateStore has it
  112. GameDifficulty m_currentDifficulty; // the last selected game difficulty for the challenge generals
  113. static void parseGeneralPersona( INI* ini, void *instance, void *store, const void *userData );
  114. public:
  115. ChallengeGenerals( void );
  116. ~ChallengeGenerals( void );
  117. void init( void );
  118. const GeneralPersona* getChallengeGenerals() const { return m_position; }
  119. const FieldParse* getFieldParse( void ) const { return s_fieldParseTable; } // for INI file parsing
  120. const GeneralPersona* getPlayerGeneralByCampaignName( AsciiString name ) const;
  121. const GeneralPersona* getGeneralByGeneralName( AsciiString name ) const;
  122. const GeneralPersona* getGeneralByTemplateName( AsciiString name ) const;
  123. void setCurrentPlayerTemplateNum( Int playerTemplateNum) { m_PlayerTemplateNum = playerTemplateNum; }
  124. Int getCurrentPlayerTemplateNum( void ) { return m_PlayerTemplateNum; }
  125. void setCurrentDifficulty( GameDifficulty diff ) { m_currentDifficulty = diff; }
  126. const GameDifficulty getCurrentDifficulty( void ) { return m_currentDifficulty; }
  127. protected:
  128. static const FieldParse s_fieldParseTable[];
  129. };
  130. // EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
  131. extern ChallengeGenerals *TheChallengeGenerals;
  132. extern ChallengeGenerals *createChallengeGenerals( void );
  133. #endif // end __CHALLENGEGENERALS_H_