| 3360 | } |
| 3361 | |
| 3362 | bool CanCreatureJump(ItemInfo& item, JumpDistance jumpDistType) |
| 3363 | { |
| 3364 | const auto& creature = *GetCreatureInfo(&item); |
| 3365 | if (creature.Enemy == nullptr) |
| 3366 | return false; |
| 3367 | |
| 3368 | float stepDist = BLOCK(0.92f); |
| 3369 | |
| 3370 | int vPos = item.Pose.Position.y; |
| 3371 | auto pointCollA = GetPointCollision(item, item.Pose.Orientation.y, stepDist); |
| 3372 | auto pointCollB = GetPointCollision(item, item.Pose.Orientation.y, stepDist * 2); |
| 3373 | auto pointCollC = GetPointCollision(item, item.Pose.Orientation.y, stepDist * 3); |
| 3374 | |
| 3375 | switch (jumpDistType) |
| 3376 | { |
| 3377 | default: |
| 3378 | case JumpDistance::Block1: |
| 3379 | if (item.BoxNumber == creature.Enemy->BoxNumber || |
| 3380 | vPos >= (pointCollA.GetFloorHeight() - STEPUP_HEIGHT) || |
| 3381 | vPos >= (pointCollB.GetFloorHeight() + CLICK(1)) || |
| 3382 | vPos <= (pointCollB.GetFloorHeight() - CLICK(1)) || |
| 3383 | pointCollA.GetSector().PathfindingBoxID == NO_VALUE || |
| 3384 | pointCollB.GetSector().PathfindingBoxID == NO_VALUE) |
| 3385 | { |
| 3386 | return false; |
| 3387 | } |
| 3388 | |
| 3389 | break; |
| 3390 | |
| 3391 | case JumpDistance::Block2: |
| 3392 | if (item.BoxNumber == creature.Enemy->BoxNumber || |
| 3393 | vPos >= (pointCollA.GetFloorHeight() - STEPUP_HEIGHT) || |
| 3394 | vPos >= (pointCollB.GetFloorHeight() - STEPUP_HEIGHT) || |
| 3395 | vPos >= (pointCollC.GetFloorHeight() + CLICK(1)) || |
| 3396 | vPos <= (pointCollC.GetFloorHeight() - CLICK(1)) || |
| 3397 | pointCollA.GetSector().PathfindingBoxID == NO_VALUE || |
| 3398 | pointCollB.GetSector().PathfindingBoxID == NO_VALUE || |
| 3399 | pointCollC.GetSector().PathfindingBoxID == NO_VALUE) |
| 3400 | { |
| 3401 | return false; |
| 3402 | } |
| 3403 | |
| 3404 | break; |
| 3405 | } |
| 3406 | |
| 3407 | return true; |
| 3408 | } |
no test coverage detected