diff --git a/asm/include/overlay_29_022EB41C.inc b/asm/include/overlay_29_022EB44C.inc similarity index 98% rename from asm/include/overlay_29_022EB41C.inc rename to asm/include/overlay_29_022EB44C.inc index cea369db..50eada93 100644 --- a/asm/include/overlay_29_022EB41C.inc +++ b/asm/include/overlay_29_022EB44C.inc @@ -1,26 +1,41 @@ #pragma once -.public abs .public AdvanceFrame .public CalcSpeedStageWrapper .public ChangeLeader +.public DUNGEON_PTR .public DecrementWindCounter .public DisplayActions -.public DUNGEON_PTR .public EnemyEvolution .public EntityIsValid__022EC608 .public ExecuteMonsterAction .public FRACTIONAL_TURN_SEQUENCE -.public GetCanMoveFlag .public GetEquivItemIndex .public GetItemAtIdx .public GetItemCategoryVeneer .public GetItemInfo .public GetLeader .public GetTile +.public ITEM_CATEGORY_ACTIONS .public IsFloorOver .public IsHM -.public ITEM_CATEGORY_ACTIONS .public ItemZInit +.public RemoveEmptyItemsInBagWrapper +.public RemoveEquivItemNoHole +.public RemoveGroundItem +.public RemoveItem +.public RunMonsterAi +.public SetItemAcquired +.public SetLeaderAction +.public SetMonsterActionFields +.public ShouldDisplayEntityWrapper +.public SpawnItem +.public TickStatusAndHealthRegen +.public TryActivateArtificialWeatherAbilities +.public TryActivateWeather +.public TryForcedLoss +.public TryRestoreRoostTyping +.public TrySpawnMonsterAndActivatePlusMinus +.public abs .public ov29_022E81F8 .public ov29_022EF9C8 .public ov29_0230FC24 @@ -34,20 +49,4 @@ .public ov29_0237C920 .public ov29_0237C922 .public ov29_0237C96C -.public RemoveEmptyItemsInBagWrapper -.public RemoveEquivItemNoHole -.public RemoveGroundItem -.public RemoveItem -.public RunMonsterAi -.public SetItemAcquired -.public SetLeaderAction -.public SetMonsterActionFields -.public ShouldDisplayEntityWrapper -.public SpawnItem .public sub_01FFBDF4 -.public TickStatusAndHealthRegen -.public TryActivateArtificialWeatherAbilities -.public TryActivateWeather -.public TryForcedLoss -.public TryRestoreRoostTyping -.public TrySpawnMonsterAndActivatePlusMinus diff --git a/asm/overlay_29_022EB41C.s b/asm/overlay_29_022EB44C.s similarity index 98% rename from asm/overlay_29_022EB41C.s rename to asm/overlay_29_022EB44C.s index e44a9e11..80ad72e4 100644 --- a/asm/overlay_29_022EB41C.s +++ b/asm/overlay_29_022EB44C.s @@ -1,24 +1,8 @@ .include "asm/macros.inc" - .include "overlay_29_022EB41C.inc" + .include "overlay_29_022EB44C.inc" .text - arm_func_start SetActionPassTurnOrWalk -SetActionPassTurnOrWalk: ; 0x022EB41C - stmdb sp!, {r4, lr} - mov r4, r0 - mov r0, r1 - bl GetCanMoveFlag - cmp r0, #0 - movne r0, #2 - moveq r0, #1 - strh r0, [r4] - mov r0, #0 - strb r0, [r4, #4] - strb r0, [r4, #0xa] - ldmia sp!, {r4, pc} - arm_func_end SetActionPassTurnOrWalk - arm_func_start GetItemToUseByIndex GetItemToUseByIndex: ; 0x022EB44C stmdb sp!, {r3, lr} diff --git a/include/dungeon_action.h b/include/dungeon_action.h index 2980e219..95f0325a 100644 --- a/include/dungeon_action.h +++ b/include/dungeon_action.h @@ -5,14 +5,16 @@ // Clears the fields related to AI in the monster's data struct, setting them all to 0. // Specifically, monster::action::action_id, monster::action::action_use_idx and monster::action::field_0xA are cleared. -// // monster_action: Pointer to the monster's action field void ClearMonsterActionFields(struct action_data *monster_action); // Sets some the fields related to AI in the monster's data struct. // Specifically, monster::action::action_id, monster::action::action_use_idx and monster::action::field_0xA. The last 2 are always set to 0. -// // action_pointer: Pointer to the monster's action field // action: Value to set monster::action::action_id to. void SetMonsterActionFields(struct action_data *monster_action, enum action action_id); +// Sets a monster's action to action::ACTION_PASS_TURN or action::ACTION_WALK, depending on the result of GetCanMoveFlag for the monster's ID. +// monster_action: Pointer to the monster's action field +// monster_id: Monster ID +void SetActionPassTurnOrWalk(struct action_data *monster_action, s16 monster_id); #endif //PMDSKY_DUNGEON_ACTION_H diff --git a/main.lsf b/main.lsf index 35b3910f..26e23b22 100644 --- a/main.lsf +++ b/main.lsf @@ -277,7 +277,7 @@ Overlay OVY_29 Object src/dg_random.o Object asm/overlay_29_022EAB50.o Object src/dungeon_action.o - Object asm/overlay_29_022EB41C.o + Object asm/overlay_29_022EB44C.o Object src/overlay_29_022EC608.o Object asm/overlay_29_022EC62C.o Object src/overlay_29_022ECDC0.o diff --git a/src/dungeon_action.c b/src/dungeon_action.c index 2f315037..284a22e3 100644 --- a/src/dungeon_action.c +++ b/src/dungeon_action.c @@ -1,5 +1,7 @@ #include "dungeon_action.h" +extern bool8 GetCanMoveFlag(s16 monster_id); + void ClearMonsterActionFields(struct action_data *monster_action) { monster_action->action_id = ACTION_NOTHING; @@ -13,3 +15,17 @@ void SetMonsterActionFields(struct action_data *monster_action, enum action acti monster_action->action_parameters[0].action_use_idx = 0; monster_action->action_parameters[1].action_use_idx = 0; } + +void SetActionPassTurnOrWalk(struct action_data *monster_action, s16 monster_id) +{ + if (GetCanMoveFlag(monster_id)) + { + monster_action->action_id = ACTION_WALK; + } + else + { + monster_action->action_id = ACTION_PASS_TURN; + } + monster_action->action_parameters[0].action_use_idx = 0; + monster_action->action_parameters[1].action_use_idx = 0; +} diff --git a/src/dungeon_ai.c b/src/dungeon_ai.c index db9040f8..e87d3418 100644 --- a/src/dungeon_ai.c +++ b/src/dungeon_ai.c @@ -26,7 +26,6 @@ extern struct dungeon *DUNGEON_PTR[]; extern void EndFrozenClassStatus(struct entity *user, struct entity *target, bool8 log); extern void SubstitutePlaceholderStringTags(u8 *string_id, struct entity *entity, u32 param_3); extern void LogMessageByIdWithPopupCheckUser(struct entity *user, u32 message_id); -extern void SetActionPassTurnOrWalk(struct action_data *monster_action, s16 monster_id); extern void ChooseAiMove(struct entity *monster); extern bool8 GetCanMoveFlag(s16 monster_id); extern void AiMovement(struct entity *monster, bool8 show_run_away_effect); diff --git a/src/status_checks.c b/src/status_checks.c index 7249eafc..98592a5d 100644 --- a/src/status_checks.c +++ b/src/status_checks.c @@ -19,7 +19,6 @@ extern void SubstitutePlaceholderStringTags(u8 *string_id, struct entity *entity, u32 param_3); extern void LogMessageByIdWithPopupCheckUser(struct entity *user, u32 message_id); -extern void SetActionPassTurnOrWalk(struct action_data *monster_action, s16 monster_id); extern bool8 CanMonsterMoveInDirection(struct entity *monster, u8 direction); extern void ChooseAiMove(struct entity *monster);