From 3c5e940a6de33cb1830c6c8bb2c8aeca945306c9 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 17:20:17 +0000 Subject: [PATCH] Decompile 31 functions in Source/Contents/NavigationManager.h, Source/Contents/NavigationRequest.cpp, ... Batch #1503 by ragnarok-clanker: 12 byte-identical, 19 confirmed by peer review. - fn_19461 CNavi_Object::GetFlag: logic confirmed by peer review - fn_19474 CNavi_Object::GetTitle: byte-identical - fn_19476 CNaviInfo::GetTitle: byte-identical - fn_19477 CNavi_Object::GetName: byte-identical - fn_19484 CNavi_Object::GetCell: logic confirmed by peer review - fn_19485 CNaviInfo::GetName: byte-identical - fn_19488 CNavi_Object::GetIndex: byte-identical - fn_19493 CNavi_Object::GetType: byte-identical - fn_19495 CNavi_Object::GetId: byte-identical - fn_19498 CNavi_Object::GetInfo: byte-identical - fn_19376 CNavigationManager::FindObject: logic confirmed by peer review - fn_19378 CNaviData::GetCell: logic confirmed by peer review - fn_19380 CNaviData::GetInfo: byte-identical - fn_19430 CNavi_Object::~CNavi_Object: logic confirmed by peer review - fn_19434 CNaviInfo::HasName: logic confirmed by peer review - fn_19604 CNavigationManager::SelectedNodeText: logic confirmed by peer review - fn_19605 CNavigationManager::SubDestinationText: logic confirmed by peer review - fn_19606 CNavigationManager::DestinationText: logic confirmed by peer review - fn_19607 CNavigationManager::DestinationTitle: logic confirmed by peer review - fn_19613 CNavigationManager::LoadSettings: logic confirmed by peer review - fn_19618 CNavigationManager::FitToSquare: logic confirmed by peer review - fn_45449 CNaviData::Clear: logic confirmed by peer review - fn_19588 CNavigationManager::GetCurrentTarget: logic confirmed by peer review - fn_19589 CNavigationManager::GetCurrentTargetName: logic confirmed by peer review - fn_19590 CNavigationManager::GetSavedTarget: logic confirmed by peer review - fn_19591 CNavigationManager::GetDestinationInfo: byte-identical - fn_19592 CNavigationManager::GetDestinationCell: logic confirmed by peer review - fn_19594 CNavigationManager::ClearData: logic confirmed by peer review - fn_19596 CNavigationManager::IsCurrentTarget: logic confirmed by peer review - fn_19597 CNavigationManager::GetCurrentTargetType: byte-identical - fn_19635 CNavigationManager::SaveCurrentTarget: byte-identical Reviewed-by: ragnarok-clanker Adds to the build: Source/Contents/NavigationRequest.cpp --- Source/Contents/NavigationManager.h | 229 ++++++++++++++++++++++++-- Source/Contents/NavigationRequest.cpp | 66 ++++++++ Source/Contents/NavigationRoute.cpp | 181 +++++++++++++++++++- Source/Contents/NavigationSource.cpp | 79 ++++++++- Source/Contents/TerrainPathSearch.h | 9 +- data/compile.json | 1 + 6 files changed, 540 insertions(+), 25 deletions(-) create mode 100644 Source/Contents/NavigationRequest.cpp diff --git a/Source/Contents/NavigationManager.h b/Source/Contents/NavigationManager.h index 3966240..8c0d002 100644 --- a/Source/Contents/NavigationManager.h +++ b/Source/Contents/NavigationManager.h @@ -1,48 +1,255 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_NAVIGATIONMANAGER_H #define RAGNAROK_SOURCE_CONTENTS_NAVIGATIONMANAGER_H +#include "Contents/MovementRouteInterpolation.h" +#include "Contents/TerrainPathSearch.h" + #include +#include #include #include -class NavigationObject { +class CActRes; +class CNaviInfo; +class CNavi_Link; +class CNavi_Object; +class CSprRes; +class CTexture; +class GroundGeometry; + +struct NaviCell { + /* 0000 */ int x; + /* 0004 */ int y; +}; + +struct NaviLink { + /* 0000 */ CNavi_Object* object; + /* 0004 */ int value; +}; + +struct NaviDataEntry { + /* 0000 */ int unknown_0000; + /* 0004 */ int unknown_0004; + /* 0008 */ int unknown_0008; +}; + +struct NaviRouteLine { + /* 0000 */ int kind; + /* 0004 */ int x; + /* 0008 */ int y; + /* 000C */ std::string text; + /* 0024 */ int color; + /* 0028 */ int shadowColor; +}; + +// VTABLE: vt_01777 +class CNavi_Object { +public: + /* 0004 */ int id; + /* 0008 */ int type; + union { + /* 000C */ int index; + struct { + /* 000C */ std::uint16_t shortIndex; + /* 000E */ std::uint16_t flag; + }; + }; + /* 0010 */ std::string name; + /* 0028 */ std::string title; + /* 0040 */ CNaviInfo* info; + /* 0044 */ int cellX; + /* 0048 */ int cellY; + /* 004C */ std::vector links; + /* 0058 */ int unknown_0058; + /* 005C */ int unknown_005C; + /* 0060 */ int unknown_0060; + /* 0064 */ int unknown_0064; + /* 0068 */ int unknown_0068; + /* 006C */ int unknown_006C; + /* 0070 */ int unknown_0070; + /* 0074 */ int unknown_0074; + /* 0078 */ int unknown_0078; + + virtual ~CNavi_Object(); + virtual int GetId() const; + virtual int GetType() const; + virtual int GetIndex() const; + virtual std::uint16_t GetFlag() const; + virtual const char* GetName() const; + virtual const char* GetTitle() const; + virtual NaviCell* GetCell(NaviCell* out) const; + virtual CNaviInfo* GetInfo() const; +}; + +class CNaviInfo { public: bool HasName(const char* name) const; + const char* GetName() const; + const char* GetTitle() const; - /* 0000 */ unsigned char unknown_0000[8]; + /* 0000 */ int index; + /* 0004 */ int type; /* 0008 */ std::string name; + /* 0020 */ std::string title; + /* 0038 */ int cellX; + /* 003C */ int cellY; + /* 0040 */ bool unknown_0040; + /* 0044 */ std::vector npcs; + /* 0050 */ std::vector mobs; + /* 005C */ std::vector links; }; struct NavigationTarget { /* 0000 */ int type; - /* 0004 */ NavigationObject* object; + /* 0004 */ void* object; /* 0008 */ int x; /* 000C */ int y; /* 0010 */ std::string name; }; -class NavigationManager { +class CNaviData { +public: + CNaviInfo* GetInfo(); + NaviCell* GetCell(NaviCell* out); + void Clear(); + + /* 0000 */ std::vector destinations; + /* 000C */ std::vector objects; + /* 0018 */ CNaviInfo* info; + /* 001C */ int cellX; + /* 0020 */ int cellY; + /* 0024 */ int range; + /* 0028 */ std::vector unknown_0028; + /* 0034 */ std::vector unknown_0034; + /* 0040 */ std::vector unknown_0040; +}; + +class CNavigationManager { public: NavigationTarget GetCurrentTarget() const; + std::string GetCurrentTargetName() const; NavigationTarget GetSavedTarget() const; + CNaviInfo* GetDestinationInfo(); + NaviCell* GetDestinationCell(NaviCell* out); + void ClearData(); + bool IsCurrentTarget(const char* name) const; int GetCurrentTargetType() const; int SaveCurrentTarget(); - NavigationObject* FindObject(const char* name) const; + CNaviInfo* FindObject(const char* name) const; + std::string SelectedNodeText(); + std::string SubDestinationText(); + std::string DestinationText(); + std::string DestinationTitle(); float FitToSquare(int* offsetX, int* offsetY, int width, int height, float size) const; void LoadSettings(); - /* 0000 */ std::vector objects; - /* 000C */ unsigned char unknown_000C[0x10F0]; + /* 0000 */ CNaviData data; + /* 004C */ CPathFinder pathFinder; + /* 10F0 */ std::vector states; /* 10FC */ NavigationTarget currentTarget; /* 1124 */ NavigationTarget savedTarget; - /* 114C */ unsigned char unknown_114C[0x1F8]; + /* 114C */ int routeResult; + /* 1150 */ std::vector nodes; + /* 115C */ bool unknown_115C; + /* 1160 */ int selectedNode; + /* 1164 */ MovementRouteInterpolation movementRoute; + /* 117C */ bool unknown_117C; + /* 1180 */ std::string labels[8]; + /* 1240 */ GroundGeometry* ground; + /* 1244 */ CNaviInfo* unknown_1244; + /* 1248 */ bool unknown_1248; + /* 124C */ int unknown_124C; + /* 1250 */ int unknown_1250; + /* 1254 */ bool unknown_1254; + /* 1258 */ int unknown_1258; + /* 125C */ int unknown_125C; + /* 1260 */ int unknown_1260; + /* 1264 */ std::string unknown_1264; + /* 127C */ bool unknown_127C; + /* 127D */ bool unknown_127D; + /* 127E */ bool unknown_127E; + /* 1280 */ int unknown_1280; + /* 1284 */ int unknown_1284; + /* 1288 */ CTexture* unknown_1288; + /* 128C */ int unknown_128C; + /* 1290 */ int unknown_1290; + /* 1294 */ std::vector cells; + /* 12A0 */ CActRes* unknown_12A0; + /* 12A4 */ CSprRes* unknown_12A4; + /* 12A8 */ std::vector routeLines; + /* 12B4 */ bool unknown_12B4; + /* 12B8 */ std::vector> nodePaths; + /* 12C4 */ int unknown_12C4; + /* 12C8 */ int unknown_12C8; + /* 12CC */ std::string destinationTitle; + /* 12E4 */ std::string destinationText; + /* 12FC */ std::string routeText; + /* 1314 */ std::string selectedNodeText; + /* 132C */ std::string subDestinationText; /* 1344 */ int viewIcon; }; #if defined(_WIN32) && !defined(_WIN64) -static_assert(offsetof(NavigationObject, name) == 0x8); -static_assert(offsetof(NavigationManager, savedTarget) == 0x1124); -static_assert(offsetof(NavigationManager, viewIcon) == 0x1344); +static_assert(sizeof(NaviCell) == 0x08); +static_assert(sizeof(NaviDataEntry) == 0x0C); +static_assert(sizeof(NaviRouteLine) == 0x2C); +static_assert(offsetof(NaviRouteLine, text) == 0x0C); +static_assert(sizeof(NavigationTarget) == 0x28); +static_assert(offsetof(NavigationTarget, object) == 0x04); +static_assert(offsetof(NavigationTarget, name) == 0x10); +static_assert(sizeof(CNavi_Object) == 0x7C); +static_assert(offsetof(CNavi_Object, id) == 0x04); +static_assert(offsetof(CNavi_Object, name) == 0x10); +static_assert(offsetof(CNavi_Object, title) == 0x28); +static_assert(offsetof(CNavi_Object, info) == 0x40); +static_assert(offsetof(CNavi_Object, cellX) == 0x44); +static_assert(offsetof(CNavi_Object, links) == 0x4C); +static_assert(sizeof(CNaviInfo) == 0x68); +static_assert(offsetof(CNaviInfo, name) == 0x08); +static_assert(offsetof(CNaviInfo, title) == 0x20); +static_assert(offsetof(CNaviInfo, cellX) == 0x38); +static_assert(offsetof(CNaviInfo, npcs) == 0x44); +static_assert(offsetof(CNaviInfo, links) == 0x5C); +static_assert(sizeof(CNaviData) == 0x4C); +static_assert(offsetof(CNaviData, info) == 0x18); +static_assert(offsetof(CNaviData, cellX) == 0x1C); +static_assert(offsetof(CNaviData, range) == 0x24); +static_assert(offsetof(CNaviData, unknown_0028) == 0x28); +static_assert(offsetof(CNaviData, unknown_0034) == 0x34); +static_assert(offsetof(CNaviData, unknown_0040) == 0x40); +static_assert(offsetof(CNavigationManager, pathFinder) == 0x004C); +static_assert(offsetof(CNavigationManager, states) == 0x10F0); +static_assert(offsetof(CNavigationManager, currentTarget) == 0x10FC); +static_assert(offsetof(CNavigationManager, savedTarget) == 0x1124); +static_assert(offsetof(CNavigationManager, routeResult) == 0x114C); +static_assert(offsetof(CNavigationManager, nodes) == 0x1150); +static_assert(offsetof(CNavigationManager, unknown_115C) == 0x115C); +static_assert(offsetof(CNavigationManager, selectedNode) == 0x1160); +static_assert(offsetof(CNavigationManager, movementRoute) == 0x1164); +static_assert(offsetof(CNavigationManager, unknown_117C) == 0x117C); +static_assert(offsetof(CNavigationManager, labels) == 0x1180); +static_assert(offsetof(CNavigationManager, ground) == 0x1240); +static_assert(offsetof(CNavigationManager, unknown_1244) == 0x1244); +static_assert(offsetof(CNavigationManager, unknown_1248) == 0x1248); +static_assert(offsetof(CNavigationManager, unknown_1258) == 0x1258); +static_assert(offsetof(CNavigationManager, unknown_1260) == 0x1260); +static_assert(offsetof(CNavigationManager, unknown_1264) == 0x1264); +static_assert(offsetof(CNavigationManager, unknown_127C) == 0x127C); +static_assert(offsetof(CNavigationManager, unknown_1280) == 0x1280); +static_assert(offsetof(CNavigationManager, unknown_1288) == 0x1288); +static_assert(offsetof(CNavigationManager, cells) == 0x1294); +static_assert(offsetof(CNavigationManager, unknown_12A0) == 0x12A0); +static_assert(offsetof(CNavigationManager, routeLines) == 0x12A8); +static_assert(offsetof(CNavigationManager, unknown_12B4) == 0x12B4); +static_assert(offsetof(CNavigationManager, nodePaths) == 0x12B8); +static_assert(offsetof(CNavigationManager, unknown_12C4) == 0x12C4); +static_assert(offsetof(CNavigationManager, destinationTitle) == 0x12CC); +static_assert(offsetof(CNavigationManager, destinationText) == 0x12E4); +static_assert(offsetof(CNavigationManager, routeText) == 0x12FC); +static_assert(offsetof(CNavigationManager, selectedNodeText) == 0x1314); +static_assert(offsetof(CNavigationManager, subDestinationText) == 0x132C); +static_assert(offsetof(CNavigationManager, viewIcon) == 0x1344); +static_assert(sizeof(CNavigationManager) == 0x1348); #endif #endif diff --git a/Source/Contents/NavigationRequest.cpp b/Source/Contents/NavigationRequest.cpp new file mode 100644 index 0000000..3d74aee --- /dev/null +++ b/Source/Contents/NavigationRequest.cpp @@ -0,0 +1,66 @@ +#include "Contents/NavigationManager.h" + +// OFFSET: 0x00B8DF10 +// FUNCTION: fn_19461 +std::uint16_t CNavi_Object::GetFlag() const { + return this->flag; +} + +// OFFSET: 0x00B8E600 +// FUNCTION: fn_19474 +const char* CNavi_Object::GetTitle() const { + return this->title.c_str(); +} + +// OFFSET: 0x00B8E620 +// FUNCTION: fn_19476 +const char* CNaviInfo::GetTitle() const { + return this->title.c_str(); +} + +// OFFSET: 0x00B8E630 +// FUNCTION: fn_19477 +const char* CNavi_Object::GetName() const { + return this->name.c_str(); +} + +// OFFSET: 0x00B8E7F0 +// FUNCTION: fn_19484 +NaviCell* CNavi_Object::GetCell(NaviCell* out) const { + out->x = this->cellX; + out->y = this->cellY; + return out; +} + +// OFFSET: 0x00B8E810 +// FUNCTION: fn_19485 +const char* CNaviInfo::GetName() const { + return this->name.c_str(); +} + +// OFFSET: 0x00B8E840 +// FUNCTION: fn_19488 +int CNavi_Object::GetIndex() const { + if (this->type == 300 || this->type == 301) { + return this->shortIndex; + } + return this->index; +} + +// OFFSET: 0x00B8E8B0 +// FUNCTION: fn_19493 +int CNavi_Object::GetType() const { + return this->type; +} + +// OFFSET: 0x00B8E8D0 +// FUNCTION: fn_19495 +int CNavi_Object::GetId() const { + return this->id; +} + +// OFFSET: 0x00B8E910 +// FUNCTION: fn_19498 +CNaviInfo* CNavi_Object::GetInfo() const { + return this->info; +} diff --git a/Source/Contents/NavigationRoute.cpp b/Source/Contents/NavigationRoute.cpp index 3a01e30..01fb1f1 100644 --- a/Source/Contents/NavigationRoute.cpp +++ b/Source/Contents/NavigationRoute.cpp @@ -3,14 +3,15 @@ #include "Client/Registry.h" #include "Utility/RegistryKey.h" +#include #include // OFFSET: 0x00B88800 // FUNCTION: fn_19376 -NavigationObject* NavigationManager::FindObject(const char* name) const { - for (NavigationObject* object : this->objects) { - if (object->HasName(name)) { - return object; +CNaviInfo* CNavigationManager::FindObject(const char* name) const { + for (CNaviInfo* info : this->data.destinations) { + if (info->HasName(name)) { + return info; } } return nullptr; @@ -18,13 +19,133 @@ NavigationObject* NavigationManager::FindObject(const char* name) const { // OFFSET: 0x00B8D270 // FUNCTION: fn_19434 -bool NavigationObject::HasName(const char* name) const { +bool CNaviInfo::HasName(const char* name) const { return std::strcmp(this->name.c_str(), name) == 0; } +// OFFSET: 0x00B97FC0 +// FUNCTION: fn_19604 +std::string CNavigationManager::SelectedNodeText() { + char buffer[0x32]; + std::memset(buffer, 0, sizeof(buffer)); + + if (!this->nodes.empty() && this->selectedNode >= 0) { + if (this->nodes.size() <= static_cast(this->selectedNode)) { + this->selectedNodeText.assign(buffer, std::strlen(buffer)); + return this->selectedNodeText; + } + + CNavi_Object* node = this->nodes[this->selectedNode]; + NaviCell cellY; + NaviCell cellX; + const int y = node->GetCell(&cellY)->y; + const int x = node->GetCell(&cellX)->x; + std::sprintf(buffer, "%s %d %d...", node->GetInfo()->GetName(), x, y); + } else if (this->unknown_1258 == 2) { + CNaviInfo* info = this->data.GetInfo(); + if (info != nullptr) { + NaviCell cellY; + NaviCell cellX; + const int y = this->data.GetCell(&cellY)->y; + const int x = this->data.GetCell(&cellX)->x; + std::sprintf(buffer, "%s %d %d...", info->GetName(), x, y); + } + } + + this->selectedNodeText.assign(buffer, std::strlen(buffer)); + return this->selectedNodeText; +} + +// OFFSET: 0x00B981A0 +// FUNCTION: fn_19605 +std::string CNavigationManager::SubDestinationText() { + char buffer[0x32]; + std::memset(buffer, 0, sizeof(buffer)); + + CNaviInfo* info = this->data.GetInfo(); + if (info != nullptr) { + NaviCell cell; + if (this->data.GetCell(&cell)->x > 0) { + NaviCell cellY; + NaviCell cellX; + const int y = this->data.GetCell(&cellY)->y; + const int x = this->data.GetCell(&cellX)->x; + std::sprintf(buffer, ">.%s %d %d", info->GetName(), x, y); + } else { + std::sprintf(buffer, ">.%s", info->GetName()); + } + } + + this->subDestinationText.assign(buffer, std::strlen(buffer)); + return this->subDestinationText; +} + +// OFFSET: 0x00B982D0 +// FUNCTION: fn_19606 +std::string CNavigationManager::DestinationText() { + char buffer[0x32]; + std::memset(buffer, 0, sizeof(buffer)); + + if (!this->nodes.empty() && this->selectedNode >= 0) { + if (this->nodes.size() <= static_cast(this->selectedNode)) { + this->destinationText.assign(buffer, std::strlen(buffer)); + return this->destinationText; + } + + CNavi_Object* node = this->nodes[this->selectedNode]; + NaviCell cellY; + NaviCell cellX; + const int y = node->GetCell(&cellY)->y; + const int x = node->GetCell(&cellX)->x; + std::sprintf(buffer, "%s %d %d", node->GetInfo()->GetName(), x, y); + } else if (this->unknown_1258 == 2) { + CNaviInfo* info = this->data.GetInfo(); + if (info != nullptr) { + NaviCell cellY; + NaviCell cellX; + const int y = this->data.GetCell(&cellY)->y; + const int x = this->data.GetCell(&cellX)->x; + std::sprintf(buffer, "%s %d %d", info->GetName(), x, y); + } + } + + this->destinationText.assign(buffer, std::strlen(buffer)); + return this->destinationText; +} + +// OFFSET: 0x00B984C0 +// FUNCTION: fn_19607 +std::string CNavigationManager::DestinationTitle() { + char buffer[0x32]; + std::memset(buffer, 0, sizeof(buffer)); + + if (!this->nodes.empty() && this->selectedNode >= 0) { + if (this->nodes.size() <= static_cast(this->selectedNode)) { + this->destinationTitle.assign(buffer, std::strlen(buffer)); + return this->destinationTitle; + } + + this->destinationTitle.assign(this->nodes[this->selectedNode]->GetInfo()->GetTitle()); + return this->destinationTitle; + } + + if (this->unknown_1258 == 2) { + NaviCell cell; + this->data.GetCell(&cell); + CNaviInfo* info = this->data.GetInfo(); + if (info != nullptr) { + this->destinationTitle.assign(info->GetTitle()); + return this->destinationTitle; + } + } + + this->destinationTitle.assign(buffer, std::strlen(buffer)); + return this->destinationTitle; +} + // OFFSET: 0x00B996D0 // FUNCTION: fn_19613 -void NavigationManager::LoadSettings() { +void CNavigationManager::LoadSettings() { RegistryKey key; std::string subKey(g_subKey); subKey += "\Navigation"; @@ -38,7 +159,7 @@ void NavigationManager::LoadSettings() { // OFFSET: 0x00B9C020 // FUNCTION: fn_19618 -float NavigationManager::FitToSquare(int* offsetX, int* offsetY, int width, int height, float size) const { +float CNavigationManager::FitToSquare(int* offsetX, int* offsetY, int width, int height, float size) const { float scale; if (width > height) { scale = size / width; @@ -55,3 +176,49 @@ float NavigationManager::FitToSquare(int* offsetX, int* offsetY, int width, int } return scale; } + +// OFFSET: 0x00B888F0 +// FUNCTION: fn_19378 +NaviCell* CNaviData::GetCell(NaviCell* out) { + out->x = this->cellX; + out->y = this->cellY; + return out; +} + +// OFFSET: 0x00B88920 +// FUNCTION: fn_19380 +CNaviInfo* CNaviData::GetInfo() { + return this->info; +} + +// OFFSET: 0x00B88A00 +// FUNCTION: fn_45449 +void CNaviData::Clear() { + this->unknown_0034.clear(); + this->info = nullptr; + this->cellX = 0; + this->cellY = 0; + this->range = 50000; + this->unknown_0040.clear(); + + for (NaviDataEntry& entry : this->unknown_0028) { + entry.unknown_0000 = -1; + entry.unknown_0004 = 0; + entry.unknown_0008 = 0; + } + this->unknown_0028.clear(); +} + +// OFFSET: 0x00B8CD60 +// FUNCTION: fn_19430 +CNavi_Object::~CNavi_Object() { + this->id = -1; + this->type = 101; + this->index = -1; + this->name.clear(); + this->title.clear(); + this->cellX = 0; + this->cellY = 0; + this->info = nullptr; + this->links.clear(); +} diff --git a/Source/Contents/NavigationSource.cpp b/Source/Contents/NavigationSource.cpp index 2b42bc3..493e6fb 100644 --- a/Source/Contents/NavigationSource.cpp +++ b/Source/Contents/NavigationSource.cpp @@ -1,26 +1,97 @@ #include "Contents/NavigationManager.h" +#include "Resource/ResourceMgr.h" + +#include // OFFSET: 0x00B96980 // FUNCTION: fn_19588 -NavigationTarget NavigationManager::GetCurrentTarget() const { +NavigationTarget CNavigationManager::GetCurrentTarget() const { return this->currentTarget; } +// OFFSET: 0x00B96A10 +// FUNCTION: fn_19589 +std::string CNavigationManager::GetCurrentTargetName() const { + std::string name; + void* object = this->currentTarget.object; + if (object != nullptr) { + const int type = this->currentTarget.type; + if (type == 0 || type == 1 || ((type == 2 || type == 3 || type == 6) && (object = static_cast(object)->GetInfo()) != nullptr)) { + name.assign(static_cast(object)->GetName()); + } + } + + return name; +} + // OFFSET: 0x00B96AE0 // FUNCTION: fn_19590 -NavigationTarget NavigationManager::GetSavedTarget() const { +NavigationTarget CNavigationManager::GetSavedTarget() const { return this->savedTarget; } +// OFFSET: 0x00B96B70 +// FUNCTION: fn_19591 +CNaviInfo* CNavigationManager::GetDestinationInfo() { + return this->data.GetInfo(); +} + +// OFFSET: 0x00B96B80 +// FUNCTION: fn_19592 +NaviCell* CNavigationManager::GetDestinationCell(NaviCell* out) { + this->data.GetCell(out); + return out; +} + +// OFFSET: 0x00B96F10 +// FUNCTION: fn_19594 +void CNavigationManager::ClearData() { + this->unknown_12B4 = false; + this->data.Clear(); +} + +// OFFSET: 0x00B97090 +// FUNCTION: fn_19596 +bool CNavigationManager::IsCurrentTarget(const char* name) const { + if (name == nullptr) { + return false; + } + + void* object = this->currentTarget.object; + if (object == nullptr) { + return false; + } + + const int type = this->currentTarget.type; + if (type != 0 && type != 1) { + if (type != 2 && type != 3 && type != 6) { + return false; + } + + object = static_cast(object)->GetInfo(); + if (object == nullptr) { + return false; + } + } + + const CNaviInfo* info = static_cast(object); + if (std::strcmp(info->GetName(), name) == 0) { + return true; + } + + const std::string resolved = ResourceMgr::Instance().aliases.ResolveMapName(name); + return std::strcmp(info->GetName(), resolved.c_str()) == 0; +} + // OFFSET: 0x00B971D0 // FUNCTION: fn_19597 -int NavigationManager::GetCurrentTargetType() const { +int CNavigationManager::GetCurrentTargetType() const { return this->currentTarget.type; } // OFFSET: 0x00BA0AE0 // FUNCTION: fn_19635 -int NavigationManager::SaveCurrentTarget() { +int CNavigationManager::SaveCurrentTarget() { const int type = this->currentTarget.type; if (type == 6) { return -92; diff --git a/Source/Contents/TerrainPathSearch.h b/Source/Contents/TerrainPathSearch.h index 6e9f6af..d9a2b07 100644 --- a/Source/Contents/TerrainPathSearch.h +++ b/Source/Contents/TerrainPathSearch.h @@ -6,7 +6,6 @@ #include #include #include -#include #include #include @@ -18,11 +17,13 @@ struct MovementPathNodeCompare { } }; -class MovementOpenList : public std::priority_queue, MovementPathNodeCompare> { +class MovementOpenList { public: std::vector& Nodes() { - return this->c; + return this->nodes; } + + /* 0000 */ std::vector nodes; }; class CPathFinder { @@ -51,6 +52,8 @@ static_assert(offsetof(CPathFinder, attrCache) == 0x1078); static_assert(offsetof(CPathFinder, nodePool) == 0x1084); static_assert(offsetof(CPathFinder, nodeMap) == 0x1090); static_assert(offsetof(CPathFinder, openList) == 0x1098); +static_assert(sizeof(MovementOpenList) == 0x0C); +static_assert(sizeof(CPathFinder) == 0x10A4); #endif #endif diff --git a/data/compile.json b/data/compile.json index f54299a..133eaaa 100644 --- a/data/compile.json +++ b/data/compile.json @@ -368,6 +368,7 @@ "Source/Contents/MovementRouteInterpolation.cpp": 4, "Source/Contents/Movies/BinkMovie.cpp": 3, "Source/Contents/Movies/BinkMovies.cpp": 3, + "Source/Contents/NavigationRequest.cpp": 4, "Source/Contents/NavigationRoute.cpp": 4, "Source/Contents/NavigationSource.cpp": 4, "Source/Contents/Party/AdvenPartyInfo.cpp": 4,