Decomped IsUsableWhileTaunted

This commit is contained in:
AnonymousRandomPerson 2025-06-25 21:45:27 -04:00
parent 0990bcd309
commit c45b7dda7a
12 changed files with 88 additions and 74 deletions

View File

@ -1,3 +1,2 @@
#pragma once
.public DUNGEON_MOVE_TABLES
.public _s32_div_f

View File

@ -0,0 +1,3 @@
#pragma once
.public DUNGEON_MOVE_TABLES
.public _s32_div_f

View File

@ -15,7 +15,7 @@
.public GetMoveTypeForMonster
.public GetTile
.public IqSkillIsEnabled
.public IsAffectedByTaunt
.public IsUsableWhileTaunted
.public IsAiTargetEligible
.public IsBlinded
.public IsTargetInRange

View File

@ -18,7 +18,7 @@
.public GetNaturePowerVariant
.public GetSpriteIndex__02052708
.public Is2TurnsMove
.public IsAffectedByTaunt
.public IsUsableWhileTaunted
.public IsCopyingMove
.public IsFloorOver
.public LogMessageByIdWithPopupCheckUser

View File

@ -54,69 +54,3 @@ IsThawingMove: ; 0x02013B30
.align 2, 0
_02013B4C: .word DUNGEON_MOVE_TABLES
arm_func_end IsThawingMove
arm_func_start IsAffectedByTaunt
IsAffectedByTaunt: ; 0x02013B50
ldr r1, _02013B6C ; =DUNGEON_MOVE_TABLES
ldrh r2, [r0, #4]
ldr r1, [r1, #8]
mov r0, #0x1a
mla r0, r2, r0, r1
ldrb r0, [r0, #0x14]
bx lr
.align 2, 0
_02013B6C: .word DUNGEON_MOVE_TABLES
arm_func_end IsAffectedByTaunt
arm_func_start GetMoveRangeId
GetMoveRangeId: ; 0x02013B70
ldr r1, _02013B8C ; =DUNGEON_MOVE_TABLES
ldrh r2, [r0, #4]
ldr r1, [r1, #8]
mov r0, #0x1a
mla r0, r2, r0, r1
ldrb r0, [r0, #0x15]
bx lr
.align 2, 0
_02013B8C: .word DUNGEON_MOVE_TABLES
arm_func_end GetMoveRangeId
arm_func_start GetMoveActualAccuracy
GetMoveActualAccuracy: ; 0x02013B90
stmdb sp!, {r3, lr}
ldr r2, _02013BE4 ; =DUNGEON_MOVE_TABLES
mov r1, #0x1a
ldr r2, [r2, #8]
mla r1, r0, r1, r2
ldrb r0, [r1, #0xe]
cmp r0, #0
ldreqb r0, [r1, #0xa]
ldmeqia sp!, {r3, pc}
cmp r0, #0x63
bne _02013BDC
ldrb r2, [r1, #0xa]
ldrb r0, [r1, #0xb]
cmp r2, #0x7d
ldmeqia sp!, {r3, pc}
mul r0, r2, r0
mov r1, #0x64
bl _s32_div_f
ldmia sp!, {r3, pc}
_02013BDC:
mov r0, #0
ldmia sp!, {r3, pc}
.align 2, 0
_02013BE4: .word DUNGEON_MOVE_TABLES
arm_func_end GetMoveActualAccuracy
arm_func_start GetMoveBasePowerFromId
GetMoveBasePowerFromId: ; 0x02013BE8
mov r1, #0x1a
mul r1, r0, r1
ldr r0, _02013C00 ; =DUNGEON_MOVE_TABLES
ldr r0, [r0, #8]
ldrsh r0, [r0, r1]
bx lr
.align 2, 0
_02013C00: .word DUNGEON_MOVE_TABLES
arm_func_end GetMoveBasePowerFromId

57
asm/main_02013B70.s Normal file
View File

@ -0,0 +1,57 @@
.include "asm/macros.inc"
.include "main_02013B70.inc"
.text
arm_func_start GetMoveRangeId
GetMoveRangeId: ; 0x02013B70
ldr r1, _02013B8C ; =DUNGEON_MOVE_TABLES
ldrh r2, [r0, #4]
ldr r1, [r1, #8]
mov r0, #0x1a
mla r0, r2, r0, r1
ldrb r0, [r0, #0x15]
bx lr
.align 2, 0
_02013B8C: .word DUNGEON_MOVE_TABLES
arm_func_end GetMoveRangeId
arm_func_start GetMoveActualAccuracy
GetMoveActualAccuracy: ; 0x02013B90
stmdb sp!, {r3, lr}
ldr r2, _02013BE4 ; =DUNGEON_MOVE_TABLES
mov r1, #0x1a
ldr r2, [r2, #8]
mla r1, r0, r1, r2
ldrb r0, [r1, #0xe]
cmp r0, #0
ldreqb r0, [r1, #0xa]
ldmeqia sp!, {r3, pc}
cmp r0, #0x63
bne _02013BDC
ldrb r2, [r1, #0xa]
ldrb r0, [r1, #0xb]
cmp r2, #0x7d
ldmeqia sp!, {r3, pc}
mul r0, r2, r0
mov r1, #0x64
bl _s32_div_f
ldmia sp!, {r3, pc}
_02013BDC:
mov r0, #0
ldmia sp!, {r3, pc}
.align 2, 0
_02013BE4: .word DUNGEON_MOVE_TABLES
arm_func_end GetMoveActualAccuracy
arm_func_start GetMoveBasePowerFromId
GetMoveBasePowerFromId: ; 0x02013BE8
mov r1, #0x1a
mul r1, r0, r1
ldr r0, _02013C00 ; =DUNGEON_MOVE_TABLES
ldr r0, [r0, #8]
ldrsh r0, [r0, r1]
bx lr
.align 2, 0
_02013C00: .word DUNGEON_MOVE_TABLES
arm_func_end GetMoveBasePowerFromId

View File

@ -38,7 +38,7 @@ AiConsiderMove: ; 0x02319880
cmp r0, #5
bne _023198F8
mov r0, sb
bl IsAffectedByTaunt
bl IsUsableWhileTaunted
cmp r0, #0
moveq r0, #1
beq _02319F64

View File

@ -409,7 +409,7 @@ CanMonsterUseMove: ; 0x02324B24
cmp r0, #5
bne _02324BA0
mov r0, r5
bl IsAffectedByTaunt
bl IsUsableWhileTaunted
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}
@ -466,7 +466,7 @@ ov29_02324BE8: ; 0x02324BE8
cmp r0, #5
bne _02324C54
mov r0, r5
bl IsAffectedByTaunt
bl IsUsableWhileTaunted
cmp r0, #0
moveq r0, #0
ldmeqia sp!, {r3, r4, r5, pc}

10
include/moves_3.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef PMDSKY_MOVES_3_H
#define PMDSKY_MOVES_3_H
#include "move.h"
#include "util.h"
// Returns true if the given move can be used while the user is affected by Taunt, or false if the move cannot be used while taunted.
bool8 IsUsableWhileTaunted(struct move *move);
#endif //PMDSKY_MOVES_3_H

View File

@ -41,6 +41,8 @@ Static main
Object asm/main_02013864.o
Object src/moves.o
Object asm/main_02013AD0.o
Object src/moves_3.o
Object asm/main_02013B70.o
Object src/main_02013C04.o
Object asm/main_02013C30.o
Object src/main_020251AC.o

View File

@ -11,6 +11,7 @@
#include "main_0208655C.h"
#include "move_data.h"
#include "moves_2.h"
#include "moves_3.h"
#include "overlay_29_0231ACAC.h"
#include "position_util.h"
@ -20,7 +21,6 @@ extern u8 AI_POTENTIAL_ATTACK_TARGET_DIRECTIONS[NUM_DIRECTIONS];
extern s32 AI_POTENTIAL_ATTACK_TARGET_WEIGHTS[NUM_DIRECTIONS];
extern struct entity *AI_POTENTIAL_ATTACK_TARGETS[NUM_DIRECTIONS];
extern bool8 IsAffectedByTaunt(struct move *move);
extern bool8 StatusCheckerCheck(struct entity *attacker, struct move *move);
extern bool8 CanAttackInDirection(struct entity *monster, s32 direction);
extern s32 TryAddTargetToAiTargetList(s32 current_num_targets, s32 move_ai_range, struct entity *user, struct entity *target, struct move *move, bool8 check_all_conditions);
@ -41,7 +41,7 @@ u32 AiConsiderMove(struct ai_possible_move *ai_possible_move, struct entity *mon
s32 move_target_and_range = GetEntityMoveTargetAndRange(monster, move, TRUE);
has_status_checker = IqSkillIsEnabled(monster, IQ_STATUS_CHECKER);
ai_possible_move->can_be_used = FALSE;
if (pokemon_info->cringe_class_status.cringe == STATUS_CRINGE_TAUNTED && !IsAffectedByTaunt(move))
if (pokemon_info->cringe_class_status.cringe == STATUS_CRINGE_TAUNTED && !IsUsableWhileTaunted(move))
return move_weight;
if (has_status_checker && !StatusCheckerCheck(monster, move))

9
src/moves_3.c Normal file
View File

@ -0,0 +1,9 @@
#include "moves_3.h"
#include "move_data.h"
extern struct move_data_table_outer DUNGEON_MOVE_TABLES;
bool8 IsUsableWhileTaunted(struct move *move)
{
return DUNGEON_MOVE_TABLES.moves->moves[move->id].usable_while_taunted;
}