transition.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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/transition.h $*
  25. * *
  26. * $Author:: Patrick $*
  27. * *
  28. * $Modtime:: 11/16/01 3:18p $*
  29. * *
  30. * $Revision:: 22 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef TRANSITION_H
  39. #define TRANSITION_H
  40. #include "always.h"
  41. #include "matrix3d.h"
  42. #include "aabox.h"
  43. #include "gameobjref.h"
  44. #include "vector.h"
  45. #include "obbox.h"
  46. #include "wwstring.h"
  47. class SoldierGameObj;
  48. class VehicleGameObj;
  49. /*
  50. ** TransitionDataClass
  51. */
  52. class TransitionDataClass {
  53. public:
  54. TransitionDataClass( void );
  55. ~TransitionDataClass( void ) { }
  56. bool Save( ChunkSaveClass & csave );
  57. bool Load( ChunkLoadClass & cload );
  58. typedef enum {
  59. DISABLED = -1,
  60. LADDER_EXIT_TOP = 0,
  61. LADDER_EXIT_BOTTOM,
  62. LADDER_ENTER_TOP,
  63. LADDER_ENTER_BOTTOM,
  64. LEGACY_VEHICLE_ENTER_0,
  65. LEGACY_VEHICLE_ENTER_1,
  66. LEGACY_VEHICLE_EXIT_0,
  67. LEGACY_VEHICLE_EXIT_1,
  68. VEHICLE_ENTER,
  69. VEHICLE_EXIT,
  70. NUM_TRANSITION_TYPE
  71. } StyleType;
  72. static int Get_Num_Types( void ) { return NUM_TRANSITION_TYPE; }
  73. static const char * Get_Type_Name( StyleType type );
  74. StyleType Get_Type( void ) const { return Type; }
  75. void Set_Type( StyleType type ) { Type = type; }
  76. const OBBoxClass & Get_Zone( void ) const { return Zone; }
  77. void Set_Zone( const OBBoxClass & zone ) { Zone = zone; }
  78. const char * Get_Animation_Name( void ) const { return AnimationName; }
  79. void Set_Animation_Name( const char * name ) { AnimationName = name; }
  80. const Matrix3D & Get_Ending_TM( void ) const { return EndingTM; }
  81. void Set_Ending_TM( const Matrix3D & tm ) { EndingTM = tm; }
  82. private:
  83. StyleType Type;
  84. OBBoxClass Zone;
  85. StringClass AnimationName;
  86. Matrix3D EndingTM;
  87. };
  88. typedef DynamicVectorClass<TransitionDataClass *> TRANSITION_DATA_LIST;
  89. /*
  90. ** TransitionCompletionDataClass
  91. */
  92. struct TransitionCompletionDataStruct {
  93. public:
  94. bool Save( ChunkSaveClass & csave );
  95. bool Load( ChunkLoadClass & cload );
  96. TransitionDataClass::StyleType Type;
  97. GameObjReference Vehicle;
  98. };
  99. /*
  100. ** TransitionInstanceClass
  101. */
  102. class TransitionInstanceClass {
  103. public:
  104. TransitionInstanceClass( const TransitionDataClass & data );
  105. ~TransitionInstanceClass( void );
  106. // Check for Triggering
  107. bool Check( SoldierGameObj *obj, bool action_trigger );
  108. void Start( SoldierGameObj *obj );
  109. static void End( SoldierGameObj *obj, TransitionCompletionDataStruct * data );
  110. TransitionDataClass::StyleType Get_Type( void ) const { return Data.Get_Type(); }
  111. void Set_Parent_Transform( const Matrix3D & tm );
  112. VehicleGameObj * Get_Vehicle( void ) { return (VehicleGameObj*)Vehicle.Get_Ptr(); }
  113. void Set_Vehicle( VehicleGameObj * vehicle ) { Vehicle = (GameObjRefPtr)vehicle; }
  114. // Accessors
  115. const OBBoxClass & Get_Zone( void ) const { return Zone; }
  116. const Matrix3D & Get_Ending_TM( void ) const { return EndingTM; }
  117. int Get_Ladder_Index( void ) { return LadderIndex; }
  118. void Set_Ladder_Index( int ladder_index ) { LadderIndex = ladder_index; }
  119. protected:
  120. Matrix3D EndingTM;
  121. OBBoxClass Zone;
  122. GameObjReference Vehicle;
  123. const TransitionDataClass & Data;
  124. int LadderIndex;
  125. };
  126. /*
  127. **
  128. */
  129. class TransitionManager {
  130. public:
  131. static void Reset( void );
  132. static void Add( TransitionInstanceClass * transition );
  133. static void Destroy( TransitionInstanceClass * transition );
  134. static void Destroy_Pending( void );
  135. static bool Check( SoldierGameObj *obj, bool action_trigger );
  136. static void Build_Ladder_List (DynamicVectorClass<TransitionInstanceClass *> &list);
  137. };
  138. #endif // TRANSITION_H