Cleanup mevent2

This commit is contained in:
Marcus Huderle 2019-03-24 18:13:32 -05:00 committed by huderlem
parent e6caf0ff10
commit d7a9fcb975
9 changed files with 88 additions and 66 deletions

View File

@ -306,7 +306,6 @@ void sub_8009FAC(void);
bool8 sub_800A4D8(u8 a0); bool8 sub_800A4D8(u8 a0);
u8 sub_800A9D8(void); u8 sub_800A9D8(void);
u8 sub_800A0C8(s32, s32); u8 sub_800A0C8(s32, s32);
u16 *sub_801B058(void);
u8 sub_800A9A8(void); u8 sub_800A9A8(void);
void sub_800AD10(void); void sub_800AD10(void);
void sub_800AB18(void); void sub_800AB18(void);

View File

@ -1,8 +1,6 @@
#ifndef GUARD_MEVENT_H #ifndef GUARD_MEVENT_H
#define GUARD_MEVENT_H #define GUARD_MEVENT_H
#include <gba/gba.h>
struct MEvent_Str_1 struct MEvent_Str_1
{ {
u16 unk_000; u16 unk_000;
@ -33,4 +31,33 @@ struct MEventStruct_Unk1442CC
u8 unk_60; u8 unk_60;
}; };
void sub_801AFD8(void);
struct MEventBuffer_3120_Sub *sub_801B00C(void);
struct MEventBuffer_32E0_Sub *sav1_get_mevent_buffer_1(void);
struct MEventBuffer_3430_Sub *sav1_get_mevent_buffer_2(void);
struct MysteryEventStruct *sub_801B044(void);
u16 *sub_801B058(void);
void sub_801B06C(void);
bool32 sub_801B078(const struct MEventBuffer_3120_Sub *src);
bool32 sub_801B0CC(void);
bool32 sub_801B128(void);
bool32 sub_801B1A4(const u8 *src);
void sub_801B1E8(void);
bool32 sub_801B21C(const struct MEventBuffer_32E0_Sub *data);
bool32 sub_801B27C(void);
bool32 sub_801B308(void);
u16 sub_801B39C(void);
void sub_801B3C0(struct MEventBuffer_32E0_Sub *buffer);
bool32 sub_801B3F8(void);
bool32 sub_801B508(const u16 *data);
void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1);
bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1);
u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused);
u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused);
bool32 sub_801B748(const struct MEventStruct_Unk1442CC *a0, const u16 *a1);
u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command);
u16 mevent_081445C0(u32 command);
void sub_801B940(void);
bool32 sub_801B94C(u16 a0);
#endif //GUARD_MEVENT_H #endif //GUARD_MEVENT_H

View File

@ -13,7 +13,6 @@ extern u8 gUnknown_02022C3E;
// Exported ROM declarations // Exported ROM declarations
void sub_8018438(void); void sub_8018438(void);
u16 mevent_081445C0(u8);
void sub_801B990(u32, u32); void sub_801B990(u32, u32);
u8 sub_8013F78(void); u8 sub_8013F78(void);
bool32 sub_802C908(u16); bool32 sub_802C908(u16);

View File

@ -14,8 +14,8 @@
#include "gpu_regs.h" #include "gpu_regs.h"
#include "graphics.h" #include "graphics.h"
#include "international_string_util.h" #include "international_string_util.h"
#include "link.h"
#include "main.h" #include "main.h"
#include "mevent.h"
#include "menu.h" #include "menu.h"
#include "overworld.h" #include "overworld.h"
#include "palette.h" #include "palette.h"

View File

@ -1,4 +1,5 @@
#include "global.h" #include "global.h"
#include "alloc.h"
#include "battle.h" #include "battle.h"
#include "battle_tower.h" #include "battle_tower.h"
#include "cable_club.h" #include "cable_club.h"
@ -20,7 +21,7 @@
#include "link.h" #include "link.h"
#include "list_menu.h" #include "list_menu.h"
#include "main.h" #include "main.h"
#include "alloc.h" #include "mevent.h"
#include "match_call.h" #include "match_call.h"
#include "menu.h" #include "menu.h"
#include "overworld.h" #include "overworld.h"
@ -31,7 +32,6 @@
#include "random.h" #include "random.h"
#include "rayquaza_scene.h" #include "rayquaza_scene.h"
#include "region_map.h" #include "region_map.h"
#include "rom_8011DC0.h"
#include "rtc.h" #include "rtc.h"
#include "script.h" #include "script.h"
#include "script_menu.h" #include "script_menu.h"

View File

