summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCheng Hann Gan <chenghanngan.us@gmail.com>2021-10-15 18:30:33 -0400
committerGitHub <noreply@github.com>2021-10-15 15:30:33 -0700
commit3f7ee3a806d965fae70fd98f2cd1af13a2e4cf0b (patch)
treed8edbe0b291c2771dd3cf0c52fb088d303a03d2c /src
parent18726d97cfe82c38a4809ca1fb4fd4aeda7a7ee1 (diff)
Decomped entityExists() (#64)
Diffstat (limited to 'src')
-rw-r--r--src/code_80521D0_1.c4
-rw-r--r--src/code_8057824_1.c4
-rw-r--r--src/dungeon_engine.c11
3 files changed, 15 insertions, 4 deletions
diff --git a/src/code_80521D0_1.c b/src/code_80521D0_1.c
index fa1c79e..b29dc9a 100644
--- a/src/code_80521D0_1.c
+++ b/src/code_80521D0_1.c
@@ -94,7 +94,7 @@ extern void sub_8085918(struct DungeonEntity *, u32);
extern void sub_806CE68(struct DungeonEntity *r0, u32);
extern void sub_8052910(u32 *);
extern void sub_803E708(u32, u32);
-extern u8 sub_80450E0(struct DungeonEntity *);
+extern u8 entityExists(struct DungeonEntity *);
extern u8 HasRecruitedMon(u32);
extern u8 sub_806FD18(struct DungeonEntity *);
extern u8 sub_8083E74(u32);
@@ -1102,7 +1102,7 @@ void sub_808C948(struct DungeonEntity *param_1, u8 param_2)
flag = FALSE;
for(iVar3 = 0; iVar3 < 0x10; iVar3++){
iVar2 = gDungeonGlobalData->wildPokemon[iVar3];
- if ((iVar2 != param_1) && (sub_80450E0(iVar2) != 0)) {
+ if ((iVar2 != param_1) && (entityExists(iVar2) != 0)) {
flag = TRUE;
break;
}
diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c
index ec518d7..3426921 100644
--- a/src/code_8057824_1.c
+++ b/src/code_8057824_1.c
@@ -313,7 +313,7 @@ void sub_808919C();
void sub_8088D30(void);
extern void sub_8083F14();
-extern u8 sub_80450E0(struct DungeonEntity *);
+extern u8 entityExists(struct DungeonEntity *);
extern u8 sub_8086AE4(u32);
@@ -1985,7 +1985,7 @@ void sub_8089788(struct DungeonEntity *param_1, u8 param_2, s32 param_3)
for(iVar3 = 0; iVar3 < 0x10; iVar3++)
{
iVar2 = gDungeonGlobalData->wildPokemon[iVar3];
- if ((sub_80450E0(iVar2) != '\0') && (iVar2 != param_1) && (iVar2->entityData->clientFlags == param_2)) {
+ if ((entityExists(iVar2) != '\0') && (iVar2 != param_1) && (iVar2->entityData->clientFlags == param_2)) {
return;
}
}
diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c
new file mode 100644
index 0000000..8689b91
--- /dev/null
+++ b/src/dungeon_engine.c
@@ -0,0 +1,11 @@
+#include "global.h"
+#include "dungeon_engine.h"
+
+bool8 entityExists(struct DungeonEntity *entity)
+{
+ if (!entity)
+ {
+ return FALSE;
+ }
+ return entity->entityType != ENTITY_NONE;
+}