W3DTruckDraw.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. ** Command & Conquer Generals(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. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: W3DTruckDraw.h ////////////////////////////////////////////////////////////////////////////
  24. // Draw a tank
  25. // Author: John Ahlquist, March 2002
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef _W3D_TRUCK_DRAW_H_
  29. #define _W3D_TRUCK_DRAW_H_
  30. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/DrawModule.h"
  32. #include "Common/AudioEventRTS.h"
  33. #include "GameClient/ParticleSys.h"
  34. #include "W3DDevice/GameClient/Module/W3DModelDraw.h"
  35. #include "WW3D2/HAnim.h"
  36. #include "WW3D2/RendObj.h"
  37. #include "WW3D2/Part_Emt.h"
  38. //-------------------------------------------------------------------------------------------------
  39. class W3DTruckDrawModuleData : public W3DModelDrawModuleData
  40. {
  41. public:
  42. AsciiString m_dustEffectName;
  43. AsciiString m_dirtEffectName;
  44. AsciiString m_powerslideEffectName;
  45. AsciiString m_frontLeftTireBoneName;
  46. AsciiString m_frontRightTireBoneName;
  47. AsciiString m_rearLeftTireBoneName;
  48. AsciiString m_rearRightTireBoneName;
  49. //4 extra tires to support up to 8 tires.
  50. AsciiString m_midFrontLeftTireBoneName;
  51. AsciiString m_midFrontRightTireBoneName;
  52. AsciiString m_midRearLeftTireBoneName;
  53. AsciiString m_midRearRightTireBoneName;
  54. //And some more
  55. AsciiString m_midMidLeftTireBoneName;
  56. AsciiString m_midMidRightTireBoneName;
  57. // Cab bone for a segmented truck.
  58. AsciiString m_cabBoneName;
  59. AsciiString m_trailerBoneName;
  60. Real m_cabRotationFactor;
  61. Real m_trailerRotationFactor;
  62. Real m_rotationDampingFactor;
  63. Real m_rotationSpeedMultiplier;
  64. Real m_powerslideRotationAddition;
  65. W3DTruckDrawModuleData();
  66. ~W3DTruckDrawModuleData();
  67. static void buildFieldParse(MultiIniFieldParse& p);
  68. };
  69. //-------------------------------------------------------------------------------------------------
  70. class W3DTruckDraw : public W3DModelDraw
  71. {
  72. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( W3DTruckDraw, "W3DTruckDraw" )
  73. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( W3DTruckDraw, W3DTruckDrawModuleData )
  74. public:
  75. W3DTruckDraw( Thing *thing, const ModuleData* moduleData );
  76. // virtual destructor prototype provided by memory pool declaration
  77. virtual void setHidden(Bool h);
  78. virtual void doDrawModule(const Matrix3D* transformMtx);
  79. virtual void setFullyObscuredByShroud(Bool fullyObscured);
  80. virtual void reactToGeometryChange() { }
  81. protected:
  82. virtual void onRenderObjRecreated(void);
  83. protected:
  84. Bool m_effectsInitialized;
  85. Bool m_wasAirborne;
  86. Bool m_isPowersliding;
  87. /// debris emitters for when tank is moving
  88. ParticleSystem* m_dustEffect;
  89. ParticleSystem* m_dirtEffect;
  90. ParticleSystem* m_powerslideEffect;
  91. Real m_frontWheelRotation;
  92. Real m_rearWheelRotation;
  93. Real m_midFrontWheelRotation;
  94. Real m_midRearWheelRotation;
  95. Int m_frontLeftTireBone;
  96. Int m_frontRightTireBone;
  97. Int m_rearLeftTireBone;
  98. Int m_rearRightTireBone;
  99. //4 extra tires to support up to 8 tires
  100. Int m_midFrontLeftTireBone;
  101. Int m_midFrontRightTireBone;
  102. Int m_midRearLeftTireBone;
  103. Int m_midRearRightTireBone;
  104. //And some more
  105. Int m_midMidLeftTireBone;
  106. Int m_midMidRightTireBone;
  107. Int m_cabBone;
  108. Real m_curCabRotation;
  109. Int m_trailerBone;
  110. Real m_curTrailerRotation;
  111. Int m_prevNumBones;
  112. AudioEventRTS m_powerslideSound;
  113. AudioEventRTS m_landingSound;
  114. RenderObjClass *m_prevRenderObj;
  115. void createEmitters( void ); ///< Create particle effects.
  116. void tossEmitters( void ); ///< Create particle effects.
  117. void enableEmitters( Bool enable ); ///< stop creating debris from the tank treads
  118. void updateBones( void );
  119. };
  120. #endif // _W3D_TRUCK_DRAW_H_