Matched up to sub_80DBF68, sub_80DBF90 WIP.

This commit is contained in:
ultima-soul 2018-12-19 08:53:43 -08:00
parent 37d7348e01
commit 76510d58bb
3 changed files with 313 additions and 977 deletions

View File

@ -5,980 +5,6 @@
.text
thumb_func_start sub_80DB884
sub_80DB884: @ 80DB884
push {r4,lr}
movs r4, 0
_080DB888:
lsls r0, r4, 24
lsrs r0, 24
bl sub_80DB798
adds r4, 0x1
cmp r4, 0x3
ble _080DB888
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80DB884
thumb_func_start sub_80DB89C
sub_80DB89C: @ 80DB89C
push {lr}
movs r0, 0x4
movs r1, 0
bl FillWindowPixelBuffer
movs r0, 0x4
movs r1, 0x2
bl CopyWindowToVram
movs r0, 0
bl Contest_SetBgCopyFlags
pop {r0}
bx r0
thumb_func_end sub_80DB89C
thumb_func_start sub_80DB8B8
sub_80DB8B8: @ 80DB8B8
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
adds r5, r4, 0
adds r0, r4, 0
bl Contest_IsMonsTurnDisabled
lsls r0, 24
cmp r0, 0
beq _080DB8D0
movs r0, 0
b _080DB90A
_080DB8D0:
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
cmp r4, r0
beq _080DB8F4
adds r0, r4, 0
bl ContestAI_ResetAI
bl ContestAI_GetActionToUse
lsls r0, 24
ldr r2, =gContestMons
lsrs r0, 23
lsls r1, r4, 6
b _080DB902
.pool
_080DB8F4:
ldr r2, =gContestMons
ldr r0, =gContestResources
ldr r0, [r0]
ldr r0, [r0]
ldrb r0, [r0]
lsls r0, 1
lsls r1, r5, 6
_080DB902:
adds r0, r1
adds r2, 0x1E
adds r0, r2
ldrh r0, [r0]
_080DB90A:
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end sub_80DB8B8
thumb_func_start sub_80DB918
sub_80DB918: @ 80DB918
push {r4,r5,lr}
movs r4, 0
movs r5, 0
_080DB91E:
lsls r0, r4, 24
lsrs r0, 24
bl sub_80DB8B8
ldr r1, =gContestResources
ldr r1, [r1]
ldr r1, [r1, 0x4]
adds r1, r5, r1
strh r0, [r1, 0x6]
adds r5, 0x1C
adds r4, 0x1
cmp r4, 0x3
ble _080DB91E
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DB918
thumb_func_start sub_80DB944
sub_80DB944: @ 80DB944
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
sub sp, 0x8
ldr r5, =gContestResources
mov r4, sp
movs r3, 0
movs r6, 0x3
_080DB956:
ldr r2, [r5]
ldr r1, [r2, 0x4]
adds r1, r3, r1
ldrh r0, [r1, 0x2]
ldrh r7, [r1, 0x4]
adds r0, r7
strh r0, [r1, 0x4]
ldr r0, [r2, 0x4]
adds r0, r3, r0
ldrh r0, [r0, 0x4]
strh r0, [r4]
adds r4, 0x2
adds r3, 0x1C
subs r6, 0x1
cmp r6, 0
bge _080DB956
movs r6, 0
_080DB978:
movs r4, 0x3
cmp r4, r6
ble _080DB9A4
_080DB97E:
subs r5, r4, 0x1
lsls r0, r5, 1
mov r1, sp
adds r3, r1, r0
lsls r0, r4, 1
adds r2, r1, r0
ldrh r4, [r3]
movs r7, 0
ldrsh r1, [r3, r7]
movs r7, 0
ldrsh r0, [r2, r7]
cmp r1, r0
bge _080DB99E
ldrh r0, [r2]
strh r4, [r2]
strh r0, [r3]
_080DB99E:
adds r4, r5, 0
cmp r4, r6
bgt _080DB97E
_080DB9A4:
adds r6, 0x1
cmp r6, 0x2
ble _080DB978
movs r6, 0
movs r0, 0x4
negs r0, r0
mov r9, r0
ldr r1, =gContestResources
mov r8, r1
movs r7, 0x3
mov r12, r7
_080DB9BA:
movs r4, 0
lsls r0, r6, 3
adds r7, r6, 0x1
subs r0, r6
lsls r5, r0, 2
mov r3, sp
_080DB9C6:
mov r1, r8
ldr r0, [r1]
ldr r0, [r0, 0x4]
adds r2, r5, r0
movs r6, 0x4
ldrsh r1, [r2, r6]
movs r6, 0
ldrsh r0, [r3, r6]
cmp r1, r0
bne _080DB9F0
mov r0, r12
ands r4, r0
ldrb r1, [r2, 0xB]
mov r0, r9
ands r0, r1
orrs r0, r4
strb r0, [r2, 0xB]
b _080DB9F8
.pool
_080DB9F0:
adds r3, 0x2
adds r4, 0x1
cmp r4, 0x3
ble _080DB9C6
_080DB9F8:
adds r6, r7, 0
cmp r6, 0x3
ble _080DB9BA
movs r0, 0x1
bl sub_80DCE58
bl sub_80DD590
add sp, 0x8
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_80DB944
thumb_func_start sub_80DBA18
sub_80DBA18: @ 80DBA18
push {r4,r5,lr}
ldr r4, =gContestResources
movs r2, 0
movs r3, 0x3
_080DBA20:
ldr r0, [r4]
ldr r0, [r0, 0x4]
adds r1, r2, r0
ldrh r0, [r1, 0x6]
cmp r0, 0
bne _080DBA34
movs r1, 0x5
b _080DBA52
.pool
_080DBA34:
movs r5, 0x2
ldrsh r0, [r1, r5]
movs r1, 0
cmp r0, 0
ble _080DBA52
movs r1, 0x1
cmp r0, 0x1D
ble _080DBA52
movs r1, 0x2
cmp r0, 0x3B
ble _080DBA52
movs r1, 0x4
cmp r0, 0x4F
bgt _080DBA52
movs r1, 0x3
_080DBA52:
ldr r0, [r4]
ldr r0, [r0, 0x4]
adds r0, r2, r0
strb r1, [r0, 0x1A]
adds r2, 0x1C
subs r3, 0x1
cmp r3, 0
bge _080DBA20
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_80DBA18
thumb_func_start sub_80DBA68
sub_80DBA68: @ 80DBA68
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gContestResources
ldr r1, [r1]
ldr r2, [r1, 0x4]
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
adds r2, r1, r2
ldrb r1, [r2, 0xC]
movs r0, 0x6
ands r0, r1
cmp r0, 0
bne _080DBA90
ldrb r1, [r2, 0xB]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _080DBA98
_080DBA90:
movs r0, 0
b _080DBA9A
.pool
_080DBA98:
movs r0, 0x1
_080DBA9A:
pop {r1}
bx r1
thumb_func_end sub_80DBA68
thumb_func_start sub_80DBAA0
sub_80DBAA0: @ 80DBAA0
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r5, =gContestResources
movs r0, 0
mov r8, r0
movs r1, 0x7
negs r1, r1
mov r10, r1
movs r0, 0x2
negs r0, r0
mov r9, r0
movs r4, 0
movs r6, 0x3
_080DBAC0:
ldr r1, [r5]
ldr r0, [r1, 0x4]
adds r0, r4, r0
movs r2, 0
strh r2, [r0, 0x2]
ldr r0, [r1, 0x4]
adds r0, r4, r0
strh r2, [r0]
ldr r0, [r1, 0x4]
adds r0, r4, r0
mov r1, r8
strb r1, [r0, 0x12]
ldr r0, [r5]
ldr r0, [r0, 0x4]
adds r3, r4, r0
ldrb r2, [r3, 0xC]
movs r0, 0x6
ands r0, r2
cmp r0, 0
beq _080DBAFC
lsls r0, r2, 29
lsrs r0, 30
subs r0, 0x1
movs r1, 0x3
ands r0, r1
lsls r0, 1
mov r1, r10
ands r1, r2
orrs r1, r0
strb r1, [r3, 0xC]
_080DBAFC:
ldr r0, [r5]
ldr r0, [r0, 0x4]
adds r0, r4, r0
mov r1, r8
strb r1, [r0, 0xE]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x10]
mov r0, r9
ands r0, r2
strb r0, [r1, 0x10]
ldr r0, [r5]
ldr r0, [r0, 0x4]
adds r0, r4, r0
mov r1, r8
strb r1, [r0, 0xF]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x10]
movs r0, 0x3
negs r0, r0
ands r0, r2
strb r0, [r1, 0x10]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x10]
movs r7, 0x5
negs r7, r7
adds r0, r7, 0
ands r0, r2
strb r0, [r1, 0x10]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x10]
movs r0, 0x9
negs r0, r0
mov r12, r0
ands r0, r2
strb r0, [r1, 0x10]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0xC]
mov r0, r9
ands r0, r2
strb r0, [r1, 0xC]
ldr r0, [r5]
ldr r0, [r0, 0x4]
adds r0, r4, r0
movs r1, 0xFF
strb r1, [r0, 0x13]
ldr r0, [r5]
ldr r0, [r0, 0x4]
adds r0, r4, r0
movs r1, 0x1
negs r1, r1
strb r1, [r0, 0x14]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x10]
movs r0, 0x31
negs r0, r0
ands r0, r2
strb r0, [r1, 0x10]
ldr r0, [r5]
ldr r2, [r0, 0x4]
adds r2, r4, r2
ldrb r3, [r2, 0x15]
lsls r1, r3, 31
lsrs r1, 31
lsls r1, 2
adds r0, r7, 0
ands r0, r3
orrs r0, r1
strb r0, [r2, 0x15]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x15]
mov r0, r9
ands r0, r2
strb r0, [r1, 0x15]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x11]
movs r0, 0x4
negs r0, r0
ands r0, r2
strb r0, [r1, 0x11]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x11]
movs r0, 0x21
negs r0, r0
ands r0, r2
strb r0, [r1, 0x11]
ldr r0, [r5]
ldr r0, [r0, 0x4]
adds r2, r4, r0
ldrb r1, [r2, 0x11]
movs r0, 0x4
ands r0, r1
cmp r0, 0
beq _080DBBF4
ldrb r1, [r2, 0xC]
mov r0, r10
ands r0, r1
movs r1, 0x2
orrs r0, r1
strb r0, [r2, 0xC]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x11]
adds r0, r7, 0
ands r0, r2
strb r0, [r1, 0x11]
_080DBBF4:
ldr r0, [r5]
ldr r0, [r0, 0x4]
adds r2, r4, r0
ldrb r1, [r2, 0x11]
movs r0, 0x8
ands r0, r1
cmp r0, 0
beq _080DBC1A
ldrb r0, [r2, 0xB]
movs r1, 0x80
orrs r0, r1
strb r0, [r2, 0xB]
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x11]
mov r0, r12
ands r0, r2
strb r0, [r1, 0x11]
_080DBC1A:
ldr r0, [r5]
ldr r1, [r0, 0x4]
adds r1, r4, r1
ldrb r2, [r1, 0x11]
movs r0, 0x11
negs r0, r0
ands r0, r2
strb r0, [r1, 0x11]
adds r4, 0x1C
subs r6, 0x1
cmp r6, 0
blt _080DBC34
b _080DBAC0
_080DBC34:
movs r6, 0
ldr r5, =gContestResources
movs r7, 0
movs r4, 0
_080DBC3C:
ldr r3, [r5]
ldr r0, [r3, 0x4]
adds r0, r4, r0
ldrh r1, [r0, 0x6]
strh r1, [r0, 0x8]
ldr r2, [r3]
lsls r1, r6, 1
ldrb r0, [r2, 0x1]
lsls r0, 3
adds r1, r0
adds r2, 0x1C
adds r2, r1
ldr r0, [r3, 0x4]
adds r0, r4, r0
ldrh r0, [r0, 0x6]
strh r0, [r2]
ldr r0, [r3, 0x4]
adds r0, r4, r0
ldrh r0, [r0, 0x6]
bl Contest_GetMoveExcitement
ldr r1, [r5]
ldr r2, [r1]
ldrb r1, [r2, 0x1]
lsls r1, 2
adds r1, r6, r1
adds r2, 0x44
adds r2, r1
strb r0, [r2]
ldr r0, [r5]
ldr r0, [r0, 0x4]
adds r0, r4, r0
strh r7, [r0, 0x6]
adds r4, 0x1C
adds r6, 0x1
cmp r6, 0x3
ble _080DBC3C
ldr r0, =gContestResources
ldr r0, [r0]
ldr r2, [r0, 0x10]
ldrb r1, [r2, 0x1]
movs r0, 0x2
negs r0, r0
ands r0, r1
strb r0, [r2, 0x1]
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DBAA0
thumb_func_start Contest_IsMonsTurnDisabled
Contest_IsMonsTurnDisabled: @ 80DBCA8
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, =gContestResources
ldr r1, [r1]
ldr r2, [r1, 0x4]
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
adds r2, r1, r2
ldrb r1, [r2, 0xC]
movs r0, 0x6
ands r0, r1
cmp r0, 0
bne _080DBCD0
ldrb r1, [r2, 0xB]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _080DBCD8
_080DBCD0:
movs r0, 0x1
b _080DBCDA
.pool
_080DBCD8:
movs r0, 0
_080DBCDA:
pop {r1}
bx r1
thumb_func_end Contest_IsMonsTurnDisabled
thumb_func_start sub_80DBCE0
sub_80DBCE0: @ 80DBCE0
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
adds r0, r4, 0
bl sub_80DBD34
ldr r1, =gUnknown_02039F18
lsls r4, 1
adds r1, r4, r1
strh r0, [r1]
ldr r2, =gUnknown_02039F08
adds r2, r4, r2
ldr r1, =gContestMonConditions
adds r4, r1
ldrh r4, [r4]
adds r0, r4
strh r0, [r2]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DBCE0
thumb_func_start sub_80DBD18
sub_80DBD18: @ 80DBD18
push {r4,lr}
movs r4, 0
_080DBD1C:
lsls r0, r4, 24
lsrs r0, 24
bl sub_80DBCE0
adds r4, 0x1
cmp r4, 0x3
ble _080DBD1C
bl sub_80DBD4C
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80DBD18
thumb_func_start sub_80DBD34
sub_80DBD34: @ 80DBD34
lsls r0, 24
ldr r1, =gUnknown_02039F10
lsrs r0, 23
adds r0, r1
movs r1, 0
ldrsh r0, [r0, r1]
lsls r0, 17
asrs r0, 16
bx lr
.pool
thumb_func_end sub_80DBD34
thumb_func_start sub_80DBD4C
sub_80DBD4C: @ 80DBD4C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x70
mov r0, sp
movs r1, 0
movs r2, 0x8
bl memset
movs r0, 0
mov r9, r0
mov r1, sp
adds r1, 0x8
str r1, [sp, 0x64]
mov r3, sp
adds r3, 0xC
str r3, [sp, 0x68]
mov r6, sp
adds r6, 0x14
str r6, [sp, 0x6C]
mov r4, sp
_080DBD7A:
bl Random
strh r0, [r4]
movs r2, 0
cmp r2, r9
bge _080DBDB8
mov r1, sp
lsls r0, 16
lsrs r0, 16
ldrh r1, [r1]
cmp r0, r1
bne _080DBD9C
subs r4, 0x2
movs r7, 0x1
negs r7, r7
add r9, r7
b _080DBDB8
_080DBD9C:
adds r2, 0x1
cmp r2, r9
bge _080DBDB8
lsls r0, r2, 1
mov r3, sp
adds r1, r3, r0
ldrh r0, [r4]
ldrh r1, [r1]
cmp r0, r1
bne _080DBD9C
subs r4, 0x2
movs r6, 0x1
negs r6, r6
add r9, r6
_080DBDB8:
adds r4, 0x2
movs r7, 0x1
add r9, r7
mov r0, r9
cmp r0, 0x3
ble _080DBD7A
movs r1, 0
mov r9, r1
mov r4, sp
ldr r6, =gUnknown_02039F08
ldr r2, [sp, 0x64]
ldr r5, =gContestMonConditions
ldr r3, [sp, 0x68]
_080DBDD2:
mov r7, r9
lsls r1, r7, 4
movs r7, 0
ldrsh r0, [r6, r7]
str r0, [r2]
movs r7, 0
ldrsh r0, [r5, r7]
str r0, [r3]
ldrh r0, [r4]
str r0, [r2, 0x8]
ldr r0, [sp, 0x6C]
adds r1, r0, r1
mov r7, r9
str r7, [r1]
adds r4, 0x2
adds r6, 0x2
adds r2, 0x10
adds r5, 0x2
adds r3, 0x10
movs r0, 0x1
add r9, r0
mov r1, r9
cmp r1, 0x3
ble _080DBDD2
movs r3, 0
mov r9, r3
_080DBE06:
movs r4, 0x3
cmp r4, r9
ble _080DBE90
add r7, sp, 0x48
ldr r6, [sp, 0x68]
str r6, [sp, 0x58]
ldr r0, [sp, 0x64]
adds r0, 0x8
str r0, [sp, 0x5C]
ldr r1, [sp, 0x6C]
str r1, [sp, 0x60]
_080DBE1C:
subs r3, r4, 0x1
mov r10, r3
mov r0, r10
adds r1, r4, 0
ldr r2, [sp, 0x64]
bl sub_80DBF30
lsls r0, 24
cmp r0, 0
beq _080DBE8A
mov r6, r10
lsls r2, r6, 4
ldr r0, [sp, 0x64]
adds r3, r0, r2
ldr r0, [r3]
str r0, [sp, 0x48]
ldr r1, [sp, 0x58]
adds r6, r1, r2
ldr r0, [r6]
str r0, [r7, 0x4]
ldr r0, [sp, 0x5C]
adds r0, r2
mov r8, r0
ldr r0, [r0]
str r0, [r7, 0x8]
ldr r1, [sp, 0x60]
adds r2, r1, r2
ldr r0, [r2]
str r0, [r7, 0xC]
lsls r1, r4, 4
ldr r0, [sp, 0x64]
adds r5, r0, r1
ldr r0, [r5]
str r0, [r3]
ldr r3, [sp, 0x58]
adds r4, r3, r1
ldr r0, [r4]
str r0, [r6]
ldr r6, [sp, 0x5C]
adds r3, r6, r1
ldr r0, [r3]
mov r6, r8
str r0, [r6]
ldr r0, [sp, 0x60]
adds r1, r0, r1
ldr r0, [r1]
str r0, [r2]
ldr r0, [sp, 0x48]
str r0, [r5]
ldr r0, [r7, 0x4]
str r0, [r4]
ldr r0, [r7, 0x8]
str r0, [r3]
ldr r0, [r7, 0xC]
str r0, [r1]
_080DBE8A:
mov r4, r10
cmp r4, r9
bgt _080DBE1C
_080DBE90:
movs r1, 0x1
add r9, r1
mov r3, r9
cmp r3, 0x2
ble _080DBE06
movs r6, 0
mov r9, r6
ldr r2, =gContestFinalStandings
ldr r1, [sp, 0x6C]
_080DBEA2:
ldr r0, [r1]
adds r0, r2
mov r7, r9
strb r7, [r0]
adds r1, 0x10
movs r0, 0x1
add r9, r0
mov r3, r9
cmp r3, 0x3
ble _080DBEA2
add sp, 0x70
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80DBD4C
thumb_func_start sub_80DBED4
sub_80DBED4: @ 80DBED4
push {lr}
ldr r0, =gIsLinkContest
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _080DBF0E
ldr r0, =gSaveBlock2Ptr
ldr r2, [r0]
ldr r1, =gContestFinalStandings
ldr r0, =gContestPlayerMonIndex
ldrb r0, [r0]
adds r0, r1
ldrb r1, [r0]
lsls r1, 1
ldr r0, =gSpecialVar_ContestCategory
ldrh r0, [r0]
lsls r0, 3
adds r1, r0
ldr r0, =0x00000624
adds r2, r0
adds r2, r1
ldrh r0, [r2]
adds r0, 0x1
ldr r1, =0x0000270f
cmp r0, r1
ble _080DBF0C
adds r0, r1, 0
_080DBF0C:
strh r0, [r2]
_080DBF0E:
pop {r0}
bx r0
.pool
thumb_func_end sub_80DBED4
thumb_func_start sub_80DBF30
sub_80DBF30: @ 80DBF30
push {lr}
lsls r0, 4
adds r0, r2
lsls r1, 4
adds r3, r1, r2
ldr r2, [r0]
ldr r1, [r3]
cmp r2, r1
blt _080DBF60
cmp r2, r1
bgt _080DBF52
ldr r2, [r0, 0x4]
ldr r1, [r3, 0x4]
cmp r2, r1
blt _080DBF60
cmp r2, r1
ble _080DBF56
_080DBF52:
movs r2, 0
b _080DBF62
_080DBF56:
ldr r1, [r0, 0x8]
ldr r0, [r3, 0x8]
movs r2, 0
cmp r1, r0
bge _080DBF62
_080DBF60:
movs r2, 0x1
_080DBF62:
adds r0, r2, 0
pop {r1}
bx r1
thumb_func_end sub_80DBF30
thumb_func_start sub_80DBF68
sub_80DBF68: @ 80DBF68
push {lr}
ldr r0, =gBattle_BG0_Y
movs r1, 0
strh r1, [r0]
ldr r0, =gBattle_BG2_Y
strh r1, [r0]
bl sub_80DB89C
ldr r0, =gUnknown_0827E8DA
movs r1, 0
bl Contest_StartTextPrinter
pop {r0}
bx r0
.pool
thumb_func_end sub_80DBF68
thumb_func_start sub_80DBF90
sub_80DBF90: @ 80DBF90
push {r4,r5,lr}
sub sp, 0xC
movs r5, 0x80
lsls r5, 18
movs r4, 0x3
_080DBF9A:
lsrs r3, r5, 24
movs r0, 0x8
str r0, [sp]
movs r0, 0x2
str r0, [sp, 0x4]
movs r0, 0x11
str r0, [sp, 0x8]
movs r0, 0
movs r1, 0
movs r2, 0x16
bl ContestBG_FillBoxWithTile
movs r0, 0xA0
lsls r0, 19
adds r5, r0
subs r4, 0x1
cmp r4, 0
bge _080DBF9A
add sp, 0xC
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_80DBF90
thumb_func_start sub_80DBFC8
sub_80DBFC8: @ 80DBFC8
push {lr}

