Decomped CanSeeTeammate

This commit is contained in:
AnonymousRandomPerson 2025-11-15 22:45:04 -05:00
parent 12e467d633
commit 045b081c48
5 changed files with 18 additions and 47 deletions

View File

@ -1,10 +1,7 @@
#pragma once
.public CanLearnIqSkill
.public CanSeeTarget
.public DisableIqSkill
.public DUNGEON_PTR
.public EnableIqSkill
.public EntityIsValid__023000E4
.public GetPerformanceFlagWithChecks
.public GetSpeciesIqSkill
.public IqSkillFlagTest

View File

@ -174,46 +174,3 @@ ov29_023021F0: ; 0x023021F0
.align 2, 0
_023021FC: .word UpdateIqSkills
arm_func_end ov29_023021F0
arm_func_start CanSeeTeammate
CanSeeTeammate: ; 0x02302200
stmdb sp!, {r3, r4, r5, r6, r7, lr}
mov r4, r0
ldr r0, [r4, #0xb4]
ldrb r0, [r0, #6]
cmp r0, #0
movne r0, #0
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
mov r6, #0
ldr r5, _02302278 ; =DUNGEON_PTR
b _02302268
_02302228:
ldr r1, [r5]
mov r0, r4
add r1, r1, r6, lsl #2
add r1, r1, #0x12000
#ifdef JAPAN
ldr r7, [r1, #0xa84]
#else
ldr r7, [r1, #0xb28]
#endif
bl EntityIsValid__023000E4
cmp r0, #0
cmpne r4, r7
beq _02302264
mov r0, r4
mov r1, r7
bl CanSeeTarget
cmp r0, #0
movne r0, #1
ldmneia sp!, {r3, r4, r5, r6, r7, pc}
_02302264:
add r6, r6, #1
_02302268:
cmp r6, #4
blt _02302228
mov r0, #0
ldmia sp!, {r3, r4, r5, r6, r7, pc}
.align 2, 0
_02302278: .word DUNGEON_PTR
arm_func_end CanSeeTeammate

View File

@ -3,6 +3,8 @@
#include "dungeon_mode.h"
// Checks if an allied monster can see any other teammate (via CanSeeTarget). Always returns false for enemy monsters.
bool8 CanSeeTeammate(struct entity *monster);
// Check the type of a move when used by a certain monster. Accounts for special cases such as Hidden Power, Weather Ball, the regular attack...
enum type_id GetMoveTypeForMonster(struct entity *entity, struct move *move);

View File

@ -7,6 +7,7 @@
#include "dungeon_ai_targeting_1.h"
#include "dungeon_capabilities_1.h"
#include "dungeon_capabilities_4.h"
#include "dungeon_logic_5.h"
#include "dungeon_logic_7.h"
#include "dungeon_logic_8.h"
#include "dungeon_map_access.h"
@ -50,7 +51,6 @@ struct can_move_in_direction_info
const s32 FACING_DIRECTION_INCREMENTS[] = {0, 1, -1, 2, -2, 3, -3, 4};
extern bool8 ShouldAvoidFirstHit(struct entity *monster, bool8 force_avoid);
extern bool8 CanSeeTeammate(struct entity *monster);
extern struct entity* GetLeaderIfVisible(struct entity *monster);
extern bool8 IsAtJunction(struct entity *monster);

View File

@ -1,12 +1,27 @@
#include "dungeon_logic_5.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util_static.h"
#include "dungeon_visibility.h"
#include "main_02014CEC.h"
#include "moves_2.h"
#include "natural_gift_data.h"
#include "overlay_29_023000E4.h"
#include "special_move_types.h"
bool8 CanSeeTeammate(struct entity *monster)
{
if (GetEntInfo(monster)->is_not_team_member)
return FALSE;
for (s32 member_idx = 0; member_idx < MAX_TEAM_MEMBERS; member_idx++)
{
struct entity *team_member = DUNGEON_PTR[0]->monster_slots.party_members[member_idx];
if (EntityIsValid__023000E4(monster) && monster != team_member && CanSeeTarget(monster, team_member))
return TRUE;
}
return FALSE;
}
enum type_id GetMoveTypeForMonster(struct entity *entity, struct move *move)
{
if (!IsRegularAttackOrProjectile(move->id) && EntityIsValid__023000E4(entity) && AbilityIsActive(entity, ABILITY_NORMALIZE))