This commit is contained in:
aozhiwei 2022-12-01 13:11:31 +08:00
parent 278d02c292
commit 1db811e366

View File

@ -52,6 +52,10 @@ bool MoveHelper::GetMovePosition(glm::vec3& out_pos)
next_point.dir.z = dir.y; next_point.dir.z = dir.y;
} }
} }
if (owner_->GetPos().x < 0 ||
owner_->GetPos().y < 0) {
abort();
}
return true; return true;
} }
return false; return false;
@ -84,7 +88,8 @@ void MoveHelper::CalcTargetPos(float distance)
bool is_hit = false; bool is_hit = false;
MovePathPoint point; MovePathPoint point;
if (c->HasBuffEffect(kBET_ThroughWall) || if (c->HasBuffEffect(kBET_ThroughWall) ||
c->HasBuffEffect(kBET_Fly)) { c->HasBuffEffect(kBET_Fly) ||
c->HasBuffEffect(kBET_Jump)) {
point.tar_pos = end * 10.f; point.tar_pos = end * 10.f;
if (point.tar_pos.x > owner_->room->GetMapMeta()->i->map_width() + 10) { if (point.tar_pos.x > owner_->room->GetMapMeta()->i->map_width() + 10) {
point.tar_pos.x = owner_->room->GetMapMeta()->i->map_width() - 10; point.tar_pos.x = owner_->room->GetMapMeta()->i->map_width() - 10;
@ -95,8 +100,8 @@ void MoveHelper::CalcTargetPos(float distance)
if (point.tar_pos.x < 10) { if (point.tar_pos.x < 10) {
point.tar_pos.x = 10; point.tar_pos.x = 10;
} }
if (point.tar_pos.y < 10) { if (point.tar_pos.z < 10) {
point.tar_pos.y = 10; point.tar_pos.z = 10;
} }
} else { } else {
int ret = owner_->room->map_instance->Raycast(0, start, end, hit_point); int ret = owner_->room->map_instance->Raycast(0, start, end, hit_point);
@ -115,7 +120,11 @@ void MoveHelper::CalcTargetPos(float distance)
point.src_pos.z = owner_->GetPos().y; point.src_pos.z = owner_->GetPos().y;
point.frameno = owner_->room->GetFrameNo() - 1; point.frameno = owner_->room->GetFrameNo() - 1;
#ifdef DEBUG if (point.tar_pos.x < 0 ||
point.tar_pos.z < 0) {
abort();
}
#ifdef DEBUG1
a8::XPrintf("CalcTargetPos src_pos:%f,%f tar_pos:%f,%f is_hit:%d start:%f,%f,%f end:%f,%f,%f\n", a8::XPrintf("CalcTargetPos src_pos:%f,%f tar_pos:%f,%f is_hit:%d start:%f,%f,%f end:%f,%f,%f\n",
{ {
point.src_pos.x, point.src_pos.x,