Merge branch 'master' of github.com:pret/pokeemerald into Edwearth-learn_move

This commit is contained in:
Diegoisawesome 2018-08-12 12:55:21 -07:00
commit 9a73a47ddd
49 changed files with 7066 additions and 14965 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@ _081562DE:
strb r1, [r0]
ldr r0, [r2]
ldr r2, [r0, 0xC]
ldr r1, =gUnknown_02039E00
ldr r1, =gContestMons
adds r0, r2, 0
adds r0, 0x41
ldrb r0, [r0]
@ -144,7 +144,7 @@ sub_81563B0: @ 81563B0
beq _081564A0
adds r7, r5, 0
ldr r6, =gAIScriptPtr
ldr r0, =gUnknown_02039E00 + 30
ldr r0, =gContestMons + 30
mov r8, r0
_081563CC:
ldr r0, [r7]
@ -1167,7 +1167,7 @@ sub_8156B88: @ 8156B88
ldr r0, =gContestResources
ldr r0, [r0]
ldr r2, [r0, 0xC]
ldr r1, =gUnknown_02039F00
ldr r1, =gContestMonConditions
adds r0, r2, 0
adds r0, 0x41
ldrb r0, [r0]
@ -1436,7 +1436,7 @@ _08156D9C:
thumb_func_start sub_8156DA0
sub_8156DA0: @ 8156DA0
push {r4,lr}
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r4, =gContestResources
ldr r0, [r4]
ldr r0, [r0, 0xC]
@ -1615,7 +1615,7 @@ _08156EFC:
thumb_func_start sub_8156F04
sub_8156F04: @ 8156F04
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r0, =gContestResources
ldr r0, [r0]
ldr r3, [r0, 0xC]
@ -1714,7 +1714,7 @@ _08156FC8:
thumb_func_start sub_8156FCC
sub_8156FCC: @ 8156FCC
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r0, =gContestResources
ldr r0, [r0]
ldr r3, [r0, 0xC]
@ -1818,7 +1818,7 @@ _0815709C:
thumb_func_start sub_81570A0
sub_81570A0: @ 81570A0
push {r4-r7,lr}
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r5, =gContestResources
ldr r0, [r5]
ldr r1, [r0, 0xC]
@ -1923,7 +1923,7 @@ _0815716C:
thumb_func_start sub_8157174
sub_8157174: @ 8157174
push {r4-r7,lr}
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r5, =gContestResources
ldr r0, [r5]
ldr r1, [r0, 0xC]
@ -2028,7 +2028,7 @@ _08157240:
thumb_func_start sub_8157248
sub_8157248: @ 8157248
push {r4,lr}
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r0, =gContestResources
ldr r0, [r0]
ldr r4, [r0, 0xC]
@ -2208,7 +2208,7 @@ _081573B0:
thumb_func_start sub_81573B4
sub_81573B4: @ 81573B4
push {r4,lr}
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r0, =gContestResources
ldr r0, [r0]
ldr r4, [r0, 0xC]
@ -2388,7 +2388,7 @@ _0815751C:
thumb_func_start sub_8157520
sub_8157520: @ 8157520
push {r4,r5,lr}
ldr r3, =gUnknown_02039E00
ldr r3, =gContestMons
ldr r5, =gContestResources
ldr r4, [r5]
ldr r1, [r4, 0xC]
@ -2575,7 +2575,7 @@ _08157684:
sub_8157688: @ 8157688
push {r4-r6,lr}
movs r3, 0
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r0, =gContestResources
ldr r0, [r0]
ldr r0, [r0, 0xC]
@ -2711,7 +2711,7 @@ _08157788:
sub_8157790: @ 8157790
push {r4-r6,lr}
movs r3, 0
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r0, =gContestResources
ldr r0, [r0]
ldr r0, [r0, 0xC]
@ -2846,7 +2846,7 @@ _08157890:
sub_8157898: @ 8157898
push {r4-r6,lr}
movs r5, 0
ldr r3, =gUnknown_02039E00
ldr r3, =gContestMons
ldr r6, =gContestResources
ldr r4, [r6]
ldr r1, [r4, 0xC]
@ -3729,7 +3729,7 @@ sub_8157F5C: @ 8157F5C
ldr r1, =gContestResources
ldr r1, [r1]
ldr r3, [r1, 0xC]
ldr r2, =gUnknown_02039F00
ldr r2, =gContestMonConditions
lsrs r0, 23
adds r0, r2
adds r1, r3, 0
@ -5030,7 +5030,7 @@ sub_8158948: @ 8158948
push {r4-r6,lr}
movs r5, 0
movs r4, 0
ldr r6, =gUnknown_02039E00 + 30
ldr r6, =gContestMons + 30
_08158950:
lsls r1, r4, 1
ldr r0, =gContestResources
@ -5156,7 +5156,7 @@ sub_8158A34: @ 8158A34
lsls r0, 8
orrs r5, r0
movs r4, 0
ldr r0, =gUnknown_02039E00
ldr r0, =gContestMons
mov r12, r0
ldr r2, =gContestResources
ldr r0, [r2]

View File

