mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-28 03:34:22 -05:00
Decomped MoveMatchesChargingStatus
This commit is contained in:
@@ -2501,7 +2501,7 @@ _080414A0:
|
||||
_080414A4:
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
adds r1, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
|
||||
@@ -2831,7 +2831,7 @@ _08053A4C:
|
||||
movs r4, 0
|
||||
adds r0, r7, 0
|
||||
mov r1, r8
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08053A7E
|
||||
@@ -6521,7 +6521,7 @@ _08055B74:
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
str r2, [sp, 0x30]
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldrb r0, [r6, 0x4]
|
||||
@@ -7148,7 +7148,7 @@ _080560AE:
|
||||
beq _080560CC
|
||||
adds r0, r5, 0
|
||||
adds r1, r7, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080560CC
|
||||
@@ -7165,7 +7165,7 @@ _080560CC:
|
||||
bl sub_80928C0
|
||||
adds r0, r5, 0
|
||||
adds r1, r7, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08056124
|
||||
@@ -8038,7 +8038,7 @@ _080567EC:
|
||||
beq _08056820
|
||||
mov r0, r10
|
||||
ldr r1, [sp, 0x1C]
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08056820
|
||||
@@ -8740,7 +8740,7 @@ _08056D44:
|
||||
bne _08056D86
|
||||
adds r0, r5, 0
|
||||
mov r1, r8
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
mov r2, r8
|
||||
@@ -9186,49 +9186,4 @@ _080570A6:
|
||||
bx r1
|
||||
thumb_func_end sub_8057088
|
||||
|
||||
thumb_func_start IsChargeMove
|
||||
IsChargeMove:
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080570C2
|
||||
b _080570E8
|
||||
_080570BE:
|
||||
movs r0, 0x1
|
||||
b _080570EA
|
||||
_080570C2:
|
||||
ldr r0, [r4, 0x70]
|
||||
movs r3, 0
|
||||
ldr r2, _080570F0
|
||||
adds r4, r0, 0
|
||||
adds r4, 0xC0
|
||||
_080570CC:
|
||||
ldrh r1, [r2]
|
||||
cmp r1, 0
|
||||
beq _080570E8
|
||||
ldrh r0, [r5, 0x2]
|
||||
cmp r0, r1
|
||||
bne _080570E0
|
||||
ldrb r0, [r4]
|
||||
ldrb r1, [r2, 0x2]
|
||||
cmp r0, r1
|
||||
beq _080570BE
|
||||
_080570E0:
|
||||
adds r2, 0x4
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x63
|
||||
ble _080570CC
|
||||
_080570E8:
|
||||
movs r0, 0
|
||||
_080570EA:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_080570F0: .4byte gChargeMovesToStatuses
|
||||
thumb_func_end IsChargeMove
|
||||
|
||||
.align 2, 0
|
||||
.align 2, 0
|
||||
@@ -932,7 +932,7 @@ _080577C8: .4byte gUnknown_80FD14C
|
||||
_080577CC:
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080577F8
|
||||
|
||||
@@ -1209,7 +1209,7 @@ sub_80582EC:
|
||||
adds r4, r2, 0
|
||||
adds r6, r3, 0
|
||||
adds r1, r4, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08058328
|
||||
@@ -1684,7 +1684,7 @@ sub_805867C:
|
||||
adds r4, r2, 0
|
||||
adds r6, r3, 0
|
||||
adds r1, r4, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080586B8
|
||||
@@ -2255,7 +2255,7 @@ SkyAttackMoveAction:
|
||||
mov r8, r0
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08058B14
|
||||
@@ -3847,7 +3847,7 @@ sub_805968C:
|
||||
beq _080596B6
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080596EC
|
||||
@@ -3972,7 +3972,7 @@ sub_8059790:
|
||||
adds r4, r2, 0
|
||||
adds r6, r3, 0
|
||||
adds r1, r4, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080597CC
|
||||
@@ -4077,7 +4077,7 @@ _0805986C: .4byte gUnknown_80FD128
|
||||
_08059870:
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080598A4
|
||||
@@ -5002,7 +5002,7 @@ sub_8059F38:
|
||||
mov r8, r0
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08059FA0
|
||||
@@ -8374,7 +8374,7 @@ SkullBashMoveAction:
|
||||
adds r4, r2, 0
|
||||
adds r6, r3, 0
|
||||
adds r1, r4, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0805B8EC
|
||||
|
||||
@@ -153,7 +153,7 @@ _080702B0:
|
||||
beq _08070312
|
||||
adds r0, r7, 0
|
||||
adds r1, r4, 0
|
||||
bl IsChargeMove
|
||||
bl MoveMatchesChargingStatus
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08070312
|
||||
|
||||
@@ -6109,7 +6109,3 @@ gUnknown_81069BC: @ 81069BC
|
||||
.global gUnknown_81069D4
|
||||
gUnknown_81069D4: @ 81069D4
|
||||
.incbin "baserom.gba", 0x1069D4, 0x20
|
||||
|
||||
.global gChargeMovesToStatuses
|
||||
gChargeMovesToStatuses: @ 81069F4
|
||||
.incbin "baserom.gba", 0x1069F4, 0x28
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
// 0x570AC
|
||||
bool8 MoveMatchesChargingStatus(struct DungeonEntity *pokemon, struct PokemonMove *move);
|
||||
// 0x570F4
|
||||
// checkCharge = Check for the move named Charge.
|
||||
bool8 IsCharging(struct DungeonEntity *pokemon, bool8 checkCharge);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
#include "global.h"
|
||||
#include "charge_move.h"
|
||||
|
||||
#include "constants/move_id.h"
|
||||
#include "constants/status.h"
|
||||
#include "dungeon_util.h"
|
||||
|
||||
struct MultiTurnChargeMove
|
||||
{
|
||||
u16 moveID;
|
||||
u8 chargingStatus;
|
||||
};
|
||||
|
||||
const struct MultiTurnChargeMove gMultiTurnChargeMoves[10] = {
|
||||
{MOVE_SOLARBEAM, CHARGING_STATUS_SOLARBEAM},
|
||||
{MOVE_SKY_ATTACK, CHARGING_STATUS_SKY_ATTACK},
|
||||
{MOVE_RAZOR_WIND, CHARGING_STATUS_RAZOR_WIND},
|
||||
{MOVE_FOCUS_PUNCH, CHARGING_STATUS_FOCUS_PUNCH},
|
||||
{MOVE_SKULL_BASH, CHARGING_STATUS_SKULL_BASH},
|
||||
{MOVE_FLY, CHARGING_STATUS_FLY},
|
||||
{MOVE_BOUNCE, CHARGING_STATUS_BOUNCE},
|
||||
{MOVE_DIVE, CHARGING_STATUS_DIVE},
|
||||
{MOVE_DIG, CHARGING_STATUS_DIG},
|
||||
{MOVE_NONE, CHARGING_STATUS_NONE}
|
||||
};
|
||||
|
||||
const u32 gMultiTurnChargingStatuses[10] = {
|
||||
CHARGING_STATUS_SOLARBEAM,
|
||||
CHARGING_STATUS_SKY_ATTACK,
|
||||
@@ -19,6 +39,32 @@ const u32 gMultiTurnChargingStatuses[10] = {
|
||||
|
||||
ALIGNED(4) const char chargingStatusFill[] = "pksdir0";
|
||||
|
||||
bool8 MoveMatchesChargingStatus(struct DungeonEntity *pokemon, struct PokemonMove *move)
|
||||
{
|
||||
if (!EntityExists(pokemon))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct DungeonEntityData *pokemonData = pokemon->entityData;
|
||||
s32 i;
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
if (gMultiTurnChargeMoves[i].moveID == MOVE_NONE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (move->moveID == gMultiTurnChargeMoves[i].moveID &&
|
||||
pokemonData->chargingStatus == gMultiTurnChargeMoves[i].chargingStatus)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 IsCharging(struct DungeonEntity *pokemon, bool8 checkCharge)
|
||||
{
|
||||
if (!EntityExists(pokemon))
|
||||
@@ -53,4 +99,4 @@ bool8 IsCharging(struct DungeonEntity *pokemon, bool8 checkCharge)
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "constants/status.h"
|
||||
#include "constants/tactic.h"
|
||||
#include "constants/type.h"
|
||||
#include "charge_move.h"
|
||||
#include "dungeon_action.h"
|
||||
#include "dungeon_ai.h"
|
||||
#include "dungeon_capabilities_1.h"
|
||||
@@ -29,7 +30,6 @@ struct MoveTargetResults
|
||||
s32 moveWeight;
|
||||
};
|
||||
|
||||
extern bool8 IsChargeMove(struct DungeonEntity*, struct PokemonMove*);
|
||||
extern void TargetTileInFront(struct DungeonEntity*);
|
||||
extern s32 FindMoveTarget(struct MoveTargetResults*, struct DungeonEntity*, struct PokemonMove*);
|
||||
extern bool8 IsMoveUsable(struct DungeonEntity*, s32, bool8);
|
||||
@@ -63,7 +63,7 @@ void DecideAttack(struct DungeonEntity *pokemon)
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (pokemonData->moves[i].moveFlags & MOVE_FLAG_EXISTS &&
|
||||
IsChargeMove(pokemon, &pokemonData->moves[i]) &&
|
||||
MoveMatchesChargingStatus(pokemon, &pokemonData->moves[i]) &&
|
||||
pokemonData->chargingStatusMoveIndex == i)
|
||||
{
|
||||
s32 chosenMoveIndex;
|
||||
|
||||
Reference in New Issue
Block a user