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:
parent
843f495bcb
commit
fd98e6b36e
1 changed files with 28 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue