Label and doc iq skills and tactics info (#75)

* label/doc iq skills/tactics info

* decomp a few more dungeon_util and label some funcs

* doc the IQSkills field
This commit is contained in:
Seth Barberee 2021-11-15 11:02:26 -08:00 committed by GitHub
parent 0ea22237c9
commit bfaa55f2fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 396 additions and 536 deletions

View File

@ -1131,7 +1131,7 @@ sub_801BEEC:
adds r0, 0xC
movs r2, 0x14
ldrsh r1, [r1, r2]
bl sub_808EBA8
bl GetNumAvailableIQSkills
ldr r1, [r4]
str r0, [r1, 0x2C]
movs r0, 0
@ -1570,7 +1570,7 @@ _0801C270:
adds r0, 0x8
movs r2, 0x14
ldrsh r1, [r1, r2]
bl sub_808EBA8
bl GetNumAvailableIQSkills
adds r1, r0, 0
ldr r0, [r5]
str r1, [r0, 0x20]
@ -1941,7 +1941,7 @@ _0801C53C:
adds r0, 0x20
movs r1, 0x1
lsls r1, r4
bl sub_808ECD0
bl IsIQSkillSet
lsls r0, 24
cmp r0, 0
beq _0801C5A4
@ -2006,7 +2006,7 @@ sub_801C5F0:
movs r2, 0x14
ldrsh r1, [r0, r2]
mov r0, sp
bl sub_808EBA8
bl GetNumAvailableIQSkills
cmp r0, 0
beq _0801C618
movs r0, 0

View File

@ -8185,7 +8185,7 @@ _08022F68:
ldr r1, [r1, 0x48]
movs r2, 0x14
ldrsh r1, [r1, r2]
bl sub_808EBA8
bl GetNumAvailableIQSkills
ldr r3, [r4]
str r0, [r3, 0x38]
ldr r0, [r3, 0x48]
@ -8201,7 +8201,7 @@ _08022F68:
ldr r1, [r1, 0x48]
movs r2, 0x14
ldrsh r1, [r1, r2]
bl sub_808EBA8
bl GetNumAvailableIQSkills
ldr r1, [r4]
str r0, [r1, 0x3C]
movs r0, 0x1

View File

@ -4701,7 +4701,7 @@ _0803F5D4:
strh r0, [r5, 0xA]
adds r0, r6, 0
movs r1, 0x11
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0803F610

View File

@ -5,69 +5,6 @@
.text
thumb_func_start GetEntityType
GetEntityType:
ldr r0, [r0]
bx lr
thumb_func_end GetEntityType
thumb_func_start sub_80450FC
sub_80450FC:
adds r0, 0x25
ldrb r0, [r0]
bx lr
thumb_func_end sub_80450FC
thumb_func_start sub_8045104
sub_8045104:
ldr r0, [r0, 0x70]
bx lr
thumb_func_end sub_8045104
thumb_func_start GetItemData
GetItemData:
ldr r0, [r0, 0x70]
bx lr
thumb_func_end GetItemData
thumb_func_start sub_804510C
sub_804510C:
ldr r0, [r0, 0x70]
bx lr
thumb_func_end sub_804510C
thumb_func_start sub_8045110
sub_8045110:
ldr r0, [r0, 0x70]
bx lr
thumb_func_end sub_8045110
thumb_func_start sub_8045114
sub_8045114:
push {lr}
movs r1, 0x4
ldrsh r2, [r0, r1]
movs r3, 0x6
ldrsh r1, [r0, r3]
adds r0, r2, 0
bl GetMapTileAtPosition
pop {r1}
bx r1
thumb_func_end sub_8045114
thumb_func_start sub_8045128
sub_8045128:
push {lr}
movs r1, 0x4
ldrsh r2, [r0, r1]
movs r3, 0x6
ldrsh r1, [r0, r3]
adds r0, r2, 0
bl sub_8049590
pop {r1}
bx r1
thumb_func_end sub_8045128
thumb_func_start sub_804513C
sub_804513C:
push {r4-r7,lr}
@ -3647,8 +3584,8 @@ _08046CA8: .4byte 0x0000052c
_08046CAC: .4byte 0x0000048c
thumb_func_end sub_804687C
thumb_func_start sub_8046CB0
sub_8046CB0:
thumb_func_start HasItem
HasItem:
push {lr}
lsls r1, 24
lsrs r1, 24
@ -3676,7 +3613,7 @@ _08046CDC:
_08046CDE:
pop {r1}
bx r1
thumb_func_end sub_8046CB0
thumb_func_end HasItem
thumb_func_start sub_8046CE4
sub_8046CE4:
@ -4346,7 +4283,7 @@ sub_8047190:
bne _08047214
mov r0, r9
movs r1, 0x2A
bl sub_8046CB0
bl HasItem
lsls r0, 24
lsrs r0, 24
negs r1, r0
@ -4568,7 +4505,7 @@ _080473A2:
bne _080473CE
ldr r0, [r5, 0x10]
movs r1, 0x26
bl sub_8046CB0
bl HasItem
lsls r0, 24
lsrs r0, 24
negs r1, r0
@ -4887,7 +4824,7 @@ sub_80475C4:
bne _0804765E
ldr r0, [sp, 0x10]
movs r1, 0x2A
bl sub_8046CB0
bl HasItem
lsls r0, 24
lsrs r0, 24
negs r1, r0
@ -5112,7 +5049,7 @@ _080477FA:
bne _08047834
ldr r0, [r4, 0x10]
movs r1, 0x26
bl sub_8046CB0
bl HasItem
lsls r0, 24
lsrs r0, 24
negs r1, r0
@ -5284,7 +5221,7 @@ _08047964:
bne _08047994
adds r0, r4, 0
movs r1, 0x28
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08047984
@ -5295,7 +5232,7 @@ _08047980: .4byte gUnknown_80F4FA2
_08047984:
adds r0, r4, 0
movs r1, 0x2A
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08047994
@ -5307,7 +5244,7 @@ _08047994:
bne _080479AE
adds r0, r5, 0
movs r1, 0x25
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _080479AE

View File

@ -19970,7 +19970,7 @@ _08051EC8:
orrs r0, r1
str r0, [sp, 0x4]
mov r0, r9
bl sub_80450FC
bl GetEntityRoomIndex
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0xC]

View File

