summaryrefslogtreecommitdiff
path: root/src/dungeon_util.c
blob: 1d443c0a6a439b63259b616fb9f95d0f52df5d95 (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
54
55
56
57
58
59
60
61
62
63
64
#include "global.h"
#include "dungeon_util.h"

#include "dungeon_map_access.h"

const struct Position gAdjacentTileOffsets[] = {
    {0, 1},
    {1, 1},
    {1, 0},
    {1, -1},
    {0, -1},
    {-1, -1},
    {-1, 0},
    {-1, 1}
};

bool8 EntityExists(struct DungeonEntity *entity)
{
    if (!entity)
    {
        return FALSE;
    }
    return entity->entityType != ENTITY_NONE;
}

u32 GetEntityType(struct DungeonEntity *entity)
{
    return entity->entityType;
}

u8 GetEntityRoomIndex(struct DungeonEntity *entity)
{
    return entity->roomIndex;
}

struct DungeonEntityData* GetTrapData(struct DungeonEntity *entity)
{
    return entity->entityData;
}

struct ItemSlot* GetItemData(struct DungeonEntity *entity)
{
    return (struct ItemSlot *)entity->entityData;
}

struct DungeonEntityData* sub_804510C(struct DungeonEntity *entity)
{
    return entity->entityData;
}

struct DungeonEntityData* sub_8045110(struct DungeonEntity *entity)
{
    return entity->entityData;
}

struct MapTile* GetMapTileForDungeonEntity_1(struct DungeonEntity *entity)
{
    return GetMapTile_1(entity->posWorld.x, entity->posWorld.y);
}

struct MapTile* GetMapTileForDungeonEntity_2(struct DungeonEntity *entity)
{
    return GetMapTile_2(entity->posWorld.x, entity->posWorld.y);
}