ABSTRACT.H 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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/ABSTRACT.H 1 3/03/97 10:24a 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 : ABSTRACT.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 01/26/95 *
  30. * *
  31. * Last Update : January 26, 1995 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef ABSTRACT_H
  37. #define ABSTRACT_H
  38. DirType Direction(CELL cell1, CELL cell2);
  39. DirType Direction(COORDINATE coord1, COORDINATE coord2);
  40. int Distance(COORDINATE coord1, COORDINATE coord2);
  41. COORDINATE As_Coord(TARGET target);
  42. class AbstractTypeClass;
  43. /*
  44. ** This class is the base class for all game objects that have an existence on the
  45. ** battlefield.
  46. */
  47. class AbstractClass
  48. {
  49. public:
  50. /*
  51. ** This specifies the type of object and the unique ID number
  52. ** associated with it. The ID number happens to match the index into
  53. ** the object heap appropriate for this object type.
  54. */
  55. RTTIType RTTI;
  56. int ID;
  57. /*
  58. ** The coordinate location of the unit. For vehicles, this is the center
  59. ** point. For buildings, it is the upper left corner.
  60. */
  61. COORDINATE Coord;
  62. /*
  63. ** This is the height of the object above ground (expressed in leptons).
  64. */
  65. int Height;
  66. /*
  67. ** The actual object ram-space is located in arrays in the data segment. This flag
  68. ** is used to indicate which objects are free to be reused and which are currently
  69. ** in use by the game.
  70. */
  71. unsigned IsActive:1;
  72. /*-----------------------------------------------------------------------------------
  73. ** Constructor & destructors.
  74. */
  75. AbstractClass(RTTIType rtti, int id) : RTTI(rtti), ID(id), Coord(0xFFFFFFFFL), Height(0) {};
  76. AbstractClass(NoInitClass const & x) {x();};
  77. virtual ~AbstractClass(void) {};
  78. /*
  79. ** Query functions.
  80. */
  81. virtual char const * Name(void) const {return("");}
  82. virtual HousesType Owner(void) const {return HOUSE_NONE;};
  83. TARGET As_Target(void) const {return(Build_Target(RTTI, ID));};
  84. RTTIType What_Am_I(void) const {return(RTTI);};
  85. /*
  86. ** Scenario and debug support.
  87. */
  88. #ifdef CHEAT_KEYS
  89. virtual void Debug_Dump(MonoClass * mono) const;
  90. #endif
  91. /*
  92. ** Coordinate query support functions.
  93. */
  94. virtual COORDINATE Center_Coord(void) const {return Coord;};
  95. virtual COORDINATE Target_Coord(void) const {return Coord;};
  96. /*
  97. ** Coordinate inquiry functions. These are used for both display and
  98. ** combat purposes.
  99. */
  100. DirType Direction(AbstractClass const * object) const {return ::Direction(Center_Coord(), object->Target_Coord());};
  101. DirType Direction(COORDINATE coord) const {return ::Direction(Center_Coord(), coord);};
  102. DirType Direction(TARGET target) const {return ::Direction(Center_Coord(), As_Coord(target));};
  103. DirType Direction(CELL cell) const {return ::Direction(Coord_Cell(Center_Coord()), cell);};
  104. int Distance(TARGET target) const;
  105. int Distance(COORDINATE coord) const {return ::Distance(Center_Coord(), coord);};
  106. int Distance(AbstractClass const * object) const {return ::Distance(Center_Coord(), object->Target_Coord());};
  107. /*
  108. ** Object entry and exit from the game system.
  109. */
  110. virtual MoveType Can_Enter_Cell(CELL , FacingType = FACING_NONE) const {return MOVE_OK;};
  111. /*
  112. ** AI.
  113. */
  114. virtual void AI(void) {};
  115. };
  116. #endif