@ -2582,7 +2582,7 @@ _08053850: .4byte gUnknown_80FCD0C
_08053854:
adds r0, r5, 0
movs r1, 0x2C
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _08053864
@ -8506,7 +8506,7 @@ _08056B9C:
_08056BA2:
adds r0, r6, 0
movs r1, 0x23
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08056BB6

View File

@ -5273,7 +5273,7 @@ _0805A170: .4byte gUnknown_80FCCE4
_0805A174:
adds r0, r5, 0
movs r1, 0x24
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0805A18C
@ -6043,7 +6043,7 @@ _0805A70C: .4byte gUnknown_80FCCE8
_0805A710:
adds r0, r5, 0
movs r1, 0x24
bl sub_8046CB0
bl HasItem
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0
@ -8637,7 +8637,7 @@ _0805BAC0: .4byte gAvailablePokemonNames
_0805BAC4:
adds r0, r5, 0
movs r1, 0x24
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0805BADC
@ -14678,7 +14678,7 @@ _0805EE4E:
beq _0805EE82
adds r0, r5, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _0805EE82
@ -31040,7 +31040,7 @@ _080672F0:
_080672F6:
adds r0, r6, 0
movs r1, 0x29
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08067310
@ -31144,7 +31144,7 @@ _080673C6:
bl sub_8042208
adds r0, r6, 0
movs r1, 0x27
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08067400
@ -31216,7 +31216,7 @@ _0806745E:
_08067462:
adds r0, r6, 0
movs r1, 0xF
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08067486
@ -37833,13 +37833,13 @@ sub_806A7E8:
sub sp, 0x30
adds r5, r0, 0
mov r0, sp
bl sub_808EBA8
bl GetNumAvailableIQSkills
mov r9, r0
add r4, sp, 0x18
movs r0, 0xC
ldrsh r1, [r5, r0]
adds r0, r4, 0
bl sub_808EBA8
bl GetNumAvailableIQSkills
adds r6, r0, 0
ldr r0, _0806A828
adds r1, r5, 0
@ -40669,7 +40669,7 @@ _0806BDA6:
adds r0, r6, 0
adds r0, 0x8C
movs r1, 0
bl sub_808EC94
bl SetDefaultIQSkills
adds r0, r6, 0
adds r0, 0x3C
bl sub_808E6F4
@ -44287,7 +44287,7 @@ _0806D978:
_0806D98E:
adds r0, r7, 0
movs r1, 0x10
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806D9B2
@ -46757,7 +46757,7 @@ _0806ED0E:
bne _0806EDC8
ldr r0, [sp, 0x70]
movs r1, 0x13
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806ED4A
@ -46778,7 +46778,7 @@ _0806ED0E:
_0806ED4A:
ldr r0, [sp, 0x70]
movs r1, 0x2B
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806ED74
@ -46802,7 +46802,7 @@ _0806ED74:
beq _0806EE4A
mov r0, r9
movs r1, 0x1E
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806EE4A
@ -46836,7 +46836,7 @@ _0806EDC8:
beq _0806EDF6
mov r0, r9
movs r1, 0x22
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806EDF6
@ -46856,7 +46856,7 @@ _0806EDC8:
_0806EDF6:
ldr r0, [sp, 0x70]
movs r1, 0x21
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806EE20
@ -46877,7 +46877,7 @@ _0806EDF6:
_0806EE20:
ldr r0, [sp, 0x70]
movs r1, 0x2B
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806EE4A
@ -47260,7 +47260,7 @@ _0806F16C: .4byte 0x000003e7
_0806F170:
ldr r0, [sp, 0x70]
movs r1, 0xC
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806F194
@ -47278,7 +47278,7 @@ _0806F170:
_0806F194:
mov r0, r9
movs r1, 0xD
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806F1B6
@ -48114,7 +48114,7 @@ _0806F7DE:
_0806F800:
adds r0, r6, 0
movs r1, 0x2E
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0806F816
@ -48562,7 +48562,7 @@ _0806FB4E:
adds r0, r5, 0
adds r0, 0x4C
movs r1, 0
bl sub_808EC94
bl SetDefaultIQSkills
ldr r0, [r6, 0x44]
str r0, [r5, 0x54]
adds r0, r5, 0
@ -48945,7 +48945,7 @@ _0806FE58:
adds r0, r5, 0
adds r0, 0x4C
movs r1, 0
bl sub_808EC94
bl SetDefaultIQSkills
ldr r0, [sp, 0x50]
str r0, [r5, 0x54]
adds r0, r5, 0

View File

@ -530,7 +530,7 @@ sub_80703A0:
beq _0807044E
adds r0, r6, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _0807044E
@ -602,7 +602,7 @@ sub_8070460:
beq _08070492
adds r0, r1, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _08070492
@ -670,7 +670,7 @@ _080704E2:
beq _08070552
adds r0, r6, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _08070552
@ -854,7 +854,7 @@ _08070636:
beq _08070696
adds r0, r6, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _08070696
@ -951,7 +951,7 @@ _080706F2:
beq _08070762
adds r0, r7, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _08070762

View File

@ -107,7 +107,7 @@ sub_8070D6C:
beq _08070DD2
adds r0, r4, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08070DDC
@ -217,7 +217,7 @@ _08070E8A:
beq _08070EAC
adds r0, r4, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08070EB4
@ -382,7 +382,7 @@ _08070FCC:
beq _08070FEE
adds r0, r4, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08070FF8
@ -496,7 +496,7 @@ _080710AE:
beq _080710D0
adds r0, r5, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _080710D8
@ -609,7 +609,7 @@ _0807118A:
beq _080711AC
adds r0, r4, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _080711B4
@ -785,7 +785,7 @@ _080712E6:
beq _08071308
adds r0, r4, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08071320
@ -877,7 +877,7 @@ sub_807138C:
beq _080713E0
adds r0, r4, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _080713E0
@ -994,4 +994,4 @@ _0807148C:
bx r1
thumb_func_end sub_8071470
.align 2, 0
.align 2, 0

View File

@ -34,28 +34,4 @@ _08071880:
bx r1
thumb_func_end sub_8071858
thumb_func_start sub_8071884
sub_8071884:
push {lr}
adds r1, r0, 0
ldr r0, [r1, 0x70]
adds r0, 0xE8
ldrb r0, [r0]
cmp r0, 0x3
beq _080718A4
adds r0, r1, 0
movs r1, 0x1A
bl sub_8046CB0
lsls r0, 24
cmp r0, 0
bne _080718A4
movs r0, 0
b _080718A6
_080718A4:
movs r0, 0x1
_080718A6:
pop {r1}
bx r1
thumb_func_end sub_8071884
.align 2, 0
.align 2, 0

