TYPE.H 59 KB

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