| 1311 | } |
| 1312 | |
| 1313 | void CGameCharacter::UpdateAnimationInfo_ProcessSteps(uint8_t &dir, bool canChange) |
| 1314 | { |
| 1315 | dir = Direction & 7; |
| 1316 | |
| 1317 | if (!m_Steps.empty()) |
| 1318 | { |
| 1319 | CWalkData &wd = m_Steps.front(); |
| 1320 | |
| 1321 | dir = wd.Direction; |
| 1322 | int run = 0; |
| 1323 | |
| 1324 | if ((dir & 0x80) != 0) |
| 1325 | { |
| 1326 | dir &= 7; |
| 1327 | run = 1; |
| 1328 | } |
| 1329 | |
| 1330 | if (canChange) |
| 1331 | { |
| 1332 | if (AnimationFromServer) |
| 1333 | { |
| 1334 | SetAnimation(AG_INVALID); |
| 1335 | } |
| 1336 | |
| 1337 | int maxDelay = g_PathFinder.GetWalkSpeed(run != 0, IsMounted()) - 15; |
| 1338 | |
| 1339 | int delay = (int)g_Ticks - (int)LastStepTime; |
| 1340 | bool removeStep = (delay >= maxDelay); |
| 1341 | bool directionChange = false; |
| 1342 | |
| 1343 | if (m_X != wd.X || m_Y != wd.Y) |
| 1344 | { |
| 1345 | bool badStep = false; |
| 1346 | |
| 1347 | if ((OffsetX == 0) && (OffsetY == 0)) |
| 1348 | { |
| 1349 | int absX = abs(m_X - wd.X); |
| 1350 | int absY = abs(m_Y - wd.Y); |
| 1351 | |
| 1352 | badStep = (absX > 1 || absY > 1 || ((absX + absY) == 0)); |
| 1353 | |
| 1354 | if (!badStep) |
| 1355 | { |
| 1356 | absX = m_X; |
| 1357 | absY = m_Y; |
| 1358 | |
| 1359 | g_PathFinder.GetNewXY(wd.Direction & 7, absX, absY); |
| 1360 | |
| 1361 | badStep = (absX != wd.X || absY != wd.Y); |
| 1362 | } |
| 1363 | } |
| 1364 | |
| 1365 | if (badStep) |
| 1366 | { |
| 1367 | removeStep = true; |
| 1368 | } |
| 1369 | else |
| 1370 | { |
no test coverage detected