Decompile 2 functions in Source/Contents/NavigationRoute.cpp, Source/Contents/NavigationManager.h
Batch #1752 by ragnarok-clanker: 0 byte-identical, 2 confirmed by peer review. - fn_19603 CNavigationManager::MapCellToView: logic confirmed by peer review - fn_19608 CNavigationManager::RouteText: logic confirmed by peer review Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
cf696df195
commit
d4d8129b0d
2 changed files with 50 additions and 0 deletions
|
|
@ -227,6 +227,8 @@ public:
|
|||
float FitToSquare(int* offsetX, int* offsetY, int width, int height, float size) const;
|
||||
void LoadSettings();
|
||||
bool BuildRoute(int startX, int startY, int destX, int destY, bool collectCells);
|
||||
NaviCell* MapCellToView(NaviCell* out, const char* mapName, int cellX, int cellY, float size);
|
||||
std::string RouteText();
|
||||
void Reset(bool clearAll);
|
||||
void ClearRouteNodes();
|
||||
void ClearNodePaths();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "Contents/NavigationManager.h"
|
||||
|
||||
#include "Contents/MessageTable.h"
|
||||
#include "Utility/Text/FormatString.h"
|
||||
#include "Client/Registry.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Resource/ResourceMgr.h"
|
||||
|
|
@ -139,6 +141,52 @@ bool CNavigationManager::BuildRoute(int startX, int startY, int destX, int destY
|
|||
return found;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00B97E90
|
||||
// FUNCTION: fn_19603
|
||||
NaviCell* CNavigationManager::MapCellToView(NaviCell* out, const char* mapName, int cellX, int cellY, float size) {
|
||||
CNaviInfo* info = this->FindObject(mapName);
|
||||
if (info == nullptr) {
|
||||
const std::string resolved = ResourceMgr::Instance().aliases.ResolveMapName(mapName);
|
||||
info = this->FindObject(resolved.c_str());
|
||||
}
|
||||
|
||||
out->x = -1;
|
||||
out->y = -1;
|
||||
if (info != nullptr) {
|
||||
const int height = info->GetCellY();
|
||||
const int width = info->GetCellX();
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
const float scale = this->FitToSquare(&offsetX, &offsetY, width, height, size);
|
||||
out->x = static_cast<int>(cellX * scale + offsetX);
|
||||
out->y = static_cast<int>(static_cast<int>(size) - (cellY * scale + offsetY));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00B98630
|
||||
// FUNCTION: fn_19608
|
||||
std::string CNavigationManager::RouteText() {
|
||||
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;
|
||||
StringFormat(buffer, sizeof(buffer), static_cast<std::size_t>(-1), "[%s] -> %s %d %d", LookupMessage(3585), info->GetName(), x, y);
|
||||
} else {
|
||||
StringFormat(buffer, sizeof(buffer), static_cast<std::size_t>(-1), "[%s] %s", LookupMessage(3585), info->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
this->routeText.assign(buffer, std::strlen(buffer));
|
||||
return this->routeText;
|
||||
}
|
||||
// OFFSET: 0x00B8D270
|
||||
// FUNCTION: fn_19434
|
||||
bool CNaviInfo::HasName(const char* name) const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue