MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / MonitorCowering

Method MonitorCowering

src/SB/Game/zNPCTypeVillager.cpp:1231–1269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1229}
1230
1231void zNPCFish::MonitorCowering(xScene* xscn, F32 dt)
1232{
1233 xVec3 vec; // from dwarf, unused?
1234 NPCTarget* tgt = &this->tgt_robonear;
1235 NPCConfig* cfg = this->cfg_npc;
1236
1237 tgt->HaveTarget();
1238 if (!tgt->HaveTarget())
1239 {
1240 tgt->TargetClear();
1241 }
1242 else if (tgt->IsDead())
1243 {
1244 tgt->TargetClear();
1245 }
1246 else if (!tgt->InCylinder(xEntGetPos(this), g_rad_cowercheck, cfg->hyt_detect, cfg->off_detect))
1247 {
1248 tgt->TargetClear();
1249 }
1250
1251 if (!tgt->HaveTarget())
1252 {
1253 tgt->FindNearest(NPC_TGT_ENT, this, xEntGetPos(this), g_rad_cowercheck);
1254 }
1255
1256 if (tgt->HaveTarget())
1257 {
1258 this->tmr_robonear = cfg->tym_alert * (0.25f * (xurand() - 0.5f)) + cfg->tym_alert;
1259 this->tmr_checkagain = cfg->tym_alert * (0.25f * (xurand() - 0.5f)) + cfg->tym_alert;
1260 zNPCMsg_SendMsg(NPC_MID_BECOMESCARED, *(U32*)this);
1261 }
1262 else
1263 {
1264 this->tmr_robonear = -1.0f;
1265 this->tmr_checkagain =
1266 cfg->tym_alert * PI * (0.25f * (xurand() - 0.5f)) + cfg->tym_alert * PI;
1267 zNPCMsg_SendMsg(NPC_MID_NOLONGERSCARED, *(U32*)this);
1268 }
1269}
1270
1271void zNPCFish::CheckDoChat()
1272{

Callers 1

ProcessMethod · 0.95

Calls 8

xEntGetPosFunction · 0.85
xurandFunction · 0.85
HaveTargetMethod · 0.80
TargetClearMethod · 0.80
IsDeadMethod · 0.80
InCylinderMethod · 0.80
FindNearestMethod · 0.80
zNPCMsg_SendMsgFunction · 0.70

Tested by

no test coverage detected