nullrobj.cpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 : WW3D *
  23. * *
  24. * $Archive:: /Commando/Code/ww3d2/nullrobj.cpp $*
  25. * *
  26. * Author:: Greg Hjelstrom *
  27. * *
  28. * $Modtime:: 12/01/01 12:18p $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "nullrobj.h"
  36. #include "chunkio.h"
  37. #include <string.h>
  38. NullLoaderClass _NullLoader;
  39. Null3DObjClass::Null3DObjClass(const char * name)
  40. {
  41. strcpy(Name, name);
  42. }
  43. Null3DObjClass::Null3DObjClass(const Null3DObjClass & src)
  44. {
  45. strcpy(Name, src.Name);
  46. }
  47. Null3DObjClass & Null3DObjClass::operator = (const Null3DObjClass & that)
  48. {
  49. strcpy(Name, that.Name);
  50. RenderObjClass::operator = (that); return *this;
  51. }
  52. int Null3DObjClass::Class_ID(void) const
  53. {
  54. return CLASSID_NULL;
  55. }
  56. RenderObjClass * Null3DObjClass::Clone(void) const
  57. {
  58. return NEW_REF( Null3DObjClass, (*this));
  59. }
  60. void Null3DObjClass::Render(RenderInfoClass & rinfo)
  61. {
  62. }
  63. void Null3DObjClass::Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const
  64. {
  65. sphere.Center.Set(0,0,0);
  66. sphere.Radius = 0.1f;
  67. }
  68. void Null3DObjClass::Get_Obj_Space_Bounding_Box(AABoxClass & box) const
  69. {
  70. box.Center.Set(0,0,0);
  71. box.Extent.Set(0.1f,0.1f,0.1f);
  72. }
  73. /*
  74. ** NullPrototypeClass
  75. */
  76. NullPrototypeClass::NullPrototypeClass (void)
  77. {
  78. // Note that the other members of the definition are uninitialized..
  79. // So don't rely on them if the name is "NULL".
  80. strcpy(Definition.Name, "NULL");
  81. }
  82. NullPrototypeClass::NullPrototypeClass (const W3dNullObjectStruct &null)
  83. {
  84. Definition = null;
  85. }
  86. /*
  87. ** NullLoaderClass
  88. */
  89. PrototypeClass * NullLoaderClass::Load_W3D (ChunkLoadClass &cload)
  90. {
  91. W3dNullObjectStruct null;
  92. cload.Read(&null,sizeof(null));
  93. return W3DNEW NullPrototypeClass(null);
  94. }