Credits.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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: Credits.h /////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Electronic Arts Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2002 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // created: Dec 2002
  34. //
  35. // Filename: Credits.h
  36. //
  37. // author: Chris Huybregts
  38. //
  39. // purpose: header file for the credits
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. #pragma once
  44. #ifndef __CREDITS_H_
  45. #define __CREDITS_H_
  46. //-----------------------------------------------------------------------------
  47. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  48. //-----------------------------------------------------------------------------
  49. //-----------------------------------------------------------------------------
  50. // USER INCLUDES //////////////////////////////////////////////////////////////
  51. //-----------------------------------------------------------------------------
  52. #include "GameClient/FontDesc.h"
  53. //-----------------------------------------------------------------------------
  54. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  55. //-----------------------------------------------------------------------------
  56. class DisplayString;
  57. //-----------------------------------------------------------------------------
  58. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  59. //-----------------------------------------------------------------------------
  60. enum
  61. {
  62. CREDIT_STYLE_TITLE = 0,
  63. CREDIT_STYLE_POSITION,
  64. CREDIT_STYLE_NORMAL,
  65. CREDIT_STYLE_COLUMN,
  66. CREDIT_STYLE_BLANK, ///< Keep this second to last
  67. MAX_CREDIT_STYLES ///< Keep this last
  68. };
  69. enum{ CREDIT_SPACE_OFFSET = 2 };
  70. static const LookupListRec CreditStyleNames[] =
  71. {
  72. { "TITLE", CREDIT_STYLE_TITLE },
  73. { "MINORTITLE", CREDIT_STYLE_POSITION },
  74. { "NORMAL", CREDIT_STYLE_NORMAL },
  75. { "COLUMN", CREDIT_STYLE_COLUMN },
  76. { NULL, 0 }// keep this last!
  77. };
  78. class CreditsLine
  79. {
  80. public:
  81. CreditsLine();
  82. ~CreditsLine();
  83. // parsing variables
  84. Int m_style;
  85. UnicodeString m_text;
  86. UnicodeString m_secondText;
  87. Bool m_useSecond;
  88. Bool m_done;
  89. // drawing variables
  90. DisplayString *m_displayString;
  91. DisplayString *m_secondDisplayString;
  92. ICoord2D m_pos;
  93. Int m_height;
  94. Int m_color;
  95. };
  96. class CreditsManager: public SubsystemInterface
  97. {
  98. public:
  99. CreditsManager(void);
  100. ~CreditsManager(void);
  101. void init(void );
  102. void load(void );
  103. void reset( void );
  104. void update( void );
  105. void draw( void );
  106. const FieldParse *getFieldParse() const { return m_creditsFieldParseTable; } ///< returns the parsing fields
  107. static const FieldParse m_creditsFieldParseTable[]; ///< the parse table
  108. static void parseBlank( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file
  109. static void parseText( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file
  110. Bool isFinished( void ) { return m_isFinished; }
  111. void addBlank( void );
  112. void addText( AsciiString text );
  113. private:
  114. UnicodeString getUnicodeString(AsciiString str);
  115. typedef std::list<CreditsLine *> CreditsLineList;
  116. CreditsLineList m_creditLineList;
  117. CreditsLineList::iterator m_creditLineListIt;
  118. CreditsLineList m_displayedCreditLineList;
  119. Int m_scrollRate; // in pixels
  120. Int m_scrollRatePerFrames;
  121. Bool m_scrollDown; // if TRUE text will come from the top to the bottom if False, it will go from the bottom up
  122. Color m_titleColor;
  123. Color m_positionColor;
  124. Color m_normalColor;
  125. Int m_currentStyle;
  126. Bool m_isFinished;
  127. Int m_framesSinceStarted;
  128. Int m_normalFontHeight;
  129. };
  130. //-----------------------------------------------------------------------------
  131. // INLINING ///////////////////////////////////////////////////////////////////
  132. //-----------------------------------------------------------------------------
  133. //-----------------------------------------------------------------------------
  134. // EXTERNALS //////////////////////////////////////////////////////////////////
  135. //-----------------------------------------------------------------------------
  136. extern CreditsManager *TheCredits;
  137. #endif // __CREDITS_H_