Compare commits

...

4 Commits

Author SHA1 Message Date
aozhiwei
160fd1a9ba 1 2024-02-26 11:10:32 +08:00
aozhiwei
13236a7746 1 2024-02-19 17:54:13 +08:00
aozhiwei
82f50e1ae9 1 2024-02-19 17:02:51 +08:00
aozhiwei
3c8c2a893b 1 2024-02-19 16:59:34 +08:00
5 changed files with 28 additions and 0 deletions

View File

@ -421,9 +421,11 @@ void CallFuncBuff::ProcFlashMove()
hit_point,
hit_result);
if (ret) {
int last_poly_flags = owner->room->map_instance->GetLastRaycastPolyFlags();
owner->room->map_instance->UnScale(hit_point);
owner->GetMovement()->ClearPath();
owner->context_real_pos = hit_point;
owner->CheckSpecObject(last_poly_flags);
Position new_pos;
new_pos.FromGlmVec3(hit_point);
@ -448,6 +450,7 @@ void CallFuncBuff::ProcFlashMove()
car->GetDriver()->SetPos(new_pos);
car->SyncPos();
car->GetDriver()->GetMovement()->ClearPath();
car->GetDriver()->CheckSpecObject(last_poly_flags);
App::Instance()->verify_set_pos = 0;
}
}

View File

@ -282,6 +282,7 @@ void Car::SyncPos()
for (auto hum : passengers_) {
if (hum != driver_) {
hum->SetPos(GetPos());
//hum->CheckSpecObject(poly_ext_flags_);
hum->SetMoveDir(GetMoveDir());
room->grid_service->MoveCreature(hum);
}
@ -637,6 +638,7 @@ void Car::Update(int delta_time)
if (GetDriver()) {
App::Instance()->verify_set_pos = 1;
GetDriver()->SetPos(GetPos());
//GetDriver()->CheckSpecObject(poly_ext_flags_);
App::Instance()->verify_set_pos = 0;
}
SyncPos();

View File

@ -89,6 +89,7 @@ public:
void MapInstance::Init()
{
last_raycast_poly_ref_ = INVALID_NAVMESH_POLYREF;
map_meta_ = mt::Map::GetById(map_id);
if (!map_meta_) {
A8_ABORT();
@ -440,6 +441,8 @@ bool MapInstance::FindRandomPointAroundCircle(const glm::vec3& center_pos,
bool MapInstance::Raycast(const glm::vec3& start, const glm::vec3& end,
glm::vec3& hit_point, bool& hit_result)
{
last_raycast_poly_ref_ = INVALID_NAVMESH_POLYREF;
float spos[3];
spos[0] = start.x;
spos[1] = start.y;
@ -480,6 +483,7 @@ bool MapInstance::Raycast(const glm::vec3& start, const glm::vec3& end,
return false;
}
last_raycast_poly_ref_ = polys_[npolys - 1];
if (t > 1) {
// No Hit
hit_pos_[0] = epos[0];
@ -730,6 +734,7 @@ bool MapInstance::RaycastEx(const glm::vec3& start, const glm::vec3& end,
int& same_polys_flags, std::vector<dtPolyRef>& spec_polys,
unsigned short exclude_flags)
{
last_raycast_poly_ref_ = INVALID_NAVMESH_POLYREF;
same_polys_flags = 0;
float spos[3];
@ -772,6 +777,7 @@ bool MapInstance::RaycastEx(const glm::vec3& start, const glm::vec3& end,
return false;
}
last_raycast_poly_ref_ = polys_[npolys - 1];
if (t > 1) {
// No Hit
hit_pos_[0] = epos[0];
@ -1403,3 +1409,15 @@ bool MapInstance::IsValidPos(const glm::vec3& point)
}
return true;
}
unsigned short MapInstance::GetLastRaycastPolyFlags()
{
return 0;
unsigned short flags = 0;
if (last_raycast_poly_ref_ != INVALID_NAVMESH_POLYREF) {
auto status = navmesh_->getPolyFlags(last_raycast_poly_ref_, &flags);
if (dtStatusSucceed(status)) {
}
}
return flags;
}

View File

@ -64,6 +64,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
void AdjustOnLandPoint(glm::vec3& point);
bool IsConnectablePoly(dtPolyRef poly_ref);
bool IsValidPos(const glm::vec3& point);
unsigned short GetLastRaycastPolyFlags();
private:
void LoadHouse();
@ -77,6 +78,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
float hit_normal_[3];
float hit_pos_[3];
dtPolyRef polys_[MAX_POLYS];
dtPolyRef last_raycast_poly_ref_ = 0;
std::vector<int> poly_ext_datas_;
std::vector<glm::vec3> grass_pos_hash_;

View File

@ -344,6 +344,9 @@ void Player::UpdateMoving()
void Player::UpdateShot()
{
#ifdef MYDEBUG
a8::XPrintf("UpdateShot fly:%d", {HasBuffEffect(kBET_InWater) ? 1 : 0});
#endif
if (dead ||
downed ||
HasBuffEffect(kBET_Jump) ||