staticnetworkobject.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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/staticnetworkobject.h $*
  25. * *
  26. * $Author:: Tom_s $*
  27. * *
  28. * $Modtime:: 10/16/01 3:56p $*
  29. * *
  30. * $Revision:: 11 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __STATICNETWORKOBJECT_H
  39. #define __STATICNETWORKOBJECT_H
  40. #include "networkobject.h"
  41. #include "vector.h"
  42. ////////////////////////////////////////////////////////////////
  43. // Forward delcarations
  44. ////////////////////////////////////////////////////////////////
  45. class StaticAnimPhysClass;
  46. class DoorNetworkObjectClass;
  47. class ElevatorNetworkObjectClass;
  48. class DSAPONetworkObjectClass;
  49. ////////////////////////////////////////////////////////////////
  50. //
  51. // StaticNetworkObjectClass
  52. //
  53. ////////////////////////////////////////////////////////////////
  54. class StaticNetworkObjectClass : public NetworkObjectClass
  55. {
  56. public:
  57. ////////////////////////////////////////////////////////////////
  58. // Public constructors/destructors
  59. ////////////////////////////////////////////////////////////////
  60. StaticNetworkObjectClass (void);
  61. ~StaticNetworkObjectClass (void);
  62. ////////////////////////////////////////////////////////////////
  63. // Public methods
  64. ////////////////////////////////////////////////////////////////
  65. //
  66. // Initialization
  67. //
  68. virtual void Initialize (StaticAnimPhysClass *phys_obj);
  69. virtual void Delete (void) {}
  70. //
  71. // Timestep support
  72. //
  73. virtual void Network_Think (void);
  74. //
  75. // Server-to-client state importing/exporting
  76. //
  77. virtual void Import_Rare (BitStreamClass &packet);
  78. virtual void Export_Rare (BitStreamClass &packet);
  79. //
  80. // Filtering support
  81. //
  82. virtual bool Get_World_Position (Vector3 &pos) const;
  83. virtual int Get_Vis_ID (void);
  84. //virtual float Compute_Object_Priority (int client_id, const Vector3 &client_pos);
  85. //
  86. // Static methods
  87. //
  88. static void Generate_Static_Network_Objects (void);
  89. static void Free_Static_Network_Objects (void);
  90. //
  91. // Type identification
  92. //
  93. virtual DoorNetworkObjectClass * As_Door_Network_Object_Class( void ) { return NULL; }
  94. virtual ElevatorNetworkObjectClass * As_Elevator_Network_Object_Class( void ) { return NULL; }
  95. virtual DSAPONetworkObjectClass * As_DSAPO_Network_Object_Class( void ) { return NULL; }
  96. //
  97. // Diagnostics
  98. //
  99. //virtual bool Is_Tagged(void) { return true; }
  100. static int Get_Static_Network_Object_Count (void) { return StaticNetworkObjectList.Count (); }
  101. static const StaticNetworkObjectClass * Get_Static_Network_Object (int index) { return StaticNetworkObjectList[index]; }
  102. protected:
  103. ////////////////////////////////////////////////////////////////
  104. // Protected member data
  105. ////////////////////////////////////////////////////////////////
  106. StaticAnimPhysClass * PhysObj;
  107. static DynamicVectorClass<StaticNetworkObjectClass *> StaticNetworkObjectList;
  108. private:
  109. ////////////////////////////////////////////////////////////////
  110. // Private member data
  111. ////////////////////////////////////////////////////////////////
  112. int AnimationMode;
  113. float LoopStart;
  114. float LoopEnd;
  115. float CurrFrame;
  116. float TargetFrame;
  117. };
  118. ////////////////////////////////////////////////////////////////
  119. //
  120. // DoorNetworkObjectClass
  121. //
  122. ////////////////////////////////////////////////////////////////
  123. class DoorNetworkObjectClass : public StaticNetworkObjectClass
  124. {
  125. public:
  126. ////////////////////////////////////////////////////////////////
  127. // Public constructor
  128. ////////////////////////////////////////////////////////////////
  129. /*
  130. DoorNetworkObjectClass (void) :
  131. DoorState (0) {}
  132. */
  133. DoorNetworkObjectClass (void);
  134. ////////////////////////////////////////////////////////////////
  135. // Public methods
  136. ////////////////////////////////////////////////////////////////
  137. //
  138. // Intialization
  139. //
  140. virtual void Initialize (StaticAnimPhysClass *phys_obj);
  141. //
  142. // Timestep support
  143. //
  144. virtual void Network_Think (void);
  145. //
  146. // Server-to-client state importing/exporting
  147. //
  148. virtual void Import_Rare (BitStreamClass &packet);
  149. virtual void Export_Rare (BitStreamClass &packet);
  150. //
  151. // Type identification
  152. //
  153. virtual DoorNetworkObjectClass * As_Door_Network_Object_Class( void ) { return this; }
  154. //
  155. // Diagnostics
  156. //
  157. //virtual bool Is_Tagged(void) { return false; }
  158. virtual void Get_Description(StringClass & description);
  159. private:
  160. ////////////////////////////////////////////////////////////////
  161. // Private member data
  162. ////////////////////////////////////////////////////////////////
  163. int DoorState;
  164. };
  165. ////////////////////////////////////////////////////////////////
  166. //
  167. // ElevatorNetworkObjectClass
  168. //
  169. ////////////////////////////////////////////////////////////////
  170. class ElevatorNetworkObjectClass : public StaticNetworkObjectClass
  171. {
  172. public:
  173. ////////////////////////////////////////////////////////////////
  174. // Public constructor
  175. ////////////////////////////////////////////////////////////////
  176. /*
  177. ElevatorNetworkObjectClass (void) :
  178. State (0),
  179. DoorStateTop (0),
  180. DoorStateBottom (0) {}
  181. */
  182. ElevatorNetworkObjectClass (void);
  183. //
  184. // Intialization
  185. //
  186. virtual void Initialize (StaticAnimPhysClass *phys_obj);
  187. //
  188. // Timestep support
  189. //
  190. virtual void Network_Think (void);
  191. //
  192. // Server-to-client state importing/exporting
  193. //
  194. virtual void Import_Rare (BitStreamClass &packet);
  195. virtual void Export_Rare (BitStreamClass &packet);
  196. //
  197. // Type identification
  198. //
  199. virtual ElevatorNetworkObjectClass * As_Elevator_Network_Object_Class( void ) { return this; }
  200. //
  201. // Diagnostics
  202. //
  203. //virtual bool Is_Tagged(void) { return true; }
  204. virtual void Get_Description(StringClass & description);
  205. private:
  206. ////////////////////////////////////////////////////////////////
  207. // Private member data
  208. ////////////////////////////////////////////////////////////////
  209. int State;
  210. int DoorStateTop;
  211. int DoorStateBottom;
  212. };
  213. ////////////////////////////////////////////////////////////////
  214. //
  215. // DSAPONetworkObjectClass
  216. //
  217. ////////////////////////////////////////////////////////////////
  218. class DSAPONetworkObjectClass : public StaticNetworkObjectClass
  219. {
  220. public:
  221. ////////////////////////////////////////////////////////////////
  222. // Public constructor
  223. ////////////////////////////////////////////////////////////////
  224. /*
  225. DSAPONetworkObjectClass (void) :
  226. Health (0) {
  227. */
  228. DSAPONetworkObjectClass (void);
  229. ////////////////////////////////////////////////////////////////
  230. // Public methods
  231. ////////////////////////////////////////////////////////////////
  232. //
  233. // Initialization
  234. //
  235. virtual void Initialize (StaticAnimPhysClass *phys_obj);
  236. //
  237. // Timestep support
  238. //
  239. virtual void Network_Think (void);
  240. //
  241. // Server-to-client state importing/exporting
  242. //
  243. virtual void Import_Rare (BitStreamClass &packet);
  244. virtual void Export_Rare (BitStreamClass &packet);
  245. //
  246. // Type identification
  247. //
  248. virtual DSAPONetworkObjectClass * As_DSAPO_Network_Object_Class( void ) { return this; }
  249. private:
  250. ////////////////////////////////////////////////////////////////
  251. // Private member data
  252. ////////////////////////////////////////////////////////////////
  253. float Health;
  254. };
  255. #endif // __STATICNETWORKOBJECT_H