almost there, troubles

This commit is contained in:
DizzyEggg 2017-09-12 00:01:12 +02:00
parent 738e776630
commit 4242ede445
16 changed files with 246 additions and 834 deletions

View File

@ -10556,7 +10556,7 @@ _0803C42E:
b _0803C6C4 b _0803C6C4
.pool .pool
_0803C440: _0803C440:
bl PlayerPartyAndPokemonStorageFull bl IsPlayerPartyAndPokemonStorageFull
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
bne _0803C44C bne _0803C44C

View File

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

View File

@ -2357,7 +2357,7 @@ ItemUseInBattle_PokeBall: @ 80FE394
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
adds r5, r4, 0 adds r5, r4, 0
bl PlayerPartyAndPokemonStorageFull bl IsPlayerPartyAndPokemonStorageFull
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
bne _080FE3D0 bne _080FE3D0

View File

@ -1056,7 +1056,7 @@ _08068BE0:
ldrb r0, [r1, 0x13] ldrb r0, [r1, 0x13]
lsls r0, 3 lsls r0, 3
orrs r2, r0 orrs r2, r0
ldr r1, =gTrainerClassNameIndices ldr r1, =gTrainerClassToNameIndex
ldr r0, =gUnknown_08329D54 ldr r0, =gUnknown_08329D54
lsls r2, 1 lsls r2, 1
adds r2, r0 adds r2, r0

View File

