summaryrefslogtreecommitdiff
path: root/src/npc/clothesRack.c
blob: 83f463dbff8808d6b09b2ee3650629348328d867 (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
/**
 * @file clothesRack.c
 * @ingroup NPCs
 *
 * @brief Clothes Rack NPC
 */
#include "npc.h"
#include "tiles.h"
#include "room.h"
#include "flags.h"
#include "asm.h"

void sub_0806DD90(Entity*);
void sub_0806DEC8(Entity*);

void ClothesRack(Entity* this) {
    static void (*const actionFuncs[])(Entity*) = {
        sub_0806DD90,
        sub_0806DEC8,
    };
    actionFuncs[this->action](this);
}

void sub_0806DD90(Entity* this) {
    u32 animIndex;
    u32 x;
    u32 y;

    this->action = 1;
    animIndex = 0;
    if (CheckGlobalFlag(DRUG_1)) {
        animIndex = 1;
    }
    if (CheckGlobalFlag(DRUG_2)) {
        animIndex = 2;
    }
    if (CheckGlobalFlag(DRUG_3)) {
        animIndex = 3;
    }
    InitializeAnimation(this, animIndex);
    x = this->x.HALF.HI;
    y = this->y.HALF.HI;
    SetTile(SPECIAL_TILE_114, TILE(x - 24, y - 16), this->collisionLayer);
    SetTile(SPECIAL_TILE_114, TILE(x - 24, y), this->collisionLayer);
    SetTile(SPECIAL_TILE_114, TILE(x - 24, y + 16), this->collisionLayer);
    SetTile(SPECIAL_TILE_114, TILE(x + 24, y - 16), this->collisionLayer);
    SetTile(SPECIAL_TILE_114, TILE(x + 24, y), this->collisionLayer);
    SetTile(SPECIAL_TILE_114, TILE(x + 24, y + 16), this->collisionLayer);
}

void sub_0806DEC8(Entity* this) {
    GetNextFrame(this);
}