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

Function thunderCountCB

src/SB/Game/zNPCTypeTiki.cpp:1563–1665  ·  view source on GitHub ↗

WIP

Source from the content-addressed store, hash-verified

1561
1562// WIP
1563static S32 thunderCountCB(xGoal* rawgoal, void*, en_trantype* trantype, F32 dt, void*)
1564{
1565 zNPCGoalTikiCount* goal;
1566 zNPCTiki* tiki;
1567 S32 nextgoal;
1568 F32 gfactor;
1569 F32 factor;
1570 xVec3 sPos;
1571 xVec3 ePos;
1572 F32 hght;
1573
1574 tiki = (zNPCTiki*)rawgoal->GetOwner();
1575 goal = (zNPCGoalTikiCount*)rawgoal;
1576
1577 nextgoal = 0;
1578
1579 factor = goal->tmr_count - dt;
1580 if (factor < -1.0f)
1581 {
1582 factor = -1.0f;
1583 }
1584 goal->tmr_count = factor;
1585
1586 if (goal->tmr_count < 0.0f)
1587 {
1588 *trantype = GOAL_TRAN_SET;
1589 nextgoal = NPC_GOAL_TIKIDYING;
1590 }
1591
1592 if (!goal->beingCarried && globals.player.carry.grabbed == tiki)
1593 {
1594 goal->beingCarried = TRUE;
1595 goal->tmr_count += 3.0f;
1596 }
1597
1598 gfactor = goal->tmr_count + 1.0f;
1599 factor = (-1.0f / gfactor) + 1.0f;
1600 hght = 8.0f * factor;
1601
1602 gfactor = factor - (F32)(S32)factor;
1603 factor = hght - (F32)(S32)hght;
1604
1605 tiki->model->RedMultiplier = factor * 0.75f + 0.25f;
1606 tiki->model->BlueMultiplier = 1.0f - tiki->model->RedMultiplier;
1607 tiki->model->GreenMultiplier = gfactor * 0.75f + 0.25f;
1608
1609 tiki->tikiFlag &= ~0xC0;
1610
1611 tiki->t1 -= dt;
1612
1613 if (tiki->t1 < 0.0f)
1614 {
1615 factor = xurand();
1616 tiki->t1 = factor * 0.5f + 0.9f;
1617
1618 if ((xrand() & 7) == 0)
1619 {
1620 tiki->t1 = 0.2f;

Callers

nothing calls this directly

Calls 7

xurandFunction · 0.85
xrandFunction · 0.85
xVec3CopyFunction · 0.85
GetOwnerMethod · 0.80
SndPlayRandomMethod · 0.80
zLightningAddFunction · 0.70
xParEmitterEmitCustomFunction · 0.50

Tested by

no test coverage detected