diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index 9d7fd3a4..fc28cd0f 100644 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -477,6 +477,13 @@ enum MagicType_e MAGIC_END }; +enum PolyExtDataFlag_e +{ + kWater1ExtFlag = 1, //能打出水坑 + kWater2ExtFlag = 2, //打不出水坑 + kWater3ExtFlag = 3, //游泳不能射击 +}; + const char* const PROJ_NAME_FMT = "game%d_gameserver"; const char* const PROJ_ROOT_FMT = "/data/logs/%s"; diff --git a/server/gameserver/constant_export.h b/server/gameserver/constant_export.h index 4ce28c97..b70e2676 100644 --- a/server/gameserver/constant_export.h +++ b/server/gameserver/constant_export.h @@ -7,7 +7,6 @@ const int DRIVER_BUFFID = 7003; const int PASSENGER_BUFFID = 7004; const int kRecoilBuffId = 7005; const int kInGrassBuffId = 7006; -const int kInWaterBuffId = 7007; const int kInIceBuffId = 7008; const int kBeRecycleBuffId = 7009; const int kTraceBuffId = 7011; @@ -22,6 +21,9 @@ const int kKeepShotAnimiBuffId = 7021; const int kVertigoEffectBuffId = 7022; const int kDispelEffectBuffId = 7023; const int kImmuneEffectBuffId = 7024; +const int kInWater1BuffId = 7026; +const int kInWater2BuffId = 7027; +const int kInWater3BuffId = 7028; const int kPullToWalkableBuffId = 8003; const int kDiveBuffId = 8054; const int kInvincibleBuffId = 1005; @@ -133,11 +135,3 @@ enum EntityType_e ET_Unuse = 30, ET_MAX }; - -enum AIKind_e -{ - kAI_Begin = 0, - kAI_Android = 1, - kAI_MineSweeper = 2, - kAI_End -}; diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index c7e16c71..83bb5dde 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -1416,7 +1416,8 @@ void Creature::CheckSpecObject() long long old_cell_flags = cell_flags_; cell_flags_ = 0; { - dtPoly* poly = room->map_instance->GetPoly(GetPos().ToGlmVec3()); + int poly_idx = 0; + dtPoly* poly = room->map_instance->GetPoly(GetPos().ToGlmVec3(), poly_idx); if (poly) { if ((poly->flags & SAMPLE_POLYFLAGS_SWIM) == SAMPLE_POLYFLAGS_SWIM) { a8::SetBitFlag(cell_flags_, kColliderTag_Water); diff --git a/server/gameserver/mapinstance.cc b/server/gameserver/mapinstance.cc index 15eebcec..bcd6d321 100644 --- a/server/gameserver/mapinstance.cc +++ b/server/gameserver/mapinstance.cc @@ -572,7 +572,7 @@ glm::vec3 MapInstance::UnScaleEx(const glm::vec3& v) return result; } -dtPoly* MapInstance::GetPoly(glm::vec3 pos) +dtPoly* MapInstance::GetPoly(glm::vec3 pos, int& poly_idx) { dtPolyRef startRef = INVALID_NAVMESH_POLYREF; @@ -598,6 +598,7 @@ dtPoly* MapInstance::GetPoly(glm::vec3 pos) unsigned int it = 0; unsigned int ip = 0; navmesh_->decodePolyId(startRef, slat, it, ip); + poly_idx = ip; return &tile->polys[ip]; } return nullptr; diff --git a/server/gameserver/mapinstance.h b/server/gameserver/mapinstance.h index 9cd1e974..efcfe4a3 100644 --- a/server/gameserver/mapinstance.h +++ b/server/gameserver/mapinstance.h @@ -20,7 +20,8 @@ class MapInstance : public std::enable_shared_from_this void UnInit(); void AttachRoom(Room* room, RoomInitInfo& init_info); - const mt::Map* GetMapMeta() { return map_meta_; } + const mt::Map* GetMapMeta() { return map_meta_; }; + std::vector& GetPolyExtDatas() { return poly_ext_datas_; }; Entity* GetEntityByUniId(int uniid); dtNavMesh* GetNavMesh() { return navmesh_; }; @@ -37,7 +38,7 @@ class MapInstance : public std::enable_shared_from_this glm::vec3& hit_point, bool& hit_result); bool FindNearestPoint(const glm::vec3& center, float radius, glm::vec3& nearestPt); bool GetPosHeight(const Position& pos, float& out_height); - dtPoly* GetPoly(glm::vec3 pos); + dtPoly* GetPoly(glm::vec3 pos, int& poly_idx); void Scale(glm::vec3& v); void UnScale(glm::vec3& v); glm::vec3 UnScaleEx(const glm::vec3& v); @@ -58,6 +59,8 @@ class MapInstance : public std::enable_shared_from_this int current_uniid_ = 0; std::map uniid_hash_; + std::vector poly_ext_datas_; + std::string map_tpl_name_; const mt::Map* map_meta_ = nullptr; MapService* map_service_ = nullptr; diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 83d3409c..7615c05c 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -3684,3 +3684,11 @@ void Room::AutoJump() }); } } + +int Room::GetPolyExtFlag(int poly_idx) +{ + if (poly_idx >=0 && poly_idx < poly_ext_datas_.size()) { + return poly_ext_datas_.at(poly_idx); + } + return 0; +} diff --git a/server/gameserver/room.h b/server/gameserver/room.h index fcf8e83f..0e8e7ba5 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -210,7 +210,8 @@ public: bool CanAddObstacle(const glm::vec3& pos, int obstacle_id); void AddTask(int task_uniid, ITask* task); void RemoveTask(int task_uniid); - const mt::AirLine* GetAirLine() { return airline_; }; + const mt::AirLine* GetAirLine() { return airline_; } + int GetPolyExtFlag(int poly_idx); private: void ShuaAndroid(); @@ -297,6 +298,7 @@ private: void AutoJump(); private: + std::vector poly_ext_datas_; int room_idx_ = 0; RoomMode_e room_mode_ = kChiJiMode; long long room_uuid_ = 0;