pokemon 3 is almost decompiled

This commit is contained in:
DizzyEggg 2017-09-12 15:05:40 +02:00
parent 6539188fa6
commit 0fe7030230
30 changed files with 254 additions and 415 deletions

View file

@ -8082,7 +8082,7 @@ _0803AE0A:
add r1, r10
ldr r2, [r1]
movs r1, 0x2
bl SetPokedexFlag
bl HandleSetPokedexFlag
b _0803AEC0
.pool
_0803AE60:
@ -8109,7 +8109,7 @@ _0803AE60:
add r1, r10
ldr r2, [r1]
movs r1, 0x2
bl SetPokedexFlag
bl HandleSetPokedexFlag
_0803AE96:
movs r0, 0
bl dp01_build_cmdbuf_x04_4_4_4
@ -8669,7 +8669,7 @@ _0803B334:
adds r1, r7
ldr r2, [r1]
movs r1, 0x2
bl SetPokedexFlag
bl HandleSetPokedexFlag
_0803B36C:
ldrb r0, [r4]
adds r0, 0x1

View file

@ -12378,7 +12378,7 @@ atk4E_switchin_anim: @ 804CAE8
adds r1, r4
ldr r2, [r1]
movs r1, 0x2
bl SetPokedexFlag
bl HandleSetPokedexFlag
_0804CB3E:
ldr r2, =gAbsentBankFlags
ldr r1, =gBitTable
@ -29984,7 +29984,7 @@ _08056480:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
movs r4, 0xA
cmp r0, 0
@ -30385,7 +30385,7 @@ atkF1_setpoke_as_caught: @ 8056850
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080568A8
@ -30411,7 +30411,7 @@ _080568A8:
lsrs r0, 16
movs r1, 0x3
adds r2, r4, 0
bl SetPokedexFlag
bl HandleSetPokedexFlag
ldr r1, =gBattlescriptCurrInstr
ldr r0, [r1]
adds r0, 0x5

View file

@ -4193,13 +4193,13 @@ _08066892:
cmp r0, 0
beq _080668BC
_080668AA:
ldr r0, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0831F578
adds r0, 0x4F
ldrb r0, [r0]
b _0806694C
.pool
_080668BC:
ldr r0, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0831F578
adds r0, 0x4E
ldrb r0, [r0]
b _0806694C
@ -4243,13 +4243,13 @@ _080668FE:
cmp r0, 0
beq _08066924
_08066916:
ldr r0, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0831F578
adds r0, 0x51
ldrb r0, [r0]
b _0806694C
.pool
_08066924:
ldr r0, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0831F578
adds r0, 0x50
ldrb r0, [r0]
b _0806694C

View file

@ -1638,7 +1638,7 @@ _080F66DA:
lsls r0, 16
lsrs r0, 16
movs r1, 0x2
bl pokedex_flag_operation
bl GetSetPokedexFlag
adds r5, 0x40
subs r4, 0x1
cmp r4, 0

View file

@ -3688,7 +3688,7 @@ sub_8177388: @ 8177388
_081773B4:
adds r0, r4, 0
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _081773D4

View file

@ -10177,7 +10177,7 @@ _0811F146:
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _0811F166
@ -11016,7 +11016,7 @@ _0811F7D8:
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
lsrs r0, 24
b _0811F82C
@ -11030,7 +11030,7 @@ _0811F7EE:
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
_0811F808:
movs r0, 0x1
b _0811F82C

View file

@ -218,10 +218,10 @@ sub_80714B8: @ 80714B8
lsrs r4, 16
adds r0, r4, 0
movs r1, 0x2
bl pokedex_flag_operation
bl GetSetPokedexFlag
adds r0, r4, 0
movs r1, 0x3
bl pokedex_flag_operation
bl GetSetPokedexFlag
ldr r1, =gStringVar1
adds r0, r5, 0
bl pokemon_get_nick

View file

