This commit is contained in:
Diegoisawesome 2017-03-07 07:44:54 -06:00
commit a2679fbbf0

View File

@ -381,7 +381,7 @@ void ResetPaletteStruct(u8 paletteNum)
sPaletteStructs[paletteNum].ps_field_9 = 0; sPaletteStructs[paletteNum].ps_field_9 = 0;
} }
void ResetPaletteFadeControl() void ResetPaletteFadeControl(void)
{ {
gPaletteFade.multipurpose1 = 0; gPaletteFade.multipurpose1 = 0;
gPaletteFade.multipurpose2 = 0; gPaletteFade.multipurpose2 = 0;
@ -426,7 +426,7 @@ static u8 GetPaletteNumByUid(u16 uid)
return 16; return 16;
} }
static u8 UpdateNormalPaletteFade() static u8 UpdateNormalPaletteFade(void)
{ {
u16 paletteOffset; u16 paletteOffset;
u16 selectedPalettes; u16 selectedPalettes;
@ -1152,118 +1152,89 @@ _080A2C38:\n\
void sub_80A2C44(u32 a1, s8 a2, u8 a3, u8 a4, u16 a5, u8 a6, u8 a7) void sub_80A2C44(u32 a1, s8 a2, u8 a3, u8 a4, u16 a5, u8 a6, u8 a7)
{ {
u8 v11; u8 taskId;
struct Task *v12;
u32 v13;
struct Task *v14;
struct Task *v15;
struct Task *v16;
v11 = CreateTask((void *)sub_80A2D54, a6); taskId = CreateTask((void *)sub_80A2D54, a6);
v15 = gTasks; gTasks[taskId].data[0] = a3;
v12 = &v15[v11]; gTasks[taskId].data[1] = a4;
v12->data[0] = a3;
v12->data[1] = a4;
if (a2 >= 0) if (a2 >= 0)
{ {
v12->data[3] = a2; gTasks[taskId].data[3] = a2;
v13 = 1; gTasks[taskId].data[2] = 1;
} }
else else
{ {
v12->data[3] = 0; gTasks[taskId].data[3] = 0;
v13 = -a2 + 1; gTasks[taskId].data[2] = -a2 + 1;
} }
v12->data[2] = v13;
if (a4 < a3) if (a4 < a3)
gTasks[v11].data[2] *= -1; gTasks[taskId].data[2] *= -1;
SetWordTaskArg(v11, 5, a1); SetWordTaskArg(taskId, 5, a1);
v16 = gTasks; gTasks[taskId].data[7] = a5;
v14 = &v16[v11]; gTasks[taskId].data[8] = a7;
v14->data[7] = a5; gTasks[taskId].func(taskId);
v14->data[8] = a7;
_call_via_r1(v11, v14->func);
} }
u32 sub_80A2CF8(u8 a1) u32 sub_80A2CF8(u8 var)
{ {
int i = 0; int i;
void *func = sub_80A2D54;
struct Task *v2 = gTasks;
for (; i <= 0xF; i++) for (i = 0; i < 16; i++) // check all the tasks.
{ if ((gTasks[i].isActive == 1) && (gTasks[i].func == sub_80A2D54) && (gTasks[i].data[8] == var))
if ((v2->isActive == 1) && (v2->func == func) && (v2->data[8] == a1))
return 1; return 1;
v2++;
}
return 0; return 0;
} }
void sub_80A2D34() void sub_80A2D34(void)
{ {
int v0; u8 taskId;
while (1) while (1)
{ {
v0 = FindTaskIdByFunc(sub_80A2D54); taskId = FindTaskIdByFunc(sub_80A2D54);
if (v0 == 0xFF) if (taskId == 0xFF)
break; break;
DestroyTask(v0); DestroyTask(taskId);
} }
} }
void sub_80A2D54(u8 a1) void sub_80A2D54(u8 taskId)
{ {
s16 *v2; u32 wordVar;
u32 v3; s16 *data;
u16 v5; u16 temp;
s32 v6;
u16 v7;
u32 v8;
s16 v9;
u16 v10;
s32 v11;
v2 = gTasks[a1].data; data = gTasks[taskId].data;
v3 = GetWordTaskArg(a1, 5); wordVar = GetWordTaskArg(taskId, 5);
v2[4] += 1;
if (v2[4] > v2[3]) if (++data[4] > data[3])
{ {
v2[4] = 0; data[4] = 0;
BlendPalettes(v3, v2[0], v2[7]); BlendPalettes(wordVar, data[0], data[7]);
v10 = v2[0]; temp = data[1];
v11 = v2[0]; if (data[0] == (s16)temp)
v5 = v2[1];
v6 = v2[1];
if (v11 == v6)
{ {
DestroyTask(a1); DestroyTask(taskId);
} }
else else
{ {
v7 = v2[2]; data[0] += data[2];
v8 = v10 + v7; if (data[2] >= 0)
v2[0] = v8;
if (v7 << 16 >= 0)
{ {
v9 = v8; if (data[0] < (s16)temp)
if (v9 < v6)
{ {
return; return;
} }
} }
else if ((v9 = v8) > v6) else if (data[0] > (s16)temp)
{ {
return; return;
} }
v2[0] = v5; data[0] = temp;
} }
} }
return;
} }