sub_811A4D0; constants for ezchat task data offsets

This commit is contained in:
scnorton 2017-09-25 17:30:49 -04:00
parent cdfdd2a29a
commit b62b67e428
2 changed files with 43 additions and 38 deletions

View File

@ -5,21 +5,6 @@
.text
thumb_func_start sub_811A4D0
sub_811A4D0: @ 811A4D0
push {r4,lr}
adds r4, r0, 0
bl sub_811C13C
bl sub_811AA90
bl sub_811F2B8
bl FreeAllWindowBuffers
adds r0, r4, 0
bl SetMainCallback2
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_811A4D0
thumb_func_start easy_chat_input_maybe
easy_chat_input_maybe: @ 811A4F0
push {r4,r5,lr}

View File

@ -6,11 +6,19 @@
#include "rom4.h"
#include "task.h"
#include "main.h"
#include "window.h"
#include "palette.h"
#include "easy_chat.h"
// Static type declarations
#define EZCHAT_TASK_STATE 0
#define EZCHAT_TASK_UNK01 1
#define EZCHAT_TASK_UNK02 2
#define EZCHAT_TASK_MAINCALLBACK 4
#define EZCHAT_TASK_UNK06 6
#define EZCHAT_TASK_UNK07 7
// Static RAM declarations
static void sub_811A2C0(u8);
static void sub_811A278(void);
@ -21,11 +29,14 @@ static void sub_811A2FC(u8);
/*static*/ void sub_811C158(u16);
/*static*/ bool8 sub_811C170(void);
/*static*/ void sub_811A8A4(u16);
/*static*/ void sub_811A4D0(u32);
/*static*/ void sub_811A4D0(MainCallback);
bool8 sub_811F28C(void);
bool8 sub_811A95C(u8, u32, u8);
bool8 sub_811BF8C(void);
bool8 sub_811BFA4(void);
void sub_811C13C(void);
void sub_811AA90(void);
void sub_811F2B8(void);
// Static ROM declarations
@ -33,16 +44,16 @@ bool8 sub_811BFA4(void);
// .text
void sub_811A20C(u8 a0, u32 a1, u32 a2, u8 a3)
void sub_811A20C(u8 a0, u32 a1, MainCallback callback, 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);
gTasks[taskId].data[EZCHAT_TASK_UNK01] = a0;
gTasks[taskId].data[EZCHAT_TASK_UNK07] = a3;
SetWordTaskArg(taskId, EZCHAT_TASK_UNK02, a1);
SetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK, (u32)callback);
SetMainCallback2(sub_811A278);
}
@ -64,7 +75,7 @@ static void sub_811A290(void)
static void sub_811A2A4(u8 taskId, TaskFunc taskFunc)
{
gTasks[taskId].func = taskFunc;
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[EZCHAT_TASK_STATE] = 0;
}
static void sub_811A2C0(u8 taskId)
@ -89,56 +100,56 @@ static void sub_811A2FC(u8 taskId)
s16 *data;
data = gTasks[taskId].data;
switch (data[0])
switch (data[EZCHAT_TASK_STATE])
{
case 0:
SetVBlankCallback(sub_811A290);
BlendPalettes(-1, 16, 0);
BeginNormalPaletteFade(-1, -1, 16, 0, 0);
data[0] = 5;
data[EZCHAT_TASK_STATE] = 5;
break;
case 1:
v0 = sub_811AAAC();
if (sub_811A88C(v0))
{
BeginNormalPaletteFade(-1, -2, 0, 16, 0);
data[0] = 3;
data[6] = v0;
data[EZCHAT_TASK_STATE] = 3;
data[EZCHAT_TASK_UNK06] = v0;
}
else if (v0 == 0x18)
{
BeginNormalPaletteFade(-1, -1, 0, 16, 0);
data[0] = 4;
data[EZCHAT_TASK_STATE] = 4;
}
else if (v0 != 0)
{
PlaySE(SE_SELECT);
sub_811C158(v0);
data[0] ++;
data[EZCHAT_TASK_STATE] ++;
}
break;
case 2:
if (!sub_811C170())
{
data[0] = 1;
data[EZCHAT_TASK_STATE] = 1;
}
break;
case 3:
if (!gPaletteFade.active)
{
sub_811A8A4(data[6]);
sub_811A8A4(data[EZCHAT_TASK_UNK06]);
}
break;
case 4:
if (!gPaletteFade.active)
{
sub_811A4D0(GetWordTaskArg(taskId, 0x04));
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
break;
case 5:
if (!gPaletteFade.active)
{
data[0] = 1;
data[EZCHAT_TASK_STATE] = 1;
}
break;
}
@ -149,7 +160,7 @@ static bool8 sub_811A428(u8 taskId)
s16 *data;
data = gTasks[taskId].data;
switch (data[0])
switch (data[EZCHAT_TASK_STATE])
{
case 0:
SetVBlankCallback(NULL);
@ -160,19 +171,19 @@ static bool8 sub_811A428(u8 taskId)
case 1:
if (!sub_811F28C())
{
sub_811A4D0(GetWordTaskArg(taskId, 0x04));
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
break;
case 2:
if (!sub_811A95C(data[1], GetWordTaskArg(taskId, 0x02), data[7]))
if (!sub_811A95C(data[EZCHAT_TASK_UNK01], GetWordTaskArg(taskId, EZCHAT_TASK_UNK02), data[EZCHAT_TASK_UNK07]))
{
sub_811A4D0(GetWordTaskArg(taskId, 0x04));
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
break;
case 3:
if (!sub_811BF8C())
{
sub_811A4D0(GetWordTaskArg(taskId, 0x04));
sub_811A4D0((MainCallback)GetWordTaskArg(taskId, EZCHAT_TASK_MAINCALLBACK));
}
break;
case 4:
@ -184,6 +195,15 @@ static bool8 sub_811A428(u8 taskId)
default:
return FALSE;
}
data[0] ++;
data[EZCHAT_TASK_STATE] ++;
return TRUE;
}
void sub_811A4D0(MainCallback callback)
{
sub_811C13C();
sub_811AA90();
sub_811F2B8();
FreeAllWindowBuffers();
SetMainCallback2(callback);
}