View File

@ -5,45 +5,6 @@
.text
thumb_func_start HasIQSkill
HasIQSkill:
push {lr}
lsls r2, r1, 24
lsrs r2, 24
ldr r0, [r0, 0x70]
adds r0, 0x90
movs r1, 0x1
lsls r1, r2
bl sub_808ECD0
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
thumb_func_end HasIQSkill
thumb_func_start sub_80718F4
sub_80718F4:
push {r4,lr}
adds r4, r1, 0
lsls r4, 24
lsrs r4, 24
lsls r2, 24
lsrs r2, 24
ldr r0, [r0, 0x70]
adds r0, 0x90
movs r3, 0x1
adds r1, r3, 0
lsls r1, r4
lsls r3, r2
orrs r1, r3
bl sub_808ECD0
lsls r0, 24
lsrs r0, 24
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_80718F4
thumb_func_start sub_807191C
sub_807191C:
push {r4-r6,lr}
@ -55,13 +16,13 @@ sub_807191C:
adds r4, 0x90
adds r0, r4, 0
movs r1, 0x8
bl sub_808EC30
bl SetIQSkill
adds r0, r4, 0
movs r1, 0x6
bl sub_808EC30
bl SetIQSkill
adds r0, r4, 0
movs r1, 0x2
bl sub_808EC30
bl SetIQSkill
adds r0, r5, 0
adds r0, 0xF7
ldrb r0, [r0]
@ -69,7 +30,7 @@ sub_807191C:
beq _08071954
adds r0, r4, 0
movs r1, 0x12
bl sub_808EC30
bl SetIQSkill
_08071954:
ldrb r0, [r5, 0x9]
ldr r1, _08071974
@ -79,7 +40,7 @@ _08071954:
blt _08071968
adds r0, r4, 0
movs r1, 0x16
bl sub_808EC30
bl SetIQSkill
_08071968:
adds r1, r5, 0
adds r1, 0x94
@ -104,7 +65,7 @@ _0807198C:
ldrsh r0, [r5, r1]
lsls r1, r4, 24
lsrs r1, 24
bl sub_808EB7C
bl HasIQForSkill
lsls r0, 24
cmp r0, 0
beq _080719B8
@ -112,13 +73,13 @@ _0807198C:
lsls r1, r4
adds r0, r5, 0
adds r0, 0x8C
bl sub_808ECD0
bl IsIQSkillSet
lsls r0, 24
cmp r0, 0
beq _080719B8
adds r0, r6, 0
adds r1, r4, 0
bl sub_808EC30
bl SetIQSkill
_080719B8:
adds r4, 0x1
cmp r4, 0x17
@ -2985,7 +2946,7 @@ _08072FE8:
beq _08073038
adds r0, r4, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _08073038

View File

@ -920,7 +920,7 @@ _080740C8:
bl sub_807E8F0
adds r0, r5, 0
movs r1, 0x16
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08074170
@ -998,7 +998,7 @@ _0807417A:
movs r4, 0xA
adds r0, r5, 0
movs r1, 0x17
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08074190
@ -1006,7 +1006,7 @@ _0807417A:
_08074190:
adds r0, r5, 0
movs r1, 0x1F
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _080741A0
@ -1022,7 +1022,7 @@ _080741A0:
_080741B0:
adds r0, r5, 0
movs r1, 0x1B
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _080741C0
@ -1030,7 +1030,7 @@ _080741B0:
_080741C0:
adds r0, r5, 0
movs r1, 0xA
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _080741D0
@ -1038,7 +1038,7 @@ _080741C0:
_080741D0:
adds r0, r5, 0
movs r1, 0x2B
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _080741E0
@ -2219,7 +2219,7 @@ _08074BAE:
beq _08074C48
adds r0, r7, 0
movs r1, 0xA
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08074BC8
@ -3666,7 +3666,7 @@ sub_8075708:
beq _08075752
adds r0, r4, 0
movs r1, 0x9
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _08075752

View File

@ -256,7 +256,7 @@ _08075D88: .4byte gUnknown_80FCD88
_08075D8C:
adds r0, r4, 0
movs r1, 0x15
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08075DB4
@ -1101,7 +1101,7 @@ _0807642C:
bl sub_80708B4
adds r0, r5, 0
movs r1, 0x14
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0807645C
@ -1335,7 +1335,7 @@ _08076614:
bl sub_80708B4
adds r0, r5, 0
movs r1, 0x14
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08076644
@ -2364,7 +2364,7 @@ _08076E6E:
bne _08076F6E
adds r0, r4, 0
movs r1, 0xB
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08076EB0
@ -2926,7 +2926,7 @@ _0807730A:
_08077320:
adds r0, r5, 0
movs r1, 0xB
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08077350
@ -3904,7 +3904,7 @@ sub_8077AE4:
bl SetMessageArgument
adds r0, r4, 0
movs r1, 0x12
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08077B34
@ -5932,7 +5932,7 @@ _08078B86:
bne _08078BB8
adds r0, r6, 0
movs r1, 0x1B
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08078BB8
@ -9761,7 +9761,7 @@ _0807AA3C:
mov r9, r0
mov r8, r0
adds r0, r5, 0
bl sub_80450FC
bl GetEntityRoomIndex
lsls r0, 24
lsrs r7, r0, 24
movs r6, 0
@ -9780,7 +9780,7 @@ _0807AA82:
beq _0807AB00
adds r0, r4, 0
movs r1, 0x18
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
bne _0807AB00
@ -9816,12 +9816,12 @@ _0807AAE0: .4byte 0x0001357c
_0807AAE4:
adds r0, r4, 0
movs r1, 0x1D
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0807AB00
adds r0, r4, 0
bl sub_80450FC
bl GetEntityRoomIndex
lsls r0, 24
lsrs r0, 24
cmp r7, r0
@ -11280,7 +11280,7 @@ sub_807B5E0:
ldr r1, [r7, 0x70]
str r1, [sp, 0x10]
adds r0, r7, 0
bl sub_80450FC
bl GetEntityRoomIndex
lsls r0, 24
lsrs r0, 24
mov r10, r0
@ -11366,7 +11366,7 @@ _0807B69A:
str r0, [sp, 0x8]
str r4, [sp, 0xC]
adds r0, r4, 0
bl sub_80450FC
bl GetEntityRoomIndex
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x4]
@ -11706,7 +11706,7 @@ sub_807B920:
sub sp, 0x10
adds r6, r0, 0
ldr r7, [r6, 0x70]
bl sub_80450FC
bl GetEntityRoomIndex
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0xFF
@ -15172,7 +15172,7 @@ sub_807D3CC:
_0807D3E8:
mov r0, r8
str r2, [sp]
bl sub_80450FC
bl GetEntityRoomIndex
lsls r0, 24
lsrs r1, r0, 24
ldr r2, [sp]
@ -17339,7 +17339,7 @@ sub_807E580:
cmp r0, 0
beq _0807E596
movs r1, 0x2D
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0807E596
@ -18286,10 +18286,10 @@ _0807ECC6:
cmp r0, 0
beq _0807ED0E
adds r0, r7, 0
bl sub_80450FC
bl GetEntityRoomIndex
adds r4, r0, 0
adds r0, r5, 0
bl sub_80450FC
bl GetEntityRoomIndex
lsls r4, 24
lsls r0, 24
cmp r4, r0
@ -18392,10 +18392,10 @@ _0807EDB8:
b _0807EEC4
_0807EDC6:
adds r0, r7, 0
bl sub_80450FC
bl GetEntityRoomIndex
adds r4, r0, 0
adds r0, r5, 0
bl sub_80450FC
bl GetEntityRoomIndex
lsls r4, 24
lsls r0, 24
cmp r4, r0
@ -20604,7 +20604,7 @@ _0807FEFE:
movs r6, 0
adds r0, r4, 0
movs r1, 0x1C
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _0807FF3C
@ -20987,7 +20987,7 @@ sub_808024C:
mov r8, r0
mov r0, r10
movs r1, 0xE
bl sub_8046CB0
bl HasItem
lsls r0, 24
cmp r0, 0
beq _08080278

