mirror of
https://github.com/pret/pmd-red.git
synced 2026-07-30 23:36:47 -05:00
Decomped IsMoveUsable()
This commit is contained in:
parent
951b01114a
commit
458001dbbd
|
|
@ -4,78 +4,7 @@
|
|||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start IsMoveUsable
|
||||
IsMoveUsable:
|
||||
push {r4-r6,lr}
|
||||
adds r4, r1, 0
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
ldr r6, [r0, 0x70]
|
||||
ldrh r1, [r4, 0x2]
|
||||
ldr r0, _08057430
|
||||
cmp r1, r0
|
||||
beq _08057442
|
||||
ldrb r1, [r4]
|
||||
movs r0, 0x20
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0805743E
|
||||
ldrb r1, [r4, 0x1]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0805743E
|
||||
cmp r2, 0
|
||||
beq _08057442
|
||||
ldrb r0, [r4, 0x4]
|
||||
cmp r0, 0
|
||||
beq _0805743E
|
||||
adds r0, r6, 0
|
||||
adds r0, 0xBC
|
||||
ldrb r1, [r0]
|
||||
adds r5, r0, 0
|
||||
cmp r1, 0x5
|
||||
bne _08057414
|
||||
adds r0, r4, 0
|
||||
bl MoveDealsDirectDamage
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805743E
|
||||
_08057414:
|
||||
ldrb r0, [r5]
|
||||
cmp r0, 0x6
|
||||
bne _08057442
|
||||
ldrh r1, [r4, 0x2]
|
||||
movs r0, 0xB0
|
||||
lsls r0, 1
|
||||
cmp r1, r0
|
||||
bne _08057434
|
||||
movs r1, 0x9C
|
||||
lsls r1, 1
|
||||
adds r0, r6, r1
|
||||
ldrb r1, [r0]
|
||||
b _08057436
|
||||
.align 2, 0
|
||||
_08057430: .4byte 0x00000163
|
||||
_08057434:
|
||||
ldrb r1, [r4]
|
||||
_08057436:
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08057442
|
||||
_0805743E:
|
||||
movs r0, 0
|
||||
b _08057444
|
||||
_08057442:
|
||||
movs r0, 0x1
|
||||
_08057444:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end IsMoveUsable
|
||||
|
||||
|
||||
thumb_func_start sub_805744C
|
||||
sub_805744C:
|
||||
push {r4-r6,lr}
|
||||
|
|
@ -4,5 +4,6 @@
|
|||
#include "dungeon_entity.h"
|
||||
|
||||
bool8 IsMoveIndexUsable(struct DungeonEntity *pokemon, s32 moveIndex, bool8 hasPPChecker);
|
||||
bool8 IsMoveUsable(struct DungeonEntity *pokemon, struct PokemonMove *move, bool8 hasPPChecker);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ s32 GetMoveAccuracy(struct PokemonMove *move, u32 accuracyType);
|
|||
u32 GetMoveMaxPP(struct PokemonMove *move);
|
||||
u8 GetMoveUnk12(struct PokemonMove *move);
|
||||
u8 GetMoveCriticalHitChance(struct PokemonMove *move);
|
||||
u8 MoveCannotHitFrozen(struct PokemonMove *move);
|
||||
u8 MoveDealsDirectDamage(struct PokemonMove *move);
|
||||
bool8 MoveCannotHitFrozen(struct PokemonMove *move);
|
||||
bool8 MoveDealsDirectDamage(struct PokemonMove *move);
|
||||
u32 GetMoveRangeType(struct PokemonMove *move);
|
||||
void sub_8092C84(u8 *buffer, u16 moveID);
|
||||
u8 *GetMoveUseText(u16 moveID);
|
||||
u8 GetMoveAffectedByMagicCoat(u16 moveID);
|
||||
u8 GetMoveTargetsUser(u16 moveID);
|
||||
u8 GetMoveAffectedByMuzzled(u16 moveID);
|
||||
bool8 GetMoveAffectedByMagicCoat(u16 moveID);
|
||||
bool8 GetMoveTargetsUser(u16 moveID);
|
||||
bool8 GetMoveAffectedByMuzzled(u16 moveID);
|
||||
bool8 IsBlockedBySoundproof(struct PokemonMove *move);
|
||||
bool8 DoesMoveCharge(u16 move);
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ SECTIONS {
|
|||
src/charge_move.o(.text);
|
||||
asm/code_8057144.o(.text);
|
||||
src/move_util.o(.text);
|
||||
asm/code_80573CC.o(.text);
|
||||
asm/code_805744C.o(.text);
|
||||
src/code_8057824.o(.text);
|
||||
asm/code_8057824.o(.text);
|
||||
src/status_checker.o(.text);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#include "global.h"
|
||||
#include "move_util.h"
|
||||
|
||||
extern bool8 IsMoveUsable(struct DungeonEntity *pokemon, struct PokemonMove *move, bool8 hasPPChecker);
|
||||
#include "constants/move_id.h"
|
||||
#include "constants/status.h"
|
||||
#include "moves.h"
|
||||
|
||||
bool8 IsMoveIndexUsable(struct DungeonEntity *pokemon, s32 moveIndex, bool8 hasPPChecker)
|
||||
{
|
||||
|
|
@ -45,3 +47,42 @@ bool8 IsMoveIndexUsable(struct DungeonEntity *pokemon, s32 moveIndex, bool8 hasP
|
|||
}
|
||||
goto incMoveIndex;
|
||||
}
|
||||
|
||||
bool8 IsMoveUsable(struct DungeonEntity *pokemon, struct PokemonMove *move, bool8 hasPPChecker)
|
||||
{
|
||||
struct DungeonEntityData *pokemonData = pokemon->entityData;
|
||||
if (move->moveID == MOVE_REGULAR_ATTACK)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
if (move->moveFlags & MOVE_FLAG_DISABLED || move->moveFlags2 & MOVE_FLAG_SEALED)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (hasPPChecker)
|
||||
{
|
||||
if (move->PP == 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (pokemonData->volatileStatus == VOLATILE_STATUS_TAUNTED && !MoveDealsDirectDamage(move))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (pokemonData->volatileStatus == VOLATILE_STATUS_ENCORE)
|
||||
{
|
||||
if (move->moveID == MOVE_STRUGGLE)
|
||||
{
|
||||
if (!(pokemonData->struggleMoveFlags & MOVE_FLAG_LAST_USED))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (!(move->moveFlags & MOVE_FLAG_LAST_USED))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,17 +297,17 @@ u8 *GetMoveUseText(u16 moveID)
|
|||
return gMovesData[moveID].useText;
|
||||
}
|
||||
|
||||
u8 GetMoveAffectedByMagicCoat(u16 moveID)
|
||||
bool8 GetMoveAffectedByMagicCoat(u16 moveID)
|
||||
{
|
||||
return gMovesData[moveID].affectedByMagicCoat;
|
||||
}
|
||||
|
||||
u8 GetMoveTargetsUser(u16 moveID)
|
||||
bool8 GetMoveTargetsUser(u16 moveID)
|
||||
{
|
||||
return gMovesData[moveID].targetsUser;
|
||||
}
|
||||
|
||||
u8 GetMoveAffectedByMuzzled(u16 moveID)
|
||||
bool8 GetMoveAffectedByMuzzled(u16 moveID)
|
||||
{
|
||||
return gMovesData[moveID].affectedByMuzzled;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user