CNavLadder::ConnectGeneratedLadder
0x00723280 · 4800 bytes · __thiscall
_ZN10CNavLadder22ConnectGeneratedLadderEf
Decompiled
undefined (2 params)
/* CNavLadder::ConnectGeneratedLadder(float) */
void __thiscall CNavLadder::ConnectGeneratedLadder(CNavLadder *this,float param_1)
{
uint uVar1;
bool bVar2;
CNavArea *pCVar3;
int iVar4;
int iVar5;
int *piVar6;
float fVar7;
float fVar8;
int local_108;
int local_104;
float local_100;
float local_f4;
float local_f0;
float local_ec;
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;
float local_ac;
float local_a8;
float local_a4;
float local_9c;
float local_98;
float local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
CNavArea *local_70;
int local_6c [2];
undefined4 local_64;
int local_60 [7];
float local_44;
local_f4 = *(float *)(this + 0x10);
local_f0 = *(float *)(this + 0x14);
local_ec = *(float *)(this + 0x18) + 25.0;
iVar5 = *(int *)(this + 0x3c);
if (iVar5 == 1) {
local_f4 = local_f4 + 16.0;
}
else if (iVar5 < 2) {
if (iVar5 == 0) {
local_f0 = local_f0 - 16.0;
}
}
else if (iVar5 == 2) {
local_f0 = local_f0 + 16.0;
}
else if (iVar5 == 3) {
local_f4 = local_f4 - 16.0;
}
pCVar3 = (CNavArea *)
CNavMesh::GetNearestNavArea(TheNavMesh,(Vector *)&local_f4,true,10000.0,false,true,false)
;
*(CNavArea **)(this + 0x34) = pCVar3;
if (pCVar3 == (CNavArea *)0x0) {
DevMsg("ERROR: Unconnected ladder bottom at ( %g, %g, %g )\n",(double)*(float *)(this + 0x10),
(double)*(float *)(this + 0x14),(double)*(float *)(this + 0x18));
}
else {
CNavArea::AddLadderUp(pCVar3,this);
}
local_f4 = *(float *)(this + 4);
local_f0 = *(float *)(this + 8);
uVar1 = *(uint *)(this + 0x3c);
local_ec = *(float *)(this + 0xc) + 25.0;
if (uVar1 == 1) {
local_f4 = local_f4 + 16.0;
}
else if ((int)uVar1 < 2) {
if (uVar1 == 0) {
local_f0 = local_f0 - 16.0;
}
}
else if (uVar1 == 2) {
local_f0 = local_f0 + 16.0;
}
else if (uVar1 == 3) {
local_f4 = local_f4 - 16.0;
}
local_100 = *(float *)(this + 0xc) - *(float *)(this + 0x18);
if (104.0 < local_100) {
local_100 = 120.0;
}
else {
local_100 = local_100 + 16.0;
}
iVar5 = 0;
if (uVar1 < 4) {
iVar5 = (&CSWTCH_1514)[uVar1];
}
local_108 = 3;
local_e8 = local_f4;
local_e4 = local_f0;
local_e0 = local_ec;
while( true ) {
if (iVar5 == 1) {
local_e8 = local_e8 + 25.0;
}
else if (iVar5 < 2) {
if (iVar5 == 0) {
local_e4 = local_e4 - 25.0;
}
}
else if (iVar5 == 2) {
local_e4 = local_e4 + 25.0;
}
else if (iVar5 == 3) {
local_e8 = local_e8 - 25.0;
}
local_bc = local_e8 - local_f4;
local_b8 = local_e4 - local_f0;
local_8c = 0;
local_b4 = local_e0 - local_ec;
local_9c = (NavTraceMaxs - NavTraceMins) * 0.5;
local_ac = (NavTraceMaxs + NavTraceMins) * 0.5;
local_87 = local_bc * local_bc + local_b8 * local_b8 + local_b4 * local_b4 != 0.0;
local_cc = local_f4 + local_ac;
local_ac = -local_ac;
local_a8 = (DAT_00fe6ba4 + DAT_00fe6bb0) * 0.5;
local_98 = (DAT_00fe6ba4 - DAT_00fe6bb0) * 0.5;
local_94 = (DAT_00fe6ba8 - DAT_00fe6bb4) * 0.5;
local_a4 = (DAT_00fe6ba8 + DAT_00fe6bb4) * 0.5;
local_c4 = local_ec + local_a4;
local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
local_c8 = local_f0 + local_a8;
local_a8 = -local_a8;
local_a4 = -local_a4;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x2420b,local_dc);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
if (local_44 < 1.0) break;
iVar4 = CNavMesh::GetNavArea(TheNavMesh,(Vector *)&local_e8,local_100);
if ((iVar4 != 0) || (local_108 = local_108 + -1, local_108 == 0)) goto LAB_007237a2;
}
iVar4 = 0;
LAB_007237a2:
*(int *)(this + 0x24) = iVar4;
if (*(int *)(this + 0x34) == iVar4) {
*(undefined4 *)(this + 0x24) = 0;
}
iVar5 = 0;
if (*(uint *)(this + 0x3c) < 4) {
iVar5 = *(int *)(CSWTCH_1516 + *(uint *)(this + 0x3c) * 4);
}
local_104 = 3;
local_e8 = local_f4;
local_e4 = local_f0;
local_e0 = local_ec;
while( true ) {
if (iVar5 == 1) {
local_e8 = local_e8 + 25.0;
}
else if (iVar5 < 2) {
if (iVar5 == 0) {
local_e4 = local_e4 - 25.0;
}
}
else if (iVar5 == 2) {
local_e4 = local_e4 + 25.0;
}
else if (iVar5 == 3) {
local_e8 = local_e8 - 25.0;
}
local_8c = 0;
local_bc = local_e8 - local_f4;
local_b8 = local_e4 - local_f0;
local_b4 = local_e0 - local_ec;
local_87 = local_bc * local_bc + local_b8 * local_b8 + local_b4 * local_b4 != 0.0;
local_98 = (DAT_00fe6ba4 - DAT_00fe6bb0) * 0.5;
local_94 = (DAT_00fe6ba8 - DAT_00fe6bb4) * 0.5;
local_9c = (NavTraceMaxs - NavTraceMins) * 0.5;
local_ac = (NavTraceMaxs + NavTraceMins) * 0.5;
local_a8 = (DAT_00fe6ba4 + DAT_00fe6bb0) * 0.5;
local_a4 = (DAT_00fe6ba8 + DAT_00fe6bb4) * 0.5;
local_c8 = local_f0 + local_a8;
local_c4 = local_ec + local_a4;
local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
local_cc = local_f4 + local_ac;
local_ac = -local_ac;
local_a8 = -local_a8;
local_a4 = -local_a4;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x2420b,local_dc);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
if (local_44 < 1.0) break;
iVar4 = CNavMesh::GetNavArea(TheNavMesh,(Vector *)&local_e8,local_100);
if ((iVar4 != 0) || (local_104 = local_104 + -1, local_104 == 0)) goto LAB_00723b3a;
}
iVar4 = 0;
LAB_00723b3a:
*(int *)(this + 0x28) = iVar4;
if (*(int *)(this + 0x34) == iVar4) {
*(undefined4 *)(this + 0x28) = 0;
}
iVar5 = 0;
if (*(uint *)(this + 0x3c) < 4) {
iVar5 = (&CSWTCH_1518)[*(uint *)(this + 0x3c)];
}
local_104 = 3;
local_e8 = local_f4;
local_e4 = local_f0;
local_e0 = local_ec;
while( true ) {
if (iVar5 == 1) {
local_e8 = local_e8 + 25.0;
}
else if (iVar5 < 2) {
if (iVar5 == 0) {
local_e4 = local_e4 - 25.0;
}
}
else if (iVar5 == 2) {
local_e4 = local_e4 + 25.0;
}
else if (iVar5 == 3) {
local_e8 = local_e8 - 25.0;
}
local_8c = 0;
local_bc = local_e8 - local_f4;
local_b8 = local_e4 - local_f0;
local_b4 = local_e0 - local_ec;
local_9c = (NavTraceMaxs - NavTraceMins) * 0.5;
local_ac = (NavTraceMaxs + NavTraceMins) * 0.5;
local_87 = local_bc * local_bc + local_b8 * local_b8 + local_b4 * local_b4 != 0.0;
local_98 = (DAT_00fe6ba4 - DAT_00fe6bb0) * 0.5;
local_94 = (DAT_00fe6ba8 - DAT_00fe6bb4) * 0.5;
local_a8 = (DAT_00fe6ba4 + DAT_00fe6bb0) * 0.5;
local_a4 = (DAT_00fe6ba8 + DAT_00fe6bb4) * 0.5;
local_c8 = local_f0 + local_a8;
local_c4 = local_ec + local_a4;
local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
local_cc = local_f4 + local_ac;
local_ac = -local_ac;
local_a8 = -local_a8;
local_a4 = -local_a4;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x2420b,local_dc);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
if (local_44 < 1.0) break;
iVar4 = CNavMesh::GetNavArea(TheNavMesh,(Vector *)&local_e8,local_100);
if ((iVar4 != 0) || (local_104 = local_104 + -1, local_104 == 0)) goto LAB_00723eca;
}
iVar4 = 0;
LAB_00723eca:
*(int *)(this + 0x2c) = iVar4;
if (*(int *)(this + 0x34) == iVar4) {
*(undefined4 *)(this + 0x2c) = 0;
}
local_104 = 6;
iVar5 = *(int *)(this + 0x3c);
local_e8 = local_f4;
local_e4 = local_f0;
local_e0 = local_ec;
while( true ) {
if (iVar5 == 1) {
local_e8 = local_e8 + 25.0;
}
else if (iVar5 < 2) {
if (iVar5 == 0) {
local_e4 = local_e4 - 25.0;
}
}
else if (iVar5 == 2) {
local_e4 = local_e4 + 25.0;
}
else if (iVar5 == 3) {
local_e8 = local_e8 - 25.0;
}
local_8c = 0;
local_bc = local_e8 - local_f4;
local_b8 = local_e4 - local_f0;
local_b4 = local_e0 - local_ec;
local_9c = (NavTraceMaxs - NavTraceMins) * 0.5;
local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
local_94 = (DAT_00fe6ba8 - DAT_00fe6bb4) * 0.5;
local_ac = (NavTraceMaxs + NavTraceMins) * 0.5;
local_98 = (DAT_00fe6ba4 - DAT_00fe6bb0) * 0.5;
local_a8 = (DAT_00fe6ba4 + DAT_00fe6bb0) * 0.5;
local_a4 = (DAT_00fe6ba8 + DAT_00fe6bb4) * 0.5;
local_c8 = local_f0 + local_a8;
local_c4 = local_ec + local_a4;
local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
local_cc = local_f4 + local_ac;
local_ac = -local_ac;
local_a8 = -local_a8;
local_a4 = -local_a4;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x2420b,local_dc);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
if (local_44 < 1.0) break;
iVar4 = CNavMesh::GetNavArea(TheNavMesh,(Vector *)&local_e8,local_100);
if ((iVar4 != 0) || (local_104 = local_104 + -1, local_104 == 0)) goto LAB_0072424a;
}
iVar4 = 0;
LAB_0072424a:
*(int *)(this + 0x30) = iVar4;
if (*(int *)(this + 0x34) == iVar4) {
*(undefined4 *)(this + 0x30) = 0;
}
pCVar3 = *(CNavArea **)(this + 0x24);
if (pCVar3 == (CNavArea *)0x0) {
pCVar3 = *(CNavArea **)(this + 0x28);
if (pCVar3 != (CNavArea *)0x0) goto LAB_00724280;
if (*(int *)(this + 0x2c) == 0) {
DevMsg("ERROR: Unconnected ladder top at ( %g, %g, %g )\n",(double)*(float *)(this + 4),
(double)*(float *)(this + 8),(double)*(float *)(this + 0xc));
pCVar3 = *(CNavArea **)(this + 0x24);
if (pCVar3 != (CNavArea *)0x0) goto LAB_00724267;
goto LAB_00724276;
}
pCVar3 = *(CNavArea **)(this + 0x2c);
}
else {
LAB_00724267:
CNavArea::AddLadderDown(pCVar3,this);
LAB_00724276:
pCVar3 = *(CNavArea **)(this + 0x28);
if (pCVar3 != (CNavArea *)0x0) {
LAB_00724280:
CNavArea::AddLadderDown(pCVar3,this);
}
pCVar3 = *(CNavArea **)(this + 0x2c);
if (pCVar3 == (CNavArea *)0x0) goto LAB_007242a8;
}
CNavArea::AddLadderDown(pCVar3,this);
LAB_007242a8:
local_64 = 0;
if (*(CNavArea **)(this + 0x30) != (CNavArea *)0x0) {
CNavArea::AddLadderDown(*(CNavArea **)(this + 0x30),this);
Disconnect(this,*(CNavArea **)(this + 0x30));
local_64 = *(undefined4 *)(this + 0x30);
}
bVar2 = false;
pCVar3 = *(CNavArea **)(this + 0x24);
fVar7 = *(float *)(this + 0x18) + 5.0;
local_6c[0] = *(int *)(this + 0x28);
piVar6 = local_6c;
local_6c[1] = *(undefined4 *)(this + 0x2c);
local_70 = pCVar3;
while( true ) {
if ((pCVar3 != (CNavArea *)0x0) &&
(CNavArea::GetClosestPointOnArea(pCVar3,(Vector *)(this + 4),(Vector *)&local_cc),
fVar7 < local_c4)) {
bVar2 = true;
fVar7 = local_c4;
}
if (piVar6 == local_60) break;
pCVar3 = (CNavArea *)*piVar6;
piVar6 = piVar6 + 1;
}
if (bVar2) {
if (param_1 <= 0.0) {
*(float *)(this + 0xc) = fVar7;
}
else {
fVar8 = fVar7 + param_1;
if (*(float *)(this + 0xc) <= fVar7 + param_1) {
fVar8 = *(float *)(this + 0xc);
}
*(float *)(this + 0xc) = fVar8;
}
}
if ((*(CNavArea **)(this + 0x34) != (CNavArea *)0x0) &&
(CNavArea::GetClosestPointOnArea
(*(CNavArea **)(this + 0x34),(Vector *)(this + 0x10),(Vector *)&local_cc),
71.0 < *(float *)(this + 0x18) - local_c4)) {
CNavArea::Disconnect(*(CNavArea **)(this + 0x34),this);
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.