sub_80E7324

This commit is contained in:
PikalaxALT 2017-11-04 10:55:39 -04:00
parent c054446790
commit 411cb29f4a
4 changed files with 109 additions and 271 deletions

View File

@ -5,276 +5,6 @@
.text
thumb_func_start sub_80E7324
sub_80E7324: @ 80E7324
push {r4-r6,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
ldr r6, =gTasks
adds r5, r0, r6
movs r0, 0x8
ldrsh r1, [r5, r0]
cmp r1, 0x64
beq _080E73A0
cmp r1, 0x64
bgt _080E7362
cmp r1, 0x1
bne _080E7346
b _080E7464
_080E7346:
cmp r1, 0x1
bgt _080E7354
cmp r1, 0
beq _080E7384
b _080E7566
.pool
_080E7354:
cmp r1, 0x2
bne _080E735A
b _080E7490
_080E735A:
cmp r1, 0x5
bne _080E7360
b _080E7550
_080E7360:
b _080E7566
_080E7362:
cmp r1, 0xC9
beq _080E73F8
cmp r1, 0xC9
bgt _080E7370
cmp r1, 0x65
beq _080E73B8
b _080E7566
_080E7370:
ldr r0, =0x0000012d
cmp r1, r0
beq _080E7432
adds r0, 0x63
cmp r1, r0
beq _080E744A
b _080E7566
.pool
_080E7384:
ldr r0, =gText_MixingRecords
bl sub_80E70F4
movs r0, 0xE1
lsls r0, 3
strh r0, [r5, 0x18]
movs r0, 0xC8
lsls r0, 1
strh r0, [r5, 0x8]
bl sub_8009FAC
b _080E7566
.pool
_080E73A0:
ldrh r0, [r5, 0x20]
adds r0, 0x1
strh r0, [r5, 0x20]
lsls r0, 16
asrs r0, 16
cmp r0, 0x14
bgt _080E73B0
b _080E7566
_080E73B0:
movs r0, 0
strh r0, [r5, 0x20]
movs r0, 0x65
b _080E7564
_080E73B8:
bl sub_800ABAC
lsls r0, 24
lsrs r4, r0, 24
bl sub_800ABBC
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _080E73EA
bl sub_800AA48
lsls r0, 24
lsrs r0, 24
cmp r4, r0
beq _080E73DA
b _080E7566
_080E73DA:
movs r0, 0x15
bl PlaySE
movs r1, 0
movs r0, 0xC9
strh r0, [r5, 0x8]
strh r1, [r5, 0x20]
b _080E7566
_080E73EA:
movs r0, 0x16
bl PlaySE
ldr r0, =0x0000012d
b _080E7564
.pool
_080E73F8:
bl sub_800AA48
adds r4, r0, 0
bl sub_800ABAC
lsls r4, 24
lsls r0, 24
cmp r4, r0
beq _080E740C
b _080E7566
_080E740C:
ldrh r4, [r5, 0x20]
adds r4, 0x1
strh r4, [r5, 0x20]
lsls r4, 16
asrs r4, 16
bl sub_800ABAC
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 4
subs r1, r0
lsls r1, 1
cmp r4, r1
bgt _080E742A
b _080E7566
_080E742A:
bl sub_800A620
movs r0, 0x1
b _080E7564
_080E7432:
bl sub_800AA48
adds r4, r0, 0
bl sub_800ABAC
lsls r4, 24
lsls r0, 24
cmp r4, r0
beq _080E7446
b _080E7566
_080E7446:
movs r0, 0x1
b _080E7564
_080E744A:
ldrh r0, [r5, 0x20]
adds r0, 0x1
strh r0, [r5, 0x20]
lsls r0, 16
asrs r0, 16
cmp r0, 0x14
bgt _080E745A
b _080E7566
_080E745A:
movs r0, 0x1
strh r0, [r5, 0x8]
movs r0, 0
strh r0, [r5, 0x20]
b _080E7566
_080E7464:
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
bne _080E746E
b _080E7566
_080E746E:
ldr r4, =gStringVar1
bl sub_80E7810
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
adds r0, r4, 0
movs r2, 0x2
movs r3, 0x2
bl ConvertIntToDecimalStringN
movs r0, 0x5
b _080E7564
.pool
_080E7490:
bl sub_800ABAC
lsls r0, 24
lsrs r0, 24
movs r1, 0
strh r0, [r5, 0x14]
strh r1, [r5, 0x8]
bl sub_80E7810
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x12]
ldr r0, =sub_80E756C
str r0, [r5]
bl Link_AnyPartnersPlayingRubyOrSapphrie
cmp r0, 0
beq _080E7504
ldr r0, =gUnknown_0203A018
ldr r0, [r0]
adds r1, r5, 0
adds r1, 0xC
bl sub_80E7808
ldr r0, =sub_80E7630
movs r1, 0x50
bl CreateTask
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x1C]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r0, r1, r6
strh r4, [r0, 0x8]
ldr r0, =gUnknown_0203A014
ldr r0, [r0]
adds r1, r6, r1
adds r1, 0x12
bl sub_80E7808
ldr r1, =gUnknown_0300115C
ldr r0, =0x00001230
str r0, [r1]
b _080E7566
.pool
_080E7504:
ldr r0, =gUnknown_0203A018
ldr r0, [r0]
adds r1, r5, 0
adds r1, 0xC
bl sub_80E7808
ldr r0, =sub_80E7630
movs r1, 0x50
bl CreateTask
lsls r0, 24
lsrs r0, 24
strh r0, [r5, 0x1C]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r0, r1, r6
strh r4, [r0, 0x8]
ldr r0, =gUnknown_0203A014
ldr r0, [r0]
adds r1, r6, r1
adds r1, 0x12
bl sub_80E7808
ldr r1, =gUnknown_0300115C
ldr r0, =0x00001444
str r0, [r1]
b _080E7566
.pool
_080E7550:
ldrh r0, [r5, 0x1C]
adds r0, 0x1
strh r0, [r5, 0x1C]
lsls r0, 16
asrs r0, 16
cmp r0, 0x3C
ble _080E7566
movs r0, 0
strh r0, [r5, 0x1C]
movs r0, 0x2
_080E7564:
strh r0, [r5, 0x8]
_080E7566:
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_80E7324
thumb_func_start sub_80E756C
sub_80E756C: @ 80E756C
push {r4,r5,lr}

