mirror of
https://github.com/pret/pmd-red.git
synced 2026-06-03 06:18:45 -05:00
Decomped HasLastUsedMove()
This commit is contained in:
parent
17a6ab3794
commit
91c0a142cc
24595
asm/code_805D810.s
24595
asm/code_805D810.s
File diff suppressed because it is too large
Load Diff
24563
asm/code_805D8C8.s
Normal file
24563
asm/code_805D8C8.s
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef GUARD_CONSTANTS_MOVE_H
|
||||
#define GUARD_CONSTANTS_MOVE_H
|
||||
|
||||
#define STRUGGLE_MOVE_INDEX 4
|
||||
|
||||
enum MoveFlags
|
||||
{
|
||||
MOVE_FLAG_EXISTS = 1 << 0,
|
||||
|
|
@ -11,6 +13,13 @@ enum MoveFlags
|
|||
MOVE_FLAG_DISABLED = 1 << 5 // Disabled by an effect like Taunt.
|
||||
};
|
||||
|
||||
enum MoveFlags2
|
||||
{
|
||||
MOVE_FLAG_SEALED = 1 << 0,
|
||||
MOVE_FLAG_TEMPORARY = 1 << 3, // Used for moves copied by Mimic.
|
||||
MOVE_FLAG_REPLACE = 1 << 5 // Used for moves copied by Sketch.
|
||||
};
|
||||
|
||||
enum AccuracyType
|
||||
{
|
||||
// Accuracy used for all moves.
|
||||
|
|
@ -52,7 +61,7 @@ struct MoveData
|
|||
struct PokemonMove
|
||||
{
|
||||
u8 moveFlags;
|
||||
bool8 sealed;
|
||||
u8 moveFlags2;
|
||||
u16 moveID;
|
||||
u8 PP;
|
||||
u8 powerBoost; // How much the move is boosted by Ginsengs.
|
||||
|
|
|
|||
9
include/status_checker_1.h
Normal file
9
include/status_checker_1.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef GUARD_STATUS_CHECKER_1_H
|
||||
#define GUARD_STATUS_CHECKER_1_H
|
||||
|
||||
#include "moves.h"
|
||||
|
||||
// 0x5D888
|
||||
bool8 HasLastUsedMove(struct PokemonMove *moves);
|
||||
|
||||
#endif
|
||||
|
|
@ -212,6 +212,8 @@ SECTIONS {
|
|||
asm/code_8057824.o(.text);
|
||||
src/status_checker.o(.text);
|
||||
asm/code_805D810.o(.text);
|
||||
src/status_checker_1.o(.text);
|
||||
asm/code_805D8C8.o(.text);
|
||||
src/targeting.o(.text);
|
||||
asm/code_8069E0C.o(.text);
|
||||
src/code_806CD90.o(.text);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ u8 sub_809287C(struct PokemonMove *move)
|
|||
{
|
||||
if((move->moveFlags & MOVE_FLAG_DISABLED) != 0)
|
||||
return 0x32;
|
||||
else if((move->sealed & 1) == 0)
|
||||
else if((move->moveFlags2 & MOVE_FLAG_SEALED) == 0)
|
||||
return 0x34;
|
||||
else
|
||||
return 0x32;
|
||||
|
|
@ -130,7 +130,7 @@ void sub_80928C0(u8 *buffer, struct PokemonMove *move, struct unkStruct_80928C0
|
|||
void InitPokemonMove(struct PokemonMove *move, u16 moveID)
|
||||
{
|
||||
move->moveFlags = MOVE_FLAG_ENABLED | MOVE_FLAG_EXISTS;
|
||||
move->sealed = FALSE;
|
||||
move->moveFlags2 = 0;
|
||||
move->moveID = moveID;
|
||||
move->PP = GetMoveMaxPP(move);
|
||||
move->powerBoost = 0;
|
||||
|
|
@ -143,7 +143,7 @@ void sub_8092AA8(struct PokemonMove *move, u16 moveID)
|
|||
else
|
||||
{
|
||||
move->moveFlags = MOVE_FLAG_ENABLED | MOVE_FLAG_EXISTS;
|
||||
move->sealed = FALSE;
|
||||
move->moveFlags2 = 0;
|
||||
move->moveID = moveID;
|
||||
move->PP = GetMoveMaxPP(move);
|
||||
move->powerBoost = 0;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void RestorePokemonMoves(struct unkStruct_8094924 *r0, struct PokemonMove *moveS
|
|||
void sub_8094148(struct unkStruct_8094924 *r0, struct PokemonMove *move)
|
||||
{
|
||||
SaveIntegerBits(r0, &move->moveFlags, 4);
|
||||
SaveIntegerBits(r0, &move->sealed, 1);
|
||||
SaveIntegerBits(r0, &move->moveFlags2, 1);
|
||||
SaveIntegerBits(r0, &move->moveID, 9);
|
||||
SaveIntegerBits(r0, &move->PP, 7);
|
||||
SaveIntegerBits(r0, &move->powerBoost, 7);
|
||||
|
|
@ -59,7 +59,7 @@ void sub_80941B0(struct unkStruct_8094924 *r0, struct PokemonMove *move)
|
|||
{
|
||||
memset(move, 0, sizeof(struct PokemonMove));
|
||||
RestoreIntegerBits(r0, &move->moveFlags, 4);
|
||||
RestoreIntegerBits(r0, &move->sealed, 1);
|
||||
RestoreIntegerBits(r0, &move->moveFlags2, 1);
|
||||
RestoreIntegerBits(r0, &move->moveID, 9);
|
||||
RestoreIntegerBits(r0, &move->PP, 7);
|
||||
RestoreIntegerBits(r0, &move->powerBoost, 7);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#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"
|
||||
|
|
@ -98,7 +99,6 @@ const u8 gDungeonCamouflageTypes[76] = {
|
|||
TYPE_ROCK
|
||||
};
|
||||
|
||||
extern bool8 HasLastUsedMove(struct PokemonMove *moves);
|
||||
extern bool8 HasDisabledMove(struct PokemonMove *moves);
|
||||
extern bool8 LastMoveOutOfPP(struct PokemonMove *moves);
|
||||
|
||||
|
|
|
|||
21
src/status_checker_1.c
Normal file
21
src/status_checker_1.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#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;
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ bool8 HasNegativeStatus(struct DungeonEntity *pokemon)
|
|||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
struct PokemonMove *moves = pokemonData->moves;
|
||||
if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].sealed & TRUE)
|
||||
if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].moveFlags2 & MOVE_FLAG_SEALED)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user