through sub_81CA474

This commit is contained in:
PikalaxALT 2019-08-04 18:15:02 -04:00
parent cd876292d1
commit 2dee42dbaf
2 changed files with 63 additions and 184 deletions

View File

@ -5,133 +5,6 @@
@ File centered around AllocSubstruct(2)
thumb_func_start sub_81CA3B4
sub_81CA3B4: @ 81CA3B4
push {r4-r7,lr}
mov r7, r8
push {r7}
adds r4, r0, 0
movs r0, 0x2
bl GetSubstructPtr
adds r7, r0, 0
movs r5, 0
mov r8, r5
_081CA3C8:
ldr r2, [r4]
ldrb r1, [r2, 0x1]
movs r3, 0xD
negs r3, r3
adds r0, r3, 0
ands r1, r0
movs r0, 0x4
orrs r1, r0
strb r1, [r2, 0x1]
ldr r2, [r4]
ldrb r0, [r2, 0x1]
movs r1, 0x3
orrs r0, r1
strb r0, [r2, 0x1]
ldr r1, [r4]
ldr r0, =sub_81CA4AC
str r0, [r1, 0x1C]
movs r6, 0x8
strh r6, [r1, 0x2E]
ldr r0, [r4]
mov r1, r8
strh r1, [r0, 0x30]
ldr r0, [r4]
strh r5, [r0, 0x3C]
ldr r0, [r4]
bl InitSpriteAffineAnim
ldm r4!, {r0}
movs r1, 0
bl StartSpriteAffineAnim
adds r5, 0x1
cmp r5, 0x3
ble _081CA3C8
movs r0, 0x52
movs r1, 0x10
bl SetGpuReg
ldr r0, =sub_81CA580
movs r1, 0x3
bl CreateTask
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
strh r6, [r1, 0x8]
ldrb r0, [r7, 0xC]
adds r0, 0x1
strb r0, [r7, 0xC]
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81CA3B4
thumb_func_start sub_81CA448
sub_81CA448: @ 81CA448
push {r4-r6,lr}
adds r5, r0, 0
movs r0, 0x1
ands r1, r0
lsls r4, r1, 2
movs r6, 0x5
negs r6, r6
movs r3, 0x3
_081CA458:
ldm r5!, {r0}
adds r0, 0x3E
ldrb r2, [r0]
adds r1, r6, 0
ands r1, r2
orrs r1, r4
strb r1, [r0]
subs r3, 0x1
cmp r3, 0
bge _081CA458
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_81CA448
thumb_func_start sub_81CA474
sub_81CA474: @ 81CA474
push {lr}
adds r2, r0, 0
ldrh r0, [r2, 0x2E]
subs r0, 0x1
strh r0, [r2, 0x2E]
lsls r0, 16
asrs r0, 16
movs r1, 0x1
negs r1, r1
cmp r0, r1
beq _081CA49A
ldrh r0, [r2, 0x30]
ldrh r1, [r2, 0x32]
adds r0, r1
strh r0, [r2, 0x32]
lsls r0, 16
asrs r0, 20
strh r0, [r2, 0x20]
b _081CA4A2
_081CA49A:
ldrh r0, [r2, 0x3C]
strh r0, [r2, 0x20]
ldr r0, =SpriteCallbackDummy
str r0, [r2, 0x1C]
_081CA4A2:
pop {r0}
bx r0
.pool
thumb_func_end sub_81CA474
thumb_func_start sub_81CA4AC
sub_81CA4AC: @ 81CA4AC
push {r4,r5,lr}

View File

