Skip to content

Commit b085fb4

Browse files
Decomped ShouldMonsterFollowLeader
1 parent f02fe26 commit b085fb4

File tree

8 files changed

+36
-38
lines changed

8 files changed

+36
-38
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#pragma once
22
.public CanTargetEntity
3-
.public DoesTacticFollowLeader
43
.public GetLeader
54
.public GetTreatmentBetweenMonsters

asm/overlay_29_023082A0.s renamed to asm/overlay_29_023082C4.s

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
.include "asm/macros.inc"
2-
.include "overlay_29_023082A0.inc"
2+
.include "overlay_29_023082C4.inc"
33

44
.text
55

6-
arm_func_start ShouldMonsterFollowLeader
7-
ShouldMonsterFollowLeader: ; 0x023082A0
8-
stmdb sp!, {r3, lr}
9-
ldr r1, [r0, #0xb4]
10-
ldrb r0, [r1, #6]
11-
cmp r0, #0
12-
movne r0, #0
13-
ldmneia sp!, {r3, pc}
14-
ldrb r0, [r1, #0xa8]
15-
bl DoesTacticFollowLeader
16-
ldmia sp!, {r3, pc}
17-
arm_func_end ShouldMonsterFollowLeader
18-
196
arm_func_start GetLeaderIfVisible
207
GetLeaderIfVisible: ; 0x023082C4
218
stmdb sp!, {r3, r4, r5, lr}

include/dungeon_ai_leader.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef PMDSKY_DUNGEON_AI_LEADER_H
2+
#define PMDSKY_DUNGEON_AI_LEADER_H
3+
4+
#include "dungeon_mode.h"
5+
6+
// Checks if an entity pointer points to a valid entity (not entity type 0, which represents no entity).
7+
bool8 EntityIsValid__0230827C(struct entity *entity);
8+
// Checks if the monster should follow the leader. Always returns false for enemy monsters.
9+
// This function may actually be should monster target leader position.
10+
bool8 ShouldMonsterFollowLeader(struct entity *monster);
11+
12+
#endif //PMDSKY_DUNGEON_AI_LEADER_H

include/overlay_29_0230827C.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

main.lsf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ Overlay OVY_29
499499
Object asm/overlay_29_02305C28.o
500500
Object src/overlay_29_02307EF8.o
501501
Object asm/overlay_29_02307F4C.o
502-
Object src/overlay_29_0230827C.o
503-
Object asm/overlay_29_023082A0.o
502+
Object src/dungeon_ai_leader.o
503+
Object asm/overlay_29_023082C4.o
504504
Object src/dungeon_ai.o
505505
Object asm/overlay_29_023085DC.o
506506
Object src/overlay_29_02308FBC.o

src/dungeon_ai_leader.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "dungeon_ai_leader.h"
2+
#include "dungeon_util_static.h"
3+
4+
extern bool8 DoesTacticFollowLeader(enum tactic_id tactic_id);
5+
6+
bool8 EntityIsValid__0230827C(struct entity *entity)
7+
{
8+
if (entity == NULL)
9+
return FALSE;
10+
11+
return GetEntityType(entity) != ENTITY_NOTHING;
12+
}
13+
14+
bool8 ShouldMonsterFollowLeader(struct entity *monster)
15+
{
16+
if (GetEntInfo(monster)->is_not_team_member)
17+
return FALSE;
18+
19+
return DoesTacticFollowLeader(GetEntInfo(monster)->tactic);
20+
}

src/dungeon_ai_movement.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "dg_camera.h"
33
#include "dg_random.h"
44
#include "dungeon_action.h"
5+
#include "dungeon_ai_leader.h"
56
#include "dungeon_ai_targeting.h"
67
#include "dungeon_ai_targeting_1.h"
78
#include "dungeon_capabilities_1.h"
@@ -19,7 +20,6 @@
1920
#include "number_util.h"
2021
#include "overlay_29_022E1610.h"
2122
#include "overlay_29_022FA430.h"
22-
#include "overlay_29_0230827C.h"
2323
#include "overlay_29_02348D00.h"
2424
#include "position_util.h"
2525

@@ -48,7 +48,6 @@ const s32 FACING_DIRECTION_INCREMENTS[] = {0, 1, -1, 2, -2, 3, -3, 4};
4848

4949
extern bool8 CanTargetEntity(struct entity *user, struct entity *target);
5050
extern bool8 CanTargetPosition(struct entity *monster, struct position *position);
51-
extern bool8 ShouldMonsterFollowLeader(struct entity *monster);
5251
extern bool8 IsPositionWithinTwoTiles(struct position *origin, struct position *target);
5352
extern s32 ov29_022FBE04(struct monster*);
5453
extern bool8 CanMoveThroughWalls(struct entity *monster);

src/overlay_29_0230827C.c

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)