@ -5,801 +5,4 @@
.text .text
thumb_func_start GetAbilityBySpecies
@ int GetAbilityBySpecies(u16 a1, int a2)
GetAbilityBySpecies: @ 806B694
push {lr}
lsls r0, 16
lsrs r3, r0, 16
lsls r1, 24
cmp r1, 0
beq _0806B6B8
ldr r2, =gLastUsedAbility
ldr r1, =gBaseStats
lsls r0, r3, 3
subs r0, r3
lsls r0, 2
adds r0, r1
ldrb r0, [r0, 0x17]
b _0806B6C6
.pool
_0806B6B8:
ldr r2, =gLastUsedAbility
ldr r1, =gBaseStats
lsls r0, r3, 3
subs r0, r3
lsls r0, 2
adds r0, r1
ldrb r0, [r0, 0x16]
_0806B6C6:
strb r0, [r2]
ldrb r0, [r2]
pop {r1}
bx r1
.pool
thumb_func_end GetAbilityBySpecies
thumb_func_start GetMonAbility
@ u8 GetMonAbility(pokemon *mon)
GetMonAbility: @ 806B6D8
push {r4,r5,lr}
adds r5, r0, 0
movs r1, 0xB
movs r2, 0
bl GetMonData
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
adds r0, r5, 0
movs r1, 0x2E
movs r2, 0
bl GetMonData
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
adds r0, r4, 0
bl GetAbilityBySpecies
lsls r0, 24
lsrs r0, 24
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end GetMonAbility
thumb_func_start CreateSecretBaseEnemyParty
CreateSecretBaseEnemyParty: @ 806B70C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x14
adds r5, r0, 0
bl ZeroEnemyPartyMons
ldr r4, =gBattleResources
ldr r0, [r4]
ldr r0, [r0]
adds r1, r5, 0
movs r2, 0xA0
bl memcpy
movs r0, 0
mov r9, r0
_0806B730:
ldr r1, =gBattleResources
ldr r3, [r1]
ldr r2, [r3]
mov r4, r9
lsls r7, r4, 1
adds r0, r2, 0
adds r0, 0x7C
adds r1, r0, r7
ldrh r0, [r1]
adds r4, 0x1
str r4, [sp, 0x10]
cmp r0, 0
beq _0806B80A
movs r0, 0x64
mov r6, r9
muls r6, r0
ldr r4, =gEnemyParty
mov r8, r4
adds r5, r6, r4
ldrh r1, [r1]
adds r0, r2, 0
adds r0, 0x94
add r0, r9
ldrb r2, [r0]
movs r0, 0x1
str r0, [sp]
ldr r0, [r3]
mov r3, r9
lsls r4, r3, 2
adds r0, 0x34
adds r0, r4
ldr r0, [r0]
str r0, [sp, 0x4]
movs r0, 0x2
str r0, [sp, 0x8]
movs r0, 0
str r0, [sp, 0xC]
adds r0, r5, 0
movs r3, 0xF
bl CreateMon
ldr r1, =gBattleResources
ldr r0, [r1]
adds r1, r7, 0
adds r1, 0x88
ldr r2, [r0]
adds r2, r1
adds r0, r5, 0
movs r1, 0xC
bl SetMonData
movs r5, 0
mov r10, r4
mov r7, r9
adds r7, 0x9A
mov r4, r8
_0806B7A0:
adds r1, r5, 0
adds r1, 0x1A
ldr r2, =gBattleResources
ldr r0, [r2]
ldr r2, [r0]
adds r2, r7
adds r0, r6, r4
bl SetMonData
adds r5, 0x1
cmp r5, 0x5
ble _0806B7A0
movs r5, 0
movs r3, 0x64
mov r0, r9
muls r0, r3
ldr r1, =gEnemyParty
adds r7, r0, r1
mov r4, r10
lsls r0, r4, 1
adds r6, r0, 0
adds r6, 0x4C
adds r4, r0, 0
_0806B7CE:
adds r1, r5, 0
adds r1, 0xD
ldr r2, =gBattleResources
ldr r0, [r2]
ldr r2, [r0]
adds r2, r6
adds r0, r7, 0
bl SetMonData
adds r1, r5, 0
adds r1, 0x11
ldr r3, =gBattleResources
ldr r0, [r3]
ldr r0, [r0]
adds r0, 0x4C
adds r0, r4
ldrh r0, [r0]
lsls r2, r0, 1
adds r2, r0
lsls r2, 2
ldr r0, =gBattleMoves + 0x4 @ PP offset
adds r2, r0
adds r0, r7, 0
bl SetMonData
adds r6, 0x2
adds r4, 0x2
adds r5, 0x1
cmp r5, 0x3
ble _0806B7CE
_0806B80A:
ldr r4, [sp, 0x10]
mov r9, r4
cmp r4, 0x5
ble _0806B730
add sp, 0x14
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end CreateSecretBaseEnemyParty
thumb_func_start GetSecretBaseTrainerPicIndex
GetSecretBaseTrainerPicIndex: @ 806B830
push {r4,r5,lr}
ldr r5, =gSecretBaseTrainerClasses
ldr r0, =gBattleResources
ldr r0, [r0]
ldr r4, [r0]
ldrb r0, [r4, 0x9]
movs r1, 0x5
bl __umodsi3
lsls r0, 24
lsrs r0, 24
ldrb r2, [r4, 0x1]
lsls r2, 27
lsrs r2, 31
lsls r1, r2, 2
adds r1, r2
adds r0, r1
adds r0, r5
ldrb r0, [r0]
ldr r1, =gTrainerPicIndices
adds r0, r1
ldrb r0, [r0]
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end GetSecretBaseTrainerPicIndex
thumb_func_start GetSecretBaseTrainerNameIndex
GetSecretBaseTrainerNameIndex: @ 806B870
push {r4,r5,lr}
ldr r5, =gSecretBaseTrainerClasses
ldr r0, =gBattleResources
ldr r0, [r0]
ldr r4, [r0]
ldrb r0, [r4, 0x9]
movs r1, 0x5
bl __umodsi3
lsls r0, 24
lsrs r0, 24
ldrb r2, [r4, 0x1]
lsls r2, 27
lsrs r2, 31
lsls r1, r2, 2
adds r1, r2
adds r0, r1
adds r0, r5
ldrb r0, [r0]
ldr r1, =gTrainerClassNameIndices
adds r0, r1
ldrb r0, [r0]
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end GetSecretBaseTrainerNameIndex
thumb_func_start PlayerPartyAndPokemonStorageFull
PlayerPartyAndPokemonStorageFull: @ 806B8B0
push {r4,lr}
movs r4, 0
_0806B8B4:
movs r0, 0x64
muls r0, r4
ldr r1, =gPlayerParty
adds r0, r1
movs r1, 0xB
movs r2, 0
bl GetMonData
cmp r0, 0
bne _0806B8D0
movs r0, 0
b _0806B8DE
.pool
_0806B8D0:
adds r4, 0x1
cmp r4, 0x5
ble _0806B8B4
bl PokemonStorageFull
lsls r0, 24
lsrs r0, 24
_0806B8DE:
pop {r4}
pop {r1}
bx r1
thumb_func_end PlayerPartyAndPokemonStorageFull
thumb_func_start PokemonStorageFull
PokemonStorageFull: @ 806B8E4
push {r4-r6,lr}
movs r6, 0
_0806B8E8:
movs r4, 0
lsls r5, r6, 24
_0806B8EC:
lsls r1, r4, 24
lsrs r1, 24
lsrs r0, r5, 24
movs r2, 0xB
bl GetBoxMonDataFromAnyBox
cmp r0, 0
bne _0806B900
movs r0, 0
b _0806B90E
_0806B900:
adds r4, 0x1
cmp r4, 0x1D
ble _0806B8EC
adds r6, 0x1
cmp r6, 0xD
ble _0806B8E8
movs r0, 0x1
_0806B90E:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end PokemonStorageFull
thumb_func_start GetSpeciesName
@ void GetSpeciesName(u8 *dest, u16 speciesId)
GetSpeciesName: @ 806B914
push {r4-r7,lr}
adds r6, r0, 0
lsls r1, 16
lsrs r5, r1, 16
movs r1, 0
movs r0, 0xCE
lsls r0, 1
mov r12, r0
ldr r7, =gSpeciesNames
movs r0, 0xB
muls r0, r5
adds r3, r0, r7
adds r2, r6, 0
b _0806B93A
.pool
_0806B934:
adds r3, 0x1
adds r2, 0x1
adds r1, 0x1
_0806B93A:
adds r4, r6, r1
cmp r1, 0xA
bgt _0806B954
cmp r5, r12
bls _0806B94A
adds r0, r1, r7
ldrb r0, [r0]
b _0806B94C
_0806B94A:
ldrb r0, [r3]
_0806B94C:
strb r0, [r2]
ldrb r0, [r4]
cmp r0, 0xFF
bne _0806B934
_0806B954:
movs r0, 0xFF
strb r0, [r4]
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end GetSpeciesName
thumb_func_start CalculatePPWithBonus
@ u16 CalculatePPWithBonus(u16 moveId, s32 ppUpCounts, u8 monMoveIndex)
CalculatePPWithBonus: @ 806B960
push {r4,lr}
lsls r0, 16
lsrs r0, 16
lsls r2, 24
lsrs r2, 24
ldr r4, =gBattleMoves
lsls r3, r0, 1
adds r3, r0
lsls r3, 2
adds r3, r4
ldrb r4, [r3, 0x4]
ldr r0, =gUnknown_08329D22
adds r0, r2, r0
ldrb r3, [r0]
ands r3, r1
lsls r2, 1
asrs r3, r2
lsls r0, r3, 2
adds r0, r3
lsls r0, 2
muls r0, r4
movs r1, 0x64
bl __divsi3
adds r4, r0
lsls r4, 24
lsrs r4, 24
adds r0, r4, 0
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end CalculatePPWithBonus
thumb_func_start RemoveMonPPBonus
RemoveMonPPBonus: @ 806B9A8
push {r4,r5,lr}
sub sp, 0x4
adds r5, r0, 0
lsls r4, r1, 24
lsrs r4, 24
movs r1, 0x15
movs r2, 0
bl GetMonData
lsls r0, 24
lsrs r0, 24
mov r1, sp
strb r0, [r1]
ldr r1, =gUnknown_08329D26
adds r4, r1
ldrb r1, [r4]
ands r1, r0
mov r0, sp
strb r1, [r0]
adds r0, r5, 0
movs r1, 0x15
mov r2, sp
bl SetMonData
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end RemoveMonPPBonus
thumb_func_start RemoveBattleMonPPBonus
RemoveBattleMonPPBonus: @ 806B9E4
lsls r1, 24
lsrs r1, 24
adds r0, 0x3B
ldr r2, =gUnknown_08329D26
adds r1, r2
ldrb r2, [r0]
ldrb r1, [r1]
ands r1, r2
strb r1, [r0]
bx lr
.pool
thumb_func_end RemoveBattleMonPPBonus
thumb_func_start CopyPlayerPartyMonToBattleData
CopyPlayerPartyMonToBattleData: @ 806B9FC
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x18
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x14]
lsls r1, 24
lsrs r1, 24
mov r9, r1
movs r0, 0x64
mov r5, r9
muls r5, r0
ldr r0, =gPlayerParty
adds r5, r0
adds r0, r5, 0
movs r1, 0xB
movs r2, 0
bl GetMonData
ldr r1, =gBattleMons
mov r8, r1
movs r1, 0x58
ldr r2, [sp, 0x14]
adds r4, r2, 0
muls r4, r1
mov r3, r8
adds r6, r4, r3
strh r0, [r6]
adds r0, r5, 0
movs r1, 0xC
movs r2, 0
bl GetMonData
strh r0, [r6, 0x2E]
movs r6, 0
mov r0, r8
adds r0, 0x24
adds r7, r4, r0
_0806BA4E:
adds r1, r6, 0
adds r1, 0xD
adds r0, r5, 0
movs r2, 0
bl GetMonData
movs r1, 0xC
add r1, r8
mov r10, r1
adds r1, r4, r1
strh r0, [r1]
adds r1, r6, 0
adds r1, 0x11
adds r0, r5, 0
movs r2, 0
bl GetMonData
strb r0, [r7]
adds r7, 0x1
adds r4, 0x2
adds r6, 0x1
cmp r6, 0x3
ble _0806BA4E
movs r0, 0x64
mov r4, r9
muls r4, r0
ldr r0, =gPlayerParty
adds r4, r0
adds r0, r4, 0
movs r1, 0x15
movs r2, 0
bl GetMonData
movs r2, 0xC
negs r2, r2
add r2, r10
mov r9, r2
movs r1, 0x58
ldr r3, [sp, 0x14]
adds r5, r3, 0
muls r5, r1
adds r7, r5, r2
adds r1, r7, 0
adds r1, 0x3B
strb r0, [r1]
adds r0, r4, 0
movs r1, 0x20
movs r2, 0
bl GetMonData
adds r1, r7, 0
adds r1, 0x2B
strb r0, [r1]
adds r0, r4, 0
movs r1, 0x19
movs r2, 0
bl GetMonData
mov r1, r10
adds r1, 0x38
adds r1, r5, r1
str r0, [r1]
adds r0, r4, 0
movs r1, 0x27
movs r2, 0
bl GetMonData
movs r6, 0x1F
ands r0, r6
ldrb r2, [r7, 0x14]
movs r1, 0x20
negs r1, r1
ands r1, r2
orrs r1, r0
strb r1, [r7, 0x14]
adds r0, r4, 0
movs r1, 0x28
movs r2, 0
bl GetMonData
movs r1, 0x1F
mov r8, r1
mov r2, r8
ands r0, r2
lsls r0, 5
ldrh r2, [r7, 0x14]
ldr r1, =0xfffffc1f
ands r1, r2
orrs r1, r0
strh r1, [r7, 0x14]
adds r0, r4, 0
movs r1, 0x29
movs r2, 0
bl GetMonData
ands r0, r6
lsls r0, 2
ldrb r2, [r7, 0x15]
movs r1, 0x7D
negs r1, r1
ands r1, r2
orrs r1, r0
strb r1, [r7, 0x15]
adds r0, r4, 0
movs r1, 0x2A
movs r2, 0
bl GetMonData
movs r1, 0x1F
ands r1, r0
lsls r1, 15
ldr r0, [r7, 0x14]
ldr r2, =0xfff07fff
ands r0, r2
orrs r0, r1
str r0, [r7, 0x14]
adds r0, r4, 0
movs r1, 0x2B
movs r2, 0
bl GetMonData
mov r3, r8
ands r0, r3
lsls r0, 4
ldrh r2, [r7, 0x16]
ldr r1, =0xfffffe0f
ands r1, r2
orrs r1, r0
strh r1, [r7, 0x16]
adds r0, r4, 0
movs r1, 0x2C
movs r2, 0
bl GetMonData
ands r0, r6
lsls r0, 1
ldrb r2, [r7, 0x17]
movs r1, 0x3F
negs r1, r1
ands r1, r2
orrs r1, r0
strb r1, [r7, 0x17]
adds r0, r4, 0
movs r1, 0
movs r2, 0
bl GetMonData
mov r1, r10
adds r1, 0x3C
adds r1, r5, r1
str r0, [r1]
adds r0, r4, 0
movs r1, 0x37
movs r2, 0
bl GetMonData
mov r1, r10
adds r1, 0x40
adds r1, r5, r1
str r0, [r1]
adds r0, r4, 0
movs r1, 0x38
movs r2, 0
bl GetMonData
adds r1, r7, 0
adds r1, 0x2A
strb r0, [r1]
adds r0, r4, 0
movs r1, 0x39
movs r2, 0
bl GetMonData
strh r0, [r7, 0x28]
adds r0, r4, 0
movs r1, 0x3A
movs r2, 0
bl GetMonData
strh r0, [r7, 0x2C]
adds r0, r4, 0
movs r1, 0x3B
movs r2, 0
bl GetMonData
strh r0, [r7, 0x2]
adds r0, r4, 0
movs r1, 0x3C
movs r2, 0
bl GetMonData
strh r0, [r7, 0x4]
adds r0, r4, 0
movs r1, 0x3D
movs r2, 0
bl GetMonData
strh r0, [r7, 0x6]
adds r0, r4, 0
movs r1, 0x3E
movs r2, 0
bl GetMonData
strh r0, [r7, 0x8]
adds r0, r4, 0
movs r1, 0x3F
movs r2, 0
bl GetMonData
strh r0, [r7, 0xA]
adds r0, r4, 0
movs r1, 0x2D
movs r2, 0
bl GetMonData
movs r1, 0x1
ands r0, r1
lsls r0, 6
ldrb r2, [r7, 0x17]
movs r1, 0x41
negs r1, r1
ands r1, r2
orrs r1, r0
strb r1, [r7, 0x17]
adds r0, r4, 0
movs r1, 0x2E
movs r2, 0
bl GetMonData
lsls r0, 7
ldrb r2, [r7, 0x17]
movs r1, 0x7F
ands r1, r2
orrs r1, r0
strb r1, [r7, 0x17]
adds r0, r4, 0
movs r1, 0x1
movs r2, 0
bl GetMonData
mov r1, r10
adds r1, 0x48
adds r1, r5, r1
str r0, [r1]
ldr r2, =gBaseStats
ldrh r1, [r7]
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r0, r2
ldrb r0, [r0, 0x6]
adds r1, r7, 0
adds r1, 0x21
strb r0, [r1]
ldrh r1, [r7]
lsls r0, r1, 3
subs r0, r1
lsls r0, 2
adds r0, r2
ldrb r0, [r0, 0x7]
adds r1, r7, 0
adds r1, 0x22
strb r0, [r1]
ldrh r0, [r7]
ldrb r1, [r7, 0x17]
lsrs r1, 7
bl GetAbilityBySpecies
adds r1, r7, 0
adds r1, 0x20
strb r0, [r1]
adds r0, r4, 0
movs r1, 0x2
mov r2, sp
bl GetMonData
mov r0, r10
adds r0, 0x24
adds r0, r5, r0
mov r1, sp
bl StringCopy10
mov r2, r10
adds r2, 0x30
adds r2, r5, r2
adds r0, r4, 0
movs r1, 0x7
bl GetMonData
ldr r0, [sp, 0x14]
bl GetBankSide
ldr r1, =gBattleStruct
lsls r0, 24
lsrs r0, 23
adds r0, 0xA8
ldr r1, [r1]
adds r1, r0
ldrh r0, [r7, 0x28]
strh r0, [r1]
movs r2, 0x6
mov r1, r9
movs r6, 0x7
add r5, r10
adds r0, r5, 0
adds r0, 0x13
_0806BCB2:
strb r2, [r0]
subs r0, 0x1
subs r6, 0x1
cmp r6, 0
bge _0806BCB2
movs r2, 0
movs r0, 0x58
ldr r3, [sp, 0x14]
muls r0, r3
adds r1, 0x50
adds r0, r1
str r2, [r0]
ldr r0, [sp, 0x14]
bl sub_803FA70
ldr r0, [sp, 0x14]
movs r1, 0
bl sub_805EF84
add sp, 0x18
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end CopyPlayerPartyMonToBattleData
.align 2, 0 @ Don't pad with nop. .align 2, 0 @ Don't pad with nop.

