From f9230e80aa1fd32d0428af9b684dcf4395148fc3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 2 May 2018 19:59:00 -0400 Subject: [PATCH] through vblank_cb_battle --- asm/contest.s | 514 +------------------------------------------- include/contest.h | 1 + include/gba/types.h | 11 + src/contest.c | 200 ++++++++++++++++- 4 files changed, 204 insertions(+), 522 deletions(-) diff --git a/asm/contest.s b/asm/contest.s index 0fa75185c8..4862bdb62e 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,518 +5,6 @@ .text - thumb_func_start sub_80D7E44 -sub_80D7E44: @ 80D7E44 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x40 - mov r10, r0 - ldrb r0, [r0] - cmp r0, 0x6 - bls _080D7E5A - b _080D80A4 -_080D7E5A: - lsls r0, 2 - ldr r1, =_080D7E68 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D7E68: - .4byte _080D7E84 - .4byte _080D7EC8 - .4byte _080D7ED8 - .4byte _080D7F28 - .4byte _080D7F40 - .4byte _080D7F7C - .4byte _080D8004 -_080D7E84: - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x8] - movs r1, 0xC0 - lsls r1, 19 - movs r4, 0x80 - lsls r4, 8 - movs r0, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl RequestDma3Fill - ldr r1, =0x06008000 - movs r0, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl RequestDma3Fill - ldr r1, =0x06010000 - movs r0, 0 - adds r2, r4, 0 - movs r3, 0x1 - bl RequestDma3Fill - b _080D80AE - .pool -_080D7EC8: - ldr r0, =gContestMiscGfx - movs r1, 0xC0 - lsls r1, 19 - bl LZDecompressVram - b _080D80AE - .pool -_080D7ED8: - ldr r0, =gContestAudienceGfx - ldr r4, =0x06002000 - adds r1, r4, 0 - bl LZDecompressVram - ldr r3, =0x02018000 - movs r5, 0x80 - lsls r5, 6 - ldr r1, =0x040000d4 - ldr r6, =0x84000400 - movs r2, 0x80 - lsls r2, 5 - movs r7, 0x84 - lsls r7, 24 -_080D7EF4: - str r4, [r1] - str r3, [r1, 0x4] - str r6, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r4, r2 - adds r3, r2 - subs r5, r2 - cmp r5, r2 - bhi _080D7EF4 - str r4, [r1] - str r3, [r1, 0x4] - lsrs r0, r5, 2 - orrs r0, r7 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - b _080D80AE - .pool -_080D7F28: - ldr r1, =gUnknown_08C16FA8 - movs r0, 0x3 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - b _080D80AE - .pool -_080D7F40: - ldr r1, =gUnknown_08C17170 - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x2C] - ldr r2, =0x0201aa04 - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x84000200 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - b _080D80AE - .pool -_080D7F7C: - ldr r0, =gUnknown_08C16E90 - movs r2, 0x80 - lsls r2, 2 - movs r1, 0 - bl LoadCompressedPalette - ldr r5, =gPlttBufferUnfaded + 0x100 - ldr r6, =0x04000008 - adds r0, r5, 0 - mov r1, sp - adds r2, r6, 0 - bl CpuSet - ldr r0, =gContestPlayerMonIndex - mov r9, r0 - ldrb r0, [r0] - adds r0, 0x5 - lsls r0, 5 - ldr r1, =0xffffff00 - adds r1, r5 - mov r8, r1 - add r0, r8 - add r4, sp, 0x20 - adds r1, r4, 0 - adds r2, r6, 0 - bl CpuSet - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl CpuSet - mov r2, r9 - ldrb r1, [r2] - adds r1, 0x5 - lsls r1, 5 - add r1, r8 - mov r0, sp - adds r2, r6, 0 - bl CpuSet - ldr r1, =0x0201a004 - ldr r0, =0x040000d4 - mov r2, r8 - str r2, [r0] - str r1, [r0, 0x4] - ldr r1, =0x84000080 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - bl sub_80D782C - b _080D80AE - .pool -_080D8004: - bl sub_80DD04C - bl sub_80DBF90 - bl sub_80DB2BC - bl sub_80DB120 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1] - movs r4, 0 - strb r0, [r1, 0x12] - bl sub_80DC2BC - bl sub_80DC4F0 - bl sub_80DC594 - bl sub_80DC5E8 - bl sub_80DC7EC - ldr r1, =gBattlerPositions - strb r4, [r1] - movs r0, 0x1 - strb r0, [r1, 0x1] - movs r3, 0x3 - strb r3, [r1, 0x2] - movs r2, 0x2 - strb r2, [r1, 0x3] - ldr r0, =gBattleTypeFlags - str r4, [r0] - ldr r4, =gBattlerAttacker - strb r2, [r4] - ldr r0, =gBattlerTarget - strb r3, [r0] - bl sub_80DB0C4 - ldr r2, =gBattlerSpriteIds - ldrb r1, [r4] - adds r1, r2 - strb r0, [r1] - bl sub_80DEA20 - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x3 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - b _080D80AE - .pool -_080D80A4: - movs r0, 0 - mov r1, r10 - strb r0, [r1] - movs r0, 0x1 - b _080D80B8 -_080D80AE: - mov r2, r10 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - movs r0, 0 -_080D80B8: - add sp, 0x40 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80D7E44 - - thumb_func_start sub_80D80C8 -sub_80D80C8: @ 80D80C8 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, =gPaletteFade - ldrb r2, [r1, 0x8] - movs r0, 0x7F - ands r0, r2 - strb r0, [r1, 0x8] - ldrb r1, [r1, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _080D80F8 - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - strh r2, [r1, 0x8] - strh r2, [r1, 0xA] - ldr r0, =sub_80D8108 - str r0, [r1] -_080D80F8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D80C8 - - thumb_func_start sub_80D8108 -sub_80D8108: @ 80D8108 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r2, r1, 0 - cmp r0, 0x4 - bhi _080D8208 - lsls r0, 2 - ldr r1, =_080D8138 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D8138: - .4byte _080D814C - .4byte _080D8176 - .4byte _080D8194 - .4byte _080D81B0 - .4byte _080D8208 -_080D814C: - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r2 - ldrh r0, [r4, 0xA] - adds r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3C - ble _080D822C - movs r0, 0 - strh r0, [r4, 0xA] - movs r0, 0x61 - movs r1, 0 - bl PlaySE12WithPanning - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _080D822C -_080D8176: - ldr r1, =gBattle_BG1_Y - ldrh r0, [r1] - adds r0, 0x7 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA0 - ble _080D822C - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r2 - b _080D81FA - .pool -_080D8194: - bl sub_80DE350 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _080D822C - .pool -_080D81B0: - movs r0, 0x8 - bl GetGpuReg - mov r1, sp - strh r0, [r1] - movs r0, 0xC - bl GetGpuReg - mov r4, sp - adds r4, 0x2 - strh r0, [r4] - mov r3, sp - ldrb r2, [r3] - movs r1, 0x4 - negs r1, r1 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3] - ldrb r0, [r4] - ands r1, r0 - strb r1, [r4] - mov r0, sp - ldrh r1, [r0] - movs r0, 0x8 - bl SetGpuReg - ldrh r1, [r4] - movs r0, 0xC - bl SetGpuReg - bl sub_80DDB0C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 -_080D81FA: - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _080D822C - .pool -_080D8208: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - bne _080D822C - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r2 - strh r1, [r0, 0x8] - strh r1, [r0, 0xA] - ldr r1, =sub_80D833C - str r1, [r0] -_080D822C: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D8108 - - thumb_func_start sub_80D823C -sub_80D823C: @ 80D823C - push {r4,r5,lr} - bl AnimateSprites - bl RunTasks - bl BuildOamBuffer - bl UpdatePaletteFade - movs r4, 0 -_080D8250: - ldr r5, =gUnknown_02039F38 - ldrb r0, [r5] - asrs r0, r4 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D8266 - lsls r0, r4, 24 - lsrs r0, 24 - bl CopyBgTilemapBufferToVram -_080D8266: - adds r4, 0x1 - cmp r4, 0x3 - ble _080D8250 - movs r0, 0 - strb r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D823C - - thumb_func_start vblank_cb_battle -vblank_cb_battle: @ 80D827C - push {lr} - ldr r0, =gBattle_BG0_X - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, =gBattle_BG0_Y - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - ldr r0, =gBattle_BG1_X - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, =gBattle_BG1_Y - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, =gBattle_BG2_X - ldrh r1, [r0] - movs r0, 0x18 - bl SetGpuReg - ldr r0, =gBattle_BG2_Y - ldrh r1, [r0] - movs r0, 0x1A - bl SetGpuReg - ldr r0, =gBattle_BG3_X - ldrh r1, [r0] - movs r0, 0x1C - bl SetGpuReg - ldr r0, =gBattle_BG3_Y - ldrh r1, [r0] - movs r0, 0x1E - bl SetGpuReg - ldr r0, =gBattle_WIN0H - ldrh r1, [r0] - movs r0, 0x40 - bl SetGpuReg - ldr r0, =gBattle_WIN0V - ldrh r1, [r0] - movs r0, 0x44 - bl SetGpuReg - ldr r0, =gBattle_WIN1H - ldrh r1, [r0] - movs r0, 0x42 - bl SetGpuReg - ldr r0, =gBattle_WIN1V - ldrh r1, [r0] - movs r0, 0x46 - bl SetGpuReg - bl TransferPlttBuffer - bl LoadOam - bl ProcessSpriteCopyRequests - bl ScanlineEffect_InitHBlankDmaTransfer - pop {r0} - bx r0 - .pool - thumb_func_end vblank_cb_battle - thumb_func_start sub_80D833C sub_80D833C: @ 80D833C push {r4,r5,lr} @@ -13321,7 +12809,7 @@ sub_80DED4C: @ 80DED4C thumb_func_start sub_80DED60 sub_80DED60: @ 80DED60 - ldr r2, =gUnknown_02039F38 + ldr r2, =sContestBgCopyFlags movs r1, 0x1 lsls r1, r0 ldrb r0, [r2] diff --git a/include/contest.h b/include/contest.h index 250929de7b..45fc9b4779 100644 --- a/include/contest.h +++ b/include/contest.h @@ -401,6 +401,7 @@ struct ContestResources void * field_3c; }; +#define shared15800 (gHeap + 0x18000) #define shared18000 (*(struct Shared18000 *)(gHeap + 0x1a000)) extern struct ContestResources *gContestResources; diff --git a/include/gba/types.h b/include/gba/types.h index 9f63489aa9..a7dbf3e030 100644 --- a/include/gba/types.h +++ b/include/gba/types.h @@ -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 diff --git a/src/contest.c b/src/contest.c index 2c56eb14cc..6d9bfe460e 100644 --- a/src/contest.c +++ b/src/contest.c @@ -31,6 +31,7 @@ #include "scanline_effect.h" #include "util.h" #include "contest_link_80F57C4.h" +#include "dma3.h" #define DESTROY_POINTER(ptr) \ free(ptr); \ @@ -42,14 +43,29 @@ void sub_80D7CB4(u8 taskId); void sub_80D7DAC(u8 taskId); void sub_80D7DC8(u8 taskId); void sub_80D7DE8(u8 taskId); -void sub_80D80C8(u8 taskId); -void sub_80D823C(void); -void sub_80DBF68(void); -void sub_80DCE58(u8); -void sub_80DD590(void); bool8 sub_80D7E44(u8 *); +void sub_80D80C8(u8 taskId); +void sub_80D8108(u8 taskId); +void sub_80DE350(void); +void sub_80DDB0C(void); +void sub_80D833C(u8 taskId); +void sub_80D823C(void); +u8 sub_80DB0C4(void); +u8 sub_80DB120(void); +void sub_80DB2BC(void); +void sub_80DBF68(void); +void sub_80DBF90(void); +void sub_80DC2BC(void); +void sub_80DC4F0(void); +void sub_80DC594(void); +void sub_80DC5E8(void); +void sub_80DC7EC(void); +void sub_80DCE58(u8); +void sub_80DD04C(void); +void sub_80DD590(void); void sub_80DE224(void); void vblank_cb_battle(void); +void sub_80DEA20(void); EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; EWRAM_DATA s16 gUnknown_02039F00[4] = {0}; @@ -69,7 +85,7 @@ EWRAM_DATA u16 gSpecialVar_ContestRank = 0; EWRAM_DATA u8 gUnknown_02039F30 = 0; EWRAM_DATA u8 gUnknown_02039F31 = 0; EWRAM_DATA struct ContestResources * gContestResources = NULL; -EWRAM_DATA u8 gUnknown_02039F38 = 0; +EWRAM_DATA u8 sContestBgCopyFlags = 0; EWRAM_DATA struct ContestWinner gUnknown_02039F3C = {0}; u32 gContestRngValue; @@ -77,7 +93,7 @@ u32 gContestRngValue; extern u16 gBattle_BG0_X; extern u16 gBattle_BG0_Y; extern u16 gBattle_BG1_X; -extern u16 gBattle_BG1_Y; +extern s16 gBattle_BG1_Y; extern u16 gBattle_BG2_X; extern u16 gBattle_BG2_Y; extern u16 gBattle_BG3_X; @@ -91,9 +107,10 @@ extern const u8 gContestMiscGfx[]; extern const u8 gContestAudienceGfx[]; extern const u8 gUnknown_08C16FA8[]; extern const u8 gUnknown_08C16E90[]; +extern const u8 gUnknown_08C17170[]; +extern const u16 gUnknown_08587C30[]; extern const struct BgTemplate gUnknown_08587F34[4]; extern const struct WindowTemplate gUnknown_08587F44[]; -extern const u16 gUnknown_08587C30[]; void TaskDummy1(u8 taskId) { @@ -271,7 +288,7 @@ void sub_80D7B24(void) switch (gMain.state) { case 0: - gUnknown_02039F38 = 0; + sContestBgCopyFlags = 0; sub_80D7988(); AllocateMonSpritesGfx(); DESTROY_POINTER(gMonSpritesGfxPtr->firstDecompressed); @@ -396,3 +413,168 @@ void sub_80D7DE8(u8 taskId) } } +u8 sub_80D7E44(u8 *a) +{ + u16 sp0[16]; + u16 sp20[16]; + + switch (*a) + { + case 0: + gPaletteFade.bufferTransferDisabled = TRUE; + RequestDma3Fill(0, (void *)VRAM, 0x8000, 1); + RequestDma3Fill(0, (void *)VRAM + 0x8000, 0x8000, 1); + RequestDma3Fill(0, (void *)VRAM + 0x10000, 0x8000, 1); + break; + case 1: + LZDecompressVram(gContestMiscGfx, (void *)VRAM); + break; + case 2: + LZDecompressVram(gContestAudienceGfx, (void *)(VRAM + 0x2000)); + DmaCopyLarge32(3, (void *)(VRAM + 0x2000), shared15800, 0x2000, 0x1000); + break; + case 3: + CopyToBgTilemapBuffer(3, gUnknown_08C16FA8, 0, 0); + CopyBgTilemapBufferToVram(3); + break; + case 4: + CopyToBgTilemapBuffer(2, gUnknown_08C17170, 0, 0); + CopyBgTilemapBufferToVram(2); + DmaCopy32Defvars(3, gContestResources->field_24[2], shared18000.unk18A04, 0x800); + break; + case 5: + LoadCompressedPalette(gUnknown_08C16E90, 0, 0x200); + CpuCopy32(gPlttBufferUnfaded + 128, sp0, 16 * sizeof(u16)); + CpuCopy32(gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, sp20, 16 * sizeof(u16)); + CpuCopy32(sp20, gPlttBufferUnfaded + 128, 16 * sizeof(u16)); + CpuCopy32(sp0, gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, 16 * sizeof(u16)); + DmaCopy32Defvars(3, gPlttBufferUnfaded, shared18000.unk18004, 0x200); + sub_80D782C(); + break; + case 6: + sub_80DD04C(); + sub_80DBF90(); + sub_80DB2BC(); + gContestResources->field_0->unk19216 = sub_80DB120(); + sub_80DC2BC(); + sub_80DC4F0(); + sub_80DC594(); + sub_80DC5E8(); + sub_80DC7EC(); + gBattlerPositions[0] = 0; + gBattlerPositions[1] = 1; + gBattlerPositions[2] = 3; + gBattlerPositions[3] = 2; + gBattleTypeFlags = 0; + gBattlerAttacker = 2; + gBattlerTarget = 3; + gBattlerSpriteIds[gBattlerAttacker] = sub_80DB0C4(); + sub_80DEA20(); + CopyBgTilemapBufferToVram(3); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(1); + ShowBg(3); + ShowBg(2); + ShowBg(0); + ShowBg(1); + break; + default: + *a = 0; + return 1; + } + + (*a)++; + return 0; +} + +void sub_80D80C8(u8 taskId) +{ + gPaletteFade.bufferTransferDisabled = FALSE; + if (!gPaletteFade.active) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].func = sub_80D8108; + } +} + + +void sub_80D8108(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + if (gTasks[taskId].data[1]++ <= 60) + break; + gTasks[taskId].data[1] = 0; + PlaySE12WithPanning(SE_C_MAKU_U, 0); + gTasks[taskId].data[0]++; + break; + case 1: + if ((gBattle_BG1_Y += 7) <= 160) + break; + gTasks[taskId].data[0]++; + break; + case 2: + sub_80DE350(); + gTasks[taskId].data[0]++; + break; + case 3: + { + u16 bg0Cnt = GetGpuReg(REG_OFFSET_BG0CNT); + u16 bg2Cnt = GetGpuReg(REG_OFFSET_BG2CNT); + ((struct BgCnt *)&bg0Cnt)->priority = 0; + ((struct BgCnt *)&bg2Cnt)->priority = 0; + SetGpuReg(REG_OFFSET_BG0CNT, bg0Cnt); + SetGpuReg(REG_OFFSET_BG2CNT, bg2Cnt); + sub_80DDB0C(); + gTasks[taskId].data[0]++; + break; + } + case 4: + default: + if (gContestResources->field_0->unk1920A_6) + break; + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].func = sub_80D833C; + break; + } +} + +void sub_80D823C(void) +{ + s32 i; + + AnimateSprites(); + RunTasks(); + BuildOamBuffer(); + UpdatePaletteFade(); + + for (i = 0; i < 4; i++) + { + if ((sContestBgCopyFlags >> i) & 1) + CopyBgTilemapBufferToVram(i); + } + sContestBgCopyFlags = 0; +} + +void vblank_cb_battle(void) +{ + SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X); + SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y); + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X); + SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y); + SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X); + SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y); + SetGpuReg(REG_OFFSET_WIN0H, gBattle_WIN0H); + SetGpuReg(REG_OFFSET_WIN0V, gBattle_WIN0V); + SetGpuReg(REG_OFFSET_WIN1H, gBattle_WIN1H); + SetGpuReg(REG_OFFSET_WIN1V, gBattle_WIN1V); + TransferPlttBuffer(); + LoadOam(); + ProcessSpriteCopyRequests(); + ScanlineEffect_InitHBlankDmaTransfer(); +}