@ -13,14 +13,14 @@
static EWRAM_DATA bool32 gUnknown_02022C70 = FALSE; static EWRAM_DATA bool32 gUnknown_02022C70 = FALSE;
void sub_801B180(void); static void sub_801B180(void);
void sub_801B14C(void); static void sub_801B14C(void);
bool32 sub_801B114(const struct MEventBuffer_3120_Sub * data); static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data);
bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub * data); static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data);
void sub_801B330(void); static void sub_801B330(void);
void sub_801B368(void); static void sub_801B368(void);
void sub_801B9F8(void); static void sub_801B9F8(void);
void sub_801BA8C(u32 a0, u32 a1, u32 * a2, int a3); static void sub_801BA8C(u32 a0, u32 a1, u32 *a2, int a3);
void sub_801AFD8(void) void sub_801AFD8(void)
{ {
@ -80,7 +80,7 @@ bool32 sub_801B0CC(void)
return TRUE; return TRUE;
} }
bool32 sub_801B114(const struct MEventBuffer_3120_Sub * data) static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data)
{ {
if (data->unk_00 == 0) if (data->unk_00 == 0)
return FALSE; return FALSE;
@ -97,13 +97,13 @@ bool32 sub_801B128(void)
return TRUE; return TRUE;
} }
void sub_801B14C(void) static void sub_801B14C(void)
{ {
CpuFill32(0, sub_801B00C(), sizeof(gSaveBlock1Ptr->unk_322C.buffer_000.data)); CpuFill32(0, sub_801B00C(), sizeof(gSaveBlock1Ptr->unk_322C.buffer_000.data));
gSaveBlock1Ptr->unk_322C.buffer_000.crc = 0; gSaveBlock1Ptr->unk_322C.buffer_000.crc = 0;
} }
void sub_801B180(void) static void sub_801B180(void)
{ {
CpuFill32(0, sub_801B044(), sizeof(struct MysteryEventStruct)); CpuFill32(0, sub_801B044(), sizeof(struct MysteryEventStruct));
sub_801DBC0(); sub_801DBC0();
@ -164,7 +164,7 @@ bool32 sub_801B27C(void)
return TRUE; return TRUE;
} }
bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub * data) static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data)
{ {
if (data->unk_00 == 0) if (data->unk_00 == 0)
return FALSE; return FALSE;
@ -189,13 +189,13 @@ bool32 sub_801B308(void)
return TRUE; return TRUE;
} }
void sub_801B330(void) static void sub_801B330(void)
{ {
CpuFill32(0, &gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub)); CpuFill32(0, &gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub));
gSaveBlock1Ptr->unk_322C.buffer_1c0.crc = 0; gSaveBlock1Ptr->unk_322C.buffer_1c0.crc = 0;
} }
void sub_801B368(void) static void sub_801B368(void)
{ {
CpuFill32(0, sav1_get_mevent_buffer_2(), 18 *sizeof(u16)); CpuFill32(0, sav1_get_mevent_buffer_2(), 18 *sizeof(u16));
gSaveBlock1Ptr->unk_322C.buffer_310.crc = 0; gSaveBlock1Ptr->unk_322C.buffer_310.crc = 0;
@ -215,7 +215,7 @@ void sub_801B3C0(struct MEventBuffer_32E0_Sub * buffer)
buffer->unk_08_6 = 0; buffer->unk_08_6 = 0;
} }
bool32 sub_801B3D8(u16 a0) static bool32 sub_801B3D8(u16 a0)
{ {
if (a0 >= 1000 && a0 < 1020) if (a0 >= 1000 && a0 < 1020)
return TRUE; return TRUE;
@ -259,7 +259,7 @@ bool32 sub_801B3F8(void)
return TRUE; return TRUE;
} }
int sub_801B438(const struct MEventBuffer_3430_Sub * data, int size) static int sub_801B438(const struct MEventBuffer_3430_Sub *data, int size)
{ {
int r3 = 0; int r3 = 0;
int i; int i;
@ -272,7 +272,7 @@ int sub_801B438(const struct MEventBuffer_3430_Sub * data, int size)
return r3; return r3;
} }
bool32 sub_801B460(const struct MEventBuffer_3430_Sub * data1, const u16 * data2, int size) static bool32 sub_801B460(const struct MEventBuffer_3430_Sub *data1, const u16 *data2, int size)
{ {
int i; int i;
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
@ -286,7 +286,7 @@ bool32 sub_801B460(const struct MEventBuffer_3430_Sub * data1, const u16 * data2
return FALSE; return FALSE;
} }
bool32 sub_801B4A4(const u16 * data) static bool32 sub_801B4A4(const u16 *data)
{ {
if (data[1] == 0) if (data[1] == 0)
return FALSE; return FALSE;
@ -297,7 +297,7 @@ bool32 sub_801B4A4(const u16 * data)
return TRUE; return TRUE;
} }
int sub_801B4CC(void) static int sub_801B4CC(void)
{ {
struct MEventBuffer_32E0_Sub *data; struct MEventBuffer_32E0_Sub *data;
if (!sub_801B27C()) if (!sub_801B27C())
@ -434,7 +434,7 @@ bool32 sub_801B748(const struct MEventStruct_Unk1442CC * a0, const u16 * a1)
return TRUE; return TRUE;
} }
int sub_801B770(const struct MEventStruct_Unk1442CC * a0) static int sub_801B770(const struct MEventStruct_Unk1442CC *a0)
{ {
return sub_801B438(&a0->unk_20, a0->unk_44); return sub_801B438(&a0->unk_20, a0->unk_44);
} }
@ -459,7 +459,7 @@ u16 sub_801B784(const struct MEventStruct_Unk1442CC * a0, u32 command)
} }
} }
void sub_801B7D8(u32 command) static void sub_801B7D8(u32 command)
{ {
struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data;
if (data->unk_08_0 == 2) if (data->unk_08_0 == 2)
@ -585,12 +585,12 @@ void sub_801B990(u32 a0, u32 a1)
} }
} }
void sub_801B9F8(void) static void sub_801B9F8(void)
{ {
CpuFill32(0, gSaveBlock1Ptr->unk_322C.unk_344, sizeof(gSaveBlock1Ptr->unk_322C.unk_344)); CpuFill32(0, gSaveBlock1Ptr->unk_322C.unk_344, sizeof(gSaveBlock1Ptr->unk_322C.unk_344));
} }
bool32 sub_801BA24(u32 a0, u32 * a1, int size) static bool32 sub_801BA24(u32 a0, u32 *a1, int size)
{ {
int i; int i;
int j; int j;
@ -619,7 +619,7 @@ bool32 sub_801BA24(u32 a0, u32 * a1, int size)
} }
} }
void sub_801BA8C(u32 a0, u32 a1, u32 * a2, int a3) static void sub_801BA8C(u32 a0, u32 a1, u32 *a2, int a3)
{ {
if (sub_801BA24(a1, a2, a3)) if (sub_801BA24(a1, a2, a3))
sub_801B7D8(a0); sub_801B7D8(a0);

View File

@ -42,10 +42,10 @@
#include "player_pc.h" #include "player_pc.h"
#include "field_specials.h" #include "field_specials.h"
#include "berry_powder.h" #include "berry_powder.h"
#include "mevent.h"
extern void copy_strings_to_sav1(void); extern void copy_strings_to_sav1(void);
extern void sub_801AFD8(void);
extern void ResetPokeJumpResults(void); extern void ResetPokeJumpResults(void);
extern const u8 EventScript_ResetAllMapFlags[]; extern const u8 EventScript_ResetAllMapFlags[];

View File

@ -1,6 +1,7 @@
#include "global.h" #include "global.h"
#include "script.h" #include "script.h"
#include "event_data.h" #include "event_data.h"
#include "mevent.h"
#include "util.h" #include "util.h"
#include "constants/map_scripts.h" #include "constants/map_scripts.h"
@ -8,8 +9,6 @@
extern const u8* gUnknown_020375C0; extern const u8* gUnknown_020375C0;
extern bool32 sub_801B27C(void);
// ewram bss // ewram bss
IWRAM_DATA static u8 sScriptContext1Status; IWRAM_DATA static u8 sScriptContext1Status;
IWRAM_DATA static u32 sUnusedVariable1; IWRAM_DATA static u32 sUnusedVariable1;

View File

@ -34,6 +34,7 @@
#include "data2.h" #include "data2.h"
#include "field_screen_effect.h" #include "field_screen_effect.h"
#include "script_pokemon_util_80F87D8.h" #include "script_pokemon_util_80F87D8.h"
#include "mevent.h"
struct UnkStruct_Shared struct UnkStruct_Shared
{ {
@ -229,9 +230,6 @@ void sub_80177B8(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4,
bool32 sub_8017678(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1); bool32 sub_8017678(struct UnkStruct_x20 *arg0, struct UnkStruct_x1C *arg1);
u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId); u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId);
void sub_801807C(struct TradeUnkStruct *arg0); void sub_801807C(struct TradeUnkStruct *arg0);
void sub_801B940(void);
void sub_801B94C(u16);
u16 sub_801B39C(void);
void sub_801AC54(void); void sub_801AC54(void);
void sub_801DD98(void); void sub_801DD98(void);
void sub_802A9A8(u8 monId, MainCallback callback); void sub_802A9A8(u8 monId, MainCallback callback);