/branch/FAZR5Dev/src/Igc/mapmakerigc.h

# · C Header · 604 lines · 405 code · 86 blank · 113 comment · 0 complexity · 0ad308c4719c98d27bd1fcdad7ac5815 MD5 · raw file

  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: mapmakerigc.h
  5. **
  6. ** Author: Jeff Fink (jfink@microsoft.com)
  7. **
  8. ** Description:
  9. **
  10. ** History:
  11. */
  12. // mapmakerIGC.h : Declaration of CmapMakerIGC
  13. #ifndef __MAPMAKERIGC_H_
  14. #define __MAPMAKERIGC_H_
  15. typedef Slist_utl<ImapMakerIGC*> MapMakerListIGC;
  16. typedef Slink_utl<ImapMakerIGC*> MapMakerLinkIGC;
  17. //
  18. // Constants currently being used.
  19. //
  20. const int c_MaxClustersPerMap = 50;
  21. const int c_NumClusterNames = 69;
  22. const int c_NumberOfPlanetPosters = 25;
  23. const int c_FriendlyAleph = 0; // Friend to Friend
  24. const int c_EnemyAleph = 1; // Friend to Enemy
  25. const int c_PlayerToNeutralAleph = 2; // Player to Neutral
  26. const int c_NeutralToPlayerAleph = 3; // Neutral to Player
  27. const int c_NeutralAleph = 4; // Neutral to Neutral
  28. const int c_HiddenToPlayerAleph = 5;
  29. //
  30. // The CMapData class holds all the information needed to build
  31. // a map.
  32. //
  33. class CMapData
  34. {
  35. protected:
  36. static const char * smszClusterName[c_NumClusterNames];
  37. protected:
  38. ImissionIGC * mpMission;
  39. const MissionParams * mpMissionParams;
  40. Time mNow;
  41. //
  42. // Members for generating unique cluster names.
  43. //
  44. SectorID mClusterNamesLeft[c_NumClusterNames];
  45. SectorID mcClusterNamesLeft;
  46. //
  47. // Members for storing the sector data.
  48. //
  49. IclusterIGC * mpCluster[c_MaxClustersPerMap];
  50. SideID msideIDCluster[c_MaxClustersPerMap];
  51. //
  52. // Local storage.
  53. //
  54. SectorID mcTeamClustersPerTeam;
  55. SectorID mcNeutralClustersPerTeam;
  56. SectorID mcOtherClusters;
  57. WarpID mIDNextWarp;
  58. public:
  59. CMapData();
  60. ~CMapData();
  61. //
  62. // Reader functions.
  63. //
  64. ImissionIGC * GetMission()
  65. { return(mpMission); }
  66. const MissionParams * GetMissionParams()
  67. { return(mpMissionParams); }
  68. Time GetTime()
  69. { return(mNow); }
  70. IclusterIGC * GetCluster(SectorID sID)
  71. { return(mpCluster[sID]); }
  72. SideID GetClusterSide(SectorID sID)
  73. { return(msideIDCluster[sID]); }
  74. SectorID GetTeamClustersPerTeam()
  75. { return(mcTeamClustersPerTeam); }
  76. SectorID GetNeutralClustersPerTeam()
  77. { return(mcNeutralClustersPerTeam); }
  78. SectorID GetClustersPerTeam()
  79. { return(mcTeamClustersPerTeam + mcNeutralClustersPerTeam); }
  80. SideID GetTeams()
  81. { return(mpMissionParams->nTeams); }
  82. SectorID GetTeamClusters()
  83. { return(GetTeamClustersPerTeam() * GetTeams()); }
  84. SectorID GetNeutralClusters()
  85. { return(GetNeutralClustersPerTeam() * GetTeams()); }
  86. SectorID GetTotalClusters()
  87. { return(GetClustersPerTeam() * GetTeams() + mcOtherClusters); }
  88. SectorID GetOtherClusters()
  89. { return(mcOtherClusters); }
  90. short GetPlayerClusterMineableAsteroids()
  91. { return(mpMissionParams->nPlayerSectorMineableAsteroids); }
  92. short GetPlayerClusterSpecialAsteroids()
  93. { return(mpMissionParams->nPlayerSectorSpecialAsteroids); }
  94. short GetPlayerClusterGenericAsteroids()
  95. { return(mpMissionParams->nPlayerSectorAsteroids); }
  96. short GetPlayerClusterTreasure()
  97. { return(mpMissionParams->nPlayerSectorTreasures); }
  98. short GetNeutralClusterMineableAsteroids()
  99. { return(mpMissionParams->nNeutralSectorMineableAsteroids); }
  100. short GetNeutralClusterSpecialAsteroids()
  101. { return(mpMissionParams->nNeutralSectorSpecialAsteroids); }
  102. short GetNeutralClusterGenericAsteroids()
  103. { return(mpMissionParams->nNeutralSectorAsteroids); }
  104. short GetNeutralClusterTreasure()
  105. { return(mpMissionParams->nNeutralSectorTreasures); }
  106. short GetMinableAsteroids(void)
  107. {
  108. return mpMissionParams->nPlayerSectorMineableAsteroids *
  109. GetTeamClusters() +
  110. mpMissionParams->nNeutralSectorMineableAsteroids *
  111. (GetOtherClusters() + GetNeutralClusters());
  112. }
  113. short GetPlayerStartTSI()
  114. { return mpMissionParams->tsiPlayerStart; }
  115. short GetNeutralStartTSI()
  116. { return mpMissionParams->tsiNeutralStart; }
  117. short GetMaxPlayersOnTeam()
  118. { return(mpMissionParams->nMaxPlayersPerTeam); }
  119. // KGJV-: added, access to iMapSize parameter
  120. short GetMapSize()
  121. { return (mpMissionParams->iMapSize); }
  122. short GetMaxPlayersInMission()
  123. { return(GetMaxPlayersOnTeam() * GetTeams()); }
  124. CivID GetCivID(SideID sideID)
  125. { return(mpMissionParams->rgCivID[sideID]); }
  126. WarpID GetNextWarpID()
  127. { return(mIDNextWarp++); }
  128. //
  129. // Writer functions.
  130. //
  131. VOID SetMission(ImissionIGC * pMission)
  132. { mpMission = pMission; }
  133. VOID SetMissionParams(const MissionParams * pMissionParams)
  134. { mpMissionParams = pMissionParams; }
  135. VOID SetTime(Time now)
  136. { mNow = now; }
  137. VOID SetTeamClustersPerTeam(SectorID sID)
  138. { mcTeamClustersPerTeam = sID; }
  139. VOID SetNeutralClustersPerTeam(SectorID sID)
  140. { mcNeutralClustersPerTeam = sID; }
  141. VOID SetOtherClusters(SectorID sID)
  142. { mcOtherClusters = sID; }
  143. VOID SetCluster(SectorID sID, IclusterIGC * pCluster, SideID sideID);
  144. VOID SetClusterSide(SectorID sID, SideID sideID)
  145. { msideIDCluster[sID] = sideID; }
  146. //
  147. // Our own custom methods.
  148. //
  149. VOID GetNewClusterName(CHAR * szClusterName);
  150. } ;
  151. //
  152. // Base class for the map maker.
  153. //
  154. //
  155. // Shape is a circle (2 alephs in and out of each sector).
  156. // If Teams > 3, neutral sectors get extra aleph to another neutral sector.
  157. // If Players On Team > 30, central player sectors get extra aleph to
  158. // another team's central player sector.
  159. //
  160. class CmapMakerIGC : public ImapMakerIGC
  161. {
  162. protected:
  163. static const char * smszPlanetName[c_NumberOfPlanetPosters];
  164. MapMakerID mMMID;
  165. char mszName[c_cbDescription + 4];
  166. public:
  167. static const char* IsValid(const MissionParams* pmp)
  168. {
  169. return NULL;
  170. }
  171. CmapMakerIGC();
  172. virtual ~CmapMakerIGC();
  173. virtual MapMakerID GetMapMakerID() const { return(mMMID); }
  174. virtual VOID SetMapMakerID(MapMakerID mmID) { mMMID = mmID; }
  175. virtual char const* GetName() const
  176. { return(mszName); }
  177. virtual VOID SetName(const char * newVal)
  178. { strcpy(mszName, newVal); }
  179. virtual VOID GenerateMission(Time now,
  180. const MissionParams * pmp,
  181. ImissionIGC * pMission);
  182. //
  183. // Our own custom helper methods.
  184. //
  185. //virtual VOID GenerateSides(CMapData * pMapData);
  186. virtual VOID GenerateTeamClusterScreenPosition(
  187. CMapData * pMapData,
  188. DataClusterIGC * pdc,
  189. SectorID sID);
  190. virtual IclusterIGC * GenerateTeamCluster(CMapData * pMapData,
  191. SectorID sID);
  192. virtual VOID GenerateNeutralClusterScreenPosition(
  193. CMapData * pMapData,
  194. DataClusterIGC * pdc,
  195. SectorID sID);
  196. virtual IclusterIGC * GenerateNeutralCluster(CMapData * pMapData,
  197. SectorID sID);
  198. virtual VOID GenerateRingClusters(CMapData * pMapData);
  199. virtual VOID GenerateWarp(CMapData* pMapData,
  200. IclusterIGC* pCluster,
  201. DataWarpIGC* pdw);
  202. virtual VOID LinkClusters(CMapData* pMapData,
  203. SectorID sID1,
  204. SectorID sID2,
  205. int alephType = NA);
  206. virtual VOID CrossLinkClusters(CMapData * pMapData,
  207. SectorID sFirstID);
  208. virtual VOID LinkClusters(CMapData * pMapData);
  209. virtual VOID GenerateLayout(CMapData * pMapData);
  210. virtual VOID GenerateStarbase(CMapData * pMapData,
  211. IclusterIGC* pcluster);
  212. virtual VOID PopulateCluster(CMapData* pMapData,
  213. IclusterIGC* pcluster,
  214. float amountHe3);
  215. virtual VOID PopulateClusters(CMapData * pMapData);
  216. virtual VOID RevealHomeClusters(ImissionIGC * pMission);
  217. virtual VOID RevealMap(ImissionIGC * pMission);
  218. virtual VOID ActivateSides(ImissionIGC * pMission);
  219. } ;
  220. //
  221. // Derived classes.
  222. // Just use the base class without changes
  223. class CmapMakerSingleRingIGC : public CmapMakerIGC
  224. {
  225. public:
  226. static const char* IsValid(const MissionParams* pmp)
  227. {
  228. return NULL;
  229. }
  230. };
  231. //
  232. //
  233. // Double ring.
  234. //
  235. // Shape is two concentric circles. The center circle contains 1
  236. // neutral sector for each team. The outer circle contains 1
  237. // sector for each 15 players. Each player sector is connected
  238. // to two neutral sectors.
  239. //
  240. class CmapMakerDoubleRingIGC : public CmapMakerIGC
  241. {
  242. public:
  243. static const char* IsValid(const MissionParams* pmp)
  244. {
  245. return NULL;
  246. }
  247. CmapMakerDoubleRingIGC();
  248. virtual VOID GenerateTeamClusterScreenPosition(
  249. CMapData * pMapData,
  250. DataClusterIGC * pdc,
  251. SectorID sID);
  252. virtual VOID GenerateNeutralClusterScreenPosition(
  253. CMapData * pMapData,
  254. DataClusterIGC * pdc,
  255. SectorID sID);
  256. virtual VOID LinkClusters(CMapData * pMapData);
  257. } ;
  258. //
  259. // HiLo
  260. //
  261. class CmapMakerHiLoIGC : public CmapMakerIGC
  262. {
  263. public:
  264. static const char* IsValid(const MissionParams* pmp)
  265. {
  266. return NULL;
  267. }
  268. CmapMakerHiLoIGC();
  269. virtual VOID GenerateLayout(CMapData * pMapData);
  270. virtual VOID GenerateTeamClusterScreenPosition(
  271. CMapData * pMapData,
  272. DataClusterIGC * pdc,
  273. SectorID sID);
  274. virtual VOID GenerateNeutralClusterScreenPosition(
  275. CMapData * pMapData,
  276. DataClusterIGC * pdc,
  277. SectorID sID);
  278. virtual VOID LinkClusters(CMapData * pMapData);
  279. } ;
  280. //
  281. // HiHigher
  282. //
  283. class CmapMakerHiHigherIGC : public CmapMakerIGC
  284. {
  285. public:
  286. static const char* IsValid(const MissionParams* pmp)
  287. {
  288. return NULL;
  289. }
  290. CmapMakerHiHigherIGC();
  291. virtual VOID GenerateLayout(CMapData * pMapData);
  292. virtual VOID GenerateTeamClusterScreenPosition(
  293. CMapData * pMapData,
  294. DataClusterIGC * pdc,
  295. SectorID sID);
  296. virtual VOID GenerateNeutralClusterScreenPosition(
  297. CMapData * pMapData,
  298. DataClusterIGC * pdc,
  299. SectorID sID);
  300. virtual VOID LinkClusters(CMapData * pMapData);
  301. } ;
  302. //
  303. // Star
  304. //
  305. class CmapMakerStarIGC : public CmapMakerIGC
  306. {
  307. public:
  308. static const char* IsValid(const MissionParams* pmp)
  309. {
  310. return NULL;
  311. }
  312. CmapMakerStarIGC();
  313. virtual VOID GenerateLayout(CMapData * pMapData);
  314. virtual VOID GenerateTeamClusterScreenPosition(
  315. CMapData * pMapData,
  316. DataClusterIGC * pdc,
  317. SectorID sID);
  318. virtual VOID GenerateNeutralClusterScreenPosition(
  319. CMapData * pMapData,
  320. DataClusterIGC * pdc,
  321. SectorID sID);
  322. virtual VOID LinkClusters(CMapData * pMapData);
  323. } ;
  324. //
  325. // Big ring
  326. //
  327. // Shape is a single ring with 2 neutral sectors between home sectors
  328. //
  329. class CmapMakerBigRingIGC : public CmapMakerIGC
  330. {
  331. public:
  332. static const char* IsValid(const MissionParams* pmp)
  333. {
  334. return NULL;
  335. }
  336. CmapMakerBigRingIGC();
  337. virtual VOID GenerateLayout(CMapData * pMapData);
  338. virtual VOID GenerateTeamClusterScreenPosition(
  339. CMapData * pMapData,
  340. DataClusterIGC * pdc,
  341. SectorID sID);
  342. virtual VOID GenerateNeutralClusterScreenPosition(
  343. CMapData * pMapData,
  344. DataClusterIGC * pdc,
  345. SectorID sID);
  346. virtual VOID LinkClusters(CMapData * pMapData);
  347. } ;
  348. //
  349. // Brawl
  350. //
  351. // Shape is a single sector containing all of the starbases.
  352. //
  353. class CmapMakerBrawlIGC : public CmapMakerIGC
  354. {
  355. public:
  356. static const char* IsValid(const MissionParams* pmp);
  357. CmapMakerBrawlIGC();
  358. virtual VOID GenerateLayout(CMapData * pMapData);
  359. virtual VOID GenerateNeutralClusterScreenPosition(
  360. CMapData * pMapData,
  361. DataClusterIGC * pdc,
  362. SectorID sID);
  363. virtual VOID LinkClusters(CMapData * pMapData);
  364. virtual VOID PopulateCluster(CMapData* pMapData,
  365. IclusterIGC* pcluster,
  366. float amountHe3);
  367. } ;
  368. //
  369. // Pin wheel.
  370. //
  371. // Shape is one or more neutral sectors with 1 player sector per
  372. // team outstretched from the center. If TotalPlayers > 30,
  373. // center contains 1 neutral sector per team. Otherwise, center
  374. // is 1 neutral sector. If Teams > 3, neutral sectors are cross
  375. // connected.
  376. //
  377. class CmapMakerPinWheelIGC : public CmapMakerIGC
  378. {
  379. public:
  380. static const char* IsValid(const MissionParams* pmp);
  381. CmapMakerPinWheelIGC();
  382. virtual VOID GenerateLayout(CMapData * pMapData);
  383. virtual VOID GenerateNeutralClusterScreenPosition(
  384. CMapData * pMapData,
  385. DataClusterIGC * pdc,
  386. SectorID sID);
  387. virtual VOID LinkClusters(CMapData * pMapData);
  388. virtual VOID PopulateCluster(CMapData* pMapData,
  389. IclusterIGC* pcluster,
  390. float amountHe3);
  391. } ;
  392. //
  393. // Diamond ring.
  394. //
  395. // Shape is one ring of neutral sectors in the center and one ring of
  396. // neutral sectors around the outside. Each team gets 1 to 3 sectors,
  397. // each one connected to the outside and inside rings with 1 aleph.
  398. //
  399. class CmapMakerDiamondRingIGC : public CmapMakerIGC
  400. {
  401. public:
  402. static const char* IsValid(const MissionParams* pmp);
  403. CmapMakerDiamondRingIGC();
  404. virtual VOID GenerateLayout(CMapData * pMapData);
  405. virtual VOID GenerateTeamClusterScreenPosition(
  406. CMapData * pMapData,
  407. DataClusterIGC * pdc,
  408. SectorID sID);
  409. virtual VOID GenerateNeutralClusterScreenPosition(
  410. CMapData * pMapData,
  411. DataClusterIGC * pdc,
  412. SectorID sID);
  413. virtual VOID LinkClusters(CMapData * pMapData);
  414. } ;
  415. //
  416. // SnowFlake.
  417. //
  418. // 3 neutral sectors per team connected in a triangle. Each triangle
  419. // is then connected to form a double ring (or with teams > 3, a single
  420. // ring with the center sectors cross connected). Each team gets 1 to 3
  421. // sectors connected to the outside of the neutral ring.
  422. //
  423. class CmapMakerSnowFlakeIGC : public CmapMakerIGC
  424. {
  425. public:
  426. static const char* IsValid(const MissionParams* pmp)
  427. {
  428. return NULL;
  429. }
  430. CmapMakerSnowFlakeIGC();
  431. virtual VOID GenerateLayout(CMapData * pMapData);
  432. virtual VOID GenerateTeamClusterScreenPosition(
  433. CMapData * pMapData,
  434. DataClusterIGC * pdc,
  435. SectorID sID);
  436. virtual VOID GenerateNeutralClusterScreenPosition(
  437. CMapData * pMapData,
  438. DataClusterIGC * pdc,
  439. SectorID sID);
  440. virtual VOID LinkClusters(CMapData * pMapData);
  441. } ;
  442. //
  443. // LargeSplit.
  444. //
  445. // Must have an even number of player sectors. Each team sector is
  446. // connected to 2 neutral sectors. Each team has its sectors spread out
  447. // so that they are not connected.
  448. //
  449. class CmapMakerLargeSplitIGC : public CmapMakerHiHigherIGC
  450. {
  451. public:
  452. static const char* IsValid(const MissionParams* pmp);
  453. CmapMakerLargeSplitIGC();
  454. };
  455. class CmapMakerInsideOutIGC : public CmapMakerHiHigherIGC
  456. {
  457. public:
  458. static const char* IsValid(const MissionParams* pmp)
  459. {
  460. return NULL;
  461. }
  462. CmapMakerInsideOutIGC();
  463. };
  464. class CmapMakerGridIGC : public CmapMakerIGC
  465. {
  466. public:
  467. static const char* IsValid(const MissionParams* pmp)
  468. {
  469. return NULL;
  470. }
  471. CmapMakerGridIGC();
  472. virtual VOID GenerateLayout(CMapData * pMapData);
  473. virtual VOID GenerateTeamClusterScreenPosition(
  474. CMapData * pMapData,
  475. DataClusterIGC * pdc,
  476. SectorID sID);
  477. virtual VOID GenerateNeutralClusterScreenPosition(
  478. CMapData * pMapData,
  479. DataClusterIGC * pdc,
  480. SectorID sID);
  481. virtual VOID LinkClusters(CMapData * pMapData);
  482. };
  483. class CmapMakerEastWestIGC : public CmapMakerIGC
  484. {
  485. public:
  486. static const char* IsValid(const MissionParams* pmp);
  487. CmapMakerEastWestIGC();
  488. virtual VOID GenerateLayout(CMapData * pMapData);
  489. virtual VOID GenerateTeamClusterScreenPosition(
  490. CMapData * pMapData,
  491. DataClusterIGC * pdc,
  492. SectorID sID);
  493. virtual VOID GenerateNeutralClusterScreenPosition(
  494. CMapData * pMapData,
  495. DataClusterIGC * pdc,
  496. SectorID sID);
  497. virtual VOID LinkClusters(CMapData * pMapData);
  498. virtual VOID PopulateCluster(CMapData* pMapData,
  499. IclusterIGC* pcluster,
  500. float amountHe3);
  501. };
  502. class CmapMakerSplitBaseIGC : public CmapMakerIGC
  503. {
  504. public:
  505. static const char* IsValid(const MissionParams* pmp);
  506. CmapMakerSplitBaseIGC();
  507. virtual VOID GenerateLayout(CMapData * pMapData);
  508. virtual VOID GenerateTeamClusterScreenPosition(
  509. CMapData * pMapData,
  510. DataClusterIGC * pdc,
  511. SectorID sID);
  512. virtual VOID GenerateNeutralClusterScreenPosition(
  513. CMapData * pMapData,
  514. DataClusterIGC * pdc,
  515. SectorID sID);
  516. virtual VOID LinkClusters(CMapData * pMapData);
  517. } ;
  518. #endif //__MAPMAKERIGC_H_