@ -1142,13 +1142,13 @@ _0813E4A0:
lsls r0, 16
lsrs r0, 16
movs r1, 0x2
bl pokedex_flag_operation
bl GetSetPokedexFlag
ldrh r0, [r4, 0xC]
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r0, 16
movs r1, 0x3
bl pokedex_flag_operation
bl GetSetPokedexFlag
mov r0, r9
movs r1, 0xB
bl GetMonData
@ -1653,13 +1653,13 @@ _0813E99E:
lsls r0, 16
lsrs r0, 16
movs r1, 0x2
bl pokedex_flag_operation
bl GetSetPokedexFlag
ldrh r0, [r4, 0xC]
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r0, 16
movs r1, 0x3
bl pokedex_flag_operation
bl GetSetPokedexFlag
movs r0, 0xE
bl IncrementGameStat
b _0813F1A4
@ -2837,13 +2837,13 @@ _0813F4F2:
lsls r0, 16
lsrs r0, 16
movs r1, 0x2
bl pokedex_flag_operation
bl GetSetPokedexFlag
ldrh r0, [r4, 0xC]
bl SpeciesToNationalPokedexNum
lsls r0, 16
lsrs r0, 16
movs r1, 0x3
bl pokedex_flag_operation
bl GetSetPokedexFlag
movs r0, 0xE
bl IncrementGameStat
b _0813FCC4

View file

@ -3940,7 +3940,7 @@ AddBirchSpeechObjects: @ 803192C
strb r1, [r2]
strh r0, [r5, 0x1A]
movs r0, 0x3C
bl TrainerClassToTrainerPic
bl sub_806EFF0
lsls r0, 24
lsrs r0, 24
ldr r4, =0x0201c000
@ -3970,7 +3970,7 @@ AddBirchSpeechObjects: @ 803192C
strb r1, [r2, 0x5]
strh r0, [r5, 0x1C]
movs r0, 0x3F
bl TrainerClassToTrainerPic
bl sub_806EFF0
lsls r0, 24
lsrs r0, 24
ldr r1, =0x0201c000

View file

@ -711,10 +711,10 @@ _08153D4C:
lsrs r4, 16
adds r0, r4, 0
movs r1, 0x2
bl pokedex_flag_operation
bl GetSetPokedexFlag
adds r0, r4, 0
movs r1, 0x3
bl pokedex_flag_operation
bl GetSetPokedexFlag
_08153D86:
adds r0, r7, 0
movs r1, 0xC

View file

