sub_81C9A10

This commit is contained in:
PikalaxALT 2019-05-02 16:19:25 -04:00
parent 9b40cdaeb9
commit 518865d8d9
3 changed files with 131 additions and 253 deletions

View file

@ -5,257 +5,6 @@
@ File centered around AllocSubstruct(2)
thumb_func_start sub_81C9A10
sub_81C9A10: @ 81C9A10
push {r4,r5,lr}
sub sp, 0x4
adds r4, r0, 0
movs r0, 0x2
bl GetSubstructPtr
adds r5, r0, 0
cmp r4, 0x9
bls _081C9A24
b _081C9C60
_081C9A24:
lsls r0, r4, 2
ldr r1, =_081C9A34
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081C9A34:
.4byte _081C9A5C
.4byte _081C9AEC
.4byte _081C9B30
.4byte _081C9B88
.4byte _081C9B9E
.4byte _081C9BA4
.4byte _081C9BB6
.4byte _081C9BC0
.4byte _081C9C0E
.4byte _081C9C4C
_081C9A5C:
ldr r0, =gUnknown_08620194
movs r1, 0x3
bl InitBgTemplates
ldr r1, =gPokenavMessageBox_Gfx
movs r0, 0
str r0, [sp]
movs r0, 0x1
movs r2, 0
movs r3, 0
bl decompress_and_copy_tile_data_to_vram
adds r1, r5, 0
adds r1, 0x8C
movs r0, 0x1
bl SetBgTilemapBuffer
ldr r1, =gPokenavMessageBox_Tilemap
movs r0, 0x1
movs r2, 0
movs r3, 0
bl CopyToBgTilemapBuffer
movs r0, 0x1
bl CopyBgTilemapBufferToVram
ldr r0, =gPokenavMessageBox_Pal
movs r1, 0x10
movs r2, 0x20
bl CopyPaletteIntoBufferUnfaded
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x1
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x2
movs r1, 0
movs r2, 0
bl ChangeBgY
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgX
movs r0, 0x3
movs r1, 0
movs r2, 0
bl ChangeBgY
_081C9AD6:
movs r0, 0
b _081C9C62
.pool
_081C9AEC:
bl free_temp_tile_data_buffers_if_possible
lsls r0, 24
lsrs r0, 24
cmp r0, 0
beq _081C9AFA
b _081C9C5C
_081C9AFA:
ldr r1, =gUnknown_0861FD6C
str r0, [sp]
movs r0, 0x2
movs r2, 0
movs r3, 0
bl decompress_and_copy_tile_data_to_vram
ldr r1, =gUnknown_0861FFF4
movs r0, 0x1
str r0, [sp]
movs r0, 0x2
movs r2, 0
movs r3, 0
bl decompress_and_copy_tile_data_to_vram
ldr r0, =gUnknown_0861FD4C
movs r1, 0x20
movs r2, 0x20
bl CopyPaletteIntoBufferUnfaded
b _081C9AD6
.pool
_081C9B30:
bl free_temp_tile_data_buffers_if_possible
lsls r0, 24
lsrs r0, 24
cmp r0, 0
beq _081C9B3E
b _081C9C5C
_081C9B3E:
ldr r1, =gUnknown_0861FC98
str r0, [sp]
movs r0, 0x3
movs r2, 0
movs r3, 0
bl decompress_and_copy_tile_data_to_vram
ldr r1, =gUnknown_0861FCAC
movs r0, 0x1
str r0, [sp]
movs r0, 0x3
movs r2, 0
movs r3, 0
bl decompress_and_copy_tile_data_to_vram
ldr r0, =gUnknown_0861FC78
movs r1, 0x30
movs r2, 0x20
bl CopyPaletteIntoBufferUnfaded
bl sub_81C9894
cmp r0, 0x3
beq _081C9B76
bl sub_81C9894
cmp r0, 0x4
bne _081C9AD6
_081C9B76:
bl sub_81CA850
b _081C9AD6
.pool
_081C9B88:
bl free_temp_tile_data_buffers_if_possible
lsls r0, 24
cmp r0, 0
bne _081C9C5C
bl sub_81CA6E0
bl sub_81CA7D4
_081C9B9A:
movs r0, 0x1
b _081C9C62
_081C9B9E:
bl sub_81C9FC4
b _081C9B9A
_081C9BA4:
bl sub_81CA714
bl sub_81CA02C
bl sub_81CA640
bl sub_81CA0C8
b _081C9AD6
_081C9BB6:
bl sub_81CA7C4
cmp r0, 0
bne _081C9C5C
b _081C9B9A
_081C9BC0:
movs r0, 0x1
bl ShowBg
movs r0, 0x2
bl ShowBg
movs r0, 0x3
bl ShowBg
ldrb r0, [r5, 0xD]
cmp r0, 0
beq _081C9BE0
movs r0, 0x1
bl sub_81C7AC0
b _081C9BEC
_081C9BE0:
movs r0, 0x6E
bl PlaySE
movs r0, 0x3
bl sub_81C7AC0
_081C9BEC:
bl sub_81C9894
cmp r0, 0x3
beq _081C9BFE
cmp r0, 0x4
bne _081C9C06
movs r0, 0x7
bl LoadLeftHeaderGfxForIndex
_081C9BFE:
movs r0, 0x1
bl LoadLeftHeaderGfxForIndex
b _081C9AD6
_081C9C06:
movs r0, 0
bl LoadLeftHeaderGfxForIndex
b _081C9AD6
_081C9C0E:
bl IsPaletteFadeActive
cmp r0, 0
bne _081C9C5C
bl sub_81C9894
cmp r0, 0x3
beq _081C9C2C
cmp r0, 0x4
bne _081C9C38
movs r0, 0x7
movs r1, 0
movs r2, 0
bl sub_81C7FA0
_081C9C2C:
movs r0, 0x1
movs r1, 0
movs r2, 0
bl sub_81C7FA0
b _081C9C42
_081C9C38:
movs r0, 0
movs r1, 0
movs r2, 0
bl sub_81C7FA0
_081C9C42:
bl sub_81CA20C
bl titlescreen_0
b _081C9B9A
_081C9C4C:
bl sub_81CA324
cmp r0, 0
bne _081C9C5C
bl sub_81C8010
cmp r0, 0
beq _081C9C60
_081C9C5C:
movs r0, 0x2
b _081C9C62
_081C9C60:
movs r0, 0x4
_081C9C62:
add sp, 0x4
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_81C9A10
thumb_func_start sub_81C9C6C
sub_81C9C6C: @ 81C9C6C
push {lr}

