sub_805EFB4

This commit is contained in:
DizzyEggg 2024-07-21 23:01:29 +02:00
parent afc77f701f
commit 466baf4710
2 changed files with 47 additions and 108 deletions

View File

@ -5,115 +5,7 @@
.text
thumb_func_start sub_805EF60
sub_805EF60:
push {r4-r6,lr}
adds r5, r0, 0
adds r6, r1, 0
bl sub_80696A8
adds r4, r0, 0
cmp r4, 0
beq _0805EF9E
adds r0, r4, 0
bl GetEntityType
cmp r0, 0x1
bne _0805EF9E
adds r0, r5, 0
bl sub_8070BC0
lsls r0, 24
cmp r0, 0
beq _0805EF9E
ldr r1, [r4, 0x70]
ldrb r0, [r1, 0x6]
cmp r0, 0
beq _0805EFA2
adds r0, r1, 0
adds r0, 0xA4
ldrb r0, [r0]
cmp r0, 0x1
beq _0805EFA2
ldrb r0, [r1, 0x8]
cmp r0, 0x1
beq _0805EFA2
_0805EF9E:
movs r0, 0
b _0805EFAE
_0805EFA2:
adds r0, r6, 0
adds r0, 0x44
movs r1, 0x13
bl SetMonsterActionFields
movs r0, 0x1
_0805EFAE:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_805EF60
thumb_func_start sub_805EFB4
sub_805EFB4:
push {r4-r7,lr}
mov r7, r8
push {r7}
mov r8, r0
lsls r1, 24
lsrs r7, r1, 24
bl GetLeaderInfo
adds r6, r0, 0
cmp r7, 0
beq _0805EFE2
adds r0, 0xBC
ldrb r0, [r0]
cmp r0, 0x4
bne _0805EFE2
adds r0, r6, 0
adds r0, 0x46
ldrb r1, [r0]
adds r1, 0x4
movs r2, 0x7
ands r1, r2
strb r1, [r0]
b _0805F020
_0805EFE2:
adds r0, r6, 0
adds r0, 0xBC
ldrb r0, [r0]
cmp r0, 0x2
bne _0805F020
movs r0, 0x8
bl DungeonRandInt
adds r4, r0, 0
movs r5, 0
_0805EFF6:
cmp r7, 0
bne _0805F008
mov r0, r8
adds r1, r4, 0
bl CanMoveInDirection
lsls r0, 24
cmp r0, 0
beq _0805F014
_0805F008:
movs r0, 0x7
ands r4, r0
adds r0, r6, 0
adds r0, 0x46
strb r4, [r0]
b _0805F020
_0805F014:
adds r4, 0x1
movs r0, 0x7
ands r4, r0
adds r5, 0x1
cmp r5, 0x7
ble _0805EFF6
_0805F020:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_805EFB4
thumb_func_start sub_805F02C
sub_805F02C:

View File

@ -7,6 +7,7 @@
#include "dungeon_action.h"
#include "dungeon_ai_targeting.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "trap.h"
#include "charge_move.h"
@ -2685,3 +2686,49 @@ void sub_805EE30(void)
break;
}
}
extern Entity *sub_80696A8(Entity *a0);
bool8 sub_805EF60(Entity *a0, EntityInfo *a1)
{
Entity *r4 = sub_80696A8(a0);
if (r4 == NULL)
return FALSE;
if (GetEntityType(r4) != ENTITY_MONSTER)
return FALSE;
if (!sub_8070BC0(a0))
return FALSE;
if (r4->info->isNotTeamMember && r4->info->clientType != 1 && r4->info->shopkeeper != 1)
return FALSE;
SetMonsterActionFields(&a1->action, ACTION_TALK_FIELD);
return TRUE;
}
void sub_805EFB4(Entity *a0, bool8 a1)
{
s32 i;
EntityInfo *leaderInfo = GetLeaderInfo();
if (a1 && leaderInfo->volatileStatus.volatileStatus == STATUS_COWERING) {
leaderInfo->action.direction += 4;
leaderInfo->action.direction &= 7;
}
else if (leaderInfo->volatileStatus.volatileStatus == STATUS_CONFUSED) {
s32 rnd = DungeonRandInt(8);
for (i = 0; i < 8; i++) {
if (a1 || CanMoveInDirection(a0, rnd)) {
leaderInfo->action.direction = rnd & 7;
return;
}
rnd = (rnd + 1) & 7;
}
}
}
/*
void sub_805F02C(void)
{
}
*/