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