through sub_81CA0EC

This commit is contained in:
PikalaxALT 2019-05-02 17:50:42 -04:00
parent a14162eb9f
commit f13e1c78b2
4 changed files with 129 additions and 307 deletions

View File

@ -5,297 +5,6 @@
@ File centered around AllocSubstruct(2)
thumb_func_start sub_81C9FC4
sub_81C9FC4: @ 81C9FC4
push {r4,r5,lr}
movs r5, 0
ldr r4, =gUnknown_086201C4
_081C9FCA:
adds r0, r4, 0
bl LoadCompressedSpriteSheet
adds r4, 0x8
adds r5, 0x1
cmp r5, 0x1
bls _081C9FCA
ldr r0, =gUnknown_086201D4
bl Pokenav_AllocAndLoadPalettes
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C9FC4
thumb_func_start sub_81C9FEC
sub_81C9FEC: @ 81C9FEC
push {lr}
movs r0, 0x3
bl FreeSpriteTilesByTag
movs r0, 0x1
bl FreeSpriteTilesByTag
movs r0, 0x4
bl FreeSpritePaletteByTag
movs r0, 0x5
bl FreeSpritePaletteByTag
movs r0, 0x6
bl FreeSpritePaletteByTag
movs r0, 0x7
bl FreeSpritePaletteByTag
movs r0, 0x8
bl FreeSpritePaletteByTag
movs r0, 0x3
bl FreeSpritePaletteByTag
bl sub_81CA094
bl sub_81CA698
pop {r0}
bx r0
thumb_func_end sub_81C9FEC
thumb_func_start sub_81CA02C
sub_81CA02C: @ 81CA02C
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r0, 0x2
bl GetSubstructPtr
movs r2, 0
adds r0, 0x2C
mov r8, r0
_081CA03E:
movs r4, 0
lsls r0, r2, 2
lsls r1, r2, 4
adds r7, r2, 0x1
adds r0, r2
lsls r0, 18
movs r2, 0xA0
lsls r2, 14
adds r5, r0, r2
mov r0, r8
adds r6, r1, r0
_081CA054:
ldr r0, =gUnknown_0862034C
movs r1, 0x8C
asrs r2, r5, 16
movs r3, 0x3
bl CreateSprite
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 4
adds r1, r0
lsls r1, 2
ldr r0, =gSprites
adds r1, r0
stm r6!, {r1}
lsls r0, r4, 5
strh r0, [r1, 0x24]
adds r4, 0x1
cmp r4, 0x3
ble _081CA054
adds r2, r7, 0
cmp r2, 0x5
ble _081CA03E
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81CA02C
thumb_func_start sub_81CA094
sub_81CA094: @ 81CA094
push {r4-r7,lr}
movs r0, 0x2
bl GetSubstructPtr
movs r1, 0
adds r7, r0, 0
adds r7, 0x2C
_081CA0A2:
lsls r0, r1, 4
adds r6, r1, 0x1
adds r4, r0, r7
movs r5, 0x3
_081CA0AA:
ldr r0, [r4]
bl FreeSpriteOamMatrix
ldm r4!, {r0}
bl DestroySprite
subs r5, 0x1
cmp r5, 0
bge _081CA0AA
adds r1, r6, 0
cmp r1, 0x5
ble _081CA0A2
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_81CA094
thumb_func_start sub_81CA0C8
sub_81CA0C8: @ 81CA0C8
push {lr}
bl sub_81C9894
lsls r2, r0, 3
subs r2, r0
lsls r2, 2
ldr r1, =gUnknown_08620244
adds r0, r2, r1
subs r1, 0x4
adds r2, r1
ldrh r1, [r2]
ldrh r2, [r2, 0x2]
bl sub_81CA0EC
pop {r0}
bx r0
.pool
thumb_func_end sub_81CA0C8
thumb_func_start sub_81CA0EC
sub_81CA0EC: @ 81CA0EC
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x18
adds r6, r0, 0
str r1, [sp, 0x14]
str r2, [sp]
movs r0, 0x2
bl GetSubstructPtr
mov r10, r0
movs r0, 0x3
bl GetSpriteTileStartByTag
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x4]
movs r1, 0
_081CA114:
ldr r0, [r6]
cmp r0, 0
beq _081CA1B0
movs r5, 0
lsls r2, r1, 4
mov r0, r10
adds r0, 0x2C
lsls r3, r1, 2
mov r9, r3
movs r4, 0x10
add r4, r10
mov r8, r4
adds r7, r6, 0x4
str r7, [sp, 0xC]
ldr r3, [sp, 0x14]
ldr r4, [sp]
adds r3, r4
str r3, [sp, 0x8]
adds r1, 0x1
str r1, [sp, 0x10]
adds r4, r2, r0
_081CA13E:
ldr r3, [r4]
ldr r0, [r6]
ldrh r2, [r0]
ldr r7, [sp, 0x4]
adds r2, r7
lsls r0, r5, 3
adds r2, r0
ldr r1, =0x000003ff
adds r0, r1, 0
ands r2, r0
ldrh r0, [r3, 0x4]
ldr r7, =0xfffffc00
adds r1, r7, 0
ands r0, r1
orrs r0, r2
strh r0, [r3, 0x4]
ldr r0, [r6]
ldrh r0, [r0, 0x2]
adds r0, 0x4
lsls r0, 16
lsrs r0, 16
bl IndexOfSpritePaletteTag
ldr r3, [r4]
lsls r0, 4
ldrb r2, [r3, 0x5]
movs r1, 0xF
ands r1, r2
orrs r1, r0
strb r1, [r3, 0x5]
ldr r2, [r4]
adds r2, 0x3E
ldrb r0, [r2]
movs r1, 0x4
orrs r0, r1
strb r0, [r2]
ldr r0, [r4]
mov r1, sp
ldrh r1, [r1, 0x14]
strh r1, [r0, 0x22]
ldr r1, [r4]
movs r0, 0x8C
strh r0, [r1, 0x20]
ldm r4!, {r1}
lsls r0, r5, 5
strh r0, [r1, 0x24]
adds r5, 0x1
cmp r5, 0x3
ble _081CA13E
mov r1, r8
add r1, r9
movs r0, 0x1
b _081CA1EC
.pool
_081CA1B0:
lsls r2, r1, 4
mov r0, r10
adds r0, 0x2C
lsls r3, r1, 2
mov r9, r3
movs r4, 0x10
add r4, r10
mov r8, r4
adds r6, 0x4
str r6, [sp, 0xC]
ldr r7, [sp, 0x14]
ldr r3, [sp]
adds r7, r3
str r7, [sp, 0x8]
adds r1, 0x1
str r1, [sp, 0x10]
movs r3, 0x4
adds r2, r0
movs r5, 0x3
_081CA1D6:
ldm r2!, {r1}
adds r1, 0x3E
ldrb r0, [r1]
orrs r0, r3
strb r0, [r1]
subs r5, 0x1
cmp r5, 0
bge _081CA1D6
mov r1, r8
add r1, r9
movs r0, 0
_081CA1EC:
str r0, [r1]
ldr r6, [sp, 0xC]
ldr r4, [sp, 0x8]
str r4, [sp, 0x14]
ldr r1, [sp, 0x10]
cmp r1, 0x5
ble _081CA114
add sp, 0x18
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_81CA0EC
thumb_func_start sub_81CA20C
sub_81CA20C: @ 81CA20C
push {r4-r7,lr}

