summaryrefslogtreecommitdiff
path: root/src/object/specialChest.c
blob: f2fbc8ae0288a144a778d64a7d490a477b043345 (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
/**
 * @file specialChest.c
 * @ingroup Objects
 *
 * @brief Special Chest object
 */
#include "entity.h"
#include "flags.h"
#include "player.h"
#include "room.h"

extern void AddInteractableChest(Entity*);
extern void OpenSmallChest(u32 pos, u32 layer);

void SpecialChest(Entity* this) {
    if (this->action == 0) {
        if (CheckLocalFlag(this->type)) {
            DeleteThisEntity();
        }
        this->action = 1;
        this->collisionLayer = 1;
        AddInteractableChest(this);
    }
    if (this->interactType != INTERACTION_NONE) {
        OpenSmallChest(COORD_TO_TILE(this), 2);
        DeleteThisEntity();
    }
}