gameobjmanager.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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/gameobjmanager.h $*
  25. * *
  26. * $Author:: Ian_l $*
  27. * *
  28. * $Modtime:: 12/09/01 2:02p $*
  29. * *
  30. * $Revision:: 38 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef GAMEOBJMANAGER_H
  36. #define GAMEOBJMANAGER_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef SLIST_H
  41. #include "slist.h"
  42. #endif
  43. #include "networkobjectmgr.h"
  44. /*
  45. **
  46. */
  47. class BaseGameObj;
  48. class SmartGameObj;
  49. class SoldierGameObj;
  50. class ScriptableGameObj;
  51. class VehicleGameObj;
  52. class BuildingGameObj;
  53. class PhysicalGameObj;
  54. class ChunkSaveClass;
  55. class ChunkLoadClass;
  56. class StaticPhysClass;
  57. class BuildingAggregateClass;
  58. class LightPhysClass;
  59. class Vector3;
  60. /*
  61. ** Static IDs
  62. */
  63. enum
  64. {
  65. NETID_GDI_BASE_CONTROLLER = NETID_STATIC_OBJECT_MIN + 1,
  66. NETID_NOD_BASE_CONTROLLER,
  67. NETID_NOD_TEAM,
  68. NETID_GDI_TEAM,
  69. NETID_SERVER_FPS,
  70. NETID_SERVER_WEATHER,
  71. NETID_SERVER_BACKGROUND
  72. };
  73. /*
  74. ** GameObjManager
  75. **
  76. ** A collection of routines to maintain lists of game objects
  77. **
  78. ** In the editor, building objects will be created and added to this manager. In the game, they will
  79. ** be loaded. After a level has been loaded, the 'Init_Level_Buildings' function should be called.
  80. ** This manager will be the entry point for any operations that need to happen on all existing buildings
  81. ** such as save/load, per-frame processing, etc.
  82. */
  83. class GameObjManager {
  84. public:
  85. static void Init(void);
  86. static void Shutdown(void);
  87. static bool Save( ChunkSaveClass &csave );
  88. static bool Load( ChunkLoadClass &cload );
  89. static int Generate_Control();
  90. static int Think();
  91. static int Post_Think();
  92. static void Init_All(void);
  93. static void Destroy_All( void );
  94. //static void Destroy_Pending( void );
  95. // BaseGameObjs
  96. static void Add( BaseGameObj *obj );
  97. static void Remove( BaseGameObj *obj ) { GameObjList.Remove( obj ); }
  98. static SList<BaseGameObj> *Get_Game_Obj_List( void ) { return &GameObjList; }
  99. // SmartGameObjs
  100. static void Add_Smart( SmartGameObj *obj ) { SmartGameObjList.Add_Tail( obj ); }
  101. static void Remove_Smart( SmartGameObj *obj ) { SmartGameObjList.Remove( obj ); }
  102. static SList<SmartGameObj> *Get_Smart_Game_Obj_List( void ) { return &SmartGameObjList; }
  103. // Star GameObjs
  104. static void Add_Star( SoldierGameObj *obj ) { StarGameObjList.Add_Tail( obj ); }
  105. static void Remove_Star( SoldierGameObj *obj ) { StarGameObjList.Remove( obj ); }
  106. static SList<SoldierGameObj> *Get_Star_Game_Obj_List( void ) { return &StarGameObjList; }
  107. // BuildingGameObjs
  108. static void Init_Buildings(void);
  109. static void Update_Building_Collection_Spheres (void);
  110. static void Debug_Set_All_Building_States(float health_percentage,bool power_on);
  111. static void Add_Building( BuildingGameObj *obj ) { BuildingGameObjList.Add_Tail( obj ); }
  112. static void Remove_Building( BuildingGameObj *obj ) { BuildingGameObjList.Remove( obj ); }
  113. static SList<BuildingGameObj> *Get_Building_Game_Obj_List( void ) { return &BuildingGameObjList; }
  114. // Environment Zone
  115. static bool Is_In_Environment_Zone( Vector3 & pos );
  116. // Find Game Objs
  117. static SoldierGameObj *Find_Soldier_Of_Client_ID(int client_id);
  118. static SoldierGameObj *Find_Different_Player_Soldier(int my_id);
  119. static SoldierGameObj *Find_Soldier_Of_Player_Type(int player_type);
  120. static PhysicalGameObj *Find_PhysicalGameObj( int id );
  121. static SmartGameObj *Find_SmartGameObj( int id );
  122. static ScriptableGameObj *Find_ScriptableGameObj( int id );
  123. static VehicleGameObj *Find_Vehicle_Occupied_By( SoldierGameObj * p_soldier );
  124. // Cinematic Freeze
  125. static bool Is_Cinematic_Freeze_Active( void ) { return CinematicFreezeActive; }
  126. static void Activate_Cinematic_Freeze( bool activate ) { CinematicFreezeActive = activate; }
  127. static void Toggle_Cinematic_Freeze( void ) { CinematicFreezeActive = !CinematicFreezeActive; }
  128. private:
  129. static SList<BaseGameObj> GameObjList; // list of all game objs
  130. static SList<SmartGameObj> SmartGameObjList; // list of all smart game objs
  131. static SList<SoldierGameObj> StarGameObjList; // list of all star game objs
  132. static SList<BuildingGameObj> BuildingGameObjList; // list of all builiding game objs
  133. static bool CinematicFreezeActive;
  134. };
  135. #endif // GAMEOBJMANAGER_H