diff options
-rw-r--r-- | asm/code_8070B48.s | 33 | ||||
-rw-r--r-- | include/status_checks_1.h | 2 | ||||
-rwxr-xr-x | ld_script.txt | 1 | ||||
-rw-r--r-- | src/status_checker.c | 1 | ||||
-rw-r--r-- | src/status_checks_1.c | 16 |
5 files changed, 18 insertions, 35 deletions
diff --git a/asm/code_8070B48.s b/asm/code_8070B48.s deleted file mode 100644 index c0b90dc..0000000 --- a/asm/code_8070B48.s +++ /dev/null @@ -1,33 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start HasQuarterHPOrLess -HasQuarterHPOrLess: - push {lr} - ldr r0, [r0, 0x70] - adds r1, r0, 0 - movs r2, 0x10 - ldrsh r0, [r1, r2] - cmp r0, 0 - bge _08070B58 - adds r0, 0x3 -_08070B58: - movs r2, 0xE - ldrsh r1, [r1, r2] - asrs r0, 2 - cmp r1, r0 - ble _08070B66 - movs r0, 0 - b _08070B68 -_08070B66: - movs r0, 0x1 -_08070B68: - pop {r1} - bx r1 - thumb_func_end HasQuarterHPOrLess - - .align 2, 0 diff --git a/include/status_checks_1.h b/include/status_checks_1.h index 486adb2..a90bdb0 100644 --- a/include/status_checks_1.h +++ b/include/status_checks_1.h @@ -7,5 +7,7 @@ bool8 HasNegativeStatus(struct DungeonEntity *pokemon); // 0x70B28 bool8 IsSleeping(struct DungeonEntity *pokemon); +// 0x70B48 +bool8 HasQuarterHPOrLess(struct DungeonEntity* pokemon); #endif diff --git a/ld_script.txt b/ld_script.txt index 34055c6..7d0298a 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -218,7 +218,6 @@ SECTIONS { src/dungeon_movement.o(.text); asm/code_807034C.o(.text); src/status_checks_1.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_checker.c b/src/status_checker.c index 6f521f1..e0bf251 100644 --- a/src/status_checker.c +++ b/src/status_checker.c @@ -95,7 +95,6 @@ const u8 gDungeonCamouflageTypes[76] = { TYPE_ROCK }; -extern bool8 HasQuarterHPOrLess(struct DungeonEntity*); extern bool8 IsTileGround(struct MapTile*); extern bool8 CanLayTrap(struct Position*); diff --git a/src/status_checks_1.c b/src/status_checks_1.c index 9d0bfe8..c49e127 100644 --- a/src/status_checks_1.c +++ b/src/status_checks_1.c @@ -53,3 +53,19 @@ bool8 IsSleeping(struct DungeonEntity *pokemon) } return TRUE; } + +bool8 HasQuarterHPOrLess(struct DungeonEntity* pokemon) +{ + struct DungeonEntityData *pokemonData = pokemon->entityData; + struct DungeonEntityData *pokemonData2 = pokemon->entityData; + s32 maxHP = pokemonData->maxHP; + if (maxHP < 0) + { + maxHP += 3; + } + if (pokemonData2->HP <= maxHP >> 2) + { + return TRUE; + } + return FALSE; +} |