@ -2450,7 +2450,7 @@ _080BC976:
strh r0, [r1]
ldrh r0, [r5, 0x4]
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
mov r3, r8
ldr r2, [r3]
adds r2, r4
@ -2465,7 +2465,7 @@ _080BC976:
strb r0, [r2, 0x2]
ldrh r0, [r5, 0x4]
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
mov r1, r8
ldr r3, [r1]
adds r3, r4
@ -2520,7 +2520,7 @@ _080BCA1A:
strh r0, [r6, 0x4]
ldrh r0, [r6, 0x4]
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
adds r7, r4, 0
cmp r0, 0
@ -2541,7 +2541,7 @@ _080BCA36:
strh r0, [r1]
ldrh r0, [r6, 0x4]
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
mov r1, r8
ldr r2, [r1]
adds r2, r4
@ -2558,7 +2558,7 @@ _080BCA36:
strb r0, [r2, 0x2]
ldrh r0, [r6, 0x4]
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
mov r2, r8
ldr r3, [r2]
adds r3, r4
@ -2625,7 +2625,7 @@ _080BCADA:
bhi _080BCB58
ldrh r0, [r5, 0x4]
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080BCB58
@ -2646,7 +2646,7 @@ _080BCADA:
strb r0, [r2, 0x2]
ldrh r0, [r5, 0x4]
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
mov r1, r8
ldr r3, [r1]
adds r1, r3, r6
@ -2701,7 +2701,7 @@ _080BCB82:
bhi _080BCBE2
ldrh r0, [r5, 0x4]
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080BCBE2
@ -2768,7 +2768,7 @@ _080BCC16:
bhi _080BCC7E
ldrh r0, [r5, 0x4]
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080BCC7E
@ -2833,7 +2833,7 @@ _080BCCAA:
bhi _080BCD0A
ldrh r0, [r5, 0x4]
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080BCD0A
@ -2900,7 +2900,7 @@ _080BCD3E:
bhi _080BCDA6
ldrh r0, [r5, 0x4]
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080BCDA6
@ -9408,9 +9408,9 @@ _080C065C:
.pool
thumb_func_end GetPokedexHeightWeight
thumb_func_start pokedex_flag_operation
@ u8 pokedex_flag_operation(u16 nationalPokedexNum, u8 op)
pokedex_flag_operation: @ 80C0664
thumb_func_start GetSetPokedexFlag
@ u8 GetSetPokedexFlag(u16 nationalPokedexNum, u8 op)
GetSetPokedexFlag: @ 80C0664
push {r4-r7,lr}
lsls r0, 16
lsls r1, 24
@ -9595,7 +9595,7 @@ _080C07E8:
pop {r1}
bx r1
.pool
thumb_func_end pokedex_flag_operation
thumb_func_end GetSetPokedexFlag
thumb_func_start pokedex_count
pokedex_count: @ 80C07F4
@ -9625,7 +9625,7 @@ _080C081A:
lsrs r0, 16
movs r1, 0x1
_080C0822:
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080C0832
@ -9675,7 +9675,7 @@ _080C086C:
lsrs r0, 16
movs r1, 0x1
_080C087C:
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080C088C
@ -9719,7 +9719,7 @@ _080C08BC:
lsrs r0, 16
movs r1, 0x1
_080C08C4:
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080C08D4
@ -9750,7 +9750,7 @@ _080C08E8:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
bne _080C0908
@ -9777,7 +9777,7 @@ _080C091C:
lsrs r4, r0, 16
adds r0, r4, 0
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
bne _080C0934
@ -9804,7 +9804,7 @@ _080C0948:
lsrs r4, r0, 16
adds r0, r4, 0
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080C0996
@ -9818,7 +9818,7 @@ _080C0964:
lsrs r4, r0, 16
adds r0, r4, 0
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080C0996
@ -9833,7 +9833,7 @@ _080C0982:
lsrs r4, r0, 16
adds r0, r4, 0
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
bne _080C09A0

View file

@ -1012,7 +1012,7 @@ _08068B78:
lsls r2, 1
adds r2, r0
ldrh r0, [r2]
bl TrainerClassToTrainerPic
bl sub_806EFF0
lsls r0, 16
lsrs r0, 16
pop {r1}

View file

