BULLET.H 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/BULLET.H 2 3/06/97 1:46p Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : BULLET.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : April 23, 1994 *
  26. * *
  27. * Last Update : April 23, 1994 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef BULLET_H
  33. #define BULLET_H
  34. #include "object.h"
  35. #include "fly.h"
  36. #include "fuse.h"
  37. class BulletClass : public ObjectClass,
  38. public FlyClass,
  39. public FuseClass
  40. {
  41. public:
  42. /*
  43. ** This specifies exactly what kind of bullet this is. All of the static attributes
  44. ** for this bullet is located in the BulletTypeClass pointed to by this variable.
  45. */
  46. CCPtr<BulletTypeClass> Class;
  47. private:
  48. /*
  49. ** Records who sent this "present" so that an appropriate "thank you" can
  50. ** be returned.
  51. */
  52. TechnoClass * Payback;
  53. /*
  54. ** This is the facing that the projectile is travelling.
  55. */
  56. FacingClass PrimaryFacing;
  57. public:
  58. /*---------------------------------------------------------------------
  59. ** Constructors, Destructors, and overloaded operators.
  60. */
  61. static void * operator new(size_t size);
  62. static void * operator new(size_t , void * ptr) {return(ptr);};
  63. static void operator delete(void *ptr);
  64. BulletClass(BulletType id, TARGET target, TechnoClass * Payback, int strength, WarheadType warhead, int speed);
  65. #ifdef FIXIT_MULTI_SAVE
  66. BulletClass(NoInitClass const & x) : ObjectClass(x), Class(x), FlyClass(x), FuseClass(x), PrimaryFacing(x) {};
  67. #else
  68. BulletClass(NoInitClass const & x) : ObjectClass(x), Class(x), FlyClass(x), FuseClass(x) {};
  69. #endif
  70. virtual ~BulletClass(void);
  71. operator BulletType(void) const {return Class->Type;};
  72. /*---------------------------------------------------------------------
  73. ** Member function prototypes.
  74. */
  75. static void Init(void);
  76. bool Is_Forced_To_Explode(COORDINATE & coord) const;
  77. void Bullet_Explodes(bool forced);
  78. int Shape_Number(void) const;
  79. virtual LayerType In_Which_Layer(void) const;
  80. virtual COORDINATE Sort_Y(void) const;
  81. virtual void Assign_Target(TARGET target) {TarCom = target;};
  82. virtual bool Unlimbo(COORDINATE , DirType facing = DIR_N);
  83. virtual ObjectTypeClass const & Class_Of(void) const {return *Class;};
  84. virtual void Detach(TARGET target, bool all);
  85. virtual void Draw_It(int x, int y, WindowNumberType window) const;
  86. virtual bool Mark(MarkType mark=MARK_CHANGE);
  87. virtual void AI(void);
  88. virtual short const * Occupy_List(bool = false) const;
  89. virtual short const * Overlap_List(void) const {return Occupy_List(false);};
  90. virtual COORDINATE Target_Coord(void) const;
  91. /*
  92. ** File I/O.
  93. */
  94. bool Load(Straw & file);
  95. bool Save(Pipe & file) const;
  96. virtual void Code_Pointers(void);
  97. virtual void Decode_Pointers(void);
  98. /*
  99. ** If this bullet is forced to be inaccurate because of some outside means. A tank
  100. ** firing while moving is a good example.
  101. */
  102. unsigned IsInaccurate:1;
  103. private:
  104. // Crude animation flag.
  105. unsigned IsToAnimate:1;
  106. /*
  107. ** Is this missile allowed to come in from out of bounds?
  108. */
  109. unsigned IsLocked:1;
  110. /*
  111. ** This is the target of the projectile. It is especially significant for those projectiles
  112. ** that home in on a target.
  113. */
  114. TARGET TarCom;
  115. /*
  116. ** The speed of this projectile.
  117. */
  118. int MaxSpeed;
  119. /*
  120. ** The warhead of this projectile.
  121. */
  122. WarheadType Warhead;
  123. /*
  124. ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load
  125. */
  126. unsigned char SaveLoadPadding[32];
  127. };
  128. #endif