mirror of
https://github.com/pret/pmd-sky.git
synced 2026-03-21 17:25:15 -05:00
Decomped CanTargetEntity
This commit is contained in:
parent
b7494f9fc1
commit
14ee177a38
|
|
@ -1,8 +1,7 @@
|
|||
#pragma once
|
||||
.public abs
|
||||
.public CanSeeInvisibleMonsters
|
||||
.public DrawMinimapTile
|
||||
.public DUNGEON_PTR
|
||||
.public DrawMinimapTile
|
||||
.public EntityIsValid__022E1A1C
|
||||
.public EntityIsValid__022E32E8
|
||||
.public GetForcedLossReason
|
||||
|
|
@ -13,6 +12,14 @@
|
|||
.public IsPositionActuallyInSight
|
||||
.public IsPositionInSight
|
||||
.public ItemIsActive__022E330C
|
||||
.public PrepareItemForPrinting2
|
||||
.public SetPreprocessorArgsStringToName
|
||||
.public StringFromId
|
||||
.public SubstitutePlaceholderTrapTags
|
||||
.public TeamMemberHasEnabledIqSkill
|
||||
.public UpdateMinimap
|
||||
.public UpdateTrapsVisibility
|
||||
.public abs
|
||||
.public ov29_022E34C8
|
||||
.public ov29_022E3534
|
||||
.public ov29_022E3A58
|
||||
|
|
@ -22,13 +29,6 @@
|
|||
.public ov29_0233711C
|
||||
.public ov29_023372A4
|
||||
.public ov29_0237C84C
|
||||
.public PrepareItemForPrinting2
|
||||
.public SetPreprocessorArgsStringToName
|
||||
.public strcpy
|
||||
.public StringFromId
|
||||
.public sub_02009194
|
||||
.public sub_020091B0
|
||||
.public SubstitutePlaceholderTrapTags
|
||||
.public TeamMemberHasEnabledIqSkill
|
||||
.public UpdateMinimap
|
||||
.public UpdateTrapsVisibility
|
||||
|
|
@ -1,63 +1,8 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "overlay_29_022E2810.inc"
|
||||
.include "overlay_29_022E28D4.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start CanTargetEntity
|
||||
CanTargetEntity: ; 0x022E2810
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
mov r5, r0
|
||||
mov r4, r1
|
||||
bl EntityIsValid__022E1A1C
|
||||
cmp r0, #0
|
||||
moveq r0, #0
|
||||
ldmeqia sp!, {r3, r4, r5, pc}
|
||||
mov r0, r4
|
||||
bl EntityIsValid__022E1A1C
|
||||
cmp r0, #0
|
||||
moveq r0, #0
|
||||
ldmeqia sp!, {r3, r4, r5, pc}
|
||||
ldrb r0, [r4, #0x20]
|
||||
cmp r0, #0
|
||||
moveq r0, #0
|
||||
ldmeqia sp!, {r3, r4, r5, pc}
|
||||
ldr r0, [r4]
|
||||
cmp r0, #1
|
||||
bne _022E28B8
|
||||
ldr r0, [r5]
|
||||
cmp r0, #1
|
||||
bne _022E28A4
|
||||
mov r0, r5
|
||||
bl CanSeeInvisibleMonsters
|
||||
cmp r0, #0
|
||||
ldreq r0, [r4, #0xb4]
|
||||
ldreqb r0, [r0, #0xef]
|
||||
cmpeq r0, #1
|
||||
moveq r0, #0
|
||||
ldmeqia sp!, {r3, r4, r5, pc}
|
||||
mov r0, r5
|
||||
mov r1, #1
|
||||
bl IsBlinded
|
||||
cmp r0, #0
|
||||
beq _022E28B8
|
||||
mov r0, #0
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
_022E28A4:
|
||||
ldr r0, [r4, #0xb4]
|
||||
ldrb r0, [r0, #0xef]
|
||||
cmp r0, #1
|
||||
moveq r0, #0
|
||||
ldmeqia sp!, {r3, r4, r5, pc}
|
||||
_022E28B8:
|
||||
mov r0, r5
|
||||
bl HasDropeyeStatus
|
||||
mov r2, r0
|
||||
add r0, r5, #4
|
||||
add r1, r4, #4
|
||||
bl IsPositionInSight
|
||||
ldmia sp!, {r3, r4, r5, pc}
|
||||
arm_func_end CanTargetEntity
|
||||
|
||||
arm_func_start ov29_022E28D4
|
||||
ov29_022E28D4: ; 0x022E28D4
|
||||
stmdb sp!, {r3, r4, r5, lr}
|
||||
|
|
@ -7,5 +7,9 @@
|
|||
// Calls IsPositionActuallyInSight. Also checks if the user is blinded, if the target is invisible, etc.
|
||||
// This function is almost the same as CanTargetEntity, the only difference is that the latter calls IsPositionInSight instead.
|
||||
bool8 CanSeeTarget(struct entity *user, struct entity *target);
|
||||
// Checks if a monster can target another entity when controlled by the AI.
|
||||
// More specifically, it checks if the target is invisible, if the user can see invisible monsters, if the user is blinded and if the target position is in sight from the position of the user (this last check is done by calling IsPositionInSight with the user's and the target's position).
|
||||
// This function is almost the same as CanSeeTarget, the only difference is that the latter calls IsPositionActuallyInSight instead.
|
||||
bool8 CanTargetEntity(struct entity *user, struct entity *target);
|
||||
|
||||
#endif //PMDSKY_DUNGEON_VISIBILITY_H
|
||||
|
|
|
|||
2
main.lsf
2
main.lsf
|
|
@ -379,7 +379,7 @@ Overlay OVY_29
|
|||
Object src/dg_object.o
|
||||
Object asm/overlay_29_022E1AD4.o
|
||||
Object src/dungeon_visibility.o
|
||||
Object asm/overlay_29_022E2810.o
|
||||
Object asm/overlay_29_022E28D4.o
|
||||
Object src/dg_camera.o
|
||||
Object asm/overlay_29_022E335C.o
|
||||
Object src/dg_effect.o
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ struct can_move_in_direction_info
|
|||
|
||||
const s32 FACING_DIRECTION_INCREMENTS[] = {0, 1, -1, 2, -2, 3, -3, 4};
|
||||
|
||||
extern bool8 CanTargetEntity(struct entity *user, struct entity *target);
|
||||
extern bool8 CanTargetPosition(struct entity *monster, struct position *position);
|
||||
extern bool8 IsPositionWithinTwoTiles(struct position *origin, struct position *target);
|
||||
extern s32 ov29_022FBE04(struct monster*);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include "dungeon_statuses.h"
|
||||
#include "dungeon_util_static.h"
|
||||
|
||||
extern bool8 IsPositionInSight(struct position *origin, struct position *target, bool8 user_has_dropeye);
|
||||
|
||||
bool8 CanSeeTarget(struct entity *user, struct entity *target)
|
||||
{
|
||||
if (!EntityIsValid__022E1A1C(user))
|
||||
|
|
@ -32,3 +34,30 @@ bool8 CanSeeTarget(struct entity *user, struct entity *target)
|
|||
|
||||
return IsPositionActuallyInSight(&user->pos, &target->pos, HasDropeyeStatus(user));
|
||||
}
|
||||
|
||||
bool8 CanTargetEntity(struct entity *user, struct entity *target)
|
||||
{
|
||||
if (!EntityIsValid__022E1A1C(user))
|
||||
return FALSE;
|
||||
|
||||
if (!EntityIsValid__022E1A1C(target))
|
||||
return FALSE;
|
||||
|
||||
if (!target->is_visible)
|
||||
return FALSE;
|
||||
|
||||
if (target->type == ENTITY_MONSTER)
|
||||
{
|
||||
if (user->type == ENTITY_MONSTER)
|
||||
{
|
||||
if (!CanSeeInvisibleMonsters(user) && GetEntInfo(target)->invisible_class_status.status == STATUS_INVISIBLE_INVISIBLE)
|
||||
return FALSE;
|
||||
|
||||
if (IsBlinded(user, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
else if (GetEntInfo(target)->invisible_class_status.status == STATUS_INVISIBLE_INVISIBLE)
|
||||
return FALSE;
|
||||
}
|
||||
return IsPositionInSight(&user->pos, &target->pos, HasDropeyeStatus(user));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user