through task_add_05_task_del_08FA224_when_no_RfuFunc

This commit is contained in:
PikalaxALT 2018-01-20 14:29:13 -05:00
parent b8ad1a0fc4
commit c5096c81ad
2 changed files with 50 additions and 116 deletions

View File

@ -5,122 +5,6 @@
.text
thumb_func_start sub_80101CC
sub_80101CC: @ 80101CC
push {r4,r5,lr}
ldr r0, =gUnknown_03005000
ldrb r5, [r0, 0xD]
movs r2, 0
movs r1, 0
adds r3, r0, 0
adds r4, r3, 0
adds r4, 0xE4
_080101DC:
adds r0, r1, r4
ldrb r0, [r0]
cmp r0, 0
beq _080101E6
adds r2, 0x1
_080101E6:
adds r1, 0x1
cmp r1, 0x4
ble _080101DC
cmp r2, r5
bne _08010220
ldr r2, =gBattleTypeFlags
ldr r0, [r2]
movs r1, 0x21
negs r1, r1
ands r0, r1
str r0, [r2]
ldrb r0, [r3, 0xC]
cmp r0, 0
bne _0801021C
adds r0, r3, 0
adds r0, 0xEE
ldrb r1, [r0]
movs r1, 0x3
strb r1, [r0]
bl sub_8010168
b _08010220
.pool
_0801021C:
ldr r0, =sub_8010168
str r0, [r3]
_08010220:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80101CC
thumb_func_start sub_801022C
sub_801022C: @ 801022C
push {r4,lr}
ldr r0, =gSendCmd
ldrh r0, [r0]
cmp r0, 0
bne _0801024E
ldr r4, =gUnknown_03005000
ldr r1, =0x00000ce8
adds r0, r4, r1
ldrb r0, [r0]
cmp r0, 0
bne _0801024E
movs r0, 0xBE
lsls r0, 7
bl sub_800FD14
ldr r0, =sub_80101CC
str r0, [r4]
_0801024E:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_801022C
thumb_func_start sub_8010264
sub_8010264: @ 8010264
push {lr}
lsls r0, 24
lsrs r3, r0, 24
ldr r2, =gUnknown_03005000
ldr r0, [r2]
cmp r0, 0
bne _08010284
ldr r1, =0x00000cd9
adds r0, r2, r1
movs r1, 0x1
strb r1, [r0]
ldr r0, =sub_801022C
str r0, [r2]
adds r0, r3, 0
bl DestroyTask
_08010284:
pop {r0}
bx r0
.pool
thumb_func_end sub_8010264
thumb_func_start task_add_05_task_del_08FA224_when_no_RfuFunc
task_add_05_task_del_08FA224_when_no_RfuFunc: @ 8010294
push {r4,lr}
ldr r4, =sub_8010264
adds r0, r4, 0
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
bne _080102AC
adds r0, r4, 0
movs r1, 0x5
bl CreateTask
_080102AC:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end task_add_05_task_del_08FA224_when_no_RfuFunc
thumb_func_start sub_80102B8
sub_80102B8: @ 80102B8
push {r4,r5,lr}

View File

@ -2,6 +2,7 @@
// Includes
#include "global.h"
#include "malloc.h"
#include "battle.h"
#include "berry_blender.h"
#include "task.h"
#include "random.h"
@ -3887,3 +3888,52 @@ void sub_8010198(void)
gUnknown_03005000.unk_ce4 = 1;
gUnknown_03005000.unk_ce3 = gUnknown_03007890->unk_02 | gUnknown_03007890->unk_03;
}
void sub_80101CC(void)
{
int i;
u8 playerCount = gUnknown_03005000.playerCount;
int count = 0;
for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
if (gUnknown_03005000.unk_e4[i])
count++;
}
if (count == playerCount)
{
gBattleTypeFlags &= ~BATTLE_TYPE_20;
if (gUnknown_03005000.unk_0c == 0)
{
gUnknown_03005000.unk_ee = 3;
sub_8010168();
}
else
gUnknown_03005000.unk_00 = sub_8010168;
}
}
void sub_801022C(void)
{
if (gSendCmd[0] == 0 && gUnknown_03005000.unk_ce8 == 0)
{
sub_800FD14(0x5f00);
gUnknown_03005000.unk_00 = sub_80101CC;
}
}
void sub_8010264(u8 taskId)
{
if (gUnknown_03005000.unk_00 == 0)
{
gUnknown_03005000.unk_cd9 = 1;
gUnknown_03005000.unk_00 = sub_801022C;
DestroyTask(taskId);
}
}
void task_add_05_task_del_08FA224_when_no_RfuFunc(void)
{
if (!FuncIsActiveTask(sub_8010264))
CreateTask(sub_8010264, 5);
}