dialogue.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : LevelEdit *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/dialogue.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 9/14/01 12:10p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #include "vector.h"
  39. #ifndef __DIALOGUE_H
  40. #define __DIALOGUE_H
  41. ////////////////////////////////////////////////////////////////
  42. // Forward declarations
  43. ////////////////////////////////////////////////////////////////
  44. class DialogueOptionClass;
  45. class ChunkSaveClass;
  46. class ChunkLoadClass;
  47. ////////////////////////////////////////////////////////////////
  48. // Typedefs
  49. ////////////////////////////////////////////////////////////////
  50. typedef DynamicVectorClass<DialogueOptionClass *> DIALOGUE_OPTION_LIST;
  51. ////////////////////////////////////////////////////////////////
  52. // Constants
  53. ////////////////////////////////////////////////////////////////
  54. typedef enum {
  55. DIALOG_ON_TAKE_DAMAGE_FROM_FRIEND = 0,
  56. DIALOG_ON_TAKE_DAMAGE_FROM_ENEMY,
  57. DIALOG_ON_DAMAGE_FRIEND,
  58. DIALOG_ON_DAMAGE_ENEMY,
  59. DIALOG_ON_KILLED_FRIEND,
  60. DIALOG_ON_KILLED_ENEMY,
  61. DIALOG_ON_SAW_FRIEND,
  62. DIALOG_ON_SAW_ENEMY,
  63. DIALOG_ON_OBSOLETE_01,
  64. DIALOG_ON_OBSOLETE_02,
  65. DIALOG_ON_DIE,
  66. DIALOG_ON_POKE_IDLE,
  67. DIALOG_ON_POKE_SEARCH,
  68. DIALOG_ON_POKE_COMBAT,
  69. DIALOG_STATE_FROM_IDLE_TO_COMBAT,
  70. DIALOG_STATE_FROM_IDLE_TO_SEARCH,
  71. DIALOG_STATE_FROM_SEARCH_TO_COMBAT,
  72. DIALOG_STATE_FROM_SEARCH_TO_IDLE,
  73. DIALOG_STATE_FROM_COMBAT_TO_SEARCH,
  74. DIALOG_STATE_FROM_COMBAT_TO_IDLE,
  75. DIALOG_MAX
  76. } DialogEvents;
  77. extern const char * const DIALOG_EVENT_NAMES[DIALOG_MAX];
  78. ////////////////////////////////////////////////////////////////
  79. //
  80. // DialogueOptionClass
  81. //
  82. ////////////////////////////////////////////////////////////////
  83. class DialogueOptionClass
  84. {
  85. public:
  86. ////////////////////////////////////////////////////////////////
  87. // Public constructors/destructors
  88. ////////////////////////////////////////////////////////////////
  89. DialogueOptionClass (void);
  90. DialogueOptionClass (const DialogueOptionClass &src);
  91. virtual ~DialogueOptionClass (void);
  92. ////////////////////////////////////////////////////////////////
  93. // Public operators
  94. ////////////////////////////////////////////////////////////////
  95. const DialogueOptionClass & operator= (const DialogueOptionClass &src);
  96. ////////////////////////////////////////////////////////////////
  97. // Public methods
  98. ////////////////////////////////////////////////////////////////
  99. //
  100. // Accessors
  101. //
  102. int Get_Conversation_ID (void) const { return ConversationID; }
  103. float Get_Weight (void) const { return Weight; }
  104. void Set_Conversation_ID (int id) { ConversationID = id; }
  105. void Set_Weight (float weight) { Weight = weight; }
  106. //
  107. // Save/load
  108. //
  109. void Save (ChunkSaveClass &csave);
  110. void Load (ChunkLoadClass &cload);
  111. protected:
  112. ////////////////////////////////////////////////////////////////
  113. // Protected methods
  114. ////////////////////////////////////////////////////////////////
  115. void Load_Variables (ChunkLoadClass &cload);
  116. ////////////////////////////////////////////////////////////////
  117. // Protected member data
  118. ////////////////////////////////////////////////////////////////
  119. float Weight;
  120. int ConversationID;
  121. };
  122. ////////////////////////////////////////////////////////////////
  123. //
  124. // DialogueClass
  125. //
  126. ////////////////////////////////////////////////////////////////
  127. class DialogueClass
  128. {
  129. public:
  130. ////////////////////////////////////////////////////////////////
  131. // Public constructors/destructors
  132. ////////////////////////////////////////////////////////////////
  133. DialogueClass (void);
  134. DialogueClass (const DialogueClass &src);
  135. virtual ~DialogueClass (void);
  136. ////////////////////////////////////////////////////////////////
  137. // Public operators
  138. ////////////////////////////////////////////////////////////////
  139. const DialogueClass & operator= (const DialogueClass &src);
  140. ////////////////////////////////////////////////////////////////
  141. // Public methods
  142. ////////////////////////////////////////////////////////////////
  143. //
  144. // Accessors
  145. //
  146. DIALOGUE_OPTION_LIST & Get_Option_List (void) { return OptionList; }
  147. void Free_Options (void);
  148. float Get_Silence_Weight (void) { return SilenceWeight; }
  149. void Set_Silence_Weight (float weight) { SilenceWeight = weight; }
  150. //
  151. // Evaluation
  152. //
  153. int Get_Conversation (void);
  154. //
  155. // Save/load
  156. //
  157. void Save (ChunkSaveClass &csave);
  158. void Load (ChunkLoadClass &cload);
  159. protected:
  160. ////////////////////////////////////////////////////////////////
  161. // Protected methods
  162. ////////////////////////////////////////////////////////////////
  163. void Load_Variables (ChunkLoadClass &cload);
  164. ////////////////////////////////////////////////////////////////
  165. // Protected member data
  166. ////////////////////////////////////////////////////////////////
  167. DIALOGUE_OPTION_LIST OptionList;
  168. float SilenceWeight;
  169. };
  170. #endif //__DIALOGUE_H