View file

@ -4941,4 +4941,9 @@ extern const u16 gPokenavConditionCancel_Pal[];
extern const u32 gUnknown_08DE34B8[];
extern const u16 gUnknown_08DE3398[];
// Pokenav
extern const u32 gPokenavMessageBox_Gfx[];
extern const u32 gPokenavMessageBox_Tilemap[];
extern const u16 gPokenavMessageBox_Pal[];
#endif //GUARD_GRAPHICS_H

View file

@ -1,8 +1,12 @@
#include "global.h"
#include "alloc.h"
#include "bg.h"
#include "menu.h"
#include "window.h"
#include "pokenav.h"
#include "graphics.h"
#include "sound.h"
#include "constants/songs.h"
// Match Call
@ -16,7 +20,8 @@ struct Pokenav2Struct
u8 field_00b;
u8 field_00c;
u8 field_00d;
u8 filler_00e[0x87E];
u8 filler_00e[0x7E];
u8 field_08c[0x800];
};
struct Pokenav2Struct * sub_81C9958(void);
@ -30,8 +35,20 @@ u32 sub_81C9E58(int state);
u32 sub_81C9EC8(int state);
u32 sub_81C9EF8(int state);
u32 sub_81C9F28(int state);
void sub_81CA7F4(void);
void sub_81C9FC4(void);
void sub_81C9FEC(void);
void sub_81CA02C(void);
void sub_81CA0C8(void);
void sub_81CA20C(void);
bool32 sub_81CA324(void);
void sub_81CA640(void);
void sub_81CA6E0(void);
void sub_81CA714(void);
bool32 sub_81CA7C4(void);
void sub_81CA7D4(void);
void sub_81CA7F4(void);
void sub_81CA850(void);
void titlescreen_0(void);
void sub_81CA994(void);
const u16 gUnknown_0861FC78[] = INCBIN_U16("graphics/pokenav/bg.gbapal");
@ -167,3 +184,110 @@ bool32 sub_81C99FC(void)
return IsLoopedTaskActive(unk->loopedTaskId);
}
u32 sub_81C9A10(int state)
{
struct Pokenav2Struct * unk = GetSubstructPtr(2);
switch (state)
{
case 0:
InitBgTemplates(gUnknown_08620194, ARRAY_COUNT(gUnknown_08620194));
decompress_and_copy_tile_data_to_vram(1, gPokenavMessageBox_Gfx, 0, 0, 0);
SetBgTilemapBuffer(1, unk->field_08c);
CopyToBgTilemapBuffer(1, gPokenavMessageBox_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
CopyPaletteIntoBufferUnfaded(gPokenavMessageBox_Pal, 0x10, 0x20);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
return 0;
case 1:
if (free_temp_tile_data_buffers_if_possible())
return 2;
decompress_and_copy_tile_data_to_vram(2, gUnknown_0861FD6C, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(2, gUnknown_0861FFF4, 0, 0, 1);
CopyPaletteIntoBufferUnfaded(gUnknown_0861FD4C, 0x20, 0x20);
return 0;
case 2:
if (free_temp_tile_data_buffers_if_possible())
return 2;
decompress_and_copy_tile_data_to_vram(3, gUnknown_0861FC98, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(3, gUnknown_0861FCAC, 0, 0, 1);
CopyPaletteIntoBufferUnfaded(gUnknown_0861FC78, 0x30, 0x20);
if (sub_81C9894() == 3 || sub_81C9894() == 4)
sub_81CA850();
return 0;
case 3:
if (free_temp_tile_data_buffers_if_possible())
return 2;
sub_81CA6E0();
sub_81CA7D4();
return 1;
case 4:
sub_81C9FC4();
return 1;
case 5:
sub_81CA714();
sub_81CA02C();
sub_81CA640();
sub_81CA0C8();
return 0;
case 6:
if (sub_81CA7C4())
return 2;
return 1;
case 7:
ShowBg(1);
ShowBg(2);
ShowBg(3);
if (unk->field_00d)
sub_81C7AC0(1);
else
{
PlaySE(SE_PN_ON);
sub_81C7AC0(3);
}
switch (sub_81C9894())
{
case 4:
LoadLeftHeaderGfxForIndex(7);
// fallthrough
case 3:
LoadLeftHeaderGfxForIndex(1);
break;
default:
LoadLeftHeaderGfxForIndex(0);
break;
}
return 0;
case 8:
if (IsPaletteFadeActive())
return 2;
switch (sub_81C9894())
{
case 4:
sub_81C7FA0(7, FALSE, FALSE);
// fallthrough
case 3:
sub_81C7FA0(1, FALSE, FALSE);
break;
default:
sub_81C7FA0(0, FALSE, FALSE);
break;
}
sub_81CA20C();
titlescreen_0();
return 1;
case 9:
if (sub_81CA324())
return 2;
if (sub_81C8010())
return 2;
break;
}
return 4;
}