@ -7,332 +7,6 @@
thumb_func_start sub_806EF08
sub_806EF08: @ 806EF08
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
movs r5, 0
bl GetMultiplayerId
lsls r0, 24
lsrs r0, 24
ldr r2, =gLinkPlayers
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
adds r1, r2
ldrh r0, [r1, 0x18]
cmp r0, 0x1
beq _0806EF4C
cmp r0, 0x1
bgt _0806EF38
cmp r0, 0
beq _0806EF42
b _0806EF56
.pool
_0806EF38:
cmp r0, 0x2
beq _0806EF42
cmp r0, 0x3
beq _0806EF4C
b _0806EF56
_0806EF42:
movs r5, 0x3
cmp r4, 0
beq _0806EF56
movs r5, 0x1
b _0806EF56
_0806EF4C:
negs r0, r4
orrs r0, r4
asrs r5, r0, 31
movs r0, 0x2
ands r5, r0
_0806EF56:
movs r2, 0
ldr r4, =gLinkPlayers
ldrh r0, [r4, 0x18]
adds r1, r5, 0
cmp r0, r1
beq _0806EF74
adds r3, r1, 0
adds r1, r4, 0
_0806EF66:
adds r1, 0x1C
adds r2, 0x1
cmp r2, 0x3
bgt _0806EF74
ldrh r0, [r1, 0x18]
cmp r0, r3
bne _0806EF66
_0806EF74:
lsls r0, r2, 24
lsrs r0, 24
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_806EF08
thumb_func_start sub_806EF84
sub_806EF84: @ 806EF84
push {r4,lr}
lsls r0, 24
lsrs r3, r0, 24
lsls r1, 24
lsrs r1, 24
movs r4, 0
ldr r2, =gLinkPlayers
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r0, r2
ldrh r0, [r0, 0x18]
cmp r0, 0x1
beq _0806EFC4
cmp r0, 0x1
bgt _0806EFB0
cmp r0, 0
beq _0806EFBA
b _0806EFCE
.pool
_0806EFB0:
cmp r0, 0x2
beq _0806EFBA
cmp r0, 0x3
beq _0806EFC4
b _0806EFCE
_0806EFBA:
movs r4, 0x3
cmp r3, 0
beq _0806EFCE
movs r4, 0x1
b _0806EFCE
_0806EFC4:
negs r0, r3
orrs r0, r3
asrs r4, r0, 31
movs r0, 0x2
ands r4, r0
_0806EFCE:
movs r3, 0
ldrh r0, [r2, 0x18]
adds r1, r4, 0
cmp r0, r1
beq _0806EFE6
_0806EFD8:
adds r2, 0x1C
adds r3, 0x1
cmp r3, 0x3
bgt _0806EFE6
ldrh r0, [r2, 0x18]
cmp r0, r1
bne _0806EFD8
_0806EFE6:
lsls r0, r3, 24
lsrs r0, 24
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_806EF84
thumb_func_start TrainerClassToTrainerPic
@ u8 TrainerClassToTrainerPic(u16 trainerClassId)
TrainerClassToTrainerPic: @ 806EFF0
lsls r0, 16
lsrs r0, 16
ldr r1, =gTrainerClassToPicIndex
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end TrainerClassToTrainerPic
thumb_func_start sub_806F000
sub_806F000: @ 806F000
push {lr}
lsls r0, 24
cmp r0, 0
bne _0806F00C
movs r0, 0x3C
b _0806F00E
_0806F00C:
movs r0, 0x3F
_0806F00E:
bl TrainerClassToTrainerPic
lsls r0, 16
lsrs r0, 16
pop {r1}
bx r1
thumb_func_end sub_806F000
thumb_func_start SetPokedexFlag
@ void SetPokedexFlag(u16 nationalPokedexNum, u8 op, u32 personality)
SetPokedexFlag: @ 806F01C
push {r4-r7,lr}
adds r7, r2, 0
lsls r0, 16
lsrs r4, r0, 16
adds r6, r4, 0
lsls r1, 24
lsrs r5, r1, 24
movs r0, 0x2
eors r0, r5
negs r1, r0
orrs r1, r0
lsrs r1, 31
adds r0, r4, 0
bl pokedex_flag_operation
lsls r0, 24
cmp r0, 0
bne _0806F072
adds r0, r4, 0
adds r1, r5, 0
bl pokedex_flag_operation
adds r0, r4, 0
bl NationalPokedexNumToSpecies
lsls r0, 16
lsrs r0, 16
cmp r0, 0xC9
bne _0806F05C
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
str r7, [r0, 0x1C]
_0806F05C:
adds r0, r6, 0
bl NationalPokedexNumToSpecies
lsls r0, 16
movs r1, 0x9A
lsls r1, 17
cmp r0, r1
bne _0806F072
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
str r7, [r0, 0x20]
_0806F072:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end SetPokedexFlag
thumb_func_start sub_806F07C
sub_806F07C: @ 806F07C
push {lr}
lsls r0, 16
lsrs r2, r0, 16
ldr r0, =0x00000356
cmp r2, r0
bls _0806F08A
movs r2, 0
_0806F08A:
ldr r1, =gTrainers
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
adds r0, r1
ldrb r1, [r0, 0x1]
movs r0, 0xD
muls r0, r1
ldr r1, =gTrainerClassNames
adds r0, r1
pop {r1}
bx r1
.pool
thumb_func_end sub_806F07C
thumb_func_start sub_806F0B0
sub_806F0B0: @ 806F0B0
push {lr}
lsls r0, 16
lsrs r1, r0, 16
ldr r0, =0x00000356
cmp r1, r0
bls _0806F0BE
movs r1, 0
_0806F0BE:
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
ldr r1, =gTrainers + 0x4 @ name offset
adds r0, r1
pop {r1}
bx r1
.pool
thumb_func_end sub_806F0B0
thumb_func_start HasTwoFramesAnimation
HasTwoFramesAnimation: @ 806F0D4
push {lr}
lsls r0, 16
lsrs r2, r0, 16
movs r1, 0
ldr r0, =0x00000181
cmp r2, r0
beq _0806F0F8
adds r0, 0x19
cmp r2, r0
beq _0806F0F8
subs r0, 0x66
cmp r2, r0
beq _0806F0F8
movs r1, 0xC9
eors r1, r2
negs r0, r1
orrs r0, r1
lsrs r1, r0, 31
_0806F0F8:
adds r0, r1, 0
pop {r1}
bx r1
.pool
thumb_func_end HasTwoFramesAnimation
thumb_func_start sub_806F104
sub_806F104: @ 806F104
push {lr}
ldr r2, =gMain
ldr r1, =0x00000439
adds r0, r2, r1
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _0806F122
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
ldr r1, =0x003f0100
ands r0, r1
cmp r0, 0
bne _0806F144
_0806F122:
ldr r1, =0x00000439
adds r0, r2, r1
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _0806F158
bl InBattlePike
lsls r0, 24
cmp r0, 0
bne _0806F144
bl InBattlePyramid
lsls r0, 24
cmp r0, 0
beq _0806F158
_0806F144:
movs r0, 0x1
b _0806F15A
.pool
_0806F158:
movs r0, 0
_0806F15A:
pop {r1}
bx r1
thumb_func_end sub_806F104
thumb_func_start sub_806F160
sub_806F160: @ 806F160
push {r4-r7,lr}

