RM_Mission.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #pragma once
  2. #if !defined(RM_MISSION_H_INC)
  3. #define RM_MISSION_H_INC
  4. #ifdef DEBUG_LINKING
  5. #pragma message("...including RM_Mission.h")
  6. #endif
  7. // maximum random choices
  8. #define MAX_RANDOM_CHOICES 100
  9. typedef vector<int> rmIntVector_t;
  10. class CRMMission
  11. {
  12. private:
  13. rmObjectiveList_t mObjectives;
  14. rmInstanceList_t mInstances;
  15. CRMInstanceFile mInstanceFile;
  16. CRMObjective* mCurrentObjective;
  17. bool mValidNodes;
  18. bool mValidPaths;
  19. bool mValidRivers;
  20. bool mValidWeapons;
  21. bool mValidAmmo;
  22. bool mValidObjectives;
  23. bool mValidInstances;
  24. int mTimeLimit;
  25. int mMaxInstancePosition;
  26. // npc multipliers
  27. float mAccuracyMultiplier;
  28. float mHealthMultiplier;
  29. // % chance that RMG pickup is actually spawned
  30. float mPickupHealth;
  31. float mPickupArmor;
  32. float mPickupAmmo;
  33. float mPickupWeapon;
  34. float mPickupEquipment;
  35. string mDescription;
  36. string mExitScreen;
  37. string mTimeExpiredScreen;
  38. // symmetric landscape style
  39. symmetry_t mSymmetric;
  40. // if set to 1 in the mission file, adds an extra connecting path in symmetric maps
  41. // to ensure both sides actually do connect
  42. int mBackUpPath;
  43. int mDefaultPadding;
  44. CRMAreaManager* mAreaManager;
  45. CRMPathManager* mPathManager;
  46. CRandomTerrain* mLandScape;
  47. public:
  48. CRMMission ( CRandomTerrain* );
  49. ~CRMMission ( );
  50. bool Load ( const char* name, const char* instances, const char* difficulty );
  51. bool Spawn ( CRandomTerrain* terrain, qboolean IsServer );
  52. void Preview ( const vec3_t from );
  53. CRMObjective* FindObjective ( const char* name );
  54. CRMObjective* GetCurrentObjective ( ) { return mCurrentObjective; }
  55. void CompleteMission (void);
  56. void FailedMission (bool TimeExpired);
  57. void CompleteObjective ( CRMObjective* ojective );
  58. int GetTimeLimit (void) { return mTimeLimit; }
  59. int GetMaxInstancePosition (void) { return mMaxInstancePosition; }
  60. const char* GetDescription (void) { return mDescription.c_str(); }
  61. const char* GetExitScreen (void) { return mExitScreen.c_str(); }
  62. int GetSymmetric (void) { return mSymmetric; }
  63. int GetBackUpPath (void) { return mBackUpPath; }
  64. int GetDefaultPadding (void) { return mDefaultPadding; }
  65. // void CreateMap ( void );
  66. bool DenyPickupHealth () {return mLandScape->flrand(0.0f,1.0f) > mPickupHealth;}
  67. bool DenyPickupArmor () {return mLandScape->flrand(0.0f,1.0f) > mPickupArmor;}
  68. bool DenyPickupAmmo () {return mLandScape->flrand(0.0f,1.0f) > mPickupAmmo;}
  69. bool DenyPickupWeapon () {return mLandScape->flrand(0.0f,1.0f) > mPickupWeapon;}
  70. bool DenyPickupEquipment () {return mLandScape->flrand(0.0f,1.0f) > mPickupEquipment;}
  71. private:
  72. // void PurgeUnlinkedTriggers ( );
  73. // void PurgeTrigger ( CEntity* trigger );
  74. void MirrorPos (vec3_t pos);
  75. CGPGroup* ParseRandom ( CGPGroup* random );
  76. bool ParseOrigin ( CGPGroup* originGroup, vec3_t origin, vec3_t lookat, int* flattenHeight );
  77. bool ParseNodes ( CGPGroup* group );
  78. bool ParsePaths ( CGPGroup *paths);
  79. bool ParseRivers ( CGPGroup *rivers);
  80. void PlaceBridges ();
  81. void PlaceWallInstance(CRMInstance* instance, float xpos, float ypos, float zpos, int x, int y, float angle);
  82. bool ParseDifficulty ( CGPGroup* difficulty, CGPGroup *parent );
  83. bool ParseWeapons ( CGPGroup* weapons );
  84. bool ParseAmmo ( CGPGroup* ammo );
  85. bool ParseOutfit ( CGPGroup* outfit );
  86. bool ParseObjectives ( CGPGroup* objectives );
  87. bool ParseInstance ( CGPGroup* instance );
  88. bool ParseInstances ( CGPGroup* instances );
  89. bool ParseInstancesOnPath ( CGPGroup* group );
  90. bool ParseWallRect ( CGPGroup* group, int side);
  91. // void SpawnNPCTriggers ( CCMLandScape* landscape );
  92. // void AttachNPCTriggers ( CCMLandScape* landscape );
  93. };
  94. #endif