rodecomp/Source/Contents/ActorMovementRoute.cpp
ragnarok-clanker c3fe24e020 Decompile 2 functions in Source/Contents/ActorMovementRoute.cpp, Source/Contents/Actors/GameActor.h, ...
Batch #1601 by eAthena: 0 byte-identical, 2 confirmed by peer review.

- fn_19317 Replay::DelayScale: logic confirmed by peer review
- fn_21028 CGameActor::FindRoute: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
Adds to the build: Source/Contents/ActorMovementRoute.cpp
2026-10-28 19:42:58 +00:00

64 lines
1.6 KiB
C++

#include "Client/Replay.h"
#include "Client/Session.h"
#include "Contents/Actors/GameActor.h"
#include "Contents/TerrainPathSearch.h"
// GLOBAL: gl_24733
CPathFinder g_pathFinder;
// OFFSET: 0x00B84570
// FUNCTION: fn_19317
float Replay::DelayScale() const {
if (this->speed == 0.25f) {
return 4.0f;
}
if (this->speed == 0.5f) {
return 2.0f;
}
if (this->speed == 1.0f) {
return 1.0f;
}
if (this->speed == 2.0f) {
return 0.5f;
}
if (this->speed == 4.0f) {
return 0.25f;
}
if (this->speed == 8.0f) {
return 0.125f;
}
if (this->speed == 16.0f) {
return 0.0625f;
}
return 1.0f;
}
// OFFSET: 0x00CAB610
// FUNCTION: fn_21028
bool CGameActor::FindRoute(int startX, int startY, int fractionX, int fractionY, int destX, int destY, int speed) {
float scaledSpeed = 0.0f;
int stepSpeed;
if (g_replayAnimationScaling != 0) {
scaledSpeed = Replay::Instance().DelayScale() * static_cast<float>(speed);
stepSpeed = static_cast<int>(scaledSpeed);
} else {
stepSpeed = speed;
}
const bool found =
g_pathFinder.FindPath(this->routeStartTick, startX, startY, fractionX, fractionY, destX, destY, stepSpeed, this->route, this->unknown_0314);
if (!found) {
return found;
}
std::uint32_t endTick;
this->route.EndTick(&endTick);
const std::uint32_t now = g_session.GetServerTime();
if (endTick > now) {
return found;
}
const int baseSpeed = g_replayAnimationScaling != 0 ? static_cast<int>(scaledSpeed) : speed;
this->routeStartTick = now;
return g_pathFinder.FindPath(now, startX, startY, fractionX, fractionY, destX, destY, baseSpeed * 10 / 13, this->route, this->unknown_0314);
}