summaryrefslogtreecommitdiff
path: root/src/actors/item_box/update.inc.c
blob: 855e8707155351211bdc047ac973e9611e903544 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <racing/actors.h>

/**
 * @brief Updates the item box under the hot air balloon object.
 * It used in Luigi Raceway.
 * (here it's just update the rotation of the item box not the position, for the position it's in object)
 *
 * @param itemBox
 */
void update_actor_item_box_hot_air_balloon(struct ItemBox* itemBox) {
    switch (itemBox->state) {
        case 5:
            itemBox->rot[0] += 0xB6;
            itemBox->rot[1] -= 0x16C;
            itemBox->rot[2] += 0xB6;
            break;
        case 3:
            if (itemBox->someTimer == 0x14) {
                itemBox->state = 5;
                itemBox->flags = -0x4000;
            } else {
                itemBox->someTimer++;
                itemBox->rot[0] += 0x444;
                itemBox->rot[1] -= 0x2D8;
                itemBox->rot[2] += 0x16C;
            }
            break;
    }
}

/**
 * @brief Updates the item box actor.
 *
 * @param itemBox
 */
void update_actor_item_box(struct ItemBox* itemBox) {
    switch (itemBox->state) {
        case 0:
            itemBox->state = 1;
            break;
        case 1:
            if ((itemBox->pos[1] - itemBox->origY) < 8.66f) {
                itemBox->pos[1] += 0.45f;
            } else {
                itemBox->pos[1] = itemBox->origY + 8.66f;
                itemBox->state = 2;
                itemBox->flags = 0xC000;
            }
            break;
        case 2:
            itemBox->rot[0] += 0xB6;
            itemBox->rot[1] -= 0x16C;
            itemBox->rot[2] += 0xB6;
            break;
        case 3:
            if (itemBox->someTimer == 20) {
                itemBox->state = 0;
                itemBox->pos[1] = itemBox->resetDistance - 20.0f;
                itemBox->flags = 0xC000;
            } else {
                itemBox->someTimer++;
                itemBox->rot[0] += 0x444;
                itemBox->rot[1] -= 0x2D8;
                itemBox->rot[2] += 0x16C;
            }
            break;
    }
}