View File

@ -5,209 +5,6 @@
.text
thumb_func_start sub_803AA34
sub_803AA34:
push {r4,r5,lr}
movs r4, 0
ldr r0, _0803AA64
ldr r1, [r0]
ldr r2, _0803AA68
ldr r3, [r2]
ldrb r0, [r3, 0x4]
adds r1, r0
ldrb r0, [r1]
adds r5, r2, 0
cmp r0, 0
beq _0803AA7A
ldr r0, _0803AA6C
str r0, [r3, 0xC]
bl sub_803ABC8
lsls r0, 24
cmp r0, 0
beq _0803AA70
ldr r1, [r5]
movs r0, 0x3
str r0, [r1, 0x10]
b _0803AA82
.align 2, 0
_0803AA64: .4byte gFriendAreas
_0803AA68: .4byte gUnknown_203B3F4
_0803AA6C: .4byte gDebug_CloseText
_0803AA70:
ldr r1, [r5]
movs r0, 0x1
negs r0, r0
str r0, [r1, 0x10]
b _0803AA82
_0803AA7A:
ldr r0, _0803AABC
str r0, [r3, 0xC]
movs r0, 0x2
str r0, [r3, 0x10]
_0803AA82:
adds r4, 0x1
ldr r5, [r5]
mov r12, r5
lsls r1, r4, 3
mov r3, r12
adds r3, 0xC
adds r2, r3, r1
ldr r0, _0803AAC0
ldr r0, [r0]
str r0, [r2]
mov r2, r12
adds r2, 0x10
adds r1, r2, r1
movs r0, 0x4
str r0, [r1]
adds r4, 0x1
lsls r1, r4, 3
adds r3, r1
movs r0, 0
str r0, [r3]
adds r2, r1
movs r0, 0x1
str r0, [r2]
mov r1, r12
ldr r0, [r1, 0x10]
str r0, [r1, 0x8]
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_0803AABC: .4byte gDebug_OpenText
_0803AAC0: .4byte gUnknown_80D4970
thumb_func_end sub_803AA34
thumb_func_start sub_803AAC4
sub_803AAC4:
push {lr}
movs r0, 0x1
bl sub_8021274
cmp r0, 0x4
bhi _0803AB2E
lsls r0, 2
ldr r1, _0803AADC
adds r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_0803AADC: .4byte _0803AAE0
.align 2, 0
_0803AAE0:
.4byte _0803AB2E
.4byte _0803AB2E
.4byte _0803AB24
.4byte _0803AAF4
.4byte _0803AB0C
_0803AAF4:
bl sub_802132C
ldr r1, _0803AB08
ldr r1, [r1]
strb r0, [r1, 0x4]
movs r0, 0x2
bl sub_803A924
b _0803AB2E
.align 2, 0
_0803AB08: .4byte gUnknown_203B3F4
_0803AB0C:
bl sub_802132C
ldr r1, _0803AB20
ldr r1, [r1]
strb r0, [r1, 0x4]
movs r0, 0x3
bl sub_803A924
b _0803AB2E
.align 2, 0
_0803AB20: .4byte gUnknown_203B3F4
_0803AB24:
bl sub_80213A0
movs r0, 0x4
bl sub_803A924
_0803AB2E:
pop {r0}
bx r0
thumb_func_end sub_803AAC4
thumb_func_start sub_803AB34
sub_803AB34:
push {r4,lr}
sub sp, 0x4
movs r0, 0
str r0, [sp]
bl sub_8021274
ldr r4, _0803AB6C
ldr r0, [r4]
adds r0, 0x4C
bl sub_8012FD8
lsls r0, 24
cmp r0, 0
bne _0803AB5A
ldr r0, [r4]
adds r0, 0x4C
mov r1, sp
bl sub_8013114
_0803AB5A:
ldr r0, [sp]
cmp r0, 0x2
beq _0803AB7A
cmp r0, 0x2
bgt _0803AB70
cmp r0, 0x1
beq _0803AB9E
b _0803ABA4
.align 2, 0
_0803AB6C: .4byte gUnknown_203B3F4
_0803AB70:
cmp r0, 0x3
beq _0803AB84
cmp r0, 0x4
beq _0803AB96
b _0803ABA4
_0803AB7A:
ldr r0, [r4]
ldrb r0, [r0, 0x4]
bl UnlockFriendArea
b _0803AB8E
_0803AB84:
ldr r0, [r4]
ldrb r0, [r0, 0x4]
movs r1, 0x1
bl sub_809249C
_0803AB8E:
movs r0, 0x1
bl sub_803A924
b _0803ABA4
_0803AB96:
movs r0, 0x3
bl sub_803A924
b _0803ABA4
_0803AB9E:
movs r0, 0x1
bl sub_803A924
_0803ABA4:
add sp, 0x4
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_803AB34
thumb_func_start sub_803ABAC
sub_803ABAC:
push {lr}
bl sub_80217EC
cmp r0, 0x1
bls _0803ABC4
cmp r0, 0x3
bhi _0803ABC4
bl sub_8021830
movs r0, 0x1
bl sub_803A924
_0803ABC4:
pop {r0}
bx r0
thumb_func_end sub_803ABAC
thumb_func_start sub_803ABC8
sub_803ABC8:
push {r4-r6,lr}

