through sub_80262C0

This commit is contained in:
scnorton 2019-03-25 18:08:25 -04:00
parent 5de624783c
commit 03e58d7dc9
2 changed files with 585 additions and 685 deletions

View file

@ -5,188 +5,6 @@
.text
thumb_func_start sub_80261CC
sub_80261CC: @ 80261CC
push {lr}
bl RunTasks
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
pop {r0}
bx r0
thumb_func_end sub_80261CC
thumb_func_start sub_80261E4
sub_80261E4: @ 80261E4
push {lr}
bl TransferPlttBuffer
bl LoadOam
bl ProcessSpriteCopyRequests
pop {r0}
bx r0
thumb_func_end sub_80261E4
thumb_func_start sub_80261F8
sub_80261F8: @ 80261F8
push {r4,lr}
adds r4, r0, 0
adds r0, r1, 0
bl IsMonShiny
strb r0, [r4]
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80261F8
thumb_func_start sub_802620C
sub_802620C: @ 802620C
push {lr}
lsls r1, 24
lsrs r1, 24
bl CreateTask
pop {r0}
bx r0
thumb_func_end sub_802620C
thumb_func_start sub_802621C
sub_802621C: @ 802621C
push {lr}
movs r1, 0x1
bl CreateTask
ldr r1, =gUnknown_02022C98
ldr r3, [r1]
movs r2, 0
strb r0, [r3, 0x4]
ldr r0, [r1]
strb r2, [r0, 0x10]
ldr r0, [r1]
strb r2, [r0, 0xC]
ldr r0, [r1]
strb r2, [r0, 0x14]
pop {r0}
bx r0
.pool
thumb_func_end sub_802621C
thumb_func_start sub_8026240
sub_8026240: @ 8026240
push {r4,lr}
ldr r2, =gUnknown_02022C98
ldr r1, [r2]
ldrb r3, [r1, 0x18]
movs r4, 0
strb r3, [r1, 0x1C]
ldr r1, [r2]
strb r0, [r1, 0x18]
ldr r0, [r2]
strb r4, [r0, 0x10]
ldr r0, [r2]
strb r4, [r0, 0x14]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8026240
thumb_func_start sub_8026264
sub_8026264: @ 8026264
push {r4,lr}
ldr r3, =gUnknown_02022C98
ldr r1, [r3]
ldrb r0, [r1, 0x14]
lsrs r2, r0, 2
adds r0, 0x1
strb r0, [r1, 0x14]
cmp r2, 0
beq _080262B8
ldr r3, [r3]
ldrb r0, [r3, 0x14]
movs r1, 0x3
ands r0, r1
cmp r0, 0
bne _080262B8
ldr r1, =gUnknown_082F7A94
adds r0, r3, 0
adds r0, 0x24
ldrb r0, [r0]
subs r0, 0x1
adds r0, r1
ldrb r0, [r0]
cmp r2, r0
bcc _080262A0
movs r0, 0x1
b _080262BA
.pool
_080262A0:
lsls r4, r2, 3
adds r1, r4, 0
movs r0, 0x14
bl SetGpuReg
negs r4, r4
lsls r4, 16
lsrs r4, 16
movs r0, 0x18
adds r1, r4, 0
bl SetGpuReg
_080262B8:
movs r0, 0
_080262BA:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8026264
thumb_func_start sub_80262C0
sub_80262C0: @ 80262C0
push {r4-r7,lr}
mov r7, r8
push {r7}
ldr r2, =gUnknown_02022C98
ldr r0, [r2]
adds r1, r0, 0
adds r1, 0x44
adds r0, 0x48
ldrb r5, [r0]
ldrb r1, [r1]
cmp r1, r5
bcs _0802630C
mov r8, r2
ldr r0, =0x000032e0
mov r12, r0
movs r7, 0
movs r6, 0x1
_080262E2:
mov r2, r8
ldr r0, [r2]
mov r2, r12
adds r4, r0, r2
ldr r2, =0x000032eb
adds r0, r2
adds r2, r0, r1
movs r3, 0
adds r0, r1, 0
ands r0, r6
cmp r0, 0
bne _080262FC
movs r3, 0x1
_080262FC:
strb r3, [r2]
adds r0, r4, r1
strb r7, [r0]
adds r0, r1, 0x1
lsls r0, 24
lsrs r1, r0, 24
cmp r1, r5
bcc _080262E2
_0802630C:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80262C0
thumb_func_start sub_8026324
sub_8026324: @ 8026324
push {r4-r7,lr}

View file

@ -3,6 +3,7 @@
#include "palette.h"
#include "window.h"
#include "bg.h"
#include "gpu_regs.h"
#include "link.h"
#include "link_rfu.h"
#include "task.h"
@ -221,6 +222,8 @@ u8 sub_802A794(void);
extern void (*const gUnknown_082F7AC4[])(void);
extern void (*const gUnknown_082F7AF4[])(void);
extern const u8 gUnknown_082F7A94[];
void sub_802493C(u16 a0, void (*a1)(void))
{
gUnknown_03000DB0 = FALSE;
@ -1314,3 +1317,82 @@ void sub_8026044(void)
gUnknown_02022C98->unk_0154 = 2;
}
}
void sub_80261CC(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
void sub_80261E4(void)
{
TransferPlttBuffer();
LoadOam();
ProcessSpriteCopyRequests();
}
void sub_80261F8(struct DodrioBerryPickingSubstruct_318C * a0, struct Pokemon * a1)
{
a0->isShiny = IsMonShiny(a1);
}
void sub_802620C(TaskFunc func, u8 priority)
{
CreateTask(func, priority);
}
void sub_802621C(TaskFunc func)
{
gUnknown_02022C98->unk_0004 = CreateTask(func, 1);
gUnknown_02022C98->unk_0010 = 0;
gUnknown_02022C98->unk_000C = 0;
gUnknown_02022C98->unk_0014 = 0;
}
void sub_8026240(u8 a0)
{
gUnknown_02022C98->unk_001C = gUnknown_02022C98->unk_0018;
gUnknown_02022C98->unk_0018 = a0;
gUnknown_02022C98->unk_0010 = 0;
gUnknown_02022C98->unk_0014 = 0;
}
bool32 sub_8026264(void)
{
u8 r2 = gUnknown_02022C98->unk_0014 / 4;
gUnknown_02022C98->unk_0014++;
if (r2 != 0 && gUnknown_02022C98->unk_0014 % 4 == 0)
{
if (r2 < gUnknown_082F7A94[gUnknown_02022C98->unk_0024 - 1])
{
SetGpuReg(REG_OFFSET_BG1HOFS, (r2 * 8));
SetGpuReg(REG_OFFSET_BG2HOFS, -(r2 * 8));
return FALSE;
}
else
{
return TRUE;
}
}
else
{
return FALSE;
}
}
void sub_80262C0(void)
{
u8 i;
u8 start = gUnknown_02022C98->unk_0044;
u8 finish = gUnknown_02022C98->unk_0048;
for (i = start; i < finish; i++)
{
struct DodrioBerryPickingSubstruct_31A0 * ptr = &gUnknown_02022C98->unk_32CC;
u8 * r4 = gUnknown_02022C98->unk_32CC.unk_14;
ptr->unk_1F[i] = (i % 2 == 0) ? 1 : 0;
r4[i] = 0;
}
}