View File

@ -423,7 +423,7 @@ _0806EFE6:
TrainerClassToTrainerPic: @ 806EFF0 TrainerClassToTrainerPic: @ 806EFF0
lsls r0, 16 lsls r0, 16
lsrs r0, 16 lsrs r0, 16
ldr r1, =gTrainerPicIndices ldr r1, =gTrainerClassToPicIndex
adds r0, r1 adds r0, r1
ldrb r0, [r0] ldrb r0, [r0]
bx lr bx lr

View File

@ -1340,7 +1340,7 @@ sub_8162AA0: @ 8162AA0
lsls r0, 1 lsls r0, 1
cmp r4, r0 cmp r4, r0
bne _08162AD0 bne _08162AD0
ldr r1, =gTrainerPicIndices ldr r1, =gTrainerClassToPicIndex
ldr r0, =gSaveBlock2Ptr ldr r0, =gSaveBlock2Ptr
ldr r0, [r0] ldr r0, [r0]
ldr r2, =0x00000bed ldr r2, =0x00000bed
@ -1362,7 +1362,7 @@ _08162AE4:
ldr r0, =0x0000012b ldr r0, =0x0000012b
cmp r4, r0 cmp r4, r0
bhi _08162B08 bhi _08162B08
ldr r2, =gTrainerPicIndices ldr r2, =gTrainerClassToPicIndex
ldr r0, =gUnknown_0203BC88 ldr r0, =gUnknown_0203BC88
ldr r1, [r0] ldr r1, [r0]
movs r0, 0x34 movs r0, 0x34
@ -1383,7 +1383,7 @@ _08162B08:
ands r0, r1 ands r0, r1
cmp r0, 0 cmp r0, 0
beq _08162B38 beq _08162B38
ldr r4, =gTrainerPicIndices ldr r4, =gTrainerClassToPicIndex
bl sub_818649C bl sub_818649C
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
@ -1391,7 +1391,7 @@ _08162B08:
b _08162BC8 b _08162BC8
.pool .pool
_08162B38: _08162B38:
ldr r3, =gTrainerPicIndices ldr r3, =gTrainerClassToPicIndex
ldr r0, =gSaveBlock2Ptr ldr r0, =gSaveBlock2Ptr
ldr r0, [r0] ldr r0, [r0]
ldr r1, =0xfffffed4 ldr r1, =0xfffffed4
@ -1413,7 +1413,7 @@ _08162B64:
ands r0, r1 ands r0, r1
cmp r0, 0 cmp r0, 0
bne _08162BB0 bne _08162BB0
ldr r4, =gTrainerPicIndices ldr r4, =gTrainerClassToPicIndex
ldr r3, =gUnknown_08610970 ldr r3, =gUnknown_08610970
ldr r0, =gSaveBlock2Ptr ldr r0, =gSaveBlock2Ptr
ldr r1, [r0] ldr r1, [r0]
@ -1436,7 +1436,7 @@ _08162B64:
b _08162BC8 b _08162BC8
.pool .pool
_08162BB0: _08162BB0:
ldr r5, =gTrainerPicIndices ldr r5, =gTrainerClassToPicIndex
ldr r4, =gUnknown_08610970 ldr r4, =gUnknown_08610970
bl sub_81864A8 bl sub_81864A8
lsls r0, 24 lsls r0, 24
@ -1467,7 +1467,7 @@ GetFrontierOpponentClass: @ 8162BD8
lsls r0, 1 lsls r0, 1
cmp r4, r0 cmp r4, r0
bne _08162C08 bne _08162C08
ldr r1, =gTrainerClassNameIndices ldr r1, =gTrainerClassToNameIndex
ldr r0, =gSaveBlock2Ptr ldr r0, =gSaveBlock2Ptr
ldr r0, [r0] ldr r0, [r0]
ldr r2, =0x00000bed ldr r2, =0x00000bed
@ -1499,7 +1499,7 @@ _08162C38:
ldr r0, =0x0000012b ldr r0, =0x0000012b
cmp r4, r0 cmp r4, r0
bhi _08162C60 bhi _08162C60
ldr r2, =gTrainerClassNameIndices ldr r2, =gTrainerClassToNameIndex
ldr r0, =gUnknown_0203BC88 ldr r0, =gUnknown_0203BC88
ldr r1, [r0] ldr r1, [r0]
movs r0, 0x34 movs r0, 0x34
@ -1521,7 +1521,7 @@ _08162C60:
ands r0, r1 ands r0, r1
cmp r0, 0 cmp r0, 0
beq _08162C90 beq _08162C90
ldr r4, =gTrainerClassNameIndices ldr r4, =gTrainerClassToNameIndex
bl sub_818649C bl sub_818649C
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
@ -1530,7 +1530,7 @@ _08162C60:
b _08162D1E b _08162D1E
.pool .pool
_08162C90: _08162C90:
ldr r3, =gTrainerClassNameIndices ldr r3, =gTrainerClassToNameIndex
ldr r0, =gSaveBlock2Ptr ldr r0, =gSaveBlock2Ptr
ldr r0, [r0] ldr r0, [r0]
ldr r1, =0xfffffed4 ldr r1, =0xfffffed4
@ -1553,7 +1553,7 @@ _08162CBC:
ands r0, r1 ands r0, r1
cmp r0, 0 cmp r0, 0
beq _08162CF4 beq _08162CF4
ldr r5, =gTrainerClassNameIndices ldr r5, =gTrainerClassToNameIndex
ldr r4, =gUnknown_08610970 ldr r4, =gUnknown_08610970
bl sub_81864A8 bl sub_81864A8
lsls r0, 24 lsls r0, 24
@ -1568,7 +1568,7 @@ _08162CBC:
b _08162D1E b _08162D1E
.pool .pool
_08162CF4: _08162CF4:
ldr r4, =gTrainerClassNameIndices ldr r4, =gTrainerClassToNameIndex
ldr r3, =gUnknown_08610970 ldr r3, =gUnknown_08610970
ldr r0, =gSaveBlock2Ptr ldr r0, =gSaveBlock2Ptr
ldr r1, [r0] ldr r1, [r0]
@ -5845,7 +5845,7 @@ _08165206:
thumb_func_start sub_8165244 thumb_func_start sub_8165244
sub_8165244: @ 8165244 sub_8165244: @ 8165244
ldr r1, =gTrainerPicIndices ldr r1, =gTrainerClassToPicIndex
ldr r0, =gSaveBlock2Ptr ldr r0, =gSaveBlock2Ptr
ldr r0, [r0] ldr r0, [r0]
ldr r2, =0x00000bed ldr r2, =0x00000bed
@ -5859,7 +5859,7 @@ sub_8165244: @ 8165244
thumb_func_start sub_8165264 thumb_func_start sub_8165264
sub_8165264: @ 8165264 sub_8165264: @ 8165264
ldr r1, =gTrainerClassNameIndices ldr r1, =gTrainerClassToNameIndex
ldr r0, =gSaveBlock2Ptr ldr r0, =gSaveBlock2Ptr
ldr r0, [r0] ldr r0, [r0]
ldr r2, =0x00000bed ldr r2, =0x00000bed

