MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AIDetermineObjVisLevel

Function AIDetermineObjVisLevel

Descent3/AImain.cpp:1649–1682  ·  view source on GitHub ↗

Allows the vis sliders to work

Source from the content-addressed store, hash-verified

1647
1648// Allows the vis sliders to work
1649float AIDetermineObjVisLevel(object *obj, object *target) {
1650 float vis_level = AIVIS_FULL;
1651
1652 if (target == NULL)
1653 return AIVIS_NONE;
1654
1655 if ((target->effect_info) && (target->effect_info->type_flags & EF_CLOAKED)) {
1656 vis_level = AIVIS_NONE;
1657
1658 if (target->type == OBJ_PLAYER && (Players[target->id].flags & PLAYER_FLAGS_AFTERBURN_ON)) {
1659 vis_level += 1.0f;
1660 }
1661
1662 if (target->type == OBJ_PLAYER && (Players[target->id].flags & PLAYER_FLAGS_HEADLIGHT)) {
1663 vector from_target = obj->pos - target->pos;
1664 vm_NormalizeVector(&from_target);
1665
1666 if ((target->orient.fvec) * (from_target) > 0.965f) {
1667 vis_level += 1.0f;
1668 }
1669 }
1670 }
1671
1672 if ((target->effect_info) && (target->effect_info->type_flags & EF_NAPALMED)) {
1673 vis_level += 1.75;
1674 }
1675
1676 if (vis_level < AIVIS_NONE)
1677 vis_level = AIVIS_NONE;
1678 else if (vis_level > AIVIS_FULL)
1679 vis_level = AIVIS_FULL;
1680
1681 return vis_level;
1682}
1683
1684static inline bool ai_target_valid(object *obj) {
1685 ai_frame *ai_info = obj->ai_info;

Callers 3

AIDetermineAimPointFunction · 0.85
AICheckTargetVisFunction · 0.85
AITargetCheckFunction · 0.85

Calls 1

vm_NormalizeVectorFunction · 0.85

Tested by

no test coverage detected