diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 05d693f..c8fa2e1 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1969,6 +1969,31 @@ void Human::CheckSkinTank() void Human::_UpdateMove(int speed) { #if 1 + do { + int distance = std::min(5, speed); + _InternalUpdateMove(distance); + speed -= distance; + } while (speed > 0); + #else + for (int i = 0; i < speed; ++i) { + a8::Vec2 old_pos = GetPos(); + SetPos(GetPos() + move_dir); + if (IsCollisionInMapService()) { + SetPos(old_pos); + FindPathInMapService(); + #if 0 + if (rand() % 3 == 0) { + i += 1; + } + #endif + } + room->grid_service.MoveHuman(this); + } + #endif +} + +void Human::_InternalUpdateMove(float speed) +{ float nx = move_dir.x * speed; float ny = move_dir.y * speed; a8::Vec2 old_pos = GetPos(); @@ -2010,22 +2035,6 @@ void Human::_UpdateMove(int speed) SetPos(old_pos + a8::Vec2(nx, ny)); room->grid_service.MoveHuman(this); - #else - for (int i = 0; i < speed; ++i) { - a8::Vec2 old_pos = GetPos(); - SetPos(GetPos() + move_dir); - if (IsCollisionInMapService()) { - SetPos(old_pos); - FindPathInMapService(); - #if 0 - if (rand() % 3 == 0) { - i += 1; - } - #endif - } - room->grid_service.MoveHuman(this); - } - #endif } void Human::ClearFrameData() diff --git a/server/gameserver/human.h b/server/gameserver/human.h index c744f4f..bdc86c0 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -246,6 +246,7 @@ class Human : public Entity protected: void _UpdateMove(int speed); + void _InternalUpdateMove(float speed); void ProcLootOldSkin(Loot* entity, MetaData::Equip* item_meta); void ProcLootSkin(Loot* entity, MetaData::Equip* item_meta); void ProcLootCar(Loot* entity, MetaData::Equip* item_meta); diff --git a/third_party/a8engine b/third_party/a8engine index 62cad93..c6c7cb3 160000 --- a/third_party/a8engine +++ b/third_party/a8engine @@ -1 +1 @@ -Subproject commit 62cad93ca276670dc7280425df58916bacbe20e5 +Subproject commit c6c7cb379e997ce3808edff38e822eda3da19915