through sub_81352DC

This commit is contained in:
PikalaxALT 2017-11-24 22:28:13 -05:00
parent 53a7f188f8
commit 1063bcaab8
2 changed files with 52 additions and 167 deletions

View File

@ -5,171 +5,6 @@
.text .text
thumb_func_start sub_8135244
sub_8135244: @ 8135244
push {r4-r7,lr}
sub sp, 0x4
adds r6, r0, 0
ldr r2, =gTasks
movs r0, 0x2E
ldrsh r1, [r6, r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
ldrh r4, [r0, 0xA]
adds r7, r4, 0
adds r0, r4, 0
bl Sin2
lsls r0, 16
asrs r0, 16
cmp r0, 0
bge _0813526C
adds r0, 0xF
_0813526C:
lsls r0, 12
lsrs r5, r0, 16
adds r0, r4, 0
bl Cos2
lsls r0, 16
asrs r0, 16
cmp r0, 0
bge _08135280
adds r0, 0xF
_08135280:
lsls r1, r0, 12
lsrs r1, 16
lsls r3, r5, 16
lsrs r2, r3, 16
negs r3, r3
lsrs r3, 16
str r1, [sp]
movs r0, 0x1
bl SetOamMatrix
ldr r1, =gUnknown_085B22D0
lsls r2, r7, 1
adds r0, r2, r1
ldrb r0, [r0]
lsls r0, 24
asrs r0, 24
lsls r0, 16
lsrs r3, r0, 16
adds r1, 0x1
adds r2, r1
movs r0, 0
ldrsb r0, [r2, r0]
lsls r0, 16
lsrs r2, r0, 16
cmp r3, 0x80
bls _081352BC
movs r1, 0xFF
lsls r1, 8
adds r0, r1, 0
orrs r3, r0
_081352BC:
cmp r2, 0x80
bls _081352C8
movs r1, 0xFF
lsls r1, 8
adds r0, r1, 0
orrs r2, r0
_081352C8:
strh r3, [r6, 0x24]
strh r2, [r6, 0x26]
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8135244
thumb_func_start sub_81352DC
sub_81352DC: @ 81352DC
push {r4,lr}
adds r4, r0, 0
ldr r2, =gTasks
movs r0, 0x2E
ldrsh r1, [r4, r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
movs r1, 0x12
ldrsh r0, [r0, r1]
cmp r0, 0
beq _0813531C
ldrh r1, [r4, 0x30]
adds r0, r1, 0
subs r0, 0x3C
lsls r0, 16
lsrs r0, 16
cmp r0, 0x1D
bhi _08135308
adds r0, r1, 0x5
strh r0, [r4, 0x30]
_08135308:
ldrh r1, [r4, 0x30]
movs r2, 0x30
ldrsh r0, [r4, r2]
cmp r0, 0x3B
bgt _0813533C
adds r0, r1, 0x1
b _0813533A
.pool
_0813531C:
ldrh r1, [r4, 0x30]
adds r0, r1, 0
subs r0, 0x2E
lsls r0, 16
lsrs r0, 16
cmp r0, 0x1D
bhi _0813532E
subs r0, r1, 0x5
strh r0, [r4, 0x30]
_0813532E:
ldrh r1, [r4, 0x30]
movs r2, 0x30
ldrsh r0, [r4, r2]
cmp r0, 0x4B
ble _0813533C
subs r0, r1, 0x1
_0813533A:
strh r0, [r4, 0x30]
_0813533C:
ldrh r0, [r4, 0x30]
bl Cos2
lsls r0, 16
asrs r0, 16
lsls r1, r0, 4
subs r1, r0
lsls r0, r1, 1
cmp r0, 0
bge _08135354
ldr r1, =0x00000fff
adds r0, r1
_08135354:
asrs r0, 12
strh r0, [r4, 0x24]
ldrh r0, [r4, 0x30]
bl Sin2
lsls r0, 16
asrs r0, 16
lsls r1, r0, 4
subs r1, r0
lsls r0, r1, 1
cmp r0, 0
bge _08135370
ldr r2, =0x00000fff
adds r0, r2
_08135370:
asrs r0, 12
strh r0, [r4, 0x26]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81352DC
thumb_func_start sub_8135380 thumb_func_start sub_8135380
sub_8135380: @ 8135380 sub_8135380: @ 8135380
push {r4,lr} push {r4,lr}

View File

@ -48,8 +48,8 @@ static bool32 MoveClockHand(u8 taskId, u8 command);
static void _12HourClockFixAMPM(u8 taskId, u8 command); static void _12HourClockFixAMPM(u8 taskId, u8 command);
static void sub_8135130(u8 taskId); static void sub_8135130(u8 taskId);
static void sub_81351AC(struct Sprite *sprite); static void sub_81351AC(struct Sprite *sprite);
void sub_8135244(struct Sprite *sprite); static void sub_8135244(struct Sprite *sprite);
void sub_81352DC(struct Sprite *sprite); static void sub_81352DC(struct Sprite *sprite);
void sub_8135380(struct Sprite *sprite); void sub_8135380(struct Sprite *sprite);
// rodata // rodata
@ -957,3 +957,53 @@ static void sub_81351AC(struct Sprite *sprite)
sprite->pos2.x = xhat; sprite->pos2.x = xhat;
sprite->pos2.y = yhat; sprite->pos2.y = yhat;
} }
static void sub_8135244(struct Sprite *sprite)
{
u16 angle = gTasks[sprite->data0].data[WALL_CLOCK_TASK_HOUR_HAND_ANGLE];
s16 sin = Sin2(angle) / 16;
s16 cos = Cos2(angle) / 16;
u16 xhat;
u16 yhat;
SetOamMatrix(1, cos, sin, -sin, cos);
xhat = gUnknown_085B22D0[angle][0];
yhat = gUnknown_085B22D0[angle][1];
if (xhat > 0x80)
{
xhat |= 0xff00;
}
if (yhat > 0x80)
{
yhat |= 0xff00;
}
sprite->pos2.x = xhat;
sprite->pos2.y = yhat;
}
static void sub_81352DC(struct Sprite *sprite)
{
if (gTasks[sprite->data0].data[WALL_CLOCK_TASK_12HRCLOCK_AM_PM])
{
if ((u16)(sprite->data1 - 60) < 30)
{
sprite->data1 += 5;
}
if (sprite->data1 < 60)
{
sprite->data1++;
}
}
else
{
if ((u16)(sprite->data1 - 46) < 30)
{
sprite->data1 -= 5;
}
if (sprite->data1 > 75)
{
sprite->data1--;
}
}
sprite->pos2.x = Cos2(sprite->data1) * 30 / 0x1000;
sprite->pos2.y = Sin2(sprite->data1) * 30 / 0x1000;
}