ANIM.H 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. ** Command & Conquer Red Alert(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. /* $Header: /CounterStrike/ANIM.H 1 3/03/97 10:24a Joe_bostic $ */
  19. /***********************************************************************************************
  20. *** 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 ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : ANIM.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : May 30, 1994 *
  30. * *
  31. * Last Update : May 30, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef ANIM_H
  37. #define ANIM_H
  38. #include "type.h"
  39. /**********************************************************************************************
  40. ** This is the class that controls the shape animation objects. Shape animation objects are
  41. ** displayed over the top of the game map. Typically, they are used for explosion and fire
  42. ** effects.
  43. */
  44. class AnimClass : public ObjectClass, public StageClass {
  45. /*
  46. ** This points to the type of animation object this is.
  47. */
  48. CCPtr<AnimTypeClass> Class;
  49. public:
  50. AnimClass(AnimType animnum, COORDINATE coord, unsigned char timedelay=0, unsigned char loop=1);
  51. AnimClass(NoInitClass const & x) : ObjectClass(x), Class(x), StageClass(x) {};
  52. virtual ~AnimClass(void);
  53. operator AnimType(void) const {return Class->Type;};
  54. static void * operator new(size_t size);
  55. static void * operator new(size_t , void * ptr) {return(ptr);};
  56. static void operator delete(void *ptr);
  57. /*---------------------------------------------------------------------
  58. ** Member function prototypes.
  59. */
  60. static void Init(void);
  61. void Attach_To(ObjectClass *obj);
  62. void Make_Invisible(void) {IsInvisible = true;};
  63. static void Do_Atom_Damage(HousesType ownerhouse, CELL cell);
  64. virtual bool Can_Place_Here(COORDINATE ) const {return true;}
  65. virtual bool Mark(MarkType mark=MARK_CHANGE);
  66. virtual bool Render(bool forced) const;
  67. virtual COORDINATE Center_Coord(void) const;
  68. virtual COORDINATE Sort_Y(void) const;
  69. virtual LayerType In_Which_Layer(void) const;
  70. virtual ObjectTypeClass const & Class_Of(void) const {return *Class;};
  71. virtual short const * Occupy_List(bool = false) const;
  72. virtual short const * Overlap_List(void) const;
  73. virtual void Draw_It(int x, int y, WindowNumberType window) const;
  74. virtual void AI(void);
  75. virtual void Detach(TARGET target, bool all);
  76. /*
  77. ** File I/O.
  78. */
  79. bool Load(Straw & file);
  80. bool Save(FileClass & file);
  81. /*
  82. ** If this animation is attached to an object, then this points to that object. An
  83. ** animation that is attached will follow that object as it moves. This is important
  84. ** for animations such as flames and smoke.
  85. */
  86. TARGET xObject;
  87. /*
  88. ** If this animation has an owner, then it will be recorded here. An owner
  89. ** is used when damage is caused by this animation during the middle of its
  90. ** animation.
  91. */
  92. HousesType OwnerHouse;
  93. /*
  94. ** This counter tells how many more times the animation should loop before it
  95. ** terminates.
  96. */
  97. unsigned char Loops;
  98. protected:
  99. void Middle(void);
  100. void Start(void);
  101. private:
  102. /*
  103. ** Delete this animation at the next opportunity. This is flagged when the
  104. ** animation is to be prematurely ended as a result of some outside event.
  105. */
  106. unsigned IsToDelete:1;
  107. /*
  108. ** If the animation has just been created, then don't do any animation
  109. ** processing until it has been through the render loop at least once.
  110. */
  111. unsigned IsBrandNew:1;
  112. /*
  113. ** If this animation is invisible, then this flag will be true. An invisible
  114. ** animation is one that is created for the sole purpose of keeping all
  115. ** machines synchronized. It will not be displayed.
  116. */
  117. unsigned IsInvisible:1;
  118. /*
  119. ** Is this animation in a temporary suspended state? If so, then it won't
  120. ** be rendered until this value is zero. The flag will be set to false
  121. ** after the first countdown timer reaches 0.
  122. */
  123. int Delay;
  124. /*
  125. ** If this is an animation that damages whatever it is attached to, then this
  126. ** value holds the accumulation of fractional damage points. When the accumulated
  127. ** fractions reach 256, then one damage point is applied to the attached object.
  128. */
  129. fixed Accum;
  130. };
  131. #endif