CC_CollisionTest
0x00b28580 · 2003 bytes · __cdecl
_Z16CC_CollisionTestRK8CCommand
Decompiled
undefined (1 param)
/* CC_CollisionTest(CCommand const&) */
void CC_CollisionTest(CCommand *param_1)
{
Vector *pVVar1;
CBaseEntity *this;
Vector *pVVar2;
long lVar3;
int iVar4;
int iVar5;
ushort in_FPUStatusWord;
longdouble lVar6;
longdouble lVar7;
longdouble lVar8;
longdouble lVar9;
float fVar10;
float fVar11;
float fVar12;
int local_104;
int local_f4;
float local_e8;
float local_e4;
float local_e0;
CTraceFilterSimple local_dc [16];
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
float local_b4;
undefined4 local_ac;
undefined4 local_a8;
undefined4 local_a4;
undefined4 local_9c;
undefined4 local_98;
undefined4 local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
float local_70;
float local_6c;
float local_68;
Vector local_64 [84];
if (physenv == 0) {
return;
}
Msg("Testing collision system\n");
(**(code **)(*partition + 0x84))(partition,&DAT_00d539c2);
this = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,"info_player_start");
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this);
}
local_e8 = *(float *)(this + 0x2e0);
local_e4 = *(float *)(this + 0x2e4);
local_e0 = *(float *)(this + 0x2e8);
if (CC_CollisionTest(CCommand_const&)::first != '\0') {
iVar4 = 0;
pVVar2 = operator_new__(30000);
fVar12 = 0.0;
fVar11 = fVar12;
fVar10 = fVar12;
CC_CollisionTest(CCommand_const&)::targets = pVVar2;
do {
fVar10 = fVar10 + 307807.5;
do {
fVar10 = fVar10 - (fVar10 / 128.0) * 128.0;
} while ((in_FPUStatusWord & 0x400) != 0);
fVar11 = fVar11 + 191900.0;
fVar10 = ABS(fVar10);
do {
fVar11 = fVar11 - (fVar11 / 6.2831855) * 6.2831855;
} while ((in_FPUStatusWord & 0x400) != 0);
fVar12 = fVar12 + 4994975.0;
fVar11 = ABS(fVar11);
do {
fVar12 = fVar12 - (fVar12 / 3.1415927) * 3.1415927;
} while ((in_FPUStatusWord & 0x400) != 0);
fVar12 = ABS(fVar12);
lVar6 = (longdouble)fcos((longdouble)fVar11);
lVar8 = (longdouble)fsin((longdouble)fVar11);
lVar7 = (longdouble)fcos((longdouble)fVar12);
lVar9 = (longdouble)fsin((longdouble)fVar12);
pVVar2 = pVVar2 + iVar4;
local_70 = (float)lVar6 * (float)lVar9 * fVar10;
local_6c = (float)lVar8 * (float)lVar9 * fVar10;
*(float *)(pVVar2 + 8) = (float)lVar7 * fVar10;
*(float *)pVVar2 = local_70;
*(float *)(pVVar2 + 4) = local_6c;
local_70 = local_70 - local_e8;
local_6c = local_6c - local_e4;
local_68 = (float)lVar7 * fVar10 - local_e0;
VectorNormalize((Vector *)&local_70);
pVVar2 = CC_CollisionTest(CCommand_const&)::targets;
pVVar1 = CC_CollisionTest(CCommand_const&)::targets + iVar4;
iVar4 = iVar4 + 0xc;
*(float *)(pVVar1 + 4) = local_6c * 1024.0 + local_e4;
*(float *)(pVVar1 + 8) = local_68 * 1024.0 + local_e0;
*(float *)pVVar1 = local_70 * 1024.0 + local_e8;
} while (iVar4 != 30000);
CC_CollisionTest(CCommand_const&)::first = '\0';
}
lVar3 = 0;
if (1 < *(int *)param_1) {
lVar3 = strtol(*(char **)(param_1 + 0x40c),(char **)0x0,10);
}
local_104 = 2;
fVar10 = 0.0;
LAB_00b2865c:
lVar6 = (longdouble)Plat_FloatTime();
if (lVar3 != 1) {
local_f4 = 1;
iVar4 = 0;
iVar5 = 0;
do {
if (iVar5 == 0) {
(**(code **)(*partition + 0x58))(partition,0x41200000);
}
pVVar2 = CC_CollisionTest(CCommand_const&)::targets + iVar4;
local_bc = *(float *)pVVar2 - local_e8;
local_b8 = *(float *)(pVVar2 + 4) - local_e4;
local_b4 = *(float *)(pVVar2 + 8) - local_e0;
local_cc = local_e8;
local_c8 = local_e4;
local_c4 = local_e0;
local_94 = 0;
local_98 = 0;
local_9c = 0;
local_8c = 0;
local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
local_88 = 1;
local_a4 = 0;
local_a8 = 0;
local_ac = 0;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0xbdffffff,local_dc,&local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,local_64,0xff,0,0,true,-1.0);
}
if (iVar5 == 0) {
(**(code **)(*partition + 0x5c))(partition);
}
else if (local_f4 == 0x9c4) goto code_r0x00b28834;
local_f4 = local_f4 + 1;
iVar5 = iVar5 + 1;
iVar4 = iVar4 + 0xc;
} while( true );
}
iVar4 = 0;
do {
pVVar2 = CC_CollisionTest(CCommand_const&)::targets + iVar4;
local_bc = *(float *)pVVar2 - local_e8;
local_b8 = *(float *)(pVVar2 + 4) - local_e4;
local_b4 = *(float *)(pVVar2 + 8) - local_e0;
local_cc = local_e8;
local_c8 = local_e4;
local_c4 = local_e0;
local_8c = 0;
local_9c = 0x41800000;
local_98 = 0x41800000;
local_94 = 0x41800000;
local_88 = 0;
local_ac = 0x80000000;
local_a8 = 0x80000000;
local_a4 = 0x80000000;
local_87 = local_b8 * local_b8 + local_b4 * local_b4 + local_bc * local_bc != 0.0;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0xbdffffff,local_dc,&local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,local_64,0xff,0xff,0,true,-1.0);
}
iVar4 = iVar4 + 0xc;
} while (iVar4 != 30000);
goto LAB_00b28836;
code_r0x00b28834:
lVar3 = 0;
LAB_00b28836:
lVar7 = (longdouble)Plat_FloatTime();
local_104 = local_104 + -1;
fVar10 = (fVar10 - (float)lVar6) + (float)lVar7;
if (local_104 == 0) {
(&CC_CollisionTest(CCommand_const&)::test)[lVar3] = fVar10;
Msg("%d collisions in %.2f ms (%u dots)\n",0x9c4,(double)(fVar10 * 1000.0),0);
(**(code **)(*partition + 0x84))(partition,&DAT_00d539c2);
NDebugOverlay::Line((Vector *)&local_e8,CC_CollisionTest(CCommand_const&)::targets,0xff,0,0,
false,2.0);
return;
}
goto LAB_00b2865c;
}
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.