View file

@ -4566,7 +4566,7 @@ _08137B7C:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
bne _08137BEA
@ -4576,7 +4576,7 @@ _08137B7C:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
bne _08137BEA
@ -4590,7 +4590,7 @@ _08137BB8:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _08137C04
@ -4600,7 +4600,7 @@ _08137BB8:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _08137C04

View file

@ -3922,7 +3922,7 @@ sub_8074310: @ 8074310
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _080743E6

View file

@ -1340,7 +1340,7 @@ sub_8162AA0: @ 8162AA0
lsls r0, 1
cmp r4, r0
bne _08162AD0
ldr r1, =gTrainerClassToPicIndex
ldr r1, =gUnknown_0831F578
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r2, =0x00000bed
@ -1362,7 +1362,7 @@ _08162AE4:
ldr r0, =0x0000012b
cmp r4, r0
bhi _08162B08
ldr r2, =gTrainerClassToPicIndex
ldr r2, =gUnknown_0831F578
ldr r0, =gUnknown_0203BC88
ldr r1, [r0]
movs r0, 0x34
@ -1383,7 +1383,7 @@ _08162B08:
ands r0, r1
cmp r0, 0
beq _08162B38
ldr r4, =gTrainerClassToPicIndex
ldr r4, =gUnknown_0831F578
bl sub_818649C
lsls r0, 24
lsrs r0, 24
@ -1391,7 +1391,7 @@ _08162B08:
b _08162BC8
.pool
_08162B38:
ldr r3, =gTrainerClassToPicIndex
ldr r3, =gUnknown_0831F578
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r1, =0xfffffed4
@ -1413,7 +1413,7 @@ _08162B64:
ands r0, r1
cmp r0, 0
bne _08162BB0
ldr r4, =gTrainerClassToPicIndex
ldr r4, =gUnknown_0831F578
ldr r3, =gUnknown_08610970
ldr r0, =gSaveBlock2Ptr
ldr r1, [r0]
@ -1436,7 +1436,7 @@ _08162B64:
b _08162BC8
.pool
_08162BB0:
ldr r5, =gTrainerClassToPicIndex
ldr r5, =gUnknown_0831F578
ldr r4, =gUnknown_08610970
bl sub_81864A8
lsls r0, 24
@ -5845,7 +5845,7 @@ _08165206:
thumb_func_start sub_8165244
sub_8165244: @ 8165244
ldr r1, =gTrainerClassToPicIndex
ldr r1, =gUnknown_0831F578
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r2, =0x00000bed

