hullTypeIGC.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. /*
  2. ** Copyright (C) 1996, 1997 Microsoft Corporation. All Rights Reserved.
  3. **
  4. ** File: hullTypeIGC.h
  5. **
  6. ** Author:
  7. **
  8. ** Description:
  9. ** Header for the ChullTypeIGC class. This file was initially created by
  10. ** the ATL wizard.
  11. **
  12. ** History:
  13. */
  14. // hullTypeIGC.h : Declaration of the ChullTypeIGC
  15. #ifndef __HULLTYPEIGC_H_
  16. #define __HULLTYPEIGC_H_
  17. /////////////////////////////////////////////////////////////////////////////
  18. // ChullTypeIGC
  19. class ChullTypeIGC : public IhullTypeIGC
  20. {
  21. public:
  22. ChullTypeIGC(void)
  23. :
  24. m_data(NULL)
  25. {
  26. }
  27. ~ChullTypeIGC(void)
  28. {
  29. delete [] (char*)m_data;
  30. }
  31. public:
  32. // IbaseIGC
  33. virtual HRESULT Initialize(ImissionIGC* pMission, Time now, const void* data, int dataSize);
  34. virtual void Terminate(void);
  35. virtual int Export(void* data) const;
  36. virtual ObjectType GetObjectType(void) const
  37. {
  38. return OT_hullType;
  39. }
  40. virtual ObjectID GetObjectID(void) const
  41. {
  42. return m_data->hullID;
  43. }
  44. // ItypeIGC
  45. virtual const void* GetData(void) const
  46. {
  47. return m_data;
  48. }
  49. // IbuyableIGC
  50. virtual const char* GetModelName(void) const
  51. {
  52. return m_data->modelName;
  53. }
  54. virtual const char* GetName(void) const
  55. {
  56. return m_data->name;
  57. }
  58. virtual const char* GetDescription(void) const
  59. {
  60. return m_data->description;
  61. }
  62. virtual Money GetPrice(void) const
  63. {
  64. return m_data->price;
  65. }
  66. virtual const TechTreeBitMask& GetRequiredTechs(void) const
  67. {
  68. return m_data->ttbmRequired;
  69. }
  70. virtual const TechTreeBitMask& GetEffectTechs(void) const
  71. {
  72. return m_data->ttbmEffects;
  73. }
  74. virtual DWORD GetTimeToBuild(void) const
  75. {
  76. return m_data->timeToBuild;
  77. }
  78. virtual BuyableGroupID GetGroupID(void) const
  79. {
  80. return m_data->groupID;
  81. }
  82. // IhullTypeIGC
  83. virtual float GetMass(void) const
  84. {
  85. return m_data->mass;
  86. }
  87. virtual float GetSignature(void) const
  88. {
  89. return m_data->signature;
  90. }
  91. virtual float GetLength(void) const
  92. {
  93. return m_data->length;
  94. }
  95. virtual float GetMaxSpeed(void) const
  96. {
  97. return m_data->speed;
  98. }
  99. virtual float GetMaxTurnRate(Axis axis) const
  100. {
  101. assert (axis >= 0);
  102. assert (axis <= 3);
  103. return m_data->maxTurnRates[axis];
  104. }
  105. virtual float GetTurnTorque(Axis axis) const
  106. {
  107. assert (axis >= 0);
  108. assert (axis <= 3);
  109. return m_data->turnTorques[axis];
  110. }
  111. virtual float GetThrust(void) const
  112. {
  113. return m_data->thrust;
  114. }
  115. virtual float GetSideMultiplier(void) const
  116. {
  117. return m_data->sideMultiplier;
  118. }
  119. virtual float GetBackMultiplier(void) const
  120. {
  121. return m_data->backMultiplier;
  122. }
  123. virtual float GetScannerRange(void) const
  124. {
  125. return m_data->scannerRange;
  126. }
  127. virtual float GetMaxEnergy(void) const
  128. {
  129. return m_data->maxEnergy;
  130. }
  131. virtual float GetRechargeRate(void) const
  132. {
  133. return m_data->rechargeRate;
  134. }
  135. virtual HitPoints GetHitPoints(void) const
  136. {
  137. return m_data->hitPoints;
  138. }
  139. virtual DefenseTypeID GetDefenseType(void) const
  140. {
  141. return m_data->defenseType;
  142. }
  143. virtual PartMask GetPartMask(EquipmentType et, Mount mountID) const
  144. {
  145. assert (mountID >= 0);
  146. if (et == ET_Weapon)
  147. {
  148. return (mountID < m_data->maxWeapons)
  149. ? (((HardpointData*)(((char*)m_data) + m_data->hardpointOffset))[mountID]).partMask
  150. : 0;
  151. }
  152. else
  153. {
  154. return (mountID == 0) ? m_data->pmEquipment[et] : 0;
  155. }
  156. }
  157. virtual short GetCapacity(EquipmentType et) const
  158. {
  159. short c;
  160. switch (et)
  161. {
  162. case ET_Magazine:
  163. c = m_data->capacityMagazine;
  164. break;
  165. case ET_Dispenser:
  166. c = m_data->capacityDispenser;
  167. break;
  168. case ET_ChaffLauncher:
  169. c = m_data->capacityChaffLauncher;
  170. break;
  171. default:
  172. c = 0;
  173. }
  174. return c;
  175. }
  176. virtual bool CanMount(IpartTypeIGC* ppt, Mount mountID) const
  177. {
  178. assert (ppt);
  179. bool bMountable;
  180. if (mountID < 0)
  181. bMountable = (mountID >= -c_maxCargo);
  182. else
  183. {
  184. EquipmentType et = ppt->GetEquipmentType();
  185. bMountable = (ppt->GetPartMask() & ~GetPartMask(et, mountID)) == 0;
  186. }
  187. return bMountable;
  188. }
  189. virtual Mount GetMaxWeapons(void) const
  190. {
  191. return m_data->maxWeapons;
  192. }
  193. virtual Mount GetMaxFixedWeapons(void) const
  194. {
  195. return m_data->maxFixedWeapons;
  196. }
  197. virtual const HardpointData& GetHardpointData(Mount hardpointID) const
  198. {
  199. assert ((hardpointID >= 0) && (hardpointID < m_data->maxWeapons));
  200. return ((HardpointData*)(((char*)m_data) + m_data->hardpointOffset))[hardpointID];
  201. }
  202. virtual const char* GetTextureName(void) const
  203. {
  204. return m_data->textureName;
  205. }
  206. virtual const char* GetIconName(void) const
  207. {
  208. return m_data->iconName;
  209. }
  210. virtual HullAbilityBitMask GetCapabilities(void) const
  211. {
  212. return m_data->habmCapabilities;
  213. }
  214. virtual bool HasCapability(HullAbilityBitMask habm) const
  215. {
  216. return (m_data->habmCapabilities & habm) != 0;
  217. }
  218. virtual const Vector& GetCockpit(void) const
  219. {
  220. return m_cockpit;
  221. }
  222. virtual const Vector& GetWeaponPosition(Mount mount) const
  223. {
  224. assert (mount >= 0);
  225. assert (mount < m_data->maxWeapons);
  226. return m_positionWeapons[mount];
  227. }
  228. virtual const Orientation& GetWeaponOrientation(Mount mount) const
  229. {
  230. assert (mount >= 0);
  231. assert (mount < m_data->maxWeapons);
  232. return m_orientationWeapons[mount];
  233. }
  234. virtual float GetMaxFuel(void) const
  235. {
  236. return m_data->maxFuel;
  237. }
  238. virtual float GetECM(void) const
  239. {
  240. return m_data->ecm;
  241. }
  242. virtual float GetRipcordSpeed(void) const
  243. {
  244. return m_data->ripcordSpeed;
  245. }
  246. virtual float GetRipcordCost(void) const
  247. {
  248. return m_data->ripcordCost;
  249. }
  250. virtual short GetMaxAmmo(void) const
  251. {
  252. return m_data->maxAmmo;
  253. }
  254. virtual IhullTypeIGC* GetSuccessorHullType(void) const
  255. {
  256. return m_phtSuccessor;
  257. }
  258. /*
  259. virtual const char* GetPilotHUDName(void) const
  260. {
  261. return m_data->pilotHUDName;
  262. }
  263. virtual const char* GetObserverHUDName(void) const
  264. {
  265. return m_data->observerHUDName;
  266. }
  267. */
  268. virtual SoundID GetInteriorSound(void) const
  269. {
  270. return m_data->interiorSound;
  271. }
  272. virtual SoundID GetExteriorSound(void) const
  273. {
  274. return m_data->exteriorSound;
  275. }
  276. virtual SoundID GetMainThrusterInteriorSound(void) const
  277. {
  278. return m_data->mainThrusterInteriorSound;
  279. }
  280. virtual SoundID GetMainThrusterExteriorSound(void) const
  281. {
  282. return m_data->mainThrusterExteriorSound;
  283. }
  284. virtual SoundID GetManuveringThrusterInteriorSound(void) const
  285. {
  286. return m_data->manuveringThrusterInteriorSound;
  287. }
  288. virtual SoundID GetManuveringThrusterExteriorSound(void) const
  289. {
  290. return m_data->manuveringThrusterExteriorSound;
  291. }
  292. virtual const PartTypeListIGC* GetPreferredPartTypes(void) const
  293. {
  294. return &m_preferredPartTypes;
  295. }
  296. virtual float GetScale() const
  297. {
  298. return m_scale;
  299. }
  300. virtual IObject* GetIcon(void) const
  301. {
  302. return m_poIcon;
  303. }
  304. virtual int GetLaunchSlots(void) const
  305. {
  306. return m_nLaunchSlots;
  307. }
  308. virtual const Vector& GetLaunchPosition(int slotID) const
  309. {
  310. assert (slotID >= 0);
  311. assert (slotID < m_nLaunchSlots);
  312. return m_positionLaunches[slotID];
  313. }
  314. virtual const Vector& GetLaunchDirection(int slotID) const
  315. {
  316. assert (slotID >= 0);
  317. assert (slotID < m_nLaunchSlots);
  318. return m_directionLaunches[slotID];
  319. }
  320. virtual int GetLandSlots(void) const
  321. {
  322. return m_nLandSlots;
  323. }
  324. virtual int GetLandPlanes(int slotID) const
  325. {
  326. assert (slotID >= 0);
  327. assert (slotID < m_nLandSlots);
  328. return m_nLandPlanes[slotID];
  329. }
  330. virtual const Vector& GetLandPosition(int slotID, int planeID) const
  331. {
  332. assert (slotID >= 0);
  333. assert (slotID < m_nLandSlots);
  334. assert (planeID >= 0);
  335. assert (planeID <= m_nLandPlanes[slotID]);
  336. return m_positionLandPlanes[slotID][planeID];
  337. }
  338. virtual const Vector& GetLandDirection(int slotID, int planeID) const
  339. {
  340. assert (slotID >= 0);
  341. assert (slotID < m_nLandSlots);
  342. assert (planeID >= 0);
  343. assert (planeID <= m_nLandPlanes[slotID]);
  344. return m_directionLandPlanes[slotID][planeID];
  345. }
  346. private:
  347. ImissionIGC* m_pMission;
  348. TRef<IhullTypeIGC> m_phtSuccessor;
  349. TRef<IObject> m_poIcon;
  350. DataHullTypeIGC* m_data;
  351. PartTypeListIGC m_preferredPartTypes;
  352. Vector m_cockpit;
  353. Vector m_positionWeapons[c_maxMountedWeapons];
  354. Orientation m_orientationWeapons[c_maxMountedWeapons];
  355. float m_scale;
  356. int m_nLaunchSlots;
  357. Vector m_positionLaunches[c_maxShipLaunchSlots];
  358. Vector m_directionLaunches[c_maxShipLaunchSlots];
  359. int m_nLandSlots;
  360. int m_nCapLandSlots;
  361. int m_nLandPlanes[c_maxLandSlots];
  362. Vector m_positionLandPlanes[c_maxShipLandSlots][c_maxLandPlanes];
  363. Vector m_directionLandPlanes[c_maxShipLandSlots][c_maxLandPlanes];
  364. };
  365. #endif //__HULLTYPEIGC_H_