View File

@ -5,19 +5,6 @@
// pokenav_unk_2.s
gUnknown_086201C4:: @ 86201C4
obj_tiles gPokenavOptions_Gfx, 0x3400, 0x0003
obj_tiles gUnknown_08620124, 0x0100, 0x0001
gUnknown_086201D4:: @ 86201D4
.4byte gPokenavOptions_Pal + 0x0, 4
.4byte gPokenavOptions_Pal + 0x20, 5
.4byte gPokenavOptions_Pal + 0x40, 6
.4byte gPokenavOptions_Pal + 0x60, 7
.4byte gPokenavOptions_Pal + 0x80, 8
.4byte gUnknown_08620104, 3
.4byte 0, 0
gUnknown_0862020C:: @ 862020C
.2byte 0, 0
@ -59,8 +46,6 @@ gUnknown_0862023C:: @ 862023C
gUnknown_08620240:: @ 8620240
.2byte 0x2A, 0x14
gUnknown_08620244:: @ 8620244
.4byte gUnknown_0862020C
.4byte gUnknown_08620210
.4byte gUnknown_0862021C

View File

@ -4945,5 +4945,7 @@ extern const u16 gUnknown_08DE3398[];
extern const u32 gPokenavMessageBox_Gfx[];
extern const u32 gPokenavMessageBox_Tilemap[];
extern const u16 gPokenavMessageBox_Pal[];
extern const u32 gPokenavOptions_Gfx[];
extern const u16 gPokenavOptions_Pal[];
#endif //GUARD_GRAPHICS_H

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "alloc.h"
#include "decompress.h"
#include "bg.h"
#include "menu.h"
#include "window.h"
@ -20,7 +21,9 @@ struct Pokenav2Struct
u8 field_00b;
u8 field_00c;
u8 field_00d;
u8 filler_00e[0x7E];
bool32 field_010[6];
u8 filler_028[4];
struct Sprite * field_02c[6][4];
u8 field_08c[0x800];
};
@ -38,12 +41,15 @@ u32 sub_81C9F28(int state);
void sub_81C9FC4(void);
void sub_81C9FEC(void);
void sub_81CA02C(void);
void sub_81CA094(void);
void sub_81CA0C8(void);
void sub_81CA0EC(const u16 *const * a0, s32 a1, s32 a2);
void sub_81CA20C(void);
void sub_81CA278(void);
void sub_81CA2DC(void);
bool32 sub_81CA324(void);
void sub_81CA640(void);
void sub_81CA698(void);
void sub_81CA6E0(void);
void sub_81CA714(void);
void sub_81CA770(void);
@ -109,6 +115,32 @@ const LoopedTask gUnknown_086201A0[] = {
sub_81C9F28
};
const struct CompressedSpriteSheet gUnknown_086201C4[] = {
{gPokenavOptions_Gfx, 0x3400, 0x0003},
{gUnknown_08620124, 0x0100, 0x0001}
};
const struct SpritePalette gUnknown_086201D4[] = {
{gPokenavOptions_Pal + 0x00, 4},
{gPokenavOptions_Pal + 0x10, 5},
{gPokenavOptions_Pal + 0x20, 6},
{gPokenavOptions_Pal + 0x30, 7},
{gPokenavOptions_Pal + 0x40, 8},
{gUnknown_08620104, 3},
{NULL, 0}
};
struct UnkStruct_08620240
{
u16 field_0;
u16 field_2;
const u16 *field_4[6];
};
extern const struct UnkStruct_08620240 gUnknown_08620240[];
extern const struct SpriteTemplate gUnknown_0862034C;
bool32 sub_81C98D4(void)
{
s32 i;
@ -535,3 +567,97 @@ u32 sub_81C9F28(int state)
}
return 4;
}
void sub_81C9FC4(void)
{
u32 i;
for (i = 0; i < 2; i++)
LoadCompressedSpriteSheet(&gUnknown_086201C4[i]);
Pokenav_AllocAndLoadPalettes(gUnknown_086201D4);
}
void sub_81C9FEC(void)
{
FreeSpriteTilesByTag(3);
FreeSpriteTilesByTag(1);
FreeSpritePaletteByTag(4);
FreeSpritePaletteByTag(5);
FreeSpritePaletteByTag(6);
FreeSpritePaletteByTag(7);
FreeSpritePaletteByTag(8);
FreeSpritePaletteByTag(3);
sub_81CA094();
sub_81CA698();
}
void sub_81CA02C(void)
{
s32 i, j;
struct Pokenav2Struct * unk = GetSubstructPtr(2);
for (i = 0; i < 6; i++)
{
for (j = 0; j < 4; j++)
{
u8 spriteId = CreateSprite(&gUnknown_0862034C, 0x8c, 20 * i + 40, 3);
unk->field_02c[i][j] = &gSprites[spriteId];
gSprites[spriteId].pos2.x = 32 * j;
}
}
}
void sub_81CA094(void)
{
s32 i, j;
struct Pokenav2Struct * unk = GetSubstructPtr(2);
for (i = 0; i < 6; i++)
{
for (j = 0; j < 4; j++)
{
FreeSpriteOamMatrix(unk->field_02c[i][j]);
DestroySprite(unk->field_02c[i][j]);
}
}
}
void sub_81CA0C8(void)
{
s32 r0 = sub_81C9894();
sub_81CA0EC(gUnknown_08620240[r0].field_4, gUnknown_08620240[r0].field_0, gUnknown_08620240[r0].field_2);
}
void sub_81CA0EC(const u16 *const *a0, s32 a1, s32 a2)
{
s32 i, j;
struct Pokenav2Struct * unk = GetSubstructPtr(2);
s32 sp04 = GetSpriteTileStartByTag(3);
for (i = 0; i < 6; i++)
{
if (*a0 != NULL)
{
for (j = 0; j < 4; j++)
{
unk->field_02c[i][j]->oam.tileNum = (*a0)[0] + sp04 + 8 * j;
unk->field_02c[i][j]->oam.paletteNum = IndexOfSpritePaletteTag((*a0)[1] + 4);
unk->field_02c[i][j]->invisible = TRUE;
unk->field_02c[i][j]->pos1.y = a1;
unk->field_02c[i][j]->pos1.x = 0x8c;
unk->field_02c[i][j]->pos2.x = 32 * j;
}
unk->field_010[i] = TRUE;
}
else
{
for (j = 0; j < 4; j++)
{
unk->field_02c[i][j]->invisible = TRUE;
}
unk->field_010[i] = FALSE;
}
a0++;
a1 += a2;
}
}