@ -276,10 +276,10 @@ sub_80F5A74: @ 80F5A74
lsrs r0, 24
adds r5, r0, 0
lsls r1, r5, 6
ldr r0, =gUnknown_02039E00
ldr r0, =gContestMons
adds r7, r1, r0
ldr r6, =gDisplayedStringBattle
ldr r0, =gUnknown_02039F25
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
cmp r5, r0
bne _080F5A96
@ -398,7 +398,7 @@ sub_80F5B00: @ 80F5B00
movs r1, 0x14
bl CreateTask
bl sub_80F7880
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
@ -503,7 +503,7 @@ sub_80F5CE4: @ 80F5CE4
push {r4-r7,lr}
lsls r0, 24
lsrs r6, r0, 24
ldr r3, =gUnknown_02039F2A
ldr r3, =gIsLinkContest
ldrb r1, [r3]
movs r0, 0x1
ands r0, r1
@ -535,8 +535,8 @@ _080F5D20:
b _080F5E2E
_080F5D2A:
bl sub_80DBED4
ldr r1, =gUnknown_02039F20
ldr r0, =gUnknown_02039F25
ldr r1, =gContestFinalStandings
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -648,7 +648,7 @@ _080F5E2E:
lsls r0, 3
adds r4, r0, r1
strh r2, [r4, 0x8]
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r5, 0x1
adds r0, r5, 0
@ -663,8 +663,8 @@ _080F5E2E:
_080F5E78:
movs r0, 0x24
bl IncrementGameStat
ldr r1, =gUnknown_02039F20
ldr r0, =gUnknown_02039F25
ldr r1, =gContestFinalStandings
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -1160,7 +1160,7 @@ _080F6298:
adds r1, r0
lsls r1, 3
adds r1, r7
ldr r0, =gUnknown_02039F20
ldr r0, =gContestFinalStandings
adds r0, r4, r0
ldrb r0, [r0]
strh r0, [r1, 0x8]
@ -1201,7 +1201,7 @@ _080F62F2:
adds r0, 0x1
strh r0, [r4, 0x8]
movs r4, 0
ldr r1, =gUnknown_02039F20
ldr r1, =gContestFinalStandings
ldrb r0, [r1]
cmp r0, 0
beq _080F631C
@ -1236,10 +1236,10 @@ _080F6334:
movs r0, 0
strh r0, [r2, 0xA]
movs r4, 0
ldr r1, =gUnknown_02039F20
ldr r1, =gContestFinalStandings
ldrb r0, [r1]
ldr r7, =gStringVar1
ldr r2, =gUnknown_02039E00 + 13
ldr r2, =gContestMons + 13
mov r8, r2
cmp r0, 0
beq _080F636E
@ -1355,12 +1355,12 @@ _080F6454:
adds r0, r3, 0
strh r0, [r1]
movs r2, 0
ldr r1, =gUnknown_02039F20
ldr r1, =gContestFinalStandings
ldrb r0, [r1]
lsls r4, r7, 2
mov r10, r4
ldr r3, =gUnknown_02039E00
ldr r4, =gUnknown_02039F25
ldr r3, =gContestMons
ldr r4, =gContestPlayerMonIndex
mov r9, r4
ldr r4, =gMonFrontPicTable
mov r12, r4
@ -1623,14 +1623,14 @@ sub_80F66B4: @ 80F66B4
ands r0, r1
cmp r0, 0
beq _080F6702
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
adds r0, r2, 0
ands r0, r1
lsls r6, r7, 2
cmp r0, 0
bne _080F66F2
ldr r5, =gUnknown_02039E00
ldr r5, =gContestMons
movs r4, 0x3
_080F66DA:
ldrh r0, [r5]
@ -1664,7 +1664,7 @@ sub_80F671C: @ 80F671C
push {r4,lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
@ -1710,7 +1710,7 @@ sub_80F677C: @ 80F677C
ldrb r0, [r0]
cmp r0, 0
bne _080F67AC
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
@ -1739,14 +1739,14 @@ task_repel: @ 80F67C4
sub sp, 0x4
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
cmp r0, 0
bne _080F67E6
ldr r1, =gUnknown_02039F20
ldr r0, =gUnknown_02039F25
ldr r1, =gContestFinalStandings
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -1980,7 +1980,7 @@ sub_80F69B8: @ 80F69B8
lsrs r5, r2, 24
lsls r3, 24
lsrs r6, r3, 24
ldr r0, =gUnknown_02039F25
ldr r0, =gContestPlayerMonIndex
movs r2, 0
ldrb r0, [r0]
cmp r4, r0
@ -2059,7 +2059,7 @@ sub_80F6A64: @ 80F6A64
lsls r1, 24
lsrs r6, r1, 24
movs r5, 0
ldr r4, =gUnknown_02039E00
ldr r4, =gContestMons
_080F6A74:
ldrh r0, [r4]
lsls r1, r5, 24
@ -2088,7 +2088,7 @@ sub_80F6A9C: @ 80F6A9C
movs r5, 0xA0
lsls r5, 16
_080F6AA6:
ldr r1, =gUnknown_02039E00
ldr r1, =gContestMons
lsls r0, r4, 6
adds r0, r1
ldrh r0, [r0]
@ -2119,7 +2119,7 @@ _080F6AA6:
thumb_func_start sub_80F6AE8
sub_80F6AE8: @ 80F6AE8
push {r4,lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
@ -2955,7 +2955,7 @@ sub_80F71C8: @ 80F71C8
sub sp, 0xC
movs r5, 0x5
movs r4, 0x1
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
adds r0, r4, 0
ands r0, r1
@ -3104,7 +3104,7 @@ sub_80F7310: @ 80F7310
lsls r0, 24
lsls r1, 24
lsrs r5, r1, 24
ldr r1, =gUnknown_02039F00
ldr r1, =gContestMonConditions
lsrs r0, 23
adds r0, r1
movs r1, 0
@ -3322,7 +3322,7 @@ sub_80F74BC: @ 80F74BC
lsls r0, 24
lsrs r5, r0, 24
movs r4, 0
ldr r1, =gUnknown_02039F20
ldr r1, =gContestFinalStandings
ldrb r0, [r1]
ldr r6, =gUnknown_0203A034
cmp r0, 0
@ -3729,7 +3729,7 @@ sub_80F77E0: @ 80F77E0
adds r1, r2
strh r4, [r1, 0x8]
strh r5, [r1, 0xA]
ldr r0, =gUnknown_02039E00
ldr r0, =gContestMons
lsls r4, 6
adds r4, r0
ldrh r0, [r4]
@ -3765,7 +3765,7 @@ sub_80F7824: @ 80F7824
strh r0, [r4, 0x1C]
ldrh r0, [r4, 0xC]
ldrb r2, [r4, 0x1E]
ldr r1, =gUnknown_02039E00
ldr r1, =gContestMons
lsls r3, r5, 6
adds r1, 0x38
adds r3, r1
@ -3847,7 +3847,7 @@ _080F78E4:
mov r8, r5
mov r10, r5
_080F78EA:
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
mov r1, r8
lsls r7, r1, 1
adds r0, r7, r0
@ -3987,7 +3987,7 @@ _080F79CC:
negs r0, r0
_080F7A02:
strb r0, [r1, 0x12]
ldr r0, =gUnknown_02039F20
ldr r0, =gContestFinalStandings
add r0, r8
ldrb r0, [r0]
cmp r0, 0
@ -4721,8 +4721,8 @@ _080F7FEE:
sub_80F7FFC: @ 80F7FFC
push {r4-r7,lr}
sub sp, 0x4
ldr r1, =gUnknown_02039F20
ldr r0, =gUnknown_02039F25
ldr r1, =gContestFinalStandings
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -4994,7 +4994,7 @@ sub_80F8264: @ 80F8264
ldr r0, =gSpecialVar_0x8006
ldrh r1, [r0]
lsls r1, 6
ldr r0, =gUnknown_02039E00 + 13
ldr r0, =gContestMons + 13
adds r1, r0
adds r0, r4, 0
bl StringCopy
@ -5013,7 +5013,7 @@ sub_80F8290: @ 80F8290
ldr r1, =gSpecialVar_0x8006
ldrh r1, [r1]
lsls r1, 6
ldr r2, =gUnknown_02039E00 + 2
ldr r2, =gContestMons + 2
adds r1, r2
bl StringCopy
pop {r0}
@ -5027,7 +5027,7 @@ sub_80F82B4: @ 80F82B4
movs r1, 0
movs r2, 0
ldr r5, =gSpecialVar_0x8004
ldr r4, =gUnknown_02039F00
ldr r4, =gContestMonConditions
ldr r0, =gSpecialVar_0x8006
ldrh r0, [r0]
lsls r0, 1
@ -5060,7 +5060,7 @@ _080F82DC:
thumb_func_start sub_80F82FC
sub_80F82FC: @ 80F82FC
ldr r2, =gSpecialVar_0x8004
ldr r1, =gUnknown_02039F00
ldr r1, =gContestMonConditions
ldr r0, =gSpecialVar_0x8006
ldrh r0, [r0]
lsls r0, 1
@ -5075,7 +5075,7 @@ sub_80F82FC: @ 80F82FC
sub_80F831C: @ 80F831C
push {lr}
movs r1, 0
ldr r2, =gUnknown_02039F20
ldr r2, =gContestFinalStandings
ldrb r0, [r2]
ldr r3, =gSpecialVar_0x8005
cmp r0, 0
@ -5101,10 +5101,10 @@ _080F833C:
sub_80F834C: @ 80F834C
push {r4,lr}
movs r1, 0
ldr r2, =gUnknown_02039F20
ldr r2, =gContestFinalStandings
ldrb r0, [r2]
ldr r4, =gStringVar3
ldr r3, =gUnknown_02039E00 + 13
ldr r3, =gContestMons + 13
cmp r0, 0
beq _080F836E
_080F835C:
@ -5134,10 +5134,10 @@ _080F836E:
sub_80F8390: @ 80F8390
push {r4,lr}
movs r1, 0
ldr r2, =gUnknown_02039F20
ldr r2, =gContestFinalStandings
ldrb r0, [r2]
ldr r4, =gStringVar1
ldr r3, =gUnknown_02039E00 + 2
ldr r3, =gContestMons + 2
cmp r0, 0
beq _080F83B2
_080F83A0:
@ -5216,7 +5216,7 @@ sub_80F840C: @ 80F840C
thumb_func_start sub_80F8438
sub_80F8438: @ 80F8438
ldr r2, =gSpecialVar_0x8004
ldr r1, =gUnknown_02039E00
ldr r1, =gContestMons
ldr r0, =gSpecialVar_0x8006
ldrh r0, [r0]
lsls r0, 6
@ -5272,7 +5272,7 @@ sub_80F8484: @ 80F8484
thumb_func_start sub_80F84B0
sub_80F84B0: @ 80F84B0
ldr r0, =gSpecialVar_0x8004
ldr r1, =gUnknown_02039F25
ldr r1, =gContestPlayerMonIndex
ldrb r1, [r1]
strh r1, [r0]
bx lr
@ -5314,7 +5314,7 @@ sub_80F8508: @ 80F8508
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x4
ands r0, r1
@ -5578,7 +5578,7 @@ sub_80F8714: @ 80F8714
b _080F877E
.pool
_080F8748:
ldr r5, =gUnknown_02039E00 + 2
ldr r5, =gContestMons + 2
movs r4, 0x3
_080F874C:
adds r0, r5, 0

View File

@ -139,12 +139,12 @@ sub_80FC5DC: @ 80FC5DC
cmp r0, 0
beq _080FC650
bl GetMultiplayerId
ldr r1, =gUnknown_02039F25
ldr r1, =gContestPlayerMonIndex
strb r0, [r1]
bl GetLinkPlayerCount
ldr r4, =gUnknown_02039F30
strb r0, [r4]
ldr r1, =gUnknown_02039F2A
ldr r1, =gIsLinkContest
movs r0, 0x1
strb r0, [r1]
ldr r0, =gWirelessCommType
@ -182,7 +182,7 @@ _080FC63A:
ldrb r6, [r6]
cmp r3, r6
bge _080FC64A
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r2, 0x4
orrs r1, r2
@ -201,7 +201,7 @@ _080FC650:
sub_80FC670: @ 80FC670
push {r4,lr}
adds r4, r0, 0
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x4
ands r0, r1
@ -285,10 +285,10 @@ _080FC6FE:
cmp r0, 0
beq _080FC7F4
ldr r0, =gBlockSendBuffer
ldr r1, =gUnknown_02039F25
ldr r1, =gContestPlayerMonIndex
ldrb r1, [r1]
lsls r1, 6
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
adds r1, r2
movs r2, 0x40
bl memcpy
@ -298,10 +298,10 @@ _080FC6FE:
.pool
_080FC738:
ldr r0, =gBlockSendBuffer
ldr r1, =gUnknown_02039F25
ldr r1, =gContestPlayerMonIndex
ldrb r1, [r1]
lsls r1, 6
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
adds r1, r2
movs r2, 0x40
bl memcpy
@ -321,7 +321,7 @@ _080FC758:
ldr r6, =gLinkPlayers
_080FC770:
lsls r4, r5, 6
ldr r0, =gUnknown_02039E00
ldr r0, =gContestMons
adds r4, r0
lsls r1, r5, 8
ldr r0, =gBlockRecvBuffer
@ -434,7 +434,7 @@ _080FC858:
adds r1, r4, 0
movs r2, 0x4
bl memcpy
ldr r0, =gUnknown_030060B8
ldr r0, =gContestRngValue
adds r1, r4, 0
movs r2, 0x4
bl memcpy
@ -603,7 +603,7 @@ _080FC9C4:
lsls r0, 24
cmp r0, 0
beq _080FC9F0
ldr r0, =gUnknown_02039F25
ldr r0, =gContestPlayerMonIndex
movs r1, 0x1
bl sub_80FC4F4
cmp r0, 0x1
@ -659,7 +659,7 @@ _080FCA30:
beq _080FCAB2
ldr r0, =gContestResources
ldr r2, [r0]
ldr r0, =gUnknown_02039F25
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
lsls r1, r0, 3
subs r1, r0
@ -860,7 +860,7 @@ _080FCC08:
lsls r0, 24
cmp r0, 0
beq _080FCC82
ldr r0, =gUnknown_02039F20
ldr r0, =gContestFinalStandings
movs r1, 0x4
_080FCC16:
bl sub_80FC4F4
@ -881,7 +881,7 @@ _080FCC38:
lsls r0, 24
cmp r0, 0
beq _080FCC82
ldr r0, =gUnknown_02039F20
ldr r0, =gContestFinalStandings
ldr r1, =gUnknown_02039F2B
ldrb r1, [r1]
lsls r1, 8
@ -1262,7 +1262,7 @@ _080FCF80:
lsls r0, 24
cmp r0, 0
beq _080FCFBE
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
movs r1, 0x8
bl sub_80FC4F4
cmp r0, 0x1
@ -1274,7 +1274,7 @@ _080FCF9C:
lsls r0, 24
cmp r0, 0
beq _080FCFBE
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
ldr r1, =gUnknown_02039F2B
ldrb r1, [r1]
lsls r1, 8

View File

@ -88,8 +88,8 @@ _081D9EA4:
_081D9EB4:
bl GetMonData
strb r0, [r4]
ldr r5, =gUnknown_02039E00
ldr r4, =gUnknown_02039F25
ldr r5, =gContestMons
ldr r4, =gContestPlayerMonIndex
ldrb r0, [r4]
lsls r0, 6
adds r0, r5
@ -266,7 +266,7 @@ _081DA02A:
lsls r0, 24
cmp r0, 0
bne _081DA0B8
ldr r0, =gUnknown_02039E00
ldr r0, =gContestMons
adds r1, r0, 0
adds r1, 0x2C
ldrb r2, [r1]
@ -438,10 +438,10 @@ _081DA1A4:
lsls r0, 24
cmp r0, 0
beq _081DA224
ldr r0, =gUnknown_02039F25
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
lsls r0, 6
ldr r1, =gUnknown_02039E00
ldr r1, =gContestMons
adds r0, r1
movs r1, 0x40
bl sub_80FC4F4
@ -466,7 +466,7 @@ _081DA1D4:
ldr r6, =gLinkPlayers
_081DA1EC:
lsls r4, r5, 6
ldr r0, =gUnknown_02039E00
ldr r0, =gContestMons
adds r4, r0
lsls r1, r5, 8
ldr r0, =gBlockRecvBuffer
@ -558,7 +558,7 @@ _081DA2AC:
adds r1, r4, 0
movs r2, 0x4
bl memcpy
ldr r0, =gUnknown_030060B8
ldr r0, =gContestRngValue
adds r1, r4, 0
movs r2, 0x4
bl memcpy
@ -823,7 +823,7 @@ _081DA4CC:
ldr r0, =gUnknown_02039F30
ldrb r2, [r0]
lsls r0, r2, 6
ldr r1, =gUnknown_02039E00
ldr r1, =gContestMons
adds r0, r1
movs r1, 0x4
subs r1, r2
@ -847,7 +847,7 @@ _081DA50C:
ldr r4, =gUnknown_02039F30
ldrb r3, [r4]
lsls r0, r3, 6
ldr r5, =gUnknown_02039E00
ldr r5, =gContestMons
adds r0, r5
ldr r1, =gBlockRecvBuffer
movs r2, 0x4

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ sub_80F87D8: @ 80F87D8
push {r4,lr}
ldr r0, =gSaveBlock1Ptr
ldr r2, [r0]
ldr r1, =gUnknown_02039E00
ldr r1, =gContestMons
ldrb r3, [r1, 0x15]
ldr r4, =0x000013bc
adds r0, r2, r4
@ -150,8 +150,8 @@ sub_80F88DC: @ 80F88DC
thumb_func_start sub_80F88E8
sub_80F88E8: @ 80F88E8
push {lr}
ldr r0, =gUnknown_02039F20
ldr r1, =gUnknown_02039F25
ldr r0, =gContestFinalStandings
ldr r1, =gContestPlayerMonIndex
ldrb r2, [r1]
adds r0, r2, r0
ldrb r0, [r0]
@ -218,11 +218,11 @@ sub_80F8970: @ 80F8970
mov r5, r8
push {r5-r7}
sub sp, 0x8
ldr r0, =gUnknown_02039F00
ldr r0, =gContestMonConditions
mov r12, r0
ldr r1, =gSpecialVar_0x8006
mov r9, r1
ldr r2, =gUnknown_02039E00 + 2
ldr r2, =gContestMons + 2
mov r10, r2
mov r2, r12
mov r1, sp
@ -413,7 +413,7 @@ ShowContestWinner: @ 80F8ADC
thumb_func_start sub_80F8AFC
sub_80F8AFC: @ 80F8AFC
push {r4,r5,lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
@ -422,7 +422,7 @@ sub_80F8AFC: @ 80F8AFC
movs r3, 0
ldr r0, =gUnknown_02039F30
adds r4, r0, 0
ldr r5, =gUnknown_02039E00
ldr r5, =gContestMons
ldrb r0, [r4]
cmp r3, r0
bge _080F8B50
@ -482,7 +482,7 @@ sub_80F8B94: @ 80F8B94
ldr r1, =gReservedSpritePaletteCount
movs r0, 0xC
strb r0, [r1]
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
@ -594,8 +594,8 @@ sub_80F8C7C: @ 80F8C7C
strb r0, [r1]
cmp r0, 0
bne _080F8D18
ldr r0, =gUnknown_02039F20
ldr r1, =gUnknown_02039F25
ldr r0, =gContestFinalStandings
ldr r1, =gContestPlayerMonIndex
ldrb r2, [r1]
adds r0, r2, r0
ldrb r0, [r0]
@ -675,7 +675,7 @@ _080F8D44:
mov r9, r0
movs r1, 0x3
mov r10, r1
ldr r2, =gUnknown_02039E00
ldr r2, =gContestMons
ldr r4, =gSpecialVar_0x8006
ldrh r1, [r4]
lsls r1, 6
@ -702,7 +702,7 @@ _080F8D44:
movs r1, 0
strh r1, [r0, 0x8]
strh r6, [r0, 0xA]
ldr r1, =gUnknown_02039F25
ldr r1, =gContestPlayerMonIndex
ldrh r0, [r4]
ldrb r1, [r1]
cmp r0, r1
@ -758,7 +758,7 @@ _080F8DD8:
bl CreateSprite
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
@ -938,7 +938,7 @@ _080F8F98:
thumb_func_start sub_80F8FA0
sub_80F8FA0: @ 80F8FA0
push {r4,lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
@ -973,13 +973,13 @@ _080F8FDE:
thumb_func_start sub_80F8FE8
sub_80F8FE8: @ 80F8FE8
push {r4,lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _080F9020
ldr r2, =gUnknown_030060B8
ldr r2, =gContestRngValue
ldr r1, [r2]
ldr r0, =0x41c64e6d
muls r0, r1
@ -1007,7 +1007,7 @@ _080F902A:
thumb_func_start sub_80F903C
sub_80F903C: @ 80F903C
ldr r2, =gUnknown_030060B8
ldr r2, =gContestRngValue
ldr r1, [r2]
ldr r0, =0x41c64e6d
muls r0, r1
@ -1022,7 +1022,7 @@ sub_80F903C: @ 80F903C
thumb_func_start sub_80F905C
sub_80F905C: @ 80F905C
push {lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
@ -1087,7 +1087,7 @@ _080F90D4:
thumb_func_start sub_80F90DC
sub_80F90DC: @ 80F90DC
push {lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
@ -1110,7 +1110,7 @@ _080F90FE:
thumb_func_start sub_80F910C
sub_80F910C: @ 80F910C
push {lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1
@ -1130,7 +1130,7 @@ _080F9126:
thumb_func_start sub_80F9134
sub_80F9134: @ 80F9134
push {lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x4
ands r0, r1
@ -1148,7 +1148,7 @@ _080F914E:
thumb_func_start sub_80F9154
sub_80F9154: @ 80F9154
ldr r1, =gUnknown_02039F2A
ldr r1, =gIsLinkContest
movs r0, 0
strb r0, [r1]
bx lr
@ -1158,7 +1158,7 @@ sub_80F9154: @ 80F9154
thumb_func_start sub_80F9160
sub_80F9160: @ 80F9160
push {lr}
ldr r0, =gUnknown_02039F2A
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x2
ands r0, r1

File diff suppressed because it is too large Load Diff

1
common_syms/contest.txt Normal file
View File

@ -0,0 +1 @@
gContestRngValue

View File

@ -352,7 +352,7 @@ gUnknown_08587FA4:: @ 8587FA4
.align 2
gUnknown_085880A4:: @ 85880A4
gContestOpponents:: @ 85880A4
.include "data/contest_opponents.inc"
gUnknown_085898A4:: @ 85898A4

View File

@ -1802,7 +1802,7 @@ EventScript_271E0E:: @ 8271E0E
checkflag FLAG_SYS_PC_LANETTE
call_if 1, EventScript_271E3E
msgbox gUnknown_082726A3, 4
special sub_80C7578
special ShowPokemonStorageSystem
waitstate
goto EventScript_271DAC
end

View File

@ -6,63 +6,6 @@
.section .rodata
.align 2, 0
gUnknown_084973FC:: @ 84973FC
.4byte MetatileBehavior_IsTrickHouseSlipperyFloor
.4byte MetatileBehavior_IsIce_2
.4byte MetatileBehavior_IsWalkSouth
.4byte MetatileBehavior_IsWalkNorth
.4byte MetatileBehavior_IsWalkWest
.4byte MetatileBehavior_IsWalkEast
.4byte MetatileBehavior_IsSouthwardCurrent
.4byte MetatileBehavior_IsNorthwardCurrent
.4byte MetatileBehavior_IsWestwardCurrent
.4byte MetatileBehavior_IsEastwardCurrent
.4byte MetatileBehavior_IsSlideSouth
.4byte MetatileBehavior_IsSlideNorth
.4byte MetatileBehavior_IsSlideWest
.4byte MetatileBehavior_IsSlideEast
.4byte MetatileBehavior_IsWaterfall
.4byte MetatileBehavior_IsSecretBaseJumpMat
.4byte MetatileBehavior_IsSecretBaseSpinMat
.4byte MetatileBehavior_IsMuddySlope
gUnknown_08497444:: @ 8497444
.4byte ForcedMovement_None
.4byte ForcedMovement_Slip
.4byte ForcedMovement_Slip
.4byte ForcedMovement_WalkSouth
.4byte ForcedMovement_WalkNorth
.4byte ForcedMovement_WalkWest
.4byte ForcedMovement_WalkEast
.4byte ForcedMovement_PushedSouthByCurrent
.4byte ForcedMovement_PushedNorthByCurrent
.4byte ForcedMovement_PushedWestByCurrent
.4byte ForcedMovement_PushedEastByCurrent
.4byte ForcedMovement_SlideSouth
.4byte ForcedMovement_SlideNorth
.4byte ForcedMovement_SlideWest
.4byte ForcedMovement_SlideEast
.4byte ForcedMovement_PushedSouthByCurrent
.4byte ForcedMovement_0xBB
.4byte ForcedMovement_0xBC
.4byte ForcedMovement_MuddySlope
gUnknown_08497490:: @ 8497490
.4byte PlayerNotOnBikeNotMoving
.4byte PlayerNotOnBikeTurningInPlace
.4byte PlayerNotOnBikeMoving
gUnknown_0849749C:: @ 849749C
.4byte MetatileBehavior_IsBumpySlope
.4byte MetatileBehavior_IsIsolatedVerticalRail
.4byte MetatileBehavior_IsIsolatedHorizontalRail
.4byte MetatileBehavior_IsVerticalRail
.4byte MetatileBehavior_IsHorizontalRail
gUnknown_084974B0:: @ 84974B0
.byte 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x00, 0x00, 0x00
gUnknown_084974B8:: @ 84974B8
.4byte PlayerAvatarTransition_Normal
.4byte PlayerAvatarTransition_MachBike
@ -158,4 +101,3 @@ gUnknown_084975B0:: @ 84975B0
gUnknown_084975BC:: @ 84975BC
.byte 0x01, 0x03, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00

View File

@ -1241,11 +1241,11 @@ gUnknown_08C17980:: @ 8C17980
.incbin "graphics/unknown/unknown_C17980.bin.lz"
.align 2
gUnknown_08C17AB0:: @ 8C17AB0
gContestMiscGfx:: @ 8C17AB0
.incbin "graphics/contest/misc.4bpp.lz"
.align 2
gUnknown_08C1850C:: @ 8C1850C
gContestAudienceGfx:: @ 8C1850C
.incbin "graphics/contest/audience.4bpp.lz"
.align 2

View File

@ -3,18 +3,6 @@
.section .rodata
.align 2
gUnknown_0857173C:: @ 857173C
.incbin "graphics/unknown/unknown_57173C.gbapal"
.align 2
gUnknown_0857175C:: @ 857175C
.incbin "graphics/pokemon_storage/box_selection_popup_center.4bpp"
.align 2
gUnknown_08571F5C:: @ 8571F5C
.incbin "graphics/pokemon_storage/box_selection_popup_sides.4bpp"
.align 2
gUnknown_085720DC:: @ 85720DC
.incbin "graphics/pokemon_storage/scrolling_bg.4bpp.lz"

View File

@ -20,36 +20,36 @@ gUnknown_085A7444:: @ 85A7444
gUnknown_085A744C:: @ 85A744C
.byte 3, 1, 2, 0
gUnknown_085A7450:: @ 85A7450
.4byte sub_812AB04
.4byte sub_812AB38
.4byte sub_812AB60
.4byte sub_812ABA8
.4byte sub_812ABC8
.4byte sub_812ABF8
.4byte sub_812ACF4
.4byte sub_812AD34
.4byte sub_812AD60
.4byte sub_812AD80
.4byte sub_812ADF4
.4byte sub_812AE24
.4byte sub_812AE4C
.4byte sub_812AE88
.4byte sub_812AEC4
.4byte sub_812AFFC
.4byte sub_812B01C
.4byte sub_812B094
.4byte sub_812B0D8
.4byte sub_812B108
.4byte sub_812B130
.4byte sub_812B158
.4byte sub_812B1B0
.4byte sub_812B214
.4byte sub_812B254
.4byte sub_812B280
.4byte sub_812B2C0
.4byte sub_812B2EC
.4byte sub_812B32C
gUnknown_083ECAAC:: @ 85A7450
.4byte sub_8101D5C
.4byte sub_8101D8C
.4byte sub_8101DB0
.4byte sub_8101DF4
.4byte sub_8101E10
.4byte sub_8101E3C
.4byte sub_8101F44
.4byte sub_8101F60
.4byte sub_8101F88
.4byte sub_8101FA4
.4byte sub_8102008
.4byte sub_8102034
.4byte sub_8102058
.4byte sub_8102090
.4byte sub_81020C8
.4byte sub_81021E0
.4byte sub_81021FC
.4byte sub_8102264
.4byte sub_81022A0
.4byte sub_81022CC
.4byte sub_81022F0
.4byte sub_8102318
.4byte sub_8102344
.4byte sub_810239C
.4byte sub_81023B8
.4byte sub_81023E0_
.4byte sub_81023FC
.4byte sub_8102424
.4byte sub_8102460
gUnknown_085A74C4:: @ 85A74C4
.4byte sub_812BB34
@ -203,10 +203,10 @@ gUnknown_085A766E:: @ 85A766E
gUnknown_085A76AD:: @ 85A76AD
.byte 1, 0, 5, 4, 3, 2, 0
gUnknown_085A76B4:: @ 85A76B4
gUnknown_083ECCF8:: @ 85A76B4
.2byte 0, 6, 0, 10, 0, 2
gUnknown_085A76C0:: @ 85A76C0
gUnknown_083ECD04:: @ 85A76C0
.byte 1, 1, 12
.byte 1, 1, 14
.byte 2, 2, 14
@ -214,19 +214,19 @@ gUnknown_085A76C0:: @ 85A76C0
.byte 2, 3, 16
.byte 3, 3, 16
gUnknown_085A76D2:: @ 85A76D2
gUnknown_083ECD16:: @ 85A76D2
.byte 0x19, 0x19, 0x1E, 0x28, 0x28, 0x32
.byte 0x19, 0x19, 0x1E, 0x1E, 0x23, 0x23
.byte 0x19, 0x19, 0x1E, 0x19, 0x19, 0x1E
gUnknown_085A76E4:: @ 85A76E4
gUnknown_083ECD28:: @ 85A76E4
.byte 0x14, 0x19, 0x19, 0x14, 0x19, 0x19
.byte 0xC, 0xF, 0xF, 0x12, 0x13, 0x16
.byte 0x19, 0x19, 0x19, 0x1E, 0x1E, 0x28
.byte 0x19, 0x19, 0x14, 0x14, 0xF, 0xF
.byte 0x28, 0x28, 0x23, 0x23, 0x28, 0x28
gUnknown_085A7702:: @ 85A7702
gUnknown_083ECD46:: @ 85A7702
.byte 0xF3, 0xF3, 0xF3, 0x50, 0x50, 0x50, 0x50, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x5, 0x5, 0x5, 0x5
.byte 0x5, 0x5, 0x5, 0x96, 0x96, 0x96, 0x96, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x64, 0x64, 0x64, 0x5
.byte 0x4, 0x4, 0x4, 0x14, 0x14, 0x14, 0x14, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x64, 0x64, 0x64, 0x28
@ -234,7 +234,7 @@ gUnknown_085A7702:: @ 85A7702
.byte 0x1, 0x1, 0x1, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x2, 0x5, 0x5, 0x5, 0x64
.byte 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x6
gUnknown_085A7768:: @ 85A7768
gUnknown_083ECDAC:: @ 85A7768
.byte 0xF3, 0xF3, 0xF3, 0xC8, 0xC8, 0xC8, 0xC8, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0xA0, 0x46, 0x46, 0x46, 0x05
.byte 0x05, 0x05, 0x05, 0x19, 0x19, 0x19, 0x19, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x02, 0x02, 0x02, 0x06
.byte 0x04, 0x04, 0x04, 0x19, 0x19, 0x19, 0x19, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x28, 0x28, 0x28, 0x23
@ -242,45 +242,45 @@ gUnknown_085A7768:: @ 85A7768
.byte 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x28, 0x28, 0x28, 0x64
.byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x04, 0x04, 0x3C
gUnknown_085A77CE:: @ 85A77CE
gUnknown_083ECE12:: @ 85A77CE
.2byte 0x80, 0xAF, 0xC8, 0xE1, 0x100
gUnknown_085A77D8:: @ 85A77D8
gUnknown_083ECE1C:: @ 85A77D8
.byte 10, 0, 5, 0
.byte 10, 0, 10, 0
.byte 10, 0, 15, 0
.byte 10, 0, 25, 0
.byte 10, 0, 35, 0
gUnknown_085A77EC:: @ 85A77EC
gUnknown_083ECE30:: @ 85A77EC
.byte 0, 0
.byte 5, 0
.byte 10, 0
.byte 15, 0
.byte 20, 0
gUnknown_085A77F6:: @ 85A77F6
gUnknown_083ECE3A:: @ 85A77F6
.byte 6, 4, 3, 2, 5, 0, 0, 0
gUnknown_085A77FE:: @ 85A77FE
gUnknown_083ECE42:: @ 85A77FE
.byte 0x80, 0
.byte 0x20, 0
.byte 0x40, 0
gUnknown_085A7804:: @ 85A7804
gUnknown_083ECE48:: @ 85A7804
.byte 16, 0
.byte 8, 0
.byte 4, 0
.byte 2, 0
.byte 1, 0
gUnknown_085A780E:: @ 85A780E
sSym2Match:: @ 85A780E
.byte 7, 8, 4, 3, 0, 5, 2, 0
gUnknown_085A7816:: @ 85A7816
sSlotMatchFlags:: @ 85A7816
.2byte 1, 2, 4, 8, 16, 32, 64, 128, 256
gUnknown_085A7828:: @ 85A7828
sSlotPayouts:: @ 85A7828
.2byte 2, 4, 0, 6, 12, 3, 0x5A, 0x12C, 0x12C
gUnknown_085A783A:: @ 85A783A

View File

@ -71,7 +71,7 @@ gSpecials:: @ 81DBA64
def_special ShouldTryRematchBattle
def_special IsTrainerReadyForRematch
def_special BattleSetup_StartRematchBattle
def_special sub_80C7578
def_special ShowPokemonStorageSystem
def_special HasEnoughMonsForDoubleBattle
def_special TurnOffTVScreen
def_special DoTVShow

View File

@ -107,4 +107,6 @@ u8 ItemIdToBallId(u16 itemId);
u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId);
u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 arg2, u8 ballId);
u8 sub_80A600C(u8, u16, u8);
#endif // GUARD_BATTLE_ANIM_H

View File

@ -1,36 +1,241 @@
#ifndef GUARD_CONTEST_H
#define GUARD_CONTEST_H
struct ContestMove
enum
{
u8 effect;
u8 contestCategory:3;
u8 comboStarterId;
u8 comboMoves[4];
CONTEST_CATEGORY_COOL,
CONTEST_CATEGORY_BEAUTY,
CONTEST_CATEGORY_CUTE,
CONTEST_CATEGORY_SMART,
CONTEST_CATEGORY_TOUGH,
};
struct ContestEffect
enum
{
u8 effectType;
u8 appeal;
u8 jam;
CONTEST_EFFECT_HIGHLY_APPEALING,
CONTEST_EFFECT_USER_MORE_EASILY_STARTLED,
CONTEST_EFFECT_GREAT_APPEAL_BUT_NO_MORE_MOVES,
CONTEST_EFFECT_REPETITION_NOT_BORING,
CONTEST_EFFECT_AVOID_STARTLE_ONCE,
CONTEST_EFFECT_AVOID_STARTLE,
CONTEST_EFFECT_AVOID_STARTLE_SLIGHTLY,
CONTEST_EFFECT_USER_LESS_EASILY_STARTLED,
CONTEST_EFFECT_STARTLE_FRONT_MON,
CONTEST_EFFECT_SLIGHTLY_STARTLE_PREV_MONS,
CONTEST_EFFECT_STARTLE_PREV_MON,
CONTEST_EFFECT_STARTLE_PREV_MONS,
CONTEST_EFFECT_BADLY_STARTLE_FRONT_MON,
CONTEST_EFFECT_BADLY_STARTLE_PREV_MONS,
CONTEST_EFFECT_STARTLE_PREV_MON_2,
CONTEST_EFFECT_STARTLE_PREV_MONS_2,
CONTEST_EFFECT_SHIFT_JUDGE_ATTENTION,
CONTEST_EFFECT_STARTLE_MON_WITH_JUDGES_ATTENTION,
CONTEST_EFFECT_JAMS_OTHERS_BUT_MISS_ONE_TURN,
CONTEST_EFFECT_STARTLE_MONS_SAME_TYPE_APPEAL,
CONTEST_EFFECT_STARTLE_MONS_COOL_APPEAL,
CONTEST_EFFECT_STARTLE_MONS_BEAUTY_APPEAL,
CONTEST_EFFECT_STARTLE_MONS_CUTE_APPEAL,
CONTEST_EFFECT_STARTLE_MONS_SMART_APPEAL,
CONTEST_EFFECT_STARTLE_MONS_TOUGH_APPEAL,
CONTEST_EFFECT_MAKE_FOLLOWING_MON_NERVOUS,
CONTEST_EFFECT_MAKE_FOLLOWING_MONS_NERVOUS,
CONTEST_EFFECT_WORSEN_CONDITION_OF_PREV_MONS,
CONTEST_EFFECT_BADLY_STARTLES_MONS_IN_GOOD_CONDITION,
CONTEST_EFFECT_BETTER_IF_FIRST,
CONTEST_EFFECT_BETTER_IF_LAST,
CONTEST_EFFECT_APPEAL_AS_GOOD_AS_PREV_ONES,
CONTEST_EFFECT_APPEAL_AS_GOOD_AS_PREV_ONE,
CONTEST_EFFECT_BETTER_WHEN_LATER,
CONTEST_EFFECT_QUALITY_DEPENDS_ON_TIMING,
CONTEST_EFFECT_BETTER_IF_SAME_TYPE,
CONTEST_EFFECT_BETTER_IF_DIFF_TYPE,
CONTEST_EFFECT_AFFECTED_BY_PREV_APPEAL,
CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS,
CONTEST_EFFECT_BETTER_WITH_GOOD_CONDITION,
CONTEST_EFFECT_NEXT_APPEAL_EARLIER,
CONTEST_EFFECT_NEXT_APPEAL_LATER,
CONTEST_EFFECT_MAKE_SCRAMBLING_TURN_ORDER_EASIER,
CONTEST_EFFECT_SCRAMBLE_NEXT_TURN_ORDER,
CONTEST_EFFECT_EXCITE_AUDIENCE_IN_ANY_CONTEST,
CONTEST_EFFECT_BADLY_STARTLE_MONS_WITH_GOOD_APPEALS,
CONTEST_EFFECT_BETTER_WHEN_AUDIENCE_EXCITED,
CONTEST_EFFECT_DONT_EXCITE_AUDIENCE
};
struct ContestStruct_02039E00
enum
{
u16 unk_00;
u8 unk_02[11];
u8 unk_0d[8];
u8 filler_15[9];
u8 filler_1E[34];
COMBO_STARTER_RAIN_DANCE = 1,
COMBO_STARTER_RAGE,
COMBO_STARTER_FOCUS_ENERGY,
COMBO_STARTER_HYPNOSIS,
COMBO_STARTER_ENDURE,
COMBO_STARTER_HORN_ATTACK,
COMBO_STARTER_SWORDS_DANCE,
COMBO_STARTER_STOCKPILE,
COMBO_STARTER_SUNNY_DAY,
COMBO_STARTER_REST,
COMBO_STARTER_VICE_GRIP,
COMBO_STARTER_DEFENSE_CURL,
COMBO_STARTER_CHARGE,
COMBO_STARTER_ROCK_THROW,
COMBO_STARTER_YAWN,
COMBO_STARTER_SCARY_FACE,
COMBO_STARTER_POWDER_SNOW,
COMBO_STARTER_LOCK_ON,
COMBO_STARTER_SOFT_BOILED,
COMBO_STARTER_MEAN_LOOK,
COMBO_STARTER_SCRATCH,
COMBO_STARTER_GROWTH,
COMBO_STARTER_HAIL,
COMBO_STARTER_SANDSTORM,
COMBO_STARTER_BELLY_DRUM,
COMBO_STARTER_MIND_READER,
COMBO_STARTER_DRAGON_BREATH,
COMBO_STARTER_DRAGON_RAGE,
COMBO_STARTER_DRAGON_DANCE,
COMBO_STARTER_SURF,
COMBO_STARTER_DIVE,
COMBO_STARTER_STRING_SHOT,
COMBO_STARTER_LEER,
COMBO_STARTER_TAUNT,
COMBO_STARTER_CHARM,
COMBO_STARTER_HARDEN,
COMBO_STARTER_SING,
COMBO_STARTER_EARTHQUAKE,
COMBO_STARTER_DOUBLE_TEAM,
COMBO_STARTER_CURSE,
COMBO_STARTER_SWEET_SCENT,
COMBO_STARTER_SLUDGE,
COMBO_STARTER_SLUDGE_BOMB,
COMBO_STARTER_THUNDER_PUNCH,
COMBO_STARTER_FIRE_PUNCH,
COMBO_STARTER_ICE_PUNCH,
COMBO_STARTER_PECK,
COMBO_STARTER_METAL_SOUND,
COMBO_STARTER_MUD_SPORT,
COMBO_STARTER_WATER_SPORT,
COMBO_STARTER_BONE_CLUB,
COMBO_STARTER_BONEMERANG,
COMBO_STARTER_BONE_RUSH,
COMBO_STARTER_SAND_ATTACK,
COMBO_STARTER_MUD_SLAP,
COMBO_STARTER_FAKE_OUT,
COMBO_STARTER_PSYCHIC,
COMBO_STARTER_KINESIS,
COMBO_STARTER_CONFUSION,
COMBO_STARTER_POUND,
COMBO_STARTER_SMOG,
COMBO_STARTER_CALM_MIND
};
extern struct ContestStruct_02039E00 gUnknown_02039E00[4];
enum
{
CONTEST_STRING_MORE_CONSCIOUS,
CONTEST_STRING_NO_APPEAL,
CONTEST_STRING_SETTLE_DOWN,
CONTEST_STRING_OBLIVIOUS_TO_OTHERS,
CONTEST_STRING_LESS_AWARE,
CONTEST_STRING_STOPPED_CARING,
CONTEST_STRING_STARTLE_ATTEMPT,
CONTEST_STRING_DAZZLE_ATTEMPT,
CONTEST_STRING_JUDGE_LOOK_AWAY2,
CONTEST_STRING_UNNERVE_ATTEMPT,
CONTEST_STRING_NERVOUS,
CONTEST_STRING_UNNERVE_WAITING,
CONTEST_STRING_TAUNT_WELL,
CONTEST_STRING_REGAINED_FORM,
CONTEST_STRING_JAM_WELL,
CONTEST_STRING_HUSTLE_STANDOUT,
CONTEST_STRING_WORK_HARD_UNNOTICED,
CONTEST_STRING_WORK_BEFORE,
CONTEST_STRING_APPEAL_NOT_WELL,
CONTEST_STRING_WORK_PRECEDING,
CONTEST_STRING_APPEAL_NOT_WELL2,
CONTEST_STRING_APPEAL_NOT_SHOWN_WELL,
CONTEST_STRING_APPEAL_SLIGHTLY_WELL,
CONTEST_STRING_APPEAL_PRETTY_WELL,
CONTEST_STRING_APPEAL_EXCELLENTLY,
CONTEST_STRING_APPEAL_DUD,
CONTEST_STRING_APPEAL_NOT_VERY_WELL,
CONTEST_STRING_APPEAL_SLIGHTLY_WELL2,
CONTEST_STRING_APPEAL_PRETTY_WELL2,
CONTEST_STRING_APPEAL_VERY_WELL,
CONTEST_STRING_APPEAL_EXCELLENTLY2,
CONTEST_STRING_SAME_TYPE_GOOD,
CONTEST_STRING_DIFF_TYPE_GOOD,
CONTEST_STRING_STOOD_OUT_AS_MUCH,
CONTEST_STRING_NOT_AS_WELL,
CONTEST_STRING_CONDITION_ROSE,
CONTEST_STRING_HOT_STATUS,
CONTEST_STRING_MOVE_UP_LINE,
CONTEST_STRING_MOVE_BACK_LINE,
CONTEST_STRING_SCRAMBLE_ORDER,
CONTEST_STRING_JUDGE_EXPECTANTLY2,
CONTEST_STRING_WENT_OVER_WELL,
CONTEST_STRING_WENT_OVER_VERY_WELL,
CONTEST_STRING_APPEAL_COMBO_EXCELLENTLY,
CONTEST_STRING_AVERT_GAZE,
CONTEST_STRING_AVOID_SEEING,
CONTEST_STRING_NOT_FAZED,
CONTEST_STRING_LITTLE_DISTRACTED,
CONTEST_STRING_ATTEMPT_STARTLE,
CONTEST_STRING_LOOKED_DOWN,
CONTEST_STRING_TURNED_BACK,
CONTEST_STRING_UTTER_CRY,
CONTEST_STRING_LEAPT_UP,
CONTEST_STRING_TRIPPED_OVER,
CONTEST_STRING_MESSED_UP2,
CONTEST_STRING_FAILED_TARGET_NERVOUS,
CONTEST_STRING_FAILED_ANYONE_NERVOUS,
CONTEST_STRING_IGNORED,
CONTEST_STRING_NO_CONDITION_IMPROVE,
CONTEST_STRING_BAD_CONDITION_WEAK_APPEAL,
CONTEST_STRING_UNAFFECTED,
CONTEST_STRING_ATTRACTED_ATTENTION,
CONTEST_STRING_NONE = 255
};
struct ContestPokemon
{
/*0x00*/ u16 species;
/*0x02*/ u8 nickname[POKEMON_NAME_LENGTH + 1];
/*0x0D*/ u8 trainerName[8];
/*0x15*/ u8 trainerGfxId;
/*0x18*/ u32 flags;
/*0x1C*/ u8 whichRank:2;
u8 aiPool_Cool:1;
u8 aiPool_Beauty:1;
u8 aiPool_Cute:1;
u8 aiPool_Smart:1;
u8 aiPool_Tough:1;
/*0x1E*/ u16 moves[4]; // moves
/*0x26*/ u8 cool; // cool
/*0x27*/ u8 beauty; // beauty
/*0x28*/ u8 cute; // cute
/*0x29*/ u8 smart; // smart
/*0x2A*/ u8 tough; // tough
/*0x2B*/ u8 sheen; // sheen
/*0x2C*/ u8 unk2C[12];
/*0x38*/ u32 personality; // personality
/*0x3C*/ u32 otId; // otId
}; // wow
extern struct ContestPokemon gContestMons[4];
extern u8 gUnknown_02039F24;
extern u16 gSpecialVar_ContestCategory;
extern u8 gSpecialVar_ContestRank;
extern u16 gSpecialVar_ContestRank;
extern u8 gUnknown_02039F30;
struct Shared18000
{
/*0x18000*/ u8 unk18000;
/*0x18001*/ u8 filler18001[3];
/*0x18004*/ u16 unk18004[16][16];
/*0x18204*/ u16 unk18204[0x200];
/*0x18604*/ u16 unk18604[0x200];
/*0x18A04*/ u8 unk18A04[0x800];
};
struct ContestStruct_field_18
{
// unknown size
@ -43,19 +248,173 @@ struct ContestStruct_field_18
u32 field_10;
};
struct Contest
{
/*0x19204*/ u8 playerMoveChoice;
/*0x19205*/ u8 turnNumber;
/*0x19206*/ u8 unk19206[4]; // seems to only be used by an unref function
/*0x1920A*/ u16 unk1920A_0:1; // Task active flags?
u16 unk1920A_1:1;
u16 unk1920A_2:1;
u16 unk1920A_3:1;
u16 unk1920A_4:1;
u16 unk1920A_5:1;
u16 unk1920A_6:1;
u16 unk1920A_7:1;
/*0x1920B*/ u16 unk1920B_0:1;
u16 unk1920B_1:1;
u16 unk1920B_2:1;
/*0x1920C*/ u8 mainTaskId;
/*0x1920D*/ u8 unk1920D[4];
/*0x19211*/ u8 unk19211;
/*0x19212*/ u8 unk19212;
/*0x19213*/ u8 filler19213;
/*0x19214*/ u8 unk19214;
/*0x19215*/ u8 unk19215;
/*0x19216*/ u8 unk19216; // sprite ID
/*0x19217*/ s8 applauseLevel;
/*0x19218*/ u8 unk19218[4];
/*0x1921C*/ u32 unk1921C; // saved RNG value?
u16 unk19220[5][4]; // move history?
u8 unk19248[5][4]; // excitement history
u8 applauseMeterSpriteId; // sprite ID
/*0x1925D*/ u8 unk1925D;
/*0x1925E*/ u8 unk1925E;
};
struct ContestantStatus
{
/*0x00*/ s16 appeal1; // move appeal?
/*0x02*/ s16 appeal2; // final appeal after end of turn, maybe?
/*0x04*/ s16 unk4;
/*0x06*/ u16 currMove;
/*0x08*/ u16 prevMove;
/*0x0A*/ u8 moveCategory;
/*0x0B*/ u8 unkB_0:2;
u8 unkB_2:2;
u8 moveRepeatCount:3;
u8 noMoreTurns:1; // used a one-time move?
/*0x0C*/ u8 nervous:1;
u8 numTurnsSkipped:2;
/*0x0D*/ s8 condition;
/*0x0E*/ u8 jam;
/*0x0F*/ u8 jamReduction;
// Flags set by move effect
/*0x10*/ u8 resistant:1;
u8 immune:1;
u8 moreEasilyStartled:1;
u8 usedRepeatableMove:1;
u8 conditionMod:2; // 1: just raised condition; 2: appeal greatly improved by condition
u8 turnOrderMod:2; // 1: defined; 2: random
/*0x11*/ u8 turnOrderModAction:2; // 1: made first; 2: made last; 3: made random
u8 turnSkipped:1;
u8 exploded:1;
u8 overrideCategoryExcitementMod:1;
u8 appealTripleCondition:1;
/*0x12*/ u8 jamSafetyCount;
/*0x13*/ u8 effectStringId; // status action?
/*0x14*/ u8 effectStringId2;
/*0x15*/ u8 disappointedRepeat:1;
u8 unk15_1:1;
u8 unk15_2:1;
u8 unk15_3:1;
u8 hasJudgesAttention:1;
u8 judgesAttentionWasRemoved:1;
u8 unk15_6:1;
/*0x16*/ u8 unk16;
/*0x17*/ u8 unk17;
/*0x18*/ u8 unk18;
/*0x19*/ u8 nextTurnOrder; // turn position
/*0x1A*/ u8 attentionLevel; // How much the Pokemon "stood out"
/*0x1B*/ u8 unk1B;
};
struct UnknownContestStruct7
{
u8 turnOrder[4];
s16 jam;
s16 jam2;
u8 jamQueue[5];
u8 unnervedPokes[4];
u8 contestant;
};
struct ContestAIInfo {
/*0x00*/ u8 aiState;
/*0x02*/ u16 unk2;
/*0x04*/ u8 unk4;
/*0x05*/ u8 unk5[4];
/*0x09*/ u8 aiAction;
/*0x0A*/ u8 fillerA[0x6]; // TODO: don't know what's here
/*0x10*/ u8 unk10;
/*0x14*/ u32 flags;
/*0x18*/ s16 scriptResult;
/*0x1A*/ s16 scriptArr[3];
/*0x20*/ u32 stack[8];
/*0x40*/ u8 unk40;
/*0x41*/ u8 unk41;
};
struct UnknownContestStruct5
{
s8 bits_0; // current move excitement?
u8 excitementFrozen:1;
u8 excitementFreezer:3;
s8 unk2;
};
struct UnknownContestStruct4
{
u8 unk0; // sprite ID
u8 unk1; // sprite ID
u8 unk2_0:1;
u8 unk2_1:1;
u8 unk2_2:1;
};
struct ContestResourcesField1C
{
u8 filler_00[0x40];
};
struct ContestResourcesField20
{
u8 filler_00[0x0C];
};
struct ContestResources
{
void *field_0;
void *field_4;
void *field_8;
void *field_C;
void *field_10;
void *field_14;
struct Contest *field_0;
struct ContestantStatus *field_4;
struct UnknownContestStruct7 *field_8;
struct ContestAIInfo *field_C;
struct UnknownContestStruct5 *field_10;
struct UnknownContestStruct4 *field_14;
struct ContestStruct_field_18 *field_18;
struct ContestResourcesField1C * field_1c;
struct ContestResourcesField20 * field_20;
u8 * field_24[4];
void * field_34;
void * field_38;
void * field_3c;
};
extern struct ContestResources *gContestResources;
#define sContest (*gContestResources->field_0)
#define sContestantStatus (gContestResources->field_4)
#define shared192D0 (*gContestResources->field_8)
#define eContestAI (*gContestResources->field_C)
#define shared19328 (*gContestResources->field_10)
#define shared19338 (*gContestResources->field_14)
#define shared15800 (gHeap + 0x18000)
#define shared18000 (*(struct Shared18000 *)(gHeap + 0x1a000))
extern u32 gContestRngValue;
bool8 IsSpeciesNotUnown(u16 species);
void LoadContestBgAfterMoveAnim(void);

22
include/contest_effect.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef GUARD_CONTEST_EFFECT_H
#define GUARD_CONTEST_EFFECT_H
struct ContestMove
{
u8 effect;
u8 contestCategory:3;
u8 comboStarterId;
u8 comboMoves[4];
};
struct ContestEffect
{
u8 effectType;
u8 appeal;
u8 jam;
};
extern const struct ContestMove gContestMoves[];
extern struct ContestEffect gContestEffects[];
#endif //GUARD_CONTEST_EFFECT_H

View File

@ -4,5 +4,6 @@
void sub_80F840C(void);
void sub_80F8484(void);
void sub_80F84C4(u8);
void sub_80FC998(u8 taskId);
#endif // GUARD_CONTEST_LINK_80F57C4_H

View File

@ -0,0 +1,8 @@
#ifndef GUARD_CONTEST_LINK_80FC4F4_H
#define GUARD_CONTEST_LINK_80FC4F4_H
void sub_80FCC88(u8);
void sub_80FCC88(u8);
void sub_80FCACC(u8);
#endif //GUARD_CONTEST_LINK_80FC4F4_H

View File

@ -19,5 +19,6 @@ extern const u8 gMoveNames[][MOVE_NAME_LENGTH + 1];
extern struct CompressedSpriteSheet gUnknown_0831C620;
extern struct CompressedSpritePalette gUnknown_0831C628;
extern const struct SpriteTemplate gUnknown_0831C688;
extern const struct CompressedSpriteSheet gMonBackPicTable[];
#endif // GUARD_DATA2_H

View File

@ -146,6 +146,7 @@ u8 GetJumpInPlaceMovementAction(u32);
bool8 EventObjectSetHeldMovement(struct EventObject *eventObject, u8 specialAnimId);
bool8 EventObjectIsMovementOverridden(struct EventObject *eventObject);
u8 EventObjectCheckHeldMovementStatus(struct EventObject *eventObject);
u8 EventObjectGetHeldMovementActionId(struct EventObject *eventObject);
void TryOverrideTemplateCoordsForEventObject(const struct EventObject *eventObject, u8 movementType);
void OverrideTemplateCoordsForEventObject(const struct EventObject *eventObject);
void ShiftStillEventObjectCoords(struct EventObject *pObject);
@ -185,6 +186,7 @@ bool8 FreezeEventObject(struct EventObject *eventObject);
u8 GetMoveDirectionFastAnimNum(u8);
u8 GetMoveDirectionFasterAnimNum(u8);
u8 GetMoveDirectionFastestAnimNum(u8);
u8 GetLedgeJumpDirection(s16, s16, u8);
void CameraObjectSetFollowedObjectId(u8 objectId);
void MovementType_None(struct Sprite *);

View File

@ -394,6 +394,10 @@ extern const u8 Route111_EventScript_2907F0[];
extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_1F863F[];
extern const u8 LittlerootTown_MaysHouse_2F_EventScript_1F958F[];
//contest_strings
extern const u8 gText_0827D507[];
extern const u8 gText_0827D531[];
//mauville_old_man
extern const u8 gOtherText_Is[];
extern const u8 gOtherText_DontYouAgree[];

View File

@ -45,4 +45,22 @@ void SetPlayerAvatarStateMask(u8 a);
u8 GetPlayerAvatarGraphicsIdByStateId(u8 a);
u8 GetJumpSpecialMovementAction(u32);
bool8 ForcedMovement_None(void);
bool8 ForcedMovement_Slip(void);
bool8 ForcedMovement_WalkSouth(void);
bool8 ForcedMovement_WalkNorth(void);
bool8 ForcedMovement_WalkWest(void);
bool8 ForcedMovement_WalkEast(void);
bool8 ForcedMovement_PushedSouthByCurrent(void);
bool8 ForcedMovement_PushedNorthByCurrent(void);
bool8 ForcedMovement_PushedWestByCurrent(void);
bool8 ForcedMovement_PushedEastByCurrent(void);
bool8 ForcedMovement_SlideSouth(void);
bool8 ForcedMovement_SlideNorth(void);
bool8 ForcedMovement_SlideWest(void);
bool8 ForcedMovement_SlideEast(void);
bool8 ForcedMovement_0xBB(void);
bool8 ForcedMovement_0xBC(void);
bool8 ForcedMovement_MuddySlope(void);
#endif // GUARD_FIELD_PLAYER_AVATAR_H

View File

@ -28,6 +28,17 @@ typedef u8 bool8;
typedef u16 bool16;
typedef u32 bool32;
struct BgCnt
{
u16 priority:2;
u16 charBaseBlock:2;
u16 dummy:4;
u16 screenBaseBlock:5;
u16 areaOverflowMode:1;
u16 screenSize:2;
};
typedef volatile struct BgCnt vBgCnt;
struct PlttData
{
u16 r:5; // red

View File

@ -761,7 +761,7 @@ struct LilycoveLadyContest
/*0x00e*/ u8 language;
};
typedef union
typedef union // 3b58
{
struct LilycoveLadyQuiz quiz;
struct LilycoveLadyFavour favour;

View File

@ -91,7 +91,7 @@ typedef union // size = 0x24
/*0x0E*/ u8 pokemonNameLanguage;
/*0x0F*/ u8 filler_0F[1];
/*0x10*/ u8 nickname[8];
/*0x18*/ u8 filler_18[4];
/*0x18*/ u16 words18[2];
/*0x1C*/ u16 words[4];
} fanclubOpinions;
@ -99,7 +99,7 @@ typedef union // size = 0x24
struct {
/*0x00*/ u8 kind;
/*0x01*/ bool8 active;
/*0x02*/ u8 pad02[4];
/*0x02*/ u16 words[2];
/*0x06*/ u16 var06;
/*0x08*/ u8 pad_08[3];
/*0x0b*/ u8 string_0b[12];

View File

@ -301,5 +301,6 @@ void sub_8009FAC(void);
bool8 sub_800A4D8(u8 a0);
u8 sub_800A9D8(void);
u8 sub_800A0C8(s32, s32);
u16 *sub_801B058(void);
#endif // GUARD_LINK_H

View File

@ -2,5 +2,6 @@
#define GUARD_MAIN_MENU_H
void CB2_InitMainMenu(void);
void sub_80323CC(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f);
#endif // GUARD_MAIN_MENU_H

View File

@ -0,0 +1,16 @@
#ifndef GUARD_PC_SCREEN_EFFECT_H
#define GUARD_PC_SCREEN_EFFECT_H
struct PCScreenEffectStruct
{
/*0x00*/ u16 tileTag;
/*0x02*/ u16 paletteTag;
/*0x04*/ u16 unk04;
/*0x06*/ u16 unk06;
/*0x08*/ u16 unk08;
/*0x0A*/ u16 unk0A;
/*0x0C*/ s16 unk0C;
/*0x10*/ u32 selectedPalettes;
};
#endif //GUARD_PC_SCREEN_EFFECT_H

View File

@ -4,6 +4,78 @@
#define TOTAL_BOXES_COUNT 14
#define IN_BOX_COUNT 30
#include "pc_screen_effect.h"
#include "mon_markings.h"
struct PokemonStorageSystemFunc
{
u8 (*func)(void);
s8 unk4;
};
struct StorageAction
{
const u8 *text;
u8 format;
};
struct StorageText
{
const u8 *text;
int textId;
};
struct PSS_MenuStringPtrs
{
const u8 *text;
const u8 *desc;
};
struct UnkStruct_2000028
{
const u8 *unk_00;
u8 *unk_04;
u16 unk_08;
u16 unk_0a;
void (*unk_0c)(struct UnkStruct_2000028 *data);
};
struct UnkStruct_2000020
{
struct UnkStruct_2000028 *unk_00;
u8 unk_04;
u8 unk_05;
};
struct UnkPSSStruct_2002370
{
struct Sprite *unk_0000;
struct Sprite *unk_0004[4];
u32 unk_0014[3];
struct Sprite *unk_0020[2];
u8 filler_0028[0x214];
u32 unk_023c;
u16 unk_0240;
u16 unk_0242;
u8 curBox;
u8 unk_0245;
u8 unk_0246;
};
struct PokemonStorageSystemData
{
u8 state;
u8 boxOption;
u8 unk_0002;
u8 unk_0003;
u8 taskId;
u8 unk_0005[710];
u16 bg2_X;
};
extern struct UnkPSSStruct_2002370 *gUnknown_02039D04;
extern struct PokemonStorageSystemData *gUnknown_02039D08;
u8* GetBoxNamePtr(u8 boxNumber);
struct BoxPokemon *GetBoxedMonPtr(u8, u8);
void SetBoxMonNickFromAnyBox(u8, u8, u8 *);

View File

@ -4,5 +4,6 @@
void RotatingGatePuzzleCameraUpdate(s16, s16);
void RotatingGate_InitPuzzleAndGraphics();
u32 CheckForRotatingGatePuzzleCollision(u8, s16, s16);
bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8, s16, s16);
#endif // GUARD_ROTATING_GATE_H

View File

@ -0,0 +1,7 @@
#ifndef GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H
#define GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H
u16 sub_80F903C(void);
#endif // GUARD_SCRIPT_POKEMON_UTIL_80F87D8_H

View File

@ -1,6 +1,6 @@
#ifndef GUARD_SLOT_MACHINE_H
#define GUARD_SLOT_MACHINE_H
void PlaySlotMachine(u8, void *);
void PlaySlotMachine(u8, void (callback)(void));
#endif // GUARD_SLOT_MACHINE_H

View File

@ -451,6 +451,8 @@ extern const u8 gText_TooImportantToToss[];
extern const u8 gText_ConfirmTossItems[];
extern const u8 gText_MoveVar1Where[];
extern const u8 gText_ColorLightShadowDarkGrey[];
extern const u8 gText_ColorBlue[];
extern const u8 gText_Friend[];
extern const u8 gText_Tristan[];
extern const u8 gText_Philip[];
@ -461,6 +463,8 @@ extern const u8 gText_FiveMarks[];
extern const u8 gText_TotalRecordWLD[];
extern const u8 gText_PlayersBattleResults[];
extern const u8 gText_WinLoseDraw[];
extern const u8 gText_ColorTransparent[];
extern const u8 gText_Slash[];
extern const u8 gText_99TimesPlus[];
extern const u8 gText_1MinutePlus[];

View File

@ -47,6 +47,7 @@ void UpdateTVShowsPerDay(u16 days);
void PutPokemonTodayCaughtOnAir(void);
void TV_PutSecretBaseVisitOnTheAir(void);
void PutBattleUpdateOnTheAir(u8 opponentLinkPlayerId, u16 move, u16 speciesPlayer, u16 speciesOpponent);
void BravoTrainerPokemonProfile_BeforeInterview1(u16 move);
void UpdateTVScreensOnMap(int, int);
void TV_PrintIntToStringVar(u8 varIdx, int value);

View File

@ -92,6 +92,7 @@ SECTIONS {
src/metatile_behavior.o(.text);
src/field_camera.o(.text);
src/field_door.o(.text);
src/field_player_avatar.o(.text);
asm/field_player_avatar.o(.text);
src/event_object_movement.o(.text);
src/field_message_box.o(.text);
@ -135,6 +136,7 @@ SECTIONS {
src/item_menu_icons.o(.text);
asm/battle_anim_80D51AC.o(.text);
src/item.o(.text);
src/contest.o(.text);
asm/contest.o(.text);
asm/shop.o(.text);
src/berry.o(.text);
@ -157,6 +159,7 @@ SECTIONS {
src/item_use.o(.text);
asm/battle_anim_80FE840.o(.text);
src/bike.o(.text);
src/easy_chat.o(.text);
asm/easy_chat.o(.text);
src/mon_markings.o(.text);
src/mauville_old_man.o(.text);
@ -167,6 +170,7 @@ SECTIONS {
src/region_map.o(.text);
asm/cute_sketch.o(.text);
src/decoration.o(.text);
src/slot_machine.o(.text);
asm/slot_machine.o(.text);
asm/contest_painting.o(.text);
src/battle_ai_script_commands.o(.text);
@ -400,6 +404,7 @@ SECTIONS {
src/fieldmap.o(.rodata);
src/metatile_behavior.o(.rodata);
src/field_door.o(.rodata);
src/field_player_avatar.o(.rodata);
data/field_player_avatar.o(.rodata);
src/event_object_movement.o(.rodata);
src/text_window.o(.rodata);
@ -461,6 +466,7 @@ SECTIONS {
src/region_map.o(.rodata);
data/cute_sketch.o(.rodata);
src/decoration.o(.rodata);
src/slot_machine.o(.rodata);
data/slot_machine.o(.rodata);
data/contest_painting.o(.rodata);
src/battle_ai_script_commands.o(.rodata);

2761
src/contest.c Normal file

File diff suppressed because it is too large Load Diff

807
src/easy_chat.c Normal file
View File

@ -0,0 +1,807 @@
// Includes
#include "global.h"
#include "malloc.h"
#include "constants/songs.h"
#include "sound.h"
#include "overworld.h"
#include "task.h"
#include "main.h"
#include "link.h"
#include "field_weather.h"
#include "window.h"
#include "palette.h"
#include "event_data.h"
#include "easy_chat.h"
// Static type declarations
#define EZCHAT_TASK_STATE 0
#define EZCHAT_TASK_KIND 1
#define EZCHAT_TASK_WORDS 2
#define EZCHAT_TASK_MAINCALLBACK 4
#define EZCHAT_TASK_UNK06 6
#define EZCHAT_TASK_SIZE 7
// Static RAM declarations
EWRAM_DATA struct
{
u8 kind;
u8 unk_01;
u8 unk_02;
u8 unk_03;
u8 unk_04;
s8 unk_05;
s8 unk_06;
u8 unk_07;
u8 unk_08;
u8 unk_09;
u8 unk_0a;
u8 unk_0b;
u8 unk_0c;
u8 unk_0d;
u8 unk_0e[0x4];
u8 sizeParam;
u8 unk_13;
u8 unk_14[0x20];
const u8 *src;
const u16 *words;
u16 ecWordBuffer[9];
} *gUnknown_0203A118 = NULL;
// Static ROM declarations
static void sub_811A2C0(u8);
static void sub_811A278(void);
static bool8 sub_811A428(u8);
static void sub_811A2FC(u8);
static void sub_811A4D0(MainCallback);
static bool32 sub_811A88C(u16);
static void sub_811A8A4(u16);
void sub_811A8F0(void);
static bool8 EasyChat_AllocateResources(u8, u16 *, u8);
static void EasyChat_FreeResources(void);
static u16 sub_811AAAC(void);
static u16 sub_811AB68(void);
u16 sub_811ACDC(void);
u16 sub_811AE44(void);
u16 sub_811AF00(void);
u16 sub_811AF8C(void);
u16 sub_811AFEC(void);
u16 sub_811B040(void);
u16 sub_811B08C(void);
u16 sub_811B0BC(void);
u16 sub_811B0E8(void);
u16 sub_811B0F8(void);
u16 sub_811B150(void);
u16 sub_811B1B4(void);
u8 sub_811BA68(void);
u8 sub_811BCC8(u8);
void sub_811BDF0(u8 *);
void sub_811BF78(void);
bool8 sub_811BF8C(void);
bool8 sub_811BFA4(void);
void sub_811C13C(void);
/*static*/ void sub_811C158(u16);
/*static*/ bool8 sub_811C170(void);
bool8 sub_811F28C(void);
void sub_811F2B8(void);
u8 sub_811F3AC(void);
// .rodata
extern const struct {
u16 word;
MainCallback callback;
} gUnknown_08597530[4];
extern const struct {
u8 unk_00;
u8 unk_01;
u8 unk_02;
u8 unk_03;
u8 *data;
u8 filler_08[16];
} gUnknown_08597550[];
// .text
void sub_811A20C(u8 kind, u16 *words, MainCallback callback, u8 sizeParam)
{
u8 taskId;
ResetTasks();
taskId = CreateTask(sub_811A2C0, 0);
gTasks[taskId].data[EZCHAT_TASK_KIND] = kind;
gTasks[taskId].data[EZCHAT_TASK_SIZE] = sizeParam;
SetWordTaskArg(taskId, EZCHAT_TASK_WORDS, (u32)words);
SetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK, (u32)callback);
SetMainCallback2(sub_811A278);
}
static void sub_811A278(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
static void sub_811A290(void)
{
TransferPlttBuffer();
LoadOam();
ProcessSpriteCopyRequests();
}
static void sub_811A2A4(u8 taskId, TaskFunc taskFunc)
{
gTasks[taskId].func = taskFunc;
gTasks[taskId].data[EZCHAT_TASK_STATE] = 0;
}
static void sub_811A2C0(u8 taskId)
{
if (!is_c1_link_related_active())
{
while (sub_811A428(taskId));
}
else
{
if (sub_811A428(taskId) == TRUE)
{
return;
}
}
sub_811A2A4(taskId, sub_811A2FC);
}
static void sub_811A2FC(u8 taskId)
{
u16 v0;
s16 *data;
data = gTasks[taskId].data;
switch (data[EZCHAT_TASK_STATE])
{
case 0:
SetVBlankCallback(sub_811A290);
BlendPalettes(0xFFFFFFFF, 16, 0);
BeginNormalPaletteFade(-1, -1, 16, 0, 0);
data[EZCHAT_TASK_STATE] = 5;
break;
case 1:
v0 = sub_811AAAC();
if (sub_811A88C(v0))
{
BeginNormalPaletteFade(-1, -2, 0, 16, 0);
data[EZCHAT_TASK_STATE] = 3;
data[EZCHAT_TASK_UNK06] = v0;
}
else if (v0 == 0x18)
{
BeginNormalPaletteFade(-1, -1, 0, 16, 0);
data[EZCHAT_TASK_STATE] = 4;
}
else if (v0 != 0)
{
PlaySE(SE_SELECT);
sub_811C158(v0);
data[EZCHAT_TASK_STATE] ++;
}
break;
case 2:
if (!sub_811C170())
{
data[EZCHAT_TASK_STATE] = 1;
}
break;
case 3:
if (!gPaletteFade.active)
{
sub_811A8A4(data[EZCHAT_TASK_UNK06]);
}
break;
case 4:
if (!gPaletteFade.active)
{
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
break;
case 5:
if (!gPaletteFade.active)
{
data[EZCHAT_TASK_STATE] = 1;
}
break;
}
}
static bool8 sub_811A428(u8 taskId)
{
s16 *data;
data = gTasks[taskId].data;
switch (data[EZCHAT_TASK_STATE])
{
case 0:
SetVBlankCallback(NULL);
ResetSpriteData();
FreeAllSpritePalettes();
ResetPaletteFade();
break;
case 1:
if (!sub_811F28C())
{
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
break;
case 2:
if (!EasyChat_AllocateResources(data[EZCHAT_TASK_KIND], (u16 *)GetWordTaskArg(taskId, EZCHAT_TASK_WORDS), data[EZCHAT_TASK_SIZE]))
{
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
break;
case 3:
if (!sub_811BF8C())
{
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
break;
case 4:
if (sub_811BFA4())
{
return TRUE;
}
break;
default:
return FALSE;
}
data[EZCHAT_TASK_STATE] ++;
return TRUE;
}
static void sub_811A4D0(MainCallback callback)
{
sub_811C13C();
EasyChat_FreeResources();
sub_811F2B8();
FreeAllWindowBuffers();
SetMainCallback2(callback);
}
void easy_chat_input_maybe(void)
{
int i;
u16 *words;
struct MauvilleManBard *bard;
u8 sizeParam = 3;
switch (gSpecialVar_0x8004)
{
case 0:
words = gSaveBlock1Ptr->unk2BB0;
break;
case 1:
words = gSaveBlock1Ptr->unk2BBC;
break;
case 2:
words = gSaveBlock1Ptr->unk2BC8;
break;
case 3:
words = gSaveBlock1Ptr->unk2BD4;
break;
case 4:
words = gSaveBlock1Ptr->mail[gSpecialVar_0x8005].words;
break;
case 6:
bard = &gSaveBlock1Ptr->oldMan.bard;
for (i = 0; i < 6; i ++)
{
bard->temporaryLyrics[i] = bard->songLyrics[i];
}
words = bard->temporaryLyrics;
break;
case 5:
words = gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].bravoTrainer.words;
sizeParam = gSpecialVar_0x8006;
break;
case 7:
words = &gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].fanclubOpinions.words[gSpecialVar_0x8006];
sizeParam = 1;
break;
case 8:
words = gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].unkShow04.words;
sizeParam = 0;
break;
case 9:
words = (u16 *)gStringVar3;
words[0] = gSaveBlock1Ptr->easyChatPairs[0].words[0];
words[1] = gSaveBlock1Ptr->easyChatPairs[0].words[1];
break;
case 10:
words = gSaveBlock1Ptr->gabbyAndTyData.quote;
*words = -1;
sizeParam = 1;
break;
case 11:
words = &gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].bravoTrainer.words[gSpecialVar_0x8006];
sizeParam = 0;
break;
case 12:
words = gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].fanclubOpinions.words18;
sizeParam = 1;
break;
case 13:
words = (u16 *)gStringVar3;
InitializeEasyChatWordArray(words, 2);
break;
case 14:
words = gSaveBlock1Ptr->tvShows[gSpecialVar_0x8005].fanClubSpecial.words;
words[0] = -1;
sizeParam = 2;
break;
case 15:
words = &gSaveBlock1Ptr->lilycoveLady.quiz.unk_016;
break;
case 16:
return;
case 17:
words = gSaveBlock1Ptr->lilycoveLady.quiz.unk_002;
break;
case 18:
words = &gSaveBlock1Ptr->lilycoveLady.quiz.unk_014;
break;
case 19:
words = (u16 *)&gSaveBlock2Ptr->field_DC[0].field_0[0x28];
break;
case 20:
words = sub_801B058();
break;
default:
return;
}
overworld_free_bg_tilemaps();
sub_811A20C(gSpecialVar_0x8004, words, CB2_ReturnToFieldContinueScript, sizeParam);
}
static void sub_811A7E4(void)
{
LilycoveLady *lilycoveLady;
UpdatePaletteFade();
switch (gMain.state)
{
case 0:
FadeScreen(1, 0);
break;
case 1:
if (!gPaletteFade.active)
{
lilycoveLady = &gSaveBlock1Ptr->lilycoveLady;
lilycoveLady->quiz.unk_016 = -1;
overworld_free_bg_tilemaps();
sub_811A8F0();
}
return;
}
gMain.state ++;
}
void sub_811A858(void)
{
SetMainCallback2(sub_811A7E4);
}
static int sub_811A868(u16 word)
{
int i;
for (i = 0; i < ARRAY_COUNT(gUnknown_08597530); i ++)
{
if (word == gUnknown_08597530[i].word)
return i;
}
return -1;
}
static bool32 sub_811A88C(u16 word)
{
return sub_811A868(word) == -1 ? FALSE : TRUE;
}
static void sub_811A8A4(u16 word)
{
int i;
i = sub_811A868(word);
ResetTasks();
sub_811A4D0(gUnknown_08597530[i].callback);
}
void sub_811A8CC(void)
{
sub_811A20C(0xF, &gSaveBlock1Ptr->lilycoveLady.quiz.unk_016, CB2_ReturnToFieldContinueScript, 3);
}
void sub_811A8F0(void)
{
sub_811A20C(0x10, gSaveBlock1Ptr->lilycoveLady.quiz.unk_002, CB2_ReturnToFieldContinueScript, 3);
}
void sub_811A914(void)
{
sub_811A20C(0x12, &gSaveBlock1Ptr->lilycoveLady.quiz.unk_014, CB2_ReturnToFieldContinueScript, 3);
}
void sub_811A938(void)
{
sub_811A20C(0x11, gSaveBlock1Ptr->lilycoveLady.quiz.unk_002, CB2_ReturnToFieldContinueScript, 3);
}
static bool8 EasyChat_AllocateResources(u8 kind, u16 *words, u8 sizeParam)
{
u8 r6;
int i;
gUnknown_0203A118 = malloc(sizeof(*gUnknown_0203A118));
if (gUnknown_0203A118 == NULL)
{
return FALSE;
}
gUnknown_0203A118->kind = kind;
gUnknown_0203A118->words = words;
gUnknown_0203A118->unk_05 = 0;
gUnknown_0203A118->unk_06 = 0;
gUnknown_0203A118->unk_09 = 0;
gUnknown_0203A118->sizeParam = sizeParam;
gUnknown_0203A118->unk_13 = 0;
r6 = sub_811BCC8(kind);
if (kind == 0x10)
{
sub_811BDF0(gUnknown_0203A118->unk_14);
gUnknown_0203A118->src = gUnknown_0203A118->unk_14;
gUnknown_0203A118->unk_04 = 7;
}
else
{
gUnknown_0203A118->unk_04 = 0;
gUnknown_0203A118->src = gUnknown_08597550[r6].data;
}
gUnknown_0203A118->unk_02 = gUnknown_08597550[r6].unk_01;
gUnknown_0203A118->unk_03 = gUnknown_08597550[r6].unk_02;
gUnknown_0203A118->unk_07 = gUnknown_0203A118->unk_02 * gUnknown_0203A118->unk_03;
gUnknown_0203A118->unk_01 = r6;
if (gUnknown_0203A118->unk_07 > 9)
{
gUnknown_0203A118->unk_07 = 9;
}
if (words != NULL)
{
CpuCopy16(words, gUnknown_0203A118->ecWordBuffer, gUnknown_0203A118->unk_07 * sizeof(u16));
}
else
{
for (i = 0; i < gUnknown_0203A118->unk_07; i ++)
{
gUnknown_0203A118->ecWordBuffer[i] = -1;
}
gUnknown_0203A118->words = gUnknown_0203A118->ecWordBuffer;
}
gUnknown_0203A118->unk_0d = (sub_811F3AC() - 1) / 2 + 1;
return TRUE;
}
static void EasyChat_FreeResources(void)
{
if (gUnknown_0203A118 != NULL)
FREE_AND_SET_NULL(gUnknown_0203A118);
}
static u16 sub_811AAAC(void)
{
switch (gUnknown_0203A118->unk_04)
{
case 0:
return sub_811AB68();
case 1:
return sub_811ACDC();
case 2:
return sub_811AE44();
case 3:
return sub_811AF00();
case 4:
return sub_811AF8C();
case 5:
return sub_811B040();
case 6:
return sub_811AFEC();
case 7:
return sub_811B08C();
case 8:
return sub_811B0BC();
case 9:
return sub_811B0E8();
case 10:
return sub_811B0F8();
}
return 0;
}
bool32 sub_811AB44(void)
{
switch (sub_811BA68())
{
case 2:
case 7:
case 8:
return TRUE;
}
return FALSE;
}
#ifdef NONMATCHING
static u16 sub_811AB68(void)
{
if (gMain.newKeys & A_BUTTON)
{
sub_811BF78();
gUnknown_0203A118->unk_04 = 2;
gUnknown_0203A118->unk_0a = 0;
gUnknown_0203A118->unk_0b = 0;
gUnknown_0203A118->unk_0c = 0;
return 9;
}
else if (gMain.newKeys & B_BUTTON)
{ // FIXME: See note below
return sub_811B150();
}
else if (gMain.newKeys & START_BUTTON)
{ // FIXME: See note below
return sub_811B1B4();
}
else if (gMain.newKeys & DPAD_UP)
{
gUnknown_0203A118->unk_06--;
}
else if (gMain.newKeys & DPAD_LEFT)
{ // FIXME: See note below
gUnknown_0203A118->unk_05--;
}
else if (gMain.newKeys & DPAD_DOWN)
{ // FIXME: See note below
gUnknown_0203A118->unk_06++;
}
else if (gMain.newKeys & DPAD_RIGHT)
{ // FIXME: See note below
gUnknown_0203A118->unk_05++;
}
else
{
return 0;
}
if (gUnknown_0203A118->unk_06 < 0)
{
gUnknown_0203A118->unk_06 = gUnknown_08597550[gUnknown_0203A118->unk_01].unk_02;
}
if (gUnknown_0203A118->unk_06 > gUnknown_08597550[gUnknown_0203A118->unk_01].unk_02)
{
gUnknown_0203A118->unk_06 = 0;
}
if (gUnknown_0203A118->unk_06 == gUnknown_08597550[gUnknown_0203A118->unk_01].unk_02)
{
if (gUnknown_0203A118->unk_05 > 2)
{
gUnknown_0203A118->unk_05 = 2;
}
gUnknown_0203A118->unk_04 = 1;
return 3;
}
/*
* FIXME: right, down, left, b, and start
* should be inserted here, but aren't
*/
if (gUnknown_0203A118->unk_05 < 0)
{
gUnknown_0203A118->unk_05 = gUnknown_08597550[gUnknown_0203A118->unk_01].unk_01 - 1;
}
if (gUnknown_0203A118->unk_05 >= gUnknown_08597550[gUnknown_0203A118->unk_01].unk_01)
{
gUnknown_0203A118->unk_05 = 0;
}
if (sub_811AB44() && gUnknown_0203A118->unk_05 == 1 && gUnknown_0203A118->unk_06 == 4)
{
gUnknown_0203A118->unk_05 = 0;
}
return 2;
}
#else
__attribute__((naked)) static u16 sub_811AB68(void)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tldr r0, =gMain\n"
"\tldrh r1, [r0, 0x2E]\n"
"\tmovs r0, 0x1\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbeq _0811ABB8\n"
"\tbl sub_811BF78\n"
"\tldr r1, =gUnknown_0203A118\n"
"\tldr r3, [r1]\n"
"\tmovs r2, 0\n"
"\tmovs r0, 0x2\n"
"\tstrb r0, [r3, 0x4]\n"
"\tldr r0, [r1]\n"
"\tstrb r2, [r0, 0xA]\n"
"\tldr r0, [r1]\n"
"\tstrb r2, [r0, 0xB]\n"
"\tldr r0, [r1]\n"
"\tstrb r2, [r0, 0xC]\n"
"\tmovs r0, 0x9\n"
"\tb _0811ACCC_return_r0\n"
"\t.pool\n"
"_0811AB9C:\n"
"\tmovs r0, 0x20\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbne _0811AC68_dpad_left\n"
"\tmovs r0, 0x80\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbne _0811AC58_dpad_down\n"
"\tmovs r0, 0x10\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbne _0811AC48_dpad_right\n"
"\tmovs r0, 0\n"
"\tb _0811ACCC_return_r0\n"
"_0811ABB8:\n"
"\tmovs r0, 0x2\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbne _0811AC78_b_button\n"
"\tmovs r0, 0x8\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbne _0811AC7E_start_button\n"
"\tmovs r0, 0x40\n"
"\tands r0, r1\n"
"\tcmp r0, 0\n"
"\tbeq _0811AB9C\n"
"\tldr r2, =gUnknown_0203A118\n"
"\tldr r1, [r2]\n"
"\tldrb r0, [r1, 0x6]\n"
"\tsubs r0, 0x1\n"
"_0811ABD8:\n"
"\tstrb r0, [r1, 0x6]\n"
"_0811ABDA:\n"
"\tadds r7, r2, 0\n"
"\tadds r4, r7, 0\n"
"\tldr r2, [r4]\n"
"\tmovs r0, 0x6\n"
"\tldrsb r0, [r2, r0]\n"
"\tldr r6, =gUnknown_08597550\n"
"\tcmp r0, 0\n"
"\tbge _0811ABF8\n"
"\tldrb r0, [r2, 0x1]\n"
"\tlsls r1, r0, 1\n"
"\tadds r1, r0\n"
"\tlsls r1, 3\n"
"\tadds r1, r6\n"
"\tldrb r0, [r1, 0x2]\n"
"\tstrb r0, [r2, 0x6]\n"
"_0811ABF8:\n"
"\tldr r3, [r4]\n"
"\tmovs r2, 0x6\n"
"\tldrsb r2, [r3, r2]\n"
"\tadds r5, r6, 0\n"
"\tldrb r1, [r3, 0x1]\n"
"\tlsls r0, r1, 1\n"
"\tadds r0, r1\n"
"\tlsls r0, 3\n"
"\tadds r0, r5\n"
"\tldrb r0, [r0, 0x2]\n"
"\tcmp r2, r0\n"
"\tble _0811AC14\n"
"\tmovs r0, 0\n"
"\tstrb r0, [r3, 0x6]\n"
"_0811AC14:\n"
"\tldr r3, [r4]\n"
"\tmovs r2, 0x6\n"
"\tldrsb r2, [r3, r2]\n"
"\tldrb r1, [r3, 0x1]\n"
"\tlsls r0, r1, 1\n"
"\tadds r0, r1\n"
"\tlsls r0, 3\n"
"\tadds r1, r0, r5\n"
"\tldrb r0, [r1, 0x2]\n"
"\tcmp r2, r0\n"
"\tbne _0811AC88\n"
"\tmovs r0, 0x5\n"
"\tldrsb r0, [r3, r0]\n"
"\tcmp r0, 0x2\n"
"\tble _0811AC36\n"
"\tmovs r0, 0x2\n"
"\tstrb r0, [r3, 0x5]\n"
"_0811AC36:\n"
"\tldr r1, [r4]\n"
"\tmovs r0, 0x1\n"
"\tstrb r0, [r1, 0x4]\n"
"\tmovs r0, 0x3\n"
"\tb _0811ACCC_return_r0\n"
"\t.pool\n"
"_0811AC48_dpad_right:\n"
"\tldr r2, =gUnknown_0203A118\n"
"\tldr r1, [r2]\n"
"\tldrb r0, [r1, 0x5]\n"
"\tadds r0, 0x1\n"
"\tstrb r0, [r1, 0x5]\n"
"\tb _0811ABDA\n"
"\t.pool\n"
"_0811AC58_dpad_down:\n"
"\tldr r2, =gUnknown_0203A118\n"
"\tldr r1, [r2]\n"
"\tldrb r0, [r1, 0x6]\n"
"\tadds r0, 0x1\n"
"\tb _0811ABD8\n"
"\t.pool\n"
"_0811AC68_dpad_left:\n"
"\tldr r2, =gUnknown_0203A118\n"
"\tldr r1, [r2]\n"
"\tldrb r0, [r1, 0x5]\n"
"\tsubs r0, 0x1\n"
"\tstrb r0, [r1, 0x5]\n"
"\tb _0811ABDA\n"
"\t.pool\n"
"_0811AC78_b_button:\n"
"\tbl sub_811B150\n"
"\tb _0811AC82\n"
"_0811AC7E_start_button:\n"
"\tbl sub_811B1B4\n"
"_0811AC82:\n"
"\tlsls r0, 16\n"
"\tlsrs r0, 16\n"
"\tb _0811ACCC_return_r0\n"
"_0811AC88:\n"
"\tmovs r0, 0x5\n"
"\tldrsb r0, [r3, r0]\n"
"\tcmp r0, 0\n"
"\tbge _0811AC96\n"
"\tldrb r0, [r1, 0x1]\n"
"\tsubs r0, 0x1\n"
"\tstrb r0, [r3, 0x5]\n"
"_0811AC96:\n"
"\tldr r3, [r4]\n"
"\tmovs r2, 0x5\n"
"\tldrsb r2, [r3, r2]\n"
"\tldrb r1, [r3, 0x1]\n"
"\tlsls r0, r1, 1\n"
"\tadds r0, r1\n"
"\tlsls r0, 3\n"
"\tadds r0, r6\n"
"\tldrb r0, [r0, 0x1]\n"
"\tcmp r2, r0\n"
"\tblt _0811ACB0\n"
"\tmovs r0, 0\n"
"\tstrb r0, [r3, 0x5]\n"
"_0811ACB0:\n"
"\tbl sub_811AB44\n"
"\tcmp r0, 0\n"
"\tbeq _0811ACCA\n"
"\tldr r2, [r7]\n"
"\tldr r0, [r2, 0x4]\n"
"\tldr r1, =0x00ffff00\n"
"\tands r0, r1\n"
"\tldr r1, =0x00040100\n"
"\tcmp r0, r1\n"
"\tbne _0811ACCA\n"
"\tmovs r0, 0\n"
"\tstrb r0, [r2, 0x5]\n"
"_0811ACCA:\n"
"\tmovs r0, 0x2\n"
"_0811ACCC_return_r0:\n"
"\tpop {r4-r7}\n"
"\tpop {r1}\n"
"\tbx r1\n"
"\t.pool");
}
#endif

581
src/field_player_avatar.c Normal file
View File

@ -0,0 +1,581 @@
#include "global.h"
#include "global.fieldmap.h"
#include "sprite.h"
#include "event_object_movement.h"
#include "bike.h"
#include "metatile_behavior.h"
#include "metatile_behaviors.h"
#include "constants/flags.h"
#include "event_data.h"
#include "fieldmap.h"
#include "overworld.h"
#include "rotating_gate.h"
#include "constants/event_object_movement_constants.h"
#include "field_player_avatar.h"
extern void task_add_bump_boulder(u8, u8);
static bool8 ShouldJumpLedge(s16, s16, u8);
static bool8 sub_808B1BC(s16, s16, u8);
static u8 sub_808B164(struct EventObject *, s16, s16, u8, u8);
static u8 sub_808B238(s16, s16, u8);
static void check_acro_bike_metatile(s16, s16, u8, u8 *);
extern void PlayerNotOnBikeCollide(u8);
extern void PlayerNotOnBikeCollideWithFarawayIslandMew(u8);
extern void PlayerRun(u8);
static void MovePlayerNotOnBike(u8, u16);
static u8 CheckMovementInputNotOnBike(u8);
extern void sub_808C5B0(void);
extern void sub_808C4D8(void);
static u8 CheckForPlayerAvatarCollision(u8);
static u8 EventObjectCB2_NoMovement2();
extern void sub_808C280(struct EventObject *);
static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8);
void npc_clear_strange_bits(struct EventObject *);
extern void DoPlayerAvatarTransition(void);
static bool8 TryDoMetatileBehaviorForcedMovement();
static void MovePlayerAvatarUsingKeypadInput(u8, u16, u16);
static void PlayerAllowForcedMovementIfMovingSameDirection();
static u8 sub_808B028(u8);
static u8 GetForcedMovementByMetatileBehavior();
static void PlayerNotOnBikeNotMoving(u8, u16);
static void PlayerNotOnBikeTurningInPlace(u8, u16);
static void PlayerNotOnBikeMoving(u8, u16);
extern void sub_808C750(u8);
static bool8 (*const gUnknown_084973FC[])(u8) =
{
MetatileBehavior_IsTrickHouseSlipperyFloor,
MetatileBehavior_IsIce_2,
MetatileBehavior_IsWalkSouth,
MetatileBehavior_IsWalkNorth,
MetatileBehavior_IsWalkWest,
MetatileBehavior_IsWalkEast,
MetatileBehavior_IsSouthwardCurrent,
MetatileBehavior_IsNorthwardCurrent,
MetatileBehavior_IsWestwardCurrent,
MetatileBehavior_IsEastwardCurrent,
MetatileBehavior_IsSlideSouth,
MetatileBehavior_IsSlideNorth,
MetatileBehavior_IsSlideWest,
MetatileBehavior_IsSlideEast,
MetatileBehavior_IsWaterfall,
MetatileBehavior_IsSecretBaseJumpMat,
MetatileBehavior_IsSecretBaseSpinMat,
MetatileBehavior_IsMuddySlope,
};
static bool8 (*const gUnknown_08497444[])(void) =
{
ForcedMovement_None,
ForcedMovement_Slip,
ForcedMovement_Slip,
ForcedMovement_WalkSouth,
ForcedMovement_WalkNorth,
ForcedMovement_WalkWest,
ForcedMovement_WalkEast,
ForcedMovement_PushedSouthByCurrent,
ForcedMovement_PushedNorthByCurrent,
ForcedMovement_PushedWestByCurrent,
ForcedMovement_PushedEastByCurrent,
ForcedMovement_SlideSouth,
ForcedMovement_SlideNorth,
ForcedMovement_SlideWest,
ForcedMovement_SlideEast,
ForcedMovement_PushedSouthByCurrent,
ForcedMovement_0xBB,
ForcedMovement_0xBC,
ForcedMovement_MuddySlope,
};
static void (*const gUnknown_08497490[])(u8, u16) =
{
PlayerNotOnBikeNotMoving,
PlayerNotOnBikeTurningInPlace,
PlayerNotOnBikeMoving,
};
static bool8 (*const gUnknown_0849749C[])(u8) =
{
MetatileBehavior_IsBumpySlope,
MetatileBehavior_IsIsolatedVerticalRail,
MetatileBehavior_IsIsolatedHorizontalRail,
MetatileBehavior_IsVerticalRail,
MetatileBehavior_IsHorizontalRail,
};
static const u8 gUnknown_084974B0[] = {9, 10, 11, 12, 13, 0, 0, 0};
void MovementType_Player(struct Sprite *sprite)
{
UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2);
}
static u8 EventObjectCB2_NoMovement2()
{
return 0;
}
void player_step(u8 direction, u16 newKeys, u16 heldKeys)
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
sub_808C280(playerEventObj);
if (gPlayerAvatar.preventStep == FALSE)
{
Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys);
if (TryInterruptEventObjectSpecialAnim(playerEventObj, direction) == 0)
{
npc_clear_strange_bits(playerEventObj);
DoPlayerAvatarTransition();
if (TryDoMetatileBehaviorForcedMovement() == 0)
{
MovePlayerAvatarUsingKeypadInput(direction, newKeys, heldKeys);
PlayerAllowForcedMovementIfMovingSameDirection();
}
}
}
}
static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventObj, u8 direction)
{
#ifdef NONMATCHING
u8 r5 = direction;
u8 r6 = direction;
#else
u8 r5 = direction;
register u8 r6 asm("r6") = direction;
#endif
//a very bad HACK
if (EventObjectIsMovementOverridden(playerEventObj)
&& !EventObjectClearHeldMovementIfFinished(playerEventObj))
{
u8 heldMovementActionId = EventObjectGetHeldMovementActionId(playerEventObj);
if (heldMovementActionId > MOVEMENT_ACTION_WALK_FAST_RIGHT && heldMovementActionId < MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN)
{
if (direction == DIR_NONE)
{
return TRUE;
}
if (playerEventObj->movementDirection != r5)
{
EventObjectClearHeldMovement(playerEventObj);
return FALSE;
}
if (!sub_808B028(r6))
{
EventObjectClearHeldMovement(playerEventObj);
return FALSE;
}
}
return TRUE;
}
return FALSE;
}
void npc_clear_strange_bits(struct EventObject *eventObj)
{
eventObj->inanimate = 0;
eventObj->disableAnim = 0;
eventObj->facingDirectionLocked = 0;
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH;
}
static void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys)
{
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE)
|| (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE))
MovePlayerOnBike(direction, newKeys, heldKeys);
else
MovePlayerNotOnBike(direction, heldKeys);
}
static void PlayerAllowForcedMovementIfMovingSameDirection(void)
{
if (gPlayerAvatar.runningState == MOVING)
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5;
}
static bool8 TryDoMetatileBehaviorForcedMovement()
{
return gUnknown_08497444[GetForcedMovementByMetatileBehavior()]();
}
static u8 GetForcedMovementByMetatileBehavior(void)
{
u8 i;
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_5))
{
u8 metatileBehavior = gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior;
for (i = 0; i < 18; i++)
{
if (gUnknown_084973FC[i](metatileBehavior))
return i + 1;
}
}
return 0;
}
bool8 ForcedMovement_None(void)
{
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6)
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
playerEventObj->facingDirectionLocked = 0;
playerEventObj->enableAnim = 1;
SetEventObjectDirection(playerEventObj, playerEventObj->facingDirection);
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_6;
}
return FALSE;
}
static u8 DoForcedMovement(u8 direction, void (*b)(u8))
{
struct PlayerAvatar *playerAvatar = &gPlayerAvatar;
u8 collisionType = CheckForPlayerAvatarCollision(direction);
playerAvatar->flags |= PLAYER_AVATAR_FLAG_6;
if (collisionType != 0)
{
ForcedMovement_None();
if (collisionType <= 4)
{
return 0;
}
else
{
if (collisionType == COLLISION_LEDGE_JUMP)
PlayerJumpLedge(direction);
playerAvatar->flags |= PLAYER_AVATAR_FLAG_6;
playerAvatar->runningState = MOVING;
return 1;
}
}
else
{
playerAvatar->runningState = MOVING;
b(direction);
return 1;
}
}
u8 DoForcedMovementInCurrentDirection(void (*a)(u8))
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
playerEventObj->disableAnim = 1;
return DoForcedMovement(playerEventObj->movementDirection, a);
}
bool8 ForcedMovement_Slip(void)
{
return DoForcedMovementInCurrentDirection(PlayerGoSpeed2);
}
bool8 ForcedMovement_WalkSouth(void)
{
return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed1);
}
bool8 ForcedMovement_WalkNorth(void)
{
return DoForcedMovement(DIR_NORTH, PlayerGoSpeed1);
}
bool8 ForcedMovement_WalkWest(void)
{
return DoForcedMovement(DIR_WEST, PlayerGoSpeed1);
}
bool8 ForcedMovement_WalkEast(void)
{
return DoForcedMovement(DIR_EAST, PlayerGoSpeed1);
}
bool8 ForcedMovement_PushedSouthByCurrent(void)
{
return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed3);
}
bool8 ForcedMovement_PushedNorthByCurrent(void)
{
return DoForcedMovement(DIR_NORTH, PlayerGoSpeed3);
}
bool8 ForcedMovement_PushedWestByCurrent(void)
{
return DoForcedMovement(DIR_WEST, PlayerGoSpeed3);
}
bool8 ForcedMovement_PushedEastByCurrent(void)
{
return DoForcedMovement(DIR_EAST, PlayerGoSpeed3);
}
u8 ForcedMovement_Slide(u8 direction, void (*b)(u8))
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
playerEventObj->disableAnim = 1;
playerEventObj->facingDirectionLocked = 1;
return DoForcedMovement(direction, b);
}
bool8 ForcedMovement_SlideSouth(void)
{
return ForcedMovement_Slide(DIR_SOUTH, PlayerGoSpeed2);
}
bool8 ForcedMovement_SlideNorth(void)
{
return ForcedMovement_Slide(DIR_NORTH, PlayerGoSpeed2);
}
bool8 ForcedMovement_SlideWest(void)
{
return ForcedMovement_Slide(DIR_WEST, PlayerGoSpeed2);
}
bool8 ForcedMovement_SlideEast(void)
{
return ForcedMovement_Slide(DIR_EAST, PlayerGoSpeed2);
}
bool8 ForcedMovement_0xBB(void)
{
sub_808C4D8();
return TRUE;
}
bool8 ForcedMovement_0xBC(void)
{
sub_808C5B0();
return TRUE;
}
bool8 ForcedMovement_MuddySlope(void)
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
if (playerEventObj->movementDirection != DIR_NORTH || GetPlayerSpeed() <= 3)
{
Bike_UpdateBikeCounterSpeed(0);
playerEventObj->facingDirectionLocked = 1;
return DoForcedMovement(1, PlayerGoSpeed2);
}
else
{
return FALSE;
}
}
static void MovePlayerNotOnBike(u8 direction, u16 heldKeys)
{
gUnknown_08497490[CheckMovementInputNotOnBike(direction)](direction, heldKeys);
}
static u8 CheckMovementInputNotOnBike(u8 direction)
{
if (direction == DIR_NONE)
{
gPlayerAvatar.runningState = NOT_MOVING;
return 0;
}
else if (direction != GetPlayerMovementDirection() && gPlayerAvatar.runningState != MOVING)
{
gPlayerAvatar.runningState = TURN_DIRECTION;
return 1;
}
else
{
gPlayerAvatar.runningState = MOVING;
return 2;
}
}
static void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys)
{
PlayerFaceDirection(GetPlayerFacingDirection());
}
static void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys)
{
PlayerTurnInPlace(direction);
}
static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
{
u8 r0 = CheckForPlayerAvatarCollision(direction);
if (r0 != 0)
{
if (r0 == 6)
{
PlayerJumpLedge(direction);
return;
}
else if (r0 == 4 && IsPlayerCollidingWithFarawayIslandMew(direction) != 0)
{
PlayerNotOnBikeCollideWithFarawayIslandMew(direction);
return;
}
else
{
u8 r4 = r0 - 5;
if (r4 > 3)
{
PlayerNotOnBikeCollide(direction);
return;
}
else
{
return;
}
}
}
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
{
// speed 2 is fast, same speed as running
PlayerGoSpeed2(direction);
return;
}
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_4) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH)
&& IsRunningDisallowed(gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior) == 0)
{
PlayerRun(direction);
gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_DASH;
return;
}
else
{
PlayerGoSpeed1(direction);
}
}
static u8 CheckForPlayerAvatarCollision(u8 direction)
{
s16 x, y;
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
x = playerEventObj->currentCoords.x;
y = playerEventObj->currentCoords.y;
MoveCoords(direction, &x, &y);
return CheckForEventObjectCollision(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
}
static u8 sub_808B028(u8 direction)
{
s16 x, y;
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
x = playerEventObj->currentCoords.x;
y = playerEventObj->currentCoords.y;
MoveCoords(direction, &x, &y);
return sub_808B164(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
}
u8 CheckForEventObjectCollision(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e)
{
u8 collision;
collision = GetCollisionAtCoords(a, x, y, direction);
if (collision == 3 && sub_808B1BC(x, y, direction))
return 5;
if (ShouldJumpLedge(x, y, direction))
{
IncrementGameStat(GAME_STAT_JUMPED_DOWN_LEDGES);
return COLLISION_LEDGE_JUMP;
}
if (collision == 4 && sub_808B238(x, y, direction))
return 7;
if (collision == 0)
{
if (CheckForRotatingGatePuzzleCollision(direction, x, y))
return 8;
check_acro_bike_metatile(x, y, e, &collision);
}
return collision;
}
static u8 sub_808B164(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e)
{
u8 collision = GetCollisionAtCoords(a, x, y, direction);
if (collision == 0)
{
if (CheckForRotatingGatePuzzleCollisionWithoutAnimation(direction, x, y) != 0)
return 8;
check_acro_bike_metatile(x, y, e, &collision);
}
return collision;
}
static bool8 sub_808B1BC(s16 x, s16 y, u8 direction)
{
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
&& MapGridGetZCoordAt(x, y) == 3
&& GetEventObjectIdByXYZ(x, y, 3) == 16)
{
sub_808C750(direction);
return TRUE;
}
else
{
return FALSE;
}
}
static bool8 ShouldJumpLedge(s16 x, s16 y, u8 z)
{
if (GetLedgeJumpDirection(x, y, z) != 0)
return TRUE;
else
return FALSE;
}
static u8 sub_808B238(s16 x, s16 y, u8 direction)
{
if (FlagGet(FLAG_SYS_USE_STRENGTH))
{
u8 eventObjectId = GetEventObjectIdByXY(x, y);
if (eventObjectId != 16 && gEventObjects[eventObjectId].graphicsId == 0x57)
{
x = gEventObjects[eventObjectId].currentCoords.x;
y = gEventObjects[eventObjectId].currentCoords.y;
MoveCoords(direction, &x, &y);
if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0
&& MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0)
{
task_add_bump_boulder(eventObjectId, direction);
return 1;
}
}
}
return 0;
}
static void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d)
{
u8 i;
for (i = 0; i < 5; i++)
{
if (gUnknown_0849749C[i](c))
{
*d = gUnknown_084974B0[i];
return;
}
}
}

