| 1104 | } |
| 1105 | |
| 1106 | S32 NPCC_HaveLOSToPos(xVec3* pos_src, xVec3* pos_tgt, F32 dst_max, xBase* tgt, xCollis* colCallers) |
| 1107 | { |
| 1108 | S32 result; |
| 1109 | xRay3 ray = {}; |
| 1110 | xScene* xscn = globals.sceneCur; |
| 1111 | xCollis* colrec; |
| 1112 | |
| 1113 | if (colCallers) |
| 1114 | { |
| 1115 | colrec = colCallers; |
| 1116 | } |
| 1117 | else |
| 1118 | { |
| 1119 | static xCollis localCollis = { (((U32)(1 << 8)) | ((U32)(1 << 9)) | ((U32)(1 << 10)) | |
| 1120 | ((U32)(1 << 11))) | |
| 1121 | ((U32)(1 << 12)) }; |
| 1122 | |
| 1123 | memset(&localCollis, 0, sizeof(xCollis)); |
| 1124 | localCollis.flags = |
| 1125 | (((U32)(1 << 8)) | ((U32)(1 << 9)) | ((U32)(1 << 10)) | ((U32)(1 << 11))) | |
| 1126 | ((U32)(1 << 12)) | ((U32)(1 << 12)); |
| 1127 | |
| 1128 | colrec = &localCollis; |
| 1129 | } |
| 1130 | |
| 1131 | ray.min_t = 0.0f; |
| 1132 | ray.max_t = dst_max; |
| 1133 | |
| 1134 | xVec3Sub(&ray.dir, pos_tgt, pos_src); |
| 1135 | xVec3Normalize(&ray.dir, &ray.dir); |
| 1136 | xVec3Copy(&ray.origin, pos_src); |
| 1137 | |
| 1138 | ray.flags = (1 << 10) | (1 << 11); |
| 1139 | |
| 1140 | xRayHitsScene(xscn, &ray, colrec); |
| 1141 | |
| 1142 | if (!(colrec->flags & ((U32)(1 << 0)))) |
| 1143 | { |
| 1144 | result = 1; |
| 1145 | } |
| 1146 | else if (colrec->dist > dst_max) |
| 1147 | { |
| 1148 | result = 1; |
| 1149 | } |
| 1150 | else if (tgt && colrec->oid != 0) |
| 1151 | { |
| 1152 | if (tgt->id == colrec->oid) |
| 1153 | { |
| 1154 | result = 1; |
| 1155 | } |
| 1156 | else |
| 1157 | { |
| 1158 | result = 0; |
| 1159 | } |
| 1160 | } |
| 1161 | else |
| 1162 | { |
| 1163 | result = 0; |
nothing calls this directly
no test coverage detected