More decomp

This commit is contained in:
Seth Barberee 2024-09-20 10:23:42 -07:00
parent 3311aa476e
commit 9d99557618
6 changed files with 663 additions and 661 deletions

View File

@ -1157,634 +1157,4 @@ _0806F440:
bx r0
thumb_func_end sub_806F370
thumb_func_start SetShopkeeperAggression
SetShopkeeperAggression:
push {r4-r6,lr}
adds r5, r0, 0
ldr r4, [r1, 0x70]
adds r6, r4, 0
ldrb r0, [r4, 0x8]
cmp r0, 0
beq _0806F47A
adds r0, r5, 0
bl GetEntityType
cmp r0, 0x1
bne _0806F47A
ldr r0, [r5, 0x70]
ldrb r0, [r0, 0x6]
cmp r0, 0
beq _0806F476
movs r0, 0x2
strb r0, [r4, 0x8]
b _0806F47A
_0806F476:
movs r0, 0x3
strb r0, [r6, 0x8]
_0806F47A:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end SetShopkeeperAggression
thumb_func_start sub_806F480
sub_806F480:
push {lr}
lsls r1, 24
lsrs r1, 24
ldr r2, [r0, 0x70]
adds r3, r2, 0
ldrb r0, [r2, 0x8]
cmp r0, 0
beq _0806F49E
cmp r1, 0
beq _0806F49A
movs r0, 0x2
strb r0, [r2, 0x8]
b _0806F49E
_0806F49A:
movs r0, 0x3
strb r0, [r3, 0x8]
_0806F49E:
pop {r0}
bx r0
thumb_func_end sub_806F480
thumb_func_start sub_806F4A4
sub_806F4A4:
push {r4-r6,lr}
lsls r1, 24
lsrs r4, r1, 24
ldr r5, [r0, 0x70]
movs r1, 0xE
bl MonsterIsType
lsls r0, 24
cmp r0, 0
beq _0806F4CE
cmp r4, 0x1
beq _0806F4C0
cmp r4, 0x7
bne _0806F4CE
_0806F4C0:
adds r0, r5, 0
adds r0, 0xF5
ldrb r0, [r0]
cmp r0, 0
bne _0806F4CE
_0806F4CA:
movs r0, 0
b _0806F4F6
_0806F4CE:
movs r2, 0
lsls r0, r4, 3
ldr r6, _0806F4FC
adds r3, r5, 0
adds r3, 0x5C
adds r0, r4
lsls r1, r0, 2
_0806F4DC:
adds r0, r3, r2
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
adds r0, r6
movs r4, 0
ldrsh r0, [r0, r4]
cmp r0, 0
beq _0806F4CA
adds r2, 0x1
cmp r2, 0x1
ble _0806F4DC
movs r0, 0x1
_0806F4F6:
pop {r4-r6}
pop {r1}
bx r1
.align 2, 0
_0806F4FC: .4byte gTypeEffectivenessChart
thumb_func_end sub_806F4A4
thumb_func_start sub_806F500
sub_806F500:
ldr r0, _0806F5F4
ldr r0, [r0]
mov r12, r0
movs r0, 0x9A
lsls r0, 1
add r0, r12
movs r1, 0
strb r1, [r0]
str r1, [r0, 0x4]
strb r1, [r0, 0x8]
strb r1, [r0, 0x9]
movs r2, 0xA
strb r2, [r0, 0xA]
strb r2, [r0, 0xB]
movs r2, 0
movs r3, 0x1
strh r3, [r0, 0xC]
strh r3, [r0, 0xE]
strh r1, [r0, 0x10]
strh r1, [r0, 0x14]
strh r1, [r0, 0x12]
strh r1, [r0, 0x16]
strh r1, [r0, 0x18]
str r1, [r0, 0x1C]
str r1, [r0, 0x24]
str r1, [r0, 0x28]
movs r0, 0xB0
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F5F8
add r0, r12
strb r2, [r0]
movs r0, 0xB1
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F5FC
add r0, r12
strb r2, [r0]
movs r0, 0xB2
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F600
add r0, r12
strb r2, [r0]
movs r0, 0xB3
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F604
add r0, r12
strb r2, [r0]
movs r0, 0xB4
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F608
add r0, r12
strb r2, [r0]
movs r0, 0xB5
lsls r0, 1
add r0, r12
strb r2, [r0]
movs r0, 0xB6
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F60C
add r0, r12
strb r2, [r0]
ldr r0, _0806F610
add r0, r12
strb r2, [r0]
movs r0, 0xB7
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F614
add r0, r12
strb r2, [r0]
movs r0, 0xB8
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F618
add r0, r12
strb r2, [r0]
movs r0, 0xB9
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F61C
add r0, r12
strb r2, [r0]
movs r0, 0xBA
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F620
add r0, r12
strb r2, [r0]
movs r0, 0xBB
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F624
add r0, r12
strb r2, [r0]
movs r0, 0xBC
lsls r0, 1
add r0, r12
strb r2, [r0]
ldr r0, _0806F628
add r0, r12
strb r2, [r0]
movs r0, 0xBD
lsls r0, 1
add r0, r12
strb r2, [r0]
bx lr
.align 2, 0
_0806F5F4: .4byte gDungeon
_0806F5F8: .4byte 0x00000161
_0806F5FC: .4byte 0x00000163
_0806F600: .4byte 0x00000165
_0806F604: .4byte 0x00000167
_0806F608: .4byte 0x00000169
_0806F60C: .4byte 0x0000016b
_0806F610: .4byte 0x0000016d
_0806F614: .4byte 0x0000016f
_0806F618: .4byte 0x00000171
_0806F61C: .4byte 0x00000173
_0806F620: .4byte 0x00000175
_0806F624: .4byte 0x00000177
_0806F628: .4byte 0x00000179
thumb_func_end sub_806F500
thumb_func_start sub_806F62C
sub_806F62C:
ldr r1, _0806F638
lsls r0, 2
adds r0, r1
ldr r0, [r0]
bx lr
.align 2, 0
_0806F638: .4byte gUnknown_8106F7C
thumb_func_end sub_806F62C
thumb_func_start sub_806F63C
sub_806F63C:
push {lr}
ldr r1, _0806F658
ldr r1, [r1]
ldr r2, _0806F65C
adds r1, r2
ldr r1, [r1, 0x10]
cmp r1, r0
bne _0806F652
adds r0, r1, 0
bl sub_803F508
_0806F652:
pop {r0}
bx r0
.align 2, 0
_0806F658: .4byte gDungeon
_0806F65C: .4byte 0x000181e8
thumb_func_end sub_806F63C
thumb_func_start sub_806F660
sub_806F660:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
adds r6, r0, 0
mov r8, r1
ldr r0, [r6, 0x70]
mov r10, r0
ldr r4, [r1, 0x70]
movs r1, 0x1
negs r1, r1
mov r9, r1
movs r2, 0x4
ldrsh r0, [r4, r2]
bl GetBodySize
lsls r0, 24
lsrs r5, r0, 24
ldr r0, _0806F6C0
ldr r3, [r0]
ldr r1, _0806F6C4
adds r0, r3, r1
ldrh r2, [r0]
subs r0, r2, 0x4
lsls r0, 16
lsrs r0, 16
cmp r0, 0x1
bls _0806F702
lsls r0, r2, 16
asrs r1, r0, 16
cmp r1, 0x9
beq _0806F702
cmp r1, 0xF
beq _0806F702
adds r0, r2, 0
subs r0, 0x2C
lsls r0, 16
lsrs r0, 16
cmp r0, 0x4
bhi _0806F6CC
ldr r2, _0806F6C8
adds r0, r3, r2
ldrb r0, [r0]
cmp r0, 0
bne _0806F702
b _0806F8FC
.align 2, 0
_0806F6C0: .4byte gDungeon
_0806F6C4: .4byte 0x00003a14
_0806F6C8: .4byte 0x0000065c
_0806F6CC:
cmp r1, 0x31
bne _0806F6F0
ldr r1, _0806F6EC
adds r0, r3, r1
ldrb r0, [r0]
cmp r0, 0
bne _0806F6DC
b _0806F8FC
_0806F6DC:
movs r0, 0xCF
lsls r0, 1
bl sub_8097900
lsls r0, 24
cmp r0, 0
bne _0806F702
b _0806F8FC
.align 2, 0
_0806F6EC: .4byte 0x00000659
_0806F6F0:
ldr r2, _0806F834
adds r0, r3, r2
ldrb r0, [r0]
bl IsRecruitingEnabled
lsls r0, 24
cmp r0, 0
bne _0806F702
b _0806F8FC
_0806F702:
ldr r0, _0806F838
ldr r0, [r0]
ldr r3, _0806F83C
adds r0, r3
ldrb r0, [r0]
cmp r0, 0
beq _0806F712
b _0806F8FC
_0806F712:
ldrh r1, [r4, 0x2]
adds r0, r1, 0
subs r0, 0x90
lsls r0, 16
lsrs r0, 16
cmp r0, 0x2
bls _0806F766
lsls r0, r1, 16
asrs r1, r0, 16
ldr r0, _0806F840
cmp r1, r0
beq _0806F766
subs r0, 0x1
cmp r1, r0
beq _0806F766
adds r0, 0x2
cmp r1, r0
beq _0806F766
adds r0, 0x8A
cmp r1, r0
beq _0806F766
adds r0, 0x1
cmp r1, r0
beq _0806F766
adds r0, 0x4
cmp r1, r0
beq _0806F766
subs r0, 0x1
cmp r1, r0
beq _0806F766
adds r0, 0x2
cmp r1, r0
beq _0806F766
subs r0, 0x9
cmp r1, r0
beq _0806F766
adds r0, 0x1
cmp r1, r0
beq _0806F766
adds r0, 0x1
cmp r1, r0
bne _0806F776
_0806F766:
movs r1, 0x2
ldrsh r0, [r4, r1]
bl HasRecruitedMon
lsls r0, 24
cmp r0, 0
beq _0806F776
b _0806F8FC
_0806F776:
movs r2, 0x2
ldrsh r0, [r4, r2]
bl sub_806F9BC
lsls r0, 24
cmp r0, 0
bne _0806F786
b _0806F8FC
_0806F786:
movs r3, 0x4
ldrsh r1, [r6, r3]
mov r2, r8
movs r3, 0x4
ldrsh r0, [r2, r3]
subs r1, r0
cmp r1, 0
bge _0806F798
negs r1, r1
_0806F798:
cmp r1, 0x1
ble _0806F79E
b _0806F8FC
_0806F79E:
movs r0, 0x6
ldrsh r1, [r6, r0]
mov r2, r8
movs r3, 0x6
ldrsh r0, [r2, r3]
subs r1, r0
cmp r1, 0
bge _0806F7B0
negs r1, r1
_0806F7B0:
cmp r1, 0x1
ble _0806F7B6
b _0806F8FC
_0806F7B6:
adds r0, r4, 0
adds r0, 0x40
ldrb r0, [r0]
cmp r0, 0x4A
bne _0806F7C2
b _0806F8FC
_0806F7C2:
adds r0, r4, 0
adds r0, 0xA4
ldrb r0, [r0]
cmp r0, 0x1
bne _0806F7CE
b _0806F8FC
_0806F7CE:
mov r0, r8
adds r1, r6, 0
bl CanSeeTarget
lsls r0, 24
cmp r0, 0
bne _0806F7DE
b _0806F8FC
_0806F7DE:
bl sub_806F910
movs r0, 0xFA
lsls r0, 2
bl DungeonRandInt
adds r7, r0, 0
movs r1, 0x2
ldrsh r0, [r4, r1]
bl GetRecruitRate
lsls r0, 16
asrs r4, r0, 16
ldr r0, _0806F844
cmp r4, r0
bne _0806F800
b _0806F8FC
_0806F800:
adds r0, r6, 0
movs r1, 0x2E
bl HasHeldItem
lsls r0, 24
cmp r0, 0
beq _0806F816
ldr r0, _0806F848
movs r2, 0
ldrsh r0, [r0, r2]
adds r4, r0
_0806F816:
ldr r0, _0806F84C
mov r3, r10
ldrb r1, [r3, 0x9]
lsls r1, 1
adds r1, r0
movs r2, 0
ldrsh r0, [r1, r2]
adds r4, r0
cmp r7, r4
bge _0806F8FC
movs r4, 0
movs r0, 0x6
subs r3, r0, r5
ldr r7, _0806F850
b _0806F856
.align 2, 0
_0806F834: .4byte 0x00000644
_0806F838: .4byte gDungeon
_0806F83C: .4byte 0x0000065d
_0806F840: .4byte 0x0000010d
_0806F844: .4byte 0xfffffc19
_0806F848: .4byte gUnknown_80F5008
_0806F84C: .4byte gUnknown_80F5700
_0806F850: .4byte gUnknown_202EE70
_0806F854:
adds r4, 0x1
_0806F856:
cmp r4, r3
bgt _0806F878
movs r2, 0
cmp r2, r5
bge _0806F872
adds r1, r4, r7
b _0806F86C
_0806F864:
adds r1, 0x1
adds r2, 0x1
cmp r2, r5
bge _0806F872
_0806F86C:
ldrb r0, [r1]
cmp r0, 0
beq _0806F864
_0806F872:
cmp r2, r5
bne _0806F854
mov r9, r4
_0806F878:
movs r0, 0x1
negs r0, r0
cmp r9, r0
beq _0806F8F4
movs r4, 0
ldr r3, _0806F8BC
ldr r0, [r3]
ldr r2, _0806F8C0
adds r0, r2
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _0806F8B4
adds r7, r3, 0
adds r5, r2, 0
movs r2, 0
movs r3, 0x1
_0806F89C:
adds r2, 0x64
adds r4, 0x1
cmp r4, 0x3
bgt _0806F8B4
ldr r0, [r7]
adds r0, r2, r0
adds r0, r5
ldrb r1, [r0]
adds r0, r3, 0
ands r0, r1
cmp r0, 0
bne _0806F89C
_0806F8B4:
cmp r4, 0x4
beq _0806F8F4
movs r4, 0
b _0806F8C6
.align 2, 0
_0806F8BC: .4byte gRecruitedPokemonRef
_0806F8C0: .4byte 0x00008df8
_0806F8C4:
adds r4, 0x1
_0806F8C6:
cmp r4, 0x3
bgt _0806F8E2
ldr r0, _0806F8EC
ldr r0, [r0]
lsls r1, r4, 2
ldr r3, _0806F8F0
adds r0, r3
adds r0, r1
ldr r0, [r0]
bl EntityExists
lsls r0, 24
cmp r0, 0
bne _0806F8C4
_0806F8E2:
cmp r4, 0x4
beq _0806F8F4
movs r0, 0x1
b _0806F8FE
.align 2, 0
_0806F8EC: .4byte gDungeon
_0806F8F0: .4byte 0x0001357c
_0806F8F4:
adds r0, r6, 0
mov r1, r8
bl nullsub_96
_0806F8FC:
movs r0, 0
_0806F8FE:
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_806F660
.align 2,0
.align 2,0

