mirror of
https://github.com/jiangzhengwenjz/katam.git
synced 2024-11-27 07:00:41 +00:00
sub_081569A0
This commit is contained in:
parent
e4200f6c3c
commit
a3982d384c
@ -7561,514 +7561,3 @@ _08156988:
|
||||
.align 2, 0
|
||||
_08156998: .4byte gUnk_030039A4
|
||||
_0815699C: .4byte gUnk_03002EC0
|
||||
|
||||
thumb_func_start sub_081569A0
|
||||
sub_081569A0: @ 0x081569A0
|
||||
push {r4, r5, r6, r7, lr}
|
||||
mov r7, sl
|
||||
mov r6, sb
|
||||
mov r5, r8
|
||||
push {r5, r6, r7}
|
||||
sub sp, #0x2c
|
||||
mov sb, r0
|
||||
str r1, [sp, #8]
|
||||
lsls r2, r2, #0x18
|
||||
lsrs r2, r2, #0x18
|
||||
str r2, [sp, #0xc]
|
||||
ldr r2, [r0, #4]
|
||||
movs r0, #1
|
||||
rsbs r0, r0, #0
|
||||
cmp r2, r0
|
||||
bne _081569C2
|
||||
b _08156D58
|
||||
_081569C2:
|
||||
lsrs r0, r2, #0x1c
|
||||
cmp r0, #0
|
||||
bne _081569E8
|
||||
ldr r0, _081569E4 @ =gUnk_03003674
|
||||
ldr r0, [r0]
|
||||
mov r3, sb
|
||||
ldrh r1, [r3, #0xc]
|
||||
ldr r0, [r0, #4]
|
||||
lsls r1, r1, #2
|
||||
adds r1, r1, r0
|
||||
lsls r0, r2, #1
|
||||
adds r0, r0, r2
|
||||
lsls r0, r0, #2
|
||||
ldr r1, [r1]
|
||||
adds r1, r1, r0
|
||||
mov sl, r1
|
||||
b _081569FE
|
||||
.align 2, 0
|
||||
_081569E4: .4byte gUnk_03003674
|
||||
_081569E8:
|
||||
ldr r0, _08156A74 @ =gUnk_03003674
|
||||
ldr r1, [r0]
|
||||
mov r4, sb
|
||||
ldrh r0, [r4, #0xc]
|
||||
ldr r1, [r1, #4]
|
||||
lsls r0, r0, #2
|
||||
adds r0, r0, r1
|
||||
lsls r1, r2, #4
|
||||
ldr r0, [r0]
|
||||
adds r0, r0, r1
|
||||
mov sl, r0
|
||||
_081569FE:
|
||||
mov r5, sl
|
||||
ldrh r0, [r5, #2]
|
||||
mov r1, sb
|
||||
strb r0, [r1, #0x1e]
|
||||
movs r2, #0x10
|
||||
ldrsh r0, [r1, r2]
|
||||
str r0, [sp]
|
||||
movs r3, #0x12
|
||||
ldrsh r0, [r1, r3]
|
||||
str r0, [sp, #4]
|
||||
ldr r1, [r1, #8]
|
||||
movs r0, #0x80
|
||||
lsls r0, r0, #0xa
|
||||
ands r0, r1
|
||||
adds r3, r1, #0
|
||||
cmp r0, #0
|
||||
beq _08156A36
|
||||
ldr r2, _08156A78 @ =gUnk_030023F4
|
||||
movs r4, #0
|
||||
ldrsh r1, [r2, r4]
|
||||
ldr r0, [sp]
|
||||
subs r0, r0, r1
|
||||
str r0, [sp]
|
||||
movs r5, #2
|
||||
ldrsh r1, [r2, r5]
|
||||
ldr r0, [sp, #4]
|
||||
subs r0, r0, r1
|
||||
str r0, [sp, #4]
|
||||
_08156A36:
|
||||
mov r0, sl
|
||||
ldrh r0, [r0, #4]
|
||||
str r0, [sp, #0x10]
|
||||
mov r1, sl
|
||||
ldrh r1, [r1, #6]
|
||||
str r1, [sp, #0x14]
|
||||
movs r0, #0x20
|
||||
ands r0, r3
|
||||
cmp r0, #0
|
||||
beq _08156A7C
|
||||
movs r0, #0x40
|
||||
ands r0, r3
|
||||
cmp r0, #0
|
||||
beq _08156AC0
|
||||
ldr r2, [sp, #0x10]
|
||||
lsrs r1, r2, #1
|
||||
ldr r0, [sp]
|
||||
subs r0, r0, r1
|
||||
str r0, [sp]
|
||||
mov r3, sl
|
||||
ldrh r1, [r3, #6]
|
||||
lsrs r1, r1, #1
|
||||
ldr r0, [sp, #4]
|
||||
subs r0, r0, r1
|
||||
str r0, [sp, #4]
|
||||
lsls r2, r2, #1
|
||||
str r2, [sp, #0x10]
|
||||
ldr r4, [sp, #0x14]
|
||||
lsls r4, r4, #1
|
||||
str r4, [sp, #0x14]
|
||||
b _08156AC0
|
||||
.align 2, 0
|
||||
_08156A74: .4byte gUnk_03003674
|
||||
_08156A78: .4byte gUnk_030023F4
|
||||
_08156A7C:
|
||||
movs r0, #0x80
|
||||
lsls r0, r0, #4
|
||||
ands r0, r3
|
||||
cmp r0, #0
|
||||
beq _08156A92
|
||||
mov r5, sl
|
||||
movs r0, #0xa
|
||||
ldrsh r1, [r5, r0]
|
||||
ldr r2, [sp, #0x14]
|
||||
subs r1, r2, r1
|
||||
b _08156A98
|
||||
_08156A92:
|
||||
mov r4, sl
|
||||
movs r5, #0xa
|
||||
ldrsh r1, [r4, r5]
|
||||
_08156A98:
|
||||
ldr r0, [sp, #4]
|
||||
subs r0, r0, r1
|
||||
str r0, [sp, #4]
|
||||
movs r0, #0x80
|
||||
lsls r0, r0, #3
|
||||
ands r0, r3
|
||||
cmp r0, #0
|
||||
beq _08156AB4
|
||||
mov r0, sl
|
||||
movs r2, #8
|
||||
ldrsh r1, [r0, r2]
|
||||
ldr r3, [sp, #0x10]
|
||||
subs r1, r3, r1
|
||||
b _08156ABA
|
||||
_08156AB4:
|
||||
mov r4, sl
|
||||
movs r5, #8
|
||||
ldrsh r1, [r4, r5]
|
||||
_08156ABA:
|
||||
ldr r0, [sp]
|
||||
subs r0, r0, r1
|
||||
str r0, [sp]
|
||||
_08156AC0:
|
||||
mov r0, sb
|
||||
movs r2, #0x10
|
||||
ldrsh r1, [r0, r2]
|
||||
ldr r0, [sp]
|
||||
subs r0, r0, r1
|
||||
str r0, [sp, #0x24]
|
||||
mov r3, sb
|
||||
movs r4, #0x12
|
||||
ldrsh r1, [r3, r4]
|
||||
ldr r0, [sp, #4]
|
||||
subs r0, r0, r1
|
||||
str r0, [sp, #0x28]
|
||||
ldr r0, [sp]
|
||||
ldr r5, [sp, #0x10]
|
||||
adds r0, r0, r5
|
||||
cmp r0, #0
|
||||
bge _08156AE4
|
||||
b _08156D58
|
||||
_08156AE4:
|
||||
ldr r0, [sp]
|
||||
cmp r0, #0xf0
|
||||
ble _08156AEC
|
||||
b _08156D58
|
||||
_08156AEC:
|
||||
ldr r0, [sp, #4]
|
||||
ldr r1, [sp, #0x14]
|
||||
adds r0, r0, r1
|
||||
cmp r0, #0
|
||||
bge _08156AF8
|
||||
b _08156D58
|
||||
_08156AF8:
|
||||
ldr r0, [sp, #4]
|
||||
cmp r0, #0xa0
|
||||
ble _08156B00
|
||||
b _08156D58
|
||||
_08156B00:
|
||||
movs r2, #0
|
||||
str r2, [sp, #0x18]
|
||||
mov r3, sl
|
||||
ldrh r3, [r3, #2]
|
||||
cmp r2, r3
|
||||
blo _08156B0E
|
||||
b _08156D58
|
||||
_08156B0E:
|
||||
ldr r0, _08156BCC @ =gUnk_03003674
|
||||
ldr r1, [r0]
|
||||
mov r4, sb
|
||||
ldrh r0, [r4, #0xc]
|
||||
ldr r1, [r1, #8]
|
||||
lsls r0, r0, #2
|
||||
adds r0, r0, r1
|
||||
ldr r4, [r0]
|
||||
mov r5, sb
|
||||
ldrh r0, [r5, #0x14]
|
||||
movs r2, #0xf8
|
||||
lsls r2, r2, #3
|
||||
adds r1, r2, #0
|
||||
ands r0, r1
|
||||
lsrs r0, r0, #6
|
||||
bl sub_08156D84
|
||||
adds r6, r0, #0
|
||||
ldr r0, _08156BD0 @ =gUnk_03006CC4
|
||||
ldr r0, [r0]
|
||||
cmp r0, r6
|
||||
bne _08156B3C
|
||||
b _08156D58
|
||||
_08156B3C:
|
||||
ldr r2, _08156BD4 @ =0x040000D4
|
||||
mov r3, sl
|
||||
ldrh r0, [r3]
|
||||
ldr r5, _08156BD8 @ =0x00003FFF
|
||||
adds r1, r5, #0
|
||||
ands r1, r0
|
||||
ldr r0, [sp, #0x18]
|
||||
adds r1, r1, r0
|
||||
lsls r0, r1, #1
|
||||
adds r0, r0, r1
|
||||
lsls r0, r0, #1
|
||||
adds r0, r4, r0
|
||||
str r0, [r2]
|
||||
str r6, [r2, #4]
|
||||
ldr r0, _08156BDC @ =0x80000003
|
||||
str r0, [r2, #8]
|
||||
ldr r0, [r2, #8]
|
||||
ldrh r1, [r6, #2]
|
||||
ldr r2, _08156BE0 @ =0x000001FF
|
||||
adds r0, r2, #0
|
||||
adds r3, r0, #0
|
||||
ands r3, r1
|
||||
str r3, [sp, #0x1c]
|
||||
ldrh r0, [r6]
|
||||
ldrb r4, [r6]
|
||||
str r4, [sp, #0x20]
|
||||
movs r3, #0xfe
|
||||
lsls r3, r3, #8
|
||||
ands r3, r1
|
||||
movs r5, #0
|
||||
strh r3, [r6, #2]
|
||||
movs r2, #0xfe
|
||||
lsls r2, r2, #8
|
||||
ands r2, r0
|
||||
strh r2, [r6]
|
||||
mov r1, sb
|
||||
ldrb r0, [r1, #0x1f]
|
||||
lsls r0, r0, #0xc
|
||||
ldrh r4, [r6, #4]
|
||||
adds r0, r0, r4
|
||||
strh r0, [r6, #4]
|
||||
ldr r4, [r1, #8]
|
||||
movs r0, #0x20
|
||||
ands r0, r4
|
||||
cmp r0, #0
|
||||
beq _08156BE4
|
||||
movs r1, #0x80
|
||||
lsls r1, r1, #1
|
||||
adds r0, r1, #0
|
||||
orrs r2, r0
|
||||
orrs r2, r5
|
||||
strh r2, [r6]
|
||||
mov r3, sb
|
||||
ldr r0, [r3, #8]
|
||||
movs r1, #0x40
|
||||
ands r0, r1
|
||||
cmp r0, #0
|
||||
beq _08156BBA
|
||||
movs r4, #0x80
|
||||
lsls r4, r4, #2
|
||||
adds r0, r4, #0
|
||||
orrs r2, r0
|
||||
strh r2, [r6]
|
||||
_08156BBA:
|
||||
mov r5, sb
|
||||
ldr r0, [r5, #8]
|
||||
movs r1, #0x1f
|
||||
ands r0, r1
|
||||
lsls r0, r0, #9
|
||||
ldrh r1, [r6, #2]
|
||||
orrs r0, r1
|
||||
strh r0, [r6, #2]
|
||||
b _08156C58
|
||||
.align 2, 0
|
||||
_08156BCC: .4byte gUnk_03003674
|
||||
_08156BD0: .4byte gUnk_03006CC4
|
||||
_08156BD4: .4byte 0x040000D4
|
||||
_08156BD8: .4byte 0x00003FFF
|
||||
_08156BDC: .4byte 0x80000003
|
||||
_08156BE0: .4byte 0x000001FF
|
||||
_08156BE4:
|
||||
movs r1, #0xc0
|
||||
lsls r1, r1, #8
|
||||
adds r0, r2, #0
|
||||
ands r0, r1
|
||||
lsrs r2, r0, #0xc
|
||||
adds r0, r3, #0
|
||||
ands r0, r1
|
||||
lsrs r0, r0, #0xe
|
||||
orrs r2, r0
|
||||
lsrs r1, r4, #0xb
|
||||
movs r4, #1
|
||||
ands r1, r4
|
||||
mov r5, sl
|
||||
ldrh r0, [r5]
|
||||
lsrs r0, r0, #0xf
|
||||
cmp r1, r0
|
||||
beq _08156C26
|
||||
movs r0, #0x80
|
||||
lsls r0, r0, #6
|
||||
adds r1, r0, #0
|
||||
adds r0, r3, #0
|
||||
eors r0, r1
|
||||
strh r0, [r6, #2]
|
||||
ldr r0, _08156D68 @ =gUnk_08D6084C
|
||||
lsls r1, r2, #1
|
||||
adds r0, #1
|
||||
adds r1, r1, r0
|
||||
ldrb r0, [r1]
|
||||
ldr r1, [sp, #0x14]
|
||||
subs r0, r1, r0
|
||||
ldr r3, [sp, #0x20]
|
||||
subs r3, r0, r3
|
||||
str r3, [sp, #0x20]
|
||||
_08156C26:
|
||||
mov r5, sb
|
||||
ldr r1, [r5, #8]
|
||||
lsrs r1, r1, #0xa
|
||||
mov r3, sl
|
||||
ldrh r0, [r3]
|
||||
lsrs r0, r0, #0xe
|
||||
eors r0, r1
|
||||
ands r0, r4
|
||||
cmp r0, #0
|
||||
beq _08156C58
|
||||
ldrh r0, [r6, #2]
|
||||
movs r4, #0x80
|
||||
lsls r4, r4, #5
|
||||
adds r1, r4, #0
|
||||
eors r0, r1
|
||||
strh r0, [r6, #2]
|
||||
ldr r1, _08156D68 @ =gUnk_08D6084C
|
||||
lsls r0, r2, #1
|
||||
adds r0, r0, r1
|
||||
ldrb r0, [r0]
|
||||
ldr r5, [sp, #0x10]
|
||||
subs r0, r5, r0
|
||||
ldr r1, [sp, #0x1c]
|
||||
subs r1, r0, r1
|
||||
str r1, [sp, #0x1c]
|
||||
_08156C58:
|
||||
mov r3, sb
|
||||
ldr r2, [r3, #8]
|
||||
movs r0, #0xc0
|
||||
lsls r0, r0, #1
|
||||
ands r2, r0
|
||||
lsls r2, r2, #3
|
||||
ldrh r0, [r6]
|
||||
orrs r2, r0
|
||||
strh r2, [r6]
|
||||
ldr r0, [r3, #8]
|
||||
movs r1, #0xc0
|
||||
lsls r1, r1, #6
|
||||
ands r0, r1
|
||||
lsrs r3, r0, #2
|
||||
ldrh r0, [r6, #4]
|
||||
orrs r3, r0
|
||||
strh r3, [r6, #4]
|
||||
ldr r0, [sp, #4]
|
||||
ldr r4, [sp, #0x20]
|
||||
adds r0, r0, r4
|
||||
movs r1, #0xff
|
||||
ands r0, r1
|
||||
adds r2, r2, r0
|
||||
strh r2, [r6]
|
||||
ldr r0, [sp]
|
||||
ldr r5, [sp, #0x1c]
|
||||
adds r0, r0, r5
|
||||
ldr r4, _08156D6C @ =0x000001FF
|
||||
adds r1, r4, #0
|
||||
ands r0, r1
|
||||
ldrh r5, [r6, #2]
|
||||
adds r0, r0, r5
|
||||
strh r0, [r6, #2]
|
||||
movs r1, #0x80
|
||||
lsls r1, r1, #6
|
||||
adds r0, r1, #0
|
||||
ands r2, r0
|
||||
cmp r2, #0
|
||||
beq _08156CB2
|
||||
ldr r2, _08156D70 @ =0x000003FF
|
||||
adds r1, r2, #0
|
||||
adds r0, r3, #0
|
||||
ands r0, r1
|
||||
adds r0, r3, r0
|
||||
strh r0, [r6, #4]
|
||||
_08156CB2:
|
||||
mov r3, sb
|
||||
ldr r0, [r3]
|
||||
ldr r4, _08156D74 @ =0xF9FF0000
|
||||
adds r0, r0, r4
|
||||
lsrs r0, r0, #5
|
||||
ldrh r5, [r6, #4]
|
||||
adds r0, r0, r5
|
||||
strh r0, [r6, #4]
|
||||
movs r7, #0
|
||||
ldr r0, [sp, #0xc]
|
||||
cmp r7, r0
|
||||
bhs _08156D44
|
||||
ldr r1, _08156D78 @ =0x040000D4
|
||||
mov r8, r1
|
||||
_08156CCE:
|
||||
mov r2, sb
|
||||
ldrh r0, [r2, #0x14]
|
||||
movs r3, #0xf8
|
||||
lsls r3, r3, #3
|
||||
adds r1, r3, #0
|
||||
ands r0, r1
|
||||
lsrs r0, r0, #6
|
||||
bl sub_08156D84
|
||||
adds r5, r0, #0
|
||||
ldr r0, _08156D7C @ =gUnk_03006CC4
|
||||
ldr r0, [r0]
|
||||
cmp r0, r6
|
||||
beq _08156D58
|
||||
mov r4, r8
|
||||
str r6, [r4]
|
||||
str r5, [r4, #4]
|
||||
ldr r0, _08156D80 @ =0x80000003
|
||||
str r0, [r4, #8]
|
||||
ldr r0, [r4, #8]
|
||||
ldrh r4, [r5, #2]
|
||||
movs r0, #0xfe
|
||||
lsls r0, r0, #8
|
||||
ands r4, r0
|
||||
strh r4, [r5, #2]
|
||||
ldrh r2, [r5]
|
||||
movs r1, #0xff
|
||||
lsls r1, r1, #8
|
||||
adds r0, r1, #0
|
||||
ands r2, r0
|
||||
strh r2, [r5]
|
||||
lsls r3, r7, #2
|
||||
ldr r0, [sp, #8]
|
||||
adds r3, r3, r0
|
||||
ldrh r0, [r3, #2]
|
||||
ldr r1, [sp, #0x28]
|
||||
adds r0, r0, r1
|
||||
ldr r1, [sp, #0x20]
|
||||
adds r0, r0, r1
|
||||
movs r1, #0xff
|
||||
ands r0, r1
|
||||
adds r2, r2, r0
|
||||
strh r2, [r5]
|
||||
ldrh r0, [r3]
|
||||
ldr r2, [sp, #0x24]
|
||||
adds r0, r0, r2
|
||||
ldr r3, [sp, #0x1c]
|
||||
adds r0, r0, r3
|
||||
ldr r2, _08156D6C @ =0x000001FF
|
||||
adds r1, r2, #0
|
||||
ands r0, r1
|
||||
adds r4, r4, r0
|
||||
strh r4, [r5, #2]
|
||||
adds r0, r7, #1
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r7, r0, #0x18
|
||||
ldr r3, [sp, #0xc]
|
||||
cmp r7, r3
|
||||
blo _08156CCE
|
||||
_08156D44:
|
||||
ldr r0, [sp, #0x18]
|
||||
adds r0, #1
|
||||
lsls r0, r0, #0x18
|
||||
lsrs r0, r0, #0x18
|
||||
str r0, [sp, #0x18]
|
||||
mov r4, sl
|
||||
ldrh r4, [r4, #2]
|
||||
cmp r0, r4
|
||||
bhs _08156D58
|
||||
b _08156B0E
|
||||
_08156D58:
|
||||
add sp, #0x2c
|
||||
pop {r3, r4, r5}
|
||||
mov r8, r3
|
||||
mov sb, r4
|
||||
mov sl, r5
|
||||
pop {r4, r5, r6, r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08156D68: .4byte gUnk_08D6084C
|
||||
_08156D6C: .4byte 0x000001FF
|
||||
_08156D70: .4byte 0x000003FF
|
||||
_08156D74: .4byte 0xF9FF0000
|
||||
_08156D78: .4byte 0x040000D4
|
||||
_08156D7C: .4byte gUnk_03006CC4
|
||||
_08156D80: .4byte 0x80000003
|
||||
|
@ -70,11 +70,11 @@ struct Object {
|
||||
|
||||
struct Sprite {
|
||||
s32 unk0;
|
||||
s32 unk4;
|
||||
u32 unk4;
|
||||
u32 unk8;
|
||||
u16 unkC;
|
||||
u8 fillerE[2];
|
||||
u16 unk10; // TODO: I think the field is s16, but it breaks function in title_screen.c
|
||||
s16 unk10;
|
||||
s16 unk12;
|
||||
u16 unk14;
|
||||
u16 unk16;
|
||||
@ -320,7 +320,8 @@ extern u8 gUnk_03000554;
|
||||
|
||||
extern u32 gUnk_03002440;
|
||||
extern u32 gUnk_03002E60;
|
||||
extern const u32* gUnk_03003674;
|
||||
|
||||
extern const s16 *const *const *gUnk_03003674;
|
||||
|
||||
extern u32 gRngVal;
|
||||
#define Rand32() ({ gRngVal = gRngVal * 1663525 + 1013904223; })
|
||||
@ -342,7 +343,11 @@ extern const u16 gUnk_08352E04[];
|
||||
extern const u8 gUnk_08357F24[];
|
||||
extern const u8 gUnk_08357F44[];
|
||||
|
||||
extern const u32 gUnk_083B909C;
|
||||
// This array may be a struct. Pointers inside have different types:
|
||||
// [0] -> const u16 *const *const *const
|
||||
// [1 ... 2] -> const u16 *const *const
|
||||
// [3 ... 4] -> const u16 *const
|
||||
extern const void *const gUnk_083B909C[];
|
||||
|
||||
extern const struct Unk_08D60FA4* gUnk_08D60FA4[];
|
||||
extern const struct Object (*gUnk_08D637AC[])[];
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
extern u8 gUnk_030035F0[];
|
||||
|
||||
extern void DrawToOamBuffer(void);
|
||||
void DrawToOamBuffer(void);
|
||||
OamData *sub_08156D84(u8);
|
||||
|
||||
#endif
|
||||
|
@ -49,8 +49,8 @@ struct PlttData
|
||||
u16 unused_15:1;
|
||||
};
|
||||
|
||||
struct OamData
|
||||
{
|
||||
typedef union {
|
||||
struct {
|
||||
/*0x00*/ u32 y:8;
|
||||
/*0x01*/ u32 affineMode:2; // 0x1, 0x2 -> 0x4
|
||||
u32 objMode:2; // 0x4, 0x8 -> 0xC
|
||||
@ -65,15 +65,19 @@ struct OamData
|
||||
/*0x04*/ u16 tileNum:10; // 0x3FF
|
||||
u16 priority:2; // 0x400, 0x800 -> 0xC00
|
||||
u16 paletteNum:4;
|
||||
/*0x06*/ union __attribute__((packed, aligned(2))) {
|
||||
u16 all;
|
||||
struct __attribute__((packed, aligned(2))) {
|
||||
u16 fractional:8;
|
||||
u16 integer:7;
|
||||
u16 sign:1;
|
||||
} split;
|
||||
} affineParam;
|
||||
};
|
||||
|
||||
/*0x06*/ u16 fractional:8;
|
||||
u16 integer:7;
|
||||
u16 sign:1;
|
||||
} split;
|
||||
|
||||
struct {
|
||||
u16 attr0;
|
||||
u16 attr1;
|
||||
u16 attr2;
|
||||
u16 affineParam;
|
||||
} all;
|
||||
} OamData;
|
||||
|
||||
#define ST_OAM_HFLIP 0x08
|
||||
#define ST_OAM_VFLIP 0x10
|
||||
|
@ -21,8 +21,8 @@ struct Unk_020382D0 {
|
||||
};
|
||||
|
||||
struct Unk_030023F4 {
|
||||
u16 unk0;
|
||||
u16 unk2;
|
||||
s16 unk0;
|
||||
s16 unk2;
|
||||
};
|
||||
|
||||
struct BgAffineRegs {
|
||||
@ -106,7 +106,7 @@ extern u8* gUnk_03002EAC;
|
||||
extern u16 gBgCntRegs[4];
|
||||
extern u16 gUnk_03002EB8;
|
||||
extern struct Unk_03002EC0 gUnk_03002EC0[];
|
||||
extern struct OamData gUnk_030031C0[];
|
||||
extern OamData gUnk_030031C0[];
|
||||
extern u8 gUnk_030035C0[];
|
||||
extern u8 gUnk_030035D4;
|
||||
extern u8 gUnk_030035E0[];
|
||||
@ -135,7 +135,7 @@ extern u8 gUnk_03006078;
|
||||
extern u8 gUnk_0300607C;
|
||||
extern u8 gUnk_03006080[];
|
||||
extern u32 gUnk_030060A0;
|
||||
extern struct OamData gOamBuffer[];
|
||||
extern OamData gOamBuffer[];
|
||||
extern u8 gUnk_030068B0;
|
||||
extern u16 gUnk_030068B4;
|
||||
extern u16 gUnk_030068B8;
|
||||
|
@ -45,7 +45,7 @@ extern struct Task* gNextTask;
|
||||
extern struct Task* gCurTask;
|
||||
extern struct Unk_03003A20 gUnk_03003A20[];
|
||||
extern u8 gUnk_030068D4;
|
||||
extern u32 gUnk_03006CC4;
|
||||
extern OamData *gUnk_03006CC4;
|
||||
|
||||
void sub_081590EC(u32*);
|
||||
u32 TaskInit(void);
|
||||
|
@ -1,23 +1,147 @@
|
||||
#include "data.h"
|
||||
#include "draw_buffer.h"
|
||||
#include "main.h"
|
||||
#include "task.h"
|
||||
|
||||
// TODO: define file boundaries
|
||||
|
||||
struct OamData *sub_08156D84(u8 r5) {
|
||||
struct R10Struct {
|
||||
u16 unk0, unk2, unk4, unk6;
|
||||
s16 unk8, unkA;
|
||||
};
|
||||
|
||||
extern const u8 gUnk_08D6084C[][2];
|
||||
|
||||
void sub_081569A0(struct Sprite *sb, u16 *sp08, u8 sp0C) {
|
||||
vs32 sp00[1], sp04[1];
|
||||
s32 sp10[1], sp14[1];
|
||||
u8 sp18, i;
|
||||
u32 sp1C, sp20, sp24, sp28;
|
||||
const struct R10Struct *sl;
|
||||
|
||||
if (sb->unk4 != -1) {
|
||||
if (!(sb->unk4 >> 28))
|
||||
sl = (const void *)gUnk_03003674[1][sb->unkC] + sb->unk4 * 12;
|
||||
else
|
||||
sl = (const void *)gUnk_03003674[1][sb->unkC] + sb->unk4 * 16;
|
||||
|
||||
sb->unk1E = sl->unk2;
|
||||
sp00[0] = sb->unk10;
|
||||
sp04[0] = sb->unk12;
|
||||
if (sb->unk8 & 0x20000) {
|
||||
sp00[0] -= gUnk_030023F4.unk0;
|
||||
sp04[0] -= gUnk_030023F4.unk2;
|
||||
}
|
||||
|
||||
sp10[0] = sl->unk4;
|
||||
sp14[0] = sl->unk6;
|
||||
|
||||
if (sb->unk8 & 0x20) {
|
||||
if (sb->unk8 & 0x40) {
|
||||
sp00[0] -= sl->unk4 >> 1;
|
||||
sp04[0] -= sl->unk6 >> 1;
|
||||
sp10[0] <<= 1;
|
||||
sp14[0] <<= 1;
|
||||
}
|
||||
} else {
|
||||
u32 r1;
|
||||
|
||||
if (sb->unk8 & 0x800) {
|
||||
r1 = sl->unkA;
|
||||
r1 = sp14[0] - r1;
|
||||
} else {
|
||||
r1 = sl->unkA;
|
||||
}
|
||||
sp04[0] -= r1;
|
||||
|
||||
if (sb->unk8 & 0x400) {
|
||||
r1 = sl->unk8;
|
||||
r1 = sp10[0] - r1;
|
||||
} else {
|
||||
r1 = sl->unk8;
|
||||
}
|
||||
sp00[0] -= r1;
|
||||
}
|
||||
|
||||
sp24 = sp00[0] - sb->unk10;
|
||||
sp28 = sp04[0] - sb->unk12;
|
||||
if (sp00[0] + sp10[0] >= 0 && sp00[0] <= 240
|
||||
&& sp04[0] + sp14[0] >= 0 && sp04[0] <= 160) {
|
||||
for (sp18 = 0; sp18 < sl->unk2; ++sp18) {
|
||||
const s16 *r4 = gUnk_03003674[2][sb->unkC];
|
||||
OamData *r6 = sub_08156D84((sb->unk14 & 0x7C0) >> 6);
|
||||
|
||||
if (gUnk_03006CC4 == r6) return;
|
||||
DmaCopy16(3, &r4[3 * ((sl->unk0 & 0x3FFF) + sp18)], r6, 6); // excluding affine params
|
||||
sp1C = r6->all.attr1 & 0x1FF;
|
||||
sp20 = (u8)r6->all.attr0;
|
||||
r6->all.attr1 &= 0xFE00;
|
||||
r6->all.attr0 &= 0xFE00;
|
||||
r6->all.attr2 += sb->unk1F << 12;
|
||||
if (sb->unk8 & 0x20) {
|
||||
r6->all.attr0 |= 0x100;
|
||||
if (sb->unk8 & 0x40)
|
||||
r6->all.attr0 |= 0x200;
|
||||
r6->all.attr1 |= (sb->unk8 & 0x1F) << 9;
|
||||
} else {
|
||||
u32 r2 = ((r6->all.attr0 & 0xC000) >> 12) | ((r6->all.attr1 & 0xC000) >> 14);
|
||||
u32 r1 = (sb->unk8 >> 11) & 1;
|
||||
u32 r0 = sl->unk0 >> 15;
|
||||
|
||||
if (r1 != r0) {
|
||||
r6->all.attr1 ^= 0x2000;
|
||||
sp20 = sp14[0] - gUnk_08D6084C[r2][1] - sp20;
|
||||
}
|
||||
|
||||
r1 = sb->unk8;
|
||||
r1 >>= 10;
|
||||
r0 = sl->unk0 >> 14;
|
||||
if ((r0 ^ r1) & 1) {
|
||||
r6->all.attr1 ^= 0x1000;
|
||||
sp1C = sp10[0] - gUnk_08D6084C[r2][0] - sp1C;
|
||||
}
|
||||
}
|
||||
|
||||
r6->all.attr0 |= (sb->unk8 & 0x180) * 8;
|
||||
r6->all.attr2 |= (sb->unk8 & 0x3000) >> 2;
|
||||
r6->all.attr0 += (sp04[0] + sp20) & 0xFF;
|
||||
r6->all.attr1 += (sp00[0] + sp1C) & 0x1FF;
|
||||
if (r6->all.attr0 & 0x2000)
|
||||
r6->all.attr2 += r6->all.attr2 & 0x3FF;
|
||||
r6->all.attr2 += (sb->unk0 - 0x6010000u) >> 5;
|
||||
#ifndef NONMATCHING
|
||||
asm("":::"r8");
|
||||
#endif
|
||||
for (i = 0; i < sp0C; ++i) {
|
||||
|
||||
OamData *r5 = sub_08156D84((sb->unk14 & 0x7C0) >> 6);
|
||||
|
||||
if (gUnk_03006CC4 == r6) return;
|
||||
DmaCopy16(3, r6, r5, 6);
|
||||
r5->all.attr1 &= 0xFE00;
|
||||
r5->all.attr0 &= 0xFF00;
|
||||
r5->all.attr0 += (sp08[2 * i + 1] + sp28 + sp20) & 0xFF;
|
||||
r5->all.attr1 += (sp08[2 * i + 0] + sp24 + sp1C) & 0x1FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OamData *sub_08156D84(u8 r5) {
|
||||
if (r5 > 0x1f) r5 = 0x1f;
|
||||
if ((s8)gUnk_030024F0 < 0) {
|
||||
return (void *)gUnk_03006CC4;
|
||||
return gUnk_03006CC4;
|
||||
}
|
||||
else {
|
||||
if (gUnk_03002450[r5] == 0xff) {
|
||||
gUnk_030031C0[gUnk_030024F0].affineParam.split.fractional = 0xff;
|
||||
gUnk_030031C0[gUnk_030024F0].split.fractional = 0xff;
|
||||
gUnk_03002450[r5] = gUnk_030024F0;
|
||||
gUnk_03006080[r5] = gUnk_030024F0;
|
||||
}
|
||||
else {
|
||||
gUnk_030031C0[gUnk_030024F0].affineParam.split.fractional = 0xff;
|
||||
gUnk_030031C0[gUnk_03006080[r5]].affineParam.split.fractional = gUnk_030024F0;
|
||||
gUnk_030031C0[gUnk_030024F0].split.fractional = 0xff;
|
||||
gUnk_030031C0[gUnk_03006080[r5]].split.fractional = gUnk_030024F0;
|
||||
gUnk_03006080[r5] = gUnk_030024F0;
|
||||
}
|
||||
++gUnk_030024F0;
|
||||
@ -26,14 +150,14 @@ struct OamData *sub_08156D84(u8 r5) {
|
||||
}
|
||||
|
||||
void DrawToOamBuffer(void) {
|
||||
struct OamData* r5 = gOamBuffer;
|
||||
OamData* r5 = gOamBuffer;
|
||||
u8 j = 0;
|
||||
s32 i;
|
||||
s8 r0;
|
||||
u8* unused;
|
||||
|
||||
for (i = 0; i < 0x20; i++) {
|
||||
for (r0 = gUnk_03002450[i]; r0 != -1; r0 = gUnk_030031C0[r0].affineParam.all) {
|
||||
for (r0 = gUnk_03002450[i]; r0 != -1; r0 = gUnk_030031C0[r0].all.affineParam) {
|
||||
unused = gUnk_030035F0;
|
||||
DmaCopy16(3, gUnk_030031C0 + r0, r5, 6);
|
||||
r5++;
|
||||
|
@ -31,7 +31,7 @@ void sub_080001CC(void) {
|
||||
gUnk_0300050C = 0xffffffff;
|
||||
gUnk_03000480 = 0;
|
||||
gUnk_03002E60 = 0x80000000;
|
||||
gUnk_03003674 = &gUnk_083B909C;
|
||||
gUnk_03003674 = (const s16 *const *const *)gUnk_083B909C;
|
||||
sub_0800AC5C();
|
||||
r6 = 0;
|
||||
if (sub_0800A91C(0, 0) != 0) {
|
||||
|
@ -85,7 +85,7 @@ void sub_08149F08(struct TitleStruct* arg0) {
|
||||
u8 r0 = arg0->unk128;
|
||||
arg0->unk8 |= 1;
|
||||
r6 = arg0->unk10;
|
||||
r6->unk10 = (r0 * 20) + (r0 / 5 * 12 + 24);
|
||||
(u16)r6->unk10 = (r0 * 20) + (r0 / 5 * 12 + 24);
|
||||
r6->unk12 = 0x7f;
|
||||
|
||||
if (sub_08155128(r6) == 0) {
|
||||
@ -224,7 +224,7 @@ void sub_0814A39C(struct TitleStruct* arg0) {
|
||||
u8 i, r7 = arg0->unk128;
|
||||
for (i = 0; i < r7; i++) {
|
||||
struct Sprite* cur = &arg0->unk10[gUnk_08D6274A[i]];
|
||||
cur->unk10 = (i * 20) + (i / 5 * 12 + 24);
|
||||
(u16)cur->unk10 = (i * 20) + (i / 5 * 12 + 24);
|
||||
cur->unk12 = 0x7f;
|
||||
sub_0815604C(cur);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user