summaryrefslogtreecommitdiff
path: root/src/manager/destructibleTileObserveManager.c
blob: 89a0ac365e8d6edece69e6206f485c6ef6e31497 (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
/**
 * @file destructibleTileObserveManager.c
 * @ingroup Managers
 *
 * @brief Sets a flag when a tile changes, e.g. to remember that grass has been cut.
 */
#include "manager/destructibleTileObserveManager.h"
#include "asm.h"
#include "flags.h"
#include "room.h"

void sub_0805CFF0(DestructibleTileObserveManager_unk*);

void DestructibleTileObserveManager_Main(DestructibleTileObserveManager* this) {
    DestructibleTileObserveManager_unk* data;

    if (super->action == 0) {
        super->action++;
    }
    data = (DestructibleTileObserveManager_unk*)GetCurrentRoomProperty(3);
    if (data != NULL) {
        for (; data->field_0x0 != 0; data = data + 1) {
            if (data->field_0x0 == 10) {
                sub_0805CFF0(data);
            }
        }
    }
}

void sub_0805CFF0(DestructibleTileObserveManager_unk* param_1) {
    if (!CheckLocalFlag(param_1->flag)) {
        u32 tileType = GetTileTypeAtTilePos(param_1->tilePos, param_1->tileLayer);
        if (param_1->tileType == tileType) {
            SetLocalFlag(param_1->flag);
        }
    }
}