View File

@ -195,5 +195,7 @@ void sub_800AC34(void);
bool32 Link_AnyPartnersPlayingRubyOrSapphrie(void);
bool32 sub_800A03C(void);
void sub_8009628(u8);
u8 sub_800AA48(void);
void sub_8009FAC(void);
#endif // GUARD_LINK_H

View File

@ -75,6 +75,7 @@ extern const u8 gText_NoRegistry[];
extern const u8 gText_OkayToDeleteFromRegistry[];
extern const u8 gText_RegisteredDataDeleted[];
extern const u8 gUnknown_085EA79D[];
extern const u8 gText_MixingRecords[];
extern const u8 gText_RecordMixingComplete[];
#endif //GUARD_STRINGS_H

View File

@ -20,6 +20,7 @@
#include "script.h"
#include "event_data.h"
#include "strings.h"
#include "string_util.h"
#include "record_mixing.h"
// Static type declarations
@ -64,7 +65,11 @@ EWRAM_DATA struct PlayerRecords *gUnknown_0203A018 = NULL;
// Static ROM declarations
static void sub_80E715C(u8 taskId);
void sub_80E7324(u8 taskId);
static void sub_80E7324(u8 taskId);
void sub_80E756C(u8 taskId);
void sub_80E7630(u8 taskId);
u8 sub_80E7810(void);
void sub_80E7808(struct PlayerRecords *records, s16 *a1);
void sub_80E78C4(OldMan *, size_t, u8);
void sub_80E7948(void *, size_t, u8);
void sub_80E7A14(LilycoveLady *, size_t, u8);
@ -296,3 +301,103 @@ static void sub_80E715C(u8 taskId)
break;
}
}
static void sub_80E7324(u8 taskId)
{
u8 r4;
u8 taskId2;
struct Task *task;
task = &gTasks[taskId];
switch (task->data[0])
{
case 0:
sub_80E70F4(gText_MixingRecords);
task->data[8] = 0x708;
task->data[0] = 400;
sub_8009FAC();
break;
case 100:
if (++ task->data[12] > 20)
{
task->data[12] = 0;
task->data[0] = 101;
}
break;
case 101:
r4 = sub_800ABAC();
if (sub_800ABBC() == TRUE)
{
if (r4 == sub_800AA48())
{
PlaySE(SE_PIN);
task->data[0] = 201;
task->data[12] = 0;
}
}
else
{
PlaySE(SE_BOO);
task->data[0] = 301;
}
break;
case 201:
if (sub_800AA48() == sub_800ABAC() && ++ task->data[12] > (sub_800ABAC() * 30))
{
sub_800A620();
task->data[0] = 1;
}
break;
case 301:
if (sub_800AA48() == sub_800ABAC())
{
task->data[0] = 1;
}
break;
case 400:
if (++ task->data[12] > 20)
{
task->data[0] = 1;
task->data[12] = 0;
}
break;
case 1:
if (gReceivedRemoteLinkPlayers != 0)
{
ConvertIntToDecimalStringN(gStringVar1, sub_80E7810(), STR_CONV_MODE_LEADING_ZEROS, 2);
task->data[0] = 5;
}
break;
case 2:
task->data[6] = sub_800ABAC();
task->data[0] = 0;
task->data[5] = sub_80E7810();
task->func = sub_80E756C;
if (Link_AnyPartnersPlayingRubyOrSapphrie())
{
sub_80E7808(gUnknown_0203A018, &task->data[2]);
taskId2 = CreateTask(sub_80E7630, 80);
task->data[10] = taskId2;
gTasks[taskId2].data[0] = taskId;
sub_80E7808(gUnknown_0203A014, &gTasks[taskId2].data[5]);
gUnknown_0300115C = 0x1230;
}
else
{
sub_80E7808(gUnknown_0203A018, &task->data[2]);
taskId2 = CreateTask(sub_80E7630, 80);
task->data[10] = taskId2;
gTasks[taskId2].data[0] = taskId;
sub_80E7808(gUnknown_0203A014, &gTasks[taskId2].data[5]);
gUnknown_0300115C = 0x1444;
}
break;
case 5:
if (++ task->data[10] > 60)
{
task->data[10] = 0;
task->data[0] = 2;
}
break;
}
}