Decomped LastUsedMoveOutOfPP()

This commit is contained in:
AnonymousRandomPerson 2022-02-28 21:17:15 -05:00
parent 07285e7e82
commit 70ce2c1642
7 changed files with 39 additions and 80 deletions

View File

@ -1,42 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start LastMoveOutOfPP
LastMoveOutOfPP:
push {r4,r5,lr}
movs r3, 0
movs r5, 0x1
adds r2, r0, 0
movs r4, 0x10
_0805D85A:
ldrb r1, [r2]
adds r0, r5, 0
ands r0, r1
cmp r0, 0
beq _0805D876
adds r0, r4, 0
ands r0, r1
cmp r0, 0
beq _0805D876
ldrb r0, [r2, 0x4]
cmp r0, 0
bne _0805D876
movs r0, 0x1
b _0805D880
_0805D876:
adds r2, 0x8
adds r3, 0x1
cmp r3, 0x3
ble _0805D85A
movs r0, 0
_0805D880:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end LastMoveOutOfPP
.align 2, 0

View File

@ -3,7 +3,7 @@
#define STRUGGLE_MOVE_INDEX 4
enum MoveFlags
enum MoveFlag
{
MOVE_FLAG_EXISTS = 1 << 0,
MOVE_FLAG_LINKED = 1 << 1, // This move is linked with the previous move in the Pokémon's moveset.
@ -13,7 +13,7 @@ enum MoveFlags
MOVE_FLAG_DISABLED = 1 << 5 // Disabled by an effect like Taunt.
};
enum MoveFlags2
enum MoveFlag2
{
MOVE_FLAG_SEALED = 1 << 0,
MOVE_FLAG_TEMPORARY = 1 << 3, // Used for moves copied by Mimic.

View File

@ -10,5 +10,9 @@ bool8 CanUseOnSelfWithStatusChecker(struct DungeonEntity *pokemon, struct Pokemo
bool8 CanUseOnTargetWithStatusChecker(struct DungeonEntity *user, struct DungeonEntity *target, struct PokemonMove *move);
// 0x5D810
bool8 HasDisabledMove(struct PokemonMove *moves);
// 0x5D850
bool8 LastUsedMoveOutOfPP(struct PokemonMove *moves);
// 0x5D888
bool8 HasLastUsedMove(struct PokemonMove *moves);
#endif

View File

@ -1,9 +0,0 @@
#ifndef GUARD_STATUS_CHECKER_1_H
#define GUARD_STATUS_CHECKER_1_H
#include "moves.h"
// 0x5D888
bool8 HasLastUsedMove(struct PokemonMove *moves);
#endif

View File

@ -211,8 +211,6 @@ SECTIONS {
src/code_8057824.o(.text);
asm/code_8057824.o(.text);
src/status_checker.o(.text);
asm/code_805D850.o(.text);
src/status_checker_1.o(.text);
asm/code_805D8C8.o(.text);
src/targeting.o(.text);
asm/code_8069E0C.o(.text);

View File

@ -13,7 +13,6 @@
#include "map.h"
#include "moves.h"
#include "number_util.h"
#include "status_checker_1.h"
#include "status_checks_1.h"
#include "tile_types.h"
#include "trap.h"
@ -99,8 +98,6 @@ const u8 gDungeonCamouflageTypes[76] = {
TYPE_ROCK
};
extern bool8 LastMoveOutOfPP(struct PokemonMove *moves);
bool8 CanUseOnSelfWithStatusChecker(struct DungeonEntity *pokemon, struct PokemonMove *move)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
@ -639,7 +636,7 @@ bool8 CanUseOnTargetWithStatusChecker(struct DungeonEntity *user, struct Dungeon
}
break;
case MOVE_SPITE:
if (LastMoveOutOfPP(targetData->moves))
if (LastUsedMoveOutOfPP(targetData->moves))
{
return FALSE;
}
@ -919,3 +916,35 @@ bool8 HasDisabledMove(struct PokemonMove *moves)
}
return FALSE;
}
bool8 LastUsedMoveOutOfPP(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_LAST_USED &&
moves[i].PP == 0)
{
return TRUE;
}
}
return FALSE;
}
bool8 HasLastUsedMove(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_LAST_USED)
{
return TRUE;
}
}
if (moves[STRUGGLE_MOVE_INDEX].moveFlags & MOVE_FLAG_LAST_USED)
{
return TRUE;
}
return FALSE;
}

View File

@ -1,21 +0,0 @@
#include "global.h"
#include "status_checker_1.h"
#include "dungeon_entity.h"
bool8 HasLastUsedMove(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_LAST_USED)
{
return TRUE;
}
}
if (moves[STRUGGLE_MOVE_INDEX].moveFlags & MOVE_FLAG_LAST_USED)
{
return TRUE;
}
return FALSE;
}