summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-11-29 09:54:26 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-11-29 09:54:26 -0500
commit2943997dcbab30619e0410b294dc109fd3e08e83 (patch)
treec03b8740cad79b73f04bc8090b662738931230f0 /src
parent21a301b77d01851a9d019b594ff11c547cc6514f (diff)
through sub_81438F0
Diffstat (limited to 'src')
-rw-r--r--src/mevent.c146
1 files changed, 146 insertions, 0 deletions
diff --git a/src/mevent.c b/src/mevent.c
index 8b710e3f3..27abf65c3 100644
--- a/src/mevent.c
+++ b/src/mevent.c
@@ -1,5 +1,9 @@
#include "global.h"
+#include "constants/songs.h"
+#include "malloc.h"
+#include "sound.h"
#include "main.h"
+#include "task.h"
#include "decompress.h"
#include "link.h"
#include "unk_815c27c.h"
@@ -11,6 +15,29 @@ struct MEvent_Str_1
u32 unk_008;
};
+struct MEvent_Str_2
+{
+ u8 fill_00[0x40];
+};
+
+struct MEventTaskData1
+{
+ u16 t00;
+ u16 t02;
+ u16 t04;
+ u16 t06;
+ u8 t08;
+ u8 t09;
+ u8 t0A;
+ u8 t0B;
+ u8 t0C;
+ u8 t0D;
+ u8 t0E;
+ struct MEvent_Str_2 *t10;
+};
+
+void sub_8143910(u8 taskId);
+
void sub_81435DC(struct MEvent_Str_1 *a0, u32 a1, u32 a2)
{
vu16 imeBak = REG_IME;
@@ -73,3 +100,122 @@ bool8 sub_81436EC(void)
return TRUE;
return FALSE;
}
+
+bool8 sub_814374C(void)
+{
+ if (sub_800AA48() && GetLinkPlayerCount_2() == 2)
+ return TRUE;
+ return FALSE;
+}
+
+u8 sub_8143770(u8 * r4, u16 * r5)
+{
+ if ((*r4 == 3 || *r4 == 4 || *r4 == 5) && HasLinkErrorOccurred())
+ {
+ *r4 = 0;
+ return 3;
+ }
+ switch (*r4)
+ {
+ case 0:
+ if (sub_800AA48() && GetLinkPlayerCount_2() > 1)
+ {
+ *r4 = 1;
+ ;
+ }
+ else if (gMain.newKeys & B_BUTTON)
+ {
+ *r4 = 0;
+ return 1;
+ }
+ break;
+ case 1:
+ if (++(*r5) > 5)
+ {
+ *r5 = 0;
+ *r4 = 2;
+ }
+ break;
+ case 2:
+ if (GetLinkPlayerCount_2() == 2)
+ {
+ PlaySE(SE_TOY_G);
+ sub_800A5BC();
+ *r5 = 0;
+ *r4 = 3;
+ }
+ else if (gMain.newKeys & B_BUTTON)
+ {
+ *r4 = 0;
+ return 1;
+ }
+ break;
+ case 3:
+ if (++(*r5) > 30)
+ {
+ *r4 = 0;
+ return 5;
+ }
+ else if (IsLinkConnectionEstablished())
+ {
+ if (gUnknown_3003F64)
+ {
+ if (IsLinkPlayerDataExchangeComplete())
+ {
+ *r4 = 0;
+ return 2;
+ }
+ else
+ *r4 = 4;
+ }
+ else
+ *r4 = 3;
+ }
+ break;
+ case 4:
+ sub_800AA80(0);
+ *r4 = 5;
+ break;
+ case 5:
+ if (!gUnknown_3003F64)
+ {
+ *r4 = 0;
+ return 4;
+ }
+ break;
+ }
+ return 0;
+}
+
+void sub_81438A0(void)
+{
+ u8 taskId = CreateTask(sub_8143910, 0);
+ struct MEventTaskData1 *data = (struct MEventTaskData1 *)gTasks[taskId].data;
+ data->t08 = 0;
+ data->t09 = 0;
+ data->t0A = 0;
+ data->t0B = 0;
+ data->t0C = 0;
+ data->t0D = 0;
+ data->t00 = 0;
+ data->t02 = 0;
+ data->t04 = 0;
+ data->t06 = 0;
+ data->t0E = 0;
+ data->t10 = AllocZeroed(sizeof(struct MEvent_Str_2));
+}
+
+void sub_81438E8(u16 *a0)
+{
+ *a0 = 0;
+}
+
+bool8 sub_81438F0(u16 * a0, u16 a1)
+{
+ if (++(*a0) > a1)
+ {
+ *a0 = 0;
+ return TRUE;
+ }
+ return FALSE;
+}