1
This commit is contained in:
parent
ddcded1ada
commit
99aeb06d16
@ -979,7 +979,7 @@ void Bullet::Raycast()
|
||||
glm::vec3 hit_point;
|
||||
sender.Get()->room->map_instance->Scale(start);
|
||||
sender.Get()->room->map_instance->Scale(end);
|
||||
bool ret = sender.Get()->room->map_instance->Raycast(0, start, end, hit_point, hit_result);
|
||||
bool ret = sender.Get()->room->map_instance->Raycast(start, end, hit_point, hit_result);
|
||||
if (ret && hit_result) {
|
||||
raycast_hited = true;
|
||||
sender.Get()->room->map_instance->UnScale(hit_point);
|
||||
|
@ -1411,8 +1411,9 @@ void Creature::DecInventory(int slot_id, int num)
|
||||
inventory_[slot_id].num -= num;
|
||||
}
|
||||
|
||||
void Creature::CheckSpecObject()
|
||||
void Creature::CheckSpecObject(int new_poly_flags)
|
||||
{
|
||||
#if 0
|
||||
int old_poly_ext_flags = poly_ext_flags_;
|
||||
poly_ext_flags_ = 0;
|
||||
{
|
||||
@ -1461,6 +1462,7 @@ void Creature::CheckSpecObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Creature::SummonObstacle(Buff* buff, int id, const Position& target_pos)
|
||||
@ -2384,15 +2386,18 @@ void Creature::SpecDirMove(glm::vec3 dir, float distance)
|
||||
room->map_instance->Scale(start);
|
||||
room->map_instance->Scale(end);
|
||||
|
||||
int same_polys_flags = 0;
|
||||
std::vector<dtPolyRef> spec_polys;
|
||||
|
||||
bool hit_result = false;
|
||||
bool ret = room->map_instance->Raycast(0, start, end, hit_point, hit_result);
|
||||
bool ret = room->map_instance->RaycastEx(start, end, hit_point, hit_result, same_polys_flags, spec_polys);
|
||||
if (ret) {
|
||||
room->map_instance->UnScale(hit_point);
|
||||
GetMutablePos().FromGlmVec3(hit_point);
|
||||
}
|
||||
|
||||
room->grid_service->MoveCreature(this);
|
||||
CheckSpecObject();
|
||||
//CheckSpecObject();
|
||||
GetMovement()->ClearPath();
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ class Creature : public MoveableEntity
|
||||
bool HasSpecMove();
|
||||
void _UpdateSpecMove();
|
||||
|
||||
void CheckSpecObject();
|
||||
void CheckSpecObject(int new_poly_flags);
|
||||
void SummonObstacle(Buff* buff, int id, const Position& target_pos);
|
||||
void SummonHero(Buff* buff, const Position& pos, const glm::vec3& dir);
|
||||
void FillSkillCasterState(SkillCasterState* caster_state);
|
||||
|
@ -210,7 +210,7 @@ int MapInstance::AllocUniid()
|
||||
return current_uniid_;
|
||||
}
|
||||
|
||||
int MapInstance::FindStraightPath(int layer,
|
||||
int MapInstance::FindStraightPath(
|
||||
const glm::vec3& start,
|
||||
const glm::vec3& end,
|
||||
std::vector<glm::vec3>& paths)
|
||||
@ -292,8 +292,7 @@ int MapInstance::FindStraightPath(int layer,
|
||||
return pos;
|
||||
}
|
||||
|
||||
int MapInstance::FindRandomPointAroundCircle(int layer,
|
||||
const glm::vec3& center_pos,
|
||||
int MapInstance::FindRandomPointAroundCircle(const glm::vec3& center_pos,
|
||||
float max_radius,
|
||||
glm::vec3& random_pt)
|
||||
{
|
||||
@ -337,7 +336,7 @@ int MapInstance::FindRandomPointAroundCircle(int layer,
|
||||
}
|
||||
}
|
||||
|
||||
bool MapInstance::Raycast(int layer, const glm::vec3& start, const glm::vec3& end,
|
||||
bool MapInstance::Raycast(const glm::vec3& start, const glm::vec3& end,
|
||||
glm::vec3& hit_point, bool& hit_result)
|
||||
{
|
||||
float spos[3];
|
||||
@ -591,7 +590,7 @@ void MapInstance::MarkMapAreaPolys()
|
||||
}
|
||||
}
|
||||
|
||||
bool MapInstance::RaycastEx(int layer, const glm::vec3& start, const glm::vec3& end,
|
||||
bool MapInstance::RaycastEx(const glm::vec3& start, const glm::vec3& end,
|
||||
glm::vec3& hit_point, bool& hit_result,
|
||||
int& same_polys_flags, std::vector<dtPolyRef>& spec_polys)
|
||||
{
|
||||
@ -695,3 +694,8 @@ bool MapInstance::RaycastEx(int layer, const glm::vec3& start, const glm::vec3&
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int MapInstance::GetPolyFlags(Creature* c, int same_polys_flags, const std::vector<dtPolyRef>& spec_polys)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -26,17 +26,15 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
|
||||
|
||||
dtNavMesh* GetNavMesh() { return navmesh_; };
|
||||
dtNavMeshQuery* GetNavMeshQuery() { return navmesh_query_; };
|
||||
int FindStraightPath(int layer,
|
||||
const glm::vec3& start,
|
||||
int FindStraightPath(const glm::vec3& start,
|
||||
const glm::vec3& end,
|
||||
std::vector<glm::vec3>& paths);
|
||||
int FindRandomPointAroundCircle(int layer,
|
||||
const glm::vec3& center_pos,
|
||||
int FindRandomPointAroundCircle(const glm::vec3& center_pos,
|
||||
float max_radius,
|
||||
glm::vec3& random_pt);
|
||||
bool Raycast(int layer, const glm::vec3& start, const glm::vec3& end,
|
||||
bool Raycast(const glm::vec3& start, const glm::vec3& end,
|
||||
glm::vec3& hit_point, bool& hit_result);
|
||||
bool RaycastEx(int layer, const glm::vec3& start, const glm::vec3& end,
|
||||
bool RaycastEx(const glm::vec3& start, const glm::vec3& end,
|
||||
glm::vec3& hit_point, bool& hit_result,
|
||||
int& same_polys_flags, std::vector<dtPolyRef>& spec_polys);
|
||||
bool FindNearestPoint(const glm::vec3& center, float radius, glm::vec3& nearestPt);
|
||||
@ -45,6 +43,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
|
||||
void Scale(glm::vec3& v);
|
||||
void UnScale(glm::vec3& v);
|
||||
glm::vec3 UnScaleEx(const glm::vec3& v);
|
||||
int GetPolyFlags(Creature* c, int same_polys_flags, const std::vector<dtPolyRef>& spec_polys);
|
||||
|
||||
private:
|
||||
void CreateThings();
|
||||
|
@ -27,7 +27,7 @@ bool Movement::UpdatePosition()
|
||||
{
|
||||
curr_point.curr_pos.AddGlmVec3(curr_point.dir * owner_->GetSpeed());
|
||||
owner_->SetPos(curr_point.curr_pos);
|
||||
owner_->CheckSpecObject();
|
||||
//owner_->CheckSpecObject();
|
||||
}
|
||||
if (owner_->GetPos().Distance2D2(curr_point.src_pos) - curr_point.distance >= 0.0001f) {
|
||||
curr_point.tar_pos.y = curr_point.curr_pos.y;
|
||||
@ -83,7 +83,7 @@ void Movement::CalcTargetPos(float distance)
|
||||
glm::vec3 hit_point;
|
||||
owner_->room->map_instance->Scale(start);
|
||||
owner_->room->map_instance->Scale(end);
|
||||
bool ret = owner_->room->map_instance->Raycast(0, start, end, hit_point, hit_result);
|
||||
bool ret = owner_->room->map_instance->Raycast(start, end, hit_point, hit_result);
|
||||
if (ret) {
|
||||
owner_->room->map_instance->UnScale(hit_point);
|
||||
point.tar_pos.FromGlmVec3(hit_point);
|
||||
|
Loading…
x
Reference in New Issue
Block a user