action.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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/action.h $*
  25. * *
  26. * $Author:: Patrick $*
  27. * *
  28. * $Modtime:: 10/09/01 2:15p $*
  29. * *
  30. * $Revision:: 47 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef ACTION_H
  36. #define ACTION_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef VECTOR3_H
  41. #include "vector3.h"
  42. #endif
  43. #ifndef GAMEOBJREF_H
  44. #include "gameobjref.h"
  45. #endif
  46. #ifndef WWSTRING_H
  47. #include "wwstring.h"
  48. #endif
  49. #ifndef ACTIONPARAMS_H
  50. #include "actionparams.h"
  51. #endif
  52. /*
  53. **
  54. */
  55. class ActionCodeClass;
  56. class SmartGameObj;
  57. /*
  58. **
  59. */
  60. class SafeActionParamsStruct : public ActionParamsStruct {
  61. public:
  62. SafeActionParamsStruct & operator = (const ActionParamsStruct & src); // Assignment operator.
  63. bool Save( ChunkSaveClass & csave );
  64. bool Load( ChunkLoadClass & cload );
  65. GameObjReference MoveObjectRef;
  66. GameObjReference AttackObjectRef;
  67. GameObjReference LookObjectRef;
  68. StringClass SafeAnimationName;
  69. StringClass SafeConversationName;
  70. };
  71. /*
  72. **
  73. */
  74. class ActionClass {
  75. public:
  76. ActionClass( SmartGameObj *obj );
  77. virtual ~ActionClass( void );
  78. bool Save( ChunkSaveClass & csave );
  79. bool Load( ChunkLoadClass & cload );
  80. SmartGameObj * Get_Action_Obj( void ) { return ActionObj; }
  81. SafeActionParamsStruct & Get_Parameters( void ) { return Parameters; }
  82. bool Is_Acting( void );
  83. bool Is_Animating( void );
  84. void Begin_Hibernation( void );
  85. void End_Hibernation( void );
  86. bool Reset( float priority );
  87. bool Follow_Input( const ActionParamsStruct & parameters );
  88. bool Stand( const ActionParamsStruct & parameters );
  89. bool Play_Animation( const ActionParamsStruct & parameters );
  90. bool Goto( const ActionParamsStruct & parameters );
  91. bool Enter_Exit( const ActionParamsStruct & parameters );
  92. bool Dive( const ActionParamsStruct & parameters );
  93. bool Attack( const ActionParamsStruct & parameters );
  94. bool Face_Location( const ActionParamsStruct & parameters );
  95. bool Have_Conversation( const ActionParamsStruct & parameters );
  96. bool Dock_Vehicle( const ActionParamsStruct & parameters );
  97. bool Modify( const ActionParamsStruct & parameters, bool modify_move, bool modify_attack );
  98. void Act( void );
  99. unsigned int Get_Act_Count( void ) { return ActCount; }
  100. bool Is_Active( void );
  101. bool Is_Busy( void );
  102. bool Is_Paused( void ) const { return IsPaused; }
  103. void Pause( bool onoff) { IsPaused = onoff; }
  104. void Done( int reason ); // Notify the obserever
  105. protected:
  106. void Notify_Completed( int observer_id, int action_id, int reason ); // Notify the obserever
  107. bool Request_Action( ActionCodeClass * action, const ActionParamsStruct & parameters );
  108. SmartGameObj * ActionObj;
  109. ActionCodeClass * ActionCode;
  110. SafeActionParamsStruct Parameters;
  111. bool IsPaused;
  112. unsigned int ActCount; // TSS - diagnostic
  113. void Set_Action_Code( ActionCodeClass * code );
  114. };
  115. // Debugging
  116. void Toggle_Display_Findpaths( void );
  117. #endif // ACTION_H