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

Function zPendulum_Reset

src/SB/Game/zPendulum.cpp:53–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53void zPendulum_Reset(_zPendulum* pend, xScene* sc)
54{
55 zEntReset((zEnt*)pend);
56 xEntMotionInit(&pend->motion, (xEnt*)pend, (xEntMotionAsset*)(pend->asset + 1));
57 xEntMotionReset(&pend->motion, sc);
58
59 xEntMotionAsset* asset = pend->motion.asset;
60 pend->lt = 0.0f;
61 pend->q1t = 1.0f - (asset->pen.phase / (2.0f * PI));
62 pend->q3t = 0.5f - (asset->pen.phase / (2.0f * PI));
63 if (pend->q1t <= 0.0f)
64 {
65 pend->q1t += 1.0f;
66 }
67 if (pend->q1t > 1.0f)
68 {
69 pend->q1t -= 1.0f;
70 }
71 if (pend->q3t <= 0.0f)
72 {
73 pend->q3t += 1.0f;
74 }
75 if (pend->q3t > 1.0f)
76 {
77 pend->q3t -= 1.0f;
78 }
79
80 pend->q1t *= asset->pen.period;
81 pend->q3t *= asset->pen.period;
82}
83
84void zPendulum_Update(_zPendulum* pend, xScene* sc, F32 dt)
85{

Callers 3

zPendulumEventCBFunction · 0.70
zSceneResetFunction · 0.70
zSceneSetupFunction · 0.70

Calls 3

zEntResetFunction · 0.70
xEntMotionInitFunction · 0.50
xEntMotionResetFunction · 0.50

Tested by

no test coverage detected