through sub_801A960

This commit is contained in:
PikalaxALT 2019-04-01 18:42:57 -04:00 committed by huderlem
parent c429e6d69c
commit 4be97b2dc6
8 changed files with 480 additions and 764 deletions

View File

@ -5,721 +5,6 @@
.text .text
thumb_func_start sub_801A3F4
sub_801A3F4: @ 801A3F4
push {lr}
bl IsDma3ManagerBusyWithBgCopy
lsls r0, 24
cmp r0, 0
bne _0801A414
bl RunTasks
bl RunTextPrinters
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
_0801A414:
pop {r0}
bx r0
thumb_func_end sub_801A3F4
thumb_func_start sub_801A418
sub_801A418: @ 801A418
push {lr}
bl LoadOam
bl ProcessSpriteCopyRequests
bl TransferPlttBuffer
pop {r0}
bx r0
thumb_func_end sub_801A418
thumb_func_start sub_801A42C
sub_801A42C: @ 801A42C
push {lr}
ldr r0, =sub_801A43C
bl SetMainCallback2
pop {r0}
bx r0
.pool
thumb_func_end sub_801A42C
thumb_func_start sub_801A43C
sub_801A43C: @ 801A43C
push {r4,r5,lr}
sub sp, 0xC
movs r0, 0
movs r1, 0
bl SetGpuReg
ldr r5, =gUnknown_03000DAC
movs r0, 0x6C
bl AllocZeroed
str r0, [r5]
movs r0, 0
bl SetVBlankCallback
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_082F0D34
movs r0, 0
movs r2, 0x2
bl InitBgsFromTemplates
movs r4, 0x80
lsls r4, 4
adds r0, r4, 0
bl Alloc
adds r1, r0, 0
movs r0, 0x1
bl SetBgTilemapBuffer
adds r0, r4, 0
bl Alloc
adds r1, r0, 0
movs r0, 0
bl SetBgTilemapBuffer
ldr r1, =gWirelessInfoScreenGfx
movs r0, 0
str r0, [sp]
movs r0, 0x1
movs r2, 0
movs r3, 0
bl DecompressAndLoadBgGfxUsingHeap
ldr r1, =gWirelessInfoScreenTilemap
movs r0, 0x1
movs r2, 0
movs r3, 0
bl CopyToBgTilemapBuffer
ldr r0, =gUnknown_082F0D3C
bl InitWindows
bl DeactivateAllTextPrinters
bl ResetPaletteFade
bl ResetSpriteData
bl ResetTasks
bl ScanlineEffect_Stop
bl m4aSoundVSyncOn
ldr r0, =sub_801A418
bl SetVBlankCallback
ldr r0, =sub_801A6C0
movs r1, 0
bl CreateTask
ldr r1, [r5]
adds r1, 0x60
strb r0, [r1]
bl sub_8013C40
ldr r1, [r5]
adds r1, 0x61
strb r0, [r1]
ldr r1, [r5]
movs r0, 0x1
str r0, [r1, 0x1C]
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgY
ldr r0, =gWirelessInfoScreenPal
movs r1, 0
movs r2, 0x20
bl LoadPalette
movs r0, 0xF0
bl Menu_LoadStdPalAt
bl DynamicPlaceholderTextUtil_Reset
movs r0, 0x20
str r0, [sp]
str r0, [sp, 0x4]
movs r0, 0xF
str r0, [sp, 0x8]
movs r0, 0
movs r1, 0
movs r2, 0
movs r3, 0
bl FillBgTilemapBufferRect
movs r0, 0x1
bl CopyBgTilemapBufferToVram
ldr r0, =sub_801A3F4
bl SetMainCallback2
bl RunTasks
bl RunTextPrinters
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
add sp, 0xC
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_801A43C
thumb_func_start sub_801A584
sub_801A584: @ 801A584
push {r4,lr}
bl FreeAllWindowBuffers
movs r4, 0
_0801A58C:
lsls r0, r4, 24
lsrs r0, 24
bl GetBgTilemapBuffer
bl Free
adds r4, 0x1
cmp r4, 0x1
ble _0801A58C
ldr r0, =gUnknown_03000DAC
ldr r0, [r0]
bl Free
ldr r0, =CB2_ReturnToFieldContinueScriptPlayMapMusic
bl SetMainCallback2
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_801A584
thumb_func_start sub_801A5BC
sub_801A5BC: @ 801A5BC
push {lr}
adds r2, r0, 0
ldrh r0, [r2]
adds r0, 0x1
strh r0, [r2]
lsls r0, 16
asrs r0, 16
cmp r0, 0x5
ble _0801A5E4
ldrh r0, [r1]
adds r0, 0x1
strh r0, [r1]
lsls r0, 16
asrs r0, 16
cmp r0, 0xE
bne _0801A5E0
movs r0, 0
strh r0, [r1]
_0801A5E0:
movs r0, 0
strh r0, [r2]
_0801A5E4:
movs r2, 0
ldrsh r0, [r1, r2]
adds r0, 0x2
lsls r0, 5
ldr r1, =gWirelessInfoScreenPal
adds r0, r1
movs r1, 0
movs r2, 0x10
bl LoadPalette
pop {r0}
bx r0
.pool
thumb_func_end sub_801A5BC
thumb_func_start sub_801A600
sub_801A600: @ 801A600
push {r4,r5,lr}
sub sp, 0x8
movs r0, 0
movs r1, 0
bl FillWindowPixelBuffer
movs r0, 0x1
movs r1, 0
bl FillWindowPixelBuffer
movs r0, 0x2
movs r1, 0
bl FillWindowPixelBuffer
ldr r5, =gUnknown_082F0D5C
ldr r4, [r5]
movs r0, 0x1
adds r1, r4, 0
movs r2, 0xC0
bl GetStringCenterAlignXOffset
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
movs r0, 0x6
str r0, [sp]
movs r0, 0x3
str r0, [sp, 0x4]
movs r0, 0
movs r1, 0x1
adds r2, r4, 0
bl sub_801A8B0
movs r1, 0
_0801A644:
adds r4, r1, 0x1
lsls r0, r4, 2
adds r0, r5
ldr r2, [r0]
lsls r0, r1, 4
subs r0, r1
lsls r0, 25
movs r1, 0x80
lsls r1, 20
adds r0, r1
lsrs r0, 24
str r0, [sp]
movs r0, 0x1
str r0, [sp, 0x4]
movs r1, 0x1
movs r3, 0
bl sub_801A8B0
adds r1, r4, 0
cmp r4, 0x2
ble _0801A644
ldr r1, =gUnknown_082F0D5C
adds r0, r4, 0x1
lsls r0, 2
adds r0, r1
ldr r2, [r0]
lsls r0, r4, 4
subs r0, r4
lsls r0, 25
movs r1, 0x80
lsls r1, 20
adds r0, r1
lsrs r0, 24
str r0, [sp]
movs r0, 0x2
str r0, [sp, 0x4]
movs r0, 0x1
movs r1, 0x1
movs r3, 0
bl sub_801A8B0
movs r0, 0
bl PutWindowTilemap
movs r0, 0
movs r1, 0x2
bl CopyWindowToVram
movs r0, 0x1
bl PutWindowTilemap
movs r0, 0x1
movs r1, 0x2
bl CopyWindowToVram
add sp, 0x8
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_801A600
thumb_func_start sub_801A6C0
sub_801A6C0: @ 801A6C0
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x8
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, 0x5
bls _0801A6E2
b _0801A89C
_0801A6E2:
lsls r0, 2
ldr r1, =_0801A6F4
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_0801A6F4:
.4byte _0801A70C
.4byte _0801A728
.4byte _0801A74C
.4byte _0801A768
.4byte _0801A85C
.4byte _0801A884
_0801A70C:
bl sub_801A600
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 _0801A89C
.pool
_0801A728:
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
movs r0, 0x1
bl ShowBg
movs r0, 0
bl CopyBgTilemapBufferToVram
movs r0, 0
bl ShowBg
b _0801A86C
_0801A74C:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _0801A75A
b _0801A89C
_0801A75A:
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r2
b _0801A876
.pool
_0801A768:
ldr r0, =gUnknown_03000DAC
ldr r0, [r0]
adds r1, r0, 0
adds r1, 0x10
adds r2, r0, 0
adds r2, 0x20
adds r3, r0, 0
adds r3, 0x61
ldrb r3, [r3]
bl sub_801AA30
lsls r1, r5, 2
mov r8, r1
cmp r0, 0
beq _0801A7F8
movs r0, 0x2
movs r1, 0
bl FillWindowPixelBuffer
movs r4, 0
ldr r6, =gStringVar4
movs r7, 0x80
lsls r7, 20
_0801A796:
ldr r0, =gUnknown_03000DAC
ldr r0, [r0]
lsls r1, r4, 2
adds r0, r1
ldr r1, [r0]
adds r0, r6, 0
movs r2, 0x1
movs r3, 0x2
bl ConvertIntToDecimalStringN
cmp r4, 0x3
beq _0801A7CC
lsrs r0, r7, 24
str r0, [sp]
movs r0, 0x1
str r0, [sp, 0x4]
movs r0, 0x2
movs r1, 0x1
adds r2, r6, 0
movs r3, 0xC
bl sub_801A8B0
b _0801A7DE
.pool
_0801A7CC:
movs r0, 0x62
str r0, [sp]
movs r0, 0x2
str r0, [sp, 0x4]
movs r1, 0x1
adds r2, r6, 0
movs r3, 0xC
bl sub_801A8B0
_0801A7DE:
movs r2, 0xF0
lsls r2, 21
adds r7, r2
adds r4, 0x1
cmp r4, 0x3
ble _0801A796
movs r0, 0x2
bl PutWindowTilemap
movs r0, 0x2
movs r1, 0x3
bl CopyWindowToVram
_0801A7F8:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
bne _0801A80C
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _0801A836
_0801A80C:
movs r0, 0x5
bl PlaySE
ldr r2, =gTasks
ldr r0, =gUnknown_03000DAC
ldr r0, [r0]
adds r0, 0x61
ldrb r1, [r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
movs r1, 0xFF
strh r1, [r0, 0x26]
mov r0, r8
adds r1, r0, r5
lsls r1, 3
adds r1, r2
ldrh r0, [r1, 0x8]
adds r0, 0x1
strh r0, [r1, 0x8]
_0801A836:
mov r2, r8
adds r1, r2, r5
lsls r1, 3
ldr r0, =gTasks + 0x8
adds r1, r0
adds r0, r1, 0
adds r0, 0xE
adds r1, 0x10
bl sub_801A5BC
b _0801A89C
.pool
_0801A85C:
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
_0801A86C:
ldr r1, =gTasks
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
adds r0, r1
_0801A876:
ldrh r1, [r0, 0x8]
adds r1, 0x1
strh r1, [r0, 0x8]
b _0801A89C
.pool
_0801A884:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _0801A89C
ldr r0, =sub_801A584
bl SetMainCallback2
adds r0, r5, 0
bl DestroyTask
_0801A89C:
add sp, 0x8
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_801A6C0
thumb_func_start sub_801A8B0
sub_801A8B0: @ 801A8B0
push {r4-r7,lr}
sub sp, 0x18
mov r12, r2
ldr r2, [sp, 0x2C]
ldr r4, [sp, 0x30]
lsls r0, 24
lsrs r7, r0, 24
lsls r1, 24
lsrs r6, r1, 24
lsls r3, 24
lsrs r5, r3, 24
lsls r2, 24
lsrs r3, r2, 24
lsls r4, 24
lsrs r0, r4, 24
cmp r0, 0x4
bhi _0801A93A
lsls r0, 2
ldr r1, =_0801A8E0
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_0801A8E0:
.4byte _0801A8F4
.4byte _0801A902
.4byte _0801A910
.4byte _0801A91E
.4byte _0801A92C
_0801A8F4:
add r1, sp, 0x14
movs r0, 0
strb r0, [r1]
movs r0, 0x2
strb r0, [r1, 0x1]
movs r0, 0x3
b _0801A938
_0801A902:
add r1, sp, 0x14
movs r0, 0
strb r0, [r1]
movs r0, 0x1
strb r0, [r1, 0x1]
movs r0, 0x3
b _0801A938
_0801A910:
add r1, sp, 0x14
movs r0, 0
strb r0, [r1]
movs r0, 0x4
strb r0, [r1, 0x1]
movs r0, 0x5
b _0801A938
_0801A91E:
add r1, sp, 0x14
movs r0, 0
strb r0, [r1]
movs r0, 0x7
strb r0, [r1, 0x1]
movs r0, 0x6
b _0801A938
_0801A92C:
add r1, sp, 0x14
movs r0, 0
strb r0, [r1]
movs r0, 0x1
strb r0, [r1, 0x1]
movs r0, 0x2
_0801A938:
strb r0, [r1, 0x2]
_0801A93A:
movs r0, 0
str r0, [sp]
str r0, [sp, 0x4]
add r0, sp, 0x14
str r0, [sp, 0x8]
movs r0, 0x1
negs r0, r0
str r0, [sp, 0xC]
mov r0, r12
str r0, [sp, 0x10]
adds r0, r7, 0
adds r1, r6, 0
adds r2, r5, 0
bl AddTextPrinterParameterized4
add sp, 0x18
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_801A8B0
thumb_func_start sub_801A960
sub_801A960: @ 801A960
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
mov r12, r0
adds r7, r1, 0
ldrb r0, [r0, 0xA]
lsls r0, 25
lsrs r0, 25
mov r8, r0
movs r4, 0
ldr r0, =gUnknown_082F0D70
mov r9, r0
movs r1, 0x1
add r1, r9
mov r10, r1
mov r3, r12
adds r3, 0x4
str r3, [sp]
_0801A98A:
lsls r0, r4, 1
adds r2, r0, r4
mov r3, r9
adds r1, r2, r3
adds r5, r0, 0
adds r6, r4, 0x1
ldrb r1, [r1]
cmp r8, r1
bne _0801A9EE
mov r0, r12
ldrb r1, [r0, 0x1A]
movs r0, 0x3
ands r0, r1
cmp r0, 0x1
bne _0801A9EE
mov r0, r9
adds r0, 0x2
adds r3, r2, r0
ldrb r0, [r3]
cmp r0, 0
bne _0801A9DC
movs r2, 0
movs r1, 0
ldr r3, [sp]
_0801A9BA:
adds r0, r3, r1
ldrb r0, [r0]
cmp r0, 0
beq _0801A9C4
adds r2, 0x1
_0801A9C4:
adds r1, 0x1
cmp r1, 0x3
ble _0801A9BA
adds r2, 0x1
adds r0, r5, r4
add r0, r10
ldrb r1, [r0]
lsls r1, 2
adds r1, r7
b _0801A9E8
.pool
_0801A9DC:
mov r1, r10
adds r0, r2, r1
ldrb r1, [r0]
lsls r1, 2
adds r1, r7
ldrb r2, [r3]
_0801A9E8:
ldr r0, [r1]
adds r0, r2
str r0, [r1]
_0801A9EE:
adds r4, r6, 0
cmp r4, 0x1E
bls _0801A98A
mov r0, r8
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_801A960
thumb_func_start sub_801AA08 thumb_func_start sub_801AA08
sub_801AA08: @ 801AA08 sub_801AA08: @ 801AA08
push {r4,lr} push {r4,lr}

View File

@ -3,53 +3,6 @@
.section .rodata .section .rodata
.align 2
gWirelessInfoScreenPal:: @ 82F0790
.incbin "graphics/interface/wireless_info_screen.gbapal"
.align 2
gWirelessInfoScreenGfx:: @ 82F0990
.incbin "graphics/interface/wireless_info_screen.4bpp.lz"
.align 2
gWirelessInfoScreenTilemap:: @ 82F0BA0
.incbin "graphics/interface/wireless_info_screen.bin.lz"
.align 2
gUnknown_082F0D34:: @ 82F0D34
.4byte 0x000001f8
.4byte 0x00001081
.align 2
gUnknown_082F0D3C:: @ 82F0D3C
window_template 0x00, 0x03, 0x00, 0x18, 0x03, 0x0f, 0x0001
window_template 0x00, 0x03, 0x04, 0x15, 0x0f, 0x0f, 0x0049
window_template 0x00, 0x18, 0x04, 0x03, 0x0f, 0x0f, 0x0184
null_window_template
.align 2
gUnknown_082F0D5C:: @ 82F0D5C
.4byte gText_WirelessCommStatus
.4byte gText_PeopleTrading
.4byte gText_PeopleBattling
.4byte gText_PeopleInUnionRoom
.4byte gText_PeopleCommunicating
.align 2
gUnknown_082F0D70:: @ 82F0D70
.byte 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x03, 0x01
.byte 0x04, 0x04, 0x00, 0x02, 0x06, 0x03, 0x02, 0x07
.byte 0x03, 0x02, 0x09, 0x03, 0x00, 0x0a, 0x03, 0x00
.byte 0x0b, 0x03, 0x00, 0x0c, 0xff, 0x00, 0x0d, 0x00
.byte 0x00, 0x10, 0x03, 0x00, 0x0f, 0x03, 0x00, 0x40
.byte 0x02, 0x01, 0x41, 0x02, 0x02, 0x44, 0x02, 0x02
.byte 0x45, 0x02, 0x00, 0x48, 0x02, 0x02, 0x54, 0x02
.byte 0x01, 0x53, 0x02, 0x02, 0x51, 0x02, 0x01, 0x52
.byte 0x02, 0x01, 0x15, 0x03, 0x02, 0x16, 0x03, 0x02
.byte 0x17, 0x03, 0x00, 0x18, 0x03, 0x00, 0x19, 0x03
.byte 0x00, 0x1a, 0x03, 0x00, 0x1b, 0x03, 0x00, 0x1c
.byte 0x01, 0x02, 0x0e, 0x01, 0x02, 0x00, 0x00, 0x00
.align 2 .align 2
gUnknown_082F0DD0:: @ 82F0DD0 gUnknown_082F0DD0:: @ 82F0DD0
.4byte 0x000001FC .4byte 0x000001FC

View File

@ -2672,5 +2672,10 @@ extern const u8 gText_CommunicationCompleted[];
extern const u8 gText_HaventReceivedGiftOkayToDiscard[]; extern const u8 gText_HaventReceivedGiftOkayToDiscard[];
extern const u8 gText_SendingWonderCard[]; extern const u8 gText_SendingWonderCard[];
extern const u8 gText_SendingWonderNews[]; extern const u8 gText_SendingWonderNews[];
extern const u8 gText_WirelessCommStatus[];
extern const u8 gText_PeopleTrading[];
extern const u8 gText_PeopleBattling[];
extern const u8 gText_PeopleInUnionRoom[];
extern const u8 gText_PeopleCommunicating[];
#endif // GUARD_STRINGS_H #endif // GUARD_STRINGS_H

View File

@ -0,0 +1,6 @@
#ifndef GUARD_UNION_ROOM_BATTLE_H
#define GUARD_UNION_ROOM_BATTLE_H
u8 sub_8013C40(void);
#endif //GUARD_UNION_ROOM_BATTLE_H

View File

@ -57,6 +57,7 @@ SECTIONS {
src/union_room.o(.text); src/union_room.o(.text);
src/mystery_gift.o(.text); src/mystery_gift.o(.text);
src/union_room_player_avatar.o(.text); src/union_room_player_avatar.o(.text);
src/union_room_battle.o(.text);
asm/union_room_battle.o(.text); asm/union_room_battle.o(.text);
src/mevent2.o(.text); src/mevent2.o(.text);
src/mevent_801BAAC.o(.text); src/mevent_801BAAC.o(.text);
@ -413,6 +414,7 @@ SECTIONS {
src/union_room.o(.rodata); src/union_room.o(.rodata);
src/mystery_gift.o(.rodata); src/mystery_gift.o(.rodata);
src/union_room_player_avatar.o(.rodata); src/union_room_player_avatar.o(.rodata);
src/union_room_battle.o(.rodata);
data/union_room_battle.o(.rodata); data/union_room_battle.o(.rodata);
src/mevent2.o(.rodata); src/mevent2.o(.rodata);
src/mevent_801BAAC.o(.rodata); src/mevent_801BAAC.o(.rodata);

View File

@ -62,8 +62,6 @@ EWRAM_DATA struct TradeUnkStruct gUnknown_02022C40 = {};
IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0; IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0;
IWRAM_DATA struct UnkStruct_Group *gUnknown_03000DA4; IWRAM_DATA struct UnkStruct_Group *gUnknown_03000DA4;
IWRAM_DATA struct UnkStruct_URoom *gUnknown_03000DA8; IWRAM_DATA struct UnkStruct_URoom *gUnknown_03000DA8;
IWRAM_DATA void *gUnknown_03000DAC;
IWRAM_DATA bool32 gUnknown_03000DB0;
// this file's functions // this file's functions
void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5); void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5);

466
src/union_room_battle.c Normal file
View File

@ -0,0 +1,466 @@
#include "global.h"
#include "battle.h"
#include "task.h"
#include "text.h"
#include "main.h"
#include "bg.h"
#include "palette.h"
#include "gpu_regs.h"
#include "alloc.h"
#include "menu.h"
#include "window.h"
#include "scanline_effect.h"
#include "m4a.h"
#include "dynamic_placeholder_text_util.h"
#include "overworld.h"
#include "strings.h"
#include "string_util.h"
#include "international_string_util.h"
#include "sound.h"
#include "constants/songs.h"
#include "union_room.h"
#include "union_room_battle.h"
struct UnkStruct_3000DAC
{
/*0x00*/ u32 unk00[4];
/*0x10*/ u32 unk10[4];
/*0x20*/ u32 unk20[16];
/*0x60*/ u8 taskId;
/*0x61*/ u8 unk61;
/*0x62*/ u8 filler_62[10];
};
IWRAM_DATA struct UnkStruct_3000DAC * gUnknown_03000DAC;
IWRAM_DATA bool32 gUnknown_03000DB0;
void sub_801A43C(void);
void sub_801A6C0(u8 taskId);
static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode);
bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 a3);
const u16 gWirelessInfoScreenPal[] = INCBIN_U16("graphics/interface/wireless_info_screen.gbapal");
const u32 gWirelessInfoScreenGfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz");
const u32 gWirelessInfoScreenTilemap[] = INCBIN_U32("graphics/interface/wireless_info_screen.bin.lz");
const struct BgTemplate gUnknown_082F0D34[] = {
{
.bg = 0,
.charBaseIndex = 2,
.mapBaseIndex = 0x1F,
.priority = 0
}, {
.bg = 1,
.charBaseIndex = 0,
.mapBaseIndex = 0x08,
.priority = 1
}
};
const struct WindowTemplate gUnknown_082F0D3C[] = {
{
.bg = 0x00,
.tilemapLeft = 0x03,
.tilemapTop = 0x00,
.width = 0x18,
.height = 0x03,
.paletteNum = 0x0f,
.baseBlock = 0x0001
}, {
.bg = 0x00,
.tilemapLeft = 0x03,
.tilemapTop = 0x04,
.width = 0x15,
.height = 0x0f,
.paletteNum = 0x0f,
.baseBlock = 0x0049
}, {
.bg = 0x00,
.tilemapLeft = 0x18,
.tilemapTop = 0x04,
.width = 0x03,
.height = 0x0f,
.paletteNum = 0x0f,
.baseBlock = 0x0184
},
{ 0xFF }
};
const u8 *const gUnknown_082F0D5C[] = {
gText_WirelessCommStatus,
gText_PeopleTrading,
gText_PeopleBattling,
gText_PeopleInUnionRoom,
gText_PeopleCommunicating
};
const u8 gUnknown_082F0D70[][3] = {
{0x01, 0x01, 0x02},
{0x02, 0x01, 0x02},
{0x03, 0x01, 0x04},
{0x04, 0x00, 0x02},
{0x06, 0x03, 0x02},
{0x07, 0x03, 0x02},
{0x09, 0x03, 0x00},
{0x0a, 0x03, 0x00},
{0x0b, 0x03, 0x00},
{0x0c, 0xff, 0x00},
{0x0d, 0x00, 0x00},
{0x10, 0x03, 0x00},
{0x0f, 0x03, 0x00},
{0x40, 0x02, 0x01},
{0x41, 0x02, 0x02},
{0x44, 0x02, 0x02},
{0x45, 0x02, 0x00},
{0x48, 0x02, 0x02},
{0x54, 0x02, 0x01},
{0x53, 0x02, 0x02},
{0x51, 0x02, 0x01},
{0x52, 0x02, 0x01},
{0x15, 0x03, 0x02},
{0x16, 0x03, 0x02},
{0x17, 0x03, 0x00},
{0x18, 0x03, 0x00},
{0x19, 0x03, 0x00},
{0x1a, 0x03, 0x00},
{0x1b, 0x03, 0x00},
{0x1c, 0x01, 0x02},
{0x0e, 0x01, 0x02}
};
void sub_801A3F4(void)
{
if (!IsDma3ManagerBusyWithBgCopy())
{
RunTasks();
RunTextPrinters();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
}
void sub_801A418(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
void sub_801A42C(void)
{
SetMainCallback2(sub_801A43C);
}
void sub_801A43C(void)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
gUnknown_03000DAC = AllocZeroed(sizeof(struct UnkStruct_3000DAC));
SetVBlankCallback(NULL);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_082F0D34, ARRAY_COUNT(gUnknown_082F0D34));
SetBgTilemapBuffer(1, Alloc(0x800));
SetBgTilemapBuffer(0, Alloc(0x800));
DecompressAndLoadBgGfxUsingHeap(1, gWirelessInfoScreenGfx, 0, 0, 0);
CopyToBgTilemapBuffer(1, gWirelessInfoScreenTilemap, 0, 0);
InitWindows(gUnknown_082F0D3C);
DeactivateAllTextPrinters();
ResetPaletteFade();
ResetSpriteData();
ResetTasks();
ScanlineEffect_Stop();
m4aSoundVSyncOn();
SetVBlankCallback(sub_801A418);
gUnknown_03000DAC->taskId = CreateTask(sub_801A6C0, 0);
gUnknown_03000DAC->unk61 = sub_8013C40();
gUnknown_03000DAC->unk10[3] = 1;
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
LoadPalette(gWirelessInfoScreenPal, 0x00, 0x20);
Menu_LoadStdPalAt(0xF0);
DynamicPlaceholderTextUtil_Reset();
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x0F);
CopyBgTilemapBufferToVram(1);
SetMainCallback2(sub_801A3F4);
RunTasks();
RunTextPrinters();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
void sub_801A584(void)
{
s32 i;
FreeAllWindowBuffers();
for (i = 0; i < 2; i++)
{
Free(GetBgTilemapBuffer(i));
}
Free(gUnknown_03000DAC);
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
void sub_801A5BC(s16 * a0, s16 * a1)
{
if (++(*a0) > 5)
{
if (++(*a1) == 14)
{
*a1 = 0;
}
*a0 = 0;
}
LoadPalette(gWirelessInfoScreenPal + 16 * (*a1 + 2), 0, 0x10);
}
void sub_801A600(void)
{
s32 i;
FillWindowPixelBuffer(0, 0);
FillWindowPixelBuffer(1, 0);
FillWindowPixelBuffer(2, 0);
sub_801A8B0(0, 1, gUnknown_082F0D5C[0], GetStringCenterAlignXOffset(1, gUnknown_082F0D5C[0], 0xC0), 6, 3);
for (i = 0; i < 3; i++)
{
sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 1);
}
sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 2);
PutWindowTilemap(0);
CopyWindowToVram(0, 2);
PutWindowTilemap(1);
CopyWindowToVram(1, 2);
}
void sub_801A6C0(u8 taskId)
{
s32 i;
switch (gTasks[taskId].data[0])
{
case 0:
sub_801A600();
gTasks[taskId].data[0]++;
break;
case 1:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
ShowBg(1);
CopyBgTilemapBufferToVram(0);
ShowBg(0);
gTasks[taskId].data[0]++;
break;
case 2:
if (!gPaletteFade.active)
{
gTasks[taskId].data[0]++;
}
break;
case 3:
if (sub_801AA30(gUnknown_03000DAC->unk00, gUnknown_03000DAC->unk10, gUnknown_03000DAC->unk20, gUnknown_03000DAC->unk61))
{
FillWindowPixelBuffer(2, 0);
for (i = 0; i < 4; i++)
{
ConvertIntToDecimalStringN(gStringVar4, gUnknown_03000DAC->unk00[i], STR_CONV_MODE_RIGHT_ALIGN, 2);
if (i != 3)
{
sub_801A8B0(2, 1, gStringVar4, 12, 30 * i + 8, 1);
}
else
{
sub_801A8B0(2, 1, gStringVar4, 12, 98, 2);
}
}
PutWindowTilemap(2);
CopyWindowToVram(2, 3);
}
if (({gMain.newKeys & A_BUTTON;}) || ({gMain.newKeys & B_BUTTON;}))
{
PlaySE(SE_SELECT);
gTasks[gUnknown_03000DAC->unk61].data[15] = 0xFF;
gTasks[taskId].data[0]++;
}
sub_801A5BC(&gTasks[taskId].data[7], &gTasks[taskId].data[8]);
break;
case 4:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
gTasks[taskId].data[0]++;
break;
case 5:
if (!gPaletteFade.active)
{
SetMainCallback2(sub_801A584);
DestroyTask(taskId);
}
break;
}
}
static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode)
{
u8 color[3];
switch (mode)
{
case 0:
color[0] = 0;
color[1] = 2;
color[2] = 3;
break;
case 1:
color[0] = 0;
color[1] = 1;
color[2] = 3;
break;
case 2:
color[0] = 0;
color[1] = 4;
color[2] = 5;
break;
case 3:
color[0] = 0;
color[1] = 7;
color[2] = 6;
break;
case 4:
color[0] = 0;
color[1] = 1;
color[2] = 2;
break;
}
AddTextPrinterParameterized4(windowId, fontId, x, y, 0, 0, color, -1, str);
}
#ifdef NONMATCHING
// register swap r2, r3
u8 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1)
{
s32 i, j, r2;
u8 result = a0->unk.field_0.unk_0a_0;
for (i = 0; i < (unsigned)ARRAY_COUNT(gUnknown_082F0D70); i++)
{
if (result != gUnknown_082F0D70[i][0])
{
continue;
}
if (a0->field_1A_0 != 1)
{
continue;
}
if (gUnknown_082F0D70[i][2] == 0)
{
r2 = 0;
for (j = 0; j < 4; j++)
{
if (a0->unk.field_0.unk_04[j] != 0)
{
r2++;
}
}
r2++;
a1[gUnknown_082F0D70[i][1]] += r2;
}
else
{
a1[gUnknown_082F0D70[i][1]] += gUnknown_082F0D70[i][2];
}
}
return result;
}
#else
NAKED
u8 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r10\n"
"\tmov r6, r9\n"
"\tmov r5, r8\n"
"\tpush {r5-r7}\n"
"\tsub sp, 0x4\n"
"\tmov r12, r0\n"
"\tadds r7, r1, 0\n"
"\tldrb r0, [r0, 0xA]\n"
"\tlsls r0, 25\n"
"\tlsrs r0, 25\n"
"\tmov r8, r0\n"
"\tmovs r4, 0\n"
"\tldr r0, =gUnknown_082F0D70\n"
"\tmov r9, r0\n"
"\tmovs r1, 0x1\n"
"\tadd r1, r9\n"
"\tmov r10, r1\n"
"\tmov r3, r12\n"
"\tadds r3, 0x4\n"
"\tstr r3, [sp]\n"
"_0801A98A:\n"
"\tlsls r0, r4, 1\n"
"\tadds r2, r0, r4\n"
"\tmov r3, r9\n"
"\tadds r1, r2, r3\n"
"\tadds r5, r0, 0\n"
"\tadds r6, r4, 0x1\n"
"\tldrb r1, [r1]\n"
"\tcmp r8, r1\n"
"\tbne _0801A9EE\n"
"\tmov r0, r12\n"
"\tldrb r1, [r0, 0x1A]\n"
"\tmovs r0, 0x3\n"
"\tands r0, r1\n"
"\tcmp r0, 0x1\n"
"\tbne _0801A9EE\n"
"\tmov r0, r9\n"
"\tadds r0, 0x2\n"
"\tadds r3, r2, r0\n"
"\tldrb r0, [r3]\n"
"\tcmp r0, 0\n"
"\tbne _0801A9DC\n"
"\tmovs r2, 0\n"
"\tmovs r1, 0\n"
"\tldr r3, [sp]\n"
"_0801A9BA:\n"
"\tadds r0, r3, r1\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0\n"
"\tbeq _0801A9C4\n"
"\tadds r2, 0x1\n"
"_0801A9C4:\n"
"\tadds r1, 0x1\n"
"\tcmp r1, 0x3\n"
"\tble _0801A9BA\n"
"\tadds r2, 0x1\n"
"\tadds r0, r5, r4\n"
"\tadd r0, r10\n"
"\tldrb r1, [r0]\n"
"\tlsls r1, 2\n"
"\tadds r1, r7\n"
"\tb _0801A9E8\n"
"\t.pool\n"
"_0801A9DC:\n"
"\tmov r1, r10\n"
"\tadds r0, r2, r1\n"
"\tldrb r1, [r0]\n"
"\tlsls r1, 2\n"
"\tadds r1, r7\n"
"\tldrb r2, [r3]\n"
"_0801A9E8:\n"
"\tldr r0, [r1]\n"
"\tadds r0, r2\n"
"\tstr r0, [r1]\n"
"_0801A9EE:\n"
"\tadds r4, r6, 0\n"
"\tcmp r4, 0x1E\n"
"\tbls _0801A98A\n"
"\tmov r0, r8\n"
"\tadd sp, 0x4\n"
"\tpop {r3-r5}\n"
"\tmov r8, r3\n"
"\tmov r9, r4\n"
"\tmov r10, r5\n"
"\tpop {r4-r7}\n"
"\tpop {r1}\n"
"\tbx r1");
}
#endif //NONMATCHING

View File

@ -8,6 +8,7 @@
.include "src/link.o" .include "src/link.o"
.include "src/link_rfu.o" .include "src/link_rfu.o"
.include "src/union_room.o" .include "src/union_room.o"
.include "src/union_room_battle.o"
.include "src/rtc.o" .include "src/rtc.o"
.include "src/main_menu.o" .include "src/main_menu.o"
.include "src/rom_8034C54.o" .include "src/rom_8034C54.o"