MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / check_lock_target

Function check_lock_target

src/SB/Game/zEntCruiseBubble.cpp:1547–1591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 2

hazard_checkMethod · 0.70
operator()Method · 0.70

Calls 5

xacosFunction · 0.85
find_locked_targetFunction · 0.85
lengthMethod · 0.80
lock_targetFunction · 0.70
dotMethod · 0.45

Tested by

no test coverage detected