sub_813504C

This commit is contained in:
PikalaxALT 2017-11-24 21:37:42 -05:00
parent dfa5f24e59
commit 1b3fcb83f2
2 changed files with 51 additions and 88 deletions

View file

@ -5,90 +5,6 @@
.text
thumb_func_start sub_813504C
sub_813504C: @ 813504C
push {r4-r6,lr}
lsls r0, 24
lsrs r3, r0, 24
lsls r1, 24
lsrs r4, r1, 24
cmp r4, 0x1
beq _08135060
cmp r4, 0x2
beq _081350A0
b _081350DE
_08135060:
ldr r0, =gTasks
lsls r1, r3, 2
adds r1, r3
lsls r1, 3
adds r1, r0
ldrh r2, [r1, 0xE]
movs r5, 0xE
ldrsh r0, [r1, r5]
cmp r0, 0
ble _08135080
subs r0, r2, 0x1
strh r0, [r1, 0xE]
b _081350DE
.pool
_08135080:
movs r0, 0x3B
strh r0, [r1, 0xE]
ldrh r2, [r1, 0xC]
movs r6, 0xC
ldrsh r0, [r1, r6]
cmp r0, 0
ble _08135092
subs r0, r2, 0x1
b _08135094
_08135092:
movs r0, 0x17
_08135094:
strh r0, [r1, 0xC]
adds r0, r3, 0
adds r1, r4, 0
bl sub_81350E8
b _081350DE
_081350A0:
ldr r0, =gTasks
lsls r1, r3, 2
adds r1, r3
lsls r1, 3
adds r1, r0
ldrh r2, [r1, 0xE]
movs r5, 0xE
ldrsh r0, [r1, r5]
cmp r0, 0x3A
bgt _081350C0
adds r0, r2, 0x1
strh r0, [r1, 0xE]
b _081350DE
.pool
_081350C0:
movs r5, 0
strh r5, [r1, 0xE]
ldrh r2, [r1, 0xC]
movs r6, 0xC
ldrsh r0, [r1, r6]
cmp r0, 0x16
bgt _081350D4
adds r0, r2, 0x1
strh r0, [r1, 0xC]
b _081350D6
_081350D4:
strh r5, [r1, 0xC]
_081350D6:
adds r0, r3, 0
adds r1, r4, 0
bl sub_81350E8
_081350DE:
movs r0, 0
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_813504C
thumb_func_start sub_81350E8
sub_81350E8: @ 81350E8
push {lr}

View file

@ -34,8 +34,9 @@ static void sub_8134F10(u8 taskId);
static void sub_8134F40(u8 taskId);
static void sub_8134F78(u8 taskId);
static void sub_8134FB0(u8 taskId);
static u16 sub_8134FFC(u16 a0, u8 a1, u8 a2);
void sub_813504C(u8 taskId, u8 a1);
static u16 sub_8134FFC(u16 a0, u8 command, u8 a2);
static bool32 sub_813504C(u8 taskId, u8 command);
void sub_81350E8(u8 taskId, u8 command);
void sub_8135130(u8 taskId);
void sub_81351AC(struct Sprite *sprite);
void sub_8135244(struct Sprite *sprite);
@ -816,10 +817,10 @@ static u8 sub_8134FD4(u16 a0)
return 1;
}
static u16 sub_8134FFC(u16 a0, u8 a1, u8 a2)
static u16 sub_8134FFC(u16 a0, u8 command, u8 a2)
{
u8 r1 = sub_8134FD4(a2);
switch (a1)
switch (command)
{
case 1:
if (a0) a0 -= r1;
@ -832,3 +833,49 @@ static u16 sub_8134FFC(u16 a0, u8 a1, u8 a2)
}
return a0;
}
static bool32 sub_813504C(u8 taskId, u8 command)
{
switch (command)
{
case 1:
if (gTasks[taskId].data[3] > 0)
{
gTasks[taskId].data[3]--;
}
else
{
gTasks[taskId].data[3] = 59;
if (gTasks[taskId].data[2] > 0)
{
gTasks[taskId].data[2]--;
}
else
{
gTasks[taskId].data[2] = 23;
}
sub_81350E8(taskId, command);
}
break;
case 2:
if (gTasks[taskId].data[3] < 59)
{
gTasks[taskId].data[3]++;
}
else
{
gTasks[taskId].data[3] = 0;
if (gTasks[taskId].data[2] < 23)
{
gTasks[taskId].data[2]++;
}
else
{
gTasks[taskId].data[2] = 0;
}
sub_81350E8(taskId, command);
}
break;
}
return FALSE;
}