--check: 938/3256 method bodies compile for x86_64 (28.8%), 32-bit layout asserts hold; boot path 3/626 curated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91 lines
3.6 KiB
C++
91 lines
3.6 KiB
C++
#include "classes.h"
|
|
|
|
// 0041c490
|
|
void EntityPartition::query_box(EntityList_EL *outList, Vector *position, Vector *extent)
|
|
{
|
|
float *pfVar1;
|
|
int iVar2;
|
|
float *pfVar3;
|
|
void *isSeen;
|
|
int resultSize;
|
|
uint64_t *allocatedBytes;
|
|
int iVar4;
|
|
int iVar5;
|
|
int iVar6;
|
|
uint32_t uVar7;
|
|
void *local_10;
|
|
uint8_t *puStack_c;
|
|
uint32_t uStack_8;
|
|
float cellSize;
|
|
int column;
|
|
int entityIndex;
|
|
float extentX;
|
|
uint64_t oldAllocated;
|
|
float posXCopy;
|
|
|
|
uStack_8 = 0xffffffff;
|
|
puStack_c = &LAB_00af1690;
|
|
local_10 = ExceptionList;
|
|
ExceptionList = &local_10;
|
|
if (*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>(this) + 0xd4)) != 0) {
|
|
isSeen = operator_new_tracked(*GHIDRA_CAST<uint32_t *>((*GHIDRA_CAST<int *>(this) + 0xd4)));
|
|
memset(isSeen,0,*GHIDRA_CAST<size_t *>((*GHIDRA_CAST<int *>(this) + 0xd4)));
|
|
extentX = extent->x;
|
|
pfVar3 = &position->x;
|
|
pfVar1 = &position->y;
|
|
cellSize = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x14));
|
|
posXCopy = position->x;
|
|
position = GHIDRA_CAST<Vector *>(GHIDRA_INT(((position->y - extent->y) / cellSize)));
|
|
iVar5 = GHIDRA_INT(((extent->y + *pfVar1) / cellSize));
|
|
iVar6 = GHIDRA_INT(((*pfVar3 - extentX) / cellSize));
|
|
if (GHIDRA_INT(position) <= iVar5) {
|
|
column = iVar6;
|
|
do {
|
|
for (; column <= GHIDRA_INT(((extentX + posXCopy) / cellSize)); column = column + 1) {
|
|
iVar4 = column + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)) * GHIDRA_INT(position);
|
|
if ((-1 < iVar4) &&
|
|
(iVar4 < (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x1c)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18))) / 0xa4)) {
|
|
uVar7 = 0;
|
|
iVar4 = iVar4 * 0xa4 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18));
|
|
if (*GHIDRA_CAST<int *>((iVar4 + 0xa0)) != 0) {
|
|
do {
|
|
iVar2 = *GHIDRA_CAST<int *>((iVar4 + uVar7 * 4));
|
|
entityIndex = *GHIDRA_CAST<int *>((iVar2 + 0x24));
|
|
if (*GHIDRA_CAST<char *>((entityIndex + GHIDRA_INT(isSeen))) == '\0') {
|
|
resultSize = outList->_size;
|
|
if (GHIDRA_UINT(outList->_capacity) < resultSize + 1U) {
|
|
KAGE_LogMessage(0x10,GHIDRA_CAST<uint8_t *>("EL: not enough space for push_back\n"));
|
|
resultSize = outList->_size;
|
|
}
|
|
*GHIDRA_CAST<int *>((*GHIDRA_CAST<int *>(&(*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>((outList)) + 0x4)))) + resultSize * 4)) = iVar2;
|
|
outList->_size = outList->_size + 1;
|
|
*GHIDRA_CAST<uint8_t *>((entityIndex + GHIDRA_INT(isSeen))) = 1;
|
|
}
|
|
uVar7 = uVar7 + 1;
|
|
} while (uVar7 < *GHIDRA_CAST<uint32_t *>((iVar4 + 0xa0)));
|
|
}
|
|
}
|
|
}
|
|
position = GHIDRA_CAST<Vector *>((GHIDRA_INT(&position->x) + 1));
|
|
column = iVar6;
|
|
} while (GHIDRA_INT(position) <= iVar5);
|
|
}
|
|
if (g_mainHeap == (void *)0x0) {
|
|
allocatedBytes = &g_allocatedBytesNoHeap;
|
|
}
|
|
else {
|
|
allocatedBytes = GHIDRA_CAST<uint64_t *>((GHIDRA_INT(g_mainHeap) + 0x30));
|
|
}
|
|
if (isSeen != (void *)0x0) {
|
|
uVar7 = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(isSeen) + -4));
|
|
oldAllocated = *allocatedBytes;
|
|
*GHIDRA_CAST<uint32_t *>(allocatedBytes) = GHIDRA_UINT(*allocatedBytes) - uVar7;
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) =
|
|
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(allocatedBytes) + 4)) - GHIDRA_UINT((GHIDRA_UINT(oldAllocated) < uVar7));
|
|
free((void *)(GHIDRA_INT(isSeen) + -4));
|
|
}
|
|
}
|
|
ExceptionList = local_10;
|
|
return;
|
|
}
|