summaryrefslogtreecommitdiff
path: root/src/manager/flameManager.c
blob: e7535e63863094d84c3ba5789ddaff961c951d42 (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
/**
 * @file flameManager.c
 * @ingroup Managers
 *
 * @brief Manages flame that can be ignited with the lamp.
 *
 * However, this manager is deleted when the flame is ignited the first time.
 */
#include "manager/flameManager.h"
#include "asm.h"
#include "room.h"
#include "tiles.h"
#include "player.h"
#include "map.h"

void FlameManager_Main(FlameManager* this) {
    if (super->action == 0) {
        this->x = TILE(this->x, this->y);
        if (GetTileTypeAtTilePos(this->x, LAYER_TOP) == TILE_TYPE_117) {
            super->action = 1;
            SetTile(SPECIAL_TILE_106, this->x, LAYER_BOTTOM);
        } else {
            DeleteThisEntity();
        }
    }
    if (GetTileTypeAtTilePos(this->x, LAYER_BOTTOM) == SPECIAL_TILE_107) {
        sub_0807B7D8(TILE_TYPE_118, this->x, LAYER_TOP);
        DeleteThisEntity();
    }
    if (GetTileTypeAtTilePos(this->x, LAYER_TOP) == TILE_TYPE_118) {
        SetTile(SPECIAL_TILE_107, this->x, LAYER_BOTTOM);
        DeleteThisEntity();
    }
}