From a5bebe640407bbaf35a2033e997cabf45f9c9d4b Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 00:18:28 +0000 Subject: [PATCH] Decompile 3 functions in Source/Contents/World/WorldRayQuery.cpp, Source/Contents/World/WorldRayQuery.h Batch #11327 by cremane: 0 byte-identical, 3 confirmed by peer review. - fn_17661 WorldRayQuery::Intersects: logic confirmed by peer review - fn_17658 WorldRayQuery::Collect: logic confirmed by peer review - fn_17663 WorldRayQuery::CollectNode: logic confirmed by peer review Peer-reviewed-by: Yommy, dori, StrawberrysherbetIX Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/World/WorldRayQuery.cpp | 18 +++++++++--------- Source/Contents/World/WorldRayQuery.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Contents/World/WorldRayQuery.cpp b/Source/Contents/World/WorldRayQuery.cpp index ea63566f..68369a7d 100644 --- a/Source/Contents/World/WorldRayQuery.cpp +++ b/Source/Contents/World/WorldRayQuery.cpp @@ -16,7 +16,7 @@ WorldRayQuery::WorldRayQuery() { // OFFSET: 0x00AC7C50 // FUNCTION: fn_17661 -bool WorldRayQuery::Intersects(const float* bounds) const { +int WorldRayQuery::Intersects(const float* bounds) const { const float centers[3] = {(bounds[3] + bounds[0]) * 0.5f, (bounds[4] + bounds[1]) * 0.5f, (bounds[5] + bounds[2]) * 0.5f}; const float extents[3] = {bounds[3] - centers[0], bounds[4] - centers[1], bounds[5] - centers[2]}; const float offsets[3] = {centers[0] - this->origin[0], centers[1] - this->origin[1], centers[2] - this->origin[2]}; @@ -33,7 +33,7 @@ bool WorldRayQuery::Intersects(const float* bounds) const { const float extent = extents[axis] * parallelScale; if (-offsets[axis] - extent > 0.0f || extent - offsets[axis] < 0.0f) { - return false; + return 0; } } else { const float inverse = 1.0f / direction; @@ -47,7 +47,7 @@ bool WorldRayQuery::Intersects(const float* bounds) const { exit = far < exit ? far : exit; if (entry > exit || exit < 0.0f) { - return false; + return 0; } } } @@ -67,9 +67,9 @@ void WorldRayQuery::Collect(const float* ray, WorldSpatialTree* root) { this->limit = 999999.0f; if (root) { - for (WorldSpatialTree* child : root->children) { - if (child && this->Intersects(child->minimum)) { - this->CollectNode(child, 1); + for (int index = 0; index < 4; ++index) { + if (root->children[index] && this->Intersects(root->children[index]->minimum)) { + this->CollectNode(root->children[index], 1); } } } @@ -85,9 +85,9 @@ void WorldRayQuery::CollectNode(WorldSpatialTree* node, int depth) { if (depth == 5) { this->nodes.push_back(node); } else { - for (WorldSpatialTree* child : node->children) { - if (child && this->Intersects(child->minimum)) { - this->CollectNode(child, depth + 1); + for (int index = 0; index < 4; ++index) { + if (node->children[index] && this->Intersects(node->children[index]->minimum)) { + this->CollectNode(node->children[index], depth + 1); } } } diff --git a/Source/Contents/World/WorldRayQuery.h b/Source/Contents/World/WorldRayQuery.h index 23d7ce0f..40bb96ff 100644 --- a/Source/Contents/World/WorldRayQuery.h +++ b/Source/Contents/World/WorldRayQuery.h @@ -13,7 +13,7 @@ struct WorldRayQuery { /* 0020 */ float limit; WorldRayQuery(); - bool Intersects(const float* bounds) const; + int Intersects(const float* bounds) const; void Collect(const float* ray, WorldSpatialTree* root); void CollectNode(WorldSpatialTree* node, int depth); };