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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
#include "global.h"
#include "dungeon_util_1.h"
#include "constants/direction.h"
#include "dungeon_global_data.h"
#include "dungeon_util.h"
#include "random.h"
extern void sub_806CE68(struct DungeonEntity *, s32);
extern s32 sub_803F994(void);
extern s32 sub_803F9B0(void);
extern void sub_803F4A0(u32);
extern void sub_803F878(s32, s32);
extern void sub_803E46C(u32);
void sub_8085860(s32 x, s32 y)
{
sub_803F4A0(0);
sub_803F878(x * 0x1800 + 0xc00, y * 0x1800 + 0x1000);
}
void sub_8085890(s32 x, s32 y)
{
sub_803F4A0(0);
sub_803F878(x, y);
}
void sub_80858AC(s32 *param_1, s32 param_2)
{
s32 iVar1;
s32 iVar2;
s32 iVar3;
s32 iVar4;
iVar1 = sub_803F994();
iVar2 = sub_803F9B0();
iVar3 = (param_1[0] - iVar1) / param_2;
iVar4 = (param_1[1] - iVar2) / param_2;
sub_803F4A0(0);
if (0 < param_2) {
do {
iVar1 += iVar3;
iVar2 += iVar4;
sub_803F878(iVar1,iVar2);
sub_803E46C(0x46);
param_2--;
} while (param_2 != 0);
}
sub_803F878(param_1[0],param_1[1]);
sub_803E46C(0x46);
}
void SetFacingDirection(struct DungeonEntity *pokemon, s32 direction)
{
pokemon->entityData->action.facingDir = direction & DIRECTION_MASK;
sub_806CE68(pokemon, direction);
}
void sub_8085930(s32 direction)
{
s32 iVar2;
struct DungeonEntity *entity;
for(iVar2 = 0; iVar2 < MAX_TEAM_MEMBERS; iVar2++)
{
entity = gDungeonGlobalData->teamPokemon[iVar2];
if(EntityExists(entity))
{
if(direction >= NUM_DIRECTIONS)
{
sub_806CE68(entity, RandomCapped(NUM_DIRECTIONS));
}
else
{
entity->entityData->action.facingDir = direction & DIRECTION_MASK;
sub_806CE68(entity, direction);
}
}
}
for(iVar2 = 0; iVar2 < DUNGEON_MAX_WILD_POKEMON; iVar2++)
{
entity = gDungeonGlobalData->wildPokemon[iVar2];
if(EntityExists(entity))
{
if(entity->entityData->clientType == 2)
{
if(direction >= NUM_DIRECTIONS)
{
sub_806CE68(entity, RandomCapped(NUM_DIRECTIONS));
}
else
{
entity->entityData->action.facingDir = direction & DIRECTION_MASK;
sub_806CE68(entity, direction);
}
}
}
}
}
void sub_80859F0(s32 direction)
{
s32 iVar2;
struct DungeonEntity *entity;
for(iVar2 = 0; iVar2 < DUNGEON_MAX_WILD_POKEMON; iVar2++)
{
entity = gDungeonGlobalData->wildPokemon[iVar2];
if(EntityExists(entity))
{
if(direction >= NUM_DIRECTIONS)
{
sub_806CE68(entity, RandomCapped(NUM_DIRECTIONS));
}
else
{
entity->entityData->action.facingDir = direction & DIRECTION_MASK;
sub_806CE68(entity, direction);
}
}
}
}
bool8 IsMovingClient(struct DungeonEntity *pokemon)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
switch (pokemonData->clientType)
{
case CLIENT_TYPE_CLIENT:
case 0x3:
case 0x5:
case 0x6:
case 0x7:
case 0x8:
case 0x9:
case 0xD:
case 0xE:
case 0xF:
case 0x10:
case 0x11:
case 0x12:
case 0x13:
case 0x14:
case 0x15:
case 0x16:
case 0x17:
case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
case 0x20:
case 0x21:
case 0x22:
case 0x23:
case 0x24:
return TRUE;
case CLIENT_TYPE_NONE:
case 0x2:
case CLIENT_TYPE_DONT_MOVE:
case 0xA:
case 0xB:
case 0xC:
default:
return FALSE;
}
}
|