Start decomp of easy_chat

This commit is contained in:
PikalaxALT 2017-09-25 08:53:25 -04:00
parent a57915fa5b
commit 0984461aeb
4 changed files with 143 additions and 257 deletions

View File

@ -5,263 +5,6 @@
.text .text
thumb_func_start sub_811A20C
sub_811A20C: @ 811A20C
push {r4-r6,lr}
mov r6, r9
mov r5, r8
push {r5,r6}
adds r6, r0, 0
mov r8, r1
mov r9, r2
adds r5, r3, 0
lsls r6, 24
lsrs r6, 24
lsls r5, 24
lsrs r5, 24
bl ResetTasks
ldr r0, =sub_811A2C0
movs r1, 0
bl CreateTask
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
strh r6, [r0, 0xA]
strh r5, [r0, 0x16]
adds r0, r4, 0
movs r1, 0x2
mov r2, r8
bl SetWordTaskArg
adds r0, r4, 0
movs r1, 0x4
mov r2, r9
bl SetWordTaskArg
ldr r0, =sub_811A278
bl SetMainCallback2
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_811A20C
thumb_func_start sub_811A278
sub_811A278: @ 811A278
push {lr}
bl RunTasks
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
pop {r0}
bx r0
thumb_func_end sub_811A278
thumb_func_start sub_811A290
sub_811A290: @ 811A290
push {lr}
bl TransferPlttBuffer
bl LoadOam
bl ProcessSpriteCopyRequests
pop {r0}
bx r0
thumb_func_end sub_811A290
thumb_func_start sub_811A2A4
sub_811A2A4: @ 811A2A4
lsls r0, 24
lsrs r0, 24
ldr r3, =gTasks
lsls r2, r0, 2
adds r2, r0
lsls r2, 3
adds r2, r3
str r1, [r2]
movs r0, 0
strh r0, [r2, 0x8]
bx lr
.pool
thumb_func_end sub_811A2A4
thumb_func_start sub_811A2C0
sub_811A2C0: @ 811A2C0
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl is_c1_link_related_active
cmp r0, 0
bne _0811A2DC
_0811A2CE:
adds r0, r4, 0
bl sub_811A428
lsls r0, 24
cmp r0, 0
bne _0811A2CE
b _0811A2EA
_0811A2DC:
adds r0, r4, 0
bl sub_811A428
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _0811A2F2
_0811A2EA:
ldr r1, =sub_811A2FC
adds r0, r4, 0
bl sub_811A2A4
_0811A2F2:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_811A2C0
thumb_func_start sub_811A2FC
sub_811A2FC: @ 811A2FC
push {r4-r6,lr}
sub sp, 0x4
lsls r0, 24
lsrs r2, r0, 24
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
ldr r1, =gTasks + 0x8
adds r5, r0, r1
movs r1, 0
ldrsh r0, [r5, r1]
cmp r0, 0x5
bls _0811A318
b _0811A41C
_0811A318:
lsls r0, 2
ldr r1, =_0811A32C
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_0811A32C:
.4byte _0811A344
.4byte _0811A370
.4byte _0811A3CC
.4byte _0811A3D4
.4byte _0811A3EC
.4byte _0811A40C
_0811A344:
ldr r0, =sub_811A290
bl SetVBlankCallback
movs r4, 0x1
negs r4, r4
adds r0, r4, 0
movs r1, 0x10
movs r2, 0
bl BlendPalettes
movs r0, 0
str r0, [sp]
adds r0, r4, 0
adds r1, r4, 0
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
movs r0, 0x5
b _0811A41A
.pool
_0811A370:
bl sub_811AAAC
lsls r0, 16
lsrs r4, r0, 16
adds r6, r4, 0
adds r0, r4, 0
bl sub_811A88C
cmp r0, 0
beq _0811A39E
movs r0, 0x1
negs r0, r0
movs r1, 0x2
negs r1, r1
movs r2, 0
str r2, [sp]
movs r3, 0x10
bl BeginNormalPaletteFade
movs r0, 0x3
strh r0, [r5]
strh r4, [r5, 0xC]
b _0811A41C
_0811A39E:
cmp r4, 0x18
bne _0811A3B6
movs r1, 0x1
negs r1, r1
str r0, [sp]
adds r0, r1, 0
movs r2, 0
movs r3, 0x10
bl BeginNormalPaletteFade
movs r0, 0x4
b _0811A41A
_0811A3B6:
cmp r6, 0
beq _0811A41C
movs r0, 0x5
bl PlaySE
adds r0, r6, 0
bl sub_811C158
ldrh r0, [r5]
adds r0, 0x1
b _0811A41A
_0811A3CC:
bl sub_811C170
lsls r0, 24
b _0811A414
_0811A3D4:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _0811A41C
ldrh r0, [r5, 0xC]
bl sub_811A8A4
b _0811A41C
.pool
_0811A3EC:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _0811A41C
adds r0, r2, 0
movs r1, 0x4
bl GetWordTaskArg
bl sub_811A4D0
b _0811A41C
.pool
_0811A40C:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
_0811A414:
cmp r0, 0
bne _0811A41C
movs r0, 0x1
_0811A41A:
strh r0, [r5]
_0811A41C:
add sp, 0x4
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_811A2FC
thumb_func_start sub_811A428 thumb_func_start sub_811A428
sub_811A428: @ 811A428 sub_811A428: @ 811A428
push {r4-r6,lr} push {r4-r6,lr}

