diff --git a/asm/contest.s b/asm/contest.s index 327a80d75..85299a8f7 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,352 +5,6 @@ .text - thumb_func_start TaskDummy1 -TaskDummy1: @ 80D7668 - bx lr - thumb_func_end TaskDummy1 - - thumb_func_start ResetLinkContestBoolean -ResetLinkContestBoolean: @ 80D766C - ldr r1, =gUnknown_02039F2A - movs r0, 0 - strb r0, [r1] - bx lr - .pool - thumb_func_end ResetLinkContestBoolean - - thumb_func_start sub_80D7678 -sub_80D7678: @ 80D7678 - push {r4,lr} - movs r0, 0 - movs r1, 0x40 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - ldr r4, =0x00003f3f - movs r0, 0x48 - adds r1, r4, 0 - bl SetGpuReg - movs r0, 0x4A - adds r1, r4, 0 - bl SetGpuReg - movs r1, 0xFE - lsls r1, 7 - movs r0, 0 - bl SetGpuRegBits - ldr r0, =gBattle_BG0_X - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG0_Y - strh r1, [r0] - ldr r0, =gBattle_BG1_X - strh r1, [r0] - ldr r0, =gBattle_BG1_Y - strh r1, [r0] - ldr r0, =gBattle_BG2_X - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - ldr r0, =gBattle_BG3_X - strh r1, [r0] - ldr r0, =gBattle_BG3_Y - strh r1, [r0] - ldr r0, =gBattle_WIN0H - strh r1, [r0] - ldr r0, =gBattle_WIN0V - strh r1, [r0] - ldr r0, =gBattle_WIN1H - strh r1, [r0] - ldr r0, =gBattle_WIN1V - strh r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D7678 - - thumb_func_start LoadContestBgAfterMoveAnim -LoadContestBgAfterMoveAnim: @ 80D7724 - push {r4,r5,lr} - ldr r0, =gUnknown_08C17AB0 - movs r1, 0xC0 - lsls r1, 19 - bl LZDecompressVram - ldr r0, =gUnknown_08C1850C - ldr r1, =0x06002000 - bl LZDecompressVram - ldr r1, =gUnknown_08C16FA8 - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - ldr r0, =gUnknown_08C16E90 - movs r2, 0x80 - lsls r2, 2 - movs r1, 0 - bl LoadCompressedPalette - bl sub_80D782C - movs r4, 0 - movs r5, 0xA0 -_080D775E: - ldr r0, =0x0201a004 - adds r0, r5, r0 - ldr r1, =gUnknown_02039F26 - adds r1, r4, r1 - ldrb r1, [r1] - adds r1, 0x5 - lsls r1, 4 - movs r2, 0x20 - bl LoadPalette - adds r5, 0x20 - adds r4, 0x1 - cmp r4, 0x3 - ble _080D775E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end LoadContestBgAfterMoveAnim - - thumb_func_start sub_80D779C -sub_80D779C: @ 80D779C - push {r4,lr} - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_08587F34 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0x3 - movs r1, 0x6 - movs r2, 0x1 - bl SetBgAttribute - movs r4, 0 -_080D77BA: - lsls r0, r4, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - lsls r2, r4, 2 - adds r1, 0x24 - adds r1, r2 - ldr r1, [r1] - bl SetBgTilemapBuffer - adds r4, 0x1 - cmp r4, 0x3 - ble _080D77BA - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D779C - - thumb_func_start sub_80D77E4 -sub_80D77E4: @ 80D77E4 - push {lr} - ldr r0, =gUnknown_08587F44 - bl InitWindows - bl DeactivateAllTextPrinters - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D7818 - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - b _080D7822 - .pool -_080D7818: - ldr r0, =gTextFlags - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] -_080D7822: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D77E4 - - thumb_func_start sub_80D782C -sub_80D782C: @ 80D782C - push {r4,r5,lr} - ldr r0, =gUnknown_08587C30 - movs r1, 0xF0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0 - movs r1, 0 - movs r2, 0x2 - bl FillPalette - movs r5, 0xA - movs r4, 0xFA - lsls r4, 16 -_080D7848: - lsrs r1, r4, 16 - ldr r0, =gPlttBufferUnfaded + 0x1E2 - movs r2, 0x2 - bl LoadPalette - movs r0, 0x80 - lsls r0, 9 - adds r4, r0 - adds r5, 0x1 - cmp r5, 0xD - ble _080D7848 - ldr r0, =0x00007e3f - movs r1, 0xF3 - movs r2, 0x2 - bl FillPalette - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D782C - - thumb_func_start sub_80D787C -sub_80D787C: @ 80D787C - push {r4-r7,lr} - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - movs r1, 0 - movs r2, 0x5C - bl memset - movs r5, 0 - movs r2, 0xFF -_080D7890: - ldr r0, [r4] - ldr r1, [r0] - adds r1, 0x2 - adds r1, r5 - ldrb r0, [r1] - orrs r0, r2 - strb r0, [r1] - adds r5, 0x1 - cmp r5, 0x3 - ble _080D7890 - movs r4, 0 - ldr r6, =gContestResources - movs r5, 0x3 -_080D78AA: - ldr r0, [r6] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - movs r1, 0 - movs r2, 0x1C - bl memset - adds r4, 0x1C - subs r5, 0x1 - cmp r5, 0 - bge _080D78AA - ldr r4, =gContestResources - movs r7, 0x4 - negs r7, r7 - movs r6, 0xFF - movs r3, 0 - movs r5, 0x3 -_080D78CC: - ldr r0, [r4] - ldr r1, [r0, 0x4] - adds r1, r3, r1 - ldrb r2, [r1, 0xB] - adds r0, r7, 0 - ands r0, r2 - strb r0, [r1, 0xB] - ldr r0, [r4] - ldr r1, [r0, 0x4] - adds r1, r3, r1 - ldrb r0, [r1, 0x13] - orrs r0, r6 - strb r0, [r1, 0x13] - ldr r0, [r4] - ldr r1, [r0, 0x4] - adds r1, r3, r1 - ldrb r0, [r1, 0x14] - orrs r0, r6 - strb r0, [r1, 0x14] - adds r3, 0x1C - subs r5, 0x1 - cmp r5, 0 - bge _080D78CC - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0, 0x8] - movs r1, 0 - movs r2, 0x14 - bl memset - ldr r0, [r4] - ldr r0, [r0, 0xC] - movs r1, 0 - movs r2, 0x44 - bl memset - ldr r2, [r4] - ldr r1, [r2, 0x10] - movs r0, 0 - str r0, [r1] - ldr r0, [r2, 0x14] - movs r1, 0 - movs r2, 0x10 - bl memset - ldr r0, =gUnknown_02039F2A - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080D7938 - movs r0, 0 - bl sub_80DCE58 -_080D7938: - movs r5, 0 - adds r2, r4, 0 - movs r6, 0xFF - movs r3, 0 - ldr r4, =gUnknown_02039F26 -_080D7942: - ldr r0, [r2] - ldr r1, [r0, 0x4] - adds r1, r3, r1 - ldrb r0, [r1, 0x19] - orrs r0, r6 - strb r0, [r1, 0x19] - ldr r0, [r2] - ldr r1, [r0] - adds r1, 0x14 - adds r1, r5 - adds r0, r5, r4 - ldrb r0, [r0] - strb r0, [r1] - adds r3, 0x1C - adds r5, 0x1 - cmp r5, 0x3 - ble _080D7942 - bl sub_80DD590 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x1C] - movs r1, 0 - movs r2, 0x40 - bl memset - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D787C - thumb_func_start sub_80D7988 sub_80D7988: @ 80D7988 push {r4,r5,lr} @@ -634,7 +288,7 @@ _080D7C04: strb r0, [r1, 0x8] ldr r0, =sub_80D823C bl SetMainCallback2 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 @@ -683,7 +337,7 @@ sub_80D7CB4: @ 80D7CB4 push {r4-r6,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -755,7 +409,7 @@ _080D7D3A: movs r0, 0x7F ands r0, r1 strb r0, [r2, 0x8] - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x2 ands r0, r1 @@ -917,14 +571,14 @@ _080D7E84: b _080D80AE .pool _080D7EC8: - ldr r0, =gUnknown_08C17AB0 + ldr r0, =gContestMiscGfx movs r1, 0xC0 lsls r1, 19 bl LZDecompressVram b _080D80AE .pool _080D7ED8: - ldr r0, =gUnknown_08C1850C + ldr r0, =gContestAudienceGfx ldr r4, =0x06002000 adds r1, r4, 0 bl LZDecompressVram @@ -997,7 +651,7 @@ _080D7F7C: mov r1, sp adds r2, r6, 0 bl CpuSet - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex mov r9, r0 ldrb r0, [r0] adds r0, 0x5 @@ -1409,7 +1063,7 @@ sub_80D833C: @ 80D833C movs r2, 0 movs r3, 0x1 bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] bl sub_80DBCA8 lsls r0, 24 @@ -1474,7 +1128,7 @@ sub_80D8424: @ 80D8424 _080D843C: movs r0, 0x5 bl PlaySE - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] bl sub_80DBCA8 lsls r0, 24 @@ -1523,9 +1177,9 @@ sub_80D8490: @ 80D8490 ldr r0, =gBattle_BG2_Y strh r1, [r0] movs r6, 0 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex mov r8, r0 - ldr r2, =gUnknown_02039E00 + 30 + ldr r2, =gContestMons + 30 mov r10, r2 ldr r7, =gContestResources _080D84B8: @@ -1639,12 +1293,12 @@ _080D856C: lsls r0, 24 asrs r0, 24 bl sub_80D880C - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, [r4] ldr r0, [r0] ldrb r1, [r0] lsls r1, 1 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] lsls r0, 6 adds r1, r0 @@ -1678,8 +1332,8 @@ sub_80D8610: @ 80D8610 lsrs r7, r0, 24 movs r6, 0 ldr r3, =gMain - ldr r1, =gUnknown_02039E00 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestMons + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] lsls r0, 6 adds r1, 0x1E @@ -1746,7 +1400,7 @@ _080D868E: movs r2, 0 movs r3, 0x1 bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] bl sub_80DBCA8 lsls r0, 24 @@ -1811,12 +1465,12 @@ _080D8756: lsls r0, 24 asrs r0, 24 bl sub_80D880C - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, [r4] ldr r0, [r0] ldrb r1, [r0] lsls r1, 1 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] lsls r0, 6 adds r1, r0 @@ -1858,12 +1512,12 @@ _080D87C4: lsls r0, 24 asrs r0, 24 bl sub_80D880C - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, [r4] ldr r0, [r0] ldrb r1, [r0] lsls r1, 1 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] lsls r0, 6 adds r1, r0 @@ -1958,13 +1612,13 @@ sub_80D8894: @ 80D8894 push {r4,r5,lr} lsls r0, 24 lsrs r5, r0, 24 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 cmp r0, 0 beq _080D890C - ldr r4, =gUnknown_02039F25 + ldr r4, =gContestPlayerMonIndex ldrb r0, [r4] bl sub_80DB8B8 ldr r1, =gContestResources @@ -2194,7 +1848,7 @@ sub_80D8A88: @ 80D8A88 ldr r0, =gRngValue ldr r0, [r0] str r0, [r1, 0x18] - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -2374,7 +2028,7 @@ _080D8C9C: ldr r0, [r4] ldr r2, [r0] ldrb r6, [r2, 0x11] - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r5, 0x1 adds r0, r5, 0 @@ -2513,7 +2167,7 @@ _080D8DD0: ldr r0, [r0] ldrb r0, [r0, 0x11] bl sub_80DE9DC - ldr r4, =gUnknown_02039E00 + ldr r4, =gContestMons ldr r0, [r5] ldr r0, [r0] ldrb r3, [r0, 0x11] @@ -2624,7 +2278,7 @@ _080D8EF2: bl sub_80DB89C ldr r0, =gStringVar1 lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy mov r2, r9 @@ -3562,7 +3216,7 @@ _080D96D4: bl sub_80DB89C ldr r0, =gStringVar1 lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r4, =gStringVar4 @@ -3671,7 +3325,7 @@ _080D97DC: bl sub_80DB89C ldr r0, =gStringVar1 lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r4, =gStringVar4 @@ -3809,7 +3463,7 @@ _080D9904: bl sub_80DB89C ldr r0, =gStringVar1 lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r4, =gStringVar4 @@ -4010,7 +3664,7 @@ _080D9AD2: bl sub_80DB89C ldr r0, =gStringVar1 lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r4, =gContestResources @@ -4381,7 +4035,7 @@ _080D9DD4: lsls r1, 20 lsrs r1, 29 lsls r1, 6 - ldr r4, =gUnknown_02039E00 + 2 + ldr r4, =gContestMons + 2 adds r1, r4 bl StringCopy ldr r0, =gStringVar1 @@ -4476,7 +4130,7 @@ _080D9EDC: bl sub_80DC9B4 ldr r0, =gStringVar1 lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r0, =gStringVar2 @@ -4626,7 +4280,7 @@ _080DA038: bl sub_80DB89C ldr r0, =gStringVar1 lsls r1, r6, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r4, =gStringVar4 @@ -4822,7 +4476,7 @@ _080DA1C0: beq _080DA248 b _080DA250 _080DA1C6: - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r6, 0x1 adds r0, r6, 0 @@ -5084,7 +4738,7 @@ sub_80DA3CC: @ 80DA3CC bne _080DA448 ldr r0, =gContestResources ldr r0, [r0] - ldr r5, =gUnknown_02039F25 + ldr r5, =gContestPlayerMonIndex ldrb r1, [r5] ldr r2, [r0, 0x4] lsls r0, r1, 3 @@ -5096,7 +4750,7 @@ sub_80DA3CC: @ 80DA3CC ldr r0, =gStringVar1 ldrb r1, [r5] lsls r1, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r5, =gStringVar4 @@ -5344,7 +4998,7 @@ _080DA600: bge _080DA600 bl sub_80DBD18 bl sub_80DB89C - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -5352,7 +5006,7 @@ _080DA600: bne _080DA65C ldr r0, =gContestResources ldr r2, [r0] - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r1, [r0] ldr r2, [r2, 0x4] lsls r0, r1, 3 @@ -5479,7 +5133,7 @@ sub_80DA740: @ 80DA740 ble _080DA794 movs r0, 0 strh r0, [r4, 0x8] - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r0, [r0] movs r1, 0x1 ands r1, r0 @@ -5608,13 +5262,13 @@ sub_80DA874: @ 80DA874 thumb_func_start sub_80DA884 sub_80DA884: @ 80DA884 push {lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 cmp r0, 0 bne _080DA898 - ldr r1, =gUnknown_02039F25 + ldr r1, =gContestPlayerMonIndex movs r0, 0x3 strb r0, [r1] _080DA898: @@ -5626,7 +5280,7 @@ _080DA898: thumb_func_start sub_80DA8A4 sub_80DA8A4: @ 80DA8A4 push {lr} - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldr r1, =gUnknown_02039F2B ldrb r0, [r0] ldrb r1, [r1] @@ -5655,7 +5309,7 @@ sub_80DA8C8: @ 80DA8C8 ldr r1, [r6] mov r0, sp bl StringCopy - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -5664,10 +5318,10 @@ sub_80DA8C8: @ 80DA8C8 mov r0, sp bl sub_80DF9D4 _080DA8F2: - ldr r5, =gUnknown_02039F25 + ldr r5, =gContestPlayerMonIndex ldrb r0, [r5] lsls r0, 6 - ldr r4, =gUnknown_02039E00 + 13 + ldr r4, =gContestMons + 13 adds r0, r4 mov r1, sp movs r2, 0x8 @@ -5689,8 +5343,8 @@ _080DA928: movs r1, 0xD9 _080DA930: strb r1, [r0, 0x8] - ldr r7, =gUnknown_02039E00 - ldr r6, =gUnknown_02039F25 + ldr r7, =gContestMons + ldr r6, =gContestPlayerMonIndex ldrb r0, [r6] lsls r0, 6 adds r1, r7, 0 @@ -5721,7 +5375,7 @@ _080DA930: bl GetMonData mov r0, sp bl StringGetEnd10 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -5934,8 +5588,8 @@ _080DAB36: ble _080DAB40 movs r4, 0xFF _080DAB40: - ldr r2, =gUnknown_02039E00 - ldr r1, =gUnknown_02039F25 + ldr r2, =gContestMons + ldr r1, =gContestPlayerMonIndex ldrb r0, [r1] lsls r0, 6 adds r0, r2 @@ -5989,7 +5643,7 @@ sub_80DAB8C: @ 80DAB8C lsls r0, 24 cmp r0, 0 beq _080DABC0 - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -6079,7 +5733,7 @@ _080DAC50: bl __modsi3 lsls r0, 16 lsrs r0, 16 - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons lsls r2, r5, 6 adds r2, r1 mov r1, sp @@ -6221,7 +5875,7 @@ _080DAD56: subs r0, r1 cmp r5, r0 bge _080DADF6 - ldr r3, =gUnknown_02039E00 + ldr r3, =gContestMons mov r8, r3 mov r6, r9 movs r0, 0x2 @@ -6451,7 +6105,7 @@ sub_80DAF1C: @ 80DAF1C add r0, sp, 0x4 bl StringCopy lsls r1, r5, 6 - ldr r0, =gUnknown_02039E00 + 13 + ldr r0, =gContestMons + 13 adds r1, r0 add r0, sp, 0x4 bl StringAppend @@ -6508,7 +6162,7 @@ sub_80DAFA0: @ 80DAFA0 lsls r1, 24 lsrs r1, 24 lsls r0, r4, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r0, r2 bl sub_80DAED4 ldr r0, =gUnknown_02039F26 @@ -6550,7 +6204,7 @@ _080DAFFC: .4byte _080DB050 .4byte _080DB06C _080DB010: - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons lsls r2, 6 adds r1, r2, r0 adds r3, r1, 0 @@ -6562,7 +6216,7 @@ _080DB010: b _080DB07E .pool _080DB028: - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons lsls r2, 6 adds r1, r2, r0 adds r3, r1, 0 @@ -6574,7 +6228,7 @@ _080DB028: b _080DB07E .pool _080DB040: - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons lsls r2, 6 adds r3, r2, r1 adds r0, r3, 0 @@ -6582,7 +6236,7 @@ _080DB040: b _080DB05A .pool _080DB050: - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons lsls r2, 6 adds r3, r2, r1 adds r0, r3, 0 @@ -6597,7 +6251,7 @@ _080DB05A: b _080DB080 .pool _080DB06C: - ldr r0, =gUnknown_02039E00 + ldr r0, =gContestMons lsls r2, 6 adds r1, r2, r0 adds r3, r1, 0 @@ -6734,7 +6388,7 @@ sub_80DB174: @ 80DB174 adds r0, r5, 0 bl sub_80DE84C adds r5, r0, 0 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] cmp r4, r0 bne _080DB1B8 @@ -7632,7 +7286,7 @@ sub_80DB8B8: @ 80DB8B8 movs r0, 0 b _080DB90A _080DB8D0: - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] cmp r4, r0 beq _080DB8F4 @@ -7640,13 +7294,13 @@ _080DB8D0: bl sub_81562C4 bl sub_8156324 lsls r0, 24 - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons lsrs r0, 23 lsls r1, r4, 6 b _080DB902 .pool _080DB8F4: - ldr r2, =gUnknown_02039E00 + ldr r2, =gContestMons ldr r0, =gContestResources ldr r0, [r0] ldr r0, [r0] @@ -8415,7 +8069,7 @@ _080DBE90: ble _080DBE06 movs r6, 0 mov r9, r6 - ldr r2, =gUnknown_02039F20 + ldr r2, =gContestFinalStandings ldr r1, [sp, 0x6C] _080DBEA2: ldr r0, [r1] @@ -8442,7 +8096,7 @@ _080DBEA2: thumb_func_start sub_80DBED4 sub_80DBED4: @ 80DBED4 push {lr} - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -8450,8 +8104,8 @@ sub_80DBED4: @ 80DBED4 beq _080DBF0E ldr r0, =gSaveBlock2Ptr ldr r2, [r0] - ldr r1, =gUnknown_02039F20 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestFinalStandings + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] adds r0, r1 ldrb r1, [r0] @@ -11173,7 +10827,7 @@ sub_80DD45C: @ 80DD45C lsrs r6, r1, 24 ldr r0, =gStringVar1 lsls r1, r4, 6 - ldr r2, =gUnknown_02039E00 + 2 + ldr r2, =gContestMons + 2 adds r1, r2 bl StringCopy ldr r0, =gStringVar2 @@ -13165,7 +12819,7 @@ _080DE4E2: b _080DE5B4 .pool _080DE52C: - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r0, [r0] ands r1, r0 cmp r1, 0 @@ -13594,7 +13248,7 @@ sub_80DE864: @ 80DE864 bl sub_80DE834 lsls r0, 16 lsrs r5, r0, 16 - ldr r1, =gUnknown_02039E00 + ldr r1, =gContestMons lsls r0, r7, 6 adds r0, r1 ldrh r0, [r0] @@ -13675,7 +13329,7 @@ _080DE920: lsls r0, 2 adds r0, r1 ldrb r4, [r0, 0x1B] - ldr r5, =gUnknown_02039E00 + ldr r5, =gContestMons lsls r4, 6 adds r0, r4, r5 ldrh r0, [r0] @@ -13767,7 +13421,7 @@ sub_80DE9DC: @ 80DE9DC ldr r0, [r6] ldr r0, [r0, 0x18] strb r4, [r0, 0x5] - ldr r5, =gUnknown_02039E00 + ldr r5, =gContestMons lsls r4, 6 adds r0, r4, r5 ldrh r0, [r0] @@ -14057,7 +13711,7 @@ sub_80DEC30: @ 80DEC30 bl AddTextPrinter b _080DECA4 _080DEC80: - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] adds r0, r5, 0 ands r0, r1 @@ -14236,7 +13890,7 @@ sub_80DEDA8: @ 80DEDA8 lsrs r0, 24 mov r8, r0 movs r5, 0 - ldr r1, =gUnknown_02039F20 + ldr r1, =gContestFinalStandings ldrb r0, [r1] cmp r0, 0 beq _080DEDE6 @@ -14252,7 +13906,7 @@ _080DEDE6: ldr r0, [sp] cmp r0, 0xFF bne _080DEE00 - ldr r0, =gUnknown_02039F25 + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] cmp r5, r0 beq _080DEE00 @@ -14316,7 +13970,7 @@ _080DEE54: ldr r6, =0x00002e90 adds r2, r0, r6 adds r2, r7 - ldr r4, =gUnknown_02039E00 + ldr r4, =gContestMons lsls r5, 6 adds r1, r4, 0 adds r1, 0x38 @@ -14351,7 +14005,7 @@ _080DEE54: adds r5, r4 adds r1, r5, 0 bl StringCopy - ldr r0, =gUnknown_02039F2A + ldr r0, =gIsLinkContest ldrb r1, [r0] movs r0, 0x1 ands r0, r1 @@ -14404,7 +14058,7 @@ _080DEF34: .pool _080DEF50: ldr r6, =gUnknown_02039F3C - ldr r4, =gUnknown_02039E00 + ldr r4, =gContestMons lsls r5, 6 adds r0, r4, 0 adds r0, 0x38 @@ -14820,7 +14474,7 @@ sub_80DF250: @ 80DF250 mov r7, sp adds r7, 0x2 str r7, [sp, 0x24] - ldr r5, =gUnknown_02039F20 + ldr r5, =gContestFinalStandings movs r2, 0 movs r3, 0x80 lsls r3, 17 @@ -14921,7 +14575,7 @@ _080DF322: _080DF336: cmp r5, 0x4 bne _080DF354 - ldr r1, =gUnknown_02039F20 + ldr r1, =gContestFinalStandings adds r0, r4, r1 ldrb r0, [r0] cmp r0, 0 @@ -15156,8 +14810,8 @@ sub_80DF4F8: @ 80DF4F8 mov r5, r8 push {r5-r7} sub sp, 0xC - ldr r1, =gUnknown_02039F20 - ldr r0, =gUnknown_02039F25 + ldr r1, =gContestFinalStandings + ldr r0, =gContestPlayerMonIndex ldrb r0, [r0] adds r0, r1 ldrb r0, [r0] diff --git a/asm/contest_ai.s b/asm/contest_ai.s index 3438107eb..217044e9f 100644 --- a/asm/contest_ai.s +++ b/asm/contest_ai.s @@ -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] @@ -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] @@ -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] diff --git a/asm/contest_link_80F57C4.s b/asm/contest_link_80F57C4.s index 450a235d5..88629fb83 100644 --- a/asm/contest_link_80F57C4.s +++ b/asm/contest_link_80F57C4.s @@ -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 @@ -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 @@ -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} @@ -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 diff --git a/asm/contest_link_80FC4F4.s b/asm/contest_link_80FC4F4.s index 621e26038..3ba383f0b 100644 --- a/asm/contest_link_80FC4F4.s +++ b/asm/contest_link_80FC4F4.s @@ -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 @@ -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 diff --git a/asm/contest_link_81D9DE4.s b/asm/contest_link_81D9DE4.s index 12eb159f7..4f392587a 100644 --- a/asm/contest_link_81D9DE4.s +++ b/asm/contest_link_81D9DE4.s @@ -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 @@ -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 diff --git a/asm/script_pokemon_util_80F87D8.s b/asm/script_pokemon_util_80F87D8.s index b241e3778..eeb50cd84 100644 --- a/asm/script_pokemon_util_80F87D8.s +++ b/asm/script_pokemon_util_80F87D8.s @@ -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] @@ -222,7 +222,7 @@ sub_80F8970: @ 80F8970 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,7 +973,7 @@ _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 @@ -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 diff --git a/data/graphics.s b/data/graphics.s index 8527e570d..9a348d9ee 100644 --- a/data/graphics.s +++ b/data/graphics.s @@ -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 diff --git a/include/contest.h b/include/contest.h index d920117f3..7b49e71a9 100644 --- a/include/contest.h +++ b/include/contest.h @@ -1,21 +1,241 @@ #ifndef GUARD_CONTEST_H #define GUARD_CONTEST_H -struct ContestStruct_02039E00 +enum { - u16 unk_00; - u8 unk_02[11]; - u8 unk_0d[8]; - u8 filler_15[9]; - u8 filler_1E[34]; + CONTEST_CATEGORY_COOL, + CONTEST_CATEGORY_BEAUTY, + CONTEST_CATEGORY_CUTE, + CONTEST_CATEGORY_SMART, + CONTEST_CATEGORY_TOUGH, }; -extern struct ContestStruct_02039E00 gUnknown_02039E00[4]; +enum +{ + 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 +}; + +enum +{ + 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 +}; + +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 @@ -28,17 +248,153 @@ 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 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)[4]; struct ContestStruct_field_18 *field_18; + struct ContestResourcesField1C * field_1c; + u8 filler_20[4]; + u8 * field_24[4]; }; +#define shared18000 (*(struct Shared18000 *)(gHeap + 0x1a000)) + extern struct ContestResources *gContestResources; bool8 IsSpeciesNotUnown(u16 species); diff --git a/ld_script.txt b/ld_script.txt index 2832bcada..b241de263 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -138,6 +138,7 @@ SECTIONS { asm/battle_anim_80D51AC.o(.text); src/item.o(.text); asm/item.o(.text); + src/contest.o(.text); asm/contest.o(.text); asm/shop.o(.text); src/berry.o(.text); diff --git a/src/contest.c b/src/contest.c new file mode 100644 index 000000000..08d4f9b57 --- /dev/null +++ b/src/contest.c @@ -0,0 +1,196 @@ +#include "global.h" +#include "gpu_regs.h" +#include "bg.h" +#include "malloc.h" +#include "constants/items.h" +#include "constants/map_objects.h" +#include "constants/moves.h" +#include "constants/songs.h" +#include "constants/species.h" +#include "battle.h" +#include "battle_anim.h" +#include "blend_palette.h" +#include "contest.h" +#include "data2.h" +#include "decompress.h" +#include "graphics.h" +#include "link.h" +#include "m4a.h" +#include "main.h" +#include "menu.h" +#include "overworld.h" +#include "palette.h" +#include "random.h" +#include "script.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "task.h" +#include "text.h" +#include "tv.h" +#include "scanline_effect.h" +#include "util.h" + +void sub_80DD590(void); +void sub_80D782C(void); +void sub_80DCE58(u8); + +EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; +EWRAM_DATA s16 gUnknown_02039F00[4] = {0}; +EWRAM_DATA s16 gUnknown_02039F08[4] = {0}; +EWRAM_DATA s16 gUnknown_02039F10[4] = {0}; +EWRAM_DATA s16 gUnknown_02039F18[4] = {0}; +EWRAM_DATA u8 gContestFinalStandings[4] = {0}; +EWRAM_DATA u8 gUnknown_02039F24 = 0; +EWRAM_DATA u8 gContestPlayerMonIndex = 0; +EWRAM_DATA u8 gUnknown_02039F26[4] = {0}; +EWRAM_DATA bool8 gIsLinkContest = FALSE; +EWRAM_DATA u8 gUnknown_02039F2B = 0; +EWRAM_DATA u16 gSpecialVar_ContestCategory = 0; +EWRAM_DATA u16 gSpecialVar_ContestRank = 0; + +extern u16 gBattle_BG0_X; +extern u16 gBattle_BG0_Y; +extern u16 gBattle_BG1_X; +extern u16 gBattle_BG1_Y; +extern u16 gBattle_BG2_X; +extern u16 gBattle_BG2_Y; +extern u16 gBattle_BG3_X; +extern u16 gBattle_BG3_Y; +extern u16 gBattle_WIN0H; +extern u16 gBattle_WIN0V; +extern u16 gBattle_WIN1H; +extern u16 gBattle_WIN1V; + +extern const u8 gContestMiscGfx[]; +extern const u8 gContestAudienceGfx[]; +extern const u8 gUnknown_08C16FA8[]; +extern const u8 gUnknown_08C16E90[]; +extern const struct BgTemplate gUnknown_08587F34[4]; +extern const struct WindowTemplate gUnknown_08587F44[]; +extern const u16 gUnknown_08587C30[]; + +void TaskDummy1(u8 taskId) +{ +} + +void ResetLinkContestBoolean(void) +{ + gIsLinkContest = FALSE; +} + +void sub_80D7678(void) +{ + u16 savedIme; + + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_WININ, 0x3F3F); + SetGpuReg(REG_OFFSET_WINOUT, 0x3F3F); + SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); + + gBattle_BG0_X = 0; + gBattle_BG0_Y = 0; + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + gBattle_BG2_X = 0; + gBattle_BG2_Y = 0; + gBattle_BG3_X = 0; + gBattle_BG3_Y = 0; + gBattle_WIN0H = 0; + gBattle_WIN0V = 0; + gBattle_WIN1H = 0; + gBattle_WIN1V = 0; +} + +void LoadContestBgAfterMoveAnim(void) +{ + s32 i; + + LZDecompressVram(gContestMiscGfx, (void *)VRAM); + LZDecompressVram(gContestAudienceGfx, (void *)(VRAM + 0x2000)); + CopyToBgTilemapBuffer(3, gUnknown_08C16FA8, 0, 0); + CopyBgTilemapBufferToVram(3); + LoadCompressedPalette(gUnknown_08C16E90, 0, 0x200); + sub_80D782C(); + for (i = 0; i < 4; i++) + { + u32 var = 5 + i; + + LoadPalette(shared18000.unk18004[var], 16 * (5 + gUnknown_02039F26[i]), 16 * sizeof(u16)); + } +} + +void sub_80D779C(void) +{ + s32 i; + + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_08587F34, ARRAY_COUNT(gUnknown_08587F34)); + SetBgAttribute(3, BG_CTRL_ATTR_PRIORITY, 1); + for (i = 0; i < 4; i++) + { + SetBgTilemapBuffer(i, gContestResources->field_24[i]); + } +} + +void sub_80D77E4(void) +{ + InitWindows(gUnknown_08587F44); + DeactivateAllTextPrinters(); + if (gIsLinkContest & 1) + { + gTextFlags.flag_0 = FALSE; + } + else + { + gTextFlags.flag_0 = TRUE; + } +} + +void sub_80D782C(void) +{ + s32 i; + + LoadPalette(gUnknown_08587C30, 0xf0, 0x20); + FillPalette(0, 0, 2); + for (i = 10; i < 14; i++) + LoadPalette(gPlttBufferUnfaded + 241, 240 + i, 2); + FillPalette(0x7E3F, 0xF3, 2); +} + +void sub_80D787C(void) +{ + s32 i; + + *gContestResources->field_0 = (struct Contest){}; + for (i = 0; i < 4; i++) + { + gContestResources->field_0->unk19206[i] = 0xFF; + } + for (i = 0; i < 4; i++) + { + gContestResources->field_4[i] = (struct ContestantStatus){}; + } + for (i = 0; i < 4; i++) + { + gContestResources->field_4[i].unkB_0 = 0; + gContestResources->field_4[i].effectStringId = CONTEST_STRING_NONE; + gContestResources->field_4[i].effectStringId2 = CONTEST_STRING_NONE; + } + *gContestResources->field_8 = (struct UnknownContestStruct7){}; + *gContestResources->field_C = (struct ContestAIInfo){}; + *gContestResources->field_10 = (struct UnknownContestStruct5){}; + memset(gContestResources->field_14, 0, 4 * sizeof(struct UnknownContestStruct4)); + if (!(gIsLinkContest & 1)) + sub_80DCE58(0); + for (i = 0; i < 4; i++) + { + gContestResources->field_4[i].nextTurnOrder = 0xFF; + gContestResources->field_0->unk19218[i] = gUnknown_02039F26[i]; + } + sub_80DD590(); + *gContestResources->field_1c = (struct ContestResourcesField1C){}; +} diff --git a/src/tv.c b/src/tv.c index b7c2812fe..769bd5080 100644 --- a/src/tv.c +++ b/src/tv.c @@ -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) diff --git a/sym_ewram.txt b/sym_ewram.txt index 9bf04d201..6ac45e645 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -419,44 +419,7 @@ gUnknown_02039DD0: @ 2039DD0 gBagPockets: @ 2039DD8 .space 0x28 -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 + .include "src/contest.o" gUnknown_02039F30: @ 2039F30 .space 0x1