| 51 | } |
| 52 | |
| 53 | void 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 | |
| 84 | void zPendulum_Update(_zPendulum* pend, xScene* sc, F32 dt) |
| 85 | { |
no test coverage detected