View File

@ -385,6 +385,14 @@ struct UnknownContestStruct4
u8 unk2_2:1;
};
struct UnknownContestStruct6
{
s32 unk0;
s32 unk4;
s32 unk8;
s32 unkC;
};
struct ContestResourcesField1C
{
u8 filler_00[0x40];

View File

@ -42,6 +42,7 @@
#include "international_string_util.h"
#include "data2.h"
#include "constants/rgb.h"
#include "contest_ai.h"
extern void (*gFieldCallback)(void);
@ -104,7 +105,7 @@ void sub_80DB2BC(void);
void prints_contest_move_description(u16);
u16 sub_80DE84C(u16);
void sub_80DB89C(void);
u16 sub_80DB8B8(u8);
u16 GetChosenMove(u8);
void sub_80DB918(void);
bool8 Contest_IsMonsTurnDisabled(u8);
void sub_80DBF68(void);
@ -169,6 +170,9 @@ void sub_80DF9D4(u8 *);
void sub_80DF9E0(u8 *, s32);
void ContestBG_FillBoxWithTile(u8, u16, u8, u8, u8, u8, u8);
void Contest_PrintTextToBg0WindowStd(u8, const u8 *);
s16 sub_80DBD34(u8);
void DetermineFinalStandings(void);
bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *);
EWRAM_DATA struct ContestPokemon gContestMons[4] = {0};
EWRAM_DATA s16 gContestMonConditions[4] = {0};
@ -199,6 +203,7 @@ extern const struct WindowTemplate gUnknown_08587F44[];
extern const u8 *const gUnknown_08587D90[];
extern const u8 *const gUnknown_08587F08[];
extern const u8 *const gUnknown_08587F1C[];
extern const u8 *const gUnknown_0827E8DA[];
extern const u8 gText_0827D55A[];
extern const u8 gText_0827E793[];
extern const u8 gText_0827E32E[];
@ -855,7 +860,7 @@ void sub_80D8894(u8 taskId)
{
if (gIsLinkContest & 1)
{
u16 var = sub_80DB8B8(gContestPlayerMonIndex);
u16 var = GetChosenMove(gContestPlayerMonIndex);
u8 taskId2;
gContestResources->field_4[gContestPlayerMonIndex].currMove = var;
@ -934,7 +939,7 @@ void sub_80D8A88(u8 taskId)
for (i = 0; i + gNumLinkContestPlayers < 4; i++)
{
gContestResources->field_4[gNumLinkContestPlayers + i].currMove = sub_80DB8B8(gNumLinkContestPlayers + i);
gContestResources->field_4[gNumLinkContestPlayers + i].currMove = GetChosenMove(gNumLinkContestPlayers + i);
}
}
gTasks[taskId].data[0] = 0;
@ -2740,3 +2745,300 @@ bool8 sub_80DB798(u8 a)
}
return r9;
}
void sub_80DB884(void)
{
s32 i;
for (i = 0; i < 4; i++)
sub_80DB798(i);
}
void sub_80DB89C(void)
{
FillWindowPixelBuffer(4, 0);
CopyWindowToVram(4, 2);
Contest_SetBgCopyFlags(0);
}
u16 GetChosenMove(u8 a)
{
if (Contest_IsMonsTurnDisabled(a))
return 0;
if (a == gContestPlayerMonIndex)
{
return gContestMons[a].moves[sContest.playerMoveChoice];
}
else
{
u8 moveChoice;
ContestAI_ResetAI(a);
moveChoice = ContestAI_GetActionToUse();
return gContestMons[a].moves[moveChoice];
}
}
void sub_80DB918(void)
{
s32 i;
for (i = 0; i < 4; i++)
sContestantStatus[i].currMove = GetChosenMove(i);
}
void sub_80DB944(void)
{
s32 i;
s32 j;
s16 arr[4];
for (i = 0; i < 4; i++)
{
sContestantStatus[i].unk4 += sContestantStatus[i].appeal2;
arr[i] = sContestantStatus[i].unk4;
}
for (i = 0; i < 3; i++)
{
for (j = 3; j > i; j--)
{
if (arr[j - 1] < arr[j])
{
u16 temp = arr[j];
arr[j] = arr[j - 1];
arr[j - 1] = temp;
}
}
}
for (i = 0; i < 4; i++)
{
for (j = 0; j < 4; j++)
{
if (sContestantStatus[i].unk4 == arr[j])
{
sContestantStatus[i].unkB_0 = j;
break;
}
}
}
sub_80DCE58(1);
sub_80DD590();
}
void sub_80DBA18(void)
{
s32 i;
for (i = 0; i < 4; i++)
{
u8 attentionLevel;
if (sContestantStatus[i].currMove == MOVE_NONE)
attentionLevel = 5;
else if (sContestantStatus[i].appeal2 <= 0)
attentionLevel = 0;
else if (sContestantStatus[i].appeal2 < 30)
attentionLevel = 1;
else if (sContestantStatus[i].appeal2 < 60)
attentionLevel = 2;
else if (sContestantStatus[i].appeal2 < 80)
attentionLevel = 3;
else
attentionLevel = 4;
sContestantStatus[i].attentionLevel = attentionLevel;
}
}
bool8 sub_80DBA68(u8 a)
{
if (sContestantStatus[a].numTurnsSkipped != 0 || sContestantStatus[a].noMoreTurns)
return FALSE;
else
return TRUE;
}
void sub_80DBAA0(void)
{
s32 i;
for (i = 0; i < 4; i++)
{
sContestantStatus[i].appeal2 = 0;
sContestantStatus[i].appeal1 = 0;
sContestantStatus[i].jamSafetyCount = 0;
if (sContestantStatus[i].numTurnsSkipped > 0)
sContestantStatus[i].numTurnsSkipped--;
sContestantStatus[i].jam = 0;
sContestantStatus[i].resistant = 0;
sContestantStatus[i].jamReduction = 0;
sContestantStatus[i].immune = 0;
sContestantStatus[i].moreEasilyStartled = 0;
sContestantStatus[i].usedRepeatableMove = 0;
sContestantStatus[i].nervous = 0;
sContestantStatus[i].effectStringId = CONTEST_STRING_NONE;
sContestantStatus[i].effectStringId2 = CONTEST_STRING_NONE;
sContestantStatus[i].conditionMod = 0;
sContestantStatus[i].unk15_2 = sContestantStatus[i].disappointedRepeat;
sContestantStatus[i].disappointedRepeat = FALSE;
sContestantStatus[i].turnOrderModAction = 0;
sContestantStatus[i].appealTripleCondition = 0;
if (sContestantStatus[i].turnSkipped)
{
sContestantStatus[i].numTurnsSkipped = 1;
sContestantStatus[i].turnSkipped = 0;
}
if (sContestantStatus[i].exploded)
{
sContestantStatus[i].noMoreTurns = 1;
sContestantStatus[i].exploded = 0;
}
sContestantStatus[i].overrideCategoryExcitementMod = 0;
}
for (i = 0; i < 4; i++)
{
sContestantStatus[i].prevMove = sContestantStatus[i].currMove;
sContest.unk19220[sContest.turnNumber][i] = sContestantStatus[i].currMove;
sContest.unk19248[sContest.turnNumber][i] = Contest_GetMoveExcitement(sContestantStatus[i].currMove);
sContestantStatus[i].currMove = MOVE_NONE;
}
shared19328.excitementFrozen = 0;
}
bool8 Contest_IsMonsTurnDisabled(u8 a)
{
if (sContestantStatus[a].numTurnsSkipped != 0 || sContestantStatus[a].noMoreTurns)
return TRUE;
else
return FALSE;
}
void sub_80DBCE0(u8 a)
{
gUnknown_02039F18[a] = sub_80DBD34(a);
gUnknown_02039F08[a] = gContestMonConditions[a] + gUnknown_02039F18[a];
}
void sub_80DBD18(void)
{
s32 i;
for (i = 0; i < 4; i++)
sub_80DBCE0(i);
DetermineFinalStandings();
}
s16 sub_80DBD34(u8 a)
{
return gUnknown_02039F10[a] * 2;
}
void DetermineFinalStandings(void)
{
u16 sp0[4] = {0};
struct UnknownContestStruct6 sp8[4];
s32 i;
s32 j;
for (i = 0; i < 4; i++)
{
s32 r2;
sp0[i] = Random();
for (r2 = 0; r2 < i; r2++)
{
if (sp0[i] == sp0[r2])
{
i--;
break;
}
}
}
for (i = 0; i < 4; i++)
{
sp8[i].unk0 = gUnknown_02039F08[i];
sp8[i].unk4 = gContestMonConditions[i];
sp8[i].unk8 = sp0[i];
sp8[i].unkC = i;
}
for (i = 0; i < 3; i++)
{
for (j = 3; j > i; j--)
{
if (sub_80DBF30(j - 1, j, sp8))
{
struct UnknownContestStruct6 temp;
temp.unk0 = sp8[j - 1].unk0;
temp.unk4 = sp8[j - 1].unk4;
temp.unk8 = sp8[j - 1].unk8;
temp.unkC = sp8[j - 1].unkC;
sp8[j - 1].unk0 = sp8[j].unk0;
sp8[j - 1].unk4 = sp8[j].unk4;
sp8[j - 1].unk8 = sp8[j].unk8;
sp8[j - 1].unkC = sp8[j].unkC;
sp8[j].unk0 = temp.unk0;
sp8[j].unk4 = temp.unk4;
sp8[j].unk8 = temp.unk8;
sp8[j].unkC = temp.unkC;
}
}
}
for (i = 0; i < 4; i++)
gContestFinalStandings[sp8[i].unkC] = i;
}
void sub_80DBED4(void)
{
if ((gIsLinkContest & 1))
{
gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] =
((gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1) > 0x270F) ? 0x270F :
(gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1);
}
}
bool8 sub_80DBF30(s32 a, s32 b, struct UnknownContestStruct6 *c)
{
bool8 retVal;
if (c[a].unk0 < c[b].unk0)
retVal = TRUE;
else if (c[a].unk0 > c[b].unk0)
retVal = FALSE;
else if (c[a].unk4 < c[b].unk4)
retVal = TRUE;
else if (c[a].unk4 > c[b].unk4)
retVal = FALSE;
else if (c[a].unk8 < c[b].unk8)
retVal = TRUE;
else
retVal = FALSE;
return retVal;
}
void sub_80DBF68(void)
{
gBattle_BG0_Y = 0;
gBattle_BG2_Y = 0;
sub_80DB89C();
Contest_StartTextPrinter((u8*) &gUnknown_0827E8DA, 0);
}
void sub_80DBF90(void)
{
u16 temp = BGCNT_WRAP;
s32 i;
for(i = 3; i >= 0; i--)
{
ContestBG_FillBoxWithIncrementingTile(0, temp, 0, 0x16, 0, 0, 0, 0);
}
}