summaryrefslogtreecommitdiff
path: root/src/actors/yoshi_egg/update.inc.c
blob: f874091b8a070acf9c4bc22537b78fd5b2adc44a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <racing/actors.h>

/**
 * @brief Updates the Yoshi egg actor.
 *
 * @param egg
 */
void update_actor_yoshi_egg(struct YoshiValleyEgg* egg) {
    egg->pathRot += 0x5B;
    egg->pos[0] = egg->pathCenter[0] + (sins(egg->pathRot) * egg->pathRadius);
    egg->pos[2] = egg->pathCenter[2] + (coss(egg->pathRot) * egg->pathRadius);
    if ((egg->flags & 0x400) != 0) {
        egg->pathCenter[1] -= 0.12;
        if (egg->pathCenter[1] < -3.0f) {
            egg->pathCenter[1] = -3.0f;
        }
        egg->pos[1] += egg->pathCenter[1];
        if (egg->pos[1] < 0.0f) {
            egg->pos[1] = 0.0f;
            egg->pathCenter[1] = 0.0f;
            egg->flags &= ~(1 << 10);
        }
        egg->eggRot -= 0x4FA;
    }
    egg->eggRot -= 0x222;
}