Decomped IsChargingTwoTurnMove

This commit is contained in:
AnonymousRandomPerson 2025-06-17 22:18:05 -05:00
parent 710459dbb1
commit a792d10c2d
13 changed files with 76 additions and 61 deletions

View File

@ -1,16 +1,15 @@
#pragma once
.public _s32_div_f
.public AbilityIsActiveVeneer
.public AdvanceFrame
.public AnimationDelayOrSomething
.public DefenderAbilityIsActive__02322D64
.public DETECT_BAND_MOVE_ACCURACY_DROP
.public DIRECTIONS_XY
.public DUNGEON_PTR
.public DefenderAbilityIsActive__02322D64
.public DungeonRandInt
.public DungeonRandRange
.public EntityIsValid__02321438
.public EXCL_ITEM_EFFECTS_EVASION_BOOST
.public EntityIsValid__02321438
.public ExclusiveItemEffectFlagTest
.public ExecuteMoveEffect
.public FormatMoveStringMore
@ -27,11 +26,18 @@
.public GetTreatmentBetweenMonsters
.public HasHeldItem
.public IqSkillIsEnabled
.public IsChargingTwoTurnMove
.public LogMessageQuiet
.public LogMessageWithPopup
.public MALE_ACCURACY_STAGE_MULTIPLIERS
.public MALE_EVASION_STAGE_MULTIPLIERS
.public MoveIsNotPhysical
.public PlayMoveAnimation
.public PositionHasMonster
.public QUICK_DODGER_MOVE_ACCURACY_DROP
.public ShouldDisplayEntityWrapper
.public TwoTurnMoveForcedMiss
.public _s32_div_f
.public ov10_022BDE50
.public ov10_022BE9E8
.public ov10_022BEB2C
@ -58,12 +64,6 @@
.public ov29_02352A6C
.public ov29_02352A8C
.public ov29_0235370C
.public PlayMoveAnimation
.public PositionHasMonster
.public QUICK_DODGER_MOVE_ACCURACY_DROP
.public ShouldDisplayEntityWrapper
.public sub_020018D0
.public sub_02001980
.public sub_0201CF90
.public TWO_TURN_MOVES_AND_STATUSES
.public TwoTurnMoveForcedMiss

View File

