1
This commit is contained in:
parent
1d405bd088
commit
6ad0a30010
@ -16,6 +16,8 @@ void MovementComponent::RayDetection()
|
|||||||
} else if (owner->entity_type == ET_Player) {
|
} else if (owner->entity_type == ET_Player) {
|
||||||
Human* hum = (Human*)owner;
|
Human* hum = (Human*)owner;
|
||||||
start_point = hum->pos;
|
start_point = hum->pos;
|
||||||
|
target_point = hum->pos + hum->move_dir * (MAP_CELL_WIDTH - 64);
|
||||||
|
target_distance = (target_point - start_point).Norm();
|
||||||
{
|
{
|
||||||
Vector2D left_dir = hum->move_dir;
|
Vector2D left_dir = hum->move_dir;
|
||||||
left_dir.Rotate(-90);
|
left_dir.Rotate(-90);
|
||||||
|
@ -727,11 +727,15 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
|
|||||||
if (std::abs(msg.move_dir().x()) > FLT_EPSILON ||
|
if (std::abs(msg.move_dir().x()) > FLT_EPSILON ||
|
||||||
std::abs(msg.move_dir().y()) > FLT_EPSILON
|
std::abs(msg.move_dir().y()) > FLT_EPSILON
|
||||||
) {
|
) {
|
||||||
|
Vector2D old_move_dir;
|
||||||
move_dir.FromPB(&msg.move_dir());
|
move_dir.FromPB(&msg.move_dir());
|
||||||
move_dir.Normalize();
|
move_dir.Normalize();
|
||||||
moving = true;
|
moving = true;
|
||||||
#ifdef RAY_DETECTION
|
#ifdef RAY_DETECTION
|
||||||
movement->RayDetection();
|
if (std::abs(move_dir.x - old_move_dir.x) > 0.00001f ||
|
||||||
|
std::abs(move_dir.y - old_move_dir.y) > 0.00001f) {
|
||||||
|
movement->RayDetection();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user