stealtheffect.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : wwphys *
  23. * *
  24. * $Archive:: /Commando/Code/wwphys/stealtheffect.h $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 11/27/01 11:43a $*
  31. * *
  32. * $Revision:: 7 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #if defined(_MSC_VER)
  38. #pragma once
  39. #endif
  40. #ifndef STEALTHEFFECT_H
  41. #define STEALTHEFFECT_H
  42. #include "always.h"
  43. #include "materialeffect.h"
  44. #include "vector2.h"
  45. #include "matrixmapper.h"
  46. class ChunkSaveClass;
  47. class ChunkLoadClass;
  48. /**
  49. ** StealthEffectClass
  50. ** This material effect can manage and display "stealth" mode for an object.
  51. ** It has a requirement that the user "timestep" it each frame so that its internal
  52. ** state gets updated.
  53. */
  54. class StealthEffectClass : public MaterialEffectClass
  55. {
  56. public:
  57. StealthEffectClass(void);
  58. ~StealthEffectClass(void);
  59. virtual void Timestep(float dt);
  60. virtual void Render_Push(RenderInfoClass & rinfo,PhysClass * obj);
  61. virtual void Render_Pop(RenderInfoClass & rinfo);
  62. void Enable_Stealth(bool onoff);
  63. void Set_Friendly(bool onoff);
  64. void Set_Broken(bool onoff);
  65. bool Is_Stealth_Enabled(void) { return IsStealthEnabled; }
  66. bool Is_Friendly(void) { return IsFriendly; }
  67. bool Is_Broken(void) { return IsBroken; }
  68. bool Is_Stealthed(void) const { return CurrentFraction > 0.5f; }
  69. void Set_Fade_Distance(float d) { FadeDistance = d; }
  70. float Get_Fade_Distance(void) const { return FadeDistance; }
  71. void Set_Current_State( float percent ) { CurrentFraction = percent; }
  72. void Set_Target_State( float percent ) { TargetFraction = percent; }
  73. void Damage_Occured(void);
  74. /*
  75. ** Save-Load support
  76. */
  77. bool Save(ChunkSaveClass & csave);
  78. bool Load(ChunkLoadClass & cload);
  79. protected:
  80. void Update_Target_Fraction(void);
  81. bool IsStealthEnabled; // is stealth supposed to be turned on?
  82. bool IsFriendly; // is this object a friend of the player?
  83. bool IsBroken; // is this object's cloaking unit broken?
  84. float FadeDistance; // distance at which the effect fades completely out
  85. float CurrentFraction;
  86. float TargetFraction;
  87. Vector2 UVRate;
  88. // Render State
  89. bool RenderBaseMaterial;
  90. bool RenderStealthMaterial;
  91. float IntensityScale;
  92. Vector2 UVOffset;
  93. MatrixMapperClass * Mapper;
  94. MaterialPassClass * MaterialPass;
  95. };
  96. #endif //STEALTHEFFECT_H