@ -1719,40 +1719,3 @@ IsHyperBeamVariant: ; 0x02324534
.align 2, 0
_023245A0: .word 0x000001C5
arm_func_end IsHyperBeamVariant
arm_func_start IsChargingTwoTurnMove
IsChargingTwoTurnMove: ; 0x023245A4
stmdb sp!, {r3, r4, r5, lr}
mov r5, r0
mov r4, r1
bl EntityIsValid__02321438
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
ldr ip, [r5, #0xb4]
mov lr, #0
ldr r2, _02324618 ; =TWO_TURN_MOVES_AND_STATUSES
b _02324608
_023245D0:
mov r3, lr, lsl #2
ldrh r1, [r2, r3]
cmp r1, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
ldrh r0, [r4, #4]
cmp r0, r1
addeq r0, r2, r3
ldreqb r1, [ip, #0xd2]
ldreqb r0, [r0, #2]
cmpeq r1, r0
moveq r0, #1
ldmeqia sp!, {r3, r4, r5, pc}
add lr, lr, #1
_02324608:
cmp lr, #0x64
blt _023245D0
mov r0, #0
ldmia sp!, {r3, r4, r5, pc}
.align 2, 0
_02324618: .word TWO_TURN_MOVES_AND_STATUSES
arm_func_end IsChargingTwoTurnMove

View File

@ -1,5 +1,5 @@
#ifndef PMDSKY_DUNGEON_LOGIC_3_H
#define PMDSKY_DUNGEON_LOGIC_3_H
#ifndef PMDSKY_DUNGEON_CAPABILITIES_3_H
#define PMDSKY_DUNGEON_CAPABILITIES_3_H
#include "dungeon_mode.h"
@ -22,4 +22,4 @@ bool8 CanMonsterMoveInDirection(struct entity *monster, u16 direction);
enum mobility_type GetDirectionalMobilityType(struct entity *monster, enum mobility_type base_mobility, u8 direction);
#endif
#endif //PMDSKY_DUNGEON_LOGIC_3_H
#endif //PMDSKY_DUNGEON_CAPABILITIES_3_H

View File

@ -1,5 +1,5 @@
#ifndef PMDSKY_OVERLAY_29_02301118_H
#define PMDSKY_OVERLAY_29_02301118_H
#ifndef PMDSKY_DUNGEON_CAPABILITIES_4_H
#define PMDSKY_DUNGEON_CAPABILITIES_4_H
#include "dungeon_mode.h"
@ -9,4 +9,4 @@ bool8 IsMonsterCornered(struct entity *monster);
// Returns false if an enemy monster is standing on the target tile
bool8 CanMonsterMoveOrSwapWithAllyInDirection(struct entity *monster, s32 direction);
#endif //PMDSKY_OVERLAY_29_02301118_H
#endif //PMDSKY_DUNGEON_CAPABILITIES_4_H

View File

@ -3,6 +3,8 @@
#include "dungeon_mode.h"
// Checks if a monster is currently charging the specified two-turn move.
bool8 IsChargingTwoTurnMove(struct entity *user, struct move *move);
// Returns a boolean indicating whether or not the given entity is charging any two-turn move.
// pokemon: Entity pointer
// check_charge: Unused boolean which was supposed to make function return true if the entity is under the effect of Charge (the Electric-type move).

View File

@ -0,0 +1,15 @@
#ifndef PMDSKY_TWO_TURN_MOVES_AND_STATUSES_H
#define PMDSKY_TWO_TURN_MOVES_AND_STATUSES_H
#include "enums.h"
// Represents a two-turn move and its corresponding status_two_turn_id value
struct two_turn_move_and_status {
enum move_id move;
enum status_two_turn_id status;
};
// List that matches two-turn move IDs to their corresponding status ID. The last entry is null.
extern const struct two_turn_move_and_status TWO_TURN_MOVES_AND_STATUSES[11];
#endif //PMDSKY_TWO_TURN_MOVES_AND_STATUSES_H

View File

@ -345,9 +345,9 @@ Overlay OVY_29
Object src/dungeon_capabilities_2.o
Object asm/overlay_29_02300D00.o
Object src/directional_bit_masks.o
Object src/dungeon_logic_3.o
Object src/dungeon_capabilities_3.o
Object asm/overlay_29_02300FCC.o
Object src/overlay_29_02301118.o
Object src/dungeon_capabilities_4.o
Object asm/overlay_29_02301234.o
Object src/dungeon_ai_targeting.o
Object asm/overlay_29_023016D8.o

View File

@ -3,13 +3,14 @@
#include "direction.h"
#include "dungeon_action.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_logic_3.h"
#include "dungeon_capabilities_3.h"
#include "dungeon_capabilities_4.h"
#include "dungeon_mode.h"
#include "dungeon_parameters.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_pokemon_attributes_1.h"
#include "dungeon_util_static.h"
#include "fixed_room_data.h"
#include "overlay_29_02301118.h"
#define REGULAR_ATTACK_INDEX 4
@ -17,7 +18,6 @@ const s16 AI_REGULAR_ATTACK_WEIGHTS[5] = { 100, 20, 30, 40, 50 };
extern struct dungeon *DUNGEON_PTR[];
extern bool8 IsChargingTwoTurnMove(struct entity *user, struct move *move);
extern void SetActionUseMoveAi(struct action_data *monster_action, s16 move_index, u8 direction);
extern void UpdateAiTargetPos(struct entity *monster);
extern void InitMove(struct move *move, enum move_id move_id);

View File

@ -1,4 +1,4 @@
#include "dungeon_logic_3.h"
#include "dungeon_capabilities_3.h"
#include "directional_bit_masks.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_map_access.h"

View File

@ -1,9 +1,9 @@
#include "overlay_29_02301118.h"
#include "dungeon_capabilities_4.h"
#include "direction.h"
#include "directional_bit_masks.h"
#include "dungeon.h"
#include "dungeon_ai_targeting_1.h"
#include "dungeon_logic_3.h"
#include "dungeon_capabilities_3.h"
#include "dungeon_map_access.h"
#include "dungeon_mobility.h"
#include "dungeon_pokemon_attributes_1.h"

View File

@ -1,7 +1,9 @@
#include "dungeon_move.h"
#include "dungeon_util_static.h"
#include "overlay_29_02321438.h"
#include "two_turn_moves_and_statuses.h"
// Lists all status IDs that are for two-turn moves. The last entry is null.
const enum status_two_turn_id TWO_TURN_STATUSES[11] =
{
STATUS_TWO_TURN_SOLARBEAM,
@ -17,6 +19,24 @@ const enum status_two_turn_id TWO_TURN_STATUSES[11] =
STATUS_TWO_TURN_NONE
};
bool8 IsChargingTwoTurnMove(struct entity *user, struct move *move)
{
if (!EntityIsValid__02321438(user))
return FALSE;
struct monster *pokemon_info = GetEntInfo(user);
for (s32 i = 0; i < 100; i++)
{
if (TWO_TURN_MOVES_AND_STATUSES[i].move == MOVE_NOTHING)
return FALSE;
if (move->id == TWO_TURN_MOVES_AND_STATUSES[i].move &&
pokemon_info->bide_class_status.bide == TWO_TURN_MOVES_AND_STATUSES[i].status)
return TRUE;
}
return FALSE;
}
bool8 IsChargingAnyTwoTurnMove(struct entity *entity, bool8 charge_check_unused)
{
if (!EntityIsValid__02321438(entity))

View File

@ -2,7 +2,7 @@
#include "dg_random.h"
#include "dungeon_action.h"
#include "dungeon_ai_itcm.h"
#include "dungeon_logic_3.h"
#include "dungeon_capabilities_3.h"
#include "dungeon_statuses.h"
#include "dungeon_util_static.h"

View File

@ -0,0 +1,15 @@
#include "two_turn_moves_and_statuses.h"
const struct two_turn_move_and_status TWO_TURN_MOVES_AND_STATUSES[11] = {
{MOVE_SOLARBEAM, STATUS_TWO_TURN_SOLARBEAM},
{MOVE_SKY_ATTACK, STATUS_TWO_TURN_SKY_ATTACK},
{MOVE_RAZOR_WIND, STATUS_TWO_TURN_RAZOR_WIND},
{MOVE_FOCUS_PUNCH, STATUS_TWO_TURN_FOCUS_PUNCH},
{MOVE_SKULL_BASH, STATUS_TWO_TURN_SKULL_BASH},
{MOVE_FLY, STATUS_TWO_TURN_FLYING},
{MOVE_BOUNCE, STATUS_TWO_TURN_BOUNCING},
{MOVE_DIVE, STATUS_TWO_TURN_DIVING},
{MOVE_DIG, STATUS_TWO_TURN_DIGGING},
{MOVE_SHADOW_FORCE, STATUS_TWO_TURN_SHADOW_FORCE},
{MOVE_NOTHING, STATUS_TWO_TURN_NONE}
};