View file

@ -1263,13 +1263,13 @@ sub_818D97C: @ 818D97C
bne _0818D9A2
cmp r0, 0
beq _0818D99C
ldr r0, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0831F578
adds r0, 0x3F
ldrb r0, [r0]
b _0818D9A2
.pool
_0818D99C:
ldr r0, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0831F578
adds r0, 0x3C
ldrb r0, [r0]
_0818D9A2:

View file

@ -15869,7 +15869,7 @@ _0819702E:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _08197050
@ -15882,7 +15882,7 @@ _08197050:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _0819706C
@ -40744,7 +40744,7 @@ sub_81A3DD0: @ 81A3DD0
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _081A3ED6
@ -41123,7 +41123,7 @@ _081A4112:
lsls r0, 16
lsrs r0, 16
movs r1, 0x1
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
cmp r0, 0
beq _081A412A

View file

@ -23949,7 +23949,7 @@ _081CAF34:
adds r0, r5, 0
bl sub_81D1BD0
adds r4, r0, 0
ldr r0, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0831F578
adds r0, r4, r0
ldrb r0, [r0]
b _081CAF6C
@ -45006,7 +45006,7 @@ sub_81D5588: @ 81D5588
adds r3, r0
ldrb r4, [r3, 0x1B]
bl sub_81D5710
ldr r0, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0831F578
adds r4, r0
ldrb r0, [r4]
pop {r4}

View file

@ -5630,7 +5630,7 @@ sub_809BDD0: @ 809BDD0
lsls r4, 2
adds r4, r1
ldr r4, [r4]
bl sub_806F07C
bl GetTrainerClassNameFromId
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy
@ -5658,7 +5658,7 @@ sub_809BE0C: @ 809BE0C
lsls r4, 2
adds r4, r1
ldr r4, [r4]
bl sub_806F0B0
bl GetTrainerNameFromId
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy

View file

@ -1320,10 +1320,10 @@ sub_80F9244: @ 80F9244
blt _080F92B8
adds r0, r5, 0
movs r1, 0x2
bl pokedex_flag_operation
bl GetSetPokedexFlag
adds r0, r5, 0
movs r1, 0x3
bl pokedex_flag_operation
bl GetSetPokedexFlag
_080F92B8:
adds r0, r4, 0
add sp, 0x78

View file

@ -7885,11 +7885,11 @@ sub_807B464: @ 807B464
lsrs r4, 16
adds r0, r4, 0
movs r1, 0x2
bl pokedex_flag_operation
bl GetSetPokedexFlag
adds r0, r4, 0
movs r1, 0x3
adds r2, r5, 0
bl SetPokedexFlag
bl HandleSetPokedexFlag
_0807B4B8:
pop {r4,r5}
pop {r0}

View file

@ -4754,7 +4754,7 @@ sub_80C4FF0: @ 80C4FF0
ldr r1, =0x00000583
adds r0, r1
ldrb r0, [r0]
bl TrainerClassToTrainerPic
bl sub_806EFF0
lsls r0, 16
lsrs r0, 16
ldr r4, =gUnknown_0856FB18
@ -4795,7 +4795,7 @@ _080C5060:
adds r0, r1
adds r0, r2
ldrb r0, [r0]
bl TrainerClassToTrainerPic
bl sub_806EFF0
lsls r0, 16
lsrs r0, 16
ldr r4, =gUnknown_0856FB18