@ -2,6 +2,7 @@
#include "alloc.h"
#include "decompress.h"
#include "bg.h"
#include "gpu_regs.h"
#include "menu.h"
#include "window.h"
#include "pokenav.h"
@ -52,10 +53,12 @@ void sub_81CA20C(void);
void sub_81CA278(void);
void sub_81CA35C(struct Sprite ** sprites, s32 a1, s32 a2, s32 a3);
void sub_81CA3B4(struct Sprite ** sprites);
void sub_81CA448(struct Sprite ** sprites, s32 a1);
void sub_81CA474(struct Sprite * sprite);
void sub_81CA2DC(void);
bool32 sub_81CA324(void);
void sub_81CA448(struct Sprite ** sprites, bool32 a1);
void sub_81CA474(struct Sprite * sprite);
void sub_81CA4AC(struct Sprite * sprite);
void sub_81CA580(u8 taskId);
void sub_81CA640(void);
void sub_81CA698(void);
void sub_81CA6E0(void);
@ -852,10 +855,10 @@ void sub_81CA20C(void)
else
r2 = 0x8c;
sub_81CA35C(unk->field_02c[i], 0x100, r2, 0xC);
sub_81CA448(unk->field_02c[i], 0);
sub_81CA448(unk->field_02c[i], FALSE);
}
else
sub_81CA448(unk->field_02c[i], 1);
sub_81CA448(unk->field_02c[i], TRUE);
}
}
@ -918,66 +921,69 @@ bool32 sub_81CA324(void)
return FALSE;
}
#ifdef NONMATCHING
void sub_81CA35C(struct Sprite ** sprites, s32 a1, s32 a2, s32 a3)
{
s32 i;
for (i = 0; i < 4; i++)
{
sprites[i]->pos1.x = a1;
sprites[i]->data[0] = a3;
sprites[i]->data[1] = 16 * (a2 - a1) / a3;
sprites[i]->data[2] = 16 * a1;
sprites[i]->data[7] = a2;
sprites[i]->callback = sub_81CA474;
(*sprites)->pos1.x = a1;
(*sprites)->data[0] = a3;
(*sprites)->data[1] = 16 * (a2 - a1) / a3;
(*sprites)->data[2] = 16 * a1;
(*sprites)->data[7] = a2;
(*sprites)->callback = sub_81CA474;
sprites++;
}
}
#else
NAKED
void sub_81CA35C(struct Sprite ** sprites, s32 a1, s32 a2, s32 a3)
void sub_81CA3B4(struct Sprite ** sprites)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r9\n"
"\tmov r6, r8\n"
"\tpush {r6,r7}\n"
"\tadds r4, r0, 0\n"
"\tadds r5, r1, 0\n"
"\tmov r9, r2\n"
"\tadds r6, r3, 0\n"
"\tldr r0, =sub_81CA474\n"
"\tmov r8, r0\n"
"\tsubs r0, r2, r5\n"
"\tlsls r0, 4\n"
"\tadds r1, r6, 0\n"
"\tbl __divsi3\n"
"\tadds r3, r0, 0\n"
"\tmovs r1, 0x3\n"
"\tlsls r2, r5, 4\n"
"_081CA380:\n"
"\tldr r0, [r4]\n"
"\tstrh r5, [r0, 0x20]\n"
"\tldr r0, [r4]\n"
"\tstrh r6, [r0, 0x2E]\n"
"\tldr r0, [r4]\n"
"\tstrh r3, [r0, 0x30]\n"
"\tldr r0, [r4]\n"
"\tstrh r2, [r0, 0x32]\n"
"\tldr r0, [r4]\n"
"\tmov r7, r9\n"
"\tstrh r7, [r0, 0x3C]\n"
"\tldm r4!, {r0}\n"
"\tmov r7, r8\n"
"\tstr r7, [r0, 0x1C]\n"
"\tsubs r1, 0x1\n"
"\tcmp r1, 0\n"
"\tbge _081CA380\n"
"\tpop {r3,r4}\n"
"\tmov r8, r3\n"
"\tmov r9, r4\n"
"\tpop {r4-r7}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.pool");
s32 i;
struct Pokenav2Struct * unk = GetSubstructPtr(2);
u8 taskId;
for (i = 0; i < 4; i++)
{
(*sprites)->oam.objMode = ST_OAM_OBJ_BLEND;
(*sprites)->oam.affineMode = ST_OAM_AFFINE_DOUBLE;
(*sprites)->callback = sub_81CA4AC;
(*sprites)->data[0] = 8;
(*sprites)->data[1] = 0;
(*sprites)->data[7] = i;
InitSpriteAffineAnim(sprites[0]);
StartSpriteAffineAnim(sprites[0], 0);
sprites++;
}
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0x10, 0x00));
taskId = CreateTask(sub_81CA580, 3);
gTasks[taskId].data[0] = 8;
unk->field_00c++;
}
void sub_81CA448(struct Sprite ** sprites, bool32 a1)
{
s32 i;
for (i = 0; i < 4; i++)
{
(*sprites)->invisible = a1;
sprites++;
}
}
void sub_81CA474(struct Sprite * sprite)
{
sprite->data[0]--;
if (sprite->data[0] != -1)
{
sprite->data[2] += sprite->data[1];
sprite->pos1.x = sprite->data[2] >> 4;
}
else
{
sprite->pos1.x = sprite->data[7];
sprite->callback = SpriteCallbackDummy;
}
}
#endif //NONMATCHING