View File

@ -69,7 +69,7 @@ _0808CEA4:
strb r4, [r0, 0x10]
add r0, sp, 0x20
movs r1, 0
bl sub_808EC94
bl SetDefaultIQSkills
mov r0, sp
strh r7, [r0, 0x8]
add r0, sp, 0x28
@ -241,7 +241,7 @@ sub_808CFD0:
adds r0, r7, 0
adds r0, 0x20
movs r1, 0
bl sub_808EC94
bl SetDefaultIQSkills
ldr r4, [sp, 0x38]
cmp r4, 0
beq _0808D08C
@ -350,7 +350,7 @@ sub_808D0D8:
strh r4, [r7, 0x14]
subs r0, 0x4
movs r1, 0
bl sub_808EC94
bl SetDefaultIQSkills
adds r0, r7, 0
adds r0, 0x2C
movs r2, 0x8
@ -402,7 +402,7 @@ sub_808D144:
adds r0, r5, 0
adds r0, 0x20
movs r1, 0
bl sub_808EC94
bl SetDefaultIQSkills
movs r6, 0
adds r4, r5, 0
adds r4, 0x2C

View File

@ -1070,7 +1070,7 @@ _0808FCB0:
movs r2, 0x3E
ldrsh r1, [r0, r2]
adds r0, r4, 0
bl sub_808EBA8
bl GetNumAvailableIQSkills
mov r0, r10
adds r0, 0x40
movs r3, 0
@ -1112,7 +1112,7 @@ _0808FCFC:
adds r1, r4, 0
ldrb r5, [r5]
lsls r1, r5
bl sub_808ECD0
bl IsIQSkillSet
lsls r0, 24
cmp r0, 0
beq _0808FD44

View File

@ -7930,8 +7930,8 @@ gUnknown_81076BC: @ 81076BC
gUnknown_81076C4: @ 81076C4
.byte 0xfc, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00
.global gUnknown_81076E4
gUnknown_81076E4: @ 81076E4
.global gIQSkillGroups
gIQSkillGroups: @ 81076E4
.4byte 9999
.4byte 4
.4byte 1
@ -8360,24 +8360,24 @@ gUnknown_810A36B: @ 810A36B
.byte 0x00
.byte 0x00
.global gUnknown_810A378
gUnknown_810A378: @ 810A378
.global gReqTacticLvls
gReqTacticLvls: @ 810A378
@ replacing .incbin "baserom.gba", 0x0010a378, 0x18
.2byte 0x01
.2byte 0x19
.2byte 0x01
.2byte 0x01
.2byte 0x3e7
.2byte 0x3e7
.2byte 0x23
.2byte 0x28
.2byte 0x14
.2byte 0x0f
.2byte 0x0a
.2byte 0x3e7
.2byte 1
.2byte 25
.2byte 1
.2byte 1
.2byte 999
.2byte 999
.2byte 35
.2byte 40
.2byte 20
.2byte 15
.2byte 10
.2byte 999
.global gUnknown_810A390
gUnknown_810A390: @ 810A390
.global gReqIQSkillPts
gReqIQSkillPts: @ 810A390
.byte 0x0f, 0x27, 0x00, 0x00
.byte 0x69, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x00, 0x00

View File

@ -25,7 +25,8 @@ enum IQSkill
IQ_SKILL_LAVA_EVADER = 0x14,
IQ_SKILL_DEDICATED_TRAVELER = 0x15,
IQ_SKILL_ITEM_MASTER = 0x16,
IQ_SKILL_EXCLUSIVE_MOVE_USER = 0x17
IQ_SKILL_EXCLUSIVE_MOVE_USER = 0x17,
NUM_IQ_SKILLS = 0x18
};
#endif

View File

@ -13,7 +13,9 @@ enum Tactic
TACTIC_BE_PATIENT = 0x7,
TACTIC_KEEP_YOUR_DISTANCE = 0x8,
TACTIC_WAIT_THERE = 0x9,
TACTIC_GET_AWAY = 0xA
TACTIC_GET_AWAY = 0xA,
TACTIC_UNUSED = 0xB,
NUM_TACTICS = 0xC
};
#endif

View File

@ -44,7 +44,7 @@ struct PokemonStruct
/* 0x16 */ u16 pokeHP; // HP
/* 0x18 */ struct Offense offense;
u32 unk1C;
u32 unk20;
u32 IQSkills;
u8 unk24;
u8 fill25[3];
struct HeldItem heldItem;
@ -91,7 +91,7 @@ struct PokemonStruct2
/* 40 */ struct ItemSlot itemSlot; // heldItem
u32 unk44; // some struct
u32 unk48; // some struct (same type as 44)
u32 unk4C; // unk20
u32 IQSkills; // unk20
u8 unk50; // unk24
u8 fill51[3];
struct unkStruct_808E6F4 unk54;

View File

@ -7,7 +7,7 @@ extern struct DungeonGlobalData *gDungeonGlobalData;
extern void sub_807191C(struct DungeonEntity *);
extern struct DungeonEntity *sub_8085480(void);
extern struct DungeonEntity *sub_8085680(u32);
extern void sub_808EC94(u8 *param_1, u8 param_2);
extern void SetDefaultIQSkills(u8 *param_1, u8 param_2);
extern void sub_8097FF8(void);
extern u8 sub_8044B28(void);
extern u8 HasRecruitedMon(u32);
@ -56,7 +56,7 @@ void SetupBossFightHP(struct DungeonEntity *param_1, s32 newHP, u16 param_3)
}
gDungeonGlobalData->unk66A = param_3;
sub_808EC94(iVar2->IQSkillsSelected,iVar2->isBoss);
SetDefaultIQSkills(iVar2->IQSkillsSelected,iVar2->isBoss);
sub_807191C(param_1);
}

View File

