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

Function quietIdleCB

src/SB/Game/zNPCTypeTiki.cpp:1435–1477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1433}
1434
1435static S32 quietIdleCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*)
1436{
1437 zNPCTiki* tiki = (zNPCTiki*)rawgoal->GetOwner();
1438 zNPCGoalTikiIdle* goal = (zNPCGoalTikiIdle*)rawgoal;
1439 S32 nextgoal = 0;
1440 xVec3 tmp;
1441
1442 xVec3Sub(&tmp, (xVec3*)&tiki->model->Mat->pos, (xVec3*)&globals.player.ent.model->Mat->pos);
1443 F32 scale = xVec3Length2(&tmp);
1444
1445 U8 notSneaking =
1446 (globals.player.Speed > 1 || globals.player.ent.model == globals.player.model_sandy ||
1447 globals.player.ent.model == globals.player.model_patrick);
1448
1449 if (scale < 25.0f && notSneaking)
1450 {
1451 nextgoal = NPC_GOAL_TIKIHIDE;
1452 *trantype = GOAL_TRAN_SET;
1453 }
1454 else
1455 {
1456 if (scale < 50.0f && notSneaking)
1457 {
1458 tiki->tikiFlag &= ~0xC0;
1459 }
1460 if (tiki->model->Scale.x)
1461 {
1462 scale = 0.75f * dt + tiki->model->Scale.x;
1463 xEntShow(tiki);
1464 tiki->RestoreColFlags();
1465 if (scale > 1.0f)
1466 {
1467 tiki->model->Scale.x = tiki->model->Scale.y = tiki->model->Scale.z = 0.0f;
1468 }
1469 else
1470 {
1471 tiki->model->Scale.x = tiki->model->Scale.y = tiki->model->Scale.z = scale;
1472 }
1473 }
1474 }
1475
1476 return nextgoal;
1477}
1478
1479static S32 quietHideCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*)
1480{

Callers

nothing calls this directly

Calls 5

xVec3SubFunction · 0.85
xVec3Length2Function · 0.85
xEntShowFunction · 0.85
GetOwnerMethod · 0.80
RestoreColFlagsMethod · 0.80

Tested by

no test coverage detected