summaryrefslogtreecommitdiff
path: root/src/code_806CD90.c
blob: d3267a90a8a6fbf20880b49c666c2789a670beab (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "global.h"
#include "constants/direction.h"
#include "dungeon_entity.h"
#include "dungeon_global_data.h"
#include "dungeon_util.h"

extern u8 sub_806CEBC(struct DungeonEntity *);
extern void sub_806CCB4(struct DungeonEntity *, u8);

void sub_806CD90(void)
{
    s32 iVar3;
    struct DungeonEntity *iVar2;
    for(iVar3 = 0; iVar3 < DUNGEON_MAX_POKEMON; iVar3++)
    {
        iVar2 = gDungeonGlobalData->allPokemon[iVar3];
        if(EntityExists(iVar2))
            sub_806CCB4(iVar2, sub_806CEBC(iVar2));
    }
}

void sub_806CDD4(struct DungeonEntity *r0, u8 r1, u32 r2)
{
    if(GetEntityType(r0) == ENTITY_POKEMON)
    {
        r0->unk6A = r1;
        if(r2 < NUM_DIRECTIONS) r0->facingDir = r2;
    }
}

void sub_806CDFC(struct DungeonEntity *r0, u8 r1, u32 r2)
{
    if(GetEntityType(r0) == ENTITY_POKEMON)
    {
        if(r0->unk6B == r1)
        {
            if(r0->facingDir2 == r2)
                return;
            else
                goto change_dir;
        }
        else
        {
change_dir:
            sub_806CDD4(r0, r1, r2);
        }
    }
}

void sub_806CE34(struct DungeonEntity *r0, u32 newDir)
{
    if(GetEntityType(r0) == ENTITY_POKEMON)
    {
        r0->unk6A = sub_806CEBC(r0);
        if(newDir < NUM_DIRECTIONS)
        {
            r0->entityData->action.facingDir = newDir & DIRECTION_MASK;
            r0->facingDir = newDir & DIRECTION_MASK;
        }
    }
}

void sub_806CE68(struct DungeonEntity *r0, u32 newDir)
{
    if(GetEntityType(r0) == ENTITY_POKEMON)
    {
        r0->unk6A = sub_806CEBC(r0);
        if(newDir < NUM_DIRECTIONS)
        {
            r0->facingDir = newDir;
        }
    }
}

void sub_806CE94(struct DungeonEntity *r0, u32 newDir)
{
    if(GetEntityType(r0) == ENTITY_POKEMON)
    {
        r0->unk6A = 6;
        if(newDir < NUM_DIRECTIONS)
        {
            r0->facingDir = newDir;
        }
    }
}