| 1528 | typedef df::proj_itemst interpose_base; |
| 1529 | |
| 1530 | void aimAtPoint(EngineInfo *engine, const ProjectilePath &path) |
| 1531 | { |
| 1532 | target_pos = path.target; |
| 1533 | |
| 1534 | // Debug |
| 1535 | if (debug_mode) |
| 1536 | set_arrow_color(path.goal, COLOR_LIGHTMAGENTA); |
| 1537 | |
| 1538 | PathMetrics raytrace(path); |
| 1539 | |
| 1540 | // Materialize map blocks, or the projectile will crash into them |
| 1541 | for (int i = 0; i < raytrace.collision_step; i++) |
| 1542 | Maps::ensureTileBlock(path[i]); |
| 1543 | |
| 1544 | // Find valid hit point for catapult stones |
| 1545 | if (flags.bits.high_flying) |
| 1546 | { |
| 1547 | if (raytrace.hits()) |
| 1548 | fall_threshold = raytrace.goal_step; |
| 1549 | else |
| 1550 | fall_threshold = (raytrace.collision_z_step+raytrace.collision_step-1)/2; |
| 1551 | |
| 1552 | while (fall_threshold < raytrace.collision_step-1) |
| 1553 | { |
| 1554 | if (isTargetableTile(path[fall_threshold])) |
| 1555 | break; |
| 1556 | |
| 1557 | fall_threshold++; |
| 1558 | } |
| 1559 | } |
| 1560 | |
| 1561 | fall_threshold = std::max(fall_threshold, engine->fire_range.first); |
| 1562 | fall_threshold = std::min(fall_threshold, engine->fire_range.second); |
| 1563 | } |
| 1564 | |
| 1565 | void aimAtPoint(EngineInfo *engine, int skill, const ProjectilePath &path) |
| 1566 | { |
no test coverage detected