Decompile fn_45471 (CSession::ScaleMapPositions)

Batch #11088 by kyoshi: 0 byte-identical, 1 confirmed by peer review.

- fn_45471 CSession::ScaleMapPositions: logic confirmed by peer review

Peer-reviewed-by: dori, cremane, StrawberrysherbetIX
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-11-04 20:06:48 +00:00
commit db887fcde1

View file

@ -167,27 +167,31 @@ bool CSession::LoadMapPosTable() {
return true;
}
// INLINED
static __forceinline void ScaleMapRect(MapPosRect* rect) {
if (!rect) {
return;
}
const float scaleX = static_cast<float>(g_renderer->viewport.width) / 1280.0f;
const float scaleY = static_cast<float>(g_renderer->viewport.height - 17) * 0.0009765625f;
rect->left = static_cast<int>(static_cast<float>(rect->left) * scaleX + 0.5);
rect->top = static_cast<int>(static_cast<float>(rect->top) * scaleY + 0.5) + 17;
rect->right = static_cast<int>(static_cast<float>(rect->right) * scaleX + 0.5);
rect->bottom = static_cast<int>(static_cast<float>(rect->bottom) * scaleY + 0.5) + 17;
}
// OFFSET: 0x00DE4FF0
// FUNCTION: fn_45471
bool CSession::ScaleMapPositions() {
const float scaleX = static_cast<float>(g_renderer->viewport.width) / 1280.0f;
const float scaleY = static_cast<float>(g_renderer->viewport.height - 17) * 0.0009765625f;
for (int index = 0; index < this->m_mapPosListCount; ++index) {
for (std::map<std::string, MapPosEntry>::iterator it = this->m_mapPosLists[index].begin(); it != this->m_mapPosLists[index].end(); ++it) {
MapPosRect& rect = it->second.rect;
rect.left = static_cast<int>(static_cast<float>(rect.left) * scaleX + 0.5);
rect.top = static_cast<int>(static_cast<float>(rect.top) * scaleY + 0.5) + 17;
rect.right = static_cast<int>(static_cast<float>(rect.right) * scaleX + 0.5);
rect.bottom = static_cast<int>(static_cast<float>(rect.bottom) * scaleY + 0.5) + 17;
ScaleMapRect(&it->second.rect);
}
}
for (std::map<int, MapPosEntry>::iterator it = this->m_mapPosBounds.begin(); it != this->m_mapPosBounds.end(); ++it) {
MapPosRect& rect = it->second.rect;
rect.left = static_cast<int>(static_cast<float>(rect.left) * scaleX + 0.5);
rect.top = static_cast<int>(static_cast<float>(rect.top) * scaleY + 0.5) + 17;
rect.right = static_cast<int>(static_cast<float>(rect.right) * scaleX + 0.5);
rect.bottom = static_cast<int>(static_cast<float>(rect.bottom) * scaleY + 0.5) + 17;
ScaleMapRect(&it->second.rect);
}
return true;