This commit is contained in:
aozhiwei 2023-01-06 14:19:21 +08:00
parent 41c36099de
commit 510ff182f9
7 changed files with 30 additions and 14 deletions

View File

@ -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";

View File

@ -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
};

View File

@ -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);

View File

@ -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;

View File

@ -20,7 +20,8 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
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<int>& 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<MapInstance>
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<MapInstance>
int current_uniid_ = 0;
std::map<int, Entity*> uniid_hash_;
std::vector<int> poly_ext_datas_;
std::string map_tpl_name_;
const mt::Map* map_meta_ = nullptr;
MapService* map_service_ = nullptr;

View File

@ -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;
}

View File

@ -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<int> poly_ext_datas_;
int room_idx_ = 0;
RoomMode_e room_mode_ = kChiJiMode;
long long room_uuid_ = 0;