View File

@ -29,5 +29,6 @@ const struct MapHeader *get_mapheader_by_bank_and_number(u8, u8);
void FieldObjectMoveDestCoords(struct MapObject *, u32, s16 *, s16 *); void FieldObjectMoveDestCoords(struct MapObject *, u32, s16 *, s16 *);
void sub_8086230(void); void sub_8086230(void);
void c2_exit_to_overworld_2_switch(void); void c2_exit_to_overworld_2_switch(void);
bool32 is_c1_link_related_active(void);
#endif //GUARD_ROM4_H #endif //GUARD_ROM4_H

View File

@ -166,6 +166,7 @@ SECTIONS {
asm/item_use.o(.text); asm/item_use.o(.text);
asm/battle_anim_80FE840.o(.text); asm/battle_anim_80FE840.o(.text);
asm/bike.o(.text); asm/bike.o(.text);
src/easy_chat.o(.text);
asm/easy_chat.o(.text); asm/easy_chat.o(.text);
asm/mon_markings.o(.text); asm/mon_markings.o(.text);
asm/mauville_old_man.o(.text); asm/mauville_old_man.o(.text);

141
src/easy_chat.c Normal file
View File

@ -0,0 +1,141 @@
// Includes
#include "global.h"
#include "songs.h"
#include "sound.h"
#include "rom4.h"
#include "task.h"
#include "main.h"
#include "palette.h"
#include "easy_chat.h"
// Static type declarations
// Static RAM declarations
static void sub_811A2C0(u8);
static void sub_811A278(void);
/*static*/ bool8 sub_811A428(u8);
static void sub_811A2FC(u8);
/*static*/ u16 sub_811AAAC(void);
/*static*/ bool32 sub_811A88C(u16);
/*static*/ void sub_811C158(u16);
/*static*/ bool8 sub_811C170(void);
/*static*/ void sub_811A8A4(u16);
/*static*/ void sub_811A4D0(u32);
// Static ROM declarations
// .rodata
// .text
void sub_811A20C(u8 a0, u32 a1, u32 a2, u8 a3)
{
u8 taskId;
ResetTasks();
taskId = CreateTask(sub_811A2C0, 0);
gTasks[taskId].data[1] = a0;
gTasks[taskId].data[7] = a3;
SetWordTaskArg(taskId, 0x02, a1);
SetWordTaskArg(taskId, 0x04, a2);
SetMainCallback2(sub_811A278);
}
static void sub_811A278(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
static void sub_811A290(void)
{
TransferPlttBuffer();
LoadOam();
ProcessSpriteCopyRequests();
}
static void sub_811A2A4(u8 taskId, TaskFunc taskFunc)
{
gTasks[taskId].func = taskFunc;
gTasks[taskId].data[0] = 0;
}
static void sub_811A2C0(u8 taskId)
{
if (!is_c1_link_related_active())
{
while (sub_811A428(taskId));
}
else
{
if (sub_811A428(taskId) == TRUE)
{
return;
}
}
sub_811A2A4(taskId, sub_811A2FC);
}
static void sub_811A2FC(u8 taskId)
{
u16 v0;
s16 *data;
data = gTasks[taskId].data;
switch (data[0])
{
case 0:
SetVBlankCallback(sub_811A290);
BlendPalettes(-1, 16, 0);
BeginNormalPaletteFade(-1, -1, 16, 0, 0);
data[0] = 5;
break;
case 1:
v0 = sub_811AAAC();
if (sub_811A88C(v0))
{
BeginNormalPaletteFade(-1, -2, 0, 16, 0);
data[0] = 3;
data[6] = v0;
}
else if (v0 == 0x18)
{
BeginNormalPaletteFade(-1, -1, 0, 16, 0);
data[0] = 4;
}
else if (v0 != 0)
{
PlaySE(SE_SELECT);
sub_811C158(v0);
data[0] ++;
}
break;
case 2:
if (!sub_811C170())
{
data[0] = 1;
}
break;
case 3:
if (!gPaletteFade.active)
{
sub_811A8A4(data[6]);
}
break;
case 4:
if (!gPaletteFade.active)
{
sub_811A4D0(GetWordTaskArg(taskId, 0x04));
}
break;
case 5:
if (!gPaletteFade.active)
{
data[0] = 1;
}
break;
}
}