View file

@ -6988,7 +6988,7 @@ _080EFA62:
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
asrs r0, 24
cmp r0, 0x1
@ -9041,7 +9041,7 @@ sub_80F0B24: @ 80F0B24
lsls r0, 16
lsrs r0, 16
movs r1, 0
bl pokedex_flag_operation
bl GetSetPokedexFlag
lsls r0, 24
asrs r2, r0, 24
cmp r2, 0

View file

@ -1,5 +1,5 @@
.align 2
gTrainerClassToPicIndex:: @ 831F578
gUnknown_0831F578:: @ 831F578
.byte TRAINER_PIC_HIKER
.byte TRAINER_PIC_AQUA_GRUNT_M
.byte TRAINER_PIC_POKEMON_BREEDER_F

View file

@ -2,8 +2,8 @@
#define GUARD_FLAGS_H
#define TRAINER_FLAG_START 0x500
#define TRAINERS_FLAG_NO 0x360
#define CODE_FLAGS (TRAINER_FLAG_START + TRAINERS_FLAG_NO)
#define TRAINERS_FLAG_NO 0x356
#define CODE_FLAGS (TRAINER_FLAG_START + TRAINERS_FLAG_NO + 0xA)
// SYSTEM FLAGS

20
include/pokedex.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef GUARD_POKEDEX_H
#define GUARD_POKEDEX_H
void ResetPokedex(void);
const u8 *GetPokemonCategory(u16);
u16 GetPokedexHeightWeight(u16 dexNum, u8 data);
u16 GetNationalPokedexCount(u8);
u16 GetHoennPokedexCount(u8);
enum
{
FLAG_GET_SEEN,
FLAG_GET_CAUGHT,
FLAG_SET_SEEN,
FLAG_SET_CAUGHT
};
u8 GetSetPokedexFlag(u16 nationalNum, u8 caseId);
#endif // GUARD_POKEDEX_H

View file

@ -1,6 +1,7 @@
#ifndef GUARD_TRAINER_IDS_H
#define GUARD_TRAINER_IDS_H
#define TRAINER_ID_STEVEN 804
#define NO_OF_TRAINERS 854
#define TRAINER_ID_STEVEN 804
#endif // GUARD_TRAINER_IDS_H

View file

@ -27,7 +27,6 @@ extern struct Unknown_020249B4* gUnknown_020249B4[2];
extern const u32 gBitTable[];
extern const struct SpriteTemplate gUnknown_08329D98[];
extern const struct SpriteTemplate gUnknown_08329DF8[];
extern const struct SpriteTemplate gUnknown_08329D98[];
extern const union AnimCmd* gUnknown_082FF70C[];
extern const union AnimCmd* const * const gUnknown_08309AAC[];
extern const union AnimCmd* const * const gUnknown_08305D0C[];
@ -1222,14 +1221,14 @@ void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord)
}
}
extern const u8 gTrainerClassToPicIndex[];
extern const u8 gUnknown_0831F578[];
extern const u8 gTrainerClassToNameIndex[];
extern const u8 gSecretBaseTrainerClasses[][5];
u8 GetSecretBaseTrainerPicIndex(void)
{
u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5];
return gTrainerClassToPicIndex[trainerClass];
return gUnknown_0831F578[trainerClass];
}
u8 GetSecretBaseTrainerNameIndex(void)

View file

