basegameobj.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/basegameobj.h $*
  25. * *
  26. * $Author:: Greg_h $*
  27. * *
  28. * $Modtime:: 10/15/01 7:48p $*
  29. * *
  30. * $Revision:: 17 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef BASEGAMEOBJ_H
  36. #define BASEGAMEOBJ_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef PERSIST_H
  41. #include "persist.h"
  42. #endif
  43. #ifndef DEFINITION_H
  44. #include "definition.h"
  45. #endif
  46. #ifndef __NETWORKOBJECT_H
  47. #include "networkobject.h"
  48. #endif
  49. #include "netclassids.h"
  50. /*
  51. **
  52. */
  53. class SmartGameObj;
  54. class PhysicalGameObj;
  55. class ScriptableGameObj;
  56. class VehicleGameObj;
  57. /*
  58. ** BaseGameObjDef - Defintion class for a BaseGameObj
  59. */
  60. class BaseGameObjDef : public DefinitionClass
  61. {
  62. public:
  63. virtual bool Save( ChunkSaveClass &csave );
  64. virtual bool Load( ChunkLoadClass &cload );
  65. };
  66. /*
  67. **
  68. */
  69. class BaseGameObj : public PersistClass, public NetworkObjectClass {
  70. public:
  71. // Constructor and Destructor
  72. BaseGameObj( void );
  73. virtual ~BaseGameObj( void );
  74. // Definitions
  75. virtual void Init( void ) = 0;
  76. void Init( const BaseGameObjDef & definition );
  77. const BaseGameObjDef & Get_Definition( void ) const ;
  78. // Save / Load
  79. virtual bool Save( ChunkSaveClass & csave );
  80. virtual bool Load( ChunkLoadClass & cload );
  81. // Thinking
  82. virtual void Think() { IsPostThinkAllowed = true; }
  83. virtual void Post_Think() {};
  84. // ID
  85. void Set_ID( int id ) { Set_Network_ID (id); }
  86. int Get_ID( void ) const { return Get_Network_ID (); }
  87. // Hibernation
  88. virtual bool Is_Hibernating( void ) { return false; }
  89. // Termination
  90. //virtual void Destroy(bool damaged = false) { DestroyType = damaged ? DESTROY_DAMAGED : DESTROY_CONTROLLED; }
  91. //bool Is_Destroy() { return (DestroyType != DESTROY_NONE); }
  92. //bool Is_Damage_Destroyed() { return (DestroyType == DESTROY_DAMAGED); }
  93. // Type identification
  94. virtual PhysicalGameObj *As_PhysicalGameObj( void ) { return (PhysicalGameObj*)NULL; };
  95. virtual VehicleGameObj *As_VehicleGameObj( void ) { return (VehicleGameObj *)NULL; }
  96. virtual SmartGameObj *As_SmartGameObj( void ) { return (SmartGameObj*)NULL; };
  97. virtual ScriptableGameObj *As_ScriptableGameObj( void ) { return (ScriptableGameObj*)NULL; };
  98. // Network support
  99. virtual uint32 Get_Network_Class_ID( void ) const { return NETCLASSID_GAMEOBJ; }
  100. virtual void Delete (void) { delete this; }
  101. bool Is_Post_Think_Allowed( void ) { return IsPostThinkAllowed; }
  102. void Enable_Cinematic_Freeze( bool enable ) { EnableCinematicFreeze = enable; }
  103. bool Is_Cinematic_Freeze_Enabled( void ) { return EnableCinematicFreeze; }
  104. private:
  105. // Constants
  106. /*enum
  107. {
  108. DESTROY_NONE = 0,
  109. DESTROY_DAMAGED,
  110. DESTROY_CONTROLLED
  111. };*/
  112. // Member data
  113. const BaseGameObjDef * Definition;
  114. //int DestroyType;
  115. //int ID;
  116. // This is used to prevent postthinking before a think call
  117. bool IsPostThinkAllowed;
  118. // This keeps certain object alive during cinematic freeze
  119. bool EnableCinematicFreeze;
  120. };
  121. #endif // BASEGAMEOBJ_H