| 494 | } |
| 495 | |
| 496 | void AlertNearbyGuards(ItemInfo* item) |
| 497 | { |
| 498 | for (int i = 0; i < ActiveCreatures.size(); i++) |
| 499 | { |
| 500 | auto* currentCreature = GetCreatureInfo(&g_Level.Items[ActiveCreatures[i]]); |
| 501 | if (currentCreature->ItemNumber == NO_VALUE) |
| 502 | continue; |
| 503 | |
| 504 | auto* currentTarget = &g_Level.Items[currentCreature->ItemNumber + i]; |
| 505 | if (item->RoomNumber == currentTarget->RoomNumber) |
| 506 | { |
| 507 | currentCreature->Alerted = true; |
| 508 | continue; |
| 509 | } |
| 510 | |
| 511 | int x = (currentTarget->Pose.Position.x - item->Pose.Position.x) / 64; |
| 512 | int y = (currentTarget->Pose.Position.y - item->Pose.Position.y) / 64; |
| 513 | int z = (currentTarget->Pose.Position.z - item->Pose.Position.z) / 64; |
| 514 | |
| 515 | float distance = SQUARE(z) + SQUARE(y) + SQUARE(x); |
| 516 | if (distance < BLOCK(8)) |
| 517 | currentCreature->Alerted = true; |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | void AlertAllGuards(short itemNumber) |
| 522 | { |
no test coverage detected