VESSEL.H 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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/VESSEL.H 1 3/03/97 10:26a 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 : VESSEL.H *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : 03/13/96 *
  26. * *
  27. * Last Update : March 13, 1996 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #ifndef VESSEL_H
  33. #define VESSEL_H
  34. #include "drive.h"
  35. #include "radio.h"
  36. #include "cargo.h"
  37. #include "mission.h"
  38. #include "target.h"
  39. class VesselClass : public DriveClass
  40. {
  41. public:
  42. /*
  43. ** This points to the controling static characteristic data associated with
  44. ** this vessel.
  45. */
  46. CCPtr<VesselTypeClass> Class;
  47. /*
  48. ** Has this sea vessel been told to move to a shipyard? If so, then
  49. ** when we get there, start the repair process.
  50. */
  51. unsigned IsToSelfRepair:1;
  52. /*
  53. ** Is this sea vessel parked next to a shipyard/subpen, and therefore
  54. ** in the special self-repair mode?
  55. */
  56. unsigned IsSelfRepairing:1;
  57. /*
  58. ** If this is an LST, is it time to shut the door?
  59. */
  60. CDTimerClass<FrameTimerClass> DoorShutCountDown;
  61. /*
  62. ** If this is a sub, has the sonar pulse worn off, such that we can
  63. ** re-submerge?
  64. */
  65. CDTimerClass<FrameTimerClass> PulseCountDown;
  66. VesselClass(VesselType classid, HousesType house);
  67. VesselClass(NoInitClass const & x) : DriveClass(x), Class(x), SecondaryFacing(x) {};
  68. static void * operator new(size_t size);
  69. static void * operator new(size_t , void * ptr) {return(ptr);};
  70. static void operator delete(void *ptr);
  71. operator VesselType(void) const {return Class->Type;};
  72. static void Init(void);
  73. virtual ~VesselClass(void);
  74. virtual ObjectTypeClass const & Class_Of(void) const;
  75. virtual MZoneType Zone_Check_Type(void) const {return(MZONE_WATER);}
  76. int Shape_Number(void) const;
  77. void Rotation_AI(void);
  78. void Combat_AI(void);
  79. bool Edge_Of_World_AI(void);
  80. void Repair_AI(void);
  81. virtual DirType Turret_Facing(void) const {if (Class->IsTurretEquipped) return(SecondaryFacing.Current());return(PrimaryFacing.Current());}
  82. virtual bool Start_Driver(COORDINATE & headto);
  83. virtual int Mission_Retreat(void);
  84. virtual int Mission_Unload(void);
  85. void LST_Open_Door(void);
  86. void LST_Close_Door(void);
  87. virtual FireDataType Fire_Data(int) const;
  88. virtual COORDINATE Fire_Coord(int which) const;
  89. virtual MoveType Can_Enter_Cell(CELL cell, FacingType from=FACING_NONE) const;
  90. virtual void Draw_It(int x, int y, WindowNumberType window) const;
  91. virtual short const * Overlap_List(bool redraw=false) const;
  92. virtual DirType Desired_Load_Dir(ObjectClass * passenger, CELL & moveto) const;
  93. virtual RadioMessageType Receive_Message(RadioClass * from, RadioMessageType message, long & param);
  94. virtual void AI(void);
  95. virtual void Per_Cell_Process(PCPType why);
  96. virtual void Assign_Destination(TARGET target);
  97. virtual int Pip_Count(void) const;
  98. virtual ResultType Take_Damage(int & damage, int distance, WarheadType warhead, TechnoClass * source=0, bool forced=false);
  99. virtual FireErrorType Can_Fire(TARGET target, int which) const;
  100. virtual void Enter_Idle_Mode(bool initial=false);
  101. virtual ActionType What_Action(ObjectClass const * object) const;
  102. virtual ActionType What_Action(CELL cell) const;
  103. virtual void Active_Click_With(ActionType action, CELL cell);
  104. virtual void Active_Click_With(ActionType action, ObjectClass * object);
  105. virtual TARGET Greatest_Threat(ThreatType threat) const;
  106. virtual bool Is_Allowed_To_Recloak(void) const;
  107. #ifdef FIXIT_CARRIER // checked - ajw 9/28/98
  108. virtual BulletClass * Fire_At(TARGET target, int which=0);
  109. #endif
  110. /*
  111. ** File I/O.
  112. */
  113. static void Read_INI(CCINIClass & ini);
  114. static void Write_INI(CCINIClass & ini);
  115. static char * INI_Name(void) {return "SHIPS";};
  116. bool Load(Straw & file);
  117. bool Save(Pipe & file) const;
  118. /*
  119. ** Scenario and debug support.
  120. */
  121. #ifdef CHEAT_KEYS
  122. virtual void Debug_Dump(MonoClass *mono) const;
  123. #endif
  124. protected:
  125. /*
  126. ** This is the facing of the turret. It can be, and usually is,
  127. ** rotated independently of the body it is attached to.
  128. */
  129. FacingClass SecondaryFacing;
  130. /*
  131. ** Some additional padding in case we need to add data to the class and maintain backwards compatibility for save/load
  132. */
  133. unsigned char SaveLoadPadding[32];
  134. };
  135. #endif