TYPE.H 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024
  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/TYPE.H 1 3/03/97 10:26a 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 : TYPE.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : April 14, 1994 *
  30. * *
  31. * Last Update : April 14, 1994 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef TYPE_H
  37. #define TYPE_H
  38. #include "mission.h"
  39. #include "target.h"
  40. class MapEditClass;
  41. class HouseClass;
  42. class WeaponTypeClass;
  43. /***************************************************************************
  44. ** This is the abstract type class. It holds information common to all
  45. ** objects that might exist. This contains the name of the object type.
  46. */
  47. class AbstractTypeClass
  48. {
  49. public:
  50. /*
  51. ** This serves to identify the object class. The ID corresponds to the
  52. ** variation number (e.g., UNIT_TANK1, UNIT_TANK2, etc.).
  53. */
  54. RTTIType RTTI;
  55. int ID;
  56. /*
  57. ** This is the internal control name of the object. This name does
  58. ** not change regardless of language specified. This is the name
  59. ** used in scenario control files and for other text based unique
  60. ** identification purposes.
  61. */
  62. char IniName[24];
  63. /*
  64. ** The translated (language specific) text name number of this object.
  65. ** This number is used to fetch the object's name from the language
  66. ** text file. Whenever the name of the object needs to be displayed,
  67. ** this is used to determine the text string.
  68. */
  69. int FullName;
  70. AbstractTypeClass(RTTIType rtti, int id, int name, char const * ini);
  71. AbstractTypeClass(NoInitClass const & ) {};
  72. ~AbstractTypeClass(void) {};
  73. RTTIType What_Am_I(void) const {return(RTTI);};
  74. TARGET As_Target(void) const {return(Build_Target(RTTI, ID));};
  75. virtual COORDINATE Coord_Fixup(COORDINATE coord) const;
  76. virtual int Full_Name(void) const;
  77. char const * Name(void) const {return(IniName);}
  78. void Set_Name(char const * buf) const {
  79. strncpy((char *)IniName, buf, sizeof(IniName));
  80. ((char &)IniName[sizeof(IniName)-1]) = '\0';
  81. };
  82. virtual int Get_Ownable(void) const;
  83. void Code_Pointers(void) {}
  84. void Decode_Pointers(void) {}
  85. };
  86. /**********************************************************************
  87. ** Each house has certain unalienable characteristics. This structure
  88. ** elaborates these.
  89. */
  90. class HouseTypeClass : public AbstractTypeClass
  91. {
  92. public:
  93. /*
  94. ** This is the house number (enum). This is a unique identification
  95. ** number for the house.
  96. */
  97. HousesType House;
  98. /*
  99. ** This is the filename suffix to use when creating a house specific
  100. ** file name. It is three characters long.
  101. */
  102. char Suffix[_MAX_EXT];
  103. /*
  104. ** This is the "lemon percentage" to use when determining if a particular
  105. ** object owned by this house is to be flagged as a "lemon". Objects so
  106. ** flagged have a greater break-down chance. The percentage is expressed
  107. ** as a fixed point number with 0x000 meaning 0% and 0x100 meaning 100%.
  108. */
  109. unsigned Lemon;
  110. /*
  111. ** This points to the default remap table for this house.
  112. */
  113. PlayerColorType RemapColor;
  114. /*
  115. ** This is a unique ASCII character used when constructing filenames. It
  116. ** serves a similar purpose as the "Suffix" element, but is only one
  117. ** character long.
  118. */
  119. char Prefix;
  120. /*
  121. ** This controls the various general adjustments to the house owned
  122. ** unit and building ratings. The default value for these ratings is
  123. ** a fixed point number of 1.0.
  124. */
  125. fixed FirepowerBias;
  126. fixed GroundspeedBias;
  127. fixed AirspeedBias;
  128. fixed ArmorBias;
  129. fixed ROFBias;
  130. fixed CostBias;
  131. fixed BuildSpeedBias;
  132. //------------------------------------------------------------------------
  133. HouseTypeClass(NoInitClass const & x) : AbstractTypeClass(x) {}
  134. HouseTypeClass(HousesType house,
  135. char const * ini,
  136. int fullname,
  137. char const * ext,
  138. int lemon,
  139. PlayerColorType remapcolor,
  140. char prefix);
  141. unsigned char const * Remap_Table(void) const;
  142. static void * operator new(size_t);
  143. static void * operator new(size_t , void * ptr) {return(ptr);};
  144. static void operator delete(void * ptr);
  145. static HousesType From_Name(char const * name);
  146. static HouseTypeClass & As_Reference(HousesType house);
  147. static void One_Time(void);
  148. static void Init_Heap(void);
  149. virtual bool Read_INI(CCINIClass & ini);
  150. };
  151. /***************************************************************************
  152. ** This the the common base class of game objects. Since these values
  153. ** represent the unchanging object TYPES, this data is initialized at game
  154. ** start and not changed during play. It is "const" data.
  155. */
  156. class ObjectTypeClass : public AbstractTypeClass
  157. {
  158. public:
  159. /*
  160. ** This is the base name of the graphic data associated with this object
  161. ** type. If the graphic name is a null string, then there is no graphic
  162. ** associated with this object type.
  163. */
  164. char GraphicName[_MAX_FNAME];
  165. /*
  166. ** Is this object squashable by heavy vehicles? If it is, then the vehicle
  167. ** can travel over this object and destroy it in the process.
  168. */
  169. unsigned IsCrushable:1;
  170. /*
  171. ** Does this object type NOT show up on radar scans? If true, then in any
  172. ** radar display, only the underlying ground will be show, not this object.
  173. ** Most terrain falls into this category, but only a few special real units/buildings
  174. ** do.
  175. */
  176. unsigned IsStealthy:1;
  177. /*
  178. ** It is legal to "select" some objects in the game. If it is legal to select this
  179. ** object type then this flag will be true. Selected game objects typically display
  180. ** a floating health bar and allows special user I/O control.
  181. */
  182. unsigned IsSelectable:1;
  183. /*
  184. ** Can this object be the target of an attack or move command? Typically, only objects
  185. ** that take damage or can be destroyed are allowed to be a target.
  186. */
  187. unsigned IsLegalTarget:1;
  188. /*
  189. ** "Insignificant" objects will not be announced when they are destroyed or when they
  190. ** appear. Terrain elements and some lesser vehicles have this characteristic.
  191. */
  192. unsigned IsInsignificant:1;
  193. /*
  194. ** Is this object immune to normal combat damage? Rocks and other inert type terrain
  195. ** object are typically of this type.
  196. */
  197. unsigned IsImmune:1;
  198. /*
  199. ** "Sentient" objects are ones that have logic AI processing performed on them. All
  200. ** vehicles, buildings, infantry, and aircraft are so flagged. Terrain elements also
  201. ** fall under this category, but only because certain animation effects require this.
  202. */
  203. unsigned IsSentient:1;
  204. /*
  205. ** If this object type affects the occupation and collision logic associated with
  206. ** cells, then this flag will be true. Typically, this characteristic is limited
  207. ** to buildings, units, terrain objects, and landed aircraft.
  208. */
  209. unsigned IsFootprint:1;
  210. /*
  211. ** The defense of this object is greatly affected by the type of armor
  212. ** it possesses. This value specifies the type of armor.
  213. */
  214. ArmorType Armor;
  215. /*
  216. ** This is the maximum strength of this object type.
  217. */
  218. unsigned short MaxStrength;
  219. /*
  220. ** These point to the shape imagery for this object type. Since the shape imagery
  221. ** exists in a separate file, the data is filled in after this object is constructed.
  222. ** The "mutable" keyword allows easy modification to this otherwise const object.
  223. */
  224. void const * ImageData;
  225. /*
  226. ** Points to the dimension data for each shape in the image list. By using this
  227. ** data, the minimum number of cells will be redrawn when the object changes shape.
  228. */
  229. Rect * DimensionData;
  230. /*
  231. ** This points to the radar imagery for this object.
  232. */
  233. void const * RadarIcon;
  234. //--------------------------------------------------------------------
  235. ObjectTypeClass(NoInitClass const & x) : AbstractTypeClass(x) {}
  236. ObjectTypeClass( RTTIType rtti,
  237. int id,
  238. bool is_sentient,
  239. bool is_stealthy,
  240. bool is_selectable,
  241. bool is_legal_target,
  242. bool is_insignificant,
  243. bool is_immune,
  244. bool is_footprint,
  245. int fullname,
  246. char const * name
  247. );
  248. static void One_Time(void);
  249. bool Is_Foot(void) const {return(RTTI == RTTI_INFANTRYTYPE || RTTI == RTTI_UNITTYPE || RTTI == RTTI_VESSELTYPE || RTTI == RTTI_AIRCRAFTTYPE);};
  250. char const * Graphic_Name(void) const {if (GraphicName[0] != '\0') return(GraphicName); return(Name());}
  251. virtual int Max_Pips(void) const;
  252. virtual void Dimensions(int &width, int &height) const;
  253. virtual bool Create_And_Place(CELL , HousesType =HOUSE_NONE) const = 0;
  254. virtual int Cost_Of(void) const;
  255. virtual int Time_To_Build(void) const;
  256. virtual ObjectClass * Create_One_Of(HouseClass *) const = 0;
  257. virtual short const * Occupy_List(bool placement=false) const;
  258. virtual short const * Overlap_List(void) const;
  259. virtual BuildingClass * Who_Can_Build_Me(bool intheory, bool legal, HousesType house) const;
  260. virtual void const * Get_Cameo_Data(void) const;
  261. void const * Get_Image_Data(void) const {return ImageData;};
  262. void const * Get_Radar_Data(void) const {return RadarIcon;};
  263. #ifdef SCENARIO_EDITOR
  264. virtual void Display(int, int, WindowNumberType, HousesType) const {};
  265. #endif
  266. static void const * SelectShapes;
  267. static void const * PipShapes;
  268. };
  269. /***************************************************************************
  270. ** This class is the common data for all objects that can be owned, produced,
  271. ** or delivered as reinforcements. These are objects that typically contain
  272. ** crews and weapons -- the fighting objects of the game.
  273. */
  274. class TechnoTypeClass : public ObjectTypeClass
  275. {
  276. public:
  277. /*
  278. ** This controls how this object type is remapped when it is displayed
  279. ** in the sidebar.
  280. */
  281. RemapType Remap;
  282. /*
  283. ** Is this object ownable by all sides in a multiplayer game? There are some
  284. ** special case objects that need this override ability.
  285. */
  286. unsigned IsDoubleOwned:1;
  287. /*
  288. ** If this object should be completely and always invisible to the enemy, then
  289. ** this flag will be true.
  290. */
  291. unsigned IsInvisible:1;
  292. /*
  293. ** If this object can serve as a good leader for a group selected
  294. ** series of objects, then this flag will be true. Unarmed or
  295. ** ability challenged units do not make good leaders. This flag is
  296. ** also used to indicate the primary factory when dealing with
  297. ** buildings.
  298. */
  299. unsigned IsLeader:1;
  300. /*
  301. ** Does this object have the ability to detect the presence of a nearby
  302. ** cloaked object?
  303. */
  304. unsigned IsScanner:1;
  305. /*
  306. ** If this object is always given its proper name rather than a generic
  307. ** name, then this flag will be true. Typically, civilians and Dr. Moebius
  308. ** fall under this category.
  309. */
  310. unsigned IsNominal:1;
  311. /*
  312. ** If the artwork for this object (only for generics) is theater specific, then
  313. ** this flag will be true. Civilian buildings are a good example of this.
  314. */
  315. unsigned IsTheater:1;
  316. /*
  317. ** Does this object type contain a rotating turret? Gun emplacements, SAM launchers,
  318. ** and many vehicles contain a turret. If a turret is present, special rendering and
  319. ** combat logic must be performed.
  320. */
  321. unsigned IsTurretEquipped:1;
  322. /*
  323. ** Certain objects can be repaired. For buildings, they repair "in place". For units,
  324. ** they must travel to a repair center to be repaired. If this flag is true, then
  325. ** allow the player or computer AI to repair the object.
  326. */
  327. unsigned IsRepairable:1;
  328. /*
  329. ** Does this object contain a crew? If it does, then when the object is destroyed, there
  330. ** is a distinct possibility that infantry will "pop out". Only units with crews can
  331. ** become "heros".
  332. */
  333. unsigned IsCrew:1;
  334. /*
  335. ** This tells whether this unit should EVER be remapped when it is displayed
  336. ** on the tactical map. Normally, the unit is remapped, but for certain civilian
  337. ** object, remapping is not to be performed, regardless of owner.
  338. */
  339. unsigned IsRemappable:1;
  340. /*
  341. ** Is the unit capable of cloaking? Only Stealth Tank can do so now.
  342. */
  343. unsigned IsCloakable:1;
  344. /*
  345. ** Can this object self heal up to half strength? Mammoth tanks from C&C had this
  346. ** feature.
  347. */
  348. unsigned IsSelfHealing:1;
  349. /*
  350. ** If this object explodes violently when destroyed, then this flag will be true.
  351. ** The type of explosion is based on the warhead type and the damage generated
  352. ** corresponds to the full strength of the object.
  353. */
  354. unsigned IsExploding:1;
  355. /*
  356. ** This specifies the zone that an object of this type should recognize. Zones
  357. ** of this type or lower will be considered "possible to travel to".
  358. */
  359. MZoneType MZone;
  360. /*
  361. ** When determining threat, the range can be overridden to be the value
  362. ** specified here. Otherwise, the range for enemy scan is equal to the
  363. ** longest weapon range the object has. If the value is zero, then the
  364. ** weapon range is used.
  365. */
  366. LEPTON ThreatRange;
  367. /*
  368. ** If this is a transporter object (e.g., hovercraft, chinook, APC), then this
  369. ** value specifies the maximum number of passengers it may carry.
  370. */
  371. int MaxPassengers;
  372. /*
  373. ** Most objects have the ability to reveal the terrain around themselves.
  374. ** This sight range (expressed in cell distance) is specified here. If
  375. ** this value is 0, then this unit never reveals terrain. Bullets are
  376. ** typically of this nature.
  377. */
  378. int SightRange;
  379. /*
  380. ** This is the credit cost to produce this object (presuming production is
  381. ** allowed).
  382. */
  383. int Cost;
  384. /*
  385. ** The tech level that this object can be produced at.
  386. */
  387. unsigned Level;
  388. /*
  389. ** This specifies the building prerequisites required before an object
  390. ** of this type can be produced.
  391. */
  392. long Prerequisite;
  393. /*
  394. ** The risk and reward values are used to determine targets and paths
  395. ** toward targets. When heading toward a target, a path of least
  396. ** risk will be followed. When picking a target, the object of
  397. ** greatest reward will be selected. The values assigned are
  398. ** arbitrary.
  399. */
  400. int Risk,Reward;
  401. /*
  402. ** This value indicates the maximum speed that this object can achieve.
  403. */
  404. MPHType MaxSpeed;
  405. /*
  406. ** This indicates the speed (locomotion) type for this unit. Through this
  407. ** value the movement capabilities are deduced.
  408. */
  409. SpeedType Speed;
  410. /*
  411. ** This is the maximum number of ammo shots this object can hold. If
  412. ** this number is -1, then this indicates unlimited ammo.
  413. */
  414. int MaxAmmo;
  415. /*
  416. ** This is a bit field representing the houses that are allowed to
  417. ** own (by normal means) this particular object type. This value is
  418. ** typically used in production contexts. It is possible for a side
  419. ** to take possession of an object type otherwise not normally allowed.
  420. ** This event usually occurs as a result of capture.
  421. */
  422. long Ownable;
  423. /*
  424. ** This is the small icon image that is used to display the object in
  425. ** the sidebar for construction selection purposes.
  426. */
  427. void const * CameoData;
  428. /*
  429. ** The number of animation frames allotted to rotation is specified here.
  430. ** For an object that has no rotation, this value will be 1. For normal
  431. ** vehicles this value will be 32. There are some special case units that
  432. ** have intermediate rotation frames.
  433. */
  434. int Rotation;
  435. /*
  436. ** This is the rotational speed of the object. This value represents the
  437. ** turret or body rotation speed expresses as 360/256ths rotation steps per
  438. ** game tick.
  439. */
  440. int ROT;
  441. /*
  442. ** These are the weapons that this techno object is armed with.
  443. */
  444. WeaponTypeClass const * PrimaryWeapon;
  445. WeaponTypeClass const * SecondaryWeapon;
  446. /*
  447. ** These specify the lepton offsets to locate the exact coordinate of the
  448. ** 'tip of the barrel' for the weapon. This is used for generating the bullet
  449. ** at the proper location.
  450. */
  451. int VerticalOffset; // Distance to move north (compensates for perspective).
  452. int PrimaryOffset; // Offset along turret centerline and facing.
  453. int PrimaryLateral; // Sideways offset from turret centerline and facing.
  454. int SecondaryOffset;
  455. int SecondaryLateral;
  456. /*
  457. ** Points you're awarded for destroying an object of this type, and
  458. ** points you lose if you lose an object of this type.
  459. */
  460. int Points;
  461. //--------------------------------------------------------------------
  462. TechnoTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {}
  463. TechnoTypeClass(
  464. RTTIType rtti,
  465. int id,
  466. int name,
  467. char const * ininame,
  468. RemapType remap,
  469. int verticaloffset,
  470. int primaryoffset,
  471. int primarylateral,
  472. int secondaryoffset,
  473. int secondarylateral,
  474. bool is_nominal,
  475. bool is_stealthy,
  476. bool is_selectable,
  477. bool is_legal_target,
  478. bool is_insignificant,
  479. bool is_immune,
  480. bool is_theater,
  481. bool is_turret_equipped,
  482. bool is_remappable,
  483. bool is_footprint,
  484. int rotation,
  485. SpeedType speed
  486. );
  487. bool Is_Two_Shooter(void) const;
  488. int Legal_Placement(CELL pos) const;
  489. virtual int Raw_Cost(void) const;
  490. virtual int Max_Passengers(void) const {return(MaxPassengers);}
  491. virtual int Repair_Cost(void) const;
  492. virtual int Repair_Step(void) const;
  493. virtual void const * Get_Cameo_Data(void) const;
  494. virtual int Cost_Of(void) const;
  495. virtual int Time_To_Build(void) const;
  496. virtual int Get_Ownable(void) const;
  497. virtual bool Read_INI(CCINIClass & ini);
  498. /*
  499. ** This is a pointer to the wake shape (as needed by the gunboat).
  500. */
  501. static void const * WakeShapes;
  502. static void const * TurretShapes;
  503. static void const * SamShapes;
  504. static void const * MGunShapes;
  505. };
  506. /***************************************************************************
  507. ** Building types need some special information custom to buildings. This
  508. ** is a derived class that elaborates these additional data elements.
  509. */
  510. class BuildingTypeClass : public TechnoTypeClass {
  511. public:
  512. /*
  513. ** Is this building allowed to be considered for building adjacency
  514. ** checking? If false, then building off of (or adjacent to) this building
  515. ** is not considered.
  516. */
  517. unsigned IsBase:1;
  518. /*
  519. ** If this building is a fake, this flag will be set.
  520. */
  521. unsigned IsFake:1;
  522. /*
  523. ** This flag controls whether the building is equiped with a dirt
  524. ** bib or not. A building with a bib has a dirt patch automatically
  525. ** attached to the structure when it is placed.
  526. */
  527. unsigned IsBibbed:1;
  528. /*
  529. ** If this building is a special wall type, such that it exists as a building
  530. ** for purposes of construction but transforms into an overlay wall object when
  531. ** it is placed on the map, then this flag will be true.
  532. */
  533. unsigned IsWall:1;
  534. /*
  535. ** Buildings can have either simple or complex damage stages. If simple,
  536. ** then the second to the last frame is the half damage stage, and the last
  537. ** frame is the complete damage stage. For non-simple damage, buildings
  538. ** have a complete animation set for damaged as well as undamaged condition.
  539. ** Turrets, oil pumps, and repair facilities are a few examples.
  540. */
  541. unsigned IsSimpleDamage:1;
  542. /*
  543. ** Certain building types can be captures by enemy infantry. For those
  544. ** building types, this flag will be true. Typically, military or hardened
  545. ** structures such as turrets cannot be captured.
  546. */
  547. unsigned IsCaptureable:1;
  548. /*
  549. ** If this building really only has cosmetic idle animation, then this flag will be
  550. ** true if this animation should run at a relatively constant rate regardless of game
  551. ** speed setting.
  552. */
  553. unsigned IsRegulated:1;
  554. /*
  555. ** Does this building require power to function? Usually, this isn't the case. The building
  556. ** normally either has no effect by power level or is gradually reduced in effectiveness. This
  557. ** flag is for those buildings that completely cease to function when the power drops below
  558. ** full.
  559. */
  560. unsigned IsPowered:1;
  561. /*
  562. ** If this flag is true, then the building cannot be sold even if it could have been built. This
  563. ** is especially useful for mines which can be built but cannot be sold.
  564. */
  565. unsigned IsUnsellable:1;
  566. /*
  567. ** This is the direction (from the center cell) of the building in order to find a
  568. ** legitimate foundation square. This location will be used for targeting and capture
  569. ** move destination purposes.
  570. */
  571. FacingType FoundationFace;
  572. /*
  573. ** Adjacent distance for building next to.
  574. */
  575. int Adjacent;
  576. /*
  577. ** This flag specifies the type of object this factory building can "produce". For non
  578. ** factory buildings, this value will be RTTI_NONE.
  579. */
  580. RTTIType ToBuild;
  581. /*
  582. ** For building that produce ground units (infantry and vehicles), there is a default
  583. ** exit point defined. This point is where the object is first placed on the map.
  584. ** Typically, this is located next to a door. The unit will then travel on to a clear
  585. ** terrain area and enter normal game processing.
  586. */
  587. COORDINATE ExitCoordinate;
  588. /*
  589. ** When determine which cell to head toward when exiting a building, use the
  590. ** list elaborated by this variable. There are directions of exit that are
  591. ** more suitable than others. This list is here to inform the system which
  592. ** directions those are.
  593. */
  594. short const * ExitList;
  595. /*
  596. ** This is the structure type identifier. It can serve as a unique
  597. ** identification number for building types.
  598. */
  599. StructType Type;
  600. /*
  601. ** This is the starting facing to give this building when it first
  602. ** gets constructed. The facing matches the final stage of the
  603. ** construction animation.
  604. */
  605. DirType StartFace;
  606. /*
  607. ** This is the Tiberium storage capacity of the building. The sum of all
  608. ** building's storage capacity is used to determine how much Tiberium can
  609. ** be accumulated.
  610. */
  611. int Capacity;
  612. /*
  613. ** Each building type produces and consumes power. These values tell how
  614. ** much.
  615. */
  616. int Power;
  617. int Drain;
  618. /*
  619. ** This is the size of the building. This size value is a rough indication
  620. ** of the building's "footprint".
  621. */
  622. BSizeType Size;
  623. /**********************************************************************
  624. ** For each stage that a building may be in, its animation is controlled
  625. ** by this structure. It dictates the starting and length of the animation
  626. ** frames needed for the specified state. In addition it specifies how long
  627. ** to delay between changes in animation. With this data it is possible to
  628. ** control the appearance of all normal buildings. Turrets and SAM sites are
  629. ** an exception since their animation is not merely cosmetic.
  630. */
  631. typedef struct {
  632. int Start; // Starting frame of animation.
  633. int Count; // Number of frames in this animation.
  634. int Rate; // Number of ticks to delay between each frame.
  635. } AnimControlType;
  636. AnimControlType Anims[BSTATE_COUNT];
  637. /*---------------------------------------------------------------------------
  638. ** This is the building type explicit constructor.
  639. */
  640. BuildingTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {}
  641. BuildingTypeClass (
  642. StructType type,
  643. int name,
  644. char const * ininame,
  645. FacingType foundation,
  646. COORDINATE exitpoint,
  647. RemapType remap,
  648. int verticaloffset,
  649. int primaryoffset,
  650. int primarylateral,
  651. bool is_fake,
  652. bool is_regulated,
  653. bool is_nominal,
  654. bool is_wall,
  655. bool is_simpledamage,
  656. bool is_stealthy,
  657. bool is_selectable,
  658. bool is_legal_target,
  659. bool is_insignificant,
  660. bool is_theater,
  661. bool is_turret_equipped,
  662. bool is_remappable,
  663. RTTIType tobuild,
  664. DirType sframe,
  665. BSizeType size,
  666. short const * exitlist,
  667. short const * sizelist,
  668. short const * overlap
  669. );
  670. operator StructType(void) const {return(Type);};
  671. static void * operator new(size_t);
  672. static void * operator new(size_t , void * ptr) {return(ptr);};
  673. static void operator delete(void * ptr);
  674. static void Init_Heap(void);
  675. static BuildingTypeClass & As_Reference(StructType type);
  676. static StructType From_Name(char const * name);
  677. static void Init(TheaterType theater);
  678. static void One_Time(void);
  679. static void Prep_For_Add(void);
  680. int Width(void) const;
  681. int Height(bool bib=false) const;
  682. virtual int Full_Name(void) const;
  683. virtual bool Read_INI(CCINIClass & ini);
  684. bool Flush_For_Placement(CELL cell, HouseClass * house) const;
  685. virtual int Cost_Of(void) const;
  686. virtual COORDINATE Coord_Fixup(COORDINATE coord) const;
  687. virtual int Max_Pips(void) const;
  688. virtual void Dimensions(int &width, int &height) const;
  689. virtual bool Create_And_Place(CELL cell, HousesType house) const;
  690. virtual ObjectClass * Create_One_Of(HouseClass * house) const;
  691. virtual short const * Occupy_List(bool placement=false) const;
  692. virtual short const * Overlap_List(void) const;
  693. virtual void const * Get_Buildup_Data(void) const {return(BuildupData);};
  694. bool Is_Factory(void) const {return(ToBuild != RTTI_NONE);}
  695. virtual int Raw_Cost(void) const;
  696. bool Bib_And_Offset(SmudgeType & bib, CELL & cell) const;
  697. #ifdef SCENARIO_EDITOR
  698. virtual void Display(int x, int y, WindowNumberType window, HousesType house) const;
  699. #endif
  700. /*
  701. ** Special overlay for the weapons factory.
  702. */
  703. static void const * WarFactoryOverlay;
  704. private:
  705. /*
  706. ** This is a pointer to a list of offsets (from the upper left corner) that
  707. ** are used to indicate the building's "footprint". This footprint is used
  708. ** to determine building placement legality and terrain passibility.
  709. */
  710. short const * OccupyList;
  711. /*
  712. ** Buildings can often times overlap a cell but not actually "occupy" it for
  713. ** purposes of movement. This points to a list of offsets that indicate which
  714. ** cells the building has visual overlap but does not occupy.
  715. */
  716. short const * OverlapList;
  717. /*
  718. ** The construction animation graphic data pointer is
  719. ** pointed to by this element.
  720. */
  721. void const * BuildupData;
  722. void Init_Anim(BStateType state, int start, int count, int rate) const;
  723. };
  724. /***************************************************************************
  725. ** The various unit types need specific data that is unique to units as
  726. ** opposed to buildings. This derived class elaborates these additional
  727. ** data types.
  728. */
  729. class UnitTypeClass : public TechnoTypeClass
  730. {
  731. public:
  732. /*
  733. ** If this unit can appear out of a crate, then this flag will be true.
  734. */
  735. unsigned IsCrateGoodie:1;
  736. /*
  737. ** Can this unit squash infantry? If it can then if the player selects
  738. ** an (enemy) infantry unit as the movement target, it will ride over and
  739. ** squish the infantry unit.
  740. */
  741. unsigned IsCrusher:1;
  742. /*
  743. ** Does this unit go into harvesting mode when it stops on a tiberium
  744. ** field? Typically, only one unit does this and that is the harvester.
  745. */
  746. unsigned IsToHarvest:1;
  747. /*
  748. ** Some units are equipped with a rotating radar dish. These units have special
  749. ** animation processing. The rotating radar dish is similar to a turret, but
  750. ** always rotates and does not affect combat.
  751. */
  752. unsigned IsRadarEquipped:1;
  753. /*
  754. ** If this unit has a firing animation, this flag is true. Infantry and some special
  755. ** vehicles are the ones with firing animations.
  756. */
  757. unsigned IsFireAnim:1;
  758. /*
  759. ** Many vehicles have a turret with restricted motion. These vehicles must move the
  760. ** turret into a locked down position while travelling. Rocket launchers and artillery
  761. ** are good examples of this kind of unit.
  762. */
  763. unsigned IsLockTurret:1;
  764. /*
  765. ** Is this unit of the humongous size? Harvesters and mobile construction vehicles are
  766. ** of this size. If the vehicle is greater than 24 x 24 but less than 48 x 48, it is
  767. ** considered "Gigundo".
  768. */
  769. unsigned IsGigundo:1;
  770. /*
  771. ** Does this unit have a constant animation (like Visceroid?)
  772. */
  773. unsigned IsAnimating:1;
  774. /*
  775. ** Does this unit have the ability to jam radar facilities?
  776. */
  777. unsigned IsJammer:1;
  778. /*
  779. ** Is this unit a mobile gap generator?
  780. */
  781. unsigned IsGapper:1;
  782. /*
  783. ** If this unit cannot fire while moving, then this flag will be
  784. ** true. Such a unit must stop and stabilize for a bit before it
  785. ** can fire.
  786. */
  787. unsigned IsNoFireWhileMoving:1;
  788. /*
  789. ** This value represents the unit class. It can serve as a unique
  790. ** identification number for this unit class.
  791. */
  792. UnitType Type;
  793. /*
  794. ** This is the distance along the centerline heading in the direction the body
  795. ** is facing used to reach the center point of the turret. This distance is
  796. ** in leptons.
  797. */
  798. signed char TurretOffset;
  799. /*
  800. ** This value is used to provide the unit with a default mission order when
  801. ** first created. Usually, this is a resting or idle type of order.
  802. */
  803. MissionType Mission;
  804. /*
  805. ** This is the default explosion to use when this vehicle is destroyed.
  806. */
  807. AnimType Explosion;
  808. /*
  809. ** The width or height of the largest dimension for this unit.
  810. */
  811. int MaxSize;
  812. /*
  813. ** This is the explicit unit class constructor.
  814. */
  815. UnitTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {}
  816. UnitTypeClass (
  817. UnitType type,
  818. int name,
  819. char const * ininame,
  820. AnimType exp,
  821. RemapType remap,
  822. int verticaloffset,
  823. int primaryoffset,
  824. int primarylateral,
  825. int secondaryoffset,
  826. int secondarylateral,
  827. bool is_goodie,
  828. bool is_nominal,
  829. bool is_crusher,
  830. bool is_harvest,
  831. bool is_stealthy,
  832. bool is_insignificant,
  833. bool is_turret_equipped,
  834. bool is_radar_equipped,
  835. bool is_fire_anim,
  836. bool is_lock_turret,
  837. bool is_gigundo,
  838. bool is_animating,
  839. bool is_jammer,
  840. bool is_gapper,
  841. int rotation,
  842. int toffset,
  843. MissionType order
  844. );
  845. static void * operator new(size_t);
  846. static void * operator new(size_t , void * ptr) {return(ptr);};
  847. static void operator delete(void * ptr);
  848. static void Init_Heap(void);
  849. static UnitType From_Name(char const * name);
  850. static UnitTypeClass & As_Reference(UnitType type);
  851. static void Init(TheaterType ) {};
  852. static void One_Time(void);
  853. static void Prep_For_Add(void);
  854. virtual bool Read_INI(CCINIClass & ini);
  855. virtual void Dimensions(int &width, int &height) const;
  856. virtual bool Create_And_Place(CELL cell, HousesType house) const;
  857. virtual ObjectClass * Create_One_Of(HouseClass * house) const;
  858. virtual int Max_Pips(void) const;
  859. void Turret_Adjust(DirType dir, int & x, int & y) const;
  860. #ifdef SCENARIO_EDITOR
  861. virtual void Display(int x, int y, WindowNumberType window, HousesType house) const;
  862. #endif
  863. /*
  864. ** The animation stage list for harvester dumping into the refinery.
  865. */
  866. static const int Harvester_Dump_List[22];
  867. /*
  868. ** The animatino stage list for harvester loading up on ore.
  869. */
  870. static const int Harvester_Load_List[9];
  871. /*
  872. ** The number of animation stages when the harvester is loading
  873. ** up on ore in the field.
  874. */
  875. static const int Harvester_Load_Count;
  876. };
  877. /***************************************************************************
  878. ** This specifies the constant attribute data associated with naval
  879. ** vessels.
  880. */
  881. class VesselTypeClass : public TechnoTypeClass
  882. {
  883. public:
  884. /*
  885. ** Does this unit have only 8 facings? Special test units have limited
  886. ** facings.
  887. */
  888. unsigned IsPieceOfEight:1;
  889. /*
  890. ** This value represents the unit class. It can serve as a unique
  891. ** identification number for this unit class.
  892. */
  893. VesselType Type;
  894. /*
  895. ** This is the distance along the centerline heading in the direction the body
  896. ** is facing used to reach the center point of the turret. This distance is
  897. ** in leptons.
  898. */
  899. signed char TurretOffset;
  900. /*
  901. ** This value is used to provide the unit with a default mission order when
  902. ** first created. Usually, this is a resting or idle type of order.
  903. */
  904. MissionType Mission;
  905. /*
  906. ** This is the default explosion to use when this vehicle is destroyed.
  907. */
  908. AnimType Explosion;
  909. /*
  910. ** The width or height of the largest dimension for this unit.
  911. */
  912. int MaxSize;
  913. /*
  914. ** This is the explicit unit class constructor.
  915. */
  916. VesselTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {}
  917. VesselTypeClass (
  918. VesselType type,
  919. int name,
  920. char const * ininame,
  921. AnimType exp,
  922. int verticaloffset,
  923. int primaryoffset,
  924. int primarylateral,
  925. int secondaryoffset,
  926. int secondarylateral,
  927. bool is_eight,
  928. bool is_nominal,
  929. bool is_turret_equipped,
  930. int rotation,
  931. int toffset
  932. );
  933. static void * operator new(size_t);
  934. static void * operator new(size_t , void * ptr) {return(ptr);};
  935. static void operator delete(void * ptr);
  936. static void Init_Heap(void);
  937. static VesselType From_Name(char const * name);
  938. static VesselTypeClass & As_Reference(VesselType type);
  939. static void Init(TheaterType ) {};
  940. static void One_Time(void);
  941. static void Prep_For_Add(void);
  942. virtual void Dimensions(int &width, int &height) const;
  943. virtual bool Create_And_Place(CELL cell, HousesType house) const;
  944. virtual ObjectClass * Create_One_Of(HouseClass * house) const;
  945. virtual int Max_Pips(void) const;
  946. virtual short const * Overlap_List(void) const;
  947. void Turret_Adjust(DirType dir, int & x, int & y) const;
  948. #ifdef SCENARIO_EDITOR
  949. virtual void Display(int x, int y, WindowNumberType window, HousesType house) const;
  950. #endif
  951. };
  952. /***************************************************************************
  953. ** The various unit types need specific data that is unique to units as
  954. ** opposed to buildings. This derived class elaborates these additional
  955. ** data types.
  956. */
  957. class InfantryTypeClass : public TechnoTypeClass
  958. {
  959. public:
  960. /*
  961. ** If this civilian infantry type is female, then this flag
  962. ** will be true. This information is used to get the correct
  963. ** voice response.
  964. */
  965. unsigned IsFemale:1;
  966. /*
  967. ** Does this infantry unit have crawling animation? If not, then this
  968. ** means that the "crawling" frames are actually running animation frames.
  969. */
  970. unsigned IsCrawling:1;
  971. /*
  972. ** For those infantry types that can capture buildings, this flag
  973. ** will be set to true. Typically, this is the engineer.
  974. */
  975. unsigned IsCapture:1;
  976. /*
  977. ** For infantry types that will run away from any damage causing
  978. ** events, this flag will be true. Typically, this is so for all
  979. ** civilians as well as the flame thrower guys.
  980. */
  981. unsigned IsFraidyCat:1;
  982. /*
  983. ** This flags whether this infantry is actually a civilian. A
  984. ** civilian uses different voice responses, has less ammunition,
  985. ** and runs from danger more often.
  986. */
  987. unsigned IsCivilian:1;
  988. /*
  989. ** If the infantry unit is equipped with C4 explosives, then this
  990. ** flag will be true. Such infantry can enter and destroy enemy
  991. ** buildings.
  992. */
  993. unsigned IsBomber:1;
  994. /*
  995. ** This flags whether this infantry is actually a dog. A dog
  996. ** uses different voice responses, has no ammo, and runs instead
  997. ** of walks to attack.
  998. */
  999. unsigned IsDog:1;
  1000. /*
  1001. ** This flag specifies whether this infantry type should use the
  1002. ** override remap table, instead of the house remap table. This is
  1003. ** used to turn the two civilian animations into a veritable smorgasbord
  1004. ** of civilian types, for example.
  1005. */
  1006. unsigned IsRemapOverride:1;
  1007. /*
  1008. ** This value represents the unit class. It can serve as a unique
  1009. ** identification number for this unit class.
  1010. */
  1011. InfantryType Type;
  1012. /*
  1013. ** When this infantry unit is loaded onto a transport, then this
  1014. ** is the pip shape to use. Primarily, this is a color control.
  1015. */
  1016. PipEnum Pip;
  1017. /*
  1018. ** This is an array of the various animation frame data for the actions that
  1019. ** the infantry may perform.
  1020. */
  1021. DoInfoStruct const * DoControls;
  1022. /*
  1023. ** There are certain units with special animation sequences built into the
  1024. ** shape file. These values tell how many frames are used for the firing animation.
  1025. */
  1026. char FireLaunch;
  1027. char ProneLaunch;
  1028. /*
  1029. ** This is a pointer to the special override remap table, which is
  1030. ** used only in conjunction with the IsRemapOverride flag, and is
  1031. ** primarily used for the civilians.
  1032. */
  1033. unsigned char const * OverrideRemap;
  1034. /*
  1035. ** This is the explicit unit class constructor.
  1036. */
  1037. InfantryTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {}
  1038. InfantryTypeClass (
  1039. InfantryType type,
  1040. int name,
  1041. char const * ininame,
  1042. int verticaloffset,
  1043. int primaryoffset,
  1044. bool is_female,
  1045. bool is_crawling,
  1046. bool is_civilian,
  1047. bool is_remap_override,
  1048. bool is_nominal,
  1049. bool is_theater,
  1050. PipEnum pip,
  1051. DoInfoStruct const * controls,
  1052. int firelaunch,
  1053. int pronelaunch,
  1054. unsigned char const * override_remap);
  1055. static void * operator new(size_t);
  1056. static void * operator new(size_t , void * ptr) {return(ptr);};
  1057. static void operator delete(void * ptr);
  1058. static void Init_Heap(void);
  1059. static InfantryType From_Name(char const * name);
  1060. static InfantryTypeClass & As_Reference(InfantryType type);
  1061. static void Init(TheaterType ) {};
  1062. static void One_Time(void);
  1063. static void Prep_For_Add(void);
  1064. virtual bool Read_INI(CCINIClass & ini);
  1065. virtual void Dimensions(int & width, int & height) const;
  1066. virtual bool Create_And_Place(CELL cell, HousesType house) const;
  1067. virtual ObjectClass * Create_One_Of(HouseClass * house) const;
  1068. virtual short const * Occupy_List(bool placement=false) const;
  1069. virtual int Full_Name(void) const;
  1070. #ifdef SCENARIO_EDITOR
  1071. virtual void Display(int x, int y, WindowNumberType window, HousesType house) const;
  1072. #endif
  1073. };
  1074. /****************************************************************************
  1075. ** The various aircraft types are controlled by object types of
  1076. ** this class.
  1077. */
  1078. class AircraftTypeClass : public TechnoTypeClass
  1079. {
  1080. public:
  1081. /*
  1082. ** Fixed wing aircraft (ones that cannot hover) have this flag set to true.
  1083. ** Such aircraft will not vary speed while it is flying.
  1084. */
  1085. unsigned IsFixedWing:1;
  1086. /*
  1087. ** Can this aircraft land? If it can land it is presumed to be controllable by the player.
  1088. */
  1089. unsigned IsLandable:1;
  1090. /*
  1091. ** Does this aircraft have a rotor blade (helicopter) type propulsion?
  1092. */
  1093. unsigned IsRotorEquipped:1; // Is a rotor attached?
  1094. /*
  1095. ** Is there a custom rotor animation stage set for each facing of the aircraft?
  1096. */
  1097. unsigned IsRotorCustom:1; // Custom rotor sets for each facing?
  1098. /*
  1099. ** This is the kind of aircraft identifier number.
  1100. */
  1101. AircraftType Type;
  1102. /*
  1103. ** This specifies the default mission order for this aircraft. Some aircraft default
  1104. ** to guard mode (e.g., helicopters) while some default to attack mode (e.g., bombers).
  1105. */
  1106. MissionType Mission;
  1107. /*
  1108. ** This is the preferred landing building. The aircraft will try to land at the
  1109. ** building of this type.
  1110. */
  1111. StructType Building;
  1112. /*
  1113. ** This is the final approach speed of this aircraft type for landing
  1114. ** at an airfield. Most aircraft hit it at full speed, but the MIG is
  1115. ** an example of a plane that needs a slower approach speed to hit the
  1116. ** airfield.
  1117. */
  1118. int LandingSpeed;
  1119. AircraftTypeClass(NoInitClass const & x) : TechnoTypeClass(x) {}
  1120. AircraftTypeClass(
  1121. AircraftType airtype,
  1122. int name,
  1123. char const * ininame,
  1124. int verticaloffset,
  1125. int primaryoffset,
  1126. int primarylateral,
  1127. bool is_fixedwing,
  1128. bool is_rotorequipped,
  1129. bool is_rotorcustom,
  1130. bool is_landable,
  1131. bool is_stealthy,
  1132. bool is_selectable,
  1133. bool is_legal_target,
  1134. bool is_insignificant,
  1135. bool is_immune,
  1136. StructType building,
  1137. int landingspeed,
  1138. int rotation,
  1139. MissionType deforder);
  1140. static void * operator new(size_t);
  1141. static void * operator new(size_t , void * ptr) {return(ptr);};
  1142. static void operator delete(void * ptr);
  1143. static void Init_Heap(void);
  1144. static AircraftType From_Name(char const * name);
  1145. static AircraftTypeClass & As_Reference(AircraftType a);
  1146. static void Init(TheaterType ) {};
  1147. static void One_Time(void);
  1148. static void Prep_For_Add(void);
  1149. virtual void Dimensions(int &width, int &height) const;
  1150. virtual bool Create_And_Place(CELL, HousesType) const;
  1151. virtual ObjectClass * Create_One_Of(HouseClass * house) const;
  1152. virtual short const * Occupy_List(bool placement=false) const;
  1153. virtual short const * Overlap_List(void) const;
  1154. virtual int Max_Pips(void) const;
  1155. #ifdef SCENARIO_EDITOR
  1156. virtual void Display(int x, int y, WindowNumberType window, HousesType house) const;
  1157. #endif
  1158. static void const * LRotorData;
  1159. static void const * RRotorData;
  1160. };
  1161. /***************************************************************************
  1162. ** Bullets and other projectiles need some specific information according
  1163. ** to their type.
  1164. */
  1165. class BulletTypeClass : public ObjectTypeClass
  1166. {
  1167. public:
  1168. /*
  1169. ** Does this bullet type fly over walls?
  1170. */
  1171. unsigned IsHigh:1;
  1172. /*
  1173. ** Does this bullet need a shadow drawn under it? Shadowed bullets
  1174. ** use the Height value to offset their Y position.
  1175. */
  1176. unsigned IsShadow:1;
  1177. /*
  1178. ** If this projectile is one that ballistically arcs from ground level, up into the air and
  1179. ** then back to the ground, where it explodes. Typical uses of this are for grenades and
  1180. ** artillery shells.
  1181. */
  1182. unsigned IsArcing:1;
  1183. /*
  1184. ** Certain projectiles do not travel horizontally, but rather, vertically -- they drop
  1185. ** from a height. Bombs fall into this category and will have this value set to
  1186. ** true. Dropping projectiles do not calculate collision with terrain (such as walls).
  1187. */
  1188. unsigned IsDropping:1;
  1189. /*
  1190. ** Is this projectile invisible? Some bullets and weapon effects are not directly
  1191. ** rendered. Small caliber bullets and flame thrower flames are treated like
  1192. ** normal projectiles for damage purposes, but are displayed using custom
  1193. ** rules.
  1194. */
  1195. unsigned IsInvisible:1;
  1196. /*
  1197. ** Does this bullet explode when near the target? Some bullets only explode if
  1198. ** it actually hits the target. Some explode even if nearby.
  1199. */
  1200. unsigned IsProximityArmed:1;
  1201. /*
  1202. ** Does this projectile spew puffs of smoke out its tail while it
  1203. ** travels? Missiles are prime examples of this projectile type.
  1204. */
  1205. unsigned IsFlameEquipped:1;
  1206. /*
  1207. ** Should fuel consumption be tracked for this projectile? Rockets are the primary
  1208. ** projectile with this characteristic, but even for bullets it should be checked so that
  1209. ** bullets don't travel too far.
  1210. */
  1211. unsigned IsFueled:1;
  1212. /*
  1213. ** Is this projectile without different facing visuals? Most plain bullets do not change
  1214. ** visual imagery if their facing changes. Rockets, on the other hand, are equipped with
  1215. ** the full 32 facing imagery.
  1216. */
  1217. unsigned IsFaceless:1;
  1218. /*
  1219. ** If this is a typically inaccurate projectile, then this flag will be true. Artillery
  1220. ** is a prime example of this type.
  1221. */
  1222. unsigned IsInaccurate:1;
  1223. /*
  1224. ** If the bullet contains translucent pixels, then this flag will be true. These
  1225. ** translucent pixels really are "shadow" pixels in the same style as the shadow
  1226. ** cast by regular ground units.
  1227. */
  1228. unsigned IsTranslucent:1;
  1229. /*
  1230. ** If this bullet can be fired on aircraft, then this flag will be true.
  1231. */
  1232. unsigned IsAntiAircraft:1;
  1233. /*
  1234. ** If this bullet can fire upon ground targets, then this flag will be true.
  1235. */
  1236. unsigned IsAntiGround:1;
  1237. /*
  1238. ** If this bullet can be fired upon submarines (that are submerged), then
  1239. ** this flag will be true.
  1240. */
  1241. unsigned IsAntiSub:1;
  1242. /*
  1243. ** If this bullet should lose strength as it travels toward the target, then
  1244. ** this flag will be true.
  1245. */
  1246. unsigned IsDegenerate:1;
  1247. /*
  1248. ** Does this projectile travel under the water? If so, then its imagery will be modified
  1249. ** to look like it is doing so.
  1250. */
  1251. unsigned IsSubSurface:1;
  1252. /*
  1253. ** If this projectile is equipped with a parachute, then this flag will be set. Parachute
  1254. ** bombs are usually the only one with this flag set.
  1255. */
  1256. unsigned IsParachuted:1;
  1257. /*
  1258. ** Is this unit of the humongous size? Certain very large projectiles have
  1259. ** this flag set. Typically, they require a special offset list so that the cells
  1260. ** they overlap will be properly redrawn.
  1261. */
  1262. unsigned IsGigundo:1;
  1263. /*
  1264. ** This element is a unique identification number for the bullet
  1265. ** type.
  1266. */
  1267. BulletType Type;
  1268. /*
  1269. ** This is the rotation speed of the bullet. It only has practical value
  1270. ** for those projectiles that performing homing action during flight -- such
  1271. ** as with rockets. If the ROT is zero, then no homing is performed. Otherwise
  1272. ** the projectile is considered to be a homing type.
  1273. */
  1274. unsigned char ROT;
  1275. /*
  1276. ** Some projectiles have a built in arming distance that must elapse before the
  1277. ** projectile may explode. If this value is non-zero, then this override is
  1278. ** applied.
  1279. */
  1280. int Arming;
  1281. /*
  1282. ** If this bullet is of the tumbling type, then this is the modulo to factor
  1283. ** into the game frame when determining what shape number to use for the
  1284. ** imagery.
  1285. */
  1286. int Tumble;
  1287. //---------------------------------------------------------------------
  1288. BulletTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {}
  1289. BulletTypeClass(char const * name);
  1290. static void * operator new(size_t);
  1291. static void * operator new(size_t , void * ptr) {return(ptr);};
  1292. static void operator delete(void * ptr);
  1293. static void Init_Heap(void);
  1294. static BulletTypeClass & As_Reference(BulletType type);
  1295. static void Init(TheaterType ) {};
  1296. static void One_Time(void);
  1297. virtual bool Read_INI(CCINIClass & ini);
  1298. virtual bool Create_And_Place(CELL , HousesType =HOUSE_NONE) const {return false;};
  1299. virtual ObjectClass * Create_One_Of(HouseClass *) const {return 0;};
  1300. };
  1301. /****************************************************************************
  1302. ** These are the different TYPES of terrain objects. Every terrain object must
  1303. ** be one of these types.
  1304. */
  1305. class TerrainTypeClass : public ObjectTypeClass
  1306. {
  1307. public:
  1308. /*
  1309. ** Which terrain object does this class type represent.
  1310. */
  1311. TerrainType Type;
  1312. /*
  1313. ** This is the coordinate offset (from upper left) of where the center base
  1314. ** position of the terrain object lies. For trees, this would be the base of
  1315. ** the trunk. This is used for sorting purposes.
  1316. */
  1317. COORDINATE CenterBase;
  1318. /*
  1319. ** This is the bitfield control that tells which theater this terrain object is
  1320. ** valid for. If the bit (1 << TheaterType) is true, then this terrain object
  1321. ** is allowed.
  1322. */
  1323. int Theater;
  1324. /*
  1325. ** Does this terrain object get placed on the water instead of the ground?
  1326. */
  1327. unsigned IsWaterBased:1;
  1328. //----------------------------------------------------------------
  1329. TerrainTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {}
  1330. TerrainTypeClass(
  1331. TerrainType terrain,
  1332. int theater,
  1333. COORDINATE centerbase,
  1334. bool is_immune,
  1335. bool is_water,
  1336. char const * ininame,
  1337. int fullname,
  1338. short const * occupy,
  1339. short const * overlap);
  1340. static void * operator new(size_t);
  1341. static void * operator new(size_t , void * ptr) {return(ptr);};
  1342. static void operator delete(void * ptr);
  1343. static void Init_Heap(void);
  1344. static TerrainType From_Name(char const * name);
  1345. static TerrainTypeClass & As_Reference(TerrainType type);
  1346. static void Init(TheaterType theater = THEATER_TEMPERATE);
  1347. static void One_Time(void);
  1348. static void Prep_For_Add(void);
  1349. virtual COORDINATE Coord_Fixup(COORDINATE coord) const;
  1350. virtual bool Create_And_Place(CELL cell, HousesType house) const;
  1351. virtual ObjectClass * Create_One_Of(HouseClass *) const;
  1352. virtual short const * Occupy_List(bool placement=false) const;
  1353. virtual short const * Overlap_List(void) const;
  1354. #ifdef SCENARIO_EDITOR
  1355. virtual void Display(int x, int y, WindowNumberType window, HousesType house=HOUSE_NONE) const;
  1356. #endif
  1357. private:
  1358. short const * Occupy;
  1359. short const * Overlap;
  1360. };
  1361. /****************************************************************************
  1362. ** The tile type objects are controlled by this class. It specifies the form
  1363. ** of the tile set for the specified object as well as other related datum.
  1364. ** It is derived from the ObjectTypeClass solely for the purpose of scenario
  1365. ** editing and creation.
  1366. */
  1367. class TemplateTypeClass: public ObjectTypeClass
  1368. {
  1369. public:
  1370. /*
  1371. ** What template is this.
  1372. */
  1373. TemplateType Type;
  1374. /*
  1375. ** A bitfield container that indicates which theaters this template is allowed
  1376. ** in. A bit set in the (1<<TheaterType) position indicates the template is legal
  1377. ** in that particular theater.
  1378. */
  1379. unsigned char Theater;
  1380. /*
  1381. ** Raw dimensions of this template (in icons).
  1382. */
  1383. unsigned char Width,Height;
  1384. //----------------------------------------------------------
  1385. TemplateTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {};
  1386. TemplateTypeClass(
  1387. TemplateType iconset,
  1388. int theater,
  1389. char const * ininame,
  1390. int fullname);
  1391. static void * operator new(size_t);
  1392. static void * operator new(size_t , void * ptr) {return(ptr);};
  1393. static void operator delete(void * ptr);
  1394. static void Init_Heap(void);
  1395. static TemplateType From_Name(char const * name);
  1396. static TemplateTypeClass & As_Reference(TemplateType type);
  1397. static void Init(TheaterType theater);
  1398. static void One_Time(void);
  1399. static void Prep_For_Add(void);
  1400. virtual COORDINATE Coord_Fixup(COORDINATE coord) const;
  1401. virtual bool Create_And_Place(CELL cell, HousesType house=HOUSE_NONE) const;
  1402. virtual ObjectClass * Create_One_Of(HouseClass *) const;
  1403. virtual short const * Occupy_List(bool placement=false) const;
  1404. LandType Land_Type(int icon) const;
  1405. #ifdef SCENARIO_EDITOR
  1406. virtual void Display(int x, int y, WindowNumberType window, HousesType house=HOUSE_NONE) const;
  1407. #endif
  1408. };
  1409. /****************************************************************************
  1410. ** All the animation objects are controlled by this class. It holds the static
  1411. ** data associated with each animation type.
  1412. */
  1413. class AnimTypeClass : public ObjectTypeClass
  1414. {
  1415. public:
  1416. /*
  1417. ** If this animation should run at a constant apparent rate regardless
  1418. ** of game speed setting, then this flag will be set to true.
  1419. */
  1420. unsigned IsNormalized:1;
  1421. /*
  1422. ** If this animation should be rendered and sorted with the other ground
  1423. ** units, then this flag is true. Typical of this would be fire and other
  1424. ** low altitude animation effects.
  1425. */
  1426. unsigned IsGroundLayer:1;
  1427. /*
  1428. ** If this animation should be rendered in a translucent fashion, this flag
  1429. ** will be true. Translucent colors are some of the reds and some of the
  1430. ** greys. Typically, smoke and some fire effects have this flag set.
  1431. */
  1432. unsigned IsTranslucent:1;
  1433. /*
  1434. ** If this animation uses the white translucent table, then this flag
  1435. ** will be true.
  1436. */
  1437. unsigned IsWhiteTrans:1;
  1438. /*
  1439. ** If this is the special flame thrower animation, then custom affects
  1440. ** occur as it is playing. Specifically, scorch marks and little fire
  1441. ** pieces appear as the flame jets forth.
  1442. */
  1443. unsigned IsFlameThrower:1;
  1444. /*
  1445. ** Some animations leave a scorch mark behind. Napalm and other flame
  1446. ** type explosions are typical of this type.
  1447. */
  1448. unsigned IsScorcher:1;
  1449. /*
  1450. ** Some explosions are of such violence that they leave craters behind.
  1451. ** This flag will be true for those types.
  1452. */
  1453. unsigned IsCraterForming:1;
  1454. /*
  1455. ** If this animation should attach itself to any unit that is in the same
  1456. ** location as itself, then this flag will be true. Most vehicle impact
  1457. ** explosions are of this type.
  1458. */
  1459. unsigned IsSticky:1;
  1460. /*
  1461. ** If this animation is theater specific, then this flag will be
  1462. ** set to true. Most animations are not theater specific.
  1463. */
  1464. unsigned IsTheater:1;
  1465. /*
  1466. ** This is the type number for this animation kind. It can be used as
  1467. ** a unique identifier for animation types.
  1468. */
  1469. AnimType Type;
  1470. /*
  1471. ** This specified the maximum dimension of the shape (edge to edge). This dimension
  1472. ** is used to build the appropriate cell refresh list. Keep this value as small
  1473. ** as possible to ensure maximum performance. This is especially critical, since
  1474. ** animations always cause the cells under them to be redrawn every frame.
  1475. */
  1476. int Size;
  1477. /*
  1478. ** This is the frame that the animation is biggest. The biggest frame of animation
  1479. ** will hide any changes to underlying ground (e.g., craters) that the animation
  1480. ** causes, so these effects are delayed until this frame is reached. The end result
  1481. ** is to prevent the player from seeing craters "pop" into existence.
  1482. */
  1483. int Biggest;
  1484. /*
  1485. ** Some animations (when attached to another object) damage the object it
  1486. ** is in contact with. Fire is a good example of this. This value is a
  1487. ** fixed point number of the damage that is applied to the attached object
  1488. ** every game tick. The damage is expressed as damage points per game frame.
  1489. ** Because it is a fixed point fraction, the damage can be very slight.
  1490. */
  1491. fixed Damage;
  1492. /*
  1493. ** Simple animation delay value between advancing of frames. This can
  1494. ** be overridden by the control list.
  1495. */
  1496. int Delay;
  1497. /*
  1498. ** The starting frame number for each animation sequence. Usually this is
  1499. ** zero, but can sometimes be different if this animation is a sub sequence
  1500. ** of a larger animation file.
  1501. */
  1502. int Start;
  1503. /*
  1504. ** Looping animations might start at a different frame than the initial one.
  1505. ** This is true for smoke effects that have a startup sequence followed by a
  1506. ** continuous looping sequence.
  1507. */
  1508. int LoopStart;
  1509. /*
  1510. ** For looping animations, this is the frame that will end all the middle loops
  1511. ** of the animation. The last loop of the animation will proceed until the Stages
  1512. ** has been fully completed.
  1513. */
  1514. int LoopEnd;
  1515. /*
  1516. ** The number of stages that this animation sequence will progress through
  1517. ** before it loops or ends.
  1518. */
  1519. int Stages;
  1520. /*
  1521. ** This is the normal loop count for this animation. Usually this is one, but
  1522. ** for some animations, it may be larger.
  1523. */
  1524. unsigned Loops;
  1525. /*
  1526. ** This is the sound effect to play when this animation starts. Usually, this
  1527. ** applies to explosion animations.
  1528. */
  1529. VocType Sound;
  1530. /*
  1531. ** If the animation is to launch into another animation, then
  1532. ** the secondary animation will be defined here.
  1533. */
  1534. AnimType ChainTo;
  1535. //---------------------------------------------------------------------------
  1536. AnimTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {}
  1537. AnimTypeClass(AnimType anim,
  1538. char const * name,
  1539. int size,
  1540. int biggest,
  1541. bool istheater,
  1542. bool isnormal,
  1543. bool iswhite,
  1544. bool isscorcher,
  1545. bool iscrater,
  1546. bool issticky,
  1547. bool ground,
  1548. bool istrans,
  1549. bool isflame,
  1550. fixed damage,
  1551. int delaytime,
  1552. int start,
  1553. int loopstart,
  1554. int loopend,
  1555. int stages,
  1556. int loops,
  1557. VocType sound,
  1558. AnimType chainto);
  1559. static void Init_Heap(void);
  1560. static void * operator new(size_t);
  1561. static void * operator new(size_t , void * ptr) {return(ptr);};
  1562. static void operator delete(void * ptr);
  1563. static AnimTypeClass & As_Reference(AnimType type);
  1564. static void Init(TheaterType theater);
  1565. static void One_Time(void);
  1566. virtual bool Create_And_Place(CELL , HousesType =HOUSE_NONE) const {return false;};
  1567. virtual ObjectClass * Create_One_Of(HouseClass *) const {return 0;};
  1568. };
  1569. /****************************************************************************
  1570. ** This controls the overlay object types. These object types include walls
  1571. ** and concrete. They are always considered to be one icon in size and
  1572. ** are processed on an icon by icon basis. This is different from normal
  1573. ** templates which can be an arbitrary size. Other than this they are
  1574. ** mostly similar to normal templates but with some characteristics of
  1575. ** structures (they can be destroyed).
  1576. */
  1577. class OverlayTypeClass: public ObjectTypeClass
  1578. {
  1579. public:
  1580. /*
  1581. ** What overlay is this.
  1582. */
  1583. OverlayType Type;
  1584. /*
  1585. ** What type of ground does this make the cell it occupies?
  1586. */
  1587. LandType Land;
  1588. /*
  1589. ** If this overlay is a wall, how many stages of destruction are there
  1590. ** for this wall type? i.e. sandbags = 2, concrete = 4, etc.
  1591. */
  1592. int DamageLevels;
  1593. /*
  1594. ** If this overlay is a wall, what amount of damage is necessary
  1595. ** before the wall takes damage?
  1596. */
  1597. int DamagePoints;
  1598. /*
  1599. ** Is this overlay graphic theater specific. This means that if there is
  1600. ** custom art for this overlay that varies between different theaters, then
  1601. ** this flag will be true.
  1602. */
  1603. unsigned IsTheater:1;
  1604. /*
  1605. ** Is this a wall type overlay? Wall types change their shape
  1606. ** depending on the existence of adjacent walls of the same type.
  1607. */
  1608. unsigned IsWall:1;
  1609. /*
  1610. ** If this overlay is actually a wall and this wall type is tall enough that
  1611. ** normal ground based straight line weapons will be blocked by it, then this
  1612. ** flag will be true. Brick fences are typical of this type.
  1613. */
  1614. unsigned IsHigh:1;
  1615. /*
  1616. ** If this overlay represents harvestable tiberium, then this flag
  1617. ** will be true.
  1618. */
  1619. unsigned IsTiberium:1;
  1620. /*
  1621. ** If this is a wall that is made of wood, then this flag will be
  1622. ** true. Such walls are affected by fire damage.
  1623. */
  1624. unsigned IsWooden:1;
  1625. /*
  1626. ** Is this a crate? If it is, then goodies may come out of it.
  1627. */
  1628. unsigned IsCrate:1;
  1629. /*
  1630. ** If this is true, then the overlay will not show up on the radar map.
  1631. */
  1632. unsigned IsRadarVisible:1;
  1633. //----------------------------------------------------------
  1634. OverlayTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {}
  1635. OverlayTypeClass(
  1636. OverlayType iconset,
  1637. char const * ininame,
  1638. int fullname,
  1639. LandType ground,
  1640. int damagelevels,
  1641. int damagepoints,
  1642. bool isradarinvisible,
  1643. bool iswooden,
  1644. bool istarget,
  1645. bool iscrushable,
  1646. bool istiberium,
  1647. bool high,
  1648. bool theater,
  1649. bool iswall,
  1650. bool iscrate);
  1651. static void * operator new(size_t);
  1652. static void * operator new(size_t , void * ptr) {return(ptr);};
  1653. static void operator delete(void * ptr);
  1654. static void Init_Heap(void);
  1655. static OverlayType From_Name(char const * name);
  1656. static OverlayTypeClass & As_Reference(OverlayType type);
  1657. static void Init(TheaterType);
  1658. static void One_Time(void);
  1659. static void Prep_For_Add(void);
  1660. virtual COORDINATE Coord_Fixup(COORDINATE coord) const;
  1661. virtual bool Create_And_Place(CELL cell, HousesType house=HOUSE_NONE) const;
  1662. virtual ObjectClass * Create_One_Of(HouseClass *) const;
  1663. virtual short const * Occupy_List(bool placement=false) const;
  1664. virtual void Draw_It(int x, int y, int data) const;
  1665. virtual unsigned char * Radar_Icon(int data) const;
  1666. #ifdef SCENARIO_EDITOR
  1667. virtual void Display(int x, int y, WindowNumberType window, HousesType house=HOUSE_NONE) const;
  1668. #endif
  1669. };
  1670. /****************************************************************************
  1671. ** This type elaborates the various "smudge" effects that can occur. Smudges are
  1672. ** those elements which are on top off all the ground icons, but below anything
  1673. ** that is "above" it. This includes scorch marks, craters, and infantry bodies.
  1674. ** Smudges, be definition, contain transparency. The are modifiers to underlying
  1675. ** terrain imagery.
  1676. */
  1677. class SmudgeTypeClass : public ObjectTypeClass
  1678. {
  1679. public:
  1680. /*
  1681. ** What overlay is this.
  1682. */
  1683. SmudgeType Type;
  1684. /*
  1685. ** Some smudges are larger than one cell. If this is the case, then
  1686. ** these dimensions specify the number of cells wide and tall the
  1687. ** smudge is.
  1688. */
  1689. int Width;
  1690. int Height;
  1691. /*
  1692. ** Is this smudge a crater type? If so, then a second crater can be added to
  1693. ** this smudge so that a more cratered landscape results.
  1694. */
  1695. unsigned IsCrater:1;
  1696. /*
  1697. ** Is this overlay used as the attached road piece for buildings (bib)?
  1698. */
  1699. unsigned IsBib:1;
  1700. //----------------------------------------------------------
  1701. SmudgeTypeClass(NoInitClass const & x) : ObjectTypeClass(x) {}
  1702. SmudgeTypeClass(
  1703. SmudgeType smudge,
  1704. char const * ininame,
  1705. int fullname,
  1706. int width,
  1707. int height,
  1708. bool isbib,
  1709. bool iscrater
  1710. );
  1711. static void * operator new(size_t);
  1712. static void * operator new(size_t , void * ptr) {return(ptr);};
  1713. static void operator delete(void * ptr);
  1714. static void Init_Heap(void);
  1715. static SmudgeType From_Name(char const * name);
  1716. static SmudgeTypeClass & As_Reference(SmudgeType type);
  1717. static void Init(TheaterType);
  1718. static void One_Time(void);
  1719. static void Prep_For_Add(void);
  1720. virtual bool Create_And_Place(CELL cell, HousesType house=HOUSE_NONE) const;
  1721. virtual ObjectClass * Create_One_Of(HouseClass *) const;
  1722. virtual short const * Occupy_List(bool placement=false) const;
  1723. virtual short const * Overlap_List(void) const {return Occupy_List();};
  1724. virtual void Draw_It(int x, int y, int data) const ;
  1725. #ifdef SCENARIO_EDITOR
  1726. virtual void Display(int x, int y, WindowNumberType window, HousesType house=HOUSE_NONE) const;
  1727. #endif
  1728. };
  1729. #endif