summaryrefslogtreecommitdiff
path: root/src/object/giantLeaf.c
blob: 3ef82f757f1b578383954db42145cb4096a5ec19 (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
/**
 * @file giantLeaf.c
 * @ingroup Objects
 *
 * @brief Giant Leaf object
 */
#include "object.h"

void sub_0808D618(Entity* this);

void GiantLeaf(Entity* this) {
    if (this->action == 0) {
        this->action = 1;
        this->spriteSettings.draw = 1;
        this->spriteRendering.b3 = 3;
        this->spritePriority.b0 = 7;
        this->frameIndex = this->type;
        sub_0808D618(this);
    }
}

void sub_0808D618(Entity* this) {
    static const s16 gUnk_08121750[] = {
        0x41, 0x40, 0x3f, 0x3e, 0x1, 0x0, -0x1, -0x2, -0x3e, -0x3f, -0x40, -0x41, -0x7e,
    };
    static const s16 gUnk_0812176A[] = {
        0x3f, 0x40, 0x41, 0x42, -0x1, 0x0, 0x1, 0x2, -0x42, -0x41, -0x40, -0x3f, -0x82,
    };
    u32 tilePos;
    const s16* arr;
    u32 i;

    arr = (this->type != 0) ? gUnk_0812176A : gUnk_08121750;
    tilePos = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) |
              ((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) * 64);

    for (i = 0; i < 13; i++) {
        SetBottomTile(16500, tilePos + arr[i], 1);
    }
}