CVoxelTree::EnumerateElementsAlongRay
0x001e1d20 · 2453 bytes · __thiscall
_ZN10CVoxelTree25EnumerateElementsAlongRayEiRK5Ray_tbP20IPartitionEnumerator
Decompiled
undefined (5 params)
/* WARNING: Type propagation algorithm not settling */
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CVoxelTree::EnumerateElementsAlongRay(int, Ray_t const&, bool, IPartitionEnumerator*) */
void __thiscall
CVoxelTree::EnumerateElementsAlongRay
(CVoxelTree *this,int param_1,Ray_t *param_2,bool param_3,IPartitionEnumerator *param_4)
{
undefined4 *puVar1;
Ray_t RVar2;
undefined4 uVar3;
undefined4 uVar4;
int iVar5;
char cVar6;
char cVar7;
int iVar8;
int *piVar9;
undefined4 *puVar10;
undefined4 *puVar11;
float *pfVar12;
int iVar13;
uint uVar14;
Ray_t *pRVar15;
undefined4 *puVar16;
ushort uVar17;
byte bVar18;
float fVar19;
float fVar20;
float fVar21;
float fVar22;
float fVar23;
CVoxelTree *pCVar24;
undefined4 local_9c;
undefined4 local_98;
undefined4 local_90;
undefined4 local_8c;
int local_88;
float local_84 [3];
float local_78;
float local_74;
float local_70;
float local_6c [4];
float local_5c [19];
bVar18 = 0;
local_9c = 0;
local_98 = 0;
if (_exit == 0) {
local_88 = 0;
}
else {
(**(code **)(_exit + 0x50))
(_exit,&local_9c,0,0,0,0,"/data/src/engine/./spatialpartition.cpp",0x8e6,
&EnumerateElementsAlongRay(int,Ray_t_const&,bool,IPartitionEnumerator*)::tm_fmt,
"(%s)%s","Unaccounted","EnumerateElementsAlongRay");
local_88 = _exit;
}
iVar13 = _DAT_0040b9d4;
local_90 = local_9c;
local_8c = local_98;
/* try { // try from 001e1e6e to 001e1ebc has its CatchHandler @ 001e2708 */
if (((_DAT_0040b028 == 0) && (DAT_0040b02c != '\0')) ||
(iVar8 = ThreadGetCurrentId(), iVar13 != iVar8)) {
RVar2 = param_2[0x45];
}
else {
if ((char *)*_DAT_0040b030 != "EnumerateElementsAlongRay") {
_DAT_0040b030 =
(int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2be3ef,&DAT_00000001,0x2a054b);
}
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
RVar2 = param_2[0x45];
}
if (RVar2 == (Ray_t)0x0) {
local_78 = *(float *)param_2 - *(float *)(param_2 + 0x30);
local_6c[0] = *(float *)param_2 + *(float *)(param_2 + 0x30);
local_6c[1] = *(float *)(param_2 + 4) + *(float *)(param_2 + 0x34);
local_74 = *(float *)(param_2 + 4) - *(float *)(param_2 + 0x34);
local_6c[2] = *(float *)(param_2 + 8) + *(float *)(param_2 + 0x38);
local_70 = *(float *)(param_2 + 8) - *(float *)(param_2 + 0x38);
/* try { // try from 001e1f5b to 001e1f5d has its CatchHandler @ 001e26e4 */
(**(code **)(*(int *)this + 0x10))(this,param_1,&local_78,local_6c,param_3,param_4);
iVar13 = _DAT_0040b9d4;
joined_r0x001e1e0a:
_DAT_0040b9d4 = iVar13;
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar8 = ThreadGetCurrentId(), iVar13 == iVar8)) {
cVar6 = CVProfNode::ExitScope();
if (cVar6 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_88 != 0) {
(**(code **)(local_88 + 0x54))(local_88,local_90,local_8c,0,0,0);
}
return;
}
iVar13 = _DAT_0040b9d4;
if (param_1 == 0) goto joined_r0x001e1e0a;
pRVar15 = param_2;
pfVar12 = local_6c;
for (iVar13 = 0x14; iVar13 != 0; iVar13 = iVar13 + -1) {
*pfVar12 = *(float *)pRVar15;
pRVar15 = pRVar15 + (uint)bVar18 * -8 + 4;
pfVar12 = pfVar12 + (uint)bVar18 * -2 + 1;
}
local_84[0] = local_5c[0] + local_6c[0];
local_84[1] = local_5c[1] + local_6c[1];
local_84[2] = local_5c[2] + local_6c[2];
/* try { // try from 001e2018 to 001e2263 has its CatchHandler @ 001e26e4 */
cVar6 = IsPointInBox((Vector *)param_2,(Vector *)&s_PartitionMin,(Vector *)&s_PartitionMax);
cVar7 = IsPointInBox((Vector *)local_84,(Vector *)&s_PartitionMin,(Vector *)&s_PartitionMax);
if ((cVar7 != '\x01') && (iVar13 = _DAT_0040b9d4, cVar6 != '\x01')) goto joined_r0x001e1e0a;
fVar21 = local_6c[2];
fVar23 = local_6c[1];
fVar20 = local_6c[0];
if (cVar6 == '\0') {
pfVar12 = local_6c;
do {
fVar22 = pfVar12[4];
if (1e-10 <= ABS(fVar22)) {
fVar19 = *pfVar12;
if (fVar22 <= 0.0) {
if (16384.0 < fVar19) {
fVar19 = fVar19 - 16379.0;
fVar22 = -fVar22;
goto LAB_001e24c3;
}
}
else if (fVar19 < -16384.0) {
fVar19 = -16379.0 - fVar19;
LAB_001e24c3:
fVar19 = fVar19 / fVar22;
fVar20 = local_5c[0] * fVar19 + fVar20;
local_6c[0] = fVar20;
fVar23 = local_5c[1] * fVar19 + fVar23;
fVar21 = fVar19 * local_5c[2] + fVar21;
local_6c[1] = fVar23;
local_6c[2] = fVar21;
}
}
pfVar12 = pfVar12 + 1;
} while (pfVar12 != local_6c + 3);
}
else {
if (cVar7 != '\0') goto LAB_001e2069;
iVar13 = 0;
do {
fVar22 = local_5c[iVar13];
if (1e-10 <= ABS(fVar22)) {
if (fVar22 < 0.0) {
if (local_84[iVar13] <= -16384.0 && local_84[iVar13] != -16384.0) {
fVar22 = -fVar22;
fVar19 = local_6c[iVar13];
goto LAB_001e25de;
}
}
else if (16384.0 < local_84[iVar13]) {
fVar19 = local_6c[iVar13];
LAB_001e25de:
fVar22 = (fVar19 + 16379.0) / fVar22;
local_84[0] = local_5c[0] * fVar22 + local_6c[0];
local_84[1] = local_5c[1] * fVar22 + local_6c[1];
local_84[2] = fVar22 * local_5c[2] + local_6c[2];
}
}
iVar13 = iVar13 + 1;
} while (iVar13 != 3);
}
local_5c[0] = local_84[0] - fVar20;
local_5c[1] = local_84[1] - fVar23;
local_5c[2] = local_84[2] - fVar21;
LAB_001e2069:
local_78 = 3.4028235e+38;
if (local_5c[0] != 0.0) {
local_78 = 1.0 / local_5c[0];
}
local_74 = 3.4028235e+38;
if (local_5c[1] != 0.0) {
local_74 = 1.0 / local_5c[1];
}
if (local_5c[2] == 0.0) {
local_70 = 3.4028235e+38;
}
else {
local_70 = 1.0 / local_5c[2];
}
piVar9 = (int *)___tls_get_addr();
iVar13 = *(int *)(this + 0xdc);
uVar3 = *(undefined4 *)(this + *piVar9 * 4 + 0x3c);
puVar10 = *(undefined4 **)(this + 0xd8);
if (puVar10 != (undefined4 *)0x0) {
do {
cVar6 = ThreadInterlockedAssignIf64(this + 0xd8,*puVar10,iVar13 + -1,puVar10,iVar13);
if (cVar6 != '\0') {
puVar16 = puVar10 + 2;
puVar11 = (undefined4 *)puVar10[4];
uVar17 = *(ushort *)(this + 0xd4);
if (uVar17 <= *(ushort *)(puVar10 + 2)) {
if (puVar11 != (undefined4 *)0x0) {
memset(puVar11,0,(uint)*(ushort *)((int)puVar10 + 10) << 2);
}
goto LAB_001e2187;
}
uVar14 = (int)(uVar17 + 0x1f) >> 5;
if (uVar14 == *(ushort *)((int)puVar10 + 10)) goto LAB_001e238c;
if (puVar11 == (undefined4 *)0x0) goto LAB_001e235d;
puVar1 = puVar10 + 3;
if (puVar11 == puVar1) {
if (uVar14 != 1) {
puVar11 = malloc(uVar14 * 4);
puVar10[4] = puVar11;
*puVar11 = puVar10[3];
puVar11 = (undefined4 *)puVar10[4];
}
}
else if (uVar14 == 1) {
puVar10[3] = *puVar11;
free(puVar11);
puVar10[4] = puVar1;
puVar11 = puVar1;
}
else {
puVar11 = realloc(puVar11,uVar14 * 4);
puVar10[4] = puVar11;
}
goto LAB_001e2388;
}
puVar10 = *(undefined4 **)(this + 0xd8);
iVar13 = *(int *)(this + 0xdc);
} while (puVar10 != (undefined4 *)0x0);
}
/* try { // try from 001e2317 to 001e23b4 has its CatchHandler @ 001e26e4 */
puVar10 = operator_new(0x18);
puVar10[2] = 0;
puVar16 = puVar10 + 2;
puVar10[3] = 0;
puVar10[4] = 0;
uVar17 = *(ushort *)(this + 0xd4);
if (*(ushort *)(puVar10 + 2) < uVar17) {
uVar14 = (int)(uVar17 + 0x1f) >> 5;
if (uVar14 != *(ushort *)((int)puVar10 + 10)) {
LAB_001e235d:
if (uVar14 == 1) {
puVar11 = puVar10 + 3;
puVar10[4] = puVar11;
}
else {
puVar11 = malloc(uVar14 * 4);
puVar10[4] = puVar11;
}
LAB_001e2388:
*(short *)((int)puVar10 + 10) = (short)uVar14;
LAB_001e238c:
if (puVar11 != (undefined4 *)0x0) {
memset(puVar11,0,uVar14 << 2);
}
}
*(ushort *)(puVar10 + 2) = uVar17;
}
LAB_001e2187:
piVar9 = (int *)___tls_get_addr();
pCVar24 = this + 0xe0;
*(undefined4 **)(this + *piVar9 * 4 + 0x3c) = puVar16;
CThreadSpinRWLock::LockForRead();
if (param_2[0x44] == (Ray_t)0x0) {
EnumerateElementsAlongRay_ExtrudedRay
(this,param_1,(Ray_t *)local_6c,(Vector *)&local_78,(Vector *)local_84,param_4);
}
else {
EnumerateElementsAlongRay_Ray
(this,param_1,(Ray_t *)local_6c,(Vector *)&local_78,(Vector *)local_84,param_4);
}
CThreadSpinRWLock::UnlockRead();
piVar9 = (int *)___tls_get_addr(pCVar24);
iVar13 = *piVar9;
iVar8 = *(int *)(this + iVar13 * 4 + 0x3c);
do {
uVar4 = *(undefined4 *)(this + 0xd8);
iVar5 = *(int *)(this + 0xdc);
*(undefined4 *)(iVar8 + -8) = uVar4;
cVar6 = ThreadInterlockedAssignIf64(this + 0xd8,iVar8 + -8,iVar5 + 0x10001,uVar4,iVar5);
} while (cVar6 == '\0');
*(undefined4 *)(this + iVar13 * 4 + 0x3c) = uVar3;
iVar13 = _DAT_0040b9d4;
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar8 = ThreadGetCurrentId(), iVar13 == iVar8)) {
cVar6 = CVProfNode::ExitScope();
if (cVar6 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_88 != 0) {
(**(code **)(local_88 + 0x54))(local_88,local_90,local_8c,0,0,0);
return;
}
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.