region_map_v1.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef EQ2EMU_REGION_MAP_V1_H
  2. #define EQ2EMU_REGION_MAP_V1_H
  3. #include "region_map.h"
  4. #include <map>
  5. class Client;
  6. class Spawn;
  7. #define SPECIAL_REGION_LAVA_OR_DEATH 4294967293
  8. #define SPECIAL_REGION_WATER 1
  9. #pragma pack(1)
  10. typedef struct ZBSP_Node {
  11. int32 node_number;
  12. float normal[3], splitdistance;
  13. int32 region;
  14. int32 special;
  15. int32 left, right;
  16. } ZBSP_Node;
  17. typedef struct Region_Node {
  18. int32 region_type;
  19. float x;
  20. float y;
  21. float z;
  22. float dist;
  23. string regionEnvFileName;
  24. string regionName;
  25. int32 grid_id;
  26. string regionScriptName;
  27. int32 vert_count;
  28. } Region_Node;
  29. #pragma pack()
  30. struct Region_Status {
  31. bool inRegion;
  32. int32 timerTic;
  33. int32 lastTimerTic;
  34. int32 regionType;
  35. };
  36. class RegionMapV1 : public RegionMap
  37. {
  38. public:
  39. RegionMapV1();
  40. ~RegionMapV1();
  41. virtual WaterRegionType ReturnRegionType(const glm::vec3& location, int32 grid_id=0) const;
  42. virtual bool InWater(const glm::vec3& location, int32 grid_id=0) const;
  43. virtual bool InLava(const glm::vec3& location, int32 grid_id=0) const;
  44. virtual bool InLiquid(const glm::vec3& location) const;
  45. virtual bool InPvP(const glm::vec3& location) const;
  46. virtual bool InZoneLine(const glm::vec3& location) const;
  47. virtual void IdentifyRegionsInGrid(Client* client, const glm::vec3& location) const;
  48. virtual void MapRegionsNearSpawn(Spawn* spawn, Client* client=0) const;
  49. virtual void UpdateRegionsNearSpawn(Spawn* spawn, Client* client=0) const;
  50. virtual void TicRegionsNearSpawn(Spawn* spawn, Client* client=0) const;
  51. protected:
  52. virtual bool Load(FILE *fp, std::string inZoneLowerName, int32 regionVersion);
  53. private:
  54. WaterRegionType BSPReturnRegionType(int32 node_number, const glm::vec3& location, int32 gridid=0) const;
  55. WaterRegionType BSPReturnRegionTypeNode(const Region_Node* node, const ZBSP_Node* BSP_Root, int32 node_number, const glm::vec3& location, float distToNode=0.0f) const;
  56. WaterRegionType BSPReturnRegionWaterRegion(const Region_Node* node, const ZBSP_Node* BSP_Root, int32 node_number, const glm::vec3& location, float distToNode=0.0f) const;
  57. map<Region_Node*, ZBSP_Node*> Regions;
  58. WaterRegionType EstablishDistanceAtAngle(const Region_Node* region_node, const ZBSP_Node* current_node, float distance, float absDistance, float absSplitDist, bool checkEdgedAngle=false) const;
  59. std::string TestFile(std::string testFile);
  60. friend class RegionMap;
  61. int32 mVersion;
  62. std::string mZoneNameLower;
  63. };
  64. #endif