CM_TraceToLeaf<true>
0x0011f210 · 1902 bytes · __cdecl
_Z14CM_TraceToLeafILb1EEvP11TraceInfo_tiff
Decompiled
void (4 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* void CM_TraceToLeaf<true>(TraceInfo_t*, int, float, float) */
void CM_TraceToLeaf<true>(TraceInfo_t *param_1,int param_2,float param_3,float param_4)
{
cbrush_t *pcVar1;
int *piVar2;
ushort uVar3;
ushort uVar4;
CCollisionBSPData *pCVar5;
int iVar6;
char cVar7;
short sVar8;
int iVar9;
int iVar10;
int iVar11;
Vector *pVVar12;
int iVar13;
CCollisionBSPData *this;
ushort uVar14;
uint uVar15;
int iVar16;
int iVar17;
int iVar18;
int local_54;
undefined4 local_44;
undefined4 local_40;
undefined4 local_3c;
undefined4 local_38;
undefined4 local_34;
undefined4 local_30;
int local_2c;
undefined4 local_28;
undefined4 local_24;
int local_20;
local_44 = 0;
local_40 = 0;
if (_exit == 0) {
local_2c = 0;
}
else {
(**(code **)(_exit + 0x50))
(_exit,&local_44,0,0,0,0,"/data/src/engine/./cmodel.cpp",0x630,
&CM_TraceToLeaf<true>(TraceInfo_t*,int,float,float)::tm_fmt,"(%s)%s","Unaccounted",
"CM_TraceToLeaf");
local_2c = _exit;
}
iVar13 = _DAT_0040b9d4;
local_34 = local_44;
local_30 = local_40;
/* try { // try from 0011f2c7 to 0011f2cb has its CatchHandler @ 0011f99a */
if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
(iVar9 = ThreadGetCurrentId(), iVar13 == iVar9)) {
if ((char *)*_DAT_0040b030 != "CM_TraceToLeaf") {
/* try { // try from 0011f83d to 0011f84e has its CatchHandler @ 0011f99a */
_DAT_0040b030 =
(int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2aab09,&DAT_00000001,0x2a054b);
}
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
}
iVar13 = *(int *)(param_1 + 0x104);
if ((param_2 < 0) || (*(int *)(iVar13 + 0x9c) <= param_2)) {
/* try { // try from 0011f70f to 0011f713 has its CatchHandler @ 0011f9af */
Error("Cannot load corrupted map.\n");
}
iVar13 = param_2 * 0x10 + *(int *)(iVar13 + 0x98);
uVar14 = *(ushort *)(iVar13 + 10);
if (uVar14 != 0) {
iVar9 = *(int *)(param_1 + 0x104);
uVar3 = *(ushort *)(iVar13 + 8);
local_54 = iVar9;
if (*(int *)(iVar9 + 0xb0) <= (int)(uint)uVar3) {
/* try { // try from 0011f862 to 0011f866 has its CatchHandler @ 0011f9af */
Error("Cannot load corrupted map.\n");
local_54 = *(int *)(param_1 + 0x104);
uVar14 = *(ushort *)(iVar13 + 10);
}
iVar9 = *(int *)(iVar9 + 0xac);
iVar11 = *(int *)(param_1 + *(int *)(param_1 + 0x11c) * 0x14 + 0x128);
iVar18 = *(int *)(param_1 + *(int *)(param_1 + 0x11c) * 4 + 0x120);
if (uVar14 != 0) {
iVar17 = 0;
do {
uVar15 = (uint)*(ushort *)(iVar9 + (uint)uVar3 * 2 + iVar17);
if (*(int *)(local_54 + 200) <= (int)uVar15) {
/* try { // try from 0011f381 to 0011f526 has its CatchHandler @ 0011f9af */
Error("Cannot load corrupted map.\n");
}
pcVar1 = (cbrush_t *)(*(int *)(local_54 + 0xc4) + uVar15 * 8);
piVar2 = (int *)(iVar11 + uVar15 * 4);
if (iVar18 != *piVar2) {
*piVar2 = iVar18;
uVar15 = *(uint *)(param_1 + 0xfc) & *(uint *)pcVar1;
if (uVar15 != 0) {
if ((uVar15 == 0x80) && ((*(uint *)(param_1 + 0xfc) & 0x2000) != 0)) {
sVar8 = *(short *)(pcVar1 + 4);
if (sVar8 == -1) {
pCVar5 = *(CCollisionBSPData **)(param_1 + 0x104);
uVar4 = *(ushort *)(pcVar1 + 6);
this = pCVar5;
if (*(int *)(pCVar5 + 0x78) <= (int)(uint)uVar4) {
Error("Cannot load corrupted map.\n");
this = *(CCollisionBSPData **)(param_1 + 0x104);
}
iVar16 = 0;
iVar6 = *(int *)(pCVar5 + 0x74);
while (iVar10 = CCollisionBSPData::GetSurfaceAtIndex
(this,*(ushort *)
((uint)uVar4 * 0x30 + iVar6 + 0x20 + iVar16 * 2)),
(*(byte *)(iVar10 + 6) & 0x80) == 0) {
iVar16 = iVar16 + 1;
if (iVar16 == 6) goto LAB_0011f440;
this = *(CCollisionBSPData **)(param_1 + 0x104);
}
goto LAB_0011f45b;
}
iVar6 = *(int *)(param_1 + 0x104);
uVar4 = *(ushort *)(pcVar1 + 6);
if (*(int *)(iVar6 + 0x6c) <= (int)(uint)uVar4) {
/* try { // try from 0011f77c to 0011f800 has its CatchHandler @ 0011f9af */
Error("Cannot load corrupted map.\n");
sVar8 = *(short *)(pcVar1 + 4);
}
iVar6 = *(int *)(iVar6 + 0x68);
if (sVar8 != 0) {
iVar16 = 0;
do {
iVar10 = CCollisionBSPData::GetSurfaceAtIndex
(*(CCollisionBSPData **)(param_1 + 0x104),
*(ushort *)(iVar6 + (uint)uVar4 * 8 + 4 + iVar16 * 8));
if ((*(byte *)(iVar10 + 6) & 0x80) != 0) goto LAB_0011f45b;
iVar16 = iVar16 + 1;
} while (iVar16 < (int)(uint)*(ushort *)(pcVar1 + 4));
}
}
LAB_0011f440:
CM_ClipBoxToBrush<true>(param_1,pcVar1);
if (*(float *)(param_1 + 0x80) == 0.0) break;
}
}
LAB_0011f45b:
iVar17 = iVar17 + 2;
} while (iVar17 != (uint)uVar14 * 2);
}
iVar9 = _DAT_0040b9d4;
if (param_1[0x8b] != (TraceInfo_t)0x0) {
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar13 = ThreadGetCurrentId(), iVar9 == iVar13)) {
cVar7 = CVProfNode::ExitScope();
if (cVar7 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_2c == 0) {
return;
}
(**(code **)(local_2c + 0x54))(local_2c,local_34,local_30,0,0,0);
return;
}
}
uVar14 = *(ushort *)(iVar13 + 0xe);
if (uVar14 != 0) {
iVar9 = *(int *)(param_1 + 0x104);
uVar3 = *(ushort *)(iVar13 + 0xc);
if (*(int *)(iVar9 + 0xd4) <= (int)(uint)uVar3) {
Error("Cannot load corrupted map.\n");
uVar14 = *(ushort *)(iVar13 + 0xe);
}
local_3c = 0;
local_38 = 0;
iVar13 = *(int *)(iVar9 + 0xd0);
if (_exit == 0) {
local_20 = 0;
}
else {
(**(code **)(_exit + 0x50))
(_exit,&local_3c,0,0,0,0,"/data/src/engine/./cmodel.cpp",0x562,
&CM_TraceToDispList<true,true>(TraceInfo_t*,unsigned_short_const*,int,float,float)
::tm_fmt,"(%s)%s","Unaccounted","CM_TraceToDispList");
local_20 = _exit;
}
iVar9 = _DAT_0040b9d4;
local_28 = local_3c;
local_24 = local_38;
/* try { // try from 0011f555 to 0011f559 has its CatchHandler @ 0011f9bf */
if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
(iVar11 = ThreadGetCurrentId(), iVar9 == iVar11)) {
if ((char *)*_DAT_0040b030 != "CM_TraceToDispList") {
/* try { // try from 0011f913 to 0011f924 has its CatchHandler @ 0011f9bf */
_DAT_0040b030 =
(int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2aab36,&DAT_00000001,0x2a054b);
}
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
}
iVar9 = *(int *)(param_1 + *(int *)(param_1 + 0x11c) * 4 + 0x120);
iVar11 = *(int *)(param_1 + *(int *)(param_1 + 0x11c) * 0x14 + 0x150);
iVar18 = 0;
if (uVar14 != 0) {
do {
uVar15 = (uint)*(ushort *)(iVar13 + (uint)uVar3 * 2 + iVar18);
pVVar12 = (Vector *)(uVar15 * 0x30 + g_pDispBounds);
if ((*(uint *)(param_1 + 0xfc) & *(uint *)(pVVar12 + 0x24)) != 0) {
if (param_1[0x101] != (TraceInfo_t)0x0) {
piVar2 = (int *)(iVar11 + *(int *)(pVVar12 + 0x20) * 4);
if (*piVar2 == iVar9) goto LAB_0011f5a0;
*piVar2 = iVar9;
}
/* try { // try from 0011f609 to 0011f657 has its CatchHandler @ 0011f9ce */
cVar7 = IsBoxIntersectingRay
(pVVar12,pVVar12 + 0x10,pVVar12,pVVar12 + 0x10,(Vector *)param_1,
(float)(param_1 + 0x3c));
if ((cVar7 != '\0') &&
(CM_TraceToDispTree<true>
(param_1,(CDispCollTree *)(uVar15 * 0xf4 + g_pDispCollTrees),param_3,param_4
), *(float *)(param_1 + 0x80) == 0.0)) break;
}
LAB_0011f5a0:
iVar18 = iVar18 + 2;
} while (iVar18 != (uint)uVar14 * 2);
}
CM_PostTraceToDispTree(param_1);
iVar13 = _DAT_0040b9d4;
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar9 = ThreadGetCurrentId(), iVar13 == iVar9)) {
cVar7 = CVProfNode::ExitScope();
if (cVar7 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_20 != 0) {
(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
}
}
iVar13 = _DAT_0040b9d4;
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar9 = ThreadGetCurrentId(), iVar13 == iVar9)) {
cVar7 = CVProfNode::ExitScope();
if (cVar7 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_2c != 0) {
(**(code **)(local_2c + 0x54))(local_2c,local_34,local_30,0,0,0);
}
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.