Scans area around given shot position for object data
| 396 | |
| 397 | // Scans area around given shot position for object data |
| 398 | bool ScanShotPathPosition(int obj_handle, vector *pos, int room, float radius, float dist) { |
| 399 | int scan_objs[MAX_SCAN_SHOT_OBJECTS]; |
| 400 | int n_scan; |
| 401 | int n, i; |
| 402 | int type; |
| 403 | |
| 404 | // Make sure there is still a shot scan position available |
| 405 | if (num_shot_path_positions >= MAX_SHOT_PATH_POSITIONS) { |
| 406 | return false; |
| 407 | } |
| 408 | |
| 409 | // Init this shot path position's data |
| 410 | n = num_shot_path_positions; |
| 411 | ShotPathPositions[n].contains_shooter = false; |
| 412 | ShotPathPositions[n].path_dist = dist; |
| 413 | ShotPathPositions[n].scan_radius = radius; |
| 414 | ShotPathPositions[n].num_enemies = 0; |
| 415 | ShotPathPositions[n].num_friends = 0; |
| 416 | ShotPathPositions[n].num_neutrals = 0; |
| 417 | |
| 418 | // Scan for any nearby objects |
| 419 | // NOTE: check the func below to see what other params do!!! |
| 420 | n_scan = AI_GetNearbyObjs(pos, room, radius, scan_objs, MAX_SCAN_SHOT_OBJECTS, false, true, false, true); |
| 421 | |
| 422 | // Go through the objects that have been found and store tallies |
| 423 | for (i = 0; i < n_scan; i++) { |
| 424 | Obj_Value(scan_objs[i], VF_GET, OBJV_I_TYPE, &type); |
| 425 | if (type == OBJ_ROBOT || type == OBJ_PLAYER) { |
| 426 | // Make sure it's not cloaked |
| 427 | if (qObjectCloakTime(scan_objs[i]) == 0.0f) { |
| 428 | // Tallie the object accordingly |
| 429 | if (scan_objs[i] == obj_handle) { |
| 430 | // It's the shooter |
| 431 | ShotPathPositions[n].contains_shooter = true; |
| 432 | } else if (AI_IsObjEnemy(obj_handle, scan_objs[i])) { |
| 433 | // It's an enemy |
| 434 | ShotPathPositions[n].num_enemies++; |
| 435 | } else if (AI_IsObjFriend(obj_handle, scan_objs[i])) { |
| 436 | // It's a friend |
| 437 | ShotPathPositions[n].num_friends++; |
| 438 | } else { |
| 439 | // It's a neutral |
| 440 | ShotPathPositions[n].num_neutrals++; |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | num_shot_path_positions++; |
| 446 | |
| 447 | return true; |
| 448 | } |
| 449 | |
| 450 | // Traverses the straight-line shot path and gathers object data |
| 451 | float TraverseShotPath(tShotData *shot_data) { |
no test coverage detected