diff options
author | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2022-02-28 21:04:40 -0500 |
---|---|---|
committer | AnonymousRandomPerson <chenghanngan.us@gmail.com> | 2022-03-10 22:32:17 -0500 |
commit | 07285e7e82db008b1f322879f3b22c8eb437a8de (patch) | |
tree | 505c70dab18c81a2320ca378ff2ef5101ef8dec7 | |
parent | 91c0a142ccf4783c65aecdd75a4faed33edf3ed6 (diff) |
Decomped HasDisabledMove()
-rw-r--r-- | asm/code_805D850.s (renamed from asm/code_805D810.s) | 40 | ||||
-rw-r--r-- | include/status_checker.h | 2 | ||||
-rwxr-xr-x | ld_script.txt | 2 | ||||
-rw-r--r-- | src/status_checker.c | 18 |
4 files changed, 20 insertions, 42 deletions
diff --git a/asm/code_805D810.s b/asm/code_805D850.s index 3630c29..be2ae85 100644 --- a/asm/code_805D810.s +++ b/asm/code_805D850.s @@ -5,46 +5,6 @@ .text - thumb_func_start HasDisabledMove -HasDisabledMove: - push {r4-r6,lr} - adds r4, r0, 0 - movs r3, 0 - movs r6, 0x1 - movs r5, 0x20 - adds r2, r4, 0 -_0805D81C: - ldrb r1, [r2] - adds r0, r6, 0 - ands r0, r1 - cmp r0, 0 - beq _0805D82E - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - bne _0805D848 -_0805D82E: - adds r2, 0x8 - adds r3, 0x1 - cmp r3, 0x3 - ble _0805D81C - adds r0, r4, 0 - adds r0, 0x20 - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - bne _0805D848 - movs r0, 0 - b _0805D84A -_0805D848: - movs r0, 0x1 -_0805D84A: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end HasDisabledMove - thumb_func_start LastMoveOutOfPP LastMoveOutOfPP: push {r4,r5,lr} diff --git a/include/status_checker.h b/include/status_checker.h index 4538af1..92fa443 100644 --- a/include/status_checker.h +++ b/include/status_checker.h @@ -8,5 +8,7 @@ bool8 CanUseOnSelfWithStatusChecker(struct DungeonEntity *pokemon, struct PokemonMove *move); // 0x5CEB8 bool8 CanUseOnTargetWithStatusChecker(struct DungeonEntity *user, struct DungeonEntity *target, struct PokemonMove *move); +// 0x5D810 +bool8 HasDisabledMove(struct PokemonMove *moves); #endif diff --git a/ld_script.txt b/ld_script.txt index 4cbde6b..64d8d9b 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -211,7 +211,7 @@ SECTIONS { src/code_8057824.o(.text); asm/code_8057824.o(.text); src/status_checker.o(.text); - asm/code_805D810.o(.text); + asm/code_805D850.o(.text); src/status_checker_1.o(.text); asm/code_805D8C8.o(.text); src/targeting.o(.text); diff --git a/src/status_checker.c b/src/status_checker.c index de1bd65..e835acf 100644 --- a/src/status_checker.c +++ b/src/status_checker.c @@ -99,7 +99,6 @@ const u8 gDungeonCamouflageTypes[76] = { TYPE_ROCK }; -extern bool8 HasDisabledMove(struct PokemonMove *moves); extern bool8 LastMoveOutOfPP(struct PokemonMove *moves); bool8 CanUseOnSelfWithStatusChecker(struct DungeonEntity *pokemon, struct PokemonMove *move) @@ -903,3 +902,20 @@ bool8 CanUseOnTargetWithStatusChecker(struct DungeonEntity *user, struct Dungeon } return TRUE; } + +bool8 HasDisabledMove(struct PokemonMove *moves) +{ + s32 i; + for (i = 0; i < MAX_MON_MOVES; i++) + { + if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].moveFlags & MOVE_FLAG_DISABLED) + { + return TRUE; + } + } + if (moves[STRUGGLE_MOVE_INDEX].moveFlags & MOVE_FLAG_DISABLED) + { + return TRUE; + } + return FALSE; +} |