mapmakerigc.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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 = 68;
  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. short GetMaxPlayersInMission()
  120. { return(GetMaxPlayersOnTeam() * GetTeams()); }
  121. CivID GetCivID(SideID sideID)
  122. { return(mpMissionParams->rgCivID[sideID]); }
  123. WarpID GetNextWarpID()
  124. { return(mIDNextWarp++); }
  125. //
  126. // Writer functions.
  127. //
  128. VOID SetMission(ImissionIGC * pMission)
  129. { mpMission = pMission; }
  130. VOID SetMissionParams(const MissionParams * pMissionParams)
  131. { mpMissionParams = pMissionParams; }
  132. VOID SetTime(Time now)
  133. { mNow = now; }
  134. VOID SetTeamClustersPerTeam(SectorID sID)
  135. { mcTeamClustersPerTeam = sID; }
  136. VOID SetNeutralClustersPerTeam(SectorID sID)
  137. { mcNeutralClustersPerTeam = sID; }
  138. VOID SetOtherClusters(SectorID sID)
  139. { mcOtherClusters = sID; }
  140. VOID SetCluster(SectorID sID, IclusterIGC * pCluster, SideID sideID);
  141. VOID SetClusterSide(SectorID sID, SideID sideID)
  142. { msideIDCluster[sID] = sideID; }
  143. //
  144. // Our own custom methods.
  145. //
  146. VOID GetNewClusterName(CHAR * szClusterName);
  147. } ;
  148. //
  149. // Base class for the map maker.
  150. //
  151. //
  152. // Shape is a circle (2 alephs in and out of each sector).
  153. // If Teams > 3, neutral sectors get extra aleph to another neutral sector.
  154. // If Players On Team > 30, central player sectors get extra aleph to
  155. // another team's central player sector.
  156. //
  157. class CmapMakerIGC : public ImapMakerIGC
  158. {
  159. protected:
  160. static const char * smszPlanetName[c_NumberOfPlanetPosters];
  161. MapMakerID mMMID;
  162. char mszName[c_cbDescription + 4];
  163. public:
  164. static const char* IsValid(const MissionParams* pmp)
  165. {
  166. return NULL;
  167. }
  168. CmapMakerIGC();
  169. virtual ~CmapMakerIGC();
  170. virtual MapMakerID GetMapMakerID() const { return(mMMID); }
  171. virtual VOID SetMapMakerID(MapMakerID mmID) { mMMID = mmID; }
  172. virtual char const* GetName() const
  173. { return(mszName); }
  174. virtual VOID SetName(const char * newVal)
  175. { strcpy(mszName, newVal); }
  176. virtual VOID GenerateMission(Time now,
  177. const MissionParams * pmp,
  178. ImissionIGC * pMission);
  179. //
  180. // Our own custom helper methods.
  181. //
  182. //virtual VOID GenerateSides(CMapData * pMapData);
  183. virtual VOID GenerateTeamClusterScreenPosition(
  184. CMapData * pMapData,
  185. DataClusterIGC * pdc,
  186. SectorID sID);
  187. virtual IclusterIGC * GenerateTeamCluster(CMapData * pMapData,
  188. SectorID sID);
  189. virtual VOID GenerateNeutralClusterScreenPosition(
  190. CMapData * pMapData,
  191. DataClusterIGC * pdc,
  192. SectorID sID);
  193. virtual IclusterIGC * GenerateNeutralCluster(CMapData * pMapData,
  194. SectorID sID);
  195. virtual VOID GenerateRingClusters(CMapData * pMapData);
  196. virtual VOID GenerateWarp(CMapData* pMapData,
  197. IclusterIGC* pCluster,
  198. DataWarpIGC* pdw);
  199. virtual VOID LinkClusters(CMapData* pMapData,
  200. SectorID sID1,
  201. SectorID sID2,
  202. int alephType = NA);
  203. virtual VOID CrossLinkClusters(CMapData * pMapData,
  204. SectorID sFirstID);
  205. virtual VOID LinkClusters(CMapData * pMapData);
  206. virtual VOID GenerateLayout(CMapData * pMapData);
  207. virtual VOID GenerateStarbase(CMapData * pMapData,
  208. IclusterIGC* pcluster);
  209. virtual VOID PopulateCluster(CMapData* pMapData,
  210. IclusterIGC* pcluster,
  211. float amountHe3);
  212. virtual VOID PopulateClusters(CMapData * pMapData);
  213. virtual VOID RevealHomeClusters(ImissionIGC * pMission);
  214. virtual VOID RevealMap(ImissionIGC * pMission);
  215. virtual VOID ActivateSides(ImissionIGC * pMission);
  216. } ;
  217. //
  218. // Derived classes.
  219. // Just use the base class without changes
  220. class CmapMakerSingleRingIGC : public CmapMakerIGC
  221. {
  222. public:
  223. static const char* IsValid(const MissionParams* pmp)
  224. {
  225. return NULL;
  226. }
  227. };
  228. //
  229. //
  230. // Double ring.
  231. //
  232. // Shape is two concentric circles. The center circle contains 1
  233. // neutral sector for each team. The outer circle contains 1
  234. // sector for each 15 players. Each player sector is connected
  235. // to two neutral sectors.
  236. //
  237. class CmapMakerDoubleRingIGC : public CmapMakerIGC
  238. {
  239. public:
  240. static const char* IsValid(const MissionParams* pmp)
  241. {
  242. return NULL;
  243. }
  244. CmapMakerDoubleRingIGC();
  245. virtual VOID GenerateTeamClusterScreenPosition(
  246. CMapData * pMapData,
  247. DataClusterIGC * pdc,
  248. SectorID sID);
  249. virtual VOID GenerateNeutralClusterScreenPosition(
  250. CMapData * pMapData,
  251. DataClusterIGC * pdc,
  252. SectorID sID);
  253. virtual VOID LinkClusters(CMapData * pMapData);
  254. } ;
  255. //
  256. // HiLo
  257. //
  258. class CmapMakerHiLoIGC : public CmapMakerIGC
  259. {
  260. public:
  261. static const char* IsValid(const MissionParams* pmp)
  262. {
  263. return NULL;
  264. }
  265. CmapMakerHiLoIGC();
  266. virtual VOID GenerateLayout(CMapData * pMapData);
  267. virtual VOID GenerateTeamClusterScreenPosition(
  268. CMapData * pMapData,
  269. DataClusterIGC * pdc,
  270. SectorID sID);
  271. virtual VOID GenerateNeutralClusterScreenPosition(
  272. CMapData * pMapData,
  273. DataClusterIGC * pdc,
  274. SectorID sID);
  275. virtual VOID LinkClusters(CMapData * pMapData);
  276. } ;
  277. //
  278. // HiHigher
  279. //
  280. class CmapMakerHiHigherIGC : public CmapMakerIGC
  281. {
  282. public:
  283. static const char* IsValid(const MissionParams* pmp)
  284. {
  285. return NULL;
  286. }
  287. CmapMakerHiHigherIGC();
  288. virtual VOID GenerateLayout(CMapData * pMapData);
  289. virtual VOID GenerateTeamClusterScreenPosition(
  290. CMapData * pMapData,
  291. DataClusterIGC * pdc,
  292. SectorID sID);
  293. virtual VOID GenerateNeutralClusterScreenPosition(
  294. CMapData * pMapData,
  295. DataClusterIGC * pdc,
  296. SectorID sID);
  297. virtual VOID LinkClusters(CMapData * pMapData);
  298. } ;
  299. //
  300. // Star
  301. //
  302. class CmapMakerStarIGC : public CmapMakerIGC
  303. {
  304. public:
  305. static const char* IsValid(const MissionParams* pmp)
  306. {
  307. return NULL;
  308. }
  309. CmapMakerStarIGC();
  310. virtual VOID GenerateLayout(CMapData * pMapData);
  311. virtual VOID GenerateTeamClusterScreenPosition(
  312. CMapData * pMapData,
  313. DataClusterIGC * pdc,
  314. SectorID sID);
  315. virtual VOID GenerateNeutralClusterScreenPosition(
  316. CMapData * pMapData,
  317. DataClusterIGC * pdc,
  318. SectorID sID);
  319. virtual VOID LinkClusters(CMapData * pMapData);
  320. } ;
  321. //
  322. // Big ring
  323. //
  324. // Shape is a single ring with 2 neutral sectors between home sectors
  325. //
  326. class CmapMakerBigRingIGC : public CmapMakerIGC
  327. {
  328. public:
  329. static const char* IsValid(const MissionParams* pmp)
  330. {
  331. return NULL;
  332. }
  333. CmapMakerBigRingIGC();
  334. virtual VOID GenerateLayout(CMapData * pMapData);
  335. virtual VOID GenerateTeamClusterScreenPosition(
  336. CMapData * pMapData,
  337. DataClusterIGC * pdc,
  338. SectorID sID);
  339. virtual VOID GenerateNeutralClusterScreenPosition(
  340. CMapData * pMapData,
  341. DataClusterIGC * pdc,
  342. SectorID sID);
  343. virtual VOID LinkClusters(CMapData * pMapData);
  344. } ;
  345. //
  346. // Brawl
  347. //
  348. // Shape is a single sector containing all of the starbases.
  349. //
  350. class CmapMakerBrawlIGC : public CmapMakerIGC
  351. {
  352. public:
  353. static const char* IsValid(const MissionParams* pmp);
  354. CmapMakerBrawlIGC();
  355. virtual VOID GenerateLayout(CMapData * pMapData);
  356. virtual VOID GenerateNeutralClusterScreenPosition(
  357. CMapData * pMapData,
  358. DataClusterIGC * pdc,
  359. SectorID sID);
  360. virtual VOID LinkClusters(CMapData * pMapData);
  361. virtual VOID PopulateCluster(CMapData* pMapData,
  362. IclusterIGC* pcluster,
  363. float amountHe3);
  364. } ;
  365. //
  366. // Pin wheel.
  367. //
  368. // Shape is one or more neutral sectors with 1 player sector per
  369. // team outstretched from the center. If TotalPlayers > 30,
  370. // center contains 1 neutral sector per team. Otherwise, center
  371. // is 1 neutral sector. If Teams > 3, neutral sectors are cross
  372. // connected.
  373. //
  374. class CmapMakerPinWheelIGC : public CmapMakerIGC
  375. {
  376. public:
  377. static const char* IsValid(const MissionParams* pmp);
  378. CmapMakerPinWheelIGC();
  379. virtual VOID GenerateLayout(CMapData * pMapData);
  380. virtual VOID GenerateNeutralClusterScreenPosition(
  381. CMapData * pMapData,
  382. DataClusterIGC * pdc,
  383. SectorID sID);
  384. virtual VOID LinkClusters(CMapData * pMapData);
  385. virtual VOID PopulateCluster(CMapData* pMapData,
  386. IclusterIGC* pcluster,
  387. float amountHe3);
  388. } ;
  389. //
  390. // Diamond ring.
  391. //
  392. // Shape is one ring of neutral sectors in the center and one ring of
  393. // neutral sectors around the outside. Each team gets 1 to 3 sectors,
  394. // each one connected to the outside and inside rings with 1 aleph.
  395. //
  396. class CmapMakerDiamondRingIGC : public CmapMakerIGC
  397. {
  398. public:
  399. static const char* IsValid(const MissionParams* pmp);
  400. CmapMakerDiamondRingIGC();
  401. virtual VOID GenerateLayout(CMapData * pMapData);
  402. virtual VOID GenerateTeamClusterScreenPosition(
  403. CMapData * pMapData,
  404. DataClusterIGC * pdc,
  405. SectorID sID);
  406. virtual VOID GenerateNeutralClusterScreenPosition(
  407. CMapData * pMapData,
  408. DataClusterIGC * pdc,
  409. SectorID sID);
  410. virtual VOID LinkClusters(CMapData * pMapData);
  411. } ;
  412. //
  413. // SnowFlake.
  414. //
  415. // 3 neutral sectors per team connected in a triangle. Each triangle
  416. // is then connected to form a double ring (or with teams > 3, a single
  417. // ring with the center sectors cross connected). Each team gets 1 to 3
  418. // sectors connected to the outside of the neutral ring.
  419. //
  420. class CmapMakerSnowFlakeIGC : public CmapMakerIGC
  421. {
  422. public:
  423. static const char* IsValid(const MissionParams* pmp)
  424. {
  425. return NULL;
  426. }
  427. CmapMakerSnowFlakeIGC();
  428. virtual VOID GenerateLayout(CMapData * pMapData);
  429. virtual VOID GenerateTeamClusterScreenPosition(
  430. CMapData * pMapData,
  431. DataClusterIGC * pdc,
  432. SectorID sID);
  433. virtual VOID GenerateNeutralClusterScreenPosition(
  434. CMapData * pMapData,
  435. DataClusterIGC * pdc,
  436. SectorID sID);
  437. virtual VOID LinkClusters(CMapData * pMapData);
  438. } ;
  439. //
  440. // LargeSplit.
  441. //
  442. // Must have an even number of player sectors. Each team sector is
  443. // connected to 2 neutral sectors. Each team has its sectors spread out
  444. // so that they are not connected.
  445. //
  446. class CmapMakerLargeSplitIGC : public CmapMakerHiHigherIGC
  447. {
  448. public:
  449. static const char* IsValid(const MissionParams* pmp);
  450. CmapMakerLargeSplitIGC();
  451. };
  452. class CmapMakerInsideOutIGC : public CmapMakerHiHigherIGC
  453. {
  454. public:
  455. static const char* IsValid(const MissionParams* pmp)
  456. {
  457. return NULL;
  458. }
  459. CmapMakerInsideOutIGC();
  460. };
  461. class CmapMakerGridIGC : public CmapMakerIGC
  462. {
  463. public:
  464. static const char* IsValid(const MissionParams* pmp)
  465. {
  466. return NULL;
  467. }
  468. CmapMakerGridIGC();
  469. virtual VOID GenerateLayout(CMapData * pMapData);
  470. virtual VOID GenerateTeamClusterScreenPosition(
  471. CMapData * pMapData,
  472. DataClusterIGC * pdc,
  473. SectorID sID);
  474. virtual VOID GenerateNeutralClusterScreenPosition(
  475. CMapData * pMapData,
  476. DataClusterIGC * pdc,
  477. SectorID sID);
  478. virtual VOID LinkClusters(CMapData * pMapData);
  479. };
  480. class CmapMakerEastWestIGC : public CmapMakerIGC
  481. {
  482. public:
  483. static const char* IsValid(const MissionParams* pmp);
  484. CmapMakerEastWestIGC();
  485. virtual VOID GenerateLayout(CMapData * pMapData);
  486. virtual VOID GenerateTeamClusterScreenPosition(
  487. CMapData * pMapData,
  488. DataClusterIGC * pdc,
  489. SectorID sID);
  490. virtual VOID GenerateNeutralClusterScreenPosition(
  491. CMapData * pMapData,
  492. DataClusterIGC * pdc,
  493. SectorID sID);
  494. virtual VOID LinkClusters(CMapData * pMapData);
  495. virtual VOID PopulateCluster(CMapData* pMapData,
  496. IclusterIGC* pcluster,
  497. float amountHe3);
  498. };
  499. class CmapMakerSplitBaseIGC : public CmapMakerIGC
  500. {
  501. public:
  502. static const char* IsValid(const MissionParams* pmp);
  503. CmapMakerSplitBaseIGC();
  504. virtual VOID GenerateLayout(CMapData * pMapData);
  505. virtual VOID GenerateTeamClusterScreenPosition(
  506. CMapData * pMapData,
  507. DataClusterIGC * pdc,
  508. SectorID sID);
  509. virtual VOID GenerateNeutralClusterScreenPosition(
  510. CMapData * pMapData,
  511. DataClusterIGC * pdc,
  512. SectorID sID);
  513. virtual VOID LinkClusters(CMapData * pMapData);
  514. } ;
  515. #endif //__MAPMAKERIGC_H_