From 2c636859f0bfd1eae5d5bcfc334109e9e8a58775 Mon Sep 17 00:00:00 2001 From: cbt6 <91667135+cbt6@users.noreply.github.com> Date: Sun, 9 Jun 2024 10:07:05 +0800 Subject: [PATCH] Name CoordEvent struct --- include/struct_defs/struct_0203A4AC.h | 20 ++++++++++---------- include/unk_0203A378.h | 2 +- src/unk_0203A378.c | 8 ++++---- src/unk_0203C954.c | 12 +++++------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/include/struct_defs/struct_0203A4AC.h b/include/struct_defs/struct_0203A4AC.h index 72bc82eb6b..60db1a1298 100644 --- a/include/struct_defs/struct_0203A4AC.h +++ b/include/struct_defs/struct_0203A4AC.h @@ -1,15 +1,15 @@ #ifndef POKEPLATINUM_STRUCT_0203A4AC_H #define POKEPLATINUM_STRUCT_0203A4AC_H -typedef struct { - u16 unk_00; - u16 unk_02; - u16 unk_04; - u16 unk_06; - u16 unk_08; - u16 unk_0A; - u16 unk_0C; - u16 unk_0E; -} UnkStruct_0203A4AC; +typedef struct CoordEvent { + u16 script; + u16 x; + u16 z; + u16 width; + u16 length; + u16 y; + u16 value; + u16 var; +} CoordEvent; #endif // POKEPLATINUM_STRUCT_0203A4AC_H diff --git a/include/unk_0203A378.h b/include/unk_0203A378.h index a234c13d8a..0ed27d7513 100644 --- a/include/unk_0203A378.h +++ b/include/unk_0203A378.h @@ -17,7 +17,7 @@ int sub_0203A448(const FieldSystem * fieldSystem); const WarpEvent * sub_0203A450(const FieldSystem * fieldSystem, int param1); int sub_0203A468(const FieldSystem * fieldSystem, int param1, int param2); int sub_0203A4A4(const FieldSystem * fieldSystem); -const UnkStruct_0203A4AC * sub_0203A4AC(const FieldSystem * fieldSystem); +const CoordEvent * sub_0203A4AC(const FieldSystem * fieldSystem); u32 FieldSystem_GetNPCCount(const FieldSystem * fieldSystem); const ObjectEvent * sub_0203A4BC(const FieldSystem * fieldSystem); BOOL sub_0203A4C4(FieldSystem * fieldSystem, int param1, u16 param2, u16 param3); diff --git a/src/unk_0203A378.c b/src/unk_0203A378.c index a104c6d69f..69f0cf742f 100644 --- a/src/unk_0203A378.c +++ b/src/unk_0203A378.c @@ -24,7 +24,7 @@ struct UnkStruct_0203A3E8_t { const BgEvent * unk_10; const ObjectEvent * unk_14; const WarpEvent * unk_18; - const UnkStruct_0203A4AC * unk_1C; + const CoordEvent * unk_1C; u32 unk_20[512]; u32 unk_820[64]; UnkStruct_ov6_02242634 unk_920; @@ -121,7 +121,7 @@ int sub_0203A4A4 (const FieldSystem * fieldSystem) return fieldSystem->unk_14->unk_0C; } -const UnkStruct_0203A4AC * sub_0203A4AC (const FieldSystem * fieldSystem) +const CoordEvent * sub_0203A4AC (const FieldSystem * fieldSystem) { return fieldSystem->unk_14->unk_1C; } @@ -263,12 +263,12 @@ static void sub_0203A5B0 (UnkStruct_0203A3E8 * param0) v0 += sizeof(u32); if (param0->unk_0C != 0) { - param0->unk_1C = (const UnkStruct_0203A4AC *)v0; + param0->unk_1C = (const CoordEvent *)v0; } else { param0->unk_1C = NULL; } - v0 += sizeof(UnkStruct_0203A4AC) * param0->unk_0C; + v0 += sizeof(CoordEvent) * param0->unk_0C; } void sub_0203A614 (UnkStruct_ov6_02242634 * param0, int param1) diff --git a/src/unk_0203C954.c b/src/unk_0203C954.c index deea0cbb7f..fe579ba116 100644 --- a/src/unk_0203C954.c +++ b/src/unk_0203C954.c @@ -206,17 +206,15 @@ u8 sub_0203CBE0 (FieldSystem * fieldSystem, MapObject ** param1) u16 sub_0203CC14 (FieldSystem * fieldSystem, void * param1, int param2) { - const UnkStruct_0203A4AC * v0; - int v1, v2; int v3; - v0 = (const UnkStruct_0203A4AC *)param1; - v1 = Player_GetXPos(fieldSystem->playerAvatar); - v2 = Player_GetZPos(fieldSystem->playerAvatar); + const CoordEvent * v0 = param1; + int v1 = Player_GetXPos(fieldSystem->playerAvatar); + int v2 = Player_GetZPos(fieldSystem->playerAvatar); for (v3 = 0; v3 < param2; v3++) { - if ((v1 >= v0[v3].unk_02) && (v1 < (v0[v3].unk_02 + v0[v3].unk_06)) && (v2 >= v0[v3].unk_04) && (v2 < (v0[v3].unk_04 + v0[v3].unk_08)) && (sub_0203F150(fieldSystem, v0[v3].unk_0E) == v0[v3].unk_0C)) { - return v0[v3].unk_00; + if ((v1 >= v0[v3].x) && (v1 < (v0[v3].x + v0[v3].width)) && (v2 >= v0[v3].z) && (v2 < (v0[v3].z + v0[v3].length)) && (sub_0203F150(fieldSystem, v0[v3].var) == v0[v3].value)) { + return v0[v3].script; } }