修复穿帮bug

This commit is contained in:
aozhiwei 2020-04-30 14:39:03 +08:00
parent bd489169aa
commit ec44ec7f6b
3 changed files with 27 additions and 17 deletions

View File

@ -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()

View File

@ -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);

@ -1 +1 @@
Subproject commit 62cad93ca276670dc7280425df58916bacbe20e5
Subproject commit c6c7cb379e997ce3808edff38e822eda3da19915