View File

@ -7,17 +7,49 @@
#include "text.h"
#include "strings.h"
#include "window.h"
#include "menu.h"
#include "bg.h"
#include "main.h"
#include "palette.h"
#include "overworld.h"
#include "field_screen.h"
#include "field_weather.h"
#include "script.h"
#include "international_string_util.h"
#include "walda_phrase.h"
#include "sound.h"
#include "gpu_regs.h"
#include "constants/songs.h"
IWRAM_DATA u8 gUnknown_03000F78[0x188];
struct OptionAndDescription
{
const u8 *optionTxt;
const u8 *descriptionTxt;
};
extern const u8 gText_PartyFull[];
extern const u8 gText_Box[];
extern const u8 gText_JustOnePkmn[];
extern u8 gUnknown_02039D00;
// This file's functions.
void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr);
void sub_80C7D74(u8);
u8 sub_80CAEA0(void);
void SetBoxWallpaper(u8 boxId, u8 wallpaperId);
void SetCurrentBox(u8 boxId);
void ClearMonInBox(u8 boxId, u8 boxPos);
void ResetWaldaWallpaper(void);
void sub_80C7958(u8 curBox);
void sub_80C7B14(void);
void sub_80C7BB4(void);
void sub_80CA028(void);
void sub_80C7B80(void);
void sub_80D2AA4(void);
void sub_80C7BE4(void);
void sub_80CAA14(void);
void sub_80C7CF4(struct Sprite *sprite);
struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority);
// const rom data
const struct OptionAndDescription gUnknown_085716C0[] =
const struct PSS_MenuStringPtrs gUnknown_085716C0[] =
{
{gText_WithdrawPokemon, gText_WithdrawMonDescription},
{gText_DepositPokemon, gText_DepositMonDescription},
@ -74,6 +106,10 @@ static const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] =
const u8 gUnknown_08571734[] = {4, 0xF, 0xE};
const u8 gUnknown_08571737[] = _("/30");
const u16 gBoxSelectionPopupPalette[] = INCBIN_U16("graphics/unknown/unknown_57173C.gbapal");
const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp");
const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp");
// code
u8 CountMonsInBox(u8 boxId)
{
@ -166,24 +202,473 @@ static u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n)
return str;
}
/* can't match
static void sub_80C7128(u16 *dst, u16 dstToAdd, u16 dstToMul, const u16 *src, u16 srcToAdd, u16 srcToMul, u32 size, u16 count, u16 srcBy)
static void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width)
{
u16 i;
size <<= 0x11;
dst += (dstToMul * 32) + dstToAdd;
src += (srcToMul * srcBy) + srcToAdd;
i = 0;
if (i < count)
dest_width *= 2;
dest += dest_top * 0x20 + dest_left;
src += src_top * src_width + src_left;
for (i = 0; i < dest_height; i++)
{
size >>= 1;
for (i = 0; i < count; i++)
CpuCopy16(src, dest, dest_width);
dest += 0x20;
src += src_width;
}
}
#define MAX_DMA_BLOCK_SIZE 0x1000
#define Dma3FillLarge_(value, dest, size, bit) \
{ \
void *_dest = dest; \
u32 _size = size; \
while (1) \
{ \
if (_size <= MAX_DMA_BLOCK_SIZE) \
{ \
DmaFill##bit(3, value, _dest, _size); \
break; \
} \
DmaFill##bit(3, value, _dest, MAX_DMA_BLOCK_SIZE); \
_dest += MAX_DMA_BLOCK_SIZE; \
_size -= MAX_DMA_BLOCK_SIZE; \
} \
}
#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16)
#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32)
void sub_80C71A4(u16 *dest, u16 dest_left, u16 dest_top, u16 width, u16 height)
{
u16 i;
dest += dest_top * 0x20 + dest_left;
width *= 2;
for (i = 0; i < height; dest += 0x20, i++)
Dma3FillLarge16_(0, dest, width);
}
void Task_PokemonStorageSystem(u8 taskId)
{
struct Task *task = gTasks + taskId;
switch (task->data[0])
{
case 0:
StorageSystemCreatePrimaryMenu(task->data[1], &task->data[15]);
sub_81973A4();
NewMenuHelpers_DrawDialogueFrame(0, 0);
FillWindowPixelBuffer(0, 0x11);
AddTextPrinterParameterized(0, 1, gUnknown_085716C0[task->data[1]].desc, TEXT_SPEED_FF, NULL, 2, 1, 3);
CopyWindowToVram(0, 3);
CopyWindowToVram(task->data[15], 3);
task->data[0]++;
break;
case 1:
if (IsWeatherNotFadingIn())
{
CpuSet(src, dst, size >> 0x10);
dst += 0x20;
src += srcBy;
task->data[0]++;
}
break;
case 2:
task->data[2] = ProcessMenuInput();
switch(task->data[2])
{
case -2:
task->data[3] = task->data[1];
if (gMain.newKeys & DPAD_UP && --task->data[3] < 0)
task->data[3] = 4;
if (gMain.newKeys & DPAD_DOWN && ++task->data[3] > 4)
task->data[3] = 0;
if (task->data[1] != task->data[3])
{
task->data[1] = task->data[3];
FillWindowPixelBuffer(0, 0x11);
AddTextPrinterParameterized(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
}
break;
case -1:
case 4:
sub_819746C(task->data[15], TRUE);
ScriptContext2_Disable();
EnableBothScriptContexts();
RemoveWindow(task->data[15]);
DestroyTask(taskId);
break;
default:
if (task->data[2] == 0 && CountPartyMons() == PARTY_SIZE)
{
FillWindowPixelBuffer(0, 0x11);
AddTextPrinterParameterized(0, 1, gText_PartyFull, 0, NULL, 2, 1, 3);
task->data[0] = 3;
}
else if (task->data[2] == 1 && CountPartyMons() == 1)
{
FillWindowPixelBuffer(0, 0x11);
AddTextPrinterParameterized(0, 1, gText_JustOnePkmn, 0, NULL, 2, 1, 3);
task->data[0] = 3;
}
else
{
FadeScreen(1, 0);
task->data[0] = 4;
}
break;
}
break;
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
FillWindowPixelBuffer(0, 0x11);
AddTextPrinterParameterized(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
task->data[0] = 2;
}
else if (gMain.newKeys & DPAD_UP)
{
if (--task->data[1] < 0)
task->data[1] = 4;
MoveMenuCursor(-1);
task->data[1] = GetMenuCursorPos();
FillWindowPixelBuffer(0, 0x11);
AddTextPrinterParameterized(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
task->data[0] = 2;
}
else if (gMain.newKeys & DPAD_DOWN)
{
if (++task->data[1] > 3)
task->data[1] = 0;
MoveMenuCursor(1);
task->data[1] = GetMenuCursorPos();
FillWindowPixelBuffer(0, 0x11);
AddTextPrinterParameterized(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
task->data[0] = 2;
}
break;
case 4:
if (!gPaletteFade.active)
{
overworld_free_bg_tilemaps();
sub_80C7D74(task->data[2]);
RemoveWindow(task->data[15]);
DestroyTask(taskId);
}
break;
}
}
void ShowPokemonStorageSystem(void)
{
u8 taskId = CreateTask(Task_PokemonStorageSystem, 80);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
ScriptContext2_Enable();
}
void mapldr_0808C6D8(void)
{
u8 taskId;
MainCallback vblankCb = gMain.vblankCallback;
SetVBlankCallback(NULL);
taskId = CreateTask(Task_PokemonStorageSystem, 80);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = gUnknown_02039D00;
Task_PokemonStorageSystem(taskId);
SetVBlankCallback(vblankCb);
pal_fill_black();
}
void StorageSystemCreatePrimaryMenu(u8 whichMenu, s16 *windowIdPtr)
{
s16 windowId;
struct WindowTemplate winTemplate = gUnknown_085716E8;
winTemplate.width = GetMaxWidthInMenuTable((void *)gUnknown_085716C0, ARRAY_COUNT(gUnknown_085716C0));
windowId = AddWindow(&winTemplate);
NewMenuHelpers_DrawStdWindowFrame(windowId, FALSE);
PrintMenuTable(windowId, ARRAY_COUNT(gUnknown_085716C0), (void *)gUnknown_085716C0);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, ARRAY_COUNT(gUnknown_085716C0), whichMenu);
*windowIdPtr = windowId;
}
void sub_80C7678(void)
{
gUnknown_02039D00 = sub_80CAEA0();
gFieldCallback = mapldr_0808C6D8;
SetMainCallback2(CB2_ReturnToField);
}
s16 StorageSystemGetNextMonIndex(struct BoxPokemon *box, s8 startIdx, u8 stopIdx, u8 mode)
{
s16 i;
s16 direction;
if (mode == 0 || mode == 1)
{
direction = 1;
}
else
{
direction = -1;
}
if (mode == 1 || mode == 3)
{
for (i = startIdx + direction; i >= 0 && i <= stopIdx; i += direction)
{
if (GetBoxMonData(box + i, MON_DATA_SPECIES) != 0)
return i;
}
}
}*/
else
{
for (i = startIdx + direction; i >= 0 && i <= stopIdx; i += direction)
{
if (GetBoxMonData(box + i, MON_DATA_SPECIES) != 0 && !GetBoxMonData(box + i, MON_DATA_IS_EGG))
return i;
}
}
return -1;
}
void ResetPokemonStorageSystem(void)
{
u16 boxId;
u16 boxMon;
SetCurrentBox(0);
for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++)
{
for (boxMon = 0; boxMon < IN_BOX_COUNT; boxMon++)
ClearMonInBox(boxId, boxMon);
}
for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++)
{
u8 *dest = StringCopy(GetBoxNamePtr(boxId), gText_Box);
ConvertIntToDecimalStringN(dest, boxId + 1, STR_CONV_MODE_LEFT_ALIGN, 2);
}
for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++)
{
SetBoxWallpaper(boxId, boxId % 4);
}
ResetWaldaWallpaper();
}
void sub_80C77E8(struct UnkPSSStruct_2002370 *a0, u16 tileTag, u16 palTag, u8 a3, bool32 loadPal)
{
struct SpritePalette palette =
{
gBoxSelectionPopupPalette, palTag
};
struct SpriteSheet sheets[] =
{
{gBoxSelectionPopupCenterTiles, 0x800, tileTag},
{gBoxSelectionPopupSidesTiles, 0x180, tileTag + 1},
{}
};
if (loadPal)
LoadSpritePalette(&palette);
LoadSpriteSheets(sheets);
gUnknown_02039D04 = a0;
a0->unk_0240 = tileTag;
a0->unk_0242 = palTag;
a0->unk_0246 = a3;
a0->unk_023c = loadPal;
}
void sub_80C7890(void)
{
if (gUnknown_02039D04->unk_023c)
FreeSpritePaletteByTag(gUnknown_02039D04->unk_0242);
FreeSpriteTilesByTag(gUnknown_02039D04->unk_0240);
FreeSpriteTilesByTag(gUnknown_02039D04->unk_0240 + 1);
}
void sub_80C78D4(u8 curBox)
{
sub_80C7958(curBox);
}
void sub_80C78E4(void)
{
sub_80C7B14();
}
u8 sub_80C78F0(void)
{
if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
return 201;
}
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
return gUnknown_02039D04->curBox;
}
if (gMain.newKeys & DPAD_LEFT)
{
PlaySE(SE_SELECT);
sub_80C7BB4();
}
else if (gMain.newKeys & DPAD_RIGHT)
{
PlaySE(SE_SELECT);
sub_80C7B80();
}
return 200;
}
void sub_80C7958(u8 curBox)
{
u16 i;
u8 spriteId;
struct SpriteTemplate template;
struct OamData oamData = {};
oamData.size = 3;
oamData.paletteNum = 1;
template = (struct SpriteTemplate){
0, 0, &oamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
};
gUnknown_02039D04->curBox = curBox;
template.tileTag = gUnknown_02039D04->unk_0240;
template.paletteTag = gUnknown_02039D04->unk_0242;
spriteId = CreateSprite(&template, 0xA0, 0x60, 0);
gUnknown_02039D04->unk_0000 = gSprites + spriteId;
oamData.shape = ST_OAM_V_RECTANGLE;
oamData.size = 1;
template.tileTag = gUnknown_02039D04->unk_0240 + 1;
template.anims = sSpriteAnimTable_8571710;
for (i = 0; i < 4; i++)
{
u16 r5;
spriteId = CreateSprite(&template, 0x7c, 0x50, gUnknown_02039D04->unk_0246);
gUnknown_02039D04->unk_0004[i] = gSprites + spriteId;
r5 = 0;
if (i & 2)
{
gUnknown_02039D04->unk_0004[i]->pos1.x = 0xc4;
r5 = 2;
}
if (i & 1)
{
gUnknown_02039D04->unk_0004[i]->pos1.y = 0x70;
gUnknown_02039D04->unk_0004[i]->oam.size = 0;
r5++;
}
StartSpriteAnim(gUnknown_02039D04->unk_0004[i], r5);
}
for (i = 0; i < 2; i++)
{
gUnknown_02039D04->unk_0020[i] = sub_80CD2E8(72 * i + 0x7c, 0x58, i, 0, gUnknown_02039D04->unk_0246);
if (gUnknown_02039D04->unk_0020[i])
{
gUnknown_02039D04->unk_0020[i]->data[0] = (i == 0 ? -1 : 1);
gUnknown_02039D04->unk_0020[i]->callback = sub_80C7CF4;
}
}
sub_80C7BE4();
}
void sub_80C7B14(void)
{
u16 i;
if (gUnknown_02039D04->unk_0000)
{
DestroySprite(gUnknown_02039D04->unk_0000);
gUnknown_02039D04->unk_0000 = NULL;
}
for (i = 0; i < 4; i++)
{
if (gUnknown_02039D04->unk_0004[i])
{
DestroySprite(gUnknown_02039D04->unk_0004[i]);
gUnknown_02039D04->unk_0004[i] = NULL;
}
}
for (i = 0; i < 2; i++)
{
if (gUnknown_02039D04->unk_0020[i])
DestroySprite(gUnknown_02039D04->unk_0020[i]);
}
}
void sub_80C7B80(void)
{
if (++gUnknown_02039D04->curBox >= TOTAL_BOXES_COUNT)
gUnknown_02039D04->curBox = 0;
sub_80C7BE4();
}
void sub_80C7BB4(void)
{
gUnknown_02039D04->curBox = (gUnknown_02039D04->curBox == 0 ? TOTAL_BOXES_COUNT - 1 : gUnknown_02039D04->curBox - 1);
sub_80C7BE4();
}
void sub_80C7BE4(void)
{
u8 text[16];
struct WindowTemplate winTemplate;
u8 windowId;
u8 *boxName = GetBoxNamePtr(gUnknown_02039D04->curBox);
u8 nPokemonInBox = CountMonsInBox(gUnknown_02039D04->curBox);
u32 winTileData;
s32 center;
memset(&winTemplate, 0, sizeof(winTemplate));
winTemplate.width = 8;
winTemplate.height = 4;
windowId = AddWindow(&winTemplate);
FillWindowPixelBuffer(windowId, 0x44);
center = GetStringCenterAlignXOffset(1, boxName, 0x40);
box_print(windowId, 1, center, 1, gUnknown_08571734, TEXT_SPEED_FF, boxName);
ConvertIntToDecimalStringN(text, nPokemonInBox, 1, 2);
StringAppend(text, gUnknown_08571737);
center = GetStringCenterAlignXOffset(1, text, 0x40);
box_print(windowId, 1, center, 0x11, gUnknown_08571734, TEXT_SPEED_FF, text);
winTileData = GetWindowAttribute(windowId, WINDOW_TILE_DATA);
CpuCopy32((void *)winTileData, (void *)OBJ_VRAM0 + 0x100 + (GetSpriteTileStartByTag(gUnknown_02039D04->unk_0240) * 32), 0x400);
RemoveWindow(windowId);
}
void sub_80C7CF4(struct Sprite *sprite)
{
if (++sprite->data[1] > 3)
{
sprite->data[1] = 0;
sprite->pos2.x += sprite->data[0];
if (++sprite->data[2] > 5)
{
sprite->data[2] = 0;
sprite->pos2.x = 0;
}
}
}
void sub_80C7D28(void)
{
LoadOam();
ProcessSpriteCopyRequests();
sub_80D2AA4();
TransferPlttBuffer();
SetGpuReg(REG_OFFSET_BG2HOFS, gUnknown_02039D08->bg2_X);
}
void c2_Box(void)
{
RunTasks();
do_scheduled_bg_tilemap_copies_to_vram();
sub_80CA028();
sub_80CAA14();
AnimateSprites();
BuildOamBuffer();
}

