diff --git a/asm/include/overlay_29_022EB44C.inc b/asm/include/overlay_29_022EB44C.inc index 650a8b7f..c87c3a64 100644 --- a/asm/include/overlay_29_022EB44C.inc +++ b/asm/include/overlay_29_022EB44C.inc @@ -5,17 +5,9 @@ .public GetItemCategoryVeneer .public GetItemInfo .public GetTile -.public IsHM .public ITEM_CATEGORY_ACTIONS +.public IsHM .public ItemZInit -.public ov29_02347040 -.public ov29_02352074 -.public ov29_0237C918 -.public ov29_0237C91C -.public ov29_0237C91E -.public ov29_0237C920 -.public ov29_0237C922 -.public ov29_0237C96C .public RemoveEmptyItemsInBagWrapper .public RemoveEquivItemNoHole .public RemoveGroundItem @@ -24,3 +16,11 @@ .public SetMonsterActionFields .public ShouldDisplayEntityWrapper .public SpawnItem +.public ov29_02347040 +.public ov29_02352074 +.public ov29_0237C918 +.public ov29_0237C91C +.public ov29_0237C91E +.public ov29_0237C920 +.public ov29_0237C922 +.public ov29_0237C96C diff --git a/asm/include/overlay_29_022EBC74.inc b/asm/include/overlay_29_022EBC74.inc new file mode 100644 index 00000000..7341ed40 --- /dev/null +++ b/asm/include/overlay_29_022EBC74.inc @@ -0,0 +1,2 @@ +#pragma once +.public SetMonsterActionFields diff --git a/asm/overlay_29_022EB44C.s b/asm/overlay_29_022EB44C.s index b143594d..9e2fc762 100644 --- a/asm/overlay_29_022EB44C.s +++ b/asm/overlay_29_022EB44C.s @@ -693,42 +693,3 @@ ov29_022EBC2C: ; 0x022EBC2C strb r4, [r6, #0xa] ldmia sp!, {r4, r5, r6, pc} arm_func_end ov29_022EBC2C - - arm_func_start SetActionRegularAttack -SetActionRegularAttack: ; 0x022EBC50 - stmdb sp!, {r3, r4, r5, lr} - mov r4, r1 - mov r1, #0x32 - mov r5, r0 - bl SetMonsterActionFields - cmp r4, #0xff - andne r0, r4, #7 - strneb r0, [r5, #2] - ldmia sp!, {r3, r4, r5, pc} - arm_func_end SetActionRegularAttack - - arm_func_start SetActionStruggle -SetActionStruggle: ; 0x022EBC74 - stmdb sp!, {r3, r4, r5, lr} - mov r4, r1 - mov r1, #0x17 - mov r5, r0 - bl SetMonsterActionFields - cmp r4, #0xff - andne r0, r4, #7 - strneb r0, [r5, #2] - ldmia sp!, {r3, r4, r5, pc} - arm_func_end SetActionStruggle - - arm_func_start SetActionUseMovePlayer -SetActionUseMovePlayer: ; 0x022EBC98 - stmdb sp!, {r4, r5, r6, lr} - mov r5, r1 - mov r1, #0x14 - mov r6, r0 - mov r4, r2 - bl SetMonsterActionFields - strb r5, [r6, #4] - strb r4, [r6, #0xa] - ldmia sp!, {r4, r5, r6, pc} - arm_func_end SetActionUseMovePlayer diff --git a/asm/overlay_29_022EBC74.s b/asm/overlay_29_022EBC74.s new file mode 100644 index 00000000..27e1c0a2 --- /dev/null +++ b/asm/overlay_29_022EBC74.s @@ -0,0 +1,30 @@ + .include "asm/macros.inc" + .include "overlay_29_022EBC74.inc" + + .text + + arm_func_start SetActionStruggle +SetActionStruggle: ; 0x022EBC74 + stmdb sp!, {r3, r4, r5, lr} + mov r4, r1 + mov r1, #0x17 + mov r5, r0 + bl SetMonsterActionFields + cmp r4, #0xff + andne r0, r4, #7 + strneb r0, [r5, #2] + ldmia sp!, {r3, r4, r5, pc} + arm_func_end SetActionStruggle + + arm_func_start SetActionUseMovePlayer +SetActionUseMovePlayer: ; 0x022EBC98 + stmdb sp!, {r4, r5, r6, lr} + mov r5, r1 + mov r1, #0x14 + mov r6, r0 + mov r4, r2 + bl SetMonsterActionFields + strb r5, [r6, #4] + strb r4, [r6, #0xa] + ldmia sp!, {r4, r5, r6, pc} + arm_func_end SetActionUseMovePlayer diff --git a/include/overlay_29_022EBC50.h b/include/overlay_29_022EBC50.h new file mode 100644 index 00000000..ae2fbf2b --- /dev/null +++ b/include/overlay_29_022EBC50.h @@ -0,0 +1,9 @@ +#ifndef PMDSKY_OVERLAY_29_022EBC50_H +#define PMDSKY_OVERLAY_29_022EBC50_H + +#include "dungeon_mode.h" + +// Sets a monster's action to action::ACTION_REGULAR_ATTACK, with a specified direction. +void SetActionRegularAttack(struct action_data *monster_action, u8 direction); + +#endif //PMDSKY_OVERLAY_29_022EBC50_H diff --git a/main.lsf b/main.lsf index 8f3e9988..b93318d2 100644 --- a/main.lsf +++ b/main.lsf @@ -373,6 +373,8 @@ Overlay OVY_29 Object asm/overlay_29_022EAB50.o Object src/dungeon_action.o Object asm/overlay_29_022EB44C.o + Object src/overlay_29_022EBC50.o + Object asm/overlay_29_022EBC74.o Object src/dungeon_action_helper.o Object asm/overlay_29_022EBCE8.o Object src/overlay_29_022EC608.o diff --git a/src/dungeon_ai_itcm.c b/src/dungeon_ai_itcm.c index a0205b23..7c82e0ae 100644 --- a/src/dungeon_ai_itcm.c +++ b/src/dungeon_ai_itcm.c @@ -18,11 +18,11 @@ #include "dungeon_util_static.h" #include "fixed_room_data.h" #include "moves_1.h" +#include "overlay_29_022EBC50.h" #include "overlay_29_02338350.h" #define REGULAR_ATTACK_INDEX 4 -extern void SetActionRegularAttack(struct action_data *monster_action, u8 direction); extern void SetActionStruggle(struct action_data *monster_action, u8 direction); extern bool8 CanAiUseMove(struct entity *monster, u32 move_index, bool8 extra_checks); extern u8 GetMoveAiWeight(struct move *move); diff --git a/src/overlay_29_022EBC50.c b/src/overlay_29_022EBC50.c new file mode 100644 index 00000000..31bccf3b --- /dev/null +++ b/src/overlay_29_022EBC50.c @@ -0,0 +1,9 @@ +#include "overlay_29_022EBC50.h" +#include "dungeon_action.h" + +void SetActionRegularAttack(struct action_data *monster_action, u8 direction) +{ + SetMonsterActionFields(monster_action, ACTION_REGULAR_ATTACK); + if (direction != DIR_NONE_UNSIGNED) + monster_action->direction = direction & DIRECTION_MASK; +}