conversationremark.cpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 : Combat *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/conversationremark.cpp $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 1/25/01 3:09p $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "conversationremark.h"
  36. #include "chunkio.h"
  37. ////////////////////////////////////////////////////////////////
  38. // Constants
  39. ////////////////////////////////////////////////////////////////
  40. enum
  41. {
  42. CHUNKID_BASE_CLASS = 0x01250306,
  43. CHUNKID_VARIABLES,
  44. };
  45. enum
  46. {
  47. VARID_ORATORID = 0,
  48. VARID_TEXTID,
  49. VARID_ANIMATION_NAME
  50. };
  51. ////////////////////////////////////////////////////////////////
  52. //
  53. // ConversationRemarkClass
  54. //
  55. ////////////////////////////////////////////////////////////////
  56. ConversationRemarkClass::ConversationRemarkClass (void) :
  57. OratorID (0),
  58. TextID (0)
  59. {
  60. return ;
  61. }
  62. ////////////////////////////////////////////////////////////////
  63. //
  64. // ConversationRemarkClass
  65. //
  66. ////////////////////////////////////////////////////////////////
  67. ConversationRemarkClass::ConversationRemarkClass (const ConversationRemarkClass &src) :
  68. OratorID (0),
  69. TextID (0)
  70. {
  71. (*this) = src;
  72. return ;
  73. }
  74. ////////////////////////////////////////////////////////////////
  75. //
  76. // ~ConversationRemarkClass
  77. //
  78. ////////////////////////////////////////////////////////////////
  79. ConversationRemarkClass::~ConversationRemarkClass (void)
  80. {
  81. return ;
  82. }
  83. ////////////////////////////////////////////////////////////////
  84. //
  85. // operator=
  86. //
  87. ////////////////////////////////////////////////////////////////
  88. const ConversationRemarkClass &
  89. ConversationRemarkClass::operator= (const ConversationRemarkClass &src)
  90. {
  91. OratorID = src.OratorID;
  92. TextID = src.TextID;
  93. AnimationName = src.AnimationName;
  94. return *this;
  95. }
  96. ////////////////////////////////////////////////////////////////
  97. //
  98. // Save
  99. //
  100. ////////////////////////////////////////////////////////////////
  101. bool
  102. ConversationRemarkClass::Save (ChunkSaveClass &csave)
  103. {
  104. csave.Begin_Chunk (CHUNKID_VARIABLES);
  105. WRITE_MICRO_CHUNK_WWSTRING (csave, VARID_ANIMATION_NAME, AnimationName);
  106. WRITE_MICRO_CHUNK (csave, VARID_ORATORID, OratorID);
  107. WRITE_MICRO_CHUNK (csave, VARID_TEXTID, TextID);
  108. csave.End_Chunk ();
  109. return true;
  110. }
  111. ////////////////////////////////////////////////////////////////
  112. //
  113. // Load
  114. //
  115. ////////////////////////////////////////////////////////////////
  116. bool
  117. ConversationRemarkClass::Load (ChunkLoadClass &cload)
  118. {
  119. while (cload.Open_Chunk ()) {
  120. switch (cload.Cur_Chunk_ID ()) {
  121. case CHUNKID_VARIABLES:
  122. Load_Variables (cload);
  123. break;
  124. }
  125. cload.Close_Chunk ();
  126. }
  127. return true;
  128. }
  129. ///////////////////////////////////////////////////////////////////////
  130. //
  131. // Load_Variables
  132. //
  133. ///////////////////////////////////////////////////////////////////////
  134. void
  135. ConversationRemarkClass::Load_Variables (ChunkLoadClass &cload)
  136. {
  137. //
  138. // Loop through all the microchunks that define the variables
  139. //
  140. while (cload.Open_Micro_Chunk ()) {
  141. switch (cload.Cur_Micro_Chunk_ID ()) {
  142. READ_MICRO_CHUNK_WWSTRING (cload, VARID_ANIMATION_NAME, AnimationName);
  143. READ_MICRO_CHUNK (cload, VARID_ORATORID, OratorID);
  144. READ_MICRO_CHUNK (cload, VARID_TEXTID, TextID);
  145. }
  146. cload.Close_Micro_Chunk ();
  147. }
  148. return ;
  149. }