View File

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

View File

@ -7171,7 +7171,7 @@ _0819270A:
ldr r4, [sp, 0x24] ldr r4, [sp, 0x24]
cmp r4, r0 cmp r4, r0
bne _08192784 bne _08192784
ldr r0, =gTrainerClassNameIndices ldr r0, =gTrainerClassToNameIndex
adds r0, 0x3C adds r0, 0x3C
ldrb r5, [r0] ldrb r5, [r0]
b _081927A2 b _081927A2
@ -52456,7 +52456,7 @@ GetTrainerEncounterMusicIdInBattlePyramind: @ 81A9F3C
lsls r0, 16 lsls r0, 16
lsrs r0, 16 lsrs r0, 16
movs r4, 0 movs r4, 0
ldr r3, =gTrainerClassNameIndices ldr r3, =gTrainerClassToNameIndex
ldr r1, =gUnknown_0203BC88 ldr r1, =gUnknown_0203BC88
ldr r2, [r1] ldr r2, [r1]
movs r1, 0x34 movs r1, 0x34

View File

@ -23949,7 +23949,7 @@ _081CAF34:
adds r0, r5, 0 adds r0, r5, 0
bl sub_81D1BD0 bl sub_81D1BD0
adds r4, r0, 0 adds r4, r0, 0
ldr r0, =gTrainerPicIndices ldr r0, =gTrainerClassToPicIndex
adds r0, r4, r0 adds r0, r4, r0
ldrb r0, [r0] ldrb r0, [r0]
b _081CAF6C b _081CAF6C
@ -44939,7 +44939,7 @@ sub_81D5530: @ 81D5530
lsls r1, 24 lsls r1, 24
adds r0, r1 adds r0, r1
lsrs r0, 24 lsrs r0, 24
ldr r2, =gTrainerClassNameIndices ldr r2, =gTrainerClassToNameIndex
ldr r1, =gUnknown_0203CF58 ldr r1, =gUnknown_0203CF58
ldr r1, [r1] ldr r1, [r1]
adds r1, 0x16 adds r1, 0x16
@ -45006,7 +45006,7 @@ sub_81D5588: @ 81D5588
adds r3, r0 adds r3, r0
ldrb r4, [r3, 0x1B] ldrb r4, [r3, 0x1B]
bl sub_81D5710 bl sub_81D5710
ldr r0, =gTrainerPicIndices ldr r0, =gTrainerClassToPicIndex
adds r4, r0 adds r4, r0
ldrb r0, [r4] ldrb r0, [r4]
pop {r4} pop {r4}
@ -46715,7 +46715,7 @@ sub_81D63C8: @ 81D63C8
ldrb r4, [r3, 0x1B] ldrb r4, [r3, 0x1B]
bl sub_81D5710 bl sub_81D5710
movs r2, 0 movs r2, 0
ldr r0, =gTrainerClassNameIndices ldr r0, =gTrainerClassToNameIndex
adds r4, r0 adds r4, r0
ldrb r3, [r4] ldrb r3, [r4]
ldr r1, =gUnknown_0862A3B4 ldr r1, =gUnknown_0862A3B4