@ -35,7 +35,7 @@ struct unkStruct_203B3F4
{
// size: 0xFC
u32 state;
u8 unk4;
u8 friendArea;
u8 fill5[0x8 - 5];
u32 unk8;
struct MenuItem menuItems[8];
@ -56,7 +56,7 @@ extern struct UnkTextStruct2 gUnknown_80E7E64;
extern const char gDebug_NumberText;
extern struct UnkTextStruct2 gUnknown_80E7E8C;
extern struct UnkTextStruct2 gUnknown_80E7EA4;
extern bool8 *gFriendAreas;
extern const char *gUnknown_80D4970[];
@ -83,8 +83,16 @@ extern void sub_8021354(u32);
extern void sub_8021494();
extern void sub_803AA34();
extern void sub_8021774(u8,u32, u32);
extern u8 gDebug_CloseText[];
extern u8 gDebug_OpenText[];
extern void UnlockFriendArea(u8);
extern void sub_809249C(u8, u32);
extern void sub_8021830(void);
extern u32 sub_80217EC(void);
extern u8 sub_803ABC8(void);
extern u32 sub_8021274(u32);
extern u8 sub_802132C(void);
extern void sub_80213A0(void);
extern void sub_803AAC4();
extern void sub_803AB34();
extern void sub_803ABAC();
@ -402,9 +410,108 @@ void sub_803A9AC(void)
sub_8012D60(&gUnknown_203B3F4->unk4C,gUnknown_203B3F4->menuItems,0,0,gUnknown_203B3F4->unk8,2);
break;
case 3:
sub_8021774(gUnknown_203B3F4->unk4,1,0);
sub_8021774(gUnknown_203B3F4->friendArea,1,0);
break;
case 4:
break;
}
}
void sub_803AA34(void)
{
s32 iVar4;
u8 *FriendAreas;
iVar4 = 0;
// So dumb that it matches...
FriendAreas = gFriendAreas;
if(FriendAreas[gUnknown_203B3F4->friendArea])
{
gUnknown_203B3F4->menuItems[0].text = gDebug_CloseText;
if(sub_803ABC8())
gUnknown_203B3F4->menuItems[0].menuAction = 3;
else
gUnknown_203B3F4->menuItems[0].menuAction = -1;
}
else
{
gUnknown_203B3F4->menuItems[0].text = gDebug_OpenText;
gUnknown_203B3F4->menuItems[0].menuAction = 2;
}
iVar4++;
gUnknown_203B3F4->menuItems[iVar4].text = *gUnknown_80D4970;
gUnknown_203B3F4->menuItems[iVar4].menuAction = 4;
iVar4++;
gUnknown_203B3F4->menuItems[iVar4].text = NULL;
gUnknown_203B3F4->menuItems[iVar4].menuAction = 1;
gUnknown_203B3F4->unk8 = gUnknown_203B3F4->menuItems[0].menuAction;
}
void sub_803AAC4(void)
{
switch(sub_8021274(1))
{
case 0:
case 1:
break;
case 3:
gUnknown_203B3F4->friendArea = sub_802132C();
sub_803A924(2);
break;
case 4:
gUnknown_203B3F4->friendArea = sub_802132C();
sub_803A924(3);
break;
case 2:
sub_80213A0();
sub_803A924(4);
break;
}
}
void sub_803AB34(void)
{
s32 temp;
temp = 0;
sub_8021274(0);
if(!sub_8012FD8(&gUnknown_203B3F4->unk4C))
sub_8013114(&gUnknown_203B3F4->unk4C, &temp);
switch(temp)
{
case 2:
UnlockFriendArea(gUnknown_203B3F4->friendArea);
sub_803A924(1);
break;
case 3:
sub_809249C(gUnknown_203B3F4->friendArea, 1);
sub_803A924(1);
break;
case 4:
sub_803A924(3);
break;
case 1:
sub_803A924(1);
break;
}
}
void sub_803ABAC(void)
{
switch(sub_80217EC())
{
case 2:
case 3:
sub_8021830();
sub_803A924(1);
break;
case 0:
case 1:
break;
}
}

View File

@ -1,8 +1,26 @@
#include "global.h"
#include "dungeon_pokemon_attributes_1.h"
#include "constants/status.h"
#include "constants/tactic.h"
extern bool8 IsIQSkillSet(u8 *, u32);
extern u8 HasItem(struct DungeonEntity *, u32);
bool8 sub_8071884(struct DungeonEntity *pokemon)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
if(pokemonData->eyesightStatus != EYESIGHT_STATUS_EYEDROPS)
{
if(!HasItem(pokemon, ITEM_ID_GOGGLE_SPECS))
return FALSE;
else
return TRUE;
}
else
return TRUE;
}
bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
@ -13,3 +31,13 @@ bool8 HasTactic(struct DungeonEntity *pokemon, u8 tactic)
}
return pokemonData->tactic == tactic;
}
bool8 HasIQSkill(struct DungeonEntity* pokemon, u8 IQSkill)
{
return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill);
}
bool8 HasIQSkillPair(struct DungeonEntity* pokemon, u8 IQSkill1, u8 IQSkill2)
{
return IsIQSkillSet(pokemon->entityData->IQSkillsEnabled, 1 << IQSkill1 | 1 << IQSkill2);
}

View File

@ -1,6 +1,19 @@
#include "global.h"
#include "dungeon_util.h"
extern struct MapTile* GetMapTileAtPosition(s16, s16);
struct unk8049590
{
u16 unk0;
u16 fill2;
u16 unk4;
u16 unk6;
u8 unk8;
};
extern struct unk8049590 *sub_8049590(s16, s16);
bool8 EntityExists(struct DungeonEntity *entity)
{
if (!entity)
@ -9,3 +22,43 @@ bool8 EntityExists(struct DungeonEntity *entity)
}
return entity->entityType != ENTITY_NONE;
}
u32 GetEntityType(struct DungeonEntity *entity)
{
return entity->entityType;
}
u8 GetEntityRoomIndex(struct DungeonEntity *entity)
{
return entity->roomIndex;
}
struct DungeonEntityData *sub_8045104(struct DungeonEntity *entity)
{
return entity->entityData;
}
struct ItemSlot *GetItemData(struct DungeonEntity *entity)
{
return (struct ItemSlot *)entity->entityData;
}
struct DungeonEntityData *sub_804510C(struct DungeonEntity *entity)
{
return entity->entityData;
}
struct DungeonEntityData *sub_8045110(struct DungeonEntity *entity)
{
return entity->entityData;
}
struct MapTile *sub_8045114(struct DungeonEntity *entity)
{
return GetMapTileAtPosition(entity->posWorldX, entity->posWorldY);
}
struct unk8049590 *sub_8045128(struct DungeonEntity *entity)
{
return sub_8049590(entity->posWorldX, entity->posWorldY);
}

