RULES.CPP 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  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/RULES.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 : RULES.CPP *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : 05/12/96 *
  26. * *
  27. * Last Update : September 10, 1996 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * Difficulty_Get -- Fetch the difficulty bias values. *
  32. * RulesClass::AI -- Processes the AI control constants from the database. *
  33. * RulesClass::General -- Process the general main game rules. *
  34. * RulesClass::Heap_Maximums -- Fetch and process the heap override values. *
  35. * RulesClass::IQ -- Fetches the IQ control values from the INI database. *
  36. * RulesClass::Land_Types -- Inits the land type values. *
  37. * RulesClass::MPlayer -- Fetch and process the multiplayer default settings. *
  38. * RulesClass::Powerups -- Process the powerup values from the database. *
  39. * RulesClass::Process -- Fetch the bulk of the rule data from the control file. *
  40. * RulesClass::Recharge -- Process the super weapon recharge statistics. *
  41. * RulesClass::RulesClass -- Default constructor for rules class object. *
  42. * RulesClass::Themes -- Fetches the theme control values from the INI database. *
  43. * Techno_Get -- Get rule data common for all techno type objects. *
  44. * _Scale_To_256 -- Scales a 1..100 number into a 1..255 number. *
  45. * RulesClass::Difficulty -- Fetch the various difficulty group settings. *
  46. * RulesClass::Objects -- Fetch all the object characteristic values. *
  47. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  48. #include "function.h"
  49. #include "vortex.h"
  50. /***********************************************************************************************
  51. * _Scale_To_256 -- Scales a 1..100 number into a 1..255 number. *
  52. * *
  53. * This is a helper routine that will take a decimal percentage number and convert it *
  54. * into a game based fixed point number. *
  55. * *
  56. * INPUT: val -- Decimal percent number to convert. *
  57. * *
  58. * OUTPUT: Returns with the decimal percent number converted to a game fixed point number. *
  59. * *
  60. * WARNINGS: none *
  61. * *
  62. * HISTORY: *
  63. * 06/17/1996 JLB : Created. *
  64. *=============================================================================================*/
  65. static inline int _Scale_To_256(int val)
  66. {
  67. val = fixed(100, 256) * val;
  68. val = min(val, 255);
  69. return(val);
  70. }
  71. /***********************************************************************************************
  72. * RulesClass::RulesClass -- Default constructor for rules class object. *
  73. * *
  74. * This is the default constructor for the rules class object. Although it initializes the *
  75. * rule data with default values, it is expected that they will all be overridden by the *
  76. * rules control file. *
  77. * *
  78. * INPUT: none *
  79. * *
  80. * OUTPUT: none *
  81. * *
  82. * WARNINGS: none *
  83. * *
  84. * HISTORY: *
  85. * 06/17/1996 JLB : Created. *
  86. *=============================================================================================*/
  87. RulesClass::RulesClass(void) :
  88. TurboBoost("1.5"),
  89. AttackInterval(3),
  90. AttackDelay(5),
  91. PowerEmergencyFraction(fixed::_3_4),
  92. BadgerBombCount(1),
  93. AirstripRatio(".12"),
  94. AirstripLimit(5),
  95. HelipadRatio(".12"),
  96. HelipadLimit(5),
  97. TeslaRatio(".16"),
  98. TeslaLimit(10),
  99. AARatio(".14"),
  100. AALimit(10),
  101. DefenseRatio(".5"),
  102. DefenseLimit(40),
  103. WarRatio(".1"),
  104. WarLimit(2),
  105. BarracksRatio(".16"),
  106. BarracksLimit(2),
  107. RefineryLimit(4),
  108. RefineryRatio(".16"),
  109. BaseSizeAdd(3),
  110. PowerSurplus(50),
  111. InfantryReserve(2000),
  112. InfantryBaseMult(2),
  113. ChronoDuration(3),
  114. WaterCrateChance(".2"),
  115. SoloCrateMoney(2000),
  116. GPSTechLevel(0),
  117. UnitCrateType(UNIT_NONE),
  118. PatrolTime(".016"),
  119. TeamDelay(".6"),
  120. CloakDelay(0),
  121. GameSpeedBias(1),
  122. NervousBias(1),
  123. VortexRange(10*CELL_LEPTON_W),
  124. VortexSpeed((MPHType)10),
  125. VortexDamage(200),
  126. VortexChance(".2"),
  127. ExplosionSpread(fixed::_1_2),
  128. SupressRadius(CELL_LEPTON_W),
  129. ParaInfantryTechLevel(10),
  130. SpyPlaneTechLevel(10),
  131. ParaBombTechLevel(10),
  132. MaxIQ(5),
  133. IQSuperWeapons(4),
  134. IQProduction(5),
  135. IQGuardArea(4),
  136. IQRepairSell(3),
  137. IQCrush(2),
  138. IQScatter(3),
  139. IQContentScan(4),
  140. IQAircraft(4),
  141. IQHarvester(3),
  142. IQSellBack(2),
  143. SilverCrate(CRATE_HEAL_BASE),
  144. WoodCrate(CRATE_MONEY),
  145. WaterCrate(CRATE_MONEY),
  146. CrateMinimum(1),
  147. CrateMaximum(255),
  148. LZScanRadius(16*CELL_LEPTON_W),
  149. MPDefaultMoney(3000),
  150. MPMaxMoney(10000),
  151. IsMPShadowGrow(true),
  152. IsMPBasesOn(true),
  153. IsMPTiberiumGrow(true),
  154. IsMPCrates(true),
  155. IsMPAIPlayers(false),
  156. IsMPCaptureTheFlag(false),
  157. DropZoneRadius(4*CELL_LEPTON_W),
  158. MessageDelay(".6"),
  159. SavourDelay(".03"),
  160. AVMineDamage(1200),
  161. APMineDamage(1000),
  162. MaxPlayers(8),
  163. BaseDefenseDelay(fixed::_1_4),
  164. SuspendPriority(20),
  165. SuspendDelay(2),
  166. SurvivorFraction(fixed::_1_2),
  167. ReloadRate(".05"),
  168. AutocreateTime(5),
  169. BuildupTime(".05"),
  170. OreDumpRate(2),
  171. AtomDamage(1000),
  172. IsComputerParanoid(true),
  173. IsCurleyShuffle(false),
  174. IsFlashLowPower(true),
  175. IsCompEasyBonus(true),
  176. IsFineDifficulty(false),
  177. IsExplosiveHarvester(false),
  178. IsMCVDeploy(false),
  179. IsAllyReveal(true),
  180. IsSeparate(false),
  181. IsTreeTarget(false),
  182. IsMineAware(true),
  183. IsTGrowth(true),
  184. IsTSpread(true),
  185. IsNamed(false),
  186. IsAutoCrush(false),
  187. IsSmartDefense(false),
  188. IsScatter(false),
  189. IsChronoKill(true),
  190. ProneDamageBias(fixed::_1_2),
  191. QuakeDamagePercent(".33"),
  192. QuakeChance(".2"),
  193. GrowthRate(2),
  194. ShroudRate(4),
  195. CrateTime(10),
  196. TimerWarning(2),
  197. ChronoTechLevel(1),
  198. SonarTime(14),
  199. ChronoTime(3),
  200. ParaBombTime(14),
  201. ParaInfantryTime(2),
  202. ParaSaboteurTime(14),
  203. SpyTime(2),
  204. IronCurtainTime(14),
  205. GPSTime(1),
  206. NukeTime(14),
  207. SpeakDelay(2),
  208. DamageDelay(1),
  209. Gravity(3),
  210. GapShroudRadius(10),
  211. GapRegenInterval(".1"),
  212. RadarJamRadius(10*CELL_LEPTON_W),
  213. Incoming(MPH_IMMOBILE),
  214. MinDamage(1),
  215. MaxDamage(1000),
  216. RepairStep(5),
  217. RepairPercent(fixed::_1_4),
  218. URepairStep(5),
  219. URepairPercent(fixed::_1_4),
  220. RepairRate(".016"),
  221. ConditionGreen(1),
  222. ConditionYellow(fixed::_1_2),
  223. ConditionRed(fixed::_1_4),
  224. RandomAnimateTime(".083"),
  225. BailCount(28),
  226. GoldValue(35),
  227. GemValue(110),
  228. AircraftMax(100),
  229. AnimMax(100),
  230. BuildingMax(500),
  231. BulletMax(40),
  232. FactoryMax(20),
  233. InfantryMax(500),
  234. OverlayMax(1),
  235. SmudgeMax(1),
  236. TeamMax(60),
  237. TeamTypeMax(60),
  238. TemplateMax(1),
  239. TerrainMax(500),
  240. TriggerMax(60),
  241. UnitMax(500),
  242. VesselMax(100),
  243. ProjectileMax(20),
  244. WeaponMax(20),
  245. WarheadMax(20),
  246. TrigTypeMax(80),
  247. CloseEnoughDistance(0x0280),
  248. StrayDistance(0x0200),
  249. CrushDistance(0x0180),
  250. CrateRadius(0x0280),
  251. HomingScatter(0x0200),
  252. BallisticScatter(0x0100),
  253. RefundPercent(fixed::_1_2),
  254. IronCurtainDuration(fixed::_1_2),
  255. BridgeStrength(1000),
  256. BuildSpeedBias(1),
  257. C4Delay(".03"),
  258. RepairThreshhold(1000),
  259. PathDelay(".016"),
  260. MovieTime(fixed::_1_4),
  261. TiberiumShortScan(0x0600),
  262. TiberiumLongScan(0x2000),
  263. HealthBarDisplayMode(HB_SELECTED),
  264. ResourceBarDisplayMode(RB_SELECTED)
  265. {
  266. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  267. NewUnitsEnabled = SecretUnitsEnabled = 0;
  268. MTankDistance = 30;
  269. QuakeUnitDamage = 0x080;
  270. QuakeBuildingDamage = 0x040;
  271. QuakeInfantryDamage = 0;
  272. QuakeDelay = 120;
  273. ChronoTankDuration = 0x300;
  274. #ifdef FIXIT_ENGINEER // checked - ajw 9/28/98
  275. EngineerDamage=(fixed)1 / (fixed)3; // Amount of damage an engineer does
  276. EngineerCaptureLevel=ConditionRed; // Building damage level before engineer can capture
  277. #endif
  278. #ifdef FIXIT_CARRIER // checked - ajw 9/28/98
  279. CarrierLaunchDelay = 60;
  280. #endif
  281. #endif
  282. }
  283. /***********************************************************************************************
  284. * Difficulty_Get -- Fetch the difficulty bias values. *
  285. * *
  286. * This will fetch the difficulty bias values for the section specified. *
  287. * *
  288. * INPUT: ini -- Reference the INI database to fetch the values from. *
  289. * *
  290. * diff -- Reference to the difficulty class object to fill in with the values. *
  291. * *
  292. * section -- The section identifier to lift the values from. *
  293. * *
  294. * OUTPUT: none *
  295. * *
  296. * WARNINGS: none *
  297. * *
  298. * HISTORY: *
  299. * 07/11/1996 JLB : Created. *
  300. *=============================================================================================*/
  301. static void Difficulty_Get(CCINIClass & ini, DifficultyClass & diff, char const * section)
  302. {
  303. if (ini.Is_Present(section)) {
  304. diff.FirepowerBias = ini.Get_Fixed(section, "FirePower", 1);
  305. diff.GroundspeedBias = ini.Get_Fixed(section, "Groundspeed", 1);
  306. diff.AirspeedBias = ini.Get_Fixed(section, "Airspeed", 1);
  307. diff.ArmorBias = ini.Get_Fixed(section, "Armor", 1);
  308. diff.ROFBias = ini.Get_Fixed(section, "ROF", 1);
  309. diff.CostBias = ini.Get_Fixed(section, "Cost", 1);
  310. diff.RepairDelay = ini.Get_Fixed(section, "RepairDelay", ".02");
  311. diff.BuildDelay = ini.Get_Fixed(section, "BuildDelay", ".03");
  312. diff.IsBuildSlowdown = ini.Get_Bool(section, "BuildSlowdown", false);
  313. diff.BuildSpeedBias = ini.Get_Fixed(section, "BuildTime", 1);
  314. diff.IsWallDestroyer = ini.Get_Bool(section, "DestroyWalls", true);
  315. diff.IsContentScan = ini.Get_Bool(section, "ContentScan", false);
  316. }
  317. }
  318. /***********************************************************************************************
  319. * RulesClass::Process -- Fetch the bulk of the rule data from the control file. *
  320. * *
  321. * This routine will fetch the rule data from the control file. *
  322. * *
  323. * INPUT: file -- Reference to the rule file to process. *
  324. * *
  325. * OUTPUT: bool; Was the rule file processed? *
  326. * *
  327. * WARNINGS: none *
  328. * *
  329. * HISTORY: *
  330. * 06/17/1996 JLB : Created. *
  331. *=============================================================================================*/
  332. bool RulesClass::Process(CCINIClass & ini)
  333. {
  334. BStart(BENCH_RULES);
  335. General(ini);
  336. MPlayer(ini);
  337. Recharge(ini);
  338. Heap_Maximums(ini);
  339. AI(ini);
  340. Powerups(ini);
  341. Land_Types(ini);
  342. Themes(ini);
  343. IQ(ini);
  344. Objects(ini);
  345. Difficulty(ini);
  346. BEnd(BENCH_RULES);
  347. return(true);
  348. }
  349. /***********************************************************************************************
  350. * RulesClass::General -- Process the general main game rules. *
  351. * *
  352. * This fetches the control constants uses for regular game processing. Any game behavior *
  353. * controlling values that don't properly fit in any of the other catagories will be *
  354. * stored here. *
  355. * *
  356. * INPUT: ini -- Reference to the database to fetch the values from. *
  357. * *
  358. * OUTPUT: bool; Was the general section found and processed? *
  359. * *
  360. * WARNINGS: none *
  361. * *
  362. * HISTORY: *
  363. * 08/08/1996 JLB : Created. *
  364. *=============================================================================================*/
  365. bool RulesClass::General(CCINIClass & ini)
  366. {
  367. static char const * const GENERAL = "General";
  368. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  369. static char const * const AFTERMATH = "Aftermath";
  370. if(ini.Is_Present(AFTERMATH)) {
  371. //debugprint( "NewUnitsEnabled previously %i\n", NewUnitsEnabled );
  372. NewUnitsEnabled = ini.Get_Int(AFTERMATH, "NewUnitsEnabled", 0);
  373. //debugprint( "NewUnitsEnabled set to %i by Rules\n", NewUnitsEnabled );
  374. MTankDistance = ini.Get_Int(AFTERMATH,"MTankDistance",MTankDistance);
  375. QuakeUnitDamage = ini.Get_Fixed(AFTERMATH, "QuakeUnitDamage", QuakeUnitDamage);
  376. QuakeBuildingDamage = ini.Get_Fixed(AFTERMATH, "QuakeBuildingDamage", QuakeBuildingDamage);
  377. QuakeInfantryDamage = ini.Get_Int(AFTERMATH,"QuakeInfantryDamage",QuakeInfantryDamage);
  378. QuakeDelay = ini.Get_Int(AFTERMATH,"QuakeDelay",QuakeDelay);
  379. ChronoTankDuration = ini.Get_Fixed(AFTERMATH, "ChronoTankDuration", ChronoTankDuration);
  380. //Mono_Set_Cursor(0,0);Mono_Printf("Chrono duration: %08x \n",ChronoTankDuration);Keyboard->Get();Keyboard->Get();
  381. #ifdef FIXIT_CARRIER // checked - ajw 9/28/98
  382. CarrierLaunchDelay = ini.Get_Int(AFTERMATH,"CarrierLaunchDelay",120);
  383. #endif
  384. #ifdef FIXIT_ENGINEER // checked - ajw 9/28/98
  385. // Engineer changing fields were specifically left out of Aftrmath.ini, thus these values are not found to set. ajw
  386. // Implies interesting security hole if user creates a separate Aftrmath.ini file!
  387. EngineerDamage = ini.Get_Fixed(AFTERMATH, "EngineerDamage", EngineerDamage); // Amount of damage an engineer does
  388. EngineerCaptureLevel = ini.Get_Fixed(AFTERMATH, "EngineerCaptureLevel", EngineerCaptureLevel); // Building damage level before engineer can capture
  389. #endif
  390. }
  391. #endif
  392. if (ini.Is_Present(GENERAL)) {
  393. TurboBoost = ini.Get_Fixed(GENERAL, "TurboBoost", TurboBoost);
  394. BadgerBombCount = ini.Get_Int(GENERAL, "BadgerBombCount", BadgerBombCount);
  395. IsCurleyShuffle = ini.Get_Bool(GENERAL, "CurleyShuffle", IsCurleyShuffle);
  396. IsFlashLowPower = ini.Get_Bool(GENERAL, "FlashLowPower", IsFlashLowPower);
  397. IsChronoKill = ini.Get_Bool(GENERAL, "ChronoKillCargo", IsChronoKill);
  398. ChronoDuration = ini.Get_Fixed(GENERAL, "ChronoDuration", ChronoDuration);
  399. IsFineDifficulty = ini.Get_Bool(GENERAL, "FineDiffControl", IsFineDifficulty);
  400. WaterCrateChance = ini.Get_Fixed(GENERAL, "WaterCrateChance", WaterCrateChance);
  401. SoloCrateMoney = ini.Get_Int(GENERAL, "SoloCrateMoney", SoloCrateMoney);
  402. ParaBombTechLevel = ini.Get_Int(GENERAL, "ParabombTech", ParaBombTechLevel);
  403. GPSTechLevel = ini.Get_Int(GENERAL, "GPSTechLevel", GPSTechLevel);
  404. UnitCrateType = ini.Get_UnitType(GENERAL, "UnitCrateType", UnitCrateType);
  405. IsExplosiveHarvester = ini.Get_Fixed(GENERAL, "OreExplosive", IsExplosiveHarvester);
  406. GapRegenInterval = ini.Get_Fixed(GENERAL, "GapRegenInterval", GapRegenInterval);
  407. TeamDelay = ini.Get_Fixed(GENERAL, "TeamDelay", TeamDelay);
  408. CloakDelay = ini.Get_Fixed(GENERAL, "SubmergeDelay", CloakDelay);
  409. GameSpeedBias = ini.Get_Fixed(GENERAL, "GameSpeedBias", GameSpeedBias);
  410. NervousBias = ini.Get_Fixed(GENERAL, "BaseBias", NervousBias);
  411. ExplosionSpread = ini.Get_Fixed(GENERAL, "ExpSpread", ExplosionSpread);
  412. SupressRadius = ini.Get_Lepton(GENERAL, "FireSupress", SupressRadius);
  413. ParaInfantryTechLevel = ini.Get_Int(GENERAL, "ParaTech", ParaInfantryTechLevel);
  414. SpyPlaneTechLevel = ini.Get_Int(GENERAL, "SpyPlaneTech", SpyPlaneTechLevel);
  415. SilverCrate = ini.Get_CrateType(GENERAL, "SilverCrate", SilverCrate);
  416. WoodCrate = ini.Get_CrateType(GENERAL, "WoodCrate", WoodCrate);
  417. WaterCrate = ini.Get_CrateType(GENERAL, "WaterCrate", WaterCrate);
  418. CrateMinimum = ini.Get_Int(GENERAL, "CrateMinimum", CrateMinimum);
  419. CrateMaximum = ini.Get_Int(GENERAL, "CrateMaximum", CrateMaximum);
  420. IsScatter = ini.Get_Bool(GENERAL, "PlayerScatter", IsScatter);
  421. IsSmartDefense = ini.Get_Bool(GENERAL, "PlayerReturnFire", IsSmartDefense);
  422. IsAutoCrush = ini.Get_Bool(GENERAL, "PlayerAutoCrush", IsAutoCrush);
  423. IsNamed = ini.Get_Bool(GENERAL, "NamedCivilians", IsNamed);
  424. IsTGrowth = ini.Get_Bool(GENERAL, "OreGrows", IsTGrowth);
  425. IsTSpread = ini.Get_Bool(GENERAL, "OreSpreads", IsTSpread);
  426. IsMineAware = ini.Get_Bool(GENERAL, "MineAware", IsMineAware);
  427. IsTreeTarget = ini.Get_Bool(GENERAL, "TreeTargeting", IsTreeTarget);
  428. IsSeparate = ini.Get_Bool(GENERAL, "SeparateAircraft", IsSeparate);
  429. DropZoneRadius = ini.Get_Lepton(GENERAL, "DropZoneRadius", DropZoneRadius);
  430. MessageDelay = ini.Get_Fixed(GENERAL, "MessageDelay", MessageDelay);
  431. SavourDelay = ini.Get_Fixed(GENERAL, "SavourDelay", SavourDelay);
  432. AVMineDamage = ini.Get_Int(GENERAL, "AVMineDamage", AVMineDamage);
  433. APMineDamage = ini.Get_Int(GENERAL, "APMineDamage", APMineDamage);
  434. BaseDefenseDelay = ini.Get_Fixed(GENERAL, "BaseDefenseDelay", BaseDefenseDelay);
  435. SuspendPriority = ini.Get_Int(GENERAL, "SuspendPriority", SuspendPriority);
  436. SuspendDelay = ini.Get_Fixed(GENERAL, "SuspendDelay", SuspendDelay);
  437. SurvivorFraction = ini.Get_Fixed(GENERAL, "SurvivorRate", SurvivorFraction);
  438. RadarJamRadius = ini.Get_Lepton(GENERAL, "RadarJamRadius", RadarJamRadius);
  439. ReloadRate = ini.Get_Fixed(GENERAL, "ReloadRate", ReloadRate);
  440. RandomAnimateTime = ini.Get_Fixed(GENERAL, "IdleActionFrequency", RandomAnimateTime);
  441. BuildupTime = ini.Get_Fixed(GENERAL, "BuildupTime", BuildupTime);
  442. OreDumpRate = ini.Get_Int(GENERAL, "OreTruckRate", OreDumpRate);
  443. AtomDamage = ini.Get_Int(GENERAL, "AtomDamage", AtomDamage);
  444. BailCount = ini.Get_Int(GENERAL, "BailCount", BailCount);
  445. BallisticScatter = ini.Get_Lepton(GENERAL, "BallisticScatter", BallisticScatter);
  446. BridgeStrength = ini.Get_Int(GENERAL, "BridgeStrength", BridgeStrength);
  447. BuildSpeedBias = ini.Get_Fixed(GENERAL, "BuildSpeed", BuildSpeedBias);
  448. ConditionGreen = 1;
  449. ConditionRed = ini.Get_Fixed(GENERAL, "ConditionRed", ConditionRed);
  450. ConditionYellow = ini.Get_Fixed(GENERAL, "ConditionYellow", ConditionYellow);
  451. CrateRadius = ini.Get_Lepton(GENERAL, "CrateRadius", CrateRadius);
  452. CrushDistance = ini.Get_Lepton(GENERAL, "Crush", CrushDistance);
  453. DamageDelay = ini.Get_Fixed(GENERAL, "DamageDelay", DamageDelay);
  454. GapShroudRadius = ini.Get_Int(GENERAL, "GapRadius", GapShroudRadius);
  455. GemValue = ini.Get_Int(GENERAL, "GemValue", GemValue);
  456. GoldValue = ini.Get_Int(GENERAL, "GoldValue", GoldValue);
  457. Gravity = ini.Get_Int(GENERAL, "Gravity", Gravity);
  458. GrowthRate = ini.Get_Fixed(GENERAL, "GrowthRate", GrowthRate);
  459. HomingScatter = ini.Get_Lepton(GENERAL, "HomingScatter", HomingScatter);
  460. Incoming = ini.Get_MPHType(GENERAL, "Incoming", MPH_IMMOBILE);
  461. IronCurtainDuration = ini.Get_Fixed(GENERAL, "IronCurtain", IronCurtainDuration);
  462. IsAllyReveal = ini.Get_Bool(GENERAL, "AllyReveal", IsAllyReveal);
  463. IsMCVDeploy = ini.Get_Bool(GENERAL, "MCVUndeploy", IsMCVDeploy);
  464. MaxDamage = ini.Get_Int(GENERAL, "MaxDamage", MaxDamage);
  465. MinDamage = ini.Get_Int(GENERAL, "MinDamage", MinDamage);
  466. ProneDamageBias = ini.Get_Fixed(GENERAL, "ProneDamage", ProneDamageBias);
  467. QuakeDamagePercent = ini.Get_Fixed(GENERAL, "QuakeDamage", QuakeDamagePercent);
  468. QuakeChance = ini.Get_Fixed(GENERAL, "QuakeChance", QuakeChance);
  469. RefundPercent = ini.Get_Fixed(GENERAL, "RefundPercent", RefundPercent);
  470. RepairPercent = ini.Get_Fixed(GENERAL, "RepairPercent", RepairPercent);
  471. RepairStep = ini.Get_Int(GENERAL, "RepairStep", RepairStep);
  472. URepairPercent = ini.Get_Fixed(GENERAL, "URepairPercent", URepairPercent);
  473. URepairStep = ini.Get_Int(GENERAL, "URepairStep", URepairStep);
  474. RepairRate = ini.Get_Fixed(GENERAL, "RepairRate", RepairRate);
  475. ShroudRate = ini.Get_Fixed(GENERAL, "ShroudRate", ShroudRate);
  476. SpeakDelay = ini.Get_Fixed(GENERAL, "SpeakDelay", SpeakDelay);
  477. StrayDistance = ini.Get_Lepton(GENERAL, "Stray", StrayDistance);
  478. CloseEnoughDistance = ini.Get_Lepton(GENERAL, "CloseEnough", CloseEnoughDistance);
  479. TimerWarning = ini.Get_Fixed(GENERAL, "TimerWarning", TimerWarning);
  480. MovieTime = ini.Get_Fixed(GENERAL, "MovieTime", MovieTime);
  481. C4Delay = ini.Get_Fixed(GENERAL, "C4Delay", C4Delay);
  482. ChronoTechLevel = ini.Get_Int(GENERAL, "ChronoTechLevel", ChronoTechLevel);
  483. CrateTime = ini.Get_Fixed(GENERAL, "CrateRegen", CrateTime);
  484. VortexRange = ini.Get_Lepton(GENERAL, "VortexRange", VortexRange);
  485. VortexSpeed = MPHType(_Scale_To_256(ini.Get_Int(GENERAL, "VortexSpeed", VortexSpeed)));
  486. VortexDamage = ini.Get_Int(GENERAL, "VortexDamage", VortexDamage);
  487. VortexChance = ini.Get_Fixed(GENERAL, "VortexChance", VortexChance);
  488. ChronalVortex.Set_Range(VortexRange / CELL_LEPTON_W);
  489. ChronalVortex.Set_Speed(VortexSpeed);
  490. ChronalVortex.Set_Damage(VortexDamage);
  491. //ChronalVortex.Set_Range ( ini.Get_Int (GENERAL, "VortexRange", ChronalVortex.Get_Range() ) );
  492. //ChronalVortex.Set_Speed ( ini.Get_Int (GENERAL, "VortexSpeed", ChronalVortex.Get_Speed() ) );
  493. //ChronalVortex.Set_Damage ( ini.Get_Int (GENERAL, "VortexDamage", ChronalVortex.Get_Damage() ) );
  494. return(true);
  495. }
  496. return(false);
  497. }
  498. /***********************************************************************************************
  499. * RulesClass::MPlayer -- Fetch and process the multiplayer default settings. *
  500. * *
  501. * This is used to set the default settings for the multiplayer system. *
  502. * *
  503. * INPUT: ini -- Reference to the INI database. *
  504. * *
  505. * OUTPUT: bool; Was the multiplayer default override section found and processed? *
  506. * *
  507. * WARNINGS: none *
  508. * *
  509. * HISTORY: *
  510. * 08/08/1996 JLB : Created. *
  511. *=============================================================================================*/
  512. bool RulesClass::MPlayer(CCINIClass & ini)
  513. {
  514. static char const * const MPLAYER = "MultiplayerDefaults";
  515. if (ini.Is_Present(MPLAYER)) {
  516. MPDefaultMoney = ini.Get_Int(MPLAYER, "Money", MPDefaultMoney);
  517. MPMaxMoney = ini.Get_Int(MPLAYER, "MaxMoney", MPMaxMoney);
  518. IsMPShadowGrow = ini.Get_Bool(MPLAYER, "ShadowGrow", IsMPShadowGrow);
  519. IsMPBasesOn = ini.Get_Bool(MPLAYER, "Bases", IsMPBasesOn);
  520. IsMPTiberiumGrow = ini.Get_Bool(MPLAYER, "OreGrows", IsMPTiberiumGrow);
  521. IsMPCrates = ini.Get_Bool(MPLAYER, "Crates", IsMPCrates);
  522. IsMPCaptureTheFlag = ini.Get_Bool(MPLAYER, "CaptureTheFlag", IsMPCaptureTheFlag);
  523. return(true);
  524. }
  525. return(false);
  526. }
  527. /***********************************************************************************************
  528. * RulesClass::Recharge -- Process the super weapon recharge statistics. *
  529. * *
  530. * Use this to set the recharge times for the various super weapons available. *
  531. * *
  532. * INPUT: ini -- Reference to the database. *
  533. * *
  534. * OUTPUT: bool; Was the recharge section found and processed? *
  535. * *
  536. * WARNINGS: none *
  537. * *
  538. * HISTORY: *
  539. * 08/08/1996 JLB : Created. *
  540. *=============================================================================================*/
  541. bool RulesClass::Recharge(CCINIClass & ini)
  542. {
  543. static char const * const RECHARGE = "Recharge";
  544. if (ini.Is_Present(RECHARGE)) {
  545. SonarTime = ini.Get_Fixed(RECHARGE, "Sonar", SonarTime);
  546. ChronoTime = ini.Get_Fixed(RECHARGE, "Chrono", ChronoTime);
  547. ParaBombTime = ini.Get_Fixed(RECHARGE, "ParaBomb", ParaBombTime);
  548. ParaInfantryTime = ini.Get_Fixed(RECHARGE, "Paratrooper", ParaInfantryTime);
  549. SpyTime = ini.Get_Fixed(RECHARGE, "SpyPlane", SpyTime);
  550. IronCurtainTime = ini.Get_Fixed(RECHARGE, "IronCurtain", IronCurtainTime);
  551. GPSTime = ini.Get_Fixed(RECHARGE, "GPS", GPSTime);
  552. NukeTime = ini.Get_Fixed(RECHARGE, "Nuke", NukeTime);
  553. return(true);
  554. }
  555. return(false);
  556. }
  557. /***********************************************************************************************
  558. * RulesClass::Heap_Maximums -- Fetch and process the heap override values. *
  559. * *
  560. * This fetches the maximum heap sizes from the database specified. The heaps will be *
  561. * initialized by this routine as indicated. *
  562. * *
  563. * INPUT: ini -- Reference to the INI database. *
  564. * *
  565. * OUTPUT: bool; Was the maximum section found and processed? *
  566. * *
  567. * WARNINGS: This process is catastrophic to any data currently existing in the heaps *
  568. * modified. This should only be processed during the game initialization stage. *
  569. * *
  570. * HISTORY: *
  571. * 08/08/1996 JLB : Created. *
  572. *=============================================================================================*/
  573. bool RulesClass::Heap_Maximums(CCINIClass & ini)
  574. {
  575. /*
  576. ** Heap maximum values.
  577. */
  578. static char const * const MAXIMUMS = "Maximums";
  579. if (ini.Is_Present(MAXIMUMS)) {
  580. MaxPlayers = ini.Get_Int(MAXIMUMS, "Players", MaxPlayers);
  581. AircraftMax = ini.Get_Int(MAXIMUMS, "Aircraft", AircraftMax);
  582. AnimMax = ini.Get_Int(MAXIMUMS, "Anim", AnimMax);
  583. BuildingMax = ini.Get_Int(MAXIMUMS, "Building", BuildingMax);
  584. BulletMax = ini.Get_Int(MAXIMUMS, "Bullet", BulletMax);
  585. FactoryMax = ini.Get_Int(MAXIMUMS, "Factory", FactoryMax);
  586. InfantryMax = ini.Get_Int(MAXIMUMS, "Infantry", InfantryMax);
  587. OverlayMax = ini.Get_Int(MAXIMUMS, "Overlay", OverlayMax);
  588. SmudgeMax = ini.Get_Int(MAXIMUMS, "Smudge", SmudgeMax);
  589. TeamMax = ini.Get_Int(MAXIMUMS, "Team", TeamMax);
  590. TeamTypeMax = ini.Get_Int(MAXIMUMS, "TeamType", TeamTypeMax);
  591. TemplateMax = ini.Get_Int(MAXIMUMS, "Template", TemplateMax);
  592. TerrainMax = ini.Get_Int(MAXIMUMS, "Terrain", TerrainMax);
  593. TriggerMax = ini.Get_Int(MAXIMUMS, "Trigger", TriggerMax);
  594. UnitMax = ini.Get_Int(MAXIMUMS, "Unit", UnitMax);
  595. VesselMax = ini.Get_Int(MAXIMUMS, "Vessel", VesselMax);
  596. ProjectileMax = ini.Get_Int(MAXIMUMS, "Projectile", ProjectileMax);
  597. WeaponMax = ini.Get_Int(MAXIMUMS, "Weapon", WeaponMax);
  598. WarheadMax = ini.Get_Int(MAXIMUMS, "Warhead", WarheadMax);
  599. TrigTypeMax = ini.Get_Int(MAXIMUMS, "TrigType", TrigTypeMax);
  600. }
  601. /*
  602. ** Special case: double maximum animations to accomodate lots of action
  603. */
  604. AnimMax = max(AnimMax, 200);
  605. /*
  606. ** Any heaps that use the maximums that were just loaded, must
  607. ** be initialized as necessary.
  608. */
  609. Warheads.Set_Heap(WarheadMax);
  610. new WarheadTypeClass("SA");
  611. new WarheadTypeClass("HE");
  612. new WarheadTypeClass("AP");
  613. new WarheadTypeClass("Fire");
  614. new WarheadTypeClass("HollowPoint");
  615. new WarheadTypeClass("Super");
  616. new WarheadTypeClass("Organic");
  617. new WarheadTypeClass("Nuke");
  618. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  619. new WarheadTypeClass("Mechanical");
  620. #endif
  621. Weapons.Set_Heap(WeaponMax);
  622. new WeaponTypeClass("Colt45");
  623. new WeaponTypeClass("ZSU-23");
  624. new WeaponTypeClass("Vulcan");
  625. new WeaponTypeClass("Maverick");
  626. new WeaponTypeClass("Camera");
  627. new WeaponTypeClass("FireballLauncher");
  628. new WeaponTypeClass("Sniper");
  629. new WeaponTypeClass("ChainGun");
  630. new WeaponTypeClass("Pistol");
  631. new WeaponTypeClass("M1Carbine");
  632. new WeaponTypeClass("Dragon");
  633. new WeaponTypeClass("Hellfire");
  634. new WeaponTypeClass("Grenade");
  635. new WeaponTypeClass("75mm");
  636. new WeaponTypeClass("90mm");
  637. new WeaponTypeClass("105mm");
  638. new WeaponTypeClass("120mm");
  639. new WeaponTypeClass("TurretGun");
  640. new WeaponTypeClass("MammothTusk");
  641. new WeaponTypeClass("155mm");
  642. new WeaponTypeClass("M60mg");
  643. new WeaponTypeClass("Napalm");
  644. new WeaponTypeClass("TeslaZap");
  645. new WeaponTypeClass("Nike");
  646. new WeaponTypeClass("8Inch");
  647. new WeaponTypeClass("Stinger");
  648. new WeaponTypeClass("TorpTube");
  649. new WeaponTypeClass("2Inch");
  650. new WeaponTypeClass("DepthCharge");
  651. new WeaponTypeClass("ParaBomb");
  652. new WeaponTypeClass("DogJaw");
  653. new WeaponTypeClass("Heal");
  654. new WeaponTypeClass("SCUD");
  655. new WeaponTypeClass("Flamer");
  656. new WeaponTypeClass("RedEye");
  657. #ifdef FIXIT_ANTS
  658. new WeaponTypeClass("Mandible");
  659. #endif
  660. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  661. new WeaponTypeClass("PortaTesla");
  662. new WeaponTypeClass("GoodWrench");
  663. new WeaponTypeClass("SubSCUD");
  664. new WeaponTypeClass("TTankZap");
  665. new WeaponTypeClass("APTusk");
  666. new WeaponTypeClass("Democharge");
  667. #endif
  668. #ifdef FIXIT_CARRIER // checked - ajw 9/28/98
  669. new WeaponTypeClass("AirAssault");
  670. #endif
  671. return(true);
  672. }
  673. /***********************************************************************************************
  674. * RulesClass::AI -- Processes the AI control constants from the database. *
  675. * *
  676. * This will examine the database specified and set the AI override values accordingly. *
  677. * *
  678. * INPUT: ini -- Reference to the INI database that holds the AI overrides. *
  679. * *
  680. * OUTPUT: bool; Was the AI section found and processed? *
  681. * *
  682. * WARNINGS: none *
  683. * *
  684. * HISTORY: *
  685. * 08/08/1996 JLB : Created. *
  686. *=============================================================================================*/
  687. bool RulesClass::AI(CCINIClass & ini)
  688. {
  689. static char const * const AI = "AI";
  690. if (ini.Is_Present(AI)) {
  691. AttackInterval = ini.Get_Fixed(AI, "AttackInterval", AttackInterval);
  692. AttackDelay = ini.Get_Fixed(AI, "AttackDelay", AttackDelay);
  693. PatrolTime = ini.Get_Fixed(AI, "PatrolScan", PatrolTime);
  694. RepairThreshhold = ini.Get_Int(AI, "CreditReserve", RepairThreshhold);
  695. PathDelay = ini.Get_Fixed(AI, "PathDelay", PathDelay);
  696. TiberiumShortScan = ini.Get_Lepton(AI, "OreNearScan", TiberiumShortScan);
  697. TiberiumLongScan = ini.Get_Lepton(AI, "OreFarScan", TiberiumLongScan);
  698. AutocreateTime = ini.Get_Fixed(AI, "AutocreateTime", AutocreateTime);
  699. InfantryReserve = ini.Get_Int(AI, "InfantryReserve", InfantryReserve);
  700. InfantryBaseMult = ini.Get_Int(AI, "InfantryBaseMult", InfantryBaseMult);
  701. PowerSurplus = ini.Get_Int(AI, "PowerSurplus", PowerSurplus);
  702. BaseSizeAdd = ini.Get_Int(AI, "BaseSizeAdd", BaseSizeAdd);
  703. RefineryRatio = ini.Get_Fixed(AI, "RefineryRatio", RefineryRatio);
  704. RefineryLimit = ini.Get_Int(AI, "RefineryLimit", RefineryLimit);
  705. BarracksRatio = ini.Get_Fixed(AI, "BarracksRatio", BarracksRatio);
  706. BarracksLimit = ini.Get_Int(AI, "BarracksLimit", BarracksLimit);
  707. WarRatio = ini.Get_Fixed(AI, "WarRatio", WarRatio);
  708. WarLimit = ini.Get_Int(AI, "WarLimit", WarLimit);
  709. DefenseRatio = ini.Get_Fixed(AI, "DefenseRatio", DefenseRatio);
  710. DefenseLimit = ini.Get_Int(AI, "DefenseLimit", DefenseLimit);
  711. AARatio = ini.Get_Fixed(AI, "AARatio", AARatio);
  712. AALimit = ini.Get_Int(AI, "AALimit", AALimit);
  713. TeslaRatio = ini.Get_Fixed(AI, "TeslaRatio", TeslaRatio);
  714. TeslaLimit = ini.Get_Int(AI, "TeslaLimit", TeslaLimit);
  715. HelipadRatio = ini.Get_Fixed(AI, "HelipadRatio", HelipadRatio);
  716. HelipadLimit = ini.Get_Int(AI, "HelipadLimit", HelipadLimit);
  717. AirstripRatio = ini.Get_Fixed(AI, "AirstripRatio", AirstripRatio);
  718. AirstripLimit = ini.Get_Int(AI, "AirstripLimit", AirstripLimit);
  719. IsCompEasyBonus = ini.Get_Bool(AI, "CompEasyBonus", IsCompEasyBonus);
  720. IsComputerParanoid = ini.Get_Bool(AI, "Paranoid", IsComputerParanoid);
  721. PowerEmergencyFraction = ini.Get_Fixed(AI, "PowerEmergency", PowerEmergencyFraction);
  722. return(true);
  723. }
  724. return(false);
  725. }
  726. /***********************************************************************************************
  727. * RulesClass::Powerups -- Process the powerup values from the database. *
  728. * *
  729. * This will examine the database and initialize the powerup override values accordingly. *
  730. * *
  731. * INPUT: ini -- Reference to the INI database the the powerup values are to be *
  732. * initialized from. *
  733. * *
  734. * OUTPUT: bool; Was the powerup section found and processed? *
  735. * *
  736. * WARNINGS: none *
  737. * *
  738. * HISTORY: *
  739. * 08/08/1996 JLB : Created. *
  740. *=============================================================================================*/
  741. bool RulesClass::Powerups(CCINIClass & ini)
  742. {
  743. static char const * const POWERUPS = "Powerups";
  744. if (ini.Is_Present(POWERUPS)) {
  745. for (CrateType crate = CRATE_FIRST; crate < CRATE_COUNT; crate++) {
  746. char buffer[128];
  747. if (ini.Get_String(POWERUPS, CrateNames[crate], "0,NONE", buffer, sizeof(buffer))) {
  748. /*
  749. ** Share odds.
  750. */
  751. char * token = strtok(buffer, ",");
  752. if (token) {
  753. strtrim(token);
  754. CrateShares[crate] = atoi(token);
  755. }
  756. /*
  757. ** Animation to use.
  758. */
  759. token = strtok(NULL, ",");
  760. if (token) {
  761. strtrim(token);
  762. CrateAnims[crate] = Anim_From_Name(token);
  763. }
  764. /*
  765. ** Optional data number.
  766. */
  767. token = strtok(NULL, ",");
  768. if (token != NULL) {
  769. if (strpbrk(token, ".%") != NULL) {
  770. CrateData[crate] = fixed(token) * 256;
  771. } else {
  772. strtrim(token);
  773. CrateData[crate] = atoi(token);
  774. }
  775. }
  776. }
  777. }
  778. return(true);
  779. }
  780. return(false);
  781. }
  782. /***********************************************************************************************
  783. * RulesClass::Land_Types -- Inits the land type values. *
  784. * *
  785. * This will set the land movement attributes from the database specified. *
  786. * *
  787. * INPUT: ini -- Reference to the database that has the land value overrides. *
  788. * *
  789. * OUTPUT: bool; Was the land type sections found and processed? *
  790. * *
  791. * WARNINGS: none *
  792. * *
  793. * HISTORY: *
  794. * 08/08/1996 JLB : Created. *
  795. *=============================================================================================*/
  796. bool RulesClass::Land_Types(CCINIClass & ini)
  797. {
  798. /*
  799. ** Fetch the movement characteristic data for terrain types.
  800. */
  801. for (LandType land = LAND_FIRST; land < LAND_COUNT; land++) {
  802. static char const * _lands[LAND_COUNT] = {
  803. "Clear",
  804. "Road",
  805. "Water",
  806. "Rock",
  807. "Wall",
  808. "Ore",
  809. "Beach",
  810. "Rough",
  811. "River"
  812. };
  813. GroundType * gptr = &Ground[land];
  814. if (ini.Is_Present(_lands[land])) {
  815. gptr->Cost[SPEED_FOOT] = ini.Get_Fixed(_lands[land], "Foot", 1);
  816. gptr->Cost[SPEED_TRACK] = ini.Get_Fixed(_lands[land], "Track", 1);
  817. gptr->Cost[SPEED_WHEEL] = ini.Get_Fixed(_lands[land], "Wheel", 1);
  818. gptr->Cost[SPEED_WINGED] = fixed(1);
  819. gptr->Cost[SPEED_FLOAT] = ini.Get_Fixed(_lands[land], "Float", 1);
  820. gptr->Build = ini.Get_Bool(_lands[land], "Buildable", false);
  821. }
  822. }
  823. return(true);
  824. }
  825. /***********************************************************************************************
  826. * RulesClass::Themes -- Fetches the theme control values from the INI database. *
  827. * *
  828. * The musical theme availability is controlled by the scenario and the player's house *
  829. * choice. These controls can be specified in the theme control section of the INI *
  830. * database. *
  831. * *
  832. * INPUT: ini -- Reference to the INI database to process. *
  833. * *
  834. * OUTPUT: bool; Was the theme section found and processed? *
  835. * *
  836. * WARNINGS: none *
  837. * *
  838. * HISTORY: *
  839. * 08/11/1996 JLB : Created. *
  840. *=============================================================================================*/
  841. bool RulesClass::Themes(CCINIClass & ini)
  842. {
  843. static char const * const THEMECONTROL = "ThemeControl";
  844. if (ini.Is_Present(THEMECONTROL)) {
  845. for (ThemeType theme = THEME_FIRST; theme < THEME_COUNT; theme++) {
  846. if (ini.Is_Present(THEMECONTROL, Theme.Base_Name(theme))) {
  847. char buffer[128];
  848. int scen = 1;
  849. int owners = HOUSEF_ALLIES | HOUSEF_SOVIET | HOUSEF_OTHERS;
  850. ini.Get_String(THEMECONTROL, Theme.Base_Name(theme), "", buffer, sizeof(buffer));
  851. char const * token = strtok(buffer, ",");
  852. if (token != NULL) {
  853. scen = atoi(token);
  854. }
  855. token = strtok(NULL, ",");
  856. if (token != NULL) {
  857. owners = Owner_From_Name(token);
  858. }
  859. Theme.Set_Theme_Data(theme, scen, owners);
  860. }
  861. }
  862. return(true);
  863. }
  864. return(false);
  865. }
  866. /***********************************************************************************************
  867. * RulesClass::IQ -- Fetches the IQ control values from the INI database. *
  868. * *
  869. * This will scan the database specified and retrieve the IQ control values from it. These *
  870. * IQ control values are what gives the IQ rating meaning. It fundimentally controls how *
  871. * the computer behaves. *
  872. * *
  873. * INPUT: ini -- Reference to the INI database to read the IQ controls from. *
  874. * *
  875. * OUTPUT: bool; Was the IQ section found and processed? *
  876. * *
  877. * WARNINGS: none *
  878. * *
  879. * HISTORY: *
  880. * 08/11/1996 JLB : Created. *
  881. *=============================================================================================*/
  882. bool RulesClass::IQ(CCINIClass & ini)
  883. {
  884. static char const * const IQCONTROL = "IQ";
  885. if (ini.Is_Present(IQCONTROL)) {
  886. MaxIQ = ini.Get_Int(IQCONTROL, "MaxIQLevels", MaxIQ);
  887. IQSuperWeapons = ini.Get_Int(IQCONTROL, "SuperWeapons", IQSuperWeapons);
  888. IQProduction = ini.Get_Int(IQCONTROL, "Production", IQProduction);
  889. IQGuardArea = ini.Get_Int(IQCONTROL, "GuardArea", IQGuardArea);
  890. IQRepairSell = ini.Get_Int(IQCONTROL, "RepairSell", IQRepairSell);
  891. IQCrush = ini.Get_Int(IQCONTROL, "AutoCrush", IQCrush);
  892. IQScatter = ini.Get_Int(IQCONTROL, "Scatter", IQScatter);
  893. IQContentScan = ini.Get_Int(IQCONTROL, "ContentScan", IQContentScan);
  894. IQAircraft = ini.Get_Int(IQCONTROL, "Aircraft", IQAircraft);
  895. IQHarvester = ini.Get_Int(IQCONTROL, "Harvester", IQHarvester);
  896. IQSellBack = ini.Get_Int(IQCONTROL, "SellBack", IQSellBack);
  897. return(true);
  898. }
  899. return(false);
  900. }
  901. /***********************************************************************************************
  902. * RulesClass::Objects -- Fetch all the object characteristic values. *
  903. * *
  904. * This will parse the specified INI database and fetch all the object characteristic *
  905. * values specified therein. *
  906. * *
  907. * INPUT: ini -- Reference to the ini database to scan. *
  908. * *
  909. * OUTPUT: none *
  910. * *
  911. * WARNINGS: none *
  912. * *
  913. * HISTORY: *
  914. * 09/10/1996 JLB : Created. *
  915. *=============================================================================================*/
  916. bool RulesClass::Objects(CCINIClass & ini)
  917. {
  918. /*
  919. ** Fetch the game object values from the rules file.
  920. */
  921. for (int index = 0; index < Warheads.Count(); index++) {
  922. Warheads.Ptr(index)->Read_INI(ini);
  923. }
  924. for (int proj = 0; proj < BulletTypes.Count(); proj++) {
  925. BulletTypes.Ptr(proj)->Read_INI(ini);
  926. }
  927. for (int windex = 0; windex < Weapons.Count(); windex++) {
  928. Weapons.Ptr(windex)->Read_INI(ini);
  929. }
  930. for (int uindex = 0; uindex < UnitTypes.Count(); uindex++) {
  931. UnitTypes.Ptr(uindex)->Read_INI(ini);
  932. }
  933. for (int iindex = 0; iindex < InfantryTypes.Count(); iindex++) {
  934. InfantryTypes.Ptr(iindex)->Read_INI(ini);
  935. }
  936. for (int vindex = 0; vindex < VesselTypes.Count(); vindex++) {
  937. VesselTypes.Ptr(vindex)->Read_INI(ini);
  938. }
  939. for (int aindex = 0; aindex < AircraftTypes.Count(); aindex++) {
  940. AircraftTypes.Ptr(aindex)->Read_INI(ini);
  941. }
  942. for (int bindex = 0; bindex < BuildingTypes.Count(); bindex++) {
  943. BuildingTypes.Ptr(bindex)->Read_INI(ini);
  944. }
  945. /*
  946. ** Fetch the house attribute override values.
  947. */
  948. for (HousesType house = HOUSE_FIRST; house < HOUSE_COUNT; house++) {
  949. HouseTypeClass::As_Reference(house).Read_INI(ini);
  950. }
  951. /*
  952. ** Fetch the mission control values.
  953. */
  954. for (MissionType mission = MISSION_FIRST; mission < MISSION_COUNT; mission++) {
  955. MissionControlClass * miss = &MissionControl[mission];
  956. miss->Mission = mission;
  957. miss->Read_INI(ini);
  958. }
  959. return(true);
  960. }
  961. /***********************************************************************************************
  962. * RulesClass::Difficulty -- Fetch the various difficulty group settings. *
  963. * *
  964. * This routine is used to fetch the various group settings for the difficulty levels. *
  965. * *
  966. * INPUT: ini -- Reference to the INI database that has the difficulty setting values. *
  967. * *
  968. * OUTPUT: bool; Was the difficulty section found and processed. *
  969. * *
  970. * WARNINGS: none *
  971. * *
  972. * HISTORY: *
  973. * 09/10/1996 JLB : Created. *
  974. *=============================================================================================*/
  975. bool RulesClass::Difficulty(CCINIClass & ini)
  976. {
  977. #if 0
  978. Difficulty_Get(ini, Diff[DIFF_EASY], "Easy");
  979. Difficulty_Get(ini, Diff[DIFF_NORMAL], "Normal");
  980. Difficulty_Get(ini, Diff[DIFF_HARD], "Difficult");
  981. #endif
  982. return(true);
  983. }
  984. /***********************************************************************************************
  985. * Is_MCV_Deploy -- Check if MCV can be deployed. *
  986. * *
  987. * This routine is used to check if the Construction Yard can revert back into an MCV. *
  988. * It allows the special variables to override anything set by the rules. *
  989. * *
  990. * INPUT: none *
  991. * *
  992. * OUTPUT: bool; Can the Construction Yard revert back into an MCV. *
  993. * *
  994. * WARNINGS: none *
  995. * *
  996. * HISTORY: *
  997. * 10/24/2019 SKY : Created. *
  998. *=============================================================================================*/
  999. bool Is_MCV_Deploy()
  1000. {
  1001. return Special.UseMCVDeploy ? Special.IsMCVDeploy : Rule.IsMCVDeploy;
  1002. }