View File

@ -29,6 +29,7 @@
#include "daycare.h"
#include "data2.h"
#include "contest.h"
#include "contest_effect.h"
extern struct UnkSummaryStruct* gUnknown_0203CF1C;
extern struct BgTemplate gUnknown_0861CBB4;
@ -41,7 +42,6 @@ extern struct UnkStruct_61CC04 gUnknown_0861CC10;
extern struct UnkStruct_61CC04 gUnknown_0861CBEC;
extern struct UnkStruct_61CC04 gUnknown_0861CBF8;
extern u16 gSummaryScreenWindow_Tilemap[];
extern struct ContestMove gContestMoves[];
extern struct ContestEffect gContestEffects[];
extern struct WindowTemplate gUnknown_0861CC24;
extern u8 gUnknown_0861CD2C[][3];

1366
src/slot_machine.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1448,8 +1448,8 @@ void ContestLiveUpdates_BeforeInterview_5(u8 a0, u8 a1)
sCurTVShowSlot = FindEmptyTVSlotWithinFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows);
if (sCurTVShowSlot != -1)
{
show->contestLiveUpdates.winningSpecies = gUnknown_02039E00[a1].unk_00;
StringCopy(show->contestLiveUpdates.winningTrainerName, gUnknown_02039E00[a1].unk_0d);
show->contestLiveUpdates.winningSpecies = gContestMons[a1].species;
StringCopy(show->contestLiveUpdates.winningTrainerName, gContestMons[a1].trainerName);
StripExtCtrlCodes(show->contestLiveUpdates.winningTrainerName);
show->contestLiveUpdates.appealFlags2 = a0;
if (a1 + 1 > gUnknown_02039F30)

View File

@ -43,9 +43,7 @@ gUnknown_030060B0: @ 30060B0
gUnknown_030060B4: @ 30060B4
.space 0x4
gUnknown_030060B8: @ 30060B8
.space 0x4
.include "contest.o"
.include "tv.o"
.include "mauville_old_man.o"

View File

@ -382,61 +382,9 @@ gUnknown_02039D8C: @ 2039D8C
.include "src/fldeff_cut.o"
.include "src/map_name_popup.o"
.include "src/item.o"
.include "src/contest.o"
gUnknown_02039E00: @ 2039E00
.space 0x100
gUnknown_02039F00: @ 2039F00
.space 0x8
gUnknown_02039F08: @ 2039F08
.space 0x8
gUnknown_02039F10: @ 2039F10
.space 0x8
gUnknown_02039F18: @ 2039F18
.space 0x8
gUnknown_02039F20: @ 2039F20
.space 0x4
gUnknown_02039F24: @ 2039F24
.space 0x1
gUnknown_02039F25: @ 2039F25
.space 0x1
gUnknown_02039F26: @ 2039F26
.space 0x4
gUnknown_02039F2A: @ 2039F2A
.space 0x1
gUnknown_02039F2B: @ 2039F2B
.space 0x1
gSpecialVar_ContestCategory: @ 2039F2C
.space 0x2
gSpecialVar_ContestRank: @ 2039F2E
.space 0x2
gUnknown_02039F30: @ 2039F30
.space 0x1
gUnknown_02039F31: @ 2039F31
.space 0x3
gContestResources: @ 2039F34
.space 0x4
gUnknown_02039F38: @ 2039F38
.space 0x4
gUnknown_02039F3C: @ 2039F3C
.space 0x20
.align 2
gUnknown_02039F5C: @ 2039F5C
.space 0x1
@ -593,7 +541,7 @@ gUnknown_0203AB2C: @ 203AB2C
gUnknown_0203AB30: @ 203AB30
.space 0x4
gUnknown_0203AB34: @ 203AB34
sSlotMachine: @ 203AB34
.space 0x4
.include "src/battle_ai_script_commands.o"