mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
more of pokemon3 decompiled
This commit is contained in:
parent
154a70e228
commit
5394435520
@ -95,7 +95,7 @@ InitBattle: @ 80367D4
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08036870
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r1, [r0]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
@ -1537,12 +1537,12 @@ _08037530:
|
||||
adds r0, 0x40
|
||||
ldr r4, =gTrainerBattleOpponent_A
|
||||
ldrh r1, [r4]
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
adds r0, r6, 0
|
||||
adds r0, 0x5C
|
||||
ldr r5, =gTrainerBattleOpponent_B
|
||||
ldrh r1, [r5]
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
ldrh r1, [r4]
|
||||
mov r0, sp
|
||||
bl sub_8165B88
|
||||
|
@ -8717,7 +8717,7 @@ _0804ACE2:
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0804AD48
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r1, [r0]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
|
@ -50455,7 +50455,7 @@ battle_intro_launch: @ 81181D4
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08118208
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r1, [r0]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
|
@ -7364,7 +7364,7 @@ _0805B5E0:
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0805B618
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r1, [r0]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
@ -7413,7 +7413,7 @@ _0805B656:
|
||||
bne _0805B664
|
||||
b _0805B794
|
||||
_0805B664:
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r1, [r0]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
|
@ -4174,7 +4174,7 @@ sub_81BD37C: @ 81BD37C
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
ldr r2, =gUnknown_02038BCE
|
||||
ldr r2, =gPartnerTrainerId
|
||||
ldrh r1, [r2]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
@ -4205,7 +4205,7 @@ _081BD3BE:
|
||||
lsls r1, 15
|
||||
adds r0, r1
|
||||
lsrs r7, r0, 16
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r1, [r0]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
@ -5823,7 +5823,7 @@ sub_81BE10C: @ 81BE10C
|
||||
bl AllocSpritePalette
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
ldr r2, =gUnknown_02038BCE
|
||||
ldr r2, =gPartnerTrainerId
|
||||
ldrh r1, [r2]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
|
@ -2237,11 +2237,11 @@ _0814F584:
|
||||
b _0814F5C0
|
||||
.pool
|
||||
_0814F594:
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
_0814F596:
|
||||
ldrh r0, [r0]
|
||||
_0814F598:
|
||||
bl sub_8162BD8
|
||||
bl GetFrontierOpponentClass
|
||||
_0814F59C:
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -2254,12 +2254,12 @@ _0814F5A2:
|
||||
b _0814F5C0
|
||||
.pool
|
||||
_0814F5B4:
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
_0814F5B6:
|
||||
ldrh r1, [r0]
|
||||
_0814F5B8:
|
||||
mov r0, sp
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
_0814F5BE:
|
||||
mov r4, sp
|
||||
_0814F5C0:
|
||||
|
@ -75,7 +75,7 @@ task_add_01_battle_start: @ 80B065C
|
||||
adds r1, r2
|
||||
strh r4, [r1, 0xA]
|
||||
adds r0, r5, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
@ -1359,7 +1359,7 @@ sub_80B1158: @ 80B1158
|
||||
movs r3, 0
|
||||
bl sub_80F9244
|
||||
bl ResetTasks
|
||||
bl sub_806E64C
|
||||
bl PlayBattleBGM
|
||||
ldr r0, =sub_80B11A8
|
||||
bl SetMainCallback2
|
||||
movs r0, 0
|
||||
|
@ -1855,13 +1855,13 @@ _080B3354:
|
||||
cmp r0, 0
|
||||
beq _080B3370
|
||||
ldr r0, =0x000001dd
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
b _080B3378
|
||||
.pool
|
||||
_080B3370:
|
||||
movs r0, 0xEE
|
||||
lsls r0, 1
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
_080B3378:
|
||||
ldr r0, =gSpecialVar_0x8004
|
||||
ldrh r0, [r0]
|
||||
@ -2025,13 +2025,13 @@ _080B34DE:
|
||||
cmp r0, 0
|
||||
beq _080B34FC
|
||||
ldr r0, =0x000001dd
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
b _080B3504
|
||||
.pool
|
||||
_080B34FC:
|
||||
movs r0, 0xEE
|
||||
lsls r0, 1
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
_080B3504:
|
||||
ldr r1, =gLinkPlayers
|
||||
ldr r0, =0x00002211
|
||||
|
@ -21076,7 +21076,7 @@ sub_8014210: @ 8014210
|
||||
str r0, [r1, 0x8]
|
||||
ldr r0, =gBattleTypeFlags
|
||||
str r6, [r0]
|
||||
bl sub_806E64C
|
||||
bl PlayBattleBGM
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
|
@ -889,7 +889,7 @@ sub_817A358: @ 817A358
|
||||
movs r1, 0x1
|
||||
strb r1, [r0]
|
||||
adds r0, r4, 0
|
||||
bl sub_806E840
|
||||
bl IsPokeSpriteNotFlipped
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0817A402
|
||||
|
1000
asm/pokemon_3.s
1000
asm/pokemon_3.s
File diff suppressed because it is too large
Load Diff
@ -883,7 +883,7 @@ _081854E2:
|
||||
ldr r2, =0x000004f6
|
||||
adds r0, r7, r2
|
||||
strh r1, [r0]
|
||||
ldr r3, =gUnknown_02038BCE
|
||||
ldr r3, =gPartnerTrainerId
|
||||
ldrh r1, [r3]
|
||||
movs r4, 0x9F
|
||||
lsls r4, 3
|
||||
@ -1196,7 +1196,7 @@ _081857B6:
|
||||
b _08185856
|
||||
.pool
|
||||
_081857E4:
|
||||
ldr r3, =gUnknown_02038BCE
|
||||
ldr r3, =gPartnerTrainerId
|
||||
ldrh r3, [r3]
|
||||
adds r0, r1, r3
|
||||
lsls r0, 16
|
||||
@ -1207,7 +1207,7 @@ _081857E4:
|
||||
ldr r4, =0x00000504
|
||||
adds r3, r7, r4
|
||||
mov r10, r9
|
||||
ldr r5, =gUnknown_02038BCE
|
||||
ldr r5, =gPartnerTrainerId
|
||||
mov r12, r5
|
||||
ldr r0, =0xfffffed4
|
||||
mov r8, r0
|
||||
@ -1231,7 +1231,7 @@ _08185804:
|
||||
ble _08185804
|
||||
mov r0, r9
|
||||
ldr r1, [r0]
|
||||
ldr r2, =gUnknown_02038BCE
|
||||
ldr r2, =gPartnerTrainerId
|
||||
ldrh r0, [r2]
|
||||
ldr r3, =0xfffffed4
|
||||
adds r0, r3
|
||||
@ -1246,7 +1246,7 @@ _08185804:
|
||||
strb r1, [r0]
|
||||
mov r0, r9
|
||||
ldr r1, [r0]
|
||||
ldr r4, =gUnknown_02038BCE
|
||||
ldr r4, =gPartnerTrainerId
|
||||
ldrh r0, [r4]
|
||||
adds r0, r3
|
||||
muls r0, r2
|
||||
@ -1374,7 +1374,7 @@ _08185936:
|
||||
b _081859AC
|
||||
.pool
|
||||
_0818597C:
|
||||
ldr r3, =gUnknown_02038BCE
|
||||
ldr r3, =gPartnerTrainerId
|
||||
ldrh r0, [r3]
|
||||
cmp r0, r1
|
||||
bls _081859C0
|
||||
@ -1395,7 +1395,7 @@ _0818597C:
|
||||
adds r1, r7, r5
|
||||
strb r0, [r1]
|
||||
ldr r2, [r4]
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r1, [r0]
|
||||
adds r1, r3
|
||||
_081859AC:
|
||||
@ -1546,7 +1546,7 @@ sub_8185AB0: @ 8185AB0
|
||||
strh r1, [r0]
|
||||
ldr r0, =gTrainerBattleOpponent_B
|
||||
strh r1, [r0]
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
strh r1, [r0]
|
||||
bl sub_8185EFC
|
||||
ldr r0, =gUnknown_0203C7B0
|
||||
@ -1725,7 +1725,7 @@ _08185C2A:
|
||||
adds r0, r7, r3
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r1]
|
||||
ldr r1, =gUnknown_02038BCE
|
||||
ldr r1, =gPartnerTrainerId
|
||||
adds r2, 0x4
|
||||
adds r0, r7, r2
|
||||
ldrh r0, [r0]
|
||||
@ -1905,7 +1905,7 @@ sub_8185E24: @ 8185E24
|
||||
ldr r0, =gUnknown_0203C7B0
|
||||
str r5, [r0]
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
ldr r0, =sub_8185E8C
|
||||
bl SetMainCallback2
|
||||
_08185E6E:
|
||||
|
@ -2524,7 +2524,7 @@ _08036208:
|
||||
ands r1, r0
|
||||
cmp r1, 0
|
||||
beq _08036224
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r1, [r0]
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
|
@ -1456,8 +1456,8 @@ _08162BCA:
|
||||
.pool
|
||||
thumb_func_end sub_8162AA0
|
||||
|
||||
thumb_func_start sub_8162BD8
|
||||
sub_8162BD8: @ 8162BD8
|
||||
thumb_func_start GetFrontierOpponentClass
|
||||
GetFrontierOpponentClass: @ 8162BD8
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
@ -1594,7 +1594,7 @@ _08162D1E:
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_8162BD8
|
||||
thumb_func_end GetFrontierOpponentClass
|
||||
|
||||
thumb_func_start sub_8162D34
|
||||
sub_8162D34: @ 8162D34
|
||||
@ -1697,8 +1697,8 @@ _08162E0C:
|
||||
.pool
|
||||
thumb_func_end sub_8162D34
|
||||
|
||||
thumb_func_start sub_8162E20
|
||||
sub_8162E20: @ 8162E20
|
||||
thumb_func_start GetFrontierTrainerName
|
||||
GetFrontierTrainerName: @ 8162E20
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
lsls r1, 16
|
||||
@ -1846,7 +1846,7 @@ _08162F62:
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8162E20
|
||||
thumb_func_end GetFrontierTrainerName
|
||||
|
||||
thumb_func_start sub_8162F68
|
||||
sub_8162F68: @ 8162F68
|
||||
@ -3275,7 +3275,7 @@ _08163B56:
|
||||
_08163B64:
|
||||
movs r0, 0x2
|
||||
bl sub_816306C
|
||||
ldr r1, =gUnknown_02038BCE
|
||||
ldr r1, =gPartnerTrainerId
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r2, =0x00000cd6
|
||||
@ -3302,7 +3302,7 @@ _08163BA6:
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0
|
||||
b _08163E10
|
||||
.pool
|
||||
@ -3334,7 +3334,7 @@ _08163BC4:
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0xC
|
||||
b _08163E10
|
||||
.pool
|
||||
@ -3369,7 +3369,7 @@ _08163C18:
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0xD
|
||||
b _08163E10
|
||||
.pool
|
||||
@ -3438,7 +3438,7 @@ _08163D12:
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0x4
|
||||
b _08163E10
|
||||
.pool
|
||||
@ -3467,7 +3467,7 @@ _08163D5E:
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0x5
|
||||
b _08163E10
|
||||
.pool
|
||||
@ -3490,7 +3490,7 @@ _08163D8E:
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0x6
|
||||
b _08163E10
|
||||
.pool
|
||||
@ -3513,7 +3513,7 @@ _08163DC8:
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0xA
|
||||
b _08163E10
|
||||
.pool
|
||||
@ -3528,7 +3528,7 @@ _08163E00:
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0x7
|
||||
_08163E10:
|
||||
bl sub_80B100C
|
||||
@ -3553,13 +3553,13 @@ _08163E2C:
|
||||
strb r0, [r4]
|
||||
ldr r0, =gUnknown_08224167
|
||||
bl TrainerBattleConfigure
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
strh r5, [r0]
|
||||
ldr r0, =sub_8163A8C
|
||||
movs r1, 0x1
|
||||
bl CreateTask
|
||||
movs r0, 0
|
||||
bl PlayNewMapMusic__default_for_battle
|
||||
bl PlayMapChosenOrBattleBGM
|
||||
movs r0, 0x12
|
||||
bl sub_8145EF4
|
||||
_08163E68:
|
||||
@ -4782,7 +4782,7 @@ _081648D6:
|
||||
_081648E2:
|
||||
ldr r0, =gStringVar1
|
||||
adds r1, r7, 0
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
b _08164AC2
|
||||
.pool
|
||||
_081648F4:
|
||||
@ -4841,7 +4841,7 @@ _08164910:
|
||||
ldr r0, =gStringVar3
|
||||
mov r3, r10
|
||||
lsrs r1, r3, 16
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
b _08164AC2
|
||||
.pool
|
||||
_08164984:
|
||||
@ -4867,7 +4867,7 @@ _081649A8:
|
||||
b _08164AC2
|
||||
.pool
|
||||
_081649BC:
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
strh r7, [r0]
|
||||
ldr r0, =0x0000012b
|
||||
cmp r7, r0
|
||||
@ -4944,7 +4944,7 @@ _08164A60:
|
||||
bl sub_8162548
|
||||
lsls r0, 16
|
||||
lsrs r3, r0, 16
|
||||
ldr r0, =gUnknown_02038BCE
|
||||
ldr r0, =gPartnerTrainerId
|
||||
ldrh r0, [r0]
|
||||
cmp r0, r3
|
||||
beq _08164A60
|
||||
@ -5340,7 +5340,7 @@ sub_8164E04: @ 8164E04
|
||||
ldr r5, =gTrainerBattleOpponent_A
|
||||
ldrh r1, [r5]
|
||||
mov r0, sp
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
mov r0, sp
|
||||
bl StripExtCtrlCodes
|
||||
ldr r4, =gSaveBlock2Ptr
|
||||
|
@ -7186,7 +7186,7 @@ _08192784:
|
||||
.pool
|
||||
_08192798:
|
||||
ldr r0, [sp, 0x24]
|
||||
bl sub_8162BD8
|
||||
bl GetFrontierOpponentClass
|
||||
_0819279E:
|
||||
lsls r0, 24
|
||||
lsrs r5, r0, 24
|
||||
@ -41472,14 +41472,14 @@ _081A4450:
|
||||
ldr r0, =gStringVar1
|
||||
ldr r1, =gTrainerBattleOpponent_A
|
||||
ldrh r1, [r1]
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
b _081A446E
|
||||
.pool
|
||||
_081A4464:
|
||||
ldr r0, =gStringVar2
|
||||
ldr r1, =gTrainerBattleOpponent_A
|
||||
ldrh r1, [r1]
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
_081A446E:
|
||||
pop {r0}
|
||||
bx r0
|
||||
@ -44244,7 +44244,7 @@ sub_81A5BE0: @ 81A5BE0
|
||||
ldr r0, =gStringVar1
|
||||
ldr r1, =gTrainerBattleOpponent_A
|
||||
ldrh r1, [r1]
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
@ -80272,7 +80272,7 @@ sub_81B8A7C: @ 81B8A7C
|
||||
bne _081B8AC4
|
||||
_081B8AA2:
|
||||
ldr r4, =gStringVar1
|
||||
bl sub_806EBF8
|
||||
bl GetTrainerPartnerName
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
bl StringCopy
|
||||
@ -82460,7 +82460,7 @@ sub_81B9CF0: @ 81B9CF0
|
||||
ldr r0, =gStringVar1
|
||||
ldr r1, =gTrainerBattleOpponent_A
|
||||
ldrh r1, [r1]
|
||||
bl sub_8162E20
|
||||
bl GetFrontierTrainerName
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
|
@ -11162,7 +11162,7 @@ sub_81C47B4: @ 81C47B4
|
||||
ands r0, r1
|
||||
strb r0, [r7, 0x5]
|
||||
ldrh r0, [r6, 0x2]
|
||||
bl sub_806E840
|
||||
bl IsPokeSpriteNotFlipped
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _081C4828
|
||||
@ -11210,7 +11210,7 @@ sub_81C4844: @ 81C4844
|
||||
cmp r0, 0x1
|
||||
beq _081C487E
|
||||
ldrh r0, [r4, 0x2E]
|
||||
bl sub_806E840
|
||||
bl IsPokeSpriteNotFlipped
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
strh r0, [r4, 0x30]
|
||||
|
@ -9588,7 +9588,7 @@ _0807C66C:
|
||||
ldr r0, [r5]
|
||||
adds r0, 0xF0
|
||||
ldrh r0, [r0]
|
||||
bl sub_806E840
|
||||
bl IsPokeSpriteNotFlipped
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807C6E4
|
||||
@ -11662,7 +11662,7 @@ _0807DA74:
|
||||
ldr r0, [r5]
|
||||
adds r0, 0xF0
|
||||
ldrh r0, [r0]
|
||||
bl sub_806E840
|
||||
bl IsPokeSpriteNotFlipped
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807DAEC
|
||||
|
@ -249,7 +249,7 @@ gUnknown_085CA459:: @ 85CA459
|
||||
.string "{STRING 19} transformed!$"
|
||||
.string "{STRING 16}’s {STRING 25}\ntook the attack!$"
|
||||
|
||||
gUnknown_085CB2A1:: @ 85CB2A1
|
||||
BattleText_PreventedSwitch:: @ 85CB2A1
|
||||
|
||||
.string "{STRING 0}’s {STRING 23}\nprevents switching!\p$"
|
||||
.string "{STRING 16}’s {STRING 25}\nprevented {STRING 19}’s\l{STRING 0} from working!$"
|
||||
@ -682,7 +682,7 @@ gUnknown_085CCB8C:: @ 85CCB8C
|
||||
gUnknown_085CCB90:: @ 85CCB90
|
||||
.incbin "baserom.gba", 0x5ccb90, 0x8
|
||||
|
||||
gUnknown_085CCB98:: @ 85CCB98
|
||||
BattleText_Wally:: @ 85CCB98
|
||||
.incbin "baserom.gba", 0x5ccb98, 0x6
|
||||
|
||||
gUnknown_085CCB9E:: @ 85CCB9E
|
||||
|
@ -101,11 +101,8 @@ gUnknown_08329ECE:: @ 8329ECE
|
||||
gHMMoves:: @ 8329EEA
|
||||
.incbin "baserom.gba", 0x329eea, 0x12
|
||||
|
||||
gUnknown_08329EFC:: @ 8329EFC
|
||||
.incbin "baserom.gba", 0x329efc, 0x2
|
||||
|
||||
gAlteringCaveWildMonHeldItems:: @ 8329EFE
|
||||
.incbin "baserom.gba", 0x329efe, 0x2a
|
||||
gAlteringCaveWildMonHeldItems:: @ 8329EFC
|
||||
.incbin "baserom.gba", 0x329efc, 0x2c
|
||||
|
||||
gUnknown_08329F28:: @ 8329F28
|
||||
.incbin "baserom.gba", 0x329f28, 0x18
|
||||
|
102
include/battle.h
102
include/battle.h
@ -32,6 +32,8 @@
|
||||
#define BATTLE_TYPE_KYORGE 0x20000000
|
||||
#define BATTLE_TYPE_RAYQUAZA 0x40000000
|
||||
|
||||
#define STEVEN_PARTNER_ID 0xC03
|
||||
|
||||
#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_x100000 | BATTLE_TYPE_PYRAMID)
|
||||
|
||||
#define BATTLE_WON 0x1
|
||||
@ -337,7 +339,105 @@ struct BattleStruct
|
||||
u8 wildVictorySong;
|
||||
u8 dynamicMoveType;
|
||||
u8 wrappedBy[4];
|
||||
u8 field_18[0x63]; // TODO: expand
|
||||
u8 field_18;
|
||||
u8 field_19;
|
||||
u8 field_1A;
|
||||
u8 field_1B;
|
||||
u8 field_1C;
|
||||
u8 field_1D;
|
||||
u8 field_1E;
|
||||
u8 field_1F;
|
||||
u8 field_20;
|
||||
u8 field_21;
|
||||
u8 field_22;
|
||||
u8 field_23;
|
||||
u8 field_24;
|
||||
u8 field_25;
|
||||
u8 field_26;
|
||||
u8 field_27;
|
||||
u8 field_28;
|
||||
u8 field_29;
|
||||
u8 field_2A;
|
||||
u8 field_2B;
|
||||
u8 field_2C;
|
||||
u8 field_2D;
|
||||
u8 field_2E;
|
||||
u8 field_2F;
|
||||
u8 field_30;
|
||||
u8 field_31;
|
||||
u8 field_32;
|
||||
u8 field_33;
|
||||
u8 field_34;
|
||||
u8 field_35;
|
||||
u8 field_36;
|
||||
u8 field_37;
|
||||
u8 field_38;
|
||||
u8 field_39;
|
||||
u8 field_3A;
|
||||
u8 field_3B;
|
||||
u8 field_3C;
|
||||
u8 field_3D;
|
||||
u8 field_3E;
|
||||
u8 field_3F;
|
||||
u8 field_40;
|
||||
u8 field_41;
|
||||
u8 field_42;
|
||||
u8 field_43;
|
||||
u8 field_44;
|
||||
u8 field_45;
|
||||
u8 field_46;
|
||||
u8 field_47;
|
||||
u8 field_48;
|
||||
u8 field_49;
|
||||
u8 field_4A;
|
||||
u8 field_4B;
|
||||
u8 field_4C;
|
||||
u8 field_4D;
|
||||
u8 field_4E;
|
||||
u8 field_4F;
|
||||
u8 field_50;
|
||||
u8 field_51;
|
||||
u8 field_52;
|
||||
u8 field_53;
|
||||
u8 field_54;
|
||||
u8 field_55;
|
||||
u8 field_56;
|
||||
u8 field_57;
|
||||
u8 field_58;
|
||||
u8 field_59;
|
||||
u8 field_5A;
|
||||
u8 field_5B;
|
||||
u8 field_5C;
|
||||
u8 field_5D;
|
||||
u8 field_5E;
|
||||
u8 field_5F;
|
||||
u8 field_60;
|
||||
u8 field_61;
|
||||
u8 field_62;
|
||||
u8 field_63;
|
||||
u8 field_64;
|
||||
u8 field_65;
|
||||
u8 field_66;
|
||||
u8 field_67;
|
||||
u8 field_68;
|
||||
u8 field_69;
|
||||
u8 field_6A;
|
||||
u8 field_6B;
|
||||
u8 field_6C;
|
||||
u8 field_6D;
|
||||
u8 field_6E;
|
||||
u8 field_6F;
|
||||
u8 field_70;
|
||||
u8 field_71;
|
||||
u8 field_72;
|
||||
u8 field_73;
|
||||
u8 field_74;
|
||||
u8 field_75;
|
||||
u8 field_76;
|
||||
u8 field_77;
|
||||
u8 field_78;
|
||||
u8 field_79;
|
||||
u8 field_7A;
|
||||
u8 field_7B;
|
||||
u8 field_7C;
|
||||
u8 field_7D;
|
||||
|
@ -9,6 +9,7 @@ void m4aSoundInit(void);
|
||||
void m4aSoundMain(void);
|
||||
void m4aSongNumStart(u16);
|
||||
void m4aSongNumStop(u16 n);
|
||||
void m4aMPlayAllStop(void);
|
||||
void m4aMPlayContinue(struct MusicPlayerInfo *mplayInfo);
|
||||
void m4aMPlayFadeOut(struct MusicPlayerInfo *mplayInfo, u16 speed);
|
||||
void m4aMPlayFadeOutTemporarily(struct MusicPlayerInfo *mplayInfo, u16 speed);
|
||||
|
@ -562,6 +562,7 @@ u8 GetNatureFromPersonality(u32 personality);
|
||||
u16 nature_stat_mod(u8 nature, u16 n, u8 statIndex);
|
||||
|
||||
void MonRestorePP(struct Pokemon *);
|
||||
void BoxMonRestorePP(struct BoxPokemon *);
|
||||
|
||||
u16 NationalPokedexNumToSpecies(u16 nationalNum);
|
||||
u16 NationalToHoennOrder(u16);
|
||||
@ -583,4 +584,11 @@ bool8 IsOtherTrainer(u32, u8 *);
|
||||
void SetWildMonHeldItem(void);
|
||||
u16 GetMonEVCount(struct Pokemon *);
|
||||
|
||||
const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon);
|
||||
const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality);
|
||||
bool32 IsHMMove2(u16 move);
|
||||
bool8 IsPokeSpriteNotFlipped(u16 species);
|
||||
bool8 IsMonShiny(struct Pokemon *mon);
|
||||
bool8 IsShinyOtIdPersonality(u32 otId, u32 personality);
|
||||
|
||||
#endif // GUARD_POKEMON_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef GUARD_TRAINER_CLASS_H
|
||||
#define GUARD_TRAINER_CLASS_H
|
||||
#ifndef GUARD_TRAINER_CLASSES_H
|
||||
#define GUARD_TRAINER_CLASSES_H
|
||||
|
||||
enum
|
||||
{
|
||||
@ -50,4 +50,4 @@ enum
|
||||
CLASS_PKMN_TRAINER2, // 0x41
|
||||
};
|
||||
|
||||
#endif // GUARD_TRAINER_CLASS_H
|
||||
#endif // GUARD_TRAINER_CLASSES_H
|
6
include/trainer_ids.h
Normal file
6
include/trainer_ids.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef GUARD_TRAINER_IDS_H
|
||||
#define GUARD_TRAINER_IDS_H
|
||||
|
||||
#define TRAINER_ID_STEVEN 804
|
||||
|
||||
#endif // GUARD_TRAINER_IDS_H
|
@ -3,14 +3,13 @@
|
||||
#include "species.h"
|
||||
#include "text.h"
|
||||
#include "malloc.h"
|
||||
#include "pokemon.h"
|
||||
|
||||
EWRAM_DATA ALIGNED(4) u8 gDecompressionBuffer[0x4000] = {0};
|
||||
|
||||
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
|
||||
extern const struct CompressedSpriteSheet gMonBackPicTable[];
|
||||
|
||||
extern void DrawSpindaSpots(u16 species, u32 personality, void* dest, bool8 isFrontPic);
|
||||
|
||||
static void DuplicateDeoxysTiles(void *pointer, s32 species);
|
||||
|
||||
void LZDecompressWram(const void *src, void *dest)
|
||||
|
374
src/pokemon_3.c
374
src/pokemon_3.c
@ -11,7 +11,15 @@
|
||||
#include "link.h"
|
||||
#include "hold_effects.h"
|
||||
#include "rng.h"
|
||||
#include "trainer_class.h"
|
||||
#include "trainer_classes.h"
|
||||
#include "trainer_ids.h"
|
||||
#include "songs.h"
|
||||
#include "sound.h"
|
||||
#include "m4a.h"
|
||||
#include "task.h"
|
||||
#include "sprite.h"
|
||||
#include "text.h"
|
||||
#include "abilities.h"
|
||||
|
||||
extern struct BattlePokemon gBattleMons[4];
|
||||
extern struct BattleEnigmaBerry gEnigmaBerries[4];
|
||||
@ -23,6 +31,9 @@ extern u8 gStringBank;
|
||||
extern u16 gTrainerBattleOpponent_A;
|
||||
extern u32 gBattleTypeFlags;
|
||||
extern u8 gBattleMonForms[4];
|
||||
extern u16 gBattlePartyID[4];
|
||||
extern u8 gLastUsedAbility;
|
||||
extern u16 gPartnerTrainerId;
|
||||
|
||||
extern const u16 gSpeciesToHoennPokedexNum[];
|
||||
extern const u16 gSpeciesToNationalPokedexNum[];
|
||||
@ -40,6 +51,12 @@ extern const s8 gNatureStatTable[][5];
|
||||
extern const s8 gUnknown_08329ECE[][3];
|
||||
extern const u32 gBitTable[];
|
||||
extern const u32 gTMHMLearnsets[][2];
|
||||
extern const u8 BattleText_Wally[];
|
||||
extern const u8 BattleText_PreventedSwitch[];
|
||||
extern const struct CompressedSpritePalette gMonPaletteTable[];
|
||||
extern const struct CompressedSpritePalette gMonShinyPaletteTable[];
|
||||
extern const u16 gHMMoves[];
|
||||
extern const s8 gPokeblockFlavorCompatibilityTable[];
|
||||
|
||||
extern bool8 InBattlePyramid(void);
|
||||
extern bool8 sub_81D5C18(void);
|
||||
@ -48,6 +65,9 @@ extern bool32 IsNationalPokedexEnabled(void);
|
||||
extern u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerOpponentId);
|
||||
extern u8 sub_81D63C8(u16 trainerOpponentId);
|
||||
extern u8 sav1_map_get_name(void);
|
||||
extern u8 GetFrontierOpponentClass(u16 trainerId);
|
||||
extern u8 pokemon_order_func(u8 bankPartyId);
|
||||
extern void GetFrontierTrainerName(u8* dest, u16 trainerId);
|
||||
|
||||
bool8 HealStatusConditions(struct Pokemon *mon, u32 battlePartyId, u32 healMask, u8 battleBank)
|
||||
{
|
||||
@ -1111,3 +1131,355 @@ void ClearBattleMonForms(void)
|
||||
for (i = 0; i < 4; i++)
|
||||
gBattleMonForms[i] = 0;
|
||||
}
|
||||
|
||||
u16 GetBattleBGM(void)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON)
|
||||
return 0x1E0;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_REGI)
|
||||
return 0x1DF;
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
|
||||
return 0x1DC;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
{
|
||||
u8 trainerClass;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
trainerClass = GetFrontierOpponentClass(gTrainerBattleOpponent_A);
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_x4000000)
|
||||
trainerClass = CLASS_EXPERT;
|
||||
else
|
||||
trainerClass = gTrainers[gTrainerBattleOpponent_A].trainerClass;
|
||||
switch (trainerClass)
|
||||
{
|
||||
case CLASS_AQUA_LEADER:
|
||||
case CLASS_MAGMA_LEADER:
|
||||
return 0x1E3;
|
||||
case CLASS_TEAM_AQUA:
|
||||
case CLASS_TEAM_MAGMA:
|
||||
case CLASS_AQUA_ADMIN:
|
||||
case CLASS_MAGMA_ADMIN:
|
||||
return 0x1DB;
|
||||
case CLASS_LEADER:
|
||||
return 0x1DD;
|
||||
case CLASS_CHAMPION:
|
||||
return 0x1DE;
|
||||
case CLASS_PKMN_TRAINER_RIVAL:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
return 0x1E1;
|
||||
if (!StringCompare(gTrainers[gTrainerBattleOpponent_A].trainerName, BattleText_Wally))
|
||||
return 0x1DC;
|
||||
return 0x1E1;
|
||||
case CLASS_ELITE_FOUR:
|
||||
return 0x1E2;
|
||||
case CLASS_SALON_MAIDEN:
|
||||
case CLASS_DOME_ACE:
|
||||
case CLASS_PALACE_MAVEN:
|
||||
case CLASS_ARENA_TYCOON:
|
||||
case CLASS_FACTORY_HEAD:
|
||||
case CLASS_PIKE_QUEEN:
|
||||
case CLASS_PYRAMID_KING:
|
||||
return 0x1D7;
|
||||
default:
|
||||
return 0x1DC;
|
||||
}
|
||||
}
|
||||
return 0x1DA;
|
||||
}
|
||||
|
||||
void PlayBattleBGM(void)
|
||||
{
|
||||
ResetMapMusic();
|
||||
m4aMPlayAllStop();
|
||||
PlayBGM(GetBattleBGM());
|
||||
}
|
||||
|
||||
void PlayMapChosenOrBattleBGM(u16 songId)
|
||||
{
|
||||
ResetMapMusic();
|
||||
m4aMPlayAllStop();
|
||||
if (songId)
|
||||
PlayNewMapMusic(songId);
|
||||
else
|
||||
PlayNewMapMusic(GetBattleBGM());
|
||||
}
|
||||
|
||||
static void sub_806E6CC(u8 taskId);
|
||||
|
||||
void sub_806E694(u16 songId)
|
||||
{
|
||||
u8 taskId;
|
||||
|
||||
ResetMapMusic();
|
||||
m4aMPlayAllStop();
|
||||
|
||||
taskId = CreateTask(sub_806E6CC, 0);
|
||||
gTasks[taskId].data[0] = songId;
|
||||
}
|
||||
|
||||
static void sub_806E6CC(u8 taskId)
|
||||
{
|
||||
if (gTasks[taskId].data[0])
|
||||
PlayNewMapMusic(gTasks[taskId].data[0]);
|
||||
else
|
||||
PlayNewMapMusic(GetBattleBGM());
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
const u8 *pokemon_get_pal(struct Pokemon *mon)
|
||||
{
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
|
||||
u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0);
|
||||
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0);
|
||||
return species_and_otid_get_pal(species, otId, personality);
|
||||
}
|
||||
|
||||
//Extracts the upper 16 bits of a 32-bit number
|
||||
#define HIHALF(n) (((n) & 0xFFFF0000) >> 16)
|
||||
|
||||
//Extracts the lower 16 bits of a 32-bit number
|
||||
#define LOHALF(n) ((n) & 0xFFFF)
|
||||
|
||||
const u8 *species_and_otid_get_pal(u16 species, u32 otId, u32 personality)
|
||||
{
|
||||
u32 shinyValue;
|
||||
|
||||
if (species > SPECIES_EGG)
|
||||
return gMonPaletteTable[0].data;
|
||||
|
||||
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
if (shinyValue < 8)
|
||||
return gMonShinyPaletteTable[species].data;
|
||||
else
|
||||
return gMonPaletteTable[species].data;
|
||||
}
|
||||
|
||||
const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon)
|
||||
{
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
|
||||
u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0);
|
||||
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0);
|
||||
return sub_806E7CC(species, otId, personality);
|
||||
}
|
||||
|
||||
const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality)
|
||||
{
|
||||
u32 shinyValue;
|
||||
|
||||
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
if (shinyValue < 8)
|
||||
return &gMonShinyPaletteTable[species];
|
||||
else
|
||||
return &gMonPaletteTable[species];
|
||||
}
|
||||
|
||||
bool32 IsHMMove2(u16 move)
|
||||
{
|
||||
int i = 0;
|
||||
while (gHMMoves[i] != 0xFFFF)
|
||||
{
|
||||
if (gHMMoves[i++] == move)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 IsPokeSpriteNotFlipped(u16 species)
|
||||
{
|
||||
return gBaseStats[species].noFlip;
|
||||
}
|
||||
|
||||
s8 GetMonFlavourRelation(struct Pokemon *mon, u8 a2)
|
||||
{
|
||||
u8 nature = GetNature(mon);
|
||||
return gPokeblockFlavorCompatibilityTable[nature * 5 + a2];
|
||||
}
|
||||
|
||||
s8 GetFlavourRelationByPersonality(u32 personality, u8 a2)
|
||||
{
|
||||
u8 nature = GetNatureFromPersonality(personality);
|
||||
return gPokeblockFlavorCompatibilityTable[nature * 5 + a2];
|
||||
}
|
||||
|
||||
bool8 IsTradedMon(struct Pokemon *mon)
|
||||
{
|
||||
u8 otName[8];
|
||||
u32 otId;
|
||||
GetMonData(mon, MON_DATA_OT_NAME, otName);
|
||||
otId = GetMonData(mon, MON_DATA_OT_ID, 0);
|
||||
return IsOtherTrainer(otId, otName);
|
||||
}
|
||||
|
||||
bool8 IsOtherTrainer(u32 otId, u8 *otName)
|
||||
{
|
||||
if (otId ==
|
||||
(gSaveBlock2Ptr->playerTrainerId[0]
|
||||
| (gSaveBlock2Ptr->playerTrainerId[1] << 8)
|
||||
| (gSaveBlock2Ptr->playerTrainerId[2] << 16)
|
||||
| (gSaveBlock2Ptr->playerTrainerId[3] << 24)))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; otName[i] != EOS; i++)
|
||||
if (otName[i] != gSaveBlock2Ptr->playerName[i])
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MonRestorePP(struct Pokemon *mon)
|
||||
{
|
||||
BoxMonRestorePP(&mon->box);
|
||||
}
|
||||
|
||||
void BoxMonRestorePP(struct BoxPokemon *boxMon)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, 0))
|
||||
{
|
||||
u16 move = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, 0);
|
||||
u16 bonus = GetBoxMonData(boxMon, MON_DATA_PP_BONUSES, 0);
|
||||
u8 pp = CalculatePPWithBonus(move, bonus, i);
|
||||
SetBoxMonData(boxMon, MON_DATA_PP1 + i, &pp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_806E994(void)
|
||||
{
|
||||
gLastUsedAbility = gBattleStruct->field_B0;
|
||||
gBattleTextBuff1[0] = 0xFD;
|
||||
gBattleTextBuff1[1] = 4;
|
||||
gBattleTextBuff1[2] = gBattleStruct->field_49;
|
||||
gBattleTextBuff1[4] = EOS;
|
||||
if (!GetBankSide(gBattleStruct->field_49))
|
||||
gBattleTextBuff1[3] = pokemon_order_func(gBattlePartyID[gBattleStruct->field_49]);
|
||||
else
|
||||
gBattleTextBuff1[3] = gBattlePartyID[gBattleStruct->field_49];
|
||||
gBattleTextBuff2[0] = 0xFD;
|
||||
gBattleTextBuff2[1] = 4;
|
||||
gBattleTextBuff2[2] = gBankInMenu;
|
||||
gBattleTextBuff2[3] = pokemon_order_func(gBattlePartyID[gBankInMenu]);
|
||||
gBattleTextBuff2[4] = EOS;
|
||||
StrCpyDecodeBattle(BattleText_PreventedSwitch, gStringVar4);
|
||||
}
|
||||
|
||||
struct PokeItem
|
||||
{
|
||||
u16 species;
|
||||
u16 item;
|
||||
};
|
||||
|
||||
extern const struct PokeItem gAlteringCaveWildMonHeldItems[9];
|
||||
|
||||
static s32 GetWildMonTableIdInAlteringCave(u16 species)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < 9; i++)
|
||||
if (gAlteringCaveWildMonHeldItems[i].species == species)
|
||||
return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetWildMonHeldItem(void)
|
||||
{
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LEGENDARY | BATTLE_TYPE_TRAINER | BATTLE_TYPE_PYRAMID | BATTLE_TYPE_x100000)))
|
||||
{
|
||||
u16 rnd = Random() % 100;
|
||||
u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0);
|
||||
u16 var1 = 45;
|
||||
u16 var2 = 95;
|
||||
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3, 0)
|
||||
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES)
|
||||
{
|
||||
var1 = 20;
|
||||
var2 = 80;
|
||||
}
|
||||
if (gMapHeader.mapDataId == 0x1A4)
|
||||
{
|
||||
s32 alteringCaveId = GetWildMonTableIdInAlteringCave(species);
|
||||
if (alteringCaveId != 0)
|
||||
{
|
||||
if (rnd < var2)
|
||||
return;
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gAlteringCaveWildMonHeldItems[alteringCaveId].item);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rnd < var1)
|
||||
return;
|
||||
if (rnd < var2)
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
else
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != 0)
|
||||
{
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rnd < var1)
|
||||
return;
|
||||
if (rnd < var2)
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
else
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool8 IsMonShiny(struct Pokemon *mon)
|
||||
{
|
||||
u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0);
|
||||
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0);
|
||||
return IsShinyOtIdPersonality(otId, personality);
|
||||
}
|
||||
|
||||
bool8 IsShinyOtIdPersonality(u32 otId, u32 personality)
|
||||
{
|
||||
bool8 retVal = FALSE;
|
||||
u32 shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
if (shinyValue < 8)
|
||||
retVal = TRUE;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
const u8* GetTrainerPartnerName(void)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
{
|
||||
if (gPartnerTrainerId == STEVEN_PARTNER_ID)
|
||||
return gTrainers[TRAINER_ID_STEVEN].trainerName;
|
||||
else
|
||||
{
|
||||
GetFrontierTrainerName(gStringVar1, gPartnerTrainerId);
|
||||
return gStringVar1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 id = GetMultiplayerId();
|
||||
return gLinkPlayers[sub_806D864(gLinkPlayers[id].lp_field_18 ^ 2)].name;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_817F544(void (*spriteCallback)(struct Sprite*), u8);
|
||||
|
||||
void sub_806EC70(u8 taskId)
|
||||
{
|
||||
if (--gTasks[taskId].data[3] == 0)
|
||||
{
|
||||
void* ptr = (void*)((u16)(gTasks[taskId].data[0]) | ((u16)(gTasks[taskId].data[1]) << 0x10));
|
||||
sub_817F544(ptr, gTasks[taskId].data[2]);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ gTrainerBattleOpponent_A: @ 2038BCA
|
||||
gTrainerBattleOpponent_B: @ 2038BCC
|
||||
.space 0x2
|
||||
|
||||
gUnknown_02038BCE: @ 2038BCE
|
||||
gPartnerTrainerId: @ 2038BCE
|
||||
.space 0x2
|
||||
|
||||
gUnknown_02038BD0: @ 2038BD0
|
||||
|
Loading…
Reference in New Issue
Block a user