View File

@ -73,14 +73,14 @@ void InitializeRecruitedPokemon(void)
// pokemon.IQ = 1;
// pokemon.unkC[0].unk0 = 0;
// pokemon.unkC[1].unk0 = 0;
// sub_808EC94((u8*)&pokemon.unk20, 0);
// SetDefaultIQSkills((u8*)&pokemon.IQSkills, 0);
// pokemon.speciesNum = species;
// pokemon.heldItem.itemIndex = 0;
// pokemon.heldItem.numItems = 0;
// pokemon.unk1C = 0;
// pokemon.unk24 = 0;
// pokemon.unk4.unk5 = 0;
// sub_808E490(pokemon.unk2C, species);
// sub_808E490(pokemon.moves, species);
// // mostly incorrect below this:
// if (!a3) {

View File

@ -1,6 +1,8 @@
#include "global.h"
#include "pokemon.h"
#include "random.h"
#include "constants/iq_skill.h"
#include "constants/tactic.h"
extern u32 gIQSkillNames[];
extern u32 gIQSkillDescriptions[];
@ -8,9 +10,9 @@ extern u32 gTacticsDescriptions[];
extern u8 *gTactics[];
extern u8 gUnknown_810A36B[];
extern s16 gUnknown_810A378[];
extern s32 gUnknown_810A390[];
extern u32 gUnknown_81076E4[];
extern s16 gReqTacticLvls[];
extern s32 gReqIQSkillPts[];
extern u32 gIQSkillGroups[];
struct unkStruct_808E9EC
{
@ -43,8 +45,8 @@ extern s16 gUnknown_810AC66; // 0x8
// 2, 4, 6, 7, 8, 9, 0xA, 0xD, 0xF, 0x11
extern s32 gUnknown_810AC90[10];
extern bool8 sub_808ECD0(u8 *, u32);
extern void sub_808EC30(u8 *, u32);
extern bool8 IsIQSkillSet(u8 *, u32);
extern void SetIQSkill(u8 *, u32);
extern void AddSprite(u16 *, u32, u32, u32);
extern void xxx_save_poke_sub_4_80902F4(struct unkStruct_8094924*, struct unkPokeSubStruct_4*);
@ -484,84 +486,79 @@ u8 sub_808EAFC(u8 r0)
return gUnknown_810A36B[r0];
}
void sub_808EB0C(u8 *r0, s32 r1)
void sub_808EB0C(u8 *r0, s32 pokeLevel)
{
s32 counter;
s32 storage;
u32 index;
storage = 0;
index = 0;
for(counter = 0; counter <= 0xB; counter++)
s32 tactic;
s32 availTactics;
availTactics = 0;
for(tactic = TACTIC_LETS_GO_TOGETHER; tactic < NUM_TACTICS; tactic++)
{
if(gUnknown_810A378[index] <= r1)
if(gReqTacticLvls[tactic] <= pokeLevel)
{
r0[storage] = counter;
storage++;
r0[availTactics] = tactic;
availTactics++;
}
index++;
}
if(storage > 0xB)
if(availTactics > TACTIC_UNUSED)
{
return;
}
while(storage <= 0xB)
while(availTactics < NUM_TACTICS)
{
r0[storage] = 0xB;
storage++;
r0[availTactics] = TACTIC_UNUSED;
availTactics++;
}
}
void sub_808EB48(u8 *r0, s32 r1)
void sub_808EB48(u8 *r0, s32 pokeLevel)
{
s32 counter;
s32 tactic;
for(counter = 0; counter <= 0xB; counter++)
for(tactic = TACTIC_LETS_GO_TOGETHER; tactic < NUM_TACTICS; tactic++)
{
if(gUnknown_810A378[counter] <= r1)
if(gReqTacticLvls[tactic] <= pokeLevel)
{
r0[counter] = TRUE;
r0[tactic] = TRUE;
}
else
{
r0[counter] = FALSE;
r0[tactic] = FALSE;
}
}
}
bool8 sub_808EB7C(s32 r0, u8 r1)
bool8 HasIQForSkill(s32 pokeIQ, u8 IQSkillIndex)
{
if(r1 == 0)
if(IQSkillIndex == 0)
{
return FALSE;
}
return gUnknown_810A390[r1] <= r0;
return gReqIQSkillPts[IQSkillIndex] <= pokeIQ;
}
s32 sub_808EBA8(u8 param_1[], s32 param_2)
s32 GetNumAvailableIQSkills(u8 *param_1, s32 pokeIQ)
{
s32 counter_2;
s32 counter_1;
u8 cast_u8;
s32 index;
index = 0;
u8 iqSkill_u8;
s32 availIQSkills;
for(counter_1 = 1; counter_1 < 0x18; counter_1++) {
cast_u8 = counter_1; // force this cast to be in a reg
if (sub_808EB7C(param_2, cast_u8)) {
param_1[index] = cast_u8;
index++;
availIQSkills = 0;
for(counter_1 = IQ_SKILL_TYPE_ADVANTAGE_MASTER; counter_1 < NUM_IQ_SKILLS; counter_1++) {
iqSkill_u8 = counter_1; // force this cast to be in a reg
if (HasIQForSkill(pokeIQ, iqSkill_u8)) {
param_1[availIQSkills] = iqSkill_u8;
availIQSkills++;
}
}
counter_2 = index; // set counter to where the first loop ended
while (counter_2 < 0x18) {
for (counter_2 = availIQSkills; counter_2 < NUM_IQ_SKILLS; counter_2++) {
param_1[counter_2] = 0;
counter_2++;
}
return index;
return availIQSkills;
}
void sub_808EBF4(u8 *param_1, u32 param_2)
@ -569,67 +566,68 @@ void sub_808EBF4(u8 *param_1, u32 param_2)
int iVar2; // a mask?
iVar2 = 1 << (param_2);
if (sub_808ECD0(param_1,iVar2)) {
if (IsIQSkillSet(param_1, iVar2)) {
param_1[0] = param_1[0] & ~iVar2;
param_1[1] = param_1[1] & ~(iVar2 >> 8);
param_1[2] = param_1[2] & ~(iVar2 >> 0x10);
}
else
{
sub_808EC30(param_1,param_2);
SetIQSkill(param_1, param_2);
}
}
void sub_808EC30(u8 *param_1, u32 param_2)
void SetIQSkill(u8 *param_1, u32 skillIndex)
{
s32 iVar1;
s32 counter;
s32 iVar4;
s32 iqSkill;
s32 iqSkillGroup;
s32 iVar5;
counter = 0;
iVar4 = gUnknown_81076E4[param_2];
do {
if (iVar4 == gUnknown_81076E4[counter]) {
iVar1 = 1 << (counter);
for (iqSkill = 0, iqSkillGroup = gIQSkillGroups[skillIndex]; iqSkill < NUM_IQ_SKILLS; iqSkill++)
{
// Turn off each IQ Skill that's in the same group as the chosen skill
if (iqSkillGroup == gIQSkillGroups[iqSkill]) {
iVar1 = 1 << (iqSkill);
param_1[0] = param_1[0] & ~iVar1;
param_1[1] = param_1[1] & ~(iVar1 >> 8);
param_1[2] = param_1[2] & ~(iVar1 >> 0x10);
}
counter++;
} while (counter < 0x18);
}
iVar5 = 1 << (param_2);
param_1[0] = iVar5 | param_1[0];
param_1[1] = (iVar5 >> 8) | param_1[1];
param_1[2] = (iVar5 >> 0x10) | param_1[2];
iVar5 = 1 << (skillIndex);
param_1[0] |= iVar5;
param_1[1] |= (iVar5 >> 8);
param_1[2] |= (iVar5 >> 0x10);
}
void sub_808EC94(u8 *param_1, u8 param_2)
void SetDefaultIQSkills(u8 *param_1, bool8 enableSelfCurer)
{
param_1[0] = 0;
param_1[1] = 0;
param_1[2] = 0;
sub_808EC30(param_1, 2);
sub_808EC30(param_1, 3);
sub_808EC30(param_1, 0x16);
if (param_2 != 0) {
sub_808EC30(param_1, 0x12);
SetIQSkill(param_1, IQ_SKILL_ITEM_CATCHER);
SetIQSkill(param_1, IQ_SKILL_COURSE_CHECKER);
SetIQSkill(param_1, IQ_SKILL_ITEM_MASTER);
// Flag is usually enabled for Boss fights..
if (enableSelfCurer) {
SetIQSkill(param_1, IQ_SKILL_SELF_CURER);
}
}
bool8 sub_808ECD0(u8 *param_1, u32 param_2)
bool8 IsIQSkillSet(u8 *param_1, u32 param_2)
{
if ((((param_1[0] & param_2) == 0) &&
((param_1[1] & param_2 >> 8) == 0)) &&
((param_1[2] & param_2 >> 0x10) == 0))
{
return 0;
return FALSE;
}
else {
return 1;
return TRUE;
}
}
@ -765,7 +763,7 @@ void SavePokemonStruct(struct unkStruct_8094924* a1, struct PokemonStruct* pokem
SaveIntegerBits(a1, &pokemon->offense.def[0], 8);
SaveIntegerBits(a1, &pokemon->offense.def[1], 8);
SaveIntegerBits(a1, &pokemon->unk1C, 24);
SaveIntegerBits(a1, &pokemon->unk20, 24);
SaveIntegerBits(a1, &pokemon->IQSkills, 24);
SaveIntegerBits(a1, &pokemon->unk24, 4);
SaveHeldItem(a1, &pokemon->heldItem);
SavePokemonMoves(a1, pokemon->moves);
@ -792,7 +790,7 @@ void RestorePokemonStruct(struct unkStruct_8094924* a1, struct PokemonStruct* po
RestoreIntegerBits(a1, &pokemon->offense.def[0], 8);
RestoreIntegerBits(a1, &pokemon->offense.def[1], 8);
RestoreIntegerBits(a1, &pokemon->unk1C, 24);
RestoreIntegerBits(a1, &pokemon->unk20, 24);
RestoreIntegerBits(a1, &pokemon->IQSkills, 24);
RestoreIntegerBits(a1, &pokemon->unk24, 4);
RestoreHeldItem(a1, &pokemon->heldItem);
RestorePokemonMoves(a1, pokemon->moves);
@ -833,7 +831,7 @@ s32 SavePokemonStruct2(u8* a1, s32 size)
SaveItemSlot(&backup, &pokemon2->itemSlot);
sub_809449C(&backup, &pokemon2->unk44);
sub_809449C(&backup, &pokemon2->unk48);
SaveIntegerBits(&backup, &pokemon2->unk4C, 24);
SaveIntegerBits(&backup, &pokemon2->IQSkills, 24);
SaveIntegerBits(&backup, &pokemon2->unk50, 4);
sub_808F448(&backup, &pokemon2->unk54);
SaveIntegerBits(&backup, &pokemon2->name, 80);
@ -881,7 +879,7 @@ s32 RestorePokemonStruct2(u8* a1, s32 size)
RestoreItemSlot(&backup, &pokemon2->itemSlot);
sub_809447C(&backup, &pokemon2->unk44);
sub_809447C(&backup, &pokemon2->unk48);
RestoreIntegerBits(&backup, &pokemon2->unk4C, 24);
RestoreIntegerBits(&backup, &pokemon2->IQSkills, 24);
RestoreIntegerBits(&backup, &pokemon2->unk50, 4);
sub_808F428(&backup, &pokemon2->unk54);
RestoreIntegerBits(&backup, &pokemon2->name, 80);

View File

@ -526,7 +526,7 @@ void xxx_pokemonstruct_to_pokemon2_808DE50(struct PokemonStruct2 * a1, struct Po
a1->unk0 = pokemon->unk0;
a1->unkHasNextStage = pokemon->unkHasNextStage;
a1->IQ = pokemon->IQ;
a1->unk4C = pokemon->unk20;
a1->IQSkills = pokemon->IQSkills;
sub_808E6F4(&a1->unk54);
a1->unk4 = pokemon->unk4;
a1->unk2 = pokemon->unk2;
@ -580,7 +580,7 @@ void xxx_pokemon2_to_pokemonstruct_808DF44(struct PokemonStruct* pokemon, struct
pokemon->unk0 = a2->unk0;
pokemon->unkHasNextStage = a2->unkHasNextStage;
pokemon->IQ = a2->IQ;
pokemon->unk20 = a2->unk4C;
pokemon->IQSkills = a2->IQSkills;
pokemon->unk4 = a2->unk4;
pokemon->unk2 = a2->unk2;
pokemon->speciesNum = a2->speciesNum;