dazzlesave.cpp 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. *** 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 : Max2W3D *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/max2w3d/dazzlesave.cpp $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 9/21/00 4:14p $*
  31. * *
  32. * $Revision:: 1 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #include "dazzlesave.h"
  38. #include "w3d_file.h"
  39. #include "util.h"
  40. #include "w3dappdata.h"
  41. #include "errclass.h"
  42. DazzleSaveClass::DazzleSaveClass
  43. (
  44. char * mesh_name,
  45. char * container_name,
  46. INode * inode,
  47. Matrix3 & exportspace,
  48. TimeValue curtime,
  49. Progress_Meter_Class & meter
  50. )
  51. {
  52. assert(mesh_name != NULL);
  53. assert(container_name != NULL);
  54. /*
  55. ** Set up the render object name
  56. */
  57. memset(&W3DName,0,sizeof(W3DName));
  58. if ((container_name != NULL) && (strlen(container_name) > 0)) {
  59. strcpy(W3DName,container_name);
  60. strcat(W3DName,".");
  61. }
  62. strcat(W3DName,mesh_name);
  63. /*
  64. ** Dig the dazzle-type out of the appropriate App-Data chunk on
  65. ** the INode.
  66. */
  67. W3DDazzleAppDataStruct * dazzle_data = W3DDazzleAppDataStruct::Get_App_Data(inode);
  68. strncpy(DazzleType,dazzle_data->DazzleType,sizeof(DazzleType));
  69. }
  70. int DazzleSaveClass::Write_To_File(ChunkSaveClass & csave)
  71. {
  72. csave.Begin_Chunk(W3D_CHUNK_DAZZLE);
  73. csave.Begin_Chunk(W3D_CHUNK_DAZZLE_NAME);
  74. csave.Write(W3DName,strlen(W3DName) + 1);
  75. csave.End_Chunk();
  76. csave.Begin_Chunk(W3D_CHUNK_DAZZLE_TYPENAME);
  77. csave.Write(DazzleType,strlen(DazzleType) + 1);
  78. csave.End_Chunk();
  79. csave.End_Chunk();
  80. return 0;
  81. }