View File

@ -49,5 +49,6 @@ void PrintDungeonLocationtoBuffer(u8 *buffer, DungeonLocation *dungeonLocation);
u32 sub_80908D8(DungeonLocation *dungeon);
u8 sub_8090910(DungeonLocation *dungeon, u32 param_2);
bool8 IsNotValidDungeon(u8 dungeon);
u8 IsRecruitingEnabled(u8 dungeon);
#endif // GUARD_DUNGEON_H

View File

@ -161,6 +161,36 @@ typedef struct UnkDungeonGlobal_unk1CD98
s16 unk2[2];
} UnkDungeonGlobal_unk1CD98;
struct unkStruct_Dungeon134_sub
{
u8 unk134;
u32 unk138;
u8 unk13C[2];
u8 unk13E[2];
u16 unk140[7];
u32 unk150;
u32 unk154;
u32 unk158;
u32 unk15C;
u8 unk160;
u8 unk161;
u8 unk162;
u8 unk163;
u8 unk164;
u8 unk165;
u8 unk166;
u8 unk167;
u8 unk168;
u8 unk169;
u8 unk16A;
u8 unk16B;
u8 unk16C;
u8 unk16D;
u8 fill16E[0x179 - 0x16E];
bool8 pokemonExposed;
u8 unk17A;
};
// size: 0x1CEDC
typedef struct Dungeon
{
@ -184,16 +214,8 @@ typedef struct Dungeon
u8 fill14[0xB8 - 0x16];
Entity *unkB8;
Entity *unkBC;
u8 fillC0[0x13C - 0xC0];
u8 unk13C[2];
u8 fill13E[0x16A - 0x13E];
u8 unk16A;
u8 unk16B;
u8 unk16C;
u8 unk16D;
u8 fill16E[0x179 - 0x16E];
/* 0x179 */ bool8 pokemonExposed; // True if a Pokémon on the floor has the Exposed status.
u8 fill17A[0x17C - 0x17A];
u8 fillC0[0x134 - 0xC0];
struct unkStruct_Dungeon134_sub unk134;
Dungeon_sub unk17C[0x100];
/* 0x57C */ u8 fill57C[0x5C0 - 0x57c];
/* 0x5C0 */ s32 unk5C0;

View File

@ -822,7 +822,7 @@ void sub_80420E8(Entity *pokemon, struct DamageStruct *dmgStruct)
u32 typeEffectiveness;
u32 arg;
typeEffectiveness = dmgStruct->typeEffectiveness;
if(gDungeon->unk16D != 0)
if(gDungeon->unk134.unk16D != 0)
typeEffectiveness = sub_806F62C(dmgStruct->typeEffectiveness);
switch(typeEffectiveness)
{

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "constants/type.h"
#include "structs/str_pokemon.h"
#include "code_8069D4C.h"
#include "code_80118A4.h"
@ -8,7 +9,12 @@
#include "code_806CD90.h"
#include "code_8077274_1.h"
#include "code_8097670.h"
#include "dungeon.h"
#include "dungeon_items.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_visibility.h"
#include "friend_area.h"
#include "pokemon.h"
#include "pokemon_3.h"
@ -16,11 +22,15 @@
#include "position_util.h"
#include "text_util.h"
#include "dungeon_util_1.h"
#include "type_chart.h"
extern u8 gUnknown_202E628[];
extern u8 gUnknown_202E088[];
extern u8 gAvailablePokemonNames[];
extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE];
extern s16 gUnknown_80F5008;
extern s16 gUnknown_80F5700[];
extern s32 gUnknown_8106F7C[];
extern u8 *gUnknown_80FA0F0[];
extern u8 *gUnknown_80FA058[];
@ -40,6 +50,605 @@ extern void PrintFieldMessage(u32, const u8 *, u32);
void sub_8083D88();
u8 sub_808529C(s32);
extern u8 GetBodySize(s16 index);
void nullsub_96(Entity *pokemon,Entity *target);
u8 sub_8097900(s16);
void sub_806F910(void);
u8 sub_806F9BC(s16);
extern void sub_803F508(Entity *);
void SetShopkeeperAggression(Entity *pokemon, Entity *target)
{
EntityInfo *info;
info = GetEntInfo(target);
if(info->shopkeeper != 0)
{
if(GetEntityType(pokemon) == ENTITY_MONSTER)
{
if(pokemon->info->isNotTeamMember)
{
info->shopkeeper = 2;
}
else
{
info->shopkeeper = 3;
}
}
}
}
void sub_806F480(Entity *pokemon, u8 r1)
{
EntityInfo *info;
info = GetEntInfo(pokemon);
if(info->shopkeeper != 0)
{
if(r1)
{
info->shopkeeper = 2;
}
else
{
info->shopkeeper = 3;
}
}
}
u8 sub_806F4A4(Entity *pokemon, u8 type) {
EntityInfo *info = pokemon->info;
s32 index;
if(MonsterIsType(pokemon, TYPE_GHOST))
{
if(type == TYPE_NORMAL || type == TYPE_FIGHTING)
if(!info->exposed)
return FALSE;
}
for(index = 0; index < 2; index++)
{
if(gTypeEffectivenessChart[type][info->types[index]] == EFFECTIVENESS_IMMUNE)
return FALSE;
}
return TRUE;
}
void sub_806F500(void)
{
struct unkStruct_Dungeon134_sub *temp;
temp = &gDungeon->unk134;
temp->unk134 = 0;
temp->unk138 = 0;
temp->unk13C[0] = 0;
temp->unk13C[1] = 0;
temp->unk13E[0] = 0xA;
temp->unk13E[1] = 0xA;
temp->unk140[0] = 1;
temp->unk140[1] = 1;
temp->unk140[2] = 0;
temp->unk140[4] = 0;
temp->unk140[3] = 0;
temp->unk140[5] = 0;
temp->unk140[6] = 0;
temp->unk150 = 0;
temp->unk158 = 0;
temp->unk15C = 0;
temp->unk160 = 0;
temp->unk161 = 0;
temp->unk162 = 0;
temp->unk163 = 0;
temp->unk164 = 0;
temp->unk165 = 0;
temp->unk166 = 0;
temp->unk167 = 0;
temp->unk168 = 0;
temp->unk169 = 0;
temp->unk16A = 0;
temp->unk16C = 0;
temp->unk16B = 0;
temp->unk16D = 0;
temp->fill16E[0] = 0;
temp->fill16E[1] = 0;
temp->fill16E[2] = 0;
temp->fill16E[3] = 0;
temp->fill16E[4] = 0;
temp->fill16E[5] = 0;
temp->fill16E[6] = 0;
temp->fill16E[7] = 0;
temp->fill16E[8] = 0;
temp->fill16E[9] = 0;
temp->fill16E[10] = 0;
temp->pokemonExposed = FALSE;
temp->unk17A = 0;
}
s32 sub_806F62C(int param_1)
{
return gUnknown_8106F7C[param_1];
}
void sub_806F63C(Entity *param_1)
{
unkDungeonGlobal_unk181E8_sub *temp;
temp = &gDungeon->unk181e8;
if (temp->cameraTarget == param_1) {
sub_803F508(temp->cameraTarget);
}
}
// https://decomp.me/scratch/2la6b - (96.72% matching - Seth)
#ifdef NONMATCHING
bool8 sub_806F660(Entity *pokemon,Entity *target)
{
EntityInfo *pokemonInfo;
EntityInfo *targetInfo;
s32 size;
int iVar4;
s32 iVar5;
s32 uVar6;
int recruitRate;
s32 iVar8;
s32 index;
pokemonInfo = pokemon->info;
targetInfo = target->info;
iVar8 = -1;
size = GetBodySize(targetInfo->apparentID);
if ((1 < ((u16)(gDungeon->bossBattleIndex - 4))) && (gDungeon->bossBattleIndex != 9) && (gDungeon->bossBattleIndex != 0xf)) {
if ((u16)(gDungeon->bossBattleIndex - 0x2cU) < 5) {
if (gDungeon->unk65C == 0) {
return FALSE;
}
}
else if (gDungeon->bossBattleIndex == 0x31) {
if (gDungeon->fill655[4] == 0) {
return FALSE;
}
if (sub_8097900(0x19e) == 0) {
return FALSE;
}
}
else {
if (IsRecruitingEnabled((gDungeon->dungeonLocation).id) == 0) {
return FALSE;
}
}
}
if (gDungeon->unk65D == 0)
{
if (((
(2 < (u16)(targetInfo->id - 0x90)) &&
(targetInfo->id != 0x10d) &&
(targetInfo->id != 0x10c) &&
(targetInfo->id != 0x10e) &&
(targetInfo->id != 0x198) &&
(targetInfo->id != 0x199) &&
(targetInfo->id != 0x19d) &&
(targetInfo->id != 0x19c) &&
(targetInfo->id != 0x19e) &&
(targetInfo->id != 0x195) &&
(targetInfo->id != 0x196) &&
(targetInfo->id != 0x197)) || (HasRecruitedMon(targetInfo->id) == 0)) &&
(sub_806F9BC(targetInfo->id) != 0)) {
iVar5 = (pokemon->pos).x - (target->pos).x;
if (iVar5 < 0) {
iVar5 = -iVar5;
}
if (iVar5 < 2) {
iVar5 = (pokemon->pos).y - (target->pos).y;
if (iVar5 < 0) {
iVar5 = -iVar5;
}
if (((iVar5 < 2) && (targetInfo->joinedAt.joinedAt != 0x4A)) &&
(targetInfo->clientType != 1 && (CanSeeTarget(target,pokemon))
)) {
sub_806F910();
iVar4 = DungeonRandInt(1000);
recruitRate = GetRecruitRate(targetInfo->id);
if (recruitRate != -999) {
if (HasHeldItem(pokemon,0x2e)) { // FRIEND_BOW
recruitRate += gUnknown_80F5008;
}
recruitRate += gUnknown_80F5700[pokemonInfo->level];
if (iVar4 < recruitRate) {
for (index = 0; index <= (6 - size); index++)
{
for(uVar6 = 0; uVar6 < size; uVar6++)
{
if (gUnknown_202EE70[index + uVar6] != 0) break;
}
iVar8 = index;
if (uVar6 == size)
break;
}
if (iVar8 != -1) {
for(index = 0; index < 4; index++)
{
if (((u8)(index[gRecruitedPokemonRef->pokemon2].unk0) & 1) == 0) break;
}
if (index != 4) {
for(index = 0; index < 4; index++)
{
if (EntityExists(gDungeon->teamPokemon[index]) == 0) break;
}
if (index != 4) {
return TRUE;
}
}
}
nullsub_96(pokemon,target);
}
}
}
}
}
}
return FALSE;
}
#else
NAKED
bool8 sub_806F660(Entity *pokemon,Entity *target)
{
asm_unified(
"\tpush {r4-r7,lr}\n"
"\tmov r7, r10\n"
"\tmov r6, r9\n"
"\tmov r5, r8\n"
"\tpush {r5-r7}\n"
"\tadds r6, r0, 0\n"
"\tmov r8, r1\n"
"\tldr r0, [r6, 0x70]\n"
"\tmov r10, r0\n"
"\tldr r4, [r1, 0x70]\n"
"\tmovs r1, 0x1\n"
"\tnegs r1, r1\n"
"\tmov r9, r1\n"
"\tmovs r2, 0x4\n"
"\tldrsh r0, [r4, r2]\n"
"\tbl GetBodySize\n"
"\tlsls r0, 24\n"
"\tlsrs r5, r0, 24\n"
"\tldr r0, _0806F6C0\n"
"\tldr r3, [r0]\n"
"\tldr r1, _0806F6C4\n"
"\tadds r0, r3, r1\n"
"\tldrh r2, [r0]\n"
"\tsubs r0, r2, 0x4\n"
"\tlsls r0, 16\n"
"\tlsrs r0, 16\n"
"\tcmp r0, 0x1\n"
"\tbls _0806F702\n"
"\tlsls r0, r2, 16\n"
"\tasrs r1, r0, 16\n"
"\tcmp r1, 0x9\n"
"\tbeq _0806F702\n"
"\tcmp r1, 0xF\n"
"\tbeq _0806F702\n"
"\tadds r0, r2, 0\n"
"\tsubs r0, 0x2C\n"
"\tlsls r0, 16\n"
"\tlsrs r0, 16\n"
"\tcmp r0, 0x4\n"
"\tbhi _0806F6CC\n"
"\tldr r2, _0806F6C8\n"
"\tadds r0, r3, r2\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0\n"
"\tbne _0806F702\n"
"\tb _0806F8FC\n"
"\t.align 2, 0\n"
"_0806F6C0: .4byte gDungeon\n"
"_0806F6C4: .4byte 0x00003a14\n"
"_0806F6C8: .4byte 0x0000065c\n"
"_0806F6CC:\n"
"\tcmp r1, 0x31\n"
"\tbne _0806F6F0\n"
"\tldr r1, _0806F6EC\n"
"\tadds r0, r3, r1\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0\n"
"\tbne _0806F6DC\n"
"\tb _0806F8FC\n"
"_0806F6DC:\n"
"\tmovs r0, 0xCF\n"
"\tlsls r0, 1\n"
"\tbl sub_8097900\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbne _0806F702\n"
"\tb _0806F8FC\n"
"\t.align 2, 0\n"
"_0806F6EC: .4byte 0x00000659\n"
"_0806F6F0:\n"
"\tldr r2, _0806F834\n"
"\tadds r0, r3, r2\n"
"\tldrb r0, [r0]\n"
"\tbl IsRecruitingEnabled\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbne _0806F702\n"
"\tb _0806F8FC\n"
"_0806F702:\n"
"\tldr r0, _0806F838\n"
"\tldr r0, [r0]\n"
"\tldr r3, _0806F83C\n"
"\tadds r0, r3\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0\n"
"\tbeq _0806F712\n"
"\tb _0806F8FC\n"
"_0806F712:\n"
"\tldrh r1, [r4, 0x2]\n"
"\tadds r0, r1, 0\n"
"\tsubs r0, 0x90\n"
"\tlsls r0, 16\n"
"\tlsrs r0, 16\n"
"\tcmp r0, 0x2\n"
"\tbls _0806F766\n"
"\tlsls r0, r1, 16\n"
"\tasrs r1, r0, 16\n"
"\tldr r0, _0806F840\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tsubs r0, 0x1\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tadds r0, 0x2\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tadds r0, 0x8A\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tadds r0, 0x1\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tadds r0, 0x4\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tsubs r0, 0x1\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tadds r0, 0x2\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tsubs r0, 0x9\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tadds r0, 0x1\n"
"\tcmp r1, r0\n"
"\tbeq _0806F766\n"
"\tadds r0, 0x1\n"
"\tcmp r1, r0\n"
"\tbne _0806F776\n"
"_0806F766:\n"
"\tmovs r1, 0x2\n"
"\tldrsh r0, [r4, r1]\n"
"\tbl HasRecruitedMon\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbeq _0806F776\n"
"\tb _0806F8FC\n"
"_0806F776:\n"
"\tmovs r2, 0x2\n"
"\tldrsh r0, [r4, r2]\n"
"\tbl sub_806F9BC\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbne _0806F786\n"
"\tb _0806F8FC\n"
"_0806F786:\n"
"\tmovs r3, 0x4\n"
"\tldrsh r1, [r6, r3]\n"
"\tmov r2, r8\n"
"\tmovs r3, 0x4\n"
"\tldrsh r0, [r2, r3]\n"
"\tsubs r1, r0\n"
"\tcmp r1, 0\n"
"\tbge _0806F798\n"
"\tnegs r1, r1\n"
"_0806F798:\n"
"\tcmp r1, 0x1\n"
"\tble _0806F79E\n"
"\tb _0806F8FC\n"
"_0806F79E:\n"
"\tmovs r0, 0x6\n"
"\tldrsh r1, [r6, r0]\n"
"\tmov r2, r8\n"
"\tmovs r3, 0x6\n"
"\tldrsh r0, [r2, r3]\n"
"\tsubs r1, r0\n"
"\tcmp r1, 0\n"
"\tbge _0806F7B0\n"
"\tnegs r1, r1\n"
"_0806F7B0:\n"
"\tcmp r1, 0x1\n"
"\tble _0806F7B6\n"
"\tb _0806F8FC\n"
"_0806F7B6:\n"
"\tadds r0, r4, 0\n"
"\tadds r0, 0x40\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0x4A\n"
"\tbne _0806F7C2\n"
"\tb _0806F8FC\n"
"_0806F7C2:\n"
"\tadds r0, r4, 0\n"
"\tadds r0, 0xA4\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0x1\n"
"\tbne _0806F7CE\n"
"\tb _0806F8FC\n"
"_0806F7CE:\n"
"\tmov r0, r8\n"
"\tadds r1, r6, 0\n"
"\tbl CanSeeTarget\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbne _0806F7DE\n"
"\tb _0806F8FC\n"
"_0806F7DE:\n"
"\tbl sub_806F910\n"
"\tmovs r0, 0xFA\n"
"\tlsls r0, 2\n"
"\tbl DungeonRandInt\n"
"\tadds r7, r0, 0\n"
"\tmovs r1, 0x2\n"
"\tldrsh r0, [r4, r1]\n"
"\tbl GetRecruitRate\n"
"\tlsls r0, 16\n"
"\tasrs r4, r0, 16\n"
"\tldr r0, _0806F844\n"
"\tcmp r4, r0\n"
"\tbne _0806F800\n"
"\tb _0806F8FC\n"
"_0806F800:\n"
"\tadds r0, r6, 0\n"
"\tmovs r1, 0x2E\n"
"\tbl HasHeldItem\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbeq _0806F816\n"
"\tldr r0, _0806F848\n"
"\tmovs r2, 0\n"
"\tldrsh r0, [r0, r2]\n"
"\tadds r4, r0\n"
"_0806F816:\n"
"\tldr r0, _0806F84C\n"
"\tmov r3, r10\n"
"\tldrb r1, [r3, 0x9]\n"
"\tlsls r1, 1\n"
"\tadds r1, r0\n"
"\tmovs r2, 0\n"
"\tldrsh r0, [r1, r2]\n"
"\tadds r4, r0\n"
"\tcmp r7, r4\n"
"\tbge _0806F8FC\n"
"\tmovs r4, 0\n"
"\tmovs r0, 0x6\n"
"\tsubs r3, r0, r5\n"
"\tldr r7, _0806F850\n"
"\tb _0806F856\n"
"\t.align 2, 0\n"
"_0806F834: .4byte 0x00000644\n"
"_0806F838: .4byte gDungeon\n"
"_0806F83C: .4byte 0x0000065d\n"
"_0806F840: .4byte 0x0000010d\n"
"_0806F844: .4byte 0xfffffc19\n"
"_0806F848: .4byte gUnknown_80F5008\n"
"_0806F84C: .4byte gUnknown_80F5700\n"
"_0806F850: .4byte gUnknown_202EE70\n"
"_0806F854:\n"
"\tadds r4, 0x1\n"
"_0806F856:\n"
"\tcmp r4, r3\n"
"\tbgt _0806F878\n"
"\tmovs r2, 0\n"
"\tcmp r2, r5\n"
"\tbge _0806F872\n"
"\tadds r1, r4, r7\n"
"\tb _0806F86C\n"
"_0806F864:\n"
"\tadds r1, 0x1\n"
"\tadds r2, 0x1\n"
"\tcmp r2, r5\n"
"\tbge _0806F872\n"
"_0806F86C:\n"
"\tldrb r0, [r1]\n"
"\tcmp r0, 0\n"
"\tbeq _0806F864\n"
"_0806F872:\n"
"\tcmp r2, r5\n"
"\tbne _0806F854\n"
"\tmov r9, r4\n"
"_0806F878:\n"
"\tmovs r0, 0x1\n"
"\tnegs r0, r0\n"
"\tcmp r9, r0\n"
"\tbeq _0806F8F4\n"
"\tmovs r4, 0\n"
"\tldr r3, _0806F8BC\n"
"\tldr r0, [r3]\n"
"\tldr r2, _0806F8C0\n"
"\tadds r0, r2\n"
"\tldrb r1, [r0]\n"
"\tmovs r0, 0x1\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbeq _0806F8B4\n"
"\tadds r7, r3, 0\n"
"\tadds r5, r2, 0\n"
"\tmovs r2, 0\n"
"\tmovs r3, 0x1\n"
"_0806F89C:\n"
"\tadds r2, 0x64\n"
"\tadds r4, 0x1\n"
"\tcmp r4, 0x3\n"
"\tbgt _0806F8B4\n"
"\tldr r0, [r7]\n"
"\tadds r0, r2, r0\n"
"\tadds r0, r5\n"
"\tldrb r1, [r0]\n"
"\tadds r0, r3, 0\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbne _0806F89C\n"
"_0806F8B4:\n"
"\tcmp r4, 0x4\n"
"\tbeq _0806F8F4\n"
"\tmovs r4, 0\n"
"\tb _0806F8C6\n"
"\t.align 2, 0\n"
"_0806F8BC: .4byte gRecruitedPokemonRef\n"
"_0806F8C0: .4byte 0x00008df8\n"
"_0806F8C4:\n"
"\tadds r4, 0x1\n"
"_0806F8C6:\n"
"\tcmp r4, 0x3\n"
"\tbgt _0806F8E2\n"
"\tldr r0, _0806F8EC\n"
"\tldr r0, [r0]\n"
"\tlsls r1, r4, 2\n"
"\tldr r3, _0806F8F0\n"
"\tadds r0, r3\n"
"\tadds r0, r1\n"
"\tldr r0, [r0]\n"
"\tbl EntityExists\n"
"\tlsls r0, 24\n"
"\tcmp r0, 0\n"
"\tbne _0806F8C4\n"
"_0806F8E2:\n"
"\tcmp r4, 0x4\n"
"\tbeq _0806F8F4\n"
"\tmovs r0, 0x1\n"
"\tb _0806F8FE\n"
"\t.align 2, 0\n"
"_0806F8EC: .4byte gDungeon\n"
"_0806F8F0: .4byte 0x0001357c\n"
"_0806F8F4:\n"
"\tadds r0, r6, 0\n"
"\tmov r1, r8\n"
"\tbl nullsub_96\n"
"_0806F8FC:\n"
"\tmovs r0, 0\n"
"_0806F8FE:\n"
"\tpop {r3-r5}\n"
"\tmov r8, r3\n"
"\tmov r9, r4\n"
"\tmov r10, r5\n"
"\tpop {r4-r7}\n"
"\tpop {r1}\n"
"\tbx r1");
}
#endif
void nullsub_96(Entity *pokemon,Entity *target)
{}

View File

@ -114,7 +114,7 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
if (sub_800A2A0(param_1)) break;
if (((normalOrFightingType) && (targetInfo->types[index] == TYPE_GHOST)) && (targetInfo->exposed == FALSE)) {
effectiveness = EFFECTIVENESS_IMMUNE;
gDungeon->pokemonExposed = TRUE;
gDungeon->unk134.pokemonExposed = TRUE;
}
else {
effectiveness = gTypeEffectivenessChart[type][targetInfo->types[index]];
@ -123,7 +123,7 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
sub_800A34C(param_1,param_1,local_48.unk0[effectiveness]);
}
local_38[index] = effectiveness;
gDungeon->unk13C[index] = effectiveness;
gDungeon->unk134.unk13C[index] = effectiveness;
}
param_5->effectiveness = gUnknown_80F54B4[local_38[0]][local_38[1]];
@ -135,11 +135,11 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
}
if (((type == TYPE_FIRE) || (type == TYPE_ICE)) && (HasAbility(target,ABILITY_THICK_FAT))) {
gDungeon->unk16D = TRUE;
gDungeon->unk134.unk16D = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F1C);
}
if ((type == TYPE_FIRE) && (GetFlashFireStatus(target) != FLASH_FIRE_STATUS_NONE)) {
gDungeon->fill16E[0] = TRUE;
gDungeon->unk134.fill16E[0] = TRUE;
sub_800A020(param_1,0);
param_5->effectiveness = EFFECTIVENESS_IMMUNE;
param_5->unkD = 0;
@ -147,7 +147,7 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
bVar4 = FALSE;
}
if ((type == TYPE_GROUND) && (HasAbility(target, ABILITY_LEVITATE))) {
gDungeon->fill16E[1] = TRUE;
gDungeon->unk134.fill16E[1] = TRUE;
sub_800A020(param_1,0);
param_5->effectiveness = EFFECTIVENESS_IMMUNE;
param_5->unkD = 0;
@ -158,7 +158,7 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
torrentFlag = pokemonInfo->maxHPStat / 4 >= pokemonInfo->HP;
torrentVisualFlag = SetVisualFlags(pokemonInfo,0x80,torrentFlag);
if (torrentFlag) {
gDungeon->fill16E[2] = TRUE;
gDungeon->unk134.fill16E[2] = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F0C);
}
if (torrentVisualFlag) {
@ -170,7 +170,7 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
overgrowFlag = pokemonInfo->maxHPStat / 4 >= pokemonInfo->HP;
overgrowVisualFlag = SetVisualFlags(pokemonInfo,2,overgrowFlag);
if (overgrowFlag) {
gDungeon->fill16E[3] = TRUE;
gDungeon->unk134.fill16E[3] = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F0C);
}
if (overgrowVisualFlag) {
@ -182,7 +182,7 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
swarmFlag = pokemonInfo->maxHPStat / 4 >= pokemonInfo->HP;
swarmVisualFlag = SetVisualFlags(pokemonInfo,0x10,swarmFlag);
if (swarmFlag) {
gDungeon->fill16E[4] = TRUE;
gDungeon->unk134.fill16E[4] = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F0C);
}
if (swarmVisualFlag) {
@ -194,7 +194,7 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
blazeFlag = pokemonInfo->maxHPStat / 4 >= pokemonInfo->HP;
blazeVisualFlag = SetVisualFlags(pokemonInfo,0x20,blazeFlag);
if (blazeFlag) {
gDungeon->fill16E[5] = TRUE;
gDungeon->unk134.fill16E[5] = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F0C);
}
if (blazeVisualFlag) {
@ -203,44 +203,44 @@ bool8 sub_806E100(s32 *param_1, Entity *pokemon, Entity *target, u8 type, struct
}
}
if (!(sub_800A2A0(param_1)) && (MonsterIsType(pokemon, type))) {
gDungeon->fill16E[6] = TRUE;
gDungeon->unk134.fill16E[6] = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F14);
}
weather = GetApparentWeather(pokemon);
if (weather == WEATHER_SUNNY) {
if (type == TYPE_FIRE) {
gDungeon->unk16C = TRUE;
gDungeon->unk134.unk16C = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F14);
}
else if (type == TYPE_WATER) {
gDungeon->unk16C = TRUE;
gDungeon->unk134.unk16C = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F1C);
}
}
if (weather == WEATHER_RAIN) {
if (type == TYPE_FIRE) {
gDungeon->unk16B = TRUE;
gDungeon->unk134.unk16B = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F1C);
}
else if (type == TYPE_WATER) {
gDungeon->unk16B = TRUE;
gDungeon->unk134.unk16B = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F14);
}
}
if ((weather == WEATHER_CLOUDY) && (type != TYPE_NORMAL)) {
sub_800A34C(param_1,param_1, gUnknown_8106F64);
gDungeon->unk16A = TRUE;
gDungeon->unk134.unk16A = TRUE;
}
if (((gDungeon->weather.mudSportTurns != 0) || (weather == WEATHER_FOG)) && (type == TYPE_ELECTRIC)) {
gDungeon->fill16E[7] = TRUE;
gDungeon->unk134.fill16E[7] = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F1C);
}
if ((gDungeon->weather.waterSportTurns != 0) && (type == TYPE_FIRE)) {
gDungeon->fill16E[8] = TRUE;
gDungeon->unk134.fill16E[8] = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F1C);
}
if ((type == TYPE_ELECTRIC) && (pokemonInfo->charging.chargingStatus == STATUS_CHARGING)) {
gDungeon->fill16E[9] = TRUE;
gDungeon->unk134.fill16E[9] = TRUE;
sub_800A34C(param_1,param_1,gUnknown_8106F0C);
}
}
@ -293,7 +293,7 @@ s32 WeightWeakTypePicker(Entity *user, Entity *target, u8 moveType)
if (checkExposed && *targetType == TYPE_GHOST && !targetData->exposed)
{
effectiveness = 0;
gDungeon->pokemonExposed = TRUE;
gDungeon->unk134.pokemonExposed = TRUE;
}
else
{