View File

@ -1,4 +1,4 @@
gTrainerClassNameIndices:: @ 831F5CA gTrainerClassToNameIndex:: @ 831F5CA
.byte TRAINER_CLASS_NAME_HIKER .byte TRAINER_CLASS_NAME_HIKER
.byte TRAINER_CLASS_NAME_TEAM_AQUA .byte TRAINER_CLASS_NAME_TEAM_AQUA
.byte TRAINER_CLASS_NAME_PKMN_BREEDER .byte TRAINER_CLASS_NAME_PKMN_BREEDER

View File

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

View File

@ -289,7 +289,7 @@ struct BattleScriptsStack
struct BattleResources struct BattleResources
{ {
void* secretBaseOpponent; struct SecretBaseRecord* secretBase;
struct UnknownFlags *flags; struct UnknownFlags *flags;
struct BattleScriptsStack* battleScriptsStack; struct BattleScriptsStack* battleScriptsStack;
void* battleCallbackStack; void* battleCallbackStack;

View File

@ -571,8 +571,8 @@ u8 GetMonAbility(struct Pokemon *mon);
void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord); void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord);
u8 GetSecretBaseTrainerPicIndex(void); u8 GetSecretBaseTrainerPicIndex(void);
u8 GetSecretBaseTrainerNameIndex(void); u8 GetSecretBaseTrainerNameIndex(void);
u8 PlayerPartyAndPokemonStorageFull(void); bool8 IsPlayerPartyAndPokemonStorageFull(void);
u8 PokemonStorageFull(void); bool8 IsPokemonStorageFull(void);
void GetSpeciesName(u8 *name, u16 species); void GetSpeciesName(u8 *name, u16 species);
u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex); u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex);
void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex); void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex);

