region_map_v1.h 2.3 KB

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