MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / AlertNearbyGuards

Function AlertNearbyGuards

TombEngine/Game/control/box.cpp:496–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

494}
495
496void 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
521void AlertAllGuards(short itemNumber)
522{

Callers 3

ControlExplosionFunction · 0.85
ExplodeProjectileFunction · 0.85
LaraControlFunction · 0.85

Calls 2

GetCreatureInfoFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected