diff --git a/Source/Client/Replay.cpp b/Source/Client/Replay.cpp index dfb008d2..195efcef 100644 --- a/Source/Client/Replay.cpp +++ b/Source/Client/Replay.cpp @@ -831,3 +831,65 @@ ReplayFileList& ReplayFileList::Instance() { static ReplayFileList g_replayFileList; return g_replayFileList; } + +// OFFSET: 0x00B87110 +// FUNCTION: fn_19339 +bool Replay::SetHeaderInfo( + std::uint32_t key0, std::uint32_t key1, const char* characterName, const char* mapName, int accountId, int cellX, int cellY, int unknown0078, int service, + int serviceType, int unknown0014 +) { + if (!characterName || !mapName) { + return false; + } + std::memcpy(this->header.mapName, mapName, sizeof(this->header.mapName)); + std::memcpy(this->header.characterName, characterName, sizeof(this->header.characterName)); + this->header.service = service; + this->header.serviceType = serviceType; + this->header.unknown_0014 = unknown0014; + this->header.key0 = key0; + this->header.key1 = key1; + this->header.accountId = accountId; + this->header.cellX = cellX; + this->header.cellY = cellY; + this->header.unknown_0078 = unknown0078; + this->header.signature = 0x52414705; + this->header.closingSignature = 0x52414705; + return true; +} + +// OFFSET: 0x00B871C0 +// FUNCTION: fn_19340 +void Replay::IncreaseSpeed() { + if (this->speed == 0.25f) { + this->speed = 0.5f; + } else if (this->speed == 0.5f) { + this->speed = 1.0f; + } else if (this->speed == 1.0f) { + this->speed = 2.0f; + } else if (this->speed == 2.0f || this->speed == 4.0f) { + this->speed = 4.0f; + } +} + +// OFFSET: 0x00B87240 +// FUNCTION: fn_19341 +void Replay::DecreaseSpeed() { + if (this->speed == 0.25f || this->speed == 0.5f) { + this->speed = 0.25f; + } else if (this->speed == 1.0f) { + this->speed = 0.5f; + } else if (this->speed == 2.0f) { + this->speed = 1.0f; + } else if (this->speed == 4.0f) { + this->speed = 2.0f; + } +} + +// OFFSET: 0x00B872C0 +// FUNCTION: fn_19342 +void Replay::RestartClock() { + if (this->state != 3 && this->state != 8) { + this->baseFrame = this->frame; + this->started = this->previousTick = timeGetTime(); + } +} diff --git a/Source/Client/Replay.h b/Source/Client/Replay.h index fb5997c8..ed807798 100644 --- a/Source/Client/Replay.h +++ b/Source/Client/Replay.h @@ -140,6 +140,13 @@ public: bool ReadRecord(unsigned char* buffer, std::uint16_t& id, bool force); bool AllowsEvent(int event) const; void Rewind(); + bool SetHeaderInfo( + std::uint32_t key0, std::uint32_t key1, const char* characterName, const char* mapName, int accountId, int cellX, int cellY, int unknown0078, int service, + int serviceType, int unknown0014 + ); + void IncreaseSpeed(); + void DecreaseSpeed(); + void RestartClock(); }; struct ReplayFileEntry { diff --git a/Source/Contents/NavigationManager.h b/Source/Contents/NavigationManager.h index 0fd03914..6bc9f2e3 100644 --- a/Source/Contents/NavigationManager.h +++ b/Source/Contents/NavigationManager.h @@ -34,6 +34,8 @@ struct NaviLink { struct NaviDataEntry { void Reset(); + int GetPrevious() const; + int GetCost() const; /* 0000 */ int previous; /* 0004 */ CNavi_Link* link; @@ -257,6 +259,8 @@ public: CNavi_Link* FindLink(unsigned int key, bool byId); int FindRoute(std::vector* route, bool direct, bool allowGates, bool includeObjects, bool allowWarps, int side); void ResetLinkDepths(); + bool CollectLinksTo(CNaviInfo* target, std::vector* out); + int ObjectCount() const; /* 0000 */ std::vector destinations; /* 000C */ std::vector objects; diff --git a/Source/Contents/NavigationRoute.cpp b/Source/Contents/NavigationRoute.cpp index c91ff3ce..f1c90c8a 100644 --- a/Source/Contents/NavigationRoute.cpp +++ b/Source/Contents/NavigationRoute.cpp @@ -691,3 +691,40 @@ bool CNavigationManager::SavedTargetText(char* out, int size) { } return true; } + +// OFFSET: 0x00B887B0 +// FUNCTION: fn_19374 +int NaviDataEntry::GetPrevious() const { + return this->previous; +} + +// OFFSET: 0x00B887C0 +// FUNCTION: fn_19375 +int NaviDataEntry::GetCost() const { + return this->cost; +} + +// OFFSET: 0x00B890E0 +// FUNCTION: fn_19384 +bool CNaviData::CollectLinksTo(CNaviInfo* target, std::vector* out) { + out->clear(); + for (auto info = this->destinations.begin(); info != this->destinations.end(); ++info) { + for (auto link = (*info)->LinksBegin(); link != (*info)->LinksEnd(); ++link) { + if ((*link)->GetLinkedInfo() == target) { + out->push_back(*link); + } + } + } + for (auto link = this->objects.begin(); link != this->objects.end(); ++link) { + if ((*link)->GetLinkedInfo() == target) { + out->push_back(*link); + } + } + return out->size() != 0; +} + +// OFFSET: 0x00B89980 +// FUNCTION: fn_19389 +int CNaviData::ObjectCount() const { + return static_cast(this->objects.size()); +}