From 4c4fb6b254939127b9bb6b6f5b44c0e0994584b9 Mon Sep 17 00:00:00 2001 From: Eebit Date: Thu, 15 Jan 2026 22:01:32 -0500 Subject: [PATCH 1/3] (cursor) Raw decomp --- config/YFEE01/arm9/overlays/ov000/delinks.txt | 3 + include/map.hpp | 21 +- include/unknown_funcs.h | 6 +- src/ov000/cursor.cpp | 315 ++++++++++++++++++ 4 files changed, 336 insertions(+), 9 deletions(-) create mode 100644 src/ov000/cursor.cpp diff --git a/config/YFEE01/arm9/overlays/ov000/delinks.txt b/config/YFEE01/arm9/overlays/ov000/delinks.txt index 2654754..1fdb10d 100644 --- a/config/YFEE01/arm9/overlays/ov000/delinks.txt +++ b/config/YFEE01/arm9/overlays/ov000/delinks.txt @@ -13,6 +13,9 @@ src/ov000/camera.cpp: complete .text start:0x021a4a7c end:0x021a5318 +src/ov000/cursor.cpp: + .text start:0x021a68c0 end:0x021a6f10 + src/ov000/playerphase.cpp: .text start:0x021aa210 end:0x021ae2f4 diff --git a/include/map.hpp b/include/map.hpp index 39196a3..7034639 100644 --- a/include/map.hpp +++ b/include/map.hpp @@ -183,7 +183,8 @@ struct MapStateManager_0C // +0x18 contains key handlers STRUCT_PAD(0x00, 0x1C); u16 unk_1c; - STRUCT_PAD(0x1E, 0x20); + u8 unk_1e; + u8 unk_1f; u8 unk_20; u8 unk_21_0 : 2; u8 unk_21_2 : 1; @@ -202,12 +203,20 @@ class MapStateManager_10 public: /* 00 */ s8 unk_00[2]; /* 02 */ s8 unk_02[2]; - /* 04 */ STRUCT_PAD(0x04, 0x08); - /* 08 */ u8 unk_08; - /* 09 */ u8 unk_09; - u8 unk_0a; + s16 unk_04; // cursor x display (in px) + s16 unk_06; // cursor y display (in px) + /* 08 */ u8 unk_08; // cursor tile x + /* 09 */ u8 unk_09; // cursor tile y + u8 unk_0a; // cursor visible? u8 unk_0b; - /* 0A */ STRUCT_PAD(0x0C, 0x1A); + u8 unk_0c; + u8 unk_0d; + u8 unk_0e; + STRUCT_PAD(0x0F, 0x12); + s16 unk_12; + s16 unk_14; + u16 unk_16; + u16 unk_18; void SetUnk00And02(u8 phase, u8 r12, u8 r2) { diff --git a/include/unknown_funcs.h b/include/unknown_funcs.h index 54614cd..e5e242e 100644 --- a/include/unknown_funcs.h +++ b/include/unknown_funcs.h @@ -5788,10 +5788,10 @@ EC void func_ov000_021a5d5c(void *, u32); // EC ??? func_ov000_021a68c0 // EC ??? func_ov000_021a6910 // EC ??? func_ov000_021a6994 -EC void func_ov000_021a6ab8(void *, s32, s32); -EC void func_ov000_021a6aec(void *); +// EC void func_ov000_021a6ab8(void *, s32, s32); +// EC void func_ov000_021a6aec(void *); // EC ??? func_ov000_021a6b4c -EC void func_ov000_021a6bd0(void *); +// EC void func_ov000_021a6bd0(void *); // EC ??? func_ov000_021a6c38 // EC ??? func_ov000_021a6d48 // EC ??? func_ov000_021a6e68 diff --git a/src/ov000/cursor.cpp b/src/ov000/cursor.cpp new file mode 100644 index 0000000..25eb027 --- /dev/null +++ b/src/ov000/cursor.cpp @@ -0,0 +1,315 @@ +#include "global.h" + +#include "map.hpp" +#include "sound_manager.hpp" + +#include "unknown_funcs.h" + +#include "constants/sounds.h" + +EC void func_ov000_021a68c0(MapStateManager_10 * param_1) +{ + int i; + + for (i = 0; i < 2; i++) + { + param_1->unk_00[i] = -1; + param_1->unk_02[i] = -1; + } + + param_1->unk_04 = 0; + param_1->unk_06 = 0; + param_1->unk_08 = 0; + param_1->unk_09 = 0; + param_1->unk_0a = 0; + param_1->unk_0c = 1; + param_1->unk_0b = 1; + param_1->unk_0d = 0; + param_1->unk_0e = 0; + + return; +} + +EC void func_ov000_021a6910(MapStateManager_10 * param_1, s32 param_2, s32 param_3, s32 param_4) +{ + if (param_2 == param_1->unk_08 && param_3 == param_1->unk_09) + { + param_1->unk_0c = 0; + return; + } + + param_1->unk_08 = param_2; + param_1->unk_09 = param_3; + + param_1->unk_0c = 1; + + if (param_4 != 0 && param_1->unk_0a != 0) + { + if (param_1->unk_0d == 0) + { + gSoundManager->unk_b0->vfunc_28(SE_SYS_CURSOL_MAP1, 0, 0); + param_1->unk_0d = 2; + } + } + + return; +} + +EC void func_ov000_021a6994(MapStateManager_10 * param_1, s32 param_2, s32 param_3, s32 param_4, u8 param_5) +{ + int iVar2; + int iVar3; + + func_ov000_021a6910(param_1, param_2, param_3, param_5); + + if (param_1->unk_0c != 0) + { + param_1->unk_0b = 2; + + if (gMapStateManager->camera->func_ov000_021a4f7c(param_2, param_3, 0)) + { + gMapStateManager->camera->func_ov000_021a4cec(param_2, param_3, 0, param_4 != 0 ? 8 : 0x10, 0); + } + + param_1->unk_12 = param_1->unk_04; + param_1->unk_14 = param_1->unk_06; + param_1->unk_0b = 2; + + iVar2 = param_1->unk_08 * GetTileSize() - param_1->unk_04; + iVar3 = param_1->unk_09 * GetTileSize() - param_1->unk_06; + + if (iVar2 < 0) + { + iVar2 = -iVar2; + } + + if (iVar3 < 0) + { + iVar3 = -iVar3; + } + + param_1->unk_16 = IntSys_Div(IntSys_Sqrt(iVar2 * iVar2 + iVar3 * iVar3), gMapStateManager->camera->unk_12); + + if (param_1->unk_16 > 4) + { + param_1->unk_16 = 4; + } + + param_1->unk_18 = 0; + } + + return; +} + +EC void func_ov000_021a6ab8(MapStateManager_10 * param_1, s16 arg_1, s16 arg_2) +{ + func_ov000_021a6910(param_1, arg_1, arg_2, 1); + + param_1->unk_04 = param_1->unk_08 * GetTileSize(); + param_1->unk_06 = param_1->unk_09 * GetTileSize(); + + return; +} + +EC void func_ov000_021a6aec(MapStateManager_10 * param_1) +{ + s32 x = gMapStateManager->camera->unk_00; + s32 y = gMapStateManager->camera->unk_04; + + func_ov000_021a6ab8(param_1, IntSys_Div(x + 0x80, GetTileSize()), IntSys_Div(y + 0x60, GetTileSize())); + + return; +} + +EC void func_ov000_021a6b4c(MapStateManager_10 * arg0, s32 arg1, s32 arg2) +{ + s32 diff; + s32 var_r4 = gMapStateManager->camera->unk_12; + + if (gMapStateManager->unk_0c->unk_24 != 0) + { + var_r4 *= 2; + } + + diff = arg1 - arg0->unk_04; + if (diff > var_r4) + { + arg0->unk_04 += var_r4; + } + else if (diff < -var_r4) + { + arg0->unk_04 -= var_r4; + } + else + { + arg0->unk_04 = arg1; + } + + diff = arg2 - arg0->unk_06; + if (diff > var_r4) + { + arg0->unk_06 += var_r4; + } + else if (diff < -var_r4) + { + arg0->unk_06 -= var_r4; + } + else + { + arg0->unk_06 = arg2; + } + + return; +} + +EC void func_ov000_021a6bd0(MapStateManager_10 * arg0) +{ + arg0->unk_04 = arg0->unk_08 * GetTileSize(); + arg0->unk_06 = arg0->unk_09 * GetTileSize(); + + if ((gMapStateManager->unk_0c->unk_1f == 1 ? TRUE : FALSE) == 0) + { + return; + } + + gMapStateManager->camera->func_ov000_021a4ba0(arg0->unk_04, arg0->unk_06, 0); +} + +EC void func_ov000_021a6c38(MapStateManager_10 * arg0) +{ + s32 temp_r4; + s32 temp_r6; + + temp_r4 = arg0->unk_08 * GetTileSize(); + temp_r6 = arg0->unk_09 * GetTileSize(); + + if (gMapStateManager->unk_0c->unk_1e != 0) + { + temp_r4 = arg0->unk_08 * GetTileSize(); + temp_r6 = arg0->unk_09 * GetTileSize(); + + if (ABS(temp_r4 - arg0->unk_04) <= GetTileSize() && ABS(temp_r6 - arg0->unk_06) <= GetTileSize()) + { + func_ov000_021a6b4c(arg0, temp_r4, temp_r6); + return; + } + + arg0->unk_04 = arg0->unk_08 * GetTileSize(); + arg0->unk_06 = arg0->unk_09 * GetTileSize(); + + return; + } + + func_ov000_021a6b4c(arg0, temp_r4, temp_r6); + + if (arg0->unk_0a == 0) + { + return; + } + + if (((gMapStateManager->unk_0c->unk_1f == 1) ? TRUE : FALSE) == 0) + { + return; + } + + gMapStateManager->camera->func_ov000_021a4ba0(arg0->unk_04, arg0->unk_06, 0); + + return; +} + +struct UnkStruct_02196f20 +{ + STRUCT_PAD(0x000, 0x184); + s32 unk_184; + u32 unk_188; + u32 unk_18c; + s32 unk_190; + u32 unk_194; + u8 unk_198; + u8 unk_199; + u8 unk_19a; + u8 unk_19b; + s8 unk_19c; + STRUCT_PAD(0x19D, 0x1A4); +}; +extern struct UnkStruct_02196f20 * data_02196f20; + +EC void func_ov000_021a6d48(MapStateManager_10 * param_1) +{ + if (param_1->unk_16 != 0) + { + param_1->unk_18++; + + if (param_1->unk_16 < 4) + { + param_1->unk_04 = + Interpolate(0, param_1->unk_12, param_1->unk_08 * GetTileSize(), param_1->unk_18, param_1->unk_16); + param_1->unk_06 = + Interpolate(0, param_1->unk_14, param_1->unk_09 * GetTileSize(), param_1->unk_18, param_1->unk_16); + } + else + { + param_1->unk_04 = + Interpolate(4, param_1->unk_12, param_1->unk_08 * GetTileSize(), param_1->unk_18, param_1->unk_16); + param_1->unk_06 = + Interpolate(4, param_1->unk_14, param_1->unk_09 * GetTileSize(), param_1->unk_18, param_1->unk_16); + } + + if (param_1->unk_18 == param_1->unk_16) + { + param_1->unk_18 = 0; + param_1->unk_16 = 0; + } + } + + if (param_1->unk_16 == 0 && !(gMapStateManager->camera->unk_18 < 2 ? FALSE : TRUE)) + { + param_1->unk_0b = 1; + } + + return; +} + +EC void func_ov000_021a6e68(MapStateManager_10 * param_1) +{ + switch (param_1->unk_0b) + { + case 1: + func_ov000_021a6c38(param_1); + break; + + case 2: + func_ov000_021a6d48(param_1); + break; + } + + if (param_1->unk_0d != 0) + { + param_1->unk_0d--; + } + + return; +} + +EC BOOL func_ov000_021a6ea8(MapStateManager_10 * param_1, s32 param_2) +{ + s32 iVar3; + + s32 idk = (param_1->unk_08 * GetTileSize() + (GetTileSize() >> 1)); + + if (param_2 != 0) + { + iVar3 = gMapStateManager->camera->unk_14; + } + else + { + iVar3 = gMapStateManager->camera->unk_00; + } + + if ((idk - iVar3) < 0x80) + { + return TRUE; + } + + return FALSE; +} From 2d9eedc4e764696040905244da96cc1c0a0a77cb Mon Sep 17 00:00:00 2001 From: Eebit Date: Thu, 15 Jan 2026 22:54:24 -0500 Subject: [PATCH 2/3] (cursor) C++ify and name functions --- config/YFEE01/arm9/overlays/ov000/symbols.txt | 22 +- include/map.hpp | 50 +++-- include/unknown_funcs.h | 22 +- src/ov000/cursor.cpp | 202 +++++++++--------- src/ov000/map_state.cpp | 30 +-- src/ov000/playerphase.cpp | 8 +- src/ov005/prep_proc_02212d60.cpp | 16 +- 7 files changed, 182 insertions(+), 168 deletions(-) diff --git a/config/YFEE01/arm9/overlays/ov000/symbols.txt b/config/YFEE01/arm9/overlays/ov000/symbols.txt index 5cc25a5..85f2d95 100644 --- a/config/YFEE01/arm9/overlays/ov000/symbols.txt +++ b/config/YFEE01/arm9/overlays/ov000/symbols.txt @@ -103,17 +103,17 @@ func_ov000_021a5d5c kind:function(arm,size=0x670) addr:0x021a5d5c func_ov000_021a63cc kind:function(arm,size=0x6c) addr:0x021a63cc func_ov000_021a6438 kind:function(arm,size=0x3c8) addr:0x021a6438 func_ov000_021a6800 kind:function(arm,size=0xc0) addr:0x021a6800 -func_ov000_021a68c0 kind:function(arm,size=0x50) addr:0x021a68c0 -func_ov000_021a6910 kind:function(arm,size=0x84) addr:0x021a6910 -func_ov000_021a6994 kind:function(arm,size=0x124) addr:0x021a6994 -func_ov000_021a6ab8 kind:function(arm,size=0x34) addr:0x021a6ab8 -func_ov000_021a6aec kind:function(arm,size=0x60) addr:0x021a6aec -func_ov000_021a6b4c kind:function(arm,size=0x84) addr:0x021a6b4c -func_ov000_021a6bd0 kind:function(arm,size=0x68) addr:0x021a6bd0 -func_ov000_021a6c38 kind:function(arm,size=0x110) addr:0x021a6c38 -func_ov000_021a6d48 kind:function(arm,size=0x120) addr:0x021a6d48 -func_ov000_021a6e68 kind:function(arm,size=0x40) addr:0x021a6e68 -func_ov000_021a6ea8 kind:function(arm,size=0x68) addr:0x021a6ea8 +_ZN6Cursor4InitEv kind:function(arm,size=0x50) addr:0x021a68c0 +_ZN6Cursor6SetPosElll kind:function(arm,size=0x84) addr:0x021a6910 +_ZN6Cursor14SetPosAnimatedElllh kind:function(arm,size=0x124) addr:0x021a6994 +_ZN6Cursor15SetPosImmediateEss kind:function(arm,size=0x34) addr:0x021a6ab8 +_ZN6Cursor14CenterOnCameraEv kind:function(arm,size=0x60) addr:0x021a6aec +_ZN6Cursor9_021a6b4cEll kind:function(arm,size=0x84) addr:0x021a6b4c +_ZN6Cursor9_021a6bd0Ev kind:function(arm,size=0x68) addr:0x021a6bd0 +_ZN6Cursor9_021a6c38Ev kind:function(arm,size=0x110) addr:0x021a6c38 +_ZN6Cursor9_021a6d48Ev kind:function(arm,size=0x120) addr:0x021a6d48 +_ZN6Cursor6UpdateEv kind:function(arm,size=0x40) addr:0x021a6e68 +_ZN6Cursor9_021a6ea8El kind:function(arm,size=0x68) addr:0x021a6ea8 func_ov000_021a6f10 kind:function(arm,size=0x6c) addr:0x021a6f10 func_ov000_021a6f7c kind:function(arm,size=0x34) addr:0x021a6f7c func_ov000_021a6fb0 kind:function(arm,size=0x120) addr:0x021a6fb0 diff --git a/include/map.hpp b/include/map.hpp index 7034639..6fb2b77 100644 --- a/include/map.hpp +++ b/include/map.hpp @@ -198,31 +198,43 @@ struct MapStateManager_0C STRUCT_PAD(0x25, 0x28); }; -class MapStateManager_10 +class Cursor { public: /* 00 */ s8 unk_00[2]; /* 02 */ s8 unk_02[2]; - s16 unk_04; // cursor x display (in px) - s16 unk_06; // cursor y display (in px) - /* 08 */ u8 unk_08; // cursor tile x - /* 09 */ u8 unk_09; // cursor tile y - u8 unk_0a; // cursor visible? - u8 unk_0b; - u8 unk_0c; - u8 unk_0d; - u8 unk_0e; - STRUCT_PAD(0x0F, 0x12); - s16 unk_12; - s16 unk_14; - u16 unk_16; - u16 unk_18; - - void SetUnk00And02(u8 phase, u8 r12, u8 r2) + /* 04 */ s16 xDisplay; // in px + /* 06 */ s16 yDisplay; // in px + /* 08 */ u8 xTile; + /* 09 */ u8 yTile; + /* 0A */ u8 isVisible; + /* 0B */ u8 unk_0b; + /* 0C */ u8 changed; + /* 0D */ u8 soundCooldownTimer; + /* 0E */ u8 unk_0e; + /* 0F */ STRUCT_PAD(0x0F, 0x12); + /* 12 */ s16 xLerpStart; + /* 14 */ s16 yLerpStart; + /* 16 */ u16 lerpDuration; + /* 18 */ u16 lerpElapsed; + + inline void SetUnk00And02(u8 phase, u8 r12, u8 r2) { this->unk_00[phase] = r12; this->unk_02[phase] = r2; } + + void Init(void); // _ZN6Cursor4InitEv + void SetPos(s32 x, s32 y, s32); // _ZN6Cursor6SetPosElll + void SetPosAnimated(s32 x, s32 y, s32, u8); // _ZN6Cursor14SetPosAnimatedElllh + void SetPosImmediate(s16, s16); // _ZN6Cursor15SetPosImmediateEss + void CenterOnCamera(void); // _ZN6Cursor14CenterOnCameraEv + void _021a6b4c(s32, s32); // _ZN6Cursor9_021a6b4cEll + void _021a6bd0(void); // _ZN6Cursor9_021a6bd0Ev + void _021a6c38(void); // _ZN6Cursor9_021a6c38Ev + void _021a6d48(void); // _ZN6Cursor9_021a6d48Ev + void Update(void); // _ZN6Cursor6UpdateEv + BOOL _021a6ea8(s32); // _ZN6Cursor9_021a6ea8El }; EC void func_ov000_021b9a1c(struct MapStateManager_14 *); @@ -317,11 +329,11 @@ class MapStateManager_1C class MapStateManager { public: - /* 000 */ struct Camera * camera; + /* 000 */ Camera * camera; /* 004 */ struct MapStateManager_04 * unk_04; /* 008 */ struct MapStateManager_08 * unk_08; /* 00C */ struct MapStateManager_0C * unk_0c; - /* 010 */ struct MapStateManager_10 * unk_10; + /* 010 */ Cursor * cursor; /* 014 */ struct MapStateManager_14 * unk_14; /* 018 */ void * unk_18; /* 01C */ struct MapStateManager_1C * unk_1c; diff --git a/include/unknown_funcs.h b/include/unknown_funcs.h index e5e242e..bea2c6b 100644 --- a/include/unknown_funcs.h +++ b/include/unknown_funcs.h @@ -5785,17 +5785,17 @@ EC void func_ov000_021a5d5c(void *, u32); // EC ??? func_ov000_021a63cc // EC ??? func_ov000_021a6438 // EC ??? func_ov000_021a6800 -// EC ??? func_ov000_021a68c0 -// EC ??? func_ov000_021a6910 -// EC ??? func_ov000_021a6994 -// EC void func_ov000_021a6ab8(void *, s32, s32); -// EC void func_ov000_021a6aec(void *); -// EC ??? func_ov000_021a6b4c -// EC void func_ov000_021a6bd0(void *); -// EC ??? func_ov000_021a6c38 -// EC ??? func_ov000_021a6d48 -// EC ??? func_ov000_021a6e68 -// EC ??? func_ov000_021a6ea8 +// EC ??? _ZN6Cursor4InitEv +// EC ??? _ZN6Cursor6SetPosElll +// EC ??? _ZN6Cursor14SetPosAnimatedElllh +// EC void _ZN6Cursor15SetPosImmediateEss(void *, s32, s32); +// EC void _ZN6Cursor14CenterOnCameraEv(void *); +// EC ??? _ZN6Cursor9_021a6b4cEll +// EC void _ZN6Cursor9_021a6bd0Ev(void *); +// EC ??? _ZN6Cursor9_021a6c38Ev +// EC ??? _ZN6Cursor9_021a6d48Ev +// EC ??? _ZN6Cursor6UpdateEv +// EC ??? _ZN6Cursor9_021a6ea8El // EC ??? func_ov000_021a6f10 // EC ??? func_ov000_021a6f7c // EC ??? func_ov000_021a6fb0 diff --git a/src/ov000/cursor.cpp b/src/ov000/cursor.cpp index 25eb027..d0db693 100644 --- a/src/ov000/cursor.cpp +++ b/src/ov000/cursor.cpp @@ -7,121 +7,121 @@ #include "constants/sounds.h" -EC void func_ov000_021a68c0(MapStateManager_10 * param_1) +void Cursor::Init(void) { int i; for (i = 0; i < 2; i++) { - param_1->unk_00[i] = -1; - param_1->unk_02[i] = -1; + this->unk_00[i] = -1; + this->unk_02[i] = -1; } - param_1->unk_04 = 0; - param_1->unk_06 = 0; - param_1->unk_08 = 0; - param_1->unk_09 = 0; - param_1->unk_0a = 0; - param_1->unk_0c = 1; - param_1->unk_0b = 1; - param_1->unk_0d = 0; - param_1->unk_0e = 0; + this->xDisplay = 0; + this->yDisplay = 0; + this->xTile = 0; + this->yTile = 0; + this->isVisible = FALSE; + this->changed = TRUE; + this->unk_0b = 1; + this->soundCooldownTimer = 0; + this->unk_0e = 0; return; } -EC void func_ov000_021a6910(MapStateManager_10 * param_1, s32 param_2, s32 param_3, s32 param_4) +void Cursor::SetPos(s32 x, s32 y, s32 param_4) { - if (param_2 == param_1->unk_08 && param_3 == param_1->unk_09) + if (x == this->xTile && y == this->yTile) { - param_1->unk_0c = 0; + this->changed = FALSE; return; } - param_1->unk_08 = param_2; - param_1->unk_09 = param_3; + this->xTile = x; + this->yTile = y; - param_1->unk_0c = 1; + this->changed = TRUE; - if (param_4 != 0 && param_1->unk_0a != 0) + if (param_4 != 0 && this->isVisible) { - if (param_1->unk_0d == 0) + if (this->soundCooldownTimer == 0) { gSoundManager->unk_b0->vfunc_28(SE_SYS_CURSOL_MAP1, 0, 0); - param_1->unk_0d = 2; + this->soundCooldownTimer = 2; } } return; } -EC void func_ov000_021a6994(MapStateManager_10 * param_1, s32 param_2, s32 param_3, s32 param_4, u8 param_5) +void Cursor::SetPosAnimated(s32 x, s32 y, s32 param_4, u8 param_5) { - int iVar2; - int iVar3; + s32 xNew; + s32 yNew; - func_ov000_021a6910(param_1, param_2, param_3, param_5); + this->SetPos(x, y, param_5); - if (param_1->unk_0c != 0) + if (this->changed) { - param_1->unk_0b = 2; + this->unk_0b = 2; - if (gMapStateManager->camera->func_ov000_021a4f7c(param_2, param_3, 0)) + if (gMapStateManager->camera->func_ov000_021a4f7c(x, y, 0)) { - gMapStateManager->camera->func_ov000_021a4cec(param_2, param_3, 0, param_4 != 0 ? 8 : 0x10, 0); + gMapStateManager->camera->func_ov000_021a4cec(x, y, 0, param_4 != 0 ? 8 : 0x10, 0); } - param_1->unk_12 = param_1->unk_04; - param_1->unk_14 = param_1->unk_06; - param_1->unk_0b = 2; + this->xLerpStart = this->xDisplay; + this->yLerpStart = this->yDisplay; + this->unk_0b = 2; - iVar2 = param_1->unk_08 * GetTileSize() - param_1->unk_04; - iVar3 = param_1->unk_09 * GetTileSize() - param_1->unk_06; + xNew = this->xTile * GetTileSize() - this->xDisplay; + yNew = this->yTile * GetTileSize() - this->yDisplay; - if (iVar2 < 0) + if (xNew < 0) { - iVar2 = -iVar2; + xNew = -xNew; } - if (iVar3 < 0) + if (yNew < 0) { - iVar3 = -iVar3; + yNew = -yNew; } - param_1->unk_16 = IntSys_Div(IntSys_Sqrt(iVar2 * iVar2 + iVar3 * iVar3), gMapStateManager->camera->unk_12); + this->lerpDuration = IntSys_Div(IntSys_Sqrt(xNew * xNew + yNew * yNew), gMapStateManager->camera->unk_12); - if (param_1->unk_16 > 4) + if (this->lerpDuration > 4) { - param_1->unk_16 = 4; + this->lerpDuration = 4; } - param_1->unk_18 = 0; + this->lerpElapsed = 0; } return; } -EC void func_ov000_021a6ab8(MapStateManager_10 * param_1, s16 arg_1, s16 arg_2) +void Cursor::SetPosImmediate(s16 x, s16 y) { - func_ov000_021a6910(param_1, arg_1, arg_2, 1); + this->SetPos(x, y, 1); - param_1->unk_04 = param_1->unk_08 * GetTileSize(); - param_1->unk_06 = param_1->unk_09 * GetTileSize(); + this->xDisplay = this->xTile * GetTileSize(); + this->yDisplay = this->yTile * GetTileSize(); return; } -EC void func_ov000_021a6aec(MapStateManager_10 * param_1) +void Cursor::CenterOnCamera(void) { s32 x = gMapStateManager->camera->unk_00; s32 y = gMapStateManager->camera->unk_04; - func_ov000_021a6ab8(param_1, IntSys_Div(x + 0x80, GetTileSize()), IntSys_Div(y + 0x60, GetTileSize())); + this->SetPosImmediate(IntSys_Div(x + 0x80, GetTileSize()), IntSys_Div(y + 0x60, GetTileSize())); return; } -EC void func_ov000_021a6b4c(MapStateManager_10 * arg0, s32 arg1, s32 arg2) +void Cursor::_021a6b4c(s32 xPx, s32 yPx) { s32 diff; s32 var_r4 = gMapStateManager->camera->unk_12; @@ -131,78 +131,80 @@ EC void func_ov000_021a6b4c(MapStateManager_10 * arg0, s32 arg1, s32 arg2) var_r4 *= 2; } - diff = arg1 - arg0->unk_04; + diff = xPx - this->xDisplay; + if (diff > var_r4) { - arg0->unk_04 += var_r4; + this->xDisplay += var_r4; } else if (diff < -var_r4) { - arg0->unk_04 -= var_r4; + this->xDisplay -= var_r4; } else { - arg0->unk_04 = arg1; + this->xDisplay = xPx; } - diff = arg2 - arg0->unk_06; + diff = yPx - this->yDisplay; + if (diff > var_r4) { - arg0->unk_06 += var_r4; + this->yDisplay += var_r4; } else if (diff < -var_r4) { - arg0->unk_06 -= var_r4; + this->yDisplay -= var_r4; } else { - arg0->unk_06 = arg2; + this->yDisplay = yPx; } return; } -EC void func_ov000_021a6bd0(MapStateManager_10 * arg0) +void Cursor::_021a6bd0(void) { - arg0->unk_04 = arg0->unk_08 * GetTileSize(); - arg0->unk_06 = arg0->unk_09 * GetTileSize(); + this->xDisplay = this->xTile * GetTileSize(); + this->yDisplay = this->yTile * GetTileSize(); if ((gMapStateManager->unk_0c->unk_1f == 1 ? TRUE : FALSE) == 0) { return; } - gMapStateManager->camera->func_ov000_021a4ba0(arg0->unk_04, arg0->unk_06, 0); + gMapStateManager->camera->func_ov000_021a4ba0(this->xDisplay, this->yDisplay, 0); } -EC void func_ov000_021a6c38(MapStateManager_10 * arg0) +void Cursor::_021a6c38(void) { - s32 temp_r4; - s32 temp_r6; + s32 xDisp; + s32 yDisp; - temp_r4 = arg0->unk_08 * GetTileSize(); - temp_r6 = arg0->unk_09 * GetTileSize(); + xDisp = this->xTile * GetTileSize(); + yDisp = this->yTile * GetTileSize(); if (gMapStateManager->unk_0c->unk_1e != 0) { - temp_r4 = arg0->unk_08 * GetTileSize(); - temp_r6 = arg0->unk_09 * GetTileSize(); + xDisp = this->xTile * GetTileSize(); + yDisp = this->yTile * GetTileSize(); - if (ABS(temp_r4 - arg0->unk_04) <= GetTileSize() && ABS(temp_r6 - arg0->unk_06) <= GetTileSize()) + if (ABS(xDisp - this->xDisplay) <= GetTileSize() && ABS(yDisp - this->yDisplay) <= GetTileSize()) { - func_ov000_021a6b4c(arg0, temp_r4, temp_r6); + this->_021a6b4c(xDisp, yDisp); return; } - arg0->unk_04 = arg0->unk_08 * GetTileSize(); - arg0->unk_06 = arg0->unk_09 * GetTileSize(); + this->xDisplay = this->xTile * GetTileSize(); + this->yDisplay = this->yTile * GetTileSize(); return; } - func_ov000_021a6b4c(arg0, temp_r4, temp_r6); + this->_021a6b4c(xDisp, yDisp); - if (arg0->unk_0a == 0) + if (!this->isVisible) { return; } @@ -212,7 +214,7 @@ EC void func_ov000_021a6c38(MapStateManager_10 * arg0) return; } - gMapStateManager->camera->func_ov000_021a4ba0(arg0->unk_04, arg0->unk_06, 0); + gMapStateManager->camera->func_ov000_021a4ba0(this->xDisplay, this->yDisplay, 0); return; } @@ -234,68 +236,68 @@ struct UnkStruct_02196f20 }; extern struct UnkStruct_02196f20 * data_02196f20; -EC void func_ov000_021a6d48(MapStateManager_10 * param_1) +void Cursor::_021a6d48(void) { - if (param_1->unk_16 != 0) + if (this->lerpDuration != 0) { - param_1->unk_18++; + this->lerpElapsed++; - if (param_1->unk_16 < 4) + if (this->lerpDuration < 4) { - param_1->unk_04 = - Interpolate(0, param_1->unk_12, param_1->unk_08 * GetTileSize(), param_1->unk_18, param_1->unk_16); - param_1->unk_06 = - Interpolate(0, param_1->unk_14, param_1->unk_09 * GetTileSize(), param_1->unk_18, param_1->unk_16); + this->xDisplay = + Interpolate(0, this->xLerpStart, this->xTile * GetTileSize(), this->lerpElapsed, this->lerpDuration); + this->yDisplay = + Interpolate(0, this->yLerpStart, this->yTile * GetTileSize(), this->lerpElapsed, this->lerpDuration); } else { - param_1->unk_04 = - Interpolate(4, param_1->unk_12, param_1->unk_08 * GetTileSize(), param_1->unk_18, param_1->unk_16); - param_1->unk_06 = - Interpolate(4, param_1->unk_14, param_1->unk_09 * GetTileSize(), param_1->unk_18, param_1->unk_16); + this->xDisplay = + Interpolate(4, this->xLerpStart, this->xTile * GetTileSize(), this->lerpElapsed, this->lerpDuration); + this->yDisplay = + Interpolate(4, this->yLerpStart, this->yTile * GetTileSize(), this->lerpElapsed, this->lerpDuration); } - if (param_1->unk_18 == param_1->unk_16) + if (this->lerpElapsed == this->lerpDuration) { - param_1->unk_18 = 0; - param_1->unk_16 = 0; + this->lerpElapsed = 0; + this->lerpDuration = 0; } } - if (param_1->unk_16 == 0 && !(gMapStateManager->camera->unk_18 < 2 ? FALSE : TRUE)) + if (this->lerpDuration == 0 && !(gMapStateManager->camera->unk_18 < 2 ? FALSE : TRUE)) { - param_1->unk_0b = 1; + this->unk_0b = 1; } return; } -EC void func_ov000_021a6e68(MapStateManager_10 * param_1) +void Cursor::Update(void) { - switch (param_1->unk_0b) + switch (this->unk_0b) { case 1: - func_ov000_021a6c38(param_1); + this->_021a6c38(); break; case 2: - func_ov000_021a6d48(param_1); + this->_021a6d48(); break; } - if (param_1->unk_0d != 0) + if (this->soundCooldownTimer != 0) { - param_1->unk_0d--; + this->soundCooldownTimer--; } return; } -EC BOOL func_ov000_021a6ea8(MapStateManager_10 * param_1, s32 param_2) +BOOL Cursor::_021a6ea8(s32 param_2) { s32 iVar3; - s32 idk = (param_1->unk_08 * GetTileSize() + (GetTileSize() >> 1)); + s32 idk = (this->xTile * GetTileSize() + (GetTileSize() >> 1)); if (param_2 != 0) { diff --git a/src/ov000/map_state.cpp b/src/ov000/map_state.cpp index 3985472..dc2d940 100644 --- a/src/ov000/map_state.cpp +++ b/src/ov000/map_state.cpp @@ -27,7 +27,7 @@ EC void func_0204f080(struct UnkStruct_021974fc *); EC void func_ov000_021a2eb0(struct SaveBuffer *, s32); EC void func_ov000_021a5318(MapStateManager_0C *); -EC void func_ov000_021a68c0(MapStateManager_10 *); +EC void _ZN6Cursor4InitEv(Cursor *); EC void func_ov000_021b9a10(MapStateManager_14 *); EC void func_ov000_021a37c4(void); @@ -70,7 +70,7 @@ EC void StartSoundWaitTo_02017b40(void *, void *, int); EC BOOL func_ov000_021adabc(struct Unit *, u32); -EC void func_ov000_021a6ab8(void *, s32, s32); +EC void _ZN6Cursor15SetPosImmediateEss(void *, s32, s32); EC BOOL func_ov000_021a475c(void); EC BOOL func_ov000_021a47ac(void); @@ -86,7 +86,7 @@ EC void func_ov000_021b9bec(struct MapStateManager_14 *); EC void func_ov000_021b9c3c(struct MapStateManager_14 *); -EC void func_ov000_021a6e68(struct MapStateManager_10 *); +EC void _ZN6Cursor6UpdateEv(struct Cursor *); EC void func_ov000_021b9bc4(struct MapStateManager_14 *); EC void func_ov000_021b9bac(struct MapStateManager_14 *); @@ -287,7 +287,7 @@ MapStateManager::MapStateManager() this->unk_08 = (MapStateManager_08 *)func_02000c70(); this->unk_0c = new struct MapStateManager_0C; - this->unk_10 = new struct MapStateManager_10; + this->cursor = new struct Cursor; this->unk_14 = new MapStateManager_14; this->unk_18 = NULL; @@ -315,7 +315,7 @@ MapStateManager::~MapStateManager() delete this->camera; delete this->unk_04; delete this->unk_0c; - delete this->unk_10; + delete this->cursor; delete this->unk_14; @@ -382,7 +382,7 @@ void MapStateManager::func_ov000_021a28cc(void) { gMapStateManager->camera->func_ov000_021a4a7c(); func_ov000_021a5318(gMapStateManager->unk_0c); - func_ov000_021a68c0(gMapStateManager->unk_10); + _ZN6Cursor4InitEv(gMapStateManager->cursor); func_ov000_021b9a10(gMapStateManager->unk_14); return; } @@ -527,13 +527,13 @@ EC void func_ov000_021a2b08(struct SaveBuffer * buf) buf->WriteShort(gMapStateManager->camera->unk_14); buf->WriteShort(gMapStateManager->camera->unk_16); - buf->WriteByte(gMapStateManager->unk_10->unk_08); - buf->WriteByte(gMapStateManager->unk_10->unk_09); + buf->WriteByte(gMapStateManager->cursor->xTile); + buf->WriteByte(gMapStateManager->cursor->yTile); for (i = 0; i < 2; i++) { - buf->WriteByte(gMapStateManager->unk_10->unk_00[i]); - buf->WriteByte(gMapStateManager->unk_10->unk_02[i]); + buf->WriteByte(gMapStateManager->cursor->unk_00[i]); + buf->WriteByte(gMapStateManager->cursor->unk_02[i]); } for (i = 0; i < 4; i++) @@ -599,14 +599,14 @@ EC void func_ov000_021a2eb0(struct SaveBuffer * buf, s32 arg_1) gMapStateManager->camera->func_ov000_021a52c8( gMapStateManager->camera->unk_14, gMapStateManager->camera->unk_16, 0); - func_ov000_021a6ab8(gMapStateManager->unk_10, buf->ReadByte(), buf->ReadByte()); + _ZN6Cursor15SetPosImmediateEss(gMapStateManager->cursor, buf->ReadByte(), buf->ReadByte()); for (i = 0; i < 2; i++) { s32 tmp = buf->ReadByte(); s32 tmp2 = buf->ReadByte(); - gMapStateManager->unk_10->unk_00[i] = tmp; - gMapStateManager->unk_10->unk_02[i] = tmp2; + gMapStateManager->cursor->unk_00[i] = tmp; + gMapStateManager->cursor->unk_02[i] = tmp2; } if (arg_1 >= 4) @@ -1453,7 +1453,7 @@ EC void func_ov000_021a46b8(void) /* NONMATCHING: https://decomp.me/scratch/DvhHi */ EC void func_ov000_021a46cc(struct Unit * unit, u32 arg_1) { - func_ov000_021a6ab8(gMapStateManager->unk_10, unit->xPos, unit->yPos); + _ZN6Cursor15SetPosImmediateEss(gMapStateManager->cursor, unit->xPos, unit->yPos); gMapStateManager->camera->func_ov000_021a4e84(unit->xPos, unit->yPos, arg_1); return; } @@ -1632,7 +1632,7 @@ void ProcMapDraw::Init(void) void ProcMapLow::Init(void) { - func_ov000_021a6e68(gMapStateManager->unk_10); + _ZN6Cursor6UpdateEv(gMapStateManager->cursor); func_ov000_021b9bc4(gMapStateManager->unk_14); gMapStateManager->camera->func_ov000_021a5128(); diff --git a/src/ov000/playerphase.cpp b/src/ov000/playerphase.cpp index 29048e4..fde6dd1 100644 --- a/src/ov000/playerphase.cpp +++ b/src/ov000/playerphase.cpp @@ -519,7 +519,7 @@ EC void func_ov000_021ac218(void) func_ov000_021a378c(); gMapStateManager->camera->func_ov000_021a4cec(x, y, 0, 0x20, 0); - func_ov000_021a6ab8(gMapStateManager->unk_10, (s16)x, (s16)y); + _ZN6Cursor15SetPosImmediateEss(gMapStateManager->unk_10, (s16)x, (s16)y); if (bVar5) { @@ -850,7 +850,7 @@ EC void func_ov000_021acd8c(void) func_ov000_021b79f8(); - func_ov000_021a6ab8(gMapStateManager->unk_10, pUnit->xPos, pUnit->yPos); + _ZN6Cursor15SetPosImmediateEss(gMapStateManager->unk_10, pUnit->xPos, pUnit->yPos); gMapStateManager->camera->func_ov000_021a4cec(pUnit->xPos, pUnit->yPos, 0, 0x20, 0); data_ov000_021e332c.unk_14->unk_09 = 1; @@ -1498,7 +1498,7 @@ EC void func_ov000_021ae1d0(void) EC void func_ov000_021ae1fc(void) { func_ov000_021b9960(gMapStateManager->unk_14); - func_ov000_021a6bd0(gMapStateManager->unk_10); + _ZN6Cursor9_021a6bd0Ev(gMapStateManager->unk_10); return; } @@ -1507,7 +1507,7 @@ EC void func_ov000_021ae228(void) func_ov000_021b9960(gMapStateManager->unk_14); func_ov000_021aa1d0(); func_ov000_021bc9e4(gMapStateManager->unk_14->unk_04); - func_ov000_021a6bd0(gMapStateManager->unk_10); + _ZN6Cursor9_021a6bd0Ev(gMapStateManager->unk_10); return; } diff --git a/src/ov005/prep_proc_02212d60.cpp b/src/ov005/prep_proc_02212d60.cpp index 033878b..c9ee49a 100644 --- a/src/ov005/prep_proc_02212d60.cpp +++ b/src/ov005/prep_proc_02212d60.cpp @@ -110,7 +110,7 @@ EC void func_ov005_02204d48(void) s32 unitId; struct Unit * unit; - unitId = gMapStateManager->unk_028[gMapStateManager->unk_10->unk_08 | gMapStateManager->unk_10->unk_09 << 5]; + unitId = gMapStateManager->unk_028[gMapStateManager->cursor->xTile | gMapStateManager->cursor->yTile << 5]; if (unitId == 0) { @@ -123,7 +123,7 @@ EC void func_ov005_02204d48(void) data_021974fc->unk_00 = unit; - func_0204b194(gMapStateManager->unk_10->unk_08, gMapStateManager->unk_10->unk_09); + func_0204b194(gMapStateManager->cursor->xTile, gMapStateManager->cursor->yTile); func_0204ae9c(2, 1); func_0204eb24(); @@ -141,25 +141,25 @@ EC void func_ov005_02204dd0(s32 param_1) if (((data_02196f0c->state & 0x200) == 0) && (unit != NULL)) { - func_ov000_021a6ab8(gMapStateManager->unk_10, unit->xPos, unit->yPos); + _ZN6Cursor15SetPosImmediateEss(gMapStateManager->cursor, unit->xPos, unit->yPos); if (param_1 == 0) { gMapStateManager->camera->func_ov000_021a4cec( - gMapStateManager->unk_10->unk_08, gMapStateManager->unk_10->unk_09, 1, 0x20, 0); + gMapStateManager->cursor->xTile, gMapStateManager->cursor->yTile, 1, 0x20, 0); } else { gMapStateManager->camera->func_ov000_021a4e84( - gMapStateManager->unk_10->unk_08, gMapStateManager->unk_10->unk_09, 1); + gMapStateManager->cursor->xTile, gMapStateManager->cursor->yTile, 1); } } else { - func_ov000_021a6aec(gMapStateManager->unk_10); + _ZN6Cursor14CenterOnCameraEv(gMapStateManager->cursor); } - gMapStateManager->unk_10->SetUnk00And02(0, -1, -1); + gMapStateManager->cursor->SetUnk00And02(0, -1, -1); return; } @@ -176,7 +176,7 @@ EC void func_ov005_02204ed8(void) EC void func_ov005_02204ee8(ProcPtr proc) { - if (gMapStateManager->unk_10->unk_0b == 2 ? TRUE : FALSE) + if (gMapStateManager->cursor->unk_0b == 2 ? TRUE : FALSE) { return; } From f3bfd51a7618eae4e2dd3ba7e0c8388a5a7dcb55 Mon Sep 17 00:00:00 2001 From: Eebit Date: Thu, 15 Jan 2026 23:05:28 -0500 Subject: [PATCH 3/3] (cursor) Integrate into codebase --- include/map.hpp | 22 ++++++++-------- src/gamectrl.cpp | 4 +-- src/ov000/map_state.cpp | 14 ++++------ src/ov000/playerphase.cpp | 44 ++++++++++++++++---------------- src/ov005/prep_proc_02212d60.cpp | 4 +-- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/include/map.hpp b/include/map.hpp index 6fb2b77..637dc78 100644 --- a/include/map.hpp +++ b/include/map.hpp @@ -224,17 +224,17 @@ class Cursor this->unk_02[phase] = r2; } - void Init(void); // _ZN6Cursor4InitEv - void SetPos(s32 x, s32 y, s32); // _ZN6Cursor6SetPosElll - void SetPosAnimated(s32 x, s32 y, s32, u8); // _ZN6Cursor14SetPosAnimatedElllh - void SetPosImmediate(s16, s16); // _ZN6Cursor15SetPosImmediateEss - void CenterOnCamera(void); // _ZN6Cursor14CenterOnCameraEv - void _021a6b4c(s32, s32); // _ZN6Cursor9_021a6b4cEll - void _021a6bd0(void); // _ZN6Cursor9_021a6bd0Ev - void _021a6c38(void); // _ZN6Cursor9_021a6c38Ev - void _021a6d48(void); // _ZN6Cursor9_021a6d48Ev - void Update(void); // _ZN6Cursor6UpdateEv - BOOL _021a6ea8(s32); // _ZN6Cursor9_021a6ea8El + void Init(void); + void SetPos(s32 x, s32 y, s32); + void SetPosAnimated(s32 x, s32 y, s32, u8); + void SetPosImmediate(s16, s16); + void CenterOnCamera(void); + void _021a6b4c(s32, s32); + void _021a6bd0(void); + void _021a6c38(void); + void _021a6d48(void); + void Update(void); + BOOL _021a6ea8(s32); }; EC void func_ov000_021b9a1c(struct MapStateManager_14 *); diff --git a/src/gamectrl.cpp b/src/gamectrl.cpp index 92e400f..785151a 100644 --- a/src/gamectrl.cpp +++ b/src/gamectrl.cpp @@ -863,7 +863,7 @@ EC void func_0202225c(void) func_0204b790(); unitId = - gMapStateManager->unk_028[gMapStateManager->unk_10->unk_08 | gMapStateManager->unk_10->unk_09 << 5]; + gMapStateManager->unk_028[gMapStateManager->cursor->xTile | gMapStateManager->cursor->yTile << 5]; if (unitId == 0) { @@ -875,7 +875,7 @@ EC void func_0202225c(void) } func_0204e1a4(pUnit, 0, 1); - func_0204eab8(gMapStateManager->unk_10->unk_08, gMapStateManager->unk_10->unk_09, 0); + func_0204eab8(gMapStateManager->cursor->xTile, gMapStateManager->cursor->yTile, 0); func_0204f6d0(); func_0204ad38(data_02196f20->unk_19b, 0, 0); diff --git a/src/ov000/map_state.cpp b/src/ov000/map_state.cpp index dc2d940..7422f3d 100644 --- a/src/ov000/map_state.cpp +++ b/src/ov000/map_state.cpp @@ -27,7 +27,6 @@ EC void func_0204f080(struct UnkStruct_021974fc *); EC void func_ov000_021a2eb0(struct SaveBuffer *, s32); EC void func_ov000_021a5318(MapStateManager_0C *); -EC void _ZN6Cursor4InitEv(Cursor *); EC void func_ov000_021b9a10(MapStateManager_14 *); EC void func_ov000_021a37c4(void); @@ -70,8 +69,6 @@ EC void StartSoundWaitTo_02017b40(void *, void *, int); EC BOOL func_ov000_021adabc(struct Unit *, u32); -EC void _ZN6Cursor15SetPosImmediateEss(void *, s32, s32); - EC BOOL func_ov000_021a475c(void); EC BOOL func_ov000_021a47ac(void); @@ -86,7 +83,6 @@ EC void func_ov000_021b9bec(struct MapStateManager_14 *); EC void func_ov000_021b9c3c(struct MapStateManager_14 *); -EC void _ZN6Cursor6UpdateEv(struct Cursor *); EC void func_ov000_021b9bc4(struct MapStateManager_14 *); EC void func_ov000_021b9bac(struct MapStateManager_14 *); @@ -287,7 +283,7 @@ MapStateManager::MapStateManager() this->unk_08 = (MapStateManager_08 *)func_02000c70(); this->unk_0c = new struct MapStateManager_0C; - this->cursor = new struct Cursor; + this->cursor = new Cursor; this->unk_14 = new MapStateManager_14; this->unk_18 = NULL; @@ -382,7 +378,7 @@ void MapStateManager::func_ov000_021a28cc(void) { gMapStateManager->camera->func_ov000_021a4a7c(); func_ov000_021a5318(gMapStateManager->unk_0c); - _ZN6Cursor4InitEv(gMapStateManager->cursor); + gMapStateManager->cursor->Init(); func_ov000_021b9a10(gMapStateManager->unk_14); return; } @@ -599,7 +595,7 @@ EC void func_ov000_021a2eb0(struct SaveBuffer * buf, s32 arg_1) gMapStateManager->camera->func_ov000_021a52c8( gMapStateManager->camera->unk_14, gMapStateManager->camera->unk_16, 0); - _ZN6Cursor15SetPosImmediateEss(gMapStateManager->cursor, buf->ReadByte(), buf->ReadByte()); + gMapStateManager->cursor->SetPosImmediate(buf->ReadByte(), buf->ReadByte()); for (i = 0; i < 2; i++) { @@ -1453,7 +1449,7 @@ EC void func_ov000_021a46b8(void) /* NONMATCHING: https://decomp.me/scratch/DvhHi */ EC void func_ov000_021a46cc(struct Unit * unit, u32 arg_1) { - _ZN6Cursor15SetPosImmediateEss(gMapStateManager->cursor, unit->xPos, unit->yPos); + gMapStateManager->cursor->SetPosImmediate(unit->xPos, unit->yPos); gMapStateManager->camera->func_ov000_021a4e84(unit->xPos, unit->yPos, arg_1); return; } @@ -1632,7 +1628,7 @@ void ProcMapDraw::Init(void) void ProcMapLow::Init(void) { - _ZN6Cursor6UpdateEv(gMapStateManager->cursor); + gMapStateManager->cursor->Update(); func_ov000_021b9bc4(gMapStateManager->unk_14); gMapStateManager->camera->func_ov000_021a5128(); diff --git a/src/ov000/playerphase.cpp b/src/ov000/playerphase.cpp index fde6dd1..024efde 100644 --- a/src/ov000/playerphase.cpp +++ b/src/ov000/playerphase.cpp @@ -116,7 +116,7 @@ static inline BOOL UNK_18_CHECK() EC void func_ov000_021aa210(void) { - gMapStateManager->unk_10->unk_0a = 1; + gMapStateManager->cursor->isVisible = TRUE; Proc_Goto(data_ov000_021e332c.unk_00[4], 4, 0); data_ov000_021e332c.unk_14->unk_02 = 0; @@ -278,15 +278,15 @@ EC BOOL func_02002038(void *, void *); EC BOOL func_ov000_021abf30(void) { - u8 x = gMapStateManager->unk_10->unk_08; - u8 y = gMapStateManager->unk_10->unk_09; + u8 x = gMapStateManager->cursor->xTile; + u8 y = gMapStateManager->cursor->yTile; if (gMapStateManager->unk_08->unk_0854[x | y << 5] >= 0) { gActionSt->unk_35 = x; gActionSt->unk_36 = y; - gMapStateManager->unk_10->unk_0a = 0; + gMapStateManager->cursor->isVisible = FALSE; func_ov000_021bc9e4(gMapStateManager->unk_14->unk_04); @@ -519,7 +519,7 @@ EC void func_ov000_021ac218(void) func_ov000_021a378c(); gMapStateManager->camera->func_ov000_021a4cec(x, y, 0, 0x20, 0); - _ZN6Cursor15SetPosImmediateEss(gMapStateManager->unk_10, (s16)x, (s16)y); + gMapStateManager->cursor->SetPosImmediate((s16)x, (s16)y); if (bVar5) { @@ -616,7 +616,7 @@ EC BOOL func_ov000_021ac80c(void) if (data_ov000_021e332c.unk_14->unk_08 != 0) { - if (gMapStateManager->unk_10->unk_0b == 2) + if (gMapStateManager->cursor->unk_0b == 2) { return TRUE; } @@ -647,7 +647,7 @@ EC void func_ov000_021ac8b4(void) return; } - unitId = gMapStateManager->unk_028[gMapStateManager->unk_10->unk_08 | gMapStateManager->unk_10->unk_09 << 5]; + unitId = gMapStateManager->unk_028[gMapStateManager->cursor->xTile | gMapStateManager->cursor->yTile << 5]; if (unitId != 0) { @@ -670,7 +670,7 @@ EC void func_ov000_021ac8b4(void) } } - gMapStateManager->unk_10->unk_0a = 1; + gMapStateManager->cursor->isVisible = TRUE; func_ov000_021a5774(gMapStateManager->unk_0c, 0xf); if ((data_02196f0c->state & 0x40) != 0) @@ -693,7 +693,7 @@ EC void func_ov000_021ac8b4(void) EC void func_ov000_021aca18(void) { - if (!(gMapStateManager->unk_10->unk_0b != 2) ? TRUE : FALSE) + if (!(gMapStateManager->cursor->unk_0b != 2) ? TRUE : FALSE) { return; } @@ -739,7 +739,7 @@ EC void func_ov000_021acb34(void) return; } - if (!(gMapStateManager->unk_10->unk_0b != 2) ? TRUE : FALSE) + if (!(gMapStateManager->cursor->unk_0b != 2) ? TRUE : FALSE) { return; } @@ -761,7 +761,7 @@ EC void func_ov000_021acb88(void) return; } - if (!(gMapStateManager->unk_10->unk_0b != 2) ? TRUE : FALSE) + if (!(gMapStateManager->cursor->unk_0b != 2) ? TRUE : FALSE) { return; } @@ -778,7 +778,7 @@ EC void func_ov000_021acbc8(void) EC void func_ov000_021acbd4(void) { - if (!(gMapStateManager->unk_10->unk_0b != 2) ? TRUE : FALSE) + if (!(gMapStateManager->cursor->unk_0b != 2) ? TRUE : FALSE) { return; } @@ -850,7 +850,7 @@ EC void func_ov000_021acd8c(void) func_ov000_021b79f8(); - _ZN6Cursor15SetPosImmediateEss(gMapStateManager->unk_10, pUnit->xPos, pUnit->yPos); + gMapStateManager->cursor->SetPosImmediate(pUnit->xPos, pUnit->yPos); gMapStateManager->camera->func_ov000_021a4cec(pUnit->xPos, pUnit->yPos, 0, 0x20, 0); data_ov000_021e332c.unk_14->unk_09 = 1; @@ -859,7 +859,7 @@ EC void func_ov000_021acd8c(void) func_01ff8d88(gMapStateManager->unk_08, pUnit, -1, 6, 1, 1); func_ov000_021a3ee4(pUnit, 1); - gMapStateManager->unk_10->unk_0a = 1; + gMapStateManager->cursor->isVisible = TRUE; func_ov000_021bc994(gMapStateManager->unk_14->unk_04, 0, 0, 0); @@ -1248,7 +1248,7 @@ EC void func_ov000_021adb48(void) { if (func_ov000_021adabc(0, 0) == 0) { - gMapStateManager->unk_10->unk_0a = 1; + gMapStateManager->cursor->isVisible = TRUE; Proc_Goto(data_ov000_021e332c.unk_00[4], 4, 1); data_ov000_021e332c.unk_14->unk_02 = 0; data_ov000_021e332c.unk_14->unk_03 = 0; @@ -1268,7 +1268,7 @@ EC void func_ov000_021adb48(void) EC void func_ov000_021adbf0(void) { - gMapStateManager->unk_10->unk_0a = 1; + gMapStateManager->cursor->isVisible = TRUE; if (data_02196f0c->state & 0x40) { @@ -1311,7 +1311,7 @@ EC void func_ov000_021add1c(void) int unitId; struct Unit * pUnit; - unitId = gMapStateManager->unk_028[gMapStateManager->unk_10->unk_08 | gMapStateManager->unk_10->unk_09 << 5]; + unitId = gMapStateManager->unk_028[gMapStateManager->cursor->xTile | gMapStateManager->cursor->yTile << 5]; if (unitId != 0) { @@ -1327,7 +1327,7 @@ EC void func_ov000_021add1c(void) data_021974fc->unk_00 = pUnit; } - func_0204b194(gMapStateManager->unk_10->unk_08, gMapStateManager->unk_10->unk_09); + func_0204b194(gMapStateManager->cursor->xTile, gMapStateManager->cursor->yTile); func_0204ae9c(0, (pUnit != NULL) & 0xFF); func_0204eb24(); return; @@ -1381,7 +1381,7 @@ EC void func_ov000_021ade88(ProcPtr proc) EC void func_ov000_021adeec(void) { - func_0204b194(gMapStateManager->unk_10->unk_08, gMapStateManager->unk_10->unk_09); + func_0204b194(gMapStateManager->cursor->xTile, gMapStateManager->cursor->yTile); func_0204ae9c(0, 0); func_0204eb24(); return; @@ -1450,7 +1450,7 @@ EC void func_ov000_021ae0a8(ProcPtr proc) phase = data_ov000_021e3324->phase; - gMapStateManager->unk_10->SetUnk00And02(phase, gMapStateManager->unk_10->unk_08, gMapStateManager->unk_10->unk_09); + gMapStateManager->cursor->SetUnk00And02(phase, gMapStateManager->cursor->xTile, gMapStateManager->cursor->yTile); Proc_End(proc); @@ -1498,7 +1498,7 @@ EC void func_ov000_021ae1d0(void) EC void func_ov000_021ae1fc(void) { func_ov000_021b9960(gMapStateManager->unk_14); - _ZN6Cursor9_021a6bd0Ev(gMapStateManager->unk_10); + gMapStateManager->cursor->_021a6bd0(); return; } @@ -1507,7 +1507,7 @@ EC void func_ov000_021ae228(void) func_ov000_021b9960(gMapStateManager->unk_14); func_ov000_021aa1d0(); func_ov000_021bc9e4(gMapStateManager->unk_14->unk_04); - _ZN6Cursor9_021a6bd0Ev(gMapStateManager->unk_10); + gMapStateManager->cursor->_021a6bd0(); return; } diff --git a/src/ov005/prep_proc_02212d60.cpp b/src/ov005/prep_proc_02212d60.cpp index c9ee49a..28afc8c 100644 --- a/src/ov005/prep_proc_02212d60.cpp +++ b/src/ov005/prep_proc_02212d60.cpp @@ -141,7 +141,7 @@ EC void func_ov005_02204dd0(s32 param_1) if (((data_02196f0c->state & 0x200) == 0) && (unit != NULL)) { - _ZN6Cursor15SetPosImmediateEss(gMapStateManager->cursor, unit->xPos, unit->yPos); + gMapStateManager->cursor->SetPosImmediate(unit->xPos, unit->yPos); if (param_1 == 0) { @@ -156,7 +156,7 @@ EC void func_ov005_02204dd0(s32 param_1) } else { - _ZN6Cursor14CenterOnCameraEv(gMapStateManager->cursor); + gMapStateManager->cursor->CenterOnCamera(); } gMapStateManager->cursor->SetUnk00And02(0, -1, -1);