Decomped SetActionPassTurnOrWalk

This commit is contained in:
AnonymousRandomPerson
2025-05-28 22:15:40 -04:00
parent 58a940eedb
commit ec1d9cccf4
7 changed files with 41 additions and 42 deletions

View File

@@ -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

View File

@@ -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}

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);