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

Function quietHideCB

src/SB/Game/zNPCTypeTiki.cpp:1479–1512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1477}
1478
1479static S32 quietHideCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*)
1480{
1481 zNPCTiki* tiki = (zNPCTiki*)rawgoal->GetOwner();
1482 S32 nextgoal = 0;
1483 xVec3 tmp;
1484
1485 xVec3Sub(&tmp, (xVec3*)&tiki->model->Mat->pos, (xVec3*)&globals.player.ent.model->Mat->pos);
1486 F32 scale = xVec3Length2(&tmp);
1487
1488 if (scale > 25.0f)
1489 {
1490 *trantype = GOAL_TRAN_SET;
1491 nextgoal = NPC_GOAL_TIKIIDLE;
1492 }
1493 else
1494 {
1495 if (!tiki->model->Scale.x)
1496 {
1497 tiki->model->Scale.x = tiki->model->Scale.y = tiki->model->Scale.z = 1.0f;
1498 }
1499
1500 scale = tiki->model->Scale.x - 2.0f * dt;
1501 if (scale < 0.00001f)
1502 {
1503 scale = 0.00001f;
1504 xEntHide(tiki);
1505 tiki->RestoreColFlags();
1506 }
1507
1508 tiki->model->Scale.x = tiki->model->Scale.y = tiki->model->Scale.z = scale;
1509 }
1510
1511 return nextgoal;
1512}
1513
1514static S32 thunderIdleCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*)
1515{

Callers

nothing calls this directly

Calls 5

xVec3SubFunction · 0.85
xVec3Length2Function · 0.85
xEntHideFunction · 0.85
GetOwnerMethod · 0.80
RestoreColFlagsMethod · 0.80

Tested by

no test coverage detected