| 445 | } |
| 446 | |
| 447 | void zNPCMsg_AreaNPCExplodeNoRobo(zNPCCommon* who, F32 radius, const xVec3* pos_fromHere) |
| 448 | { |
| 449 | st_XORDEREDARRAY* npclist = zNPCMgr_GetNPCList(); |
| 450 | xVec3 from = (pos_fromHere != NULL) ? *pos_fromHere : *who->Center(); |
| 451 | F32 ds2_discard = SQ(radius); |
| 452 | for (S32 i = 0; i < npclist->cnt; i++) |
| 453 | { |
| 454 | zNPCCommon* npc = (zNPCCommon*)npclist->list[i]; |
| 455 | if (npc == who) |
| 456 | { |
| 457 | continue; |
| 458 | } |
| 459 | if (npc->baseFlags & 0x40) |
| 460 | { |
| 461 | continue; |
| 462 | } |
| 463 | if (npc->model != NULL && (npc->model->Flags & 0x400) != 0) |
| 464 | { |
| 465 | continue; |
| 466 | } |
| 467 | S32 ntyp = npc->SelfType() & 0xFFFFFF00; |
| 468 | if (ntyp == 'NTR\0') |
| 469 | { |
| 470 | continue; |
| 471 | } |
| 472 | xVec3 diff; |
| 473 | F32 ds2_tgt = npc->XYZDstSqToPos(&from, &diff); |
| 474 | if (ds2_tgt > ds2_discard) |
| 475 | { |
| 476 | continue; |
| 477 | } |
| 478 | if (ntyp == 'NTR\0') |
| 479 | { |
| 480 | zNPCRobot* robo = (zNPCRobot*)npc; |
| 481 | if (robo->IsDying() != 0) |
| 482 | { |
| 483 | continue; |
| 484 | } |
| 485 | } |
| 486 | else if (npc->IsAlive() == 0) |
| 487 | { |
| 488 | continue; |
| 489 | } |
| 490 | F32 dst = xsqrt(ds2_tgt); |
| 491 | if (dst > 0.00001f) |
| 492 | { |
| 493 | diff /= dst; |
| 494 | } |
| 495 | else |
| 496 | { |
| 497 | if (FABS(diff.x) > FABS(diff.z)) |
| 498 | { |
| 499 | diff = (diff.x > 0.0f) ? g_X3 : g_NX3; |
| 500 | } |
| 501 | else |
| 502 | { |
| 503 | diff = (diff.z > 0.0f) ? g_Z3 : g_NZ3; |
| 504 | } |
no test coverage detected