summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-10-06 16:16:33 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2018-10-06 16:16:33 -0400
commit43a0915d90b8c53c3e1fc8141e3c3d6376e18293 (patch)
tree3d0889c118a1ea63a60214df7b496a55250c2c51 /src
parente7c43d6890616fa10b770266c2b81f0c7f4677b8 (diff)
through sub_810C760
Diffstat (limited to 'src')
-rw-r--r--src/vs_seeker.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/vs_seeker.c b/src/vs_seeker.c
new file mode 100644
index 000000000..14b522679
--- /dev/null
+++ b/src/vs_seeker.c
@@ -0,0 +1,94 @@
+#include "global.h"
+#include "songs.h"
+#include "sound.h"
+#include "task.h"
+#include "malloc.h"
+#include "new_menu_helpers.h"
+#include "item_use.h"
+#include "event_scripts.h"
+#include "item_menu.h"
+#include "field_effect.h"
+#include "script_movement.h"
+#include "vs_seeker.h"
+
+// static types
+struct UnkStruct_845318C
+{
+ // TODO: populate
+};
+
+// static declarations
+EWRAM_DATA struct VsSeekerStruct *gUnknown_203ADB8;
+void sub_810C730(u8 taskId);
+void sub_810C760(u8 taskId);
+void sub_810C8EC(u8 taskId);
+void sub_810C808(void);
+bool8 sub_810C96C(void);
+void sub_810C604(void);
+u8 sub_810C9A8(const void *);
+
+// rodata
+extern const struct UnkStruct_845318C gUnknown_845318C[];
+extern const u8 gUnknown_8453F5C[];
+
+// text
+void sub_810C670(u8 taskId)
+{
+ u8 i;
+ u8 respval;
+
+ for (i = 0; i < 16; i++)
+ gTasks[taskId].data[i] = 0;
+
+ gUnknown_203ADB8 = AllocZeroed(sizeof(struct VsSeekerStruct));
+ sub_810C808();
+ respval = sub_810C96C();
+ if (respval == 0)
+ {
+ Free(gUnknown_203ADB8);
+ DisplayItemMessageOnField(taskId, 2, gUnknown_81C137C, sub_80A1E0C);
+ }
+ else if (respval == 1)
+ {
+ Free(gUnknown_203ADB8);
+ DisplayItemMessageOnField(taskId, 2, gUnknown_81C13D6, sub_80A1E0C);
+ }
+ else if (respval == 2)
+ {
+ sub_80A2294(4, 0, gUnknown_203AD30, 0xffff);
+ FieldEffectStart(FLDEFF_UNK_41); // TODO: name this enum
+ gTasks[taskId].func = sub_810C730;
+ gTasks[taskId].data[0] = 15;
+ }
+}
+
+void sub_810C730(u8 taskId)
+{
+ if (--gTasks[taskId].data[0] == 0)
+ {
+ gTasks[taskId].func = sub_810C760;
+ gTasks[taskId].data[1] = 16;
+ }
+}
+
+void sub_810C760(u8 taskId)
+{
+ s16 * data = gTasks[taskId].data;
+
+ if (data[2] != 2 && --data[1] == 0)
+ {
+ PlaySE(SE_BASABASA);
+ data[1] = 11;
+ data[2]++;
+ }
+
+ if (!FieldEffectActiveListContains(FLDEFF_UNK_41))
+ {
+ data[1] = 0;
+ data[2] = 0;
+ sub_810C604();
+ gUnknown_203ADB8->unk_431_3 = sub_810C9A8(gUnknown_845318C);
+ ScriptMovement_StartObjectMovementScript(0xFF, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gUnknown_8453F5C);
+ gTasks[taskId].func = sub_810C8EC;
+ }
+}