ANIM.H (7387B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: /CounterStrike/ANIM.H 1 3/03/97 10:24a Joe_bostic $ */ 17 /*********************************************************************************************** 18 *** 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 *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : ANIM.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : May 30, 1994 * 28 * * 29 * Last Update : May 30, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef ANIM_H 36 #define ANIM_H 37 38 #include "type.h" 39 40 41 /********************************************************************************************** 42 ** This is the class that controls the shape animation objects. Shape animation objects are 43 ** displayed over the top of the game map. Typically, they are used for explosion and fire 44 ** effects. 45 */ 46 class AnimClass : public ObjectClass, public StageClass { 47 /* 48 ** This points to the type of animation object this is. 49 */ 50 CCPtr<AnimTypeClass> Class; 51 52 public: 53 54 AnimClass(AnimType animnum, COORDINATE coord, unsigned char timedelay=0, char loop=1); 55 AnimClass(NoInitClass const & x) : ObjectClass(x), Class(x), StageClass(x) {}; 56 virtual ~AnimClass(void); 57 58 operator AnimType(void) const {return Class->Type;}; 59 60 static void * operator new(size_t size); 61 static void * operator new(size_t , void * ptr) {return(ptr);}; 62 static void operator delete(void *ptr); 63 64 /*--------------------------------------------------------------------- 65 ** Member function prototypes. 66 */ 67 static void Init(void); 68 69 void Attach_To(ObjectClass *obj); 70 void Sort_Above(TARGET target); 71 void Make_Invisible(void) {IsInvisible = true;}; 72 void Make_Visible(void) {IsInvisible = false;}; 73 void Kill_At(unsigned long long kill_time) {KillTime = kill_time;} 74 static void Do_Atom_Damage(HousesType ownerhouse, CELL cell); 75 76 /* 77 ** 2019/09/19 JAS 78 ** Added functions for accessing which players can see this anim 79 */ 80 void Set_Visible_Flags(unsigned flags); 81 unsigned Get_Visible_Flags() const { return (Delay == 0) ? VisibleFlags : 0; } 82 83 virtual void Set_Owner(HousesType owner); 84 virtual HousesType Owner(void) const {return OwnerHouse;}; 85 virtual bool Can_Place_Here(COORDINATE ) const {return true;} 86 virtual bool Mark(MarkType mark=MARK_CHANGE); 87 virtual bool Render(bool forced) const; 88 virtual COORDINATE Center_Coord(void) const; 89 virtual COORDINATE Sort_Y(void) const; 90 virtual LayerType In_Which_Layer(void) const; 91 virtual ObjectTypeClass const & Class_Of(void) const {return *Class;}; 92 virtual short const * Occupy_List(bool = false) const; 93 virtual short const * Overlap_List(void) const; 94 virtual void Draw_It(int x, int y, WindowNumberType window) const; 95 virtual void AI(void); 96 virtual void Detach(TARGET target, bool all); 97 98 /* 99 ** File I/O. 100 */ 101 bool Load(Straw & file); 102 bool Save(FileClass & file); 103 104 /* 105 ** If this animation is attached to an object, then this points to that object. An 106 ** animation that is attached will follow that object as it moves. This is important 107 ** for animations such as flames and smoke. 108 */ 109 TARGET xObject; 110 111 /* 112 ** If specified, this animation uses the sort target for Y sorting 113 */ 114 TARGET SortTarget; 115 116 /* 117 ** If this animation has an owner, then it will be recorded here. An owner 118 ** is used when damage is caused by this animation during the middle of its 119 ** animation. 120 */ 121 HousesType OwnerHouse; 122 123 /* 124 ** This counter tells how many more times the animation should loop before it 125 ** terminates. 126 */ 127 char Loops; 128 129 protected: 130 void Middle(void); 131 void Start(void); 132 void Chain(void); 133 134 private: 135 /* 136 ** Delete this animation at the next opportunity. This is flagged when the 137 ** animation is to be prematurely ended as a result of some outside event. 138 */ 139 unsigned IsToDelete:1; 140 141 /* 142 ** If the animation has just been created, then don't do any animation 143 ** processing until it has been through the render loop at least once. 144 */ 145 unsigned IsBrandNew:1; 146 147 /* 148 ** If this animation is invisible, then this flag will be true. An invisible 149 ** animation is one that is created for the sole purpose of keeping all 150 ** machines synchronized. It will not be displayed. 151 */ 152 unsigned IsInvisible:1; 153 154 /* 155 ** 2019/09/19 JAS 156 ** Flags storing which players can see this anim. 157 */ 158 unsigned VisibleFlags; 159 160 /* 161 ** Is this animation in a temporary suspended state? If so, then it won't 162 ** be rendered until this value is zero. The flag will be set to false 163 ** after the first countdown timer reaches 0. 164 */ 165 int Delay; 166 167 /* 168 ** If this is an animation that damages whatever it is attached to, then this 169 ** value holds the accumulation of fractional damage points. When the accumulated 170 ** fractions reach 256, then one damage point is applied to the attached object. 171 */ 172 fixed Accum; 173 174 /* 175 ** The map layer this animation is in when attached to an object. 176 */ 177 LayerType AttachLayer; 178 179 /* 180 ** This references the virtual animation. 181 */ 182 TARGET VirtualAnimTarget; 183 184 /* 185 ** Real-time point to kill this animation. 186 */ 187 unsigned long long KillTime; 188 189 /* 190 ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load 191 */ 192 unsigned char SaveLoadPadding[24]; 193 }; 194 195 196 197 #endif