HDATA.CPP 16 KB

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