| 1545 | } |
| 1546 | |
| 1547 | void check_lock_target(const xVec3* target) |
| 1548 | { |
| 1549 | xMat4x3* mat = &globals.camera.mat; |
| 1550 | xVec3 offset = *target - mat->pos; |
| 1551 | F32 ang = offset.dot(mat->at); |
| 1552 | |
| 1553 | if (ang < current_tweak->reticle.dist_min || ang > current_tweak->reticle.dist_max) |
| 1554 | { |
| 1555 | return; |
| 1556 | } |
| 1557 | |
| 1558 | ang = offset.length(); |
| 1559 | if ((ang >= -0.00001f) && (ang <= 0.00001f)) |
| 1560 | { |
| 1561 | ang = 0.0f; |
| 1562 | } |
| 1563 | else |
| 1564 | { |
| 1565 | ang = xacos(offset.dot(mat->at) / ang); |
| 1566 | } |
| 1567 | |
| 1568 | F32 max_ang = current_tweak->reticle.ang_show; |
| 1569 | F32 min_ang = current_tweak->reticle.ang_hide; |
| 1570 | |
| 1571 | if (ang >= min_ang) |
| 1572 | { |
| 1573 | return; |
| 1574 | } |
| 1575 | |
| 1576 | if (ang >= max_ang) |
| 1577 | { |
| 1578 | S32 t = find_locked_target(target); |
| 1579 | if (t < 0) |
| 1580 | { |
| 1581 | return; |
| 1582 | } |
| 1583 | |
| 1584 | lock_target(t, target, (min_ang - ang) / (min_ang - max_ang)); |
| 1585 | } |
| 1586 | |
| 1587 | else |
| 1588 | { |
| 1589 | lock_target(find_locked_target(target), target, 1.0f); |
| 1590 | } |
| 1591 | } |
| 1592 | |
| 1593 | U32 check_anim_aim(xAnimTransition*, xAnimSingle*, void*) |
| 1594 | { |
no test coverage detected