Decompile fn_21250 (CGameMode::StepTowardWalkableCell)

Batch #5096 by Yommy: 0 byte-identical, 1 confirmed by peer review.

- fn_21250 CGameMode::StepTowardWalkableCell: logic confirmed by peer review

Peer-reviewed-by: youko, SapitoSucio
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-30 07:46:08 +00:00
commit fd98e6b36e

View file

@ -26,6 +26,34 @@ void MiniMapNoOp() {
}
// OFFSET: 0x00CCFFA0
// FUNCTION: fn_21250
void CGameMode::StepTowardWalkableCell(const int& targetX, const int& targetY, int& x, int& y) {
const int startX = x;
const int startY = y;
if (targetX > startX) {
x = startX + 1;
} else if (targetX < startX) {
x = startX - 1;
}
if (targetY > y) {
++y;
} else if (targetY < y) {
--y;
}
if (this->scene->terrain->Grid().Walkable(x, y)) {
return;
}
const int offsets[8][2] = {{1, 0}, {1, 1}, {1, -1}, {-1, 0}, {-1, 1}, {-1, -1}, {0, 1}, {0, -1}};
for (int i = 0; i < 8; ++i) {
x = startX + offsets[i][0];
y = startY + offsets[i][1];
if (this->scene->terrain->Grid().Walkable(x, y)) {
return;
}
}
}
// OFFSET: 0x00CD0150