summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnonymousRandomPerson <chenghanngan.us@gmail.com>2022-01-20 18:12:17 -0500
committerAnonymousRandomPerson <chenghanngan.us@gmail.com>2022-01-20 18:12:17 -0500
commitc5cd6e137fbad180a21ec24a50fde76633db0c20 (patch)
tree38953616b74da130bd832635bed1c605d4b0e322
parent74d89a6fe4615b4c463852e98c2ea43bb1f6bf00 (diff)
Decomped IsSleeping()
-Function provided by SethBarberee.
-rw-r--r--asm/code_8070B48.s (renamed from asm/code_8070B28.s)21
-rw-r--r--include/status_checks_1.h2
-rwxr-xr-xld_script.txt2
-rw-r--r--src/status_checks_1.c11
4 files changed, 14 insertions, 22 deletions
diff --git a/asm/code_8070B28.s b/asm/code_8070B48.s
index 65b82a2..c0b90dc 100644
--- a/asm/code_8070B28.s
+++ b/asm/code_8070B48.s
@@ -5,27 +5,6 @@
.text
- thumb_func_start IsSleeping
-IsSleeping:
- push {lr}
- ldr r0, [r0, 0x70]
- adds r0, 0xA8
- ldrb r0, [r0]
- cmp r0, 0x1
- beq _08070B40
- cmp r0, 0x5
- beq _08070B40
- cmp r0, 0x3
- beq _08070B40
- movs r0, 0
- b _08070B42
-_08070B40:
- movs r0, 0x1
-_08070B42:
- pop {r1}
- bx r1
- thumb_func_end IsSleeping
-
thumb_func_start HasQuarterHPOrLess
HasQuarterHPOrLess:
push {lr}
diff --git a/include/status_checks_1.h b/include/status_checks_1.h
index 770767a..486adb2 100644
--- a/include/status_checks_1.h
+++ b/include/status_checks_1.h
@@ -5,5 +5,7 @@
// 0x70A58
bool8 HasNegativeStatus(struct DungeonEntity *pokemon);
+// 0x70B28
+bool8 IsSleeping(struct DungeonEntity *pokemon);
#endif
diff --git a/ld_script.txt b/ld_script.txt
index 8bf1b5c..23ea939 100755
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -210,7 +210,7 @@ SECTIONS {
src/status_checks.o(.text);
asm/code_80701A4.o(.text);
src/status_checks_1.o(.text);
- asm/code_8070B28.o(.text);
+ asm/code_8070B48.o(.text);
src/dungeon_capabilities.o(.text);
asm/code_8070BC0.o(.text);
src/dungeon_capabilities_1.o(.text);
diff --git a/src/status_checks_1.c b/src/status_checks_1.c
index 32ed6bf..9d0bfe8 100644
--- a/src/status_checks_1.c
+++ b/src/status_checks_1.c
@@ -42,3 +42,14 @@ bool8 HasNegativeStatus(struct DungeonEntity *pokemon)
}
return FALSE;
}
+
+bool8 IsSleeping(struct DungeonEntity *pokemon)
+{
+ if (pokemon->entityData->sleepStatus != SLEEP_STATUS_SLEEP &&
+ pokemon->entityData->sleepStatus != SLEEP_STATUS_NAPPING &&
+ pokemon->entityData->sleepStatus != SLEEP_STATUS_NIGHTMARE)
+ {
+ return FALSE;
+ }
+ return TRUE;
+}