HDATA.CPP 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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\hdata.cpv 2.17 16 Oct 1995 16:48:18 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 : HDATA.CPP *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : May 22, 1994 *
  30. * *
  31. * Last Update : January 23, 1995 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * HouseTypeClass::From_Name -- Fetch house pointer from its name. *
  36. * HouseTypeClass::As_Reference -- Fetches a reference to the house specified. *
  37. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  38. #include "function.h"
  39. /*
  40. ** These are the colors used to identify the various owners.
  41. */
  42. const int COLOR_GOOD = 180; // GOLD
  43. const int COLOR_BRIGHT_GOOD = 176; // GOLD
  44. const int COLOR_BAD = 123; //RED;
  45. const int COLOR_BRIGHT_BAD = 127; //RED;
  46. const int COLOR_NEUTRAL = 205; //WHITE;
  47. const int COLOR_BRIGHT_NEUTRAL = 202; //WHITE;
  48. static HouseTypeClass const HouseGood(
  49. HOUSE_GOOD,
  50. "GoodGuy", // NAME: House name.
  51. TXT_GDI, // FULLNAME: Translated house name.
  52. "GDI", // SUFFIX: House file suffix.
  53. 0, // LEMON: Lemon vehicle frequency.
  54. COLOR_GOOD, // COLOR: Dark Radar map color.
  55. COLOR_BRIGHT_GOOD, // COLOR: Bright Radar map color.
  56. REMAP_YELLOW, // Remap color ID number.
  57. RemapYellow, // Default remap table.
  58. 'G' // VOICE: Voice prefix character.
  59. );
  60. static HouseTypeClass const HouseBad(
  61. HOUSE_BAD,
  62. "BadGuy", // NAME: House name.
  63. TXT_NOD, // FULLNAME: Translated house name.
  64. "NOD", // SUFFIX: House file suffix.
  65. 0, // LEMON: Lemon vehicle frequency.
  66. COLOR_BAD, // COLOR: Dark Radar map color.
  67. COLOR_BRIGHT_BAD, // COLOR: Bright Radar map color.
  68. REMAP_BLUE, // Remap color ID number.
  69. RemapBlue, // Default remap table.
  70. 'B' // VOICE: Voice prefix character.
  71. );
  72. static HouseTypeClass const HouseCivilian(
  73. HOUSE_NEUTRAL,
  74. "Neutral", // NAME: House name.
  75. TXT_CIVILIAN, // FULLNAME: Translated house name.
  76. "CIV", // SUFFIX: House file suffix.
  77. 0, // LEMON: Lemon vehicle frequency.
  78. COLOR_NEUTRAL, // COLOR: Dark Radar map color.
  79. COLOR_BRIGHT_NEUTRAL, // COLOR: Bright Radar map color.
  80. REMAP_YELLOW, // Remap color ID number.
  81. RemapNone, // Default remap table.
  82. 'C' // VOICE: Voice prefix character.
  83. );
  84. static HouseTypeClass const HouseJP(
  85. HOUSE_JP,
  86. "Special", // NAME: House name.
  87. TXT_JP, // FULLNAME: Translated house name.
  88. "JP", // SUFFIX: House file suffix.
  89. 0, // LEMON: Lemon vehicle frequency.
  90. COLOR_NEUTRAL, // COLOR: Dark Radar map color.
  91. COLOR_BRIGHT_NEUTRAL, // COLOR: Bright Radar map color.
  92. REMAP_YELLOW, // Remap color ID number.
  93. RemapNone, // Default remap table.
  94. 'J' // VOICE: Voice prefix character.
  95. );
  96. static HouseTypeClass const HouseMulti1(
  97. HOUSE_MULTI1,
  98. "Multi1", // NAME: House name.
  99. TXT_CIVILIAN, // FULLNAME: Translated house name.
  100. "MP1", // SUFFIX: House file suffix.
  101. 0, // LEMON: Lemon vehicle frequency.
  102. COLOR_NEUTRAL, // COLOR: Radar map color.
  103. COLOR_BRIGHT_NEUTRAL, // COLOR: Bright Radar map color.
  104. REMAP_AQUA, // Remap color ID number.
  105. RemapBlueGreen, // Default remap table.
  106. 'M' // VOICE: Voice prefix character.
  107. );
  108. static HouseTypeClass const HouseMulti2(
  109. HOUSE_MULTI2,
  110. "Multi2", // NAME: House name.
  111. TXT_CIVILIAN, // FULLNAME: Translated house name.
  112. "MP2", // SUFFIX: House file suffix.
  113. 0, // LEMON: Lemon vehicle frequency.
  114. COLOR_NEUTRAL, // COLOR: Radar map color.
  115. COLOR_BRIGHT_NEUTRAL, // COLOR: Bright Radar map color.
  116. REMAP_ORANGE, // Remap color ID number.
  117. RemapOrange, // Default remap table.
  118. 'M' // VOICE: Voice prefix character.
  119. );
  120. static HouseTypeClass const HouseMulti3(
  121. HOUSE_MULTI3,
  122. "Multi3", // NAME: House name.
  123. TXT_CIVILIAN, // FULLNAME: Translated house name.
  124. "MP3", // SUFFIX: House file suffix.
  125. 0, // LEMON: Lemon vehicle frequency.
  126. COLOR_NEUTRAL, // COLOR: Radar map color.
  127. COLOR_BRIGHT_NEUTRAL, // COLOR: Bright Radar map color.
  128. REMAP_GREEN, // Remap color ID number.
  129. RemapGreen, // Default remap table.
  130. 'M' // VOICE: Voice prefix character.
  131. );
  132. static HouseTypeClass const HouseMulti4(
  133. HOUSE_MULTI4,
  134. "Multi4", // NAME: House name.
  135. TXT_CIVILIAN, // FULLNAME: Translated house name.
  136. "MP4", // SUFFIX: House file suffix.
  137. 0, // LEMON: Lemon vehicle frequency.
  138. COLOR_NEUTRAL, // COLOR: Radar map color.
  139. COLOR_BRIGHT_NEUTRAL, // COLOR: Bright Radar map color.
  140. REMAP_BLUE, // Remap color ID number.
  141. RemapBlue, // Default remap table.
  142. 'M' // VOICE: Voice prefix character.
  143. );
  144. static HouseTypeClass const HouseMulti5(
  145. HOUSE_MULTI5,
  146. "Multi5", // NAME: House name.
  147. TXT_CIVILIAN, // FULLNAME: Translated house name.
  148. "MP5", // SUFFIX: House file suffix.
  149. 0, // LEMON: Lemon vehicle frequency.
  150. COLOR_NEUTRAL, // COLOR: Radar map color.
  151. COLOR_BRIGHT_NEUTRAL, // COLOR: Bright Radar map color.
  152. REMAP_YELLOW, // Remap color ID number.
  153. RemapYellow, // Default remap table.
  154. 'M' // VOICE: Voice prefix character.
  155. );
  156. static HouseTypeClass const HouseMulti6(
  157. HOUSE_MULTI6,
  158. "Multi6", // NAME: House name.
  159. TXT_CIVILIAN, // FULLNAME: Translated house name.
  160. "MP6", // SUFFIX: House file suffix.
  161. 0, // LEMON: Lemon vehicle frequency.
  162. COLOR_NEUTRAL, // COLOR: Radar map color.
  163. COLOR_BRIGHT_NEUTRAL, // COLOR: Bright Radar map color.
  164. REMAP_RED, // Remap color ID number.
  165. RemapRed, // Default remap table.
  166. 'M' // VOICE: Voice prefix character.
  167. );
  168. HouseTypeClass const * const HouseTypeClass::Pointers[HOUSE_COUNT] = {
  169. &HouseGood,
  170. &HouseBad,
  171. &HouseCivilian,
  172. &HouseJP,
  173. &HouseMulti1,
  174. &HouseMulti2,
  175. &HouseMulti3,
  176. &HouseMulti4,
  177. &HouseMulti5,
  178. &HouseMulti6,
  179. };
  180. /***********************************************************************************************
  181. * HouseTypeClass::HouseTypeClass -- Constructor for house type objects. *
  182. * *
  183. * This is the constructor for house type objects. This object holds the constant data *
  184. * for the house type. *
  185. * *
  186. * INPUT: house -- The ID number for this house type. *
  187. * ini -- The INI name of this house. *
  188. * fullname -- The text number representing the complete name of the house. *
  189. * ext -- The filename extension used when loading data files. *
  190. * lemon -- The percentage for objects of this ownership to be lemon. *
  191. * remapc -- The remap color number to use. *
  192. * color -- The radar color to use for this "house". *
  193. * prefix -- A unique prefix letter used when building custom filenames. *
  194. * *
  195. * OUTPUT: none *
  196. * *
  197. * WARNINGS: none *
  198. * *
  199. * HISTORY: *
  200. * 06/21/1994 JLB : Created. *
  201. *=============================================================================================*/
  202. HouseTypeClass::HouseTypeClass(HousesType house,
  203. char const * ini,
  204. int fullname,
  205. char const * ext,
  206. int lemon,
  207. int color,
  208. int bright_color,
  209. PlayerColorType remapcolor,
  210. unsigned char const * remap,
  211. char prefix)
  212. {
  213. RemapTable = remap;
  214. RemapColor = remapcolor;
  215. House = house;
  216. IniName = ini;
  217. FullName = fullname;
  218. strncpy(Suffix, ext, 3);
  219. Suffix[3] = '\0';
  220. Lemon = lemon;
  221. Color = color;
  222. BrightColor = bright_color;
  223. Prefix = prefix;
  224. }
  225. /***********************************************************************************************
  226. * HouseTypeClass::From_Name -- Fetch house pointer from its name. *
  227. * *
  228. * This routine will convert the ASCII house name specified into a *
  229. * real house number. Typically, this is used when processing a *
  230. * scenario INI file. *
  231. * *
  232. * INPUT: name -- ASCII name of house to process. *
  233. * *
  234. * OUTPUT: Returns with actual house number represented by the ASCII *
  235. * name specified. *
  236. * *
  237. * WARNINGS: none *
  238. * *
  239. * HISTORY: *
  240. * 10/07/1992 JLB : Created. *
  241. * 05/21/1994 JLB : Converted to member function. *
  242. *=============================================================================================*/
  243. HousesType HouseTypeClass::From_Name(char const *name)
  244. {
  245. if (name) {
  246. for (HousesType house = HOUSE_FIRST; house < HOUSE_COUNT; house++) {
  247. if (stricmp(Pointers[house]->IniName, name) == 0) {
  248. return(house);
  249. }
  250. }
  251. }
  252. return(HOUSE_NONE);
  253. }
  254. /***********************************************************************************************
  255. * HouseTypeClass::One_Time -- One-time initialization *
  256. * *
  257. * INPUT: none *
  258. * *
  259. * OUTPUT: none *
  260. * *
  261. * WARNINGS: none *
  262. * *
  263. * HISTORY: *
  264. * 05/21/1994 JLB : Converted to member function. *
  265. *=============================================================================================*/
  266. void HouseTypeClass::One_Time(void)
  267. {
  268. /*
  269. ** Change the radar color for special units; otherwise, they'll be the same
  270. ** color as the player!
  271. */
  272. if (Special.IsJurassic && AreThingiesEnabled) {
  273. ((unsigned char &)HouseJP.Color) = (unsigned char)COLOR_BAD;
  274. ((unsigned char &)HouseJP.BrightColor) = (unsigned char)COLOR_BRIGHT_BAD;
  275. }
  276. }
  277. /***********************************************************************************************
  278. * HouseTypeClass::As_Reference -- Fetches a reference to the house specified. *
  279. * *
  280. * Use this routine to fetch a reference to the house number specified. *
  281. * *
  282. * INPUT: house -- The house number (HousesType) to look up. *
  283. * *
  284. * OUTPUT: Returns with a reference to the HouseTypeClass object that matches the house *
  285. * number specified. *
  286. * *
  287. * WARNINGS: none *
  288. * *
  289. * HISTORY: *
  290. * 01/23/1995 JLB : Created. *
  291. *=============================================================================================*/
  292. HouseTypeClass const & HouseTypeClass::As_Reference(HousesType house)
  293. {
  294. return(*Pointers[house]);
  295. }