@ -21,6 +21,7 @@
#include "text.h"
#include "abilities.h"
#include "pokemon_animation.h"
#include "pokedex.h"
extern struct BattlePokemon gBattleMons[4];
extern struct BattleEnigmaBerry gEnigmaBerries[4];
@ -63,6 +64,7 @@ extern const u8 gMonAnimationDelayTable[];
extern const u8 gMonFrontAnimIdsTable[];
extern bool8 InBattlePyramid(void);
extern bool8 InBattlePike(void);
extern bool8 sub_81D5C18(void);
extern bool8 sub_806F104(void);
extern bool32 IsNationalPokedexEnabled(void);
@ -1606,3 +1608,146 @@ void BattleAnimateBackSprite(struct Sprite* sprite, u16 species)
sprite->callback = SpriteCallbackDummy_2;
}
}
u8 sub_806EF08(u8 arg0)
{
s32 i;
s32 var = 0;
u8 multiplayerId = GetMultiplayerId();
switch (gLinkPlayers[multiplayerId].lp_field_18)
{
case 0:
case 2:
var = (arg0 != 0) ? 1 : 3;
break;
case 1:
case 3:
var = (arg0 != 0) ? 2 : 0;
break;
}
for (i = 0; i < 4; i++)
{
if (gLinkPlayers[i].lp_field_18 == (s16)(var))
break;
}
return i;
}
u8 sub_806EF84(u8 arg0, u8 arg1)
{
s32 i;
s32 var = 0;
switch (gLinkPlayers[arg1].lp_field_18)
{
case 0:
case 2:
var = (arg0 != 0) ? 1 : 3;
break;
case 1:
case 3:
var = (arg0 != 0) ? 2 : 0;
break;
}
for (i = 0; i < 4; i++)
{
if (gLinkPlayers[i].lp_field_18 == (s16)(var))
break;
}
return i;
}
extern const u8 gUnknown_0831F578[];
u16 sub_806EFF0(u16 arg0)
{
return gUnknown_0831F578[arg0];
}
u16 sub_806F000(u8 playerGender)
{
if (playerGender)
return sub_806EFF0(0x3F);
else
return sub_806EFF0(0x3C);
}
extern const u8 gTrainerClassNames[][13];
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality)
{
u8 getFlagCaseId = (caseId == FLAG_SET_SEEN) ? FLAG_GET_SEEN : FLAG_GET_CAUGHT;
if (!GetSetPokedexFlag(nationalNum, getFlagCaseId)) // don't set if it's already set
{
GetSetPokedexFlag(nationalNum, caseId);
if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_UNOWN)
gSaveBlock2Ptr->pokedex.unownPersonality = personality;
if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_SPINDA)
gSaveBlock2Ptr->pokedex.spindaPersonality = personality;
}
}
const u8* GetTrainerClassNameFromId(u16 trainerId)
{
if (trainerId > NO_OF_TRAINERS)
trainerId = 0;
return gTrainerClassNames[gTrainers[trainerId].trainerClass];
}
const u8* GetTrainerNameFromId(u16 trainerId)
{
if (trainerId > NO_OF_TRAINERS)
trainerId = 0;
return gTrainers[trainerId].trainerName;
}
bool8 HasTwoFramesAnimation(u16 species)
{
return (species != SPECIES_CASTFORM
&& species != SPECIES_DEOXYS
&& species != SPECIES_SPINDA
&& species != SPECIES_UNOWN);
}
bool8 sub_806F104(void)
{
if (gMain.inBattle && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER))
return TRUE;
if (!gMain.inBattle && (InBattlePike() || InBattlePyramid()))
return TRUE;
return FALSE;
}
/*
extern const struct SpriteTemplate gUnknown_08329D98[];
struct Unknown_806F160_Struct
{
u8 field_0;
u8 field_1;
u8 field_2;
u8 field_3;
u8 field_4;
u8 field_5;
u8 field_6;
u8 field_7;
u8 field_8;
u8 field_9;
u8 field_A;
u8 field_B;
struct SpriteTemplate* templates;
};
void sub_806F160(struct Unknown_806F160_Struct* structPtr)
{
u16 i, j;
for (i = 0; i < structPtr->field_0; i++)
{
structPtr->templates[i] = gUnknown_08329D98[i];
for (j = 0; j < structPtr->field_1)
{
// no clue what the pointer in the struct point to :/
}
}
} */