through sub_81351AC

This commit is contained in:
PikalaxALT 2017-11-24 22:08:12 -05:00
parent 23c7c6a41c
commit 53a7f188f8
2 changed files with 42 additions and 140 deletions

View File

@ -5,144 +5,6 @@
.text
thumb_func_start sub_8135130
sub_8135130: @ 8135130
push {r4-r6,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl RtcCalcLocalTime
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r6, r0, r1
ldr r5, =gLocalTime
movs r0, 0x2
ldrsb r0, [r5, r0]
strh r0, [r6, 0xC]
movs r0, 0x3
ldrsb r0, [r5, r0]
strh r0, [r6, 0xE]
movs r0, 0xE
ldrsh r1, [r6, r0]
lsls r0, r1, 1
adds r0, r1
lsls r0, 1
strh r0, [r6, 0x8]
movs r1, 0xC
ldrsh r0, [r6, r1]
movs r1, 0xC
bl __modsi3
lsls r0, 16
asrs r0, 16
lsls r4, r0, 4
subs r4, r0
lsls r4, 1
movs r1, 0xE
ldrsh r0, [r6, r1]
movs r1, 0xA
bl __divsi3
lsls r0, 16
asrs r0, 16
lsls r1, r0, 2
adds r1, r0
adds r4, r1
strh r4, [r6, 0xA]
movs r0, 0x2
ldrsb r0, [r5, r0]
cmp r0, 0xB
bgt _081351A0
movs r0, 0
b _081351A2
.pool
_081351A0:
movs r0, 0x1
_081351A2:
strh r0, [r6, 0x12]
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_8135130
thumb_func_start sub_81351AC
sub_81351AC: @ 81351AC
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, 0x8]
adds r7, r4, 0
adds r0, r4, 0
bl Sin2
lsls r0, 16
asrs r0, 16
cmp r0, 0
bge _081351D4
adds r0, 0xF
_081351D4:
lsls r0, 12
lsrs r5, r0, 16
adds r0, r4, 0
bl Cos2
lsls r0, 16
asrs r0, 16
cmp r0, 0
bge _081351E8
adds r0, 0xF
_081351E8:
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, 0
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 _08135224
movs r1, 0xFF
lsls r1, 8
adds r0, r1, 0
orrs r3, r0
_08135224:
cmp r2, 0x80
bls _08135230
movs r1, 0xFF
lsls r1, 8
adds r0, r1, 0
orrs r2, r0
_08135230:
strh r3, [r6, 0x24]
strh r2, [r6, 0x26]
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81351AC
thumb_func_start sub_8135244
sub_8135244: @ 8135244
push {r4-r7,lr}

View File

@ -17,6 +17,7 @@
#include "strings.h"
#include "sound.h"
#include "songs.h"
#include "trig.h"
#include "decompress.h"
// static types
@ -45,8 +46,8 @@ static void sub_8134FB0(u8 taskId);
static u16 GetClockHandAngle(u16 a0, u8 command, u8 a2);
static bool32 MoveClockHand(u8 taskId, u8 command);
static void _12HourClockFixAMPM(u8 taskId, u8 command);
void sub_8135130(u8 taskId);
void sub_81351AC(struct Sprite *sprite);
static void sub_8135130(u8 taskId);
static void sub_81351AC(struct Sprite *sprite);
void sub_8135244(struct Sprite *sprite);
void sub_81352DC(struct Sprite *sprite);
void sub_8135380(struct Sprite *sprite);
@ -917,3 +918,42 @@ static void _12HourClockFixAMPM(u8 taskId, u8 command)
break;
}
}
static void sub_8135130(u8 taskId)
{
RtcCalcLocalTime();
gTasks[taskId].data[WALL_CLOCK_TASK_HOUR] = gLocalTime.hours;
gTasks[taskId].data[WALL_CLOCK_TASK_MINUTE] = gLocalTime.minutes;
gTasks[taskId].data[WALL_CLOCK_TASK_MINUTE_HAND_ANGLE] = gTasks[taskId].data[WALL_CLOCK_TASK_MINUTE] * 6;
gTasks[taskId].data[WALL_CLOCK_TASK_HOUR_HAND_ANGLE] = (gTasks[taskId].data[WALL_CLOCK_TASK_HOUR] % 12) * 30 + (gTasks[taskId].data[WALL_CLOCK_TASK_MINUTE] / 10) * 5;
if (gLocalTime.hours < 12)
{
gTasks[taskId].data[WALL_CLOCK_TASK_12HRCLOCK_AM_PM] = FALSE;
}
else
{
gTasks[taskId].data[WALL_CLOCK_TASK_12HRCLOCK_AM_PM] = TRUE;
}
}
static void sub_81351AC(struct Sprite *sprite)
{
u16 angle = gTasks[sprite->data0].data[WALL_CLOCK_TASK_MINUTE_HAND_ANGLE];
s16 sin = Sin2(angle) / 16;
s16 cos = Cos2(angle) / 16;
u16 xhat;
u16 yhat;
SetOamMatrix(0, 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;
}