BULLET.H (5830B)
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/BULLET.H 2 3/06/97 1:46p 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 CCPtr<BulletTypeClass> Class; 54 55 private: 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 public: 68 69 /*--------------------------------------------------------------------- 70 ** Constructors, Destructors, and overloaded operators. 71 */ 72 static void * operator new(size_t size); 73 static void * operator new(size_t , void * ptr) {return(ptr);}; 74 static void operator delete(void *ptr); 75 BulletClass(BulletType id, TARGET target, TechnoClass * Payback, int strength, WarheadType warhead, int speed); 76 #ifdef FIXIT_MULTI_SAVE 77 BulletClass(NoInitClass const & x) : ObjectClass(x), Class(x), FlyClass(x), FuseClass(x), PrimaryFacing(x) {}; 78 #else 79 BulletClass(NoInitClass const & x) : ObjectClass(x), Class(x), FlyClass(x), FuseClass(x) {}; 80 #endif 81 virtual ~BulletClass(void); 82 operator BulletType(void) const {return Class->Type;}; 83 84 /*--------------------------------------------------------------------- 85 ** Member function prototypes. 86 */ 87 static void Init(void); 88 89 bool Is_Forced_To_Explode(COORDINATE & coord) const; 90 void Bullet_Explodes(bool forced); 91 int Shape_Number(void) const; 92 virtual LayerType In_Which_Layer(void) const; 93 virtual COORDINATE Sort_Y(void) const; 94 virtual void Assign_Target(TARGET target) {TarCom = target;}; 95 virtual bool Unlimbo(COORDINATE , DirType facing = DIR_N); 96 virtual ObjectTypeClass const & Class_Of(void) const {return *Class;}; 97 virtual void Detach(TARGET target, bool all); 98 virtual void Draw_It(int x, int y, WindowNumberType window) const; 99 virtual bool Mark(MarkType mark=MARK_CHANGE); 100 virtual void AI(void); 101 virtual short const * Occupy_List(bool = false) const; 102 virtual short const * Overlap_List(void) const {return Occupy_List(false);}; 103 virtual COORDINATE Target_Coord(void) const; 104 105 /* 106 ** File I/O. 107 */ 108 bool Load(Straw & file); 109 bool Save(Pipe & file) const; 110 virtual void Code_Pointers(void); 111 virtual void Decode_Pointers(void); 112 113 /* 114 ** If this bullet is forced to be inaccurate because of some outside means. A tank 115 ** firing while moving is a good example. 116 */ 117 unsigned IsInaccurate:1; 118 119 private: 120 // Crude animation flag. 121 unsigned IsToAnimate:1; 122 123 /* 124 ** Is this missile allowed to come in from out of bounds? 125 */ 126 unsigned IsLocked:1; 127 128 /* 129 ** This is the target of the projectile. It is especially significant for those projectiles 130 ** that home in on a target. 131 */ 132 TARGET TarCom; 133 134 /* 135 ** The speed of this projectile. 136 */ 137 int MaxSpeed; 138 139 /* 140 ** The warhead of this projectile. 141 */ 142 WarheadType Warhead; 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 #endif