View File

@ -1,4 +1,8 @@
enum { #ifndef GUARD_SPECIES_H
#define GUARD_SPECIES_H
enum
{
SPECIES_NONE, // 0x000 SPECIES_NONE, // 0x000
SPECIES_BULBASAUR, // 0x001 SPECIES_BULBASAUR, // 0x001
SPECIES_IVYSAUR, // 0x002 SPECIES_IVYSAUR, // 0x002
@ -443,3 +447,7 @@ enum {
SPECIES_UNOWN_EMARK, SPECIES_UNOWN_EMARK,
SPECIES_UNOWN_QMARK, SPECIES_UNOWN_QMARK,
}; };
#define NUM_SPECIES SPECIES_EGG
#endif // GUARD_SPECIES_H

View File

@ -18,6 +18,7 @@ extern u8 gAbsentBankFlags;
extern u8 gActiveBank; extern u8 gActiveBank;
extern u8 gBankAttacker; extern u8 gBankAttacker;
extern u8 gBankTarget; extern u8 gBankTarget;
extern u8 gLastUsedAbility;
extern u16 gTrainerBattleOpponent_A; extern u16 gTrainerBattleOpponent_A;
extern u32 gBattleTypeFlags; extern u32 gBattleTypeFlags;
extern struct SpriteTemplate gUnknown_0202499C; extern struct SpriteTemplate gUnknown_0202499C;
@ -1167,3 +1168,203 @@ u8 GetMonsStateToDoubles_2(void)
return (aliveCount > 1) ? PLAYER_HAS_TWO_USABLE_MONS : PLAYER_HAS_ONE_USABLE_MON; return (aliveCount > 1) ? PLAYER_HAS_TWO_USABLE_MONS : PLAYER_HAS_ONE_USABLE_MON;
} }
u8 GetAbilityBySpecies(u16 species, bool8 altAbility)
{
if (altAbility)
gLastUsedAbility = gBaseStats[species].ability2;
else
gLastUsedAbility = gBaseStats[species].ability1;
return gLastUsedAbility;
}
u8 GetMonAbility(struct Pokemon *mon)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
u8 altAbility = GetMonData(mon, MON_DATA_ALT_ABILITY, NULL);
return GetAbilityBySpecies(species, altAbility);
}
extern const struct BattleMove gBattleMoves[];
void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord)
{
s32 i, j;
ZeroEnemyPartyMons();
*gBattleResources->secretBase = *secretBaseRecord;
for (i = 0; i < PARTY_SIZE; i++)
{
if (gBattleResources->secretBase->partySpecies[i])
{
CreateMon(&gEnemyParty[i],
gBattleResources->secretBase->partySpecies[i],
gBattleResources->secretBase->partyLevels[i],
15,
1,
gBattleResources->secretBase->partyPersonality[i],
2,
0);
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleResources->secretBase->partyHeldItems[i]);
for (j = 0; j < 6; j++)
SetMonData(&gEnemyParty[i], MON_DATA_HP_EV + j, &gBattleResources->secretBase->partyEVs[i]);
for (j = 0; j < 4; j++)
{
SetMonData(&gEnemyParty[i], MON_DATA_MOVE1 + j, &gBattleResources->secretBase->partyMoves[i * 4 + j]);
SetMonData(&gEnemyParty[i], MON_DATA_PP1 + j, &gBattleMoves[gBattleResources->secretBase->partyMoves[i * 4 + j]].pp);
}
}
}
}
extern const u8 gTrainerClassToPicIndex[];
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];
}
u8 GetSecretBaseTrainerNameIndex(void)
{
u8 trainerClass = gSecretBaseTrainerClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5];
return gTrainerClassToNameIndex[trainerClass];
}
bool8 IsPlayerPartyAndPokemonStorageFull(void)
{
s32 i;
for (i = 0; i < 6; i++)
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE)
return FALSE;
return IsPokemonStorageFull();
}
extern u32 GetBoxMonDataFromAnyBox(u8 boxNo, u8 boxPos, s32 field);
bool8 IsPokemonStorageFull(void)
{
s32 i, j;
for (i = 0; i < 14; i++)
for (j = 0; j < 30; j++)
if (GetBoxMonDataFromAnyBox(i, j, MON_DATA_SPECIES) == SPECIES_NONE)
return FALSE;
return TRUE;
}
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
void GetSpeciesName(u8 *name, u16 species)
{
s32 i;
for (i = 0; i <= POKEMON_NAME_LENGTH; i++)
{
if (species > NUM_SPECIES)
name[i] = gSpeciesNames[0][i];
else
name[i] = gSpeciesNames[species][i];
if (name[i] == EOS)
break;
}
name[i] = EOS;
}
extern const u8 gUnknown_08329D22[];
extern const u8 gUnknown_08329D26[];
u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex)
{
u8 basePP = gBattleMoves[move].pp;
return basePP + ((basePP * 20 * ((gUnknown_08329D22[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100);
}
void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex)
{
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
ppBonuses &= gUnknown_08329D26[moveIndex];
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses);
}
void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex)
{
mon->ppBonuses &= gUnknown_08329D26[moveIndex];
}
void sub_803FA70(u8 bank);
void sub_805EF84(u8 bank, bool8);
extern struct BattlePokemon gBattleMons[4];
void CopyPlayerPartyMonToBattleData(u8 bank, u8 partyIndex)
{
s32 i;
u8 nickname[POKEMON_NAME_LENGTH * 2];
gBattleMons[bank].species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL);
gBattleMons[bank].item = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HELD_ITEM, NULL);
for (i = 0; i < 4; i++)
{
gBattleMons[bank].moves[i] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MOVE1 + i, NULL);
gBattleMons[bank].pp[i] = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PP1 + i, NULL);
}
gBattleMons[bank].ppBonuses = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PP_BONUSES, NULL);
gBattleMons[bank].friendship = GetMonData(&gPlayerParty[partyIndex], MON_DATA_FRIENDSHIP, NULL);
gBattleMons[bank].experience = GetMonData(&gPlayerParty[partyIndex], MON_DATA_EXP, NULL);
gBattleMons[bank].hpIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP_IV, NULL);
gBattleMons[bank].attackIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ATK_IV, NULL);
gBattleMons[bank].defenseIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_DEF_IV, NULL);
gBattleMons[bank].speedIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPD_IV, NULL);
gBattleMons[bank].spAttackIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK_IV, NULL);
gBattleMons[bank].spDefenseIV = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF_IV, NULL);
gBattleMons[bank].personality = GetMonData(&gPlayerParty[partyIndex], MON_DATA_PERSONALITY, NULL);
gBattleMons[bank].status1 = GetMonData(&gPlayerParty[partyIndex], MON_DATA_STATUS, NULL);
gBattleMons[bank].level = GetMonData(&gPlayerParty[partyIndex], MON_DATA_LEVEL, NULL);
gBattleMons[bank].hp = GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP, NULL);
gBattleMons[bank].maxHP = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MAX_HP, NULL);
gBattleMons[bank].attack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ATK, NULL);
gBattleMons[bank].defense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_DEF, NULL);
gBattleMons[bank].speed = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPD, NULL);
gBattleMons[bank].spAttack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK, NULL);
gBattleMons[bank].spDefense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF, NULL);
gBattleMons[bank].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL);
gBattleMons[bank].altAbility = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ALT_ABILITY, NULL);
gBattleMons[bank].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL);
gBattleMons[bank].type1 = gBaseStats[gBattleMons[bank].species].type1;
gBattleMons[bank].type2 = gBaseStats[gBattleMons[bank].species].type2;
gBattleMons[bank].ability = GetAbilityBySpecies(gBattleMons[bank].species, gBattleMons[bank].altAbility);
GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname);
StringCopy10(gBattleMons[bank].nickname, nickname);
GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_NAME, gBattleMons[bank].otName);
// ewram memes from Ruby return
#ifdef NONMATCHING
gBattleStruct->hpOnSwitchout[GetBankSide(bank)] = gBattleMons[bank].hp;
#else
{
u32 side = GetBankSide(bank);
*(u16*)((void*)(gBattleStruct) + side) = gBattleMons[bank].hp;
}
#endif // NONMATCHING
for (i = 0; i < 8; i++)
gBattleMons[bank].statStages[i] = 6;
gBattleMons[bank].status2 = 0;
sub_803FA70(bank);
sub_805EF84(bank, FALSE);
}