BULLET.H 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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/BULLET.H 2 3/06/97 1:46p 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 : BULLET.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : April 23, 1994 *
  30. * *
  31. * Last Update : April 23, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef BULLET_H
  37. #define BULLET_H
  38. #include "object.h"
  39. #include "fly.h"
  40. #include "fuse.h"
  41. class BulletClass : public ObjectClass,
  42. public FlyClass,
  43. public FuseClass
  44. {
  45. public:
  46. /*
  47. ** This specifies exactly what kind of bullet this is. All of the static attributes
  48. ** for this bullet is located in the BulletTypeClass pointed to by this variable.
  49. */
  50. CCPtr<BulletTypeClass> Class;
  51. private:
  52. /*
  53. ** Records who sent this "present" so that an appropriate "thank you" can
  54. ** be returned.
  55. */
  56. TechnoClass * Payback;
  57. /*
  58. ** This is the facing that the projectile is travelling.
  59. */
  60. FacingClass PrimaryFacing;
  61. public:
  62. /*---------------------------------------------------------------------
  63. ** Constructors, Destructors, and overloaded operators.
  64. */
  65. static void * operator new(size_t size);
  66. static void * operator new(size_t , void * ptr) {return(ptr);};
  67. static void operator delete(void *ptr);
  68. BulletClass(BulletType id, TARGET target, TechnoClass * Payback, int strength, WarheadType warhead, int speed);
  69. #ifdef FIXIT_MULTI_SAVE
  70. BulletClass(NoInitClass const & x) : ObjectClass(x), Class(x), FlyClass(x), FuseClass(x), PrimaryFacing(x) {};
  71. #else
  72. BulletClass(NoInitClass const & x) : ObjectClass(x), Class(x), FlyClass(x), FuseClass(x) {};
  73. #endif
  74. virtual ~BulletClass(void);
  75. operator BulletType(void) const {return Class->Type;};
  76. /*---------------------------------------------------------------------
  77. ** Member function prototypes.
  78. */
  79. static void Init(void);
  80. bool Is_Forced_To_Explode(COORDINATE & coord) const;
  81. void Bullet_Explodes(bool forced);
  82. int Shape_Number(void) const;
  83. virtual LayerType In_Which_Layer(void) const;
  84. virtual COORDINATE Sort_Y(void) const;
  85. virtual void Assign_Target(TARGET target) {TarCom = target;};
  86. virtual bool Unlimbo(COORDINATE , DirType facing = DIR_N);
  87. virtual ObjectTypeClass const & Class_Of(void) const {return *Class;};
  88. virtual void Detach(TARGET target, bool all);
  89. virtual void Draw_It(int x, int y, WindowNumberType window) const;
  90. virtual bool Mark(MarkType mark=MARK_CHANGE);
  91. virtual void AI(void);
  92. virtual short const * Occupy_List(bool = false) const;
  93. virtual short const * Overlap_List(void) const {return Occupy_List(false);};
  94. virtual COORDINATE Target_Coord(void) const;
  95. /*
  96. ** File I/O.
  97. */
  98. bool Load(Straw & file);
  99. bool Save(Pipe & file) const;
  100. virtual void Code_Pointers(void);
  101. virtual void Decode_Pointers(void);
  102. /*
  103. ** If this bullet is forced to be inaccurate because of some outside means. A tank
  104. ** firing while moving is a good example.
  105. */
  106. unsigned IsInaccurate:1;
  107. private:
  108. // Crude animation flag.
  109. unsigned IsToAnimate:1;
  110. /*
  111. ** Is this missile allowed to come in from out of bounds?
  112. */
  113. unsigned IsLocked:1;
  114. /*
  115. ** This is the target of the projectile. It is especially significant for those projectiles
  116. ** that home in on a target.
  117. */
  118. TARGET TarCom;
  119. /*
  120. ** The speed of this projectile.
  121. */
  122. int MaxSpeed;
  123. /*
  124. ** The warhead of this projectile.
  125. */
  126. WarheadType Warhead;
  127. };
  128. #endif