mission.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #ifndef _MISSION_H_
  2. #define _MISSION_H_
  3. #if 0
  4. //////////////////////////////////////////////////////////////////////////////
  5. //
  6. // MissionContext
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9. class MissionContext : public IObject
  10. {
  11. public:
  12. virtual TRef<IshipIGC> GetShip() = 0;
  13. virtual ImissionIGC* GetMissionIGC() = 0;
  14. virtual TRef<Modeler> GetModeler() = 0;
  15. };
  16. //////////////////////////////////////////////////////////////////////////////
  17. //
  18. // Regions
  19. //
  20. //////////////////////////////////////////////////////////////////////////////
  21. class Region : public IObject
  22. {
  23. public:
  24. virtual bool InRegion(ImodelIGC* pmodel) = 0;
  25. };
  26. class PlanarRegion : public Region
  27. {
  28. public:
  29. };
  30. class SphericalRegion : public Region
  31. {
  32. public:
  33. static TRef<SphericalRegion> Create(ImodelIGC* pmodel, float radius);
  34. };
  35. //////////////////////////////////////////////////////////////////////////////
  36. //
  37. // Path
  38. //
  39. //////////////////////////////////////////////////////////////////////////////
  40. class PathSegment : public IObject
  41. {
  42. public:
  43. };
  44. class Path : public IObject
  45. {
  46. public:
  47. };
  48. //////////////////////////////////////////////////////////////////////////////
  49. //
  50. // MissionStage
  51. //
  52. //////////////////////////////////////////////////////////////////////////////
  53. class MissionStage: public IObject
  54. {
  55. public:
  56. };
  57. //////////////////////////////////////////////////////////////////////////////
  58. //
  59. // MissionEventHandler
  60. //
  61. //////////////////////////////////////////////////////////////////////////////
  62. class MissionEventHandler : public IObject
  63. {
  64. public:
  65. virtual bool OnModelTerminated(ImodelIGC* model){return false;}
  66. virtual bool OnModelKilled(ImodelIGC* model){return false;}
  67. virtual bool OnModelDamaged(ImodelIGC* model){return false;}
  68. virtual bool OnDocked(IshipIGC* pship, IstationIGC* pstation){return false;}
  69. virtual bool OnSwitchSector(IshipIGC* pship, IclusterIGC* pclusterOld, IclusterIGC* pclusterNew){return false;}
  70. virtual bool OnHitTreasure(IshipIGC* pship, ItreasureIGC* ptreasure){return false;}
  71. virtual bool OnEnteredRegion(ImodelIGC* pmodel, Region* pregion){return false;}
  72. virtual bool OnExitedRegion(ImodelIGC* pmodel, Region* pregion){return false;}
  73. virtual bool OnDivergedPath(IshipIGC* pship, Path* ppath, float distance, float angle){return false;}
  74. virtual bool OnSwitchedMissionStage(MissionStage* pstageNew, MissionStage* pstageOld){return false;}
  75. };
  76. //////////////////////////////////////////////////////////////////////////////
  77. //
  78. // MissionManager
  79. //
  80. //////////////////////////////////////////////////////////////////////////////
  81. enum DestroyDroneMethod
  82. {
  83. DestroyDroneExplode,
  84. DestroyDroneWarp,
  85. DestroyDroneOffScreen,
  86. DestroyDroneFlank,
  87. DestroyDroneDock
  88. };
  89. class MissionManager : public IObject
  90. {
  91. public:
  92. virtual void Update(Time time, float dtime) = 0;
  93. // stuff for loading, creating, and accessing items
  94. virtual void CreateDefaults() = 0;
  95. virtual void LoadClusters(const ZString& strMdlFile) = 0;
  96. virtual void LoadTechTree(const ZString& strMdlFile) = 0;
  97. /*
  98. virtual Drone* CreateDrone(DroneType dt, const ZString& strLoadout, SideID sideID, const ZString& strName,
  99. const Vector& pos, IclusterIGC* pcluster) = 0;
  100. */
  101. virtual TRef<IshipIGC> CreateShip(const ZString& strLoadout, SideID sideID, const ZString& strName) = 0;
  102. virtual TRef<Region> GetRegion(const ZString& strRegion) = 0;
  103. // virtual void CreatePowerup(const ZString& strPartType) = 0;
  104. // virtual void DestroyDrone(Drone* pdrone, DestroyDroneMethod method) = 0;
  105. // Events and mission flow
  106. virtual void SetMissionStage(MissionStage* pstageNew) = 0;
  107. virtual void AdviseRegion(Region* pregion, ImodelIGC* pmodel) = 0;
  108. virtual void UnadviseRegion(Region* pregion, ImodelIGC* pmodel) = 0;
  109. virtual void AddMissionEventHandler(MissionEventHandler* phandler) = 0;
  110. virtual void RemoveMissionEventHandler(MissionEventHandler* phandler) = 0;
  111. // Triggering of events
  112. virtual void FireOnModelTerminated(ImodelIGC* model) = 0;
  113. virtual void FireOnModelKilled(ImodelIGC* model) = 0;
  114. virtual void FireOnModelDamaged(ImodelIGC* model) = 0;
  115. virtual void FireOnDocked(IshipIGC* pship, IstationIGC* pstation) = 0;
  116. virtual void FireOnSwitchSector(IshipIGC* pship, IclusterIGC* pclusterOld, IclusterIGC* pclusterNew) = 0;
  117. virtual void FireOnHitTreasure(IshipIGC* pship, ItreasureIGC* ptreasure) = 0;
  118. virtual void FireOnEnteredRegion(ImodelIGC* pmodel, Region* pregion) = 0;
  119. virtual void FireOnExitedRegion(ImodelIGC* pmodel, Region* pregion) = 0;
  120. virtual void FireOnDivergedPath(IshipIGC* pship, Path* ppath, float distance, float angle) = 0;
  121. virtual void FireOnSwitchedMissionStage(MissionStage* pstageNew, MissionStage* pstageOld) = 0;
  122. static TRef<MissionManager> Create(MissionContext* pcontext);
  123. };
  124. #endif
  125. #endif