BULLET.H (6017B)
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: F:\projects\c&c\vcs\code\bullet.h_v 2.18 16 Oct 1995 16:47:40 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 : BULLET.H * 24 * * 25 * Programmer : Joe L. Bostic * 26 * * 27 * Start Date : April 23, 1994 * 28 * * 29 * Last Update : April 23, 1994 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef BULLET_H 36 #define BULLET_H 37 38 #include "object.h" 39 #include "fly.h" 40 #include "fuse.h" 41 42 43 class BulletClass : public ObjectClass, 44 public FlyClass, 45 public FuseClass 46 { 47 public: 48 49 /* 50 ** This specifies exactly what kind of bullet this is. All of the static attributes 51 ** for this bullet is located in the BulletTypeClass pointed to by this variable. 52 */ 53 BulletTypeClass const * const Class; 54 operator BulletType(void) const {return Class->Type;}; 55 56 /* 57 ** Records who sent this "present" so that an appropriate "thank you" can 58 ** be returned. 59 */ 60 TechnoClass * Payback; 61 62 /* 63 ** This is the facing that the projectile is travelling. 64 */ 65 FacingClass PrimaryFacing; 66 67 /*--------------------------------------------------------------------- 68 ** Constructors, Destructors, and overloaded operators. 69 */ 70 static void * BulletClass::operator new(size_t size); 71 static void BulletClass::operator delete(void *ptr); 72 BulletClass(void); 73 BulletClass(BulletType id); 74 virtual ~BulletClass(void) {if (GameActive) BulletClass::Limbo();}; 75 virtual RTTIType What_Am_I(void) const {return RTTI_BULLET;}; 76 77 /*--------------------------------------------------------------------- 78 ** Member function prototypes. 79 */ 80 static void Init(void); 81 82 virtual void Assign_Target(TARGET target) {TarCom = target;}; 83 virtual bool Unlimbo(COORDINATE , DirType facing = DIR_N); 84 virtual LayerType In_Which_Layer(void) const {return LAYER_TOP;}; 85 virtual ObjectTypeClass const & Class_Of(void) const {return *Class;}; 86 virtual void Detach(TARGET target, bool all); 87 virtual void Draw_It(int x, int y, WindowNumberType window); 88 virtual bool Mark(MarkType mark=MARK_CHANGE); 89 virtual void AI(void); 90 virtual short const * Occupy_List(void) const; 91 virtual short const * Overlap_List(void) const {return Occupy_List();}; 92 virtual TARGET As_Target(void) const; 93 94 /* 95 ** File I/O. 96 */ 97 bool Load(FileClass & file); 98 bool Save(FileClass & file); 99 virtual void Code_Pointers(void); 100 virtual void Decode_Pointers(void); 101 102 /* 103 ** Dee-buggin' support. 104 */ 105 int Validate(void) const; 106 107 /* 108 ** If this bullet is forced to be inaccurate because of some outside means. A tank 109 ** firing while moving is a good example. 110 */ 111 unsigned IsInaccurate:1; 112 113 private: 114 115 // Crude animation flag. 116 unsigned IsToAnimate:1; 117 118 /* 119 ** This is the height of the projectile. It starts at a low height, rises to an 120 ** apogee and then drops to explode upon impact. The height is used to render 121 ** the bullet's vertical offset. 122 */ 123 int Altitude; 124 125 /* 126 ** This is a modifier for the altitude that rises and falls in order to simulate 127 ** the arc of the projectile. This value is added to the height every game tick 128 ** while simultaneously being reduced itself. The net effect, is a rising 129 ** projectile that slows and then eventually drops. 130 */ 131 signed char Riser; 132 133 /* 134 ** This is the target of the projectile. It is especially significant for those projectiles 135 ** that home in on a target. 136 */ 137 TARGET TarCom; 138 139 /* 140 ** Is this missle allowed to come in from out of bounds? 141 */ 142 unsigned IsLocked:1; 143 144 /* 145 ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load 146 */ 147 unsigned char SaveLoadPadding[32]; 148 149 /* 150 ** This contains the value of the Virtual Function Table Pointer 151 */ 152 static void * VTable; 153 }; 154 155 #endif