RadiusDecal.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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: RadiusDecal.h ///////////////////////////////////////////////////////////////////////////////
  24. ///////////////////////////////////////////////////////////////////////////////////////////////////
  25. #pragma once
  26. #ifndef _RadiusDecal_H_
  27. #define _RadiusDecal_H_
  28. #include "Common/GameCommon.h"
  29. #include "Common/GameType.h"
  30. #include "GameClient/Color.h"
  31. enum ShadowType;
  32. class Player;
  33. class Shadow;
  34. class RadiusDecalTemplate;
  35. // ------------------------------------------------------------------------------------------------
  36. class RadiusDecal
  37. {
  38. friend class RadiusDecalTemplate;
  39. private:
  40. const RadiusDecalTemplate* m_template;
  41. Shadow* m_decal;
  42. Bool m_empty;
  43. public:
  44. RadiusDecal();
  45. RadiusDecal(const RadiusDecal& that);
  46. RadiusDecal& operator=(const RadiusDecal& that);
  47. ~RadiusDecal();
  48. void xferRadiusDecal( Xfer *xfer );
  49. // please note: it is very important, for game/net sync reasons, to ensure that
  50. // isEmpty() returns the same value, regardless of whether this decal will
  51. // be visible to the local player or not.
  52. Bool isEmpty() const { return m_empty; }
  53. void clear();
  54. void update();
  55. void setPosition(const Coord3D& pos);
  56. void setOpacity( const Real o );
  57. };
  58. // ------------------------------------------------------------------------------------------------
  59. class RadiusDecalTemplate
  60. {
  61. friend class RadiusDecal;
  62. private:
  63. AsciiString m_name;
  64. ShadowType m_shadowType;
  65. Real m_minOpacity;
  66. Real m_maxOpacity;
  67. UnsignedInt m_opacityThrobTime;
  68. Color m_color;
  69. Bool m_onlyVisibleToOwningPlayer;
  70. public:
  71. RadiusDecalTemplate();
  72. Bool valid() const { return m_name.isNotEmpty(); }
  73. void xferRadiusDecalTemplate( Xfer *xfer );
  74. // please note: it is very important, for game/net sync reasons, to ensure that
  75. // a valid radiusdecal is created, even if will not be visible to the local player,
  76. // since some logic makes decisions based on this.
  77. void createRadiusDecal(const Coord3D& pos, Real radius, const Player* owningPlayer, RadiusDecal& result) const;
  78. static void parseRadiusDecalTemplate(INI* ini, void *instance, void * store, const void* /*userData*/);
  79. };
  80. #endif