Decomped ShouldMonsterRunAwayAndShowEffectOutlawCheck

This commit is contained in:
AnonymousRandomPerson 2025-10-22 21:31:42 -04:00
parent e055041d01
commit ed11a850e9
5 changed files with 47 additions and 43 deletions

View File

@ -1,4 +1,22 @@
#pragma once
.public DTCM_BSS
.public EnableIrqFlag
.public G3_MultMtx43
.public GeomSetTexImageParam
.public GeomSetVertexCoord16
.public GetAllBaseForms
.public GetWindow
.public MONSTER_DATA_TABLE_PTR
.public MemcpyFast
.public MemsetFast
.public OS_IRQTable
.public RENDER_3D
.public RENDER_3D_FUNCTIONS
.public Rgb8ToRgb5
.public SetIrqFlag
.public TRIG_TABLE
.public UpdateWindow
.public WINDOW_LIST
.public _02099724
.public _02099734
.public _02099744
@ -10,23 +28,7 @@
.public _022A88FC
.public _022B966C
.public _022B99D0
.public DTCM_BSS
.public EnableIrqFlag
.public G3_MultMtx43
.public GeomSetTexImageParam
.public GeomSetVertexCoord16
.public GetAllBaseForms
.public GetWindow
.public MemcpyFast
.public MemsetFast
.public MONSTER_DATA_TABLE_PTR
.public OS_IRQTable
.public ov29_02353530
.public RENDER_3D
.public RENDER_3D_FUNCTIONS
.public Rgb8ToRgb5
.public SetIrqFlag
.public ShouldMonsterRunAwayAndShowEffect
.public sub_0201BD50
.public sub_0201BD80
.public sub_0202760C
@ -37,6 +39,3 @@
.public sub_0207A324
.public sub_02080EF0
.public sub_02080F30
.public TRIG_TABLE
.public UpdateWindow
.public WINDOW_LIST

View File

@ -2791,21 +2791,3 @@ _01FFA37C:
.align 2, 0
_01FFA38C: .word ov29_02353530
arm_func_end sub_01FF9F80
arm_func_start ShouldMonsterRunAwayAndShowEffectOutlawCheck
ShouldMonsterRunAwayAndShowEffectOutlawCheck: ; 0x01FFA390
stmdb sp!, {r3, r4, r5, lr}
mov r4, #0
mov r5, r0
bl ShouldMonsterRunAwayAndShowEffect
cmp r0, #0
movne r4, #1
bne _01FFA3BC
ldr r0, [r5, #0xb4]
ldrb r0, [r0, #0xbc]
cmp r0, #3
moveq r4, #1
_01FFA3BC:
mov r0, r4
ldmia sp!, {r3, r4, r5, pc}
arm_func_end ShouldMonsterRunAwayAndShowEffectOutlawCheck

View File

@ -3,6 +3,11 @@
#include "dungeon_mode.h"
// Calls ShouldMonsterRunAwayAndShowEffect. If the result is true, returns true. Otherwise, returns true only if the monster's behavior field is equal to monster_behavior::BEHAVIOR_FLEEING_OUTLAW.
// monster: Entity pointer
// show_run_away_effect: Boolean value. If true, display a visual "poof" effect if the Run Away ability caused the monster to run away.
// return: True if ShouldMonsterRunAway returns true or the monster is a fleeing outlaw
bool8 ShouldMonsterRunAwayAndShowEffectOutlawCheck(struct entity *monster, bool8 show_run_away_effect);
// Used by the AI to determine the direction in which a monster should move
// monster: Entity pointer
// show_run_away_effect: If the monster becomes terrified, this flag determines whether the "poof" visual effect will show.

View File

@ -2,6 +2,7 @@
#include "dg_camera.h"
#include "dg_random.h"
#include "dungeon_action.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_ai_targeting_1.h"
#include "dungeon_capabilities_1.h"
#include "dungeon_capabilities_4.h"
@ -16,6 +17,7 @@
#include "math.h"
#include "number_util.h"
#include "overlay_29_022E1610.h"
#include "overlay_29_022FA430.h"
#include "overlay_29_0230827C.h"
#include "position_util.h"
@ -47,8 +49,6 @@ extern bool8 CanTargetPosition(struct entity *monster, struct position *position
extern s32 GetChebyshevDistance(struct position *position_a, struct position *position_b);
extern bool8 IsBagFull();
extern bool8 ShouldMonsterFollowLeader(struct entity *monster);
extern bool8 ShouldMonsterHeadToStairs(struct entity *entity);
extern bool8 ShouldMonsterRunAwayAndShowEffectOutlawCheck(struct entity* monster, bool8 show_run_away_effect);
extern bool8 IsPositionWithinTwoTiles(struct position *origin, struct position *target);
extern s32 ov29_022FBE04(struct monster*);
extern bool8 CanMoveThroughWalls(struct entity *monster);
@ -58,6 +58,18 @@ extern struct entity* GetLeaderIfVisible(struct entity *monster);
extern bool8 ov29_02348D00(struct item*);
extern bool8 IsAtJunction(struct entity *monster);
bool8 ShouldMonsterRunAwayAndShowEffectOutlawCheck(struct entity *monster, bool8 show_run_away_effect)
{
bool8 should_run_away = FALSE;
if (ShouldMonsterRunAwayAndShowEffect(monster, show_run_away_effect))
should_run_away = TRUE;
else if (GetEntInfo(monster)->monster_behavior == BEHAVIOR_FLEEING_OUTLAW)
should_run_away = TRUE;
return should_run_away;
}
// https://decomp.me/scratch/2QnEr
#ifdef NONMATCHING
void AiMovement(struct entity *monster, bool8 show_run_away_effect)

View File

@ -136,18 +136,24 @@ for i, line in enumerate(lsf_lines):
if not include_new_asm_file and merge_prev_file is None:
next_line = lsf_lines[i + 1]
if next_line.startswith(SRC_LSF_PREFIX):
merge_next_file = next_line[len(SRC_LSF_PREFIX) : -3]
merge_next_file = next_line[len(SRC_LSF_PREFIX):]
if merge_prev_file is None and merge_next_file is None:
lsf_lines[i] += f'\tObject src/{extract_file_name}.o{lsf_suffix}\n'
if include_new_asm_file:
lsf_lines[i] += f'\tObject asm/{new_asm_base_name}.o{lsf_suffix}\n'
break
if merge_prev_file is not None:
def trim_merge_file_name(file_name: str) -> str:
if file_name is None:
return None
line_end_index = len('.o\n')
if merge_prev_file.endswith('.o (.itcm)\n'):
if file_name.endswith('.o (.itcm)\n'):
line_end_index = len('.o (.itcm)\n')
merge_prev_file = merge_prev_file[:-line_end_index]
return file_name[:-line_end_index]
merge_prev_file = trim_merge_file_name(merge_prev_file)
merge_next_file = trim_merge_file_name(merge_next_file)
print('Updating', LSF_FILE_PATH)
with open(LSF_FILE_PATH, 'w') as lsf_file: