ODATA.CPP 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/ODATA.CPP 1 3/03/97 10:25a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : ODATA.CPP *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : May 16, 1994 *
  26. * *
  27. * Last Update : August 14, 1996 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * OverlayTypeClass::As_Reference -- Fetch a reference to the overlay type specified. *
  32. * OverlayTypeClass::Coord_Fixup -- Adjust the coord to be legal for assignment. *
  33. * OverlayTypeClass::Create_And_Place -- Creates and places a overlay object on the map. *
  34. * OverlayTypeClass::Create_One_Of -- Creates an object of this overlay type. *
  35. * OverlayTypeClass::Display -- Displays a generic representation of overlay. *
  36. * OverlayTypeClass::Draw_It -- Draws the overlay image at location specified. *
  37. * OverlayTypeClass::From_Name -- Determine overlay from ASCII name. *
  38. * OverlayTypeClass::Init -- Initialize the overlay graphic data per theater. *
  39. * OverlayTypeClass::Init_Heap -- Initialize the overlay type class heap. *
  40. * OverlayTypeClass::Occupy_List -- Determines occupation list. *
  41. * OverlayTypeClass::One_Time -- Loads all the necessary general overlay shape data. *
  42. * OverlayTypeClass::OverlayTypeClass -- Constructor for overlay type objects. *
  43. * OverlayTypeClass::Prep_For_Add -- Prepares to add overlay to scenario. *
  44. * OverlayTypeClass::Radar_Icon -- Gets a pointer to the radar icons *
  45. * OverlayTypeClass::operator delete -- Returns an overlay type object back to the pool. *
  46. * OverlayTypeClass::operator new -- Allocate an overlay type class object from pool. *
  47. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  48. #include "function.h"
  49. #include "type.h"
  50. static OverlayTypeClass const Sandbag(
  51. OVERLAY_SANDBAG_WALL, // Overlay type number.
  52. "SBAG", // INI name of overlay.
  53. TXT_SANDBAG_WALL, // Full name of overlay.
  54. LAND_WALL, // What kind of ground is it?
  55. 1, // If this is a wall, how many damage levels?
  56. 20, // If this is a wall, how many damage points can it take per level?
  57. true, // Visible on the radar map?
  58. false, // Is it a wooden overlay (affected by fire)?
  59. true, // Targetable as a destroyable overlay?
  60. true, // Crushable by tracked vehicle?
  61. false, // Is this harvestable Tiberium?
  62. false, // Stops low level bullets in flight?
  63. false, // Theater specific art?
  64. true, // Is this a wall type?
  65. false // Is this a crate?
  66. );
  67. static OverlayTypeClass const Cyclone(
  68. OVERLAY_CYCLONE_WALL, // Overlay type number.
  69. "CYCL", // INI name of overlay.
  70. TXT_CYCLONE_WALL, // Full name of overlay.
  71. LAND_WALL, // What kind of ground is it?
  72. 2, // If this is a wall, how many damage levels?
  73. 10, // If this is a wall, how many damage points can it take per level?
  74. true, // Visible on the radar map?
  75. false, // Is it a wooden overlay (affected by fire)?
  76. true, // Targetable as a destroyable overlay?
  77. true, // Crushable by tracked vehicle?
  78. false, // Is this harvestable Tiberium?
  79. false, // Stops low level bullets in flight?
  80. false, // Theater specific art?
  81. true, // Is this a wall type?
  82. false // Is this a crate?
  83. );
  84. static OverlayTypeClass const Brick(
  85. OVERLAY_BRICK_WALL, // Overlay type number.
  86. "BRIK", // INI name of overlay.
  87. TXT_BRICK_WALL, // Full name of overlay.
  88. LAND_WALL, // What kind of ground is it?
  89. 3, // If this is a wall, how many damage levels?
  90. 70, // If this is a wall, how many damage points can it take per level?
  91. true, // Visible on the radar map?
  92. false, // Is it a wooden overlay (affected by fire)?
  93. true, // Targetable as a destroyable overlay?
  94. false, // Crushable by tracked vehicle?
  95. false, // Is this harvestable Tiberium?
  96. true, // Stops low level bullets in flight?
  97. false, // Theater specific art?
  98. true, // Is this a wall type?
  99. false // Is this a crate?
  100. );
  101. static OverlayTypeClass const Barbwire(
  102. OVERLAY_BARBWIRE_WALL, // Overlay type number.
  103. "BARB", // INI name of overlay.
  104. TXT_BARBWIRE_WALL, // Full name of overlay.
  105. LAND_WALL, // What kind of ground is it?
  106. 1, // If this is a wall, how many damage levels?
  107. 2, // If this is a wall, how many damage points can it take per level?
  108. true, // Visible on the radar map?
  109. false, // Is it a wooden overlay (affected by fire)?
  110. true, // Targetable as a destroyable overlay?
  111. true, // Crushable by tracked vehicle?
  112. false, // Is this harvestable Tiberium?
  113. false, // Stops low level bullets in flight?
  114. false, // Theater specific art?
  115. true, // Is this a wall type?
  116. false // Is this a crate?
  117. );
  118. static OverlayTypeClass const Wood(
  119. OVERLAY_WOOD_WALL, // Overlay type number.
  120. "WOOD", // INI name of overlay.
  121. TXT_WOOD_WALL, // Full name of overlay.
  122. LAND_WALL, // What kind of ground is it?
  123. 1, // If this is a wall, how many damage levels?
  124. 2, // If this is a wall, how many damage points can it take per level?
  125. true, // Visible on the radar map?
  126. true, // Is it a wooden overlay (affected by fire)?
  127. true, // Targetable as a destroyable overlay?
  128. true, // Crushable by tracked vehicle?
  129. false, // Is this harvestable Tiberium?
  130. false, // Stops low level bullets in flight?
  131. false, // Theater specific art?
  132. true, // Is this a wall type?
  133. false // Is this a crate?
  134. );
  135. static OverlayTypeClass const Fence(
  136. OVERLAY_FENCE, // Overlay type number.
  137. "FENC", // INI name of overlay.
  138. TXT_FENCE, // Full name of overlay.
  139. LAND_WALL, // What kind of ground is it?
  140. 2, // If this is a wall, how many damage levels?
  141. 10, // If this is a wall, how many damage points can it take per level?
  142. true, // Visible on the radar map?
  143. false, // Is it a wooden overlay (affected by fire)?
  144. true, // Targetable as a destroyable overlay?
  145. true, // Crushable by tracked vehicle?
  146. false, // Is this harvestable Tiberium?
  147. false, // Stops low level bullets in flight?
  148. false, // Theater specific art?
  149. true, // Is this a wall type?
  150. false // Is this a crate?
  151. );
  152. static OverlayTypeClass const Gold1(
  153. OVERLAY_GOLD1, // Overlay type number.
  154. "GOLD01", // INI name of overlay.
  155. TXT_GOLD, // Full name of overlay.
  156. LAND_TIBERIUM, // What kind of ground is it?
  157. 0, // If this is a wall, how many damage levels?
  158. 0, // If this is a wall, how many damage points can it take per level?
  159. true, // Visible on the radar map?
  160. false, // Is it a wooden overlay (affected by fire)?
  161. false, // Targetable as a destroyable overlay?
  162. false, // Crushable by tracked vehicle?
  163. true, // Is this harvestable Tiberium?
  164. false, // Stops low level bullets in flight?
  165. true, // Theater specific art?
  166. false, // Is this a wall type?
  167. false // Is this a crate?
  168. );
  169. static OverlayTypeClass const Gold2(
  170. OVERLAY_GOLD2, // Overlay type number.
  171. "GOLD02", // INI name of overlay.
  172. TXT_GOLD, // Full name of overlay.
  173. LAND_TIBERIUM, // What kind of ground is it?
  174. 0, // If this is a wall, how many damage levels?
  175. 0, // If this is a wall, how many damage points can it take per level?
  176. true, // Visible on the radar map?
  177. false, // Is it a wooden overlay (affected by fire)?
  178. false, // Targetable as a destroyable overlay?
  179. false, // Crushable by tracked vehicle?
  180. true, // Is this harvestable Tiberium?
  181. false, // Stops low level bullets in flight?
  182. true, // Theater specific art?
  183. false, // Is this a wall type?
  184. false // Is this a crate?
  185. );
  186. static OverlayTypeClass const Gold3(
  187. OVERLAY_GOLD3, // Overlay type number.
  188. "GOLD03", // INI name of overlay.
  189. TXT_GOLD, // Full name of overlay.
  190. LAND_TIBERIUM, // What kind of ground is it?
  191. 0, // If this is a wall, how many damage levels?
  192. 0, // If this is a wall, how many damage points can it take per level?
  193. true, // Visible on the radar map?
  194. false, // Is it a wooden overlay (affected by fire)?
  195. false, // Targetable as a destroyable overlay?
  196. false, // Crushable by tracked vehicle?
  197. true, // Is this harvestable Tiberium?
  198. false, // Stops low level bullets in flight?
  199. true, // Theater specific art?
  200. false, // Is this a wall type?
  201. false // Is this a crate?
  202. );
  203. static OverlayTypeClass const Gold4(
  204. OVERLAY_GOLD4, // Overlay type number.
  205. "GOLD04", // INI name of overlay.
  206. TXT_GOLD, // Full name of overlay.
  207. LAND_TIBERIUM, // What kind of ground is it?
  208. 0, // If this is a wall, how many damage levels?
  209. 0, // If this is a wall, how many damage points can it take per level?
  210. true, // Visible on the radar map?
  211. false, // Is it a wooden overlay (affected by fire)?
  212. false, // Targetable as a destroyable overlay?
  213. false, // Crushable by tracked vehicle?
  214. true, // Is this harvestable Tiberium?
  215. false, // Stops low level bullets in flight?
  216. true, // Theater specific art?
  217. false, // Is this a wall type?
  218. false // Is this a crate?
  219. );
  220. static OverlayTypeClass const Gems1(
  221. OVERLAY_GEMS1, // Overlay type number.
  222. "GEM01", // INI name of overlay.
  223. TXT_GEMS, // Full name of overlay.
  224. LAND_TIBERIUM, // What kind of ground is it?
  225. 0, // If this is a wall, how many damage levels?
  226. 0, // If this is a wall, how many damage points can it take per level?
  227. true, // Visible on the radar map?
  228. false, // Is it a wooden overlay (affected by fire)?
  229. false, // Targetable as a destroyable overlay?
  230. false, // Crushable by tracked vehicle?
  231. true, // Is this harvestable Tiberium?
  232. false, // Stops low level bullets in flight?
  233. true, // Theater specific art?
  234. false, // Is this a wall type?
  235. false // Is this a crate?
  236. );
  237. static OverlayTypeClass const Gems2(
  238. OVERLAY_GEMS2, // Overlay type number.
  239. "GEM02", // INI name of overlay.
  240. TXT_GEMS, // Full name of overlay.
  241. LAND_TIBERIUM, // What kind of ground is it?
  242. 0, // If this is a wall, how many damage levels?
  243. 0, // If this is a wall, how many damage points can it take per level?
  244. true, // Visible on the radar map?
  245. false, // Is it a wooden overlay (affected by fire)?
  246. false, // Targetable as a destroyable overlay?
  247. false, // Crushable by tracked vehicle?
  248. true, // Is this harvestable Tiberium?
  249. false, // Stops low level bullets in flight?
  250. true, // Theater specific art?
  251. false, // Is this a wall type?
  252. false // Is this a crate?
  253. );
  254. static OverlayTypeClass const Gems3(
  255. OVERLAY_GEMS3, // Overlay type number.
  256. "GEM03", // INI name of overlay.
  257. TXT_GEMS, // Full name of overlay.
  258. LAND_TIBERIUM, // What kind of ground is it?
  259. 0, // If this is a wall, how many damage levels?
  260. 0, // If this is a wall, how many damage points can it take per level?
  261. true, // Visible on the radar map?
  262. false, // Is it a wooden overlay (affected by fire)?
  263. false, // Targetable as a destroyable overlay?
  264. false, // Crushable by tracked vehicle?
  265. true, // Is this harvestable Tiberium?
  266. false, // Stops low level bullets in flight?
  267. true, // Theater specific art?
  268. false, // Is this a wall type?
  269. false // Is this a crate?
  270. );
  271. static OverlayTypeClass const Gems4(
  272. OVERLAY_GEMS4, // Overlay type number.
  273. "GEM04", // INI name of overlay.
  274. TXT_GEMS, // Full name of overlay.
  275. LAND_TIBERIUM, // What kind of ground is it?
  276. 0, // If this is a wall, how many damage levels?
  277. 0, // If this is a wall, how many damage points can it take per level?
  278. true, // Visible on the radar map?
  279. false, // Is it a wooden overlay (affected by fire)?
  280. false, // Targetable as a destroyable overlay?
  281. false, // Crushable by tracked vehicle?
  282. true, // Is this harvestable Tiberium?
  283. false, // Stops low level bullets in flight?
  284. true, // Theater specific art?
  285. false, // Is this a wall type?
  286. false // Is this a crate?
  287. );
  288. static OverlayTypeClass const V12(
  289. OVERLAY_V12, // Overlay type number.
  290. "V12", // INI name of overlay.
  291. TXT_CIV12, // Full name of overlay.
  292. LAND_ROCK, // What kind of ground is it?
  293. 0, // If this is a wall, how many damage levels?
  294. 0, // If this is a wall, how many damage points can it take per level?
  295. false, // Visible on the radar map?
  296. false, // Is it a wooden overlay (affected by fire)?
  297. false, // Targetable as a destroyable overlay?
  298. true, // Crushable by tracked vehicle?
  299. false, // Is this harvestable Tiberium?
  300. false, // Stops low level bullets in flight?
  301. true, // Theater specific art?
  302. false, // Is this a wall type?
  303. false // Is this a crate?
  304. );
  305. static OverlayTypeClass const V13(
  306. OVERLAY_V13, // Overlay type number.
  307. "V13", // INI name of overlay.
  308. TXT_CIV13, // Full name of overlay.
  309. LAND_ROCK, // What kind of ground is it?
  310. 0, // If this is a wall, how many damage levels?
  311. 0, // If this is a wall, how many damage points can it take per level?
  312. false, // Visible on the radar map?
  313. false, // Is it a wooden overlay (affected by fire)?
  314. false, // Targetable as a destroyable overlay?
  315. true, // Crushable by tracked vehicle?
  316. false, // Is this harvestable Tiberium?
  317. false, // Stops low level bullets in flight?
  318. true, // Theater specific art?
  319. false, // Is this a wall type?
  320. false // Is this a crate?
  321. );
  322. static OverlayTypeClass const V14(
  323. OVERLAY_V14, // Overlay type number.
  324. "V14", // INI name of overlay.
  325. TXT_CIV14, // Full name of overlay.
  326. LAND_ROCK, // What kind of ground is it?
  327. 0, // If this is a wall, how many damage levels?
  328. 0, // If this is a wall, how many damage points can it take per level?
  329. false, // Visible on the radar map?
  330. false, // Is it a wooden overlay (affected by fire)?
  331. false, // Targetable as a destroyable overlay?
  332. true, // Crushable by tracked vehicle?
  333. false, // Is this harvestable Tiberium?
  334. false, // Stops low level bullets in flight?
  335. true, // Theater specific art?
  336. false, // Is this a wall type?
  337. false // Is this a crate?
  338. );
  339. static OverlayTypeClass const V15(
  340. OVERLAY_V15, // Overlay type number.
  341. "V15", // INI name of overlay.
  342. TXT_CIV15, // Full name of overlay.
  343. LAND_ROCK, // What kind of ground is it?
  344. 0, // If this is a wall, how many damage levels?
  345. 0, // If this is a wall, how many damage points can it take per level?
  346. false, // Visible on the radar map?
  347. false, // Is it a wooden overlay (affected by fire)?
  348. false, // Targetable as a destroyable overlay?
  349. true, // Crushable by tracked vehicle?
  350. false, // Is this harvestable Tiberium?
  351. false, // Stops low level bullets in flight?
  352. true, // Theater specific art?
  353. false, // Is this a wall type?
  354. false // Is this a crate?
  355. );
  356. static OverlayTypeClass const V16(
  357. OVERLAY_V16, // Overlay type number.
  358. "V16", // INI name of overlay.
  359. TXT_CIV16, // Full name of overlay.
  360. LAND_ROCK, // What kind of ground is it?
  361. 0, // If this is a wall, how many damage levels?
  362. 0, // If this is a wall, how many damage points can it take per level?
  363. false, // Visible on the radar map?
  364. false, // Is it a wooden overlay (affected by fire)?
  365. false, // Targetable as a destroyable overlay?
  366. true, // Crushable by tracked vehicle?
  367. false, // Is this harvestable Tiberium?
  368. false, // Stops low level bullets in flight?
  369. true, // Theater specific art?
  370. false, // Is this a wall type?
  371. false // Is this a crate?
  372. );
  373. static OverlayTypeClass const V17(
  374. OVERLAY_V17, // Overlay type number.
  375. "V17", // INI name of overlay.
  376. TXT_CIV17, // Full name of overlay.
  377. LAND_ROCK, // What kind of ground is it?
  378. 0, // If this is a wall, how many damage levels?
  379. 0, // If this is a wall, how many damage points can it take per level?
  380. false, // Visible on the radar map?
  381. false, // Is it a wooden overlay (affected by fire)?
  382. false, // Targetable as a destroyable overlay?
  383. true, // Crushable by tracked vehicle?
  384. false, // Is this harvestable Tiberium?
  385. false, // Stops low level bullets in flight?
  386. true, // Theater specific art?
  387. false, // Is this a wall type?
  388. false // Is this a crate?
  389. );
  390. static OverlayTypeClass const V18(
  391. OVERLAY_V18, // Overlay type number.
  392. "V18", // INI name of overlay.
  393. TXT_CIV18, // Full name of overlay.
  394. LAND_ROCK, // What kind of ground is it?
  395. 0, // If this is a wall, how many damage levels?
  396. 0, // If this is a wall, how many damage points can it take per level?
  397. false, // Visible on the radar map?
  398. false, // Is it a wooden overlay (affected by fire)?
  399. false, // Targetable as a destroyable overlay?
  400. true, // Crushable by tracked vehicle?
  401. false, // Is this harvestable Tiberium?
  402. false, // Stops low level bullets in flight?
  403. true, // Theater specific art?
  404. false, // Is this a wall type?
  405. false // Is this a crate?
  406. );
  407. static OverlayTypeClass const FlagSpot(
  408. OVERLAY_FLAG_SPOT, // Overlay type number.
  409. "FPLS", // INI name of overlay.
  410. TXT_FLAG_SPOT, // Full name of overlay.
  411. LAND_CLEAR, // What kind of ground is it?
  412. 0, // If this is a wall, how many damage levels?
  413. 0, // If this is a wall, how many damage points can it take per level?
  414. true, // Visible on the radar map?
  415. false, // Is it a wooden overlay (affected by fire)?
  416. false, // Targetable as a destroyable overlay?
  417. false, // Crushable by tracked vehicle?
  418. false, // Is this harvestable Tiberium?
  419. false, // Stops low level bullets in flight?
  420. false, // Theater specific art?
  421. false, // Is this a wall type?
  422. false // Is this a crate?
  423. );
  424. static OverlayTypeClass const WoodCrate(
  425. OVERLAY_WOOD_CRATE, // Overlay type number.
  426. "WCRATE", // INI name of overlay.
  427. TXT_WOOD_CRATE, // Full name of overlay.
  428. LAND_CLEAR, // What kind of ground is it?
  429. 0, // If this is a wall, how many damage levels?
  430. 0, // If this is a wall, how many damage points can it take per level?
  431. false, // Visible on the radar map?
  432. false, // Is it a wooden overlay (affected by fire)?
  433. false, // Targetable as a destroyable overlay?
  434. false, // Crushable by tracked vehicle?
  435. false, // Is this harvestable Tiberium?
  436. false, // Stops low level bullets in flight?
  437. false, // Theater specific art?
  438. false, // Is this a wall type?
  439. true // Is this a crate?
  440. );
  441. static OverlayTypeClass const WaterCrate(
  442. OVERLAY_WATER_CRATE, // Overlay type number.
  443. "WWCRATE", // INI name of overlay.
  444. TXT_WATER_CRATE, // Full name of overlay.
  445. LAND_WATER, // What kind of ground is it?
  446. 0, // If this is a wall, how many damage levels?
  447. 0, // If this is a wall, how many damage points can it take per level?
  448. false, // Visible on the radar map?
  449. false, // Is it a wooden overlay (affected by fire)?
  450. false, // Targetable as a destroyable overlay?
  451. false, // Crushable by tracked vehicle?
  452. false, // Is this harvestable Tiberium?
  453. false, // Stops low level bullets in flight?
  454. false, // Theater specific art?
  455. false, // Is this a wall type?
  456. true // Is this a crate?
  457. );
  458. static OverlayTypeClass const SteelCrate(
  459. OVERLAY_STEEL_CRATE, // Overlay type number.
  460. "SCRATE", // INI name of overlay.
  461. TXT_STEEL_CRATE, // Full name of overlay.
  462. LAND_CLEAR, // What kind of ground is it?
  463. 0, // If this is a wall, how many damage levels?
  464. 0, // If this is a wall, how many damage points can it take per level?
  465. false, // Visible on the radar map?
  466. false, // Is it a wooden overlay (affected by fire)?
  467. false, // Targetable as a destroyable overlay?
  468. false, // Crushable by tracked vehicle?
  469. false, // Is this harvestable Tiberium?
  470. false, // Stops low level bullets in flight?
  471. false, // Theater specific art?
  472. false, // Is this a wall type?
  473. true // Is this a crate?
  474. );
  475. /***********************************************************************************************
  476. * OverlayTypeClass::OverlayTypeClass -- Constructor for overlay type objects. *
  477. * *
  478. * This is the constructor for the overlay types. *
  479. * *
  480. * INPUT: see below... *
  481. * *
  482. * OUTPUT: none *
  483. * *
  484. * WARNINGS: none *
  485. * *
  486. * HISTORY: *
  487. * 07/29/1994 JLB : Created. *
  488. *=============================================================================================*/
  489. OverlayTypeClass::OverlayTypeClass(
  490. OverlayType iconset,
  491. char const * ininame,
  492. int fullname,
  493. LandType ground,
  494. int damagelevels,
  495. int damagepoints,
  496. bool isradarvisible,
  497. bool iswooden,
  498. bool istarget,
  499. bool iscrushable,
  500. bool istiberium,
  501. bool high,
  502. bool theater,
  503. bool walltype,
  504. bool iscrate) :
  505. ObjectTypeClass(RTTI_OVERLAYTYPE,
  506. int(iconset),
  507. false,
  508. true,
  509. false,
  510. istarget,
  511. true,
  512. false,
  513. false,
  514. fullname,
  515. ininame),
  516. Type(iconset),
  517. Land(ground),
  518. DamageLevels(damagelevels),
  519. DamagePoints(damagepoints),
  520. IsTheater(theater),
  521. IsWall(walltype),
  522. IsHigh(high),
  523. IsTiberium(istiberium),
  524. IsWooden(iswooden),
  525. IsCrate(iscrate),
  526. IsRadarVisible(isradarvisible)
  527. {
  528. IsCrushable = iscrushable;
  529. }
  530. /***********************************************************************************************
  531. * OverlayTypeClass::operator new -- Allocate an overlay type class object from pool. *
  532. * *
  533. * This will allocate an overlay type class object from the special memory pool that is *
  534. * for that purpose. *
  535. * *
  536. * INPUT: none *
  537. * *
  538. * OUTPUT: Returns with a pointer to the overlay type class object allocated. If there is *
  539. * insufficient memory to fulfill the request, then NULL is returned. *
  540. * *
  541. * WARNINGS: none *
  542. * *
  543. * HISTORY: *
  544. * 07/09/1996 JLB : Created. *
  545. *=============================================================================================*/
  546. void * OverlayTypeClass::operator new(size_t)
  547. {
  548. return(OverlayTypes.Alloc());
  549. }
  550. /***********************************************************************************************
  551. * OverlayTypeClass::operator delete -- Returns an overlay type object back to the pool. *
  552. * *
  553. * This will return a previously allcoated overaly type object to the special memory *
  554. * pool that it was allocated from. *
  555. * *
  556. * INPUT: pointer -- Pointer to the overlay type class object to return the memory pool. *
  557. * *
  558. * OUTPUT: none *
  559. * *
  560. * WARNINGS: none *
  561. * *
  562. * HISTORY: *
  563. * 07/09/1996 JLB : Created. *
  564. *=============================================================================================*/
  565. void OverlayTypeClass::operator delete(void * pointer)
  566. {
  567. OverlayTypes.Free((OverlayTypeClass *)pointer);
  568. }
  569. /***********************************************************************************************
  570. * OverlayTypeClass::Init_Heap -- Initialize the overlay type class heap. *
  571. * *
  572. * This will initialize the overlay type heap by pre-allocated all overlay types known *
  573. * to exist. *
  574. * *
  575. * INPUT: none *
  576. * *
  577. * OUTPUT: none *
  578. * *
  579. * WARNINGS: It should be called once and before the rules.ini file is processed. *
  580. * *
  581. * HISTORY: *
  582. * 07/09/1996 JLB : Created. *
  583. *=============================================================================================*/
  584. void OverlayTypeClass::Init_Heap(void)
  585. {
  586. /*
  587. ** These overlay type class objects must be allocated in the exact order that they
  588. ** are specified in the OverlayType enumeration. This is necessary because the heap
  589. ** allocation block index serves double duty as the type number index.
  590. */
  591. new OverlayTypeClass(Sandbag); // OVERLAY_SANDBAG_WALL
  592. new OverlayTypeClass(Cyclone); // OVERLAY_CYCLONE_WALL
  593. new OverlayTypeClass(Brick); // OVERLAY_BRICK_WALL
  594. new OverlayTypeClass(Barbwire); // OVERLAY_BARBWIRE_WALL
  595. new OverlayTypeClass(Wood); // OVERLAY_WOOD_WALL
  596. new OverlayTypeClass(Gold1); // OVERLAY_GOLD1
  597. new OverlayTypeClass(Gold2); // OVERLAY_GOLD2
  598. new OverlayTypeClass(Gold3); // OVERLAY_GOLD3
  599. new OverlayTypeClass(Gold4); // OVERLAY_GOLD4
  600. new OverlayTypeClass(Gems1); // OVERLAY_GEMS1
  601. new OverlayTypeClass(Gems2); // OVERLAY_GEMS2
  602. new OverlayTypeClass(Gems3); // OVERLAY_GEMS3
  603. new OverlayTypeClass(Gems4); // OVERLAY_GEMS4
  604. new OverlayTypeClass(V12); // OVERLAY_V12
  605. new OverlayTypeClass(V13); // OVERLAY_V13
  606. new OverlayTypeClass(V14); // OVERLAY_V14
  607. new OverlayTypeClass(V15); // OVERLAY_V15
  608. new OverlayTypeClass(V16); // OVERLAY_V16
  609. new OverlayTypeClass(V17); // OVERLAY_V17
  610. new OverlayTypeClass(V18); // OVERLAY_V18
  611. new OverlayTypeClass(FlagSpot); // OVERLAY_FLAG_SPOT
  612. new OverlayTypeClass(WoodCrate); // OVERLAY_WOOD_CRATE
  613. new OverlayTypeClass(SteelCrate); // OVERLAY_STEEL_CRATE
  614. new OverlayTypeClass(Fence); // OVERLAY_FENCE
  615. new OverlayTypeClass(WaterCrate); // OVERLAY_WATER_CRATE
  616. }
  617. /***********************************************************************************************
  618. * OverlayTypeClass::One_Time -- Loads all the necessary general overlay shape data. *
  619. * *
  620. * This routine should be called once when the game first starts. It will establish *
  621. * pointers to the graphic data of the overlay objects. *
  622. * *
  623. * INPUT: none *
  624. * *
  625. * OUTPUT: none *
  626. * *
  627. * WARNINGS: none *
  628. * *
  629. * HISTORY: *
  630. * 08/12/1994 JLB : Created. *
  631. *=============================================================================================*/
  632. void OverlayTypeClass::One_Time(void)
  633. {
  634. }
  635. /***********************************************************************************************
  636. * OverlayTypeClass::From_Name -- Determine overlay from ASCII name. *
  637. * *
  638. * This routine is used to determine the overlay number given only *
  639. * an ASCII representation. The scenario loader uses this routine *
  640. * to construct the map from the INI control file. *
  641. * *
  642. * INPUT: name -- Pointer to the ASCII name of the overlay. *
  643. * *
  644. * OUTPUT: Returns with the overlay number. If the name had no match, *
  645. * then returns with OVERLAY_NONE. *
  646. * *
  647. * WARNINGS: none *
  648. * *
  649. * HISTORY: *
  650. * 05/23/1994 JLB : Created. *
  651. *=============================================================================================*/
  652. OverlayType OverlayTypeClass::From_Name(char const * name)
  653. {
  654. if (name != NULL) {
  655. for (OverlayType index = OVERLAY_FIRST; index < OVERLAY_COUNT; index++) {
  656. if (stricmp(As_Reference(index).IniName, name) == 0) {
  657. return(index);
  658. }
  659. }
  660. }
  661. return(OVERLAY_NONE);
  662. }
  663. /***********************************************************************************************
  664. * OverlayTypeClass::Occupy_List -- Determines occupation list. *
  665. * *
  666. * This routine is used to examine the overlay map and build an *
  667. * occupation list. This list is used to render a overlay cursor as *
  668. * well as placement of icon numbers. *
  669. * *
  670. * INPUT: placement -- Is this for placement legality checking only? The normal condition *
  671. * is for marking occupation flags. *
  672. * *
  673. * OUTPUT: Returns with a pointer to the overlay occupation list. *
  674. * *
  675. * WARNINGS: The return pointer is valid only until the next time that *
  676. * this routine is called. *
  677. * *
  678. * HISTORY: *
  679. * 05/23/1994 JLB : Created. *
  680. *=============================================================================================*/
  681. short const * OverlayTypeClass::Occupy_List(bool) const
  682. {
  683. static short _simple[] = {0, REFRESH_EOL};
  684. return(_simple);
  685. }
  686. /***************************************************************************
  687. * OverlayTypeClass::Radar_Icon -- Gets a pointer to the radar icons *
  688. * *
  689. * *
  690. * INPUT: *
  691. * *
  692. * OUTPUT: *
  693. * *
  694. * WARNINGS: *
  695. * *
  696. * HISTORY: *
  697. * 04/19/1995 PWG : Created. *
  698. *=========================================================================*/
  699. unsigned char * OverlayTypeClass::Radar_Icon(int data) const
  700. {
  701. unsigned char * icon = (unsigned char *)Get_Radar_Data(); // Get pointer to radar icons
  702. if (icon != NULL) icon += (data * 9) + 2; // move icon ptr to correct icon
  703. return(icon); // Return the correct icon
  704. }
  705. #ifdef SCENARIO_EDITOR
  706. /***********************************************************************************************
  707. * OverlayTypeClass::Display -- Displays a generic representation of overlay. *
  708. * *
  709. * This routine is used to display a generic view of the overlay *
  710. * object. This is necessary for selection in the scenario editor. *
  711. * *
  712. * INPUT: x,y -- The coordinates to center the display about. *
  713. * *
  714. * window-- The window to base the coordinates upon. *
  715. * *
  716. * OUTPUT: none *
  717. * *
  718. * WARNINGS: none *
  719. * *
  720. * HISTORY: *
  721. * 05/23/1994 JLB : Created. *
  722. *=============================================================================================*/
  723. void OverlayTypeClass::Display(int x, int y, WindowNumberType window, HousesType ) const
  724. {
  725. if (Get_Image_Data() != NULL) {
  726. int frame = 0;
  727. if (IsTiberium) {
  728. frame = 7;
  729. }
  730. if (Type == OVERLAY_GEMS1 || Type == OVERLAY_GEMS2 || Type == OVERLAY_GEMS3 || Type == OVERLAY_GEMS4) {
  731. frame = 2;
  732. }
  733. IsTheaterShape = IsTheater;
  734. CC_Draw_Shape(Get_Image_Data(), frame, x, y, window, SHAPE_NORMAL|SHAPE_CENTER|SHAPE_WIN_REL);
  735. IsTheaterShape = false;
  736. }
  737. }
  738. /***********************************************************************************************
  739. * OverlayTypeClass::Prep_For_Add -- Prepares to add overlay to scenario. *
  740. * *
  741. * This routine prepares a list of overlay objects so that the *
  742. * scenario editor can use this list to display a dialog box. The *
  743. * selection of a overlay object will allow its placement upon the *
  744. * map. *
  745. * *
  746. * INPUT: none *
  747. * *
  748. * OUTPUT: none *
  749. * *
  750. * WARNINGS: none *
  751. * *
  752. * HISTORY: *
  753. * 08/06/1994 JLB : Created *
  754. *=============================================================================================*/
  755. void OverlayTypeClass::Prep_For_Add(void)
  756. {
  757. for (OverlayType index = OVERLAY_FIRST; index < OVERLAY_COUNT; index++) {
  758. OverlayTypeClass const & overlay = As_Reference(index);
  759. if (overlay.Get_Image_Data() != NULL &&
  760. !overlay.IsWall &&
  761. (!overlay.IsTiberium || index == OVERLAY_GOLD1 || index == OVERLAY_GEMS1)) {
  762. Map.Add_To_List(&overlay);
  763. }
  764. }
  765. }
  766. #endif
  767. /***********************************************************************************************
  768. * OverlayTypeClass::Create_And_Place -- Creates and places a overlay object on the map. *
  769. * *
  770. * This support routine is used by the scenario editor to add a overlay object to the map *
  771. * and to the game. *
  772. * *
  773. * INPUT: cell -- The cell to place the overlay object. *
  774. * *
  775. * OUTPUT: bool; Was the overlay object placed successfully? *
  776. * *
  777. * WARNINGS: none *
  778. * *
  779. * HISTORY: *
  780. * 05/28/1994 JLB : Created. *
  781. *=============================================================================================*/
  782. bool OverlayTypeClass::Create_And_Place(CELL cell, HousesType ) const
  783. {
  784. if (new OverlayClass(Type, cell)) {
  785. return(true);
  786. }
  787. return(false);
  788. }
  789. /***********************************************************************************************
  790. * OverlayTypeClass::Create_One_Of -- Creates an object of this overlay type. *
  791. * *
  792. * This routine will create an object of this type. For certain overlay objects, such *
  793. * as walls, it is actually created as a building. The "building" wall is converted into *
  794. * a overlay at the moment of placing down on the map. *
  795. * *
  796. * INPUT: none *
  797. * *
  798. * OUTPUT: Returns with a pointer to the appropriate object for this overlay type. *
  799. * *
  800. * WARNINGS: none *
  801. * *
  802. * HISTORY: *
  803. * 06/18/1994 JLB : Created. *
  804. *=============================================================================================*/
  805. ObjectClass * OverlayTypeClass::Create_One_Of(HouseClass *) const
  806. {
  807. return(new OverlayClass(Type, -1));
  808. }
  809. /***********************************************************************************************
  810. * OverlayTypeClass::Draw_It -- Draws the overlay image at location specified. *
  811. * *
  812. * This routine will draw the overlay shape at the coordinates specified. It is presumed *
  813. * that all the underlying layers have already been rendered by the time this routine is *
  814. * called. *
  815. * *
  816. * INPUT: x, y -- Coordinate (upper left) of cell where overlay image is to be drawn. *
  817. * *
  818. * data -- Cell specific data that controls the imagery of the overlay. *
  819. * *
  820. * OUTPUT: none *
  821. * *
  822. * WARNINGS: none *
  823. * *
  824. * HISTORY: *
  825. * 08/12/1994 JLB : Created. *
  826. *=============================================================================================*/
  827. void OverlayTypeClass::Draw_It(int x, int y, int data) const
  828. {
  829. IsTheaterShape = IsTheater;
  830. CC_Draw_Shape(Get_Image_Data(), data, Map.TacPixelX+x+(CELL_PIXEL_W>>1), Map.TacPixelY+y+(CELL_PIXEL_H>>1), WINDOW_MAIN, SHAPE_CENTER|SHAPE_WIN_REL|SHAPE_GHOST, NULL, Map.UnitShadow);
  831. IsTheaterShape = false;
  832. }
  833. /***********************************************************************************************
  834. * OverlayTypeClass::Init -- Initialize the overlay graphic data per theater. *
  835. * *
  836. * This routine will update the overlay graphic data according to the theater specified. *
  837. * It is typically called when the scenario is first loaded (theater change). *
  838. * *
  839. * INPUT: theater -- The theater to load specific data for. *
  840. * *
  841. * OUTPUT: none *
  842. * *
  843. * WARNINGS: none *
  844. * *
  845. * HISTORY: *
  846. * 09/01/1994 JLB : Created. *
  847. *=============================================================================================*/
  848. void OverlayTypeClass::Init(TheaterType theater)
  849. {
  850. if (theater != LastTheater) {
  851. for (OverlayType index = OVERLAY_FIRST; index < OVERLAY_COUNT; index++) {
  852. OverlayTypeClass & overlay = As_Reference(index);
  853. char fullname[_MAX_FNAME+_MAX_EXT]; // Fully constructed iconset name.
  854. if (overlay.IsTheater) {
  855. _makepath(fullname, NULL, NULL, overlay.IniName, Theaters[theater].Suffix);
  856. } else {
  857. _makepath(fullname, NULL, NULL, overlay.IniName, ".SHP");
  858. }
  859. overlay.ImageData = MFCD::Retrieve(fullname);
  860. IsTheaterShape = overlay.IsTheater; //Tell Build_Frame if this is a theater specific shape
  861. if (overlay.RadarIcon != NULL) delete[] (char *)overlay.RadarIcon;
  862. overlay.RadarIcon = Get_Radar_Icon(overlay.Get_Image_Data(), 0, -1, 3);
  863. IsTheaterShape = false;
  864. }
  865. }
  866. }
  867. /***********************************************************************************************
  868. * OverlayTypeClass::As_Reference -- Fetch a reference to the overlay type specified. *
  869. * *
  870. * Use this routine to get a reference that corresponds to the overlay type. *
  871. * *
  872. * INPUT: type -- The overlay type to fetch a reference to. *
  873. * *
  874. * OUTPUT: Returns with a reference to the overlay type specified. *
  875. * *
  876. * WARNINGS: Be sure that the overlay type specified is legal. Illegal type value will *
  877. * result in undefined behavior. *
  878. * *
  879. * HISTORY: *
  880. * 07/09/1996 JLB : Created. *
  881. *=============================================================================================*/
  882. OverlayTypeClass & OverlayTypeClass::As_Reference(OverlayType type)
  883. {
  884. return(*OverlayTypes.Ptr(type));
  885. }
  886. /***********************************************************************************************
  887. * OverlayTypeClass::Coord_Fixup -- Adjust the coord to be legal for assignment. *
  888. * *
  889. * This will adjust the coordinate specified so that it will be of legal format to *
  890. * assign as the coordinate of an overlay. Overlays are always relative to the upper left *
  891. * corner of the cell, so this routine drops the fractional cell components. *
  892. * *
  893. * INPUT: coord -- The coordinate to fixup to be legal for assignment. *
  894. * *
  895. * OUTPUT: Returns with a properly fixed up coordinate. *
  896. * *
  897. * WARNINGS: none *
  898. * *
  899. * HISTORY: *
  900. * 08/14/1996 JLB : Created. *
  901. *=============================================================================================*/
  902. COORDINATE OverlayTypeClass::Coord_Fixup(COORDINATE coord) const
  903. {
  904. return Coord_Whole(coord);
  905. }