CTerrorGameMovement::CheckForLedges
0x008e64a0 · 3634 bytes · __thiscall
_ZN19CTerrorGameMovement14CheckForLedgesEv
Decompiled
undefined (1 param)
/* CTerrorGameMovement::CheckForLedges() */
void __thiscall CTerrorGameMovement::CheckForLedges(CTerrorGameMovement *this)
{
float fVar1;
float fVar2;
float fVar3;
int *piVar4;
CBaseEdict *pCVar5;
uint uVar6;
bool bVar7;
char cVar8;
int iVar9;
float *pfVar10;
undefined4 uVar11;
undefined4 uVar12;
int iVar13;
CBaseEntity *pCVar14;
CTerrorPlayer *this_00;
undefined *puVar15;
longdouble lVar16;
float fVar17;
float fVar18;
float fVar19;
float fVar20;
float fVar21;
float fVar22;
float fVar23;
float fVar24;
float fVar25;
float fVar26;
float fVar27;
float fVar28;
int local_160;
Vector local_158 [12];
undefined4 local_14c;
float local_148;
undefined4 local_144;
undefined **local_140 [4];
int local_130 [5];
float local_11c;
float local_118;
float local_114;
float local_10c;
float local_108;
float local_104;
float local_fc;
float local_f8;
float local_f4;
float local_ec;
float local_e8;
float local_e4;
undefined4 local_dc;
undefined1 local_d8;
undefined1 local_d7;
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;
undefined4 local_70;
int local_6c;
undefined4 local_68;
float local_64;
float local_60;
float local_5c;
float local_58;
float local_54;
float local_50;
char *local_34;
short local_30;
if (*(int *)(this + 0x810) == 0) {
return;
}
cVar8 = (**(code **)(**(int **)(this + 4) + 300))(*(int **)(this + 4));
if (cVar8 == '\0') {
return;
}
iVar9 = CBaseEntity::GetGroundEntity(*(CBaseEntity **)(this + 4));
if ((iVar9 != 0) || (*(char *)(*(int *)(this + 4) + 0x186) == '\t')) goto LAB_008e64ef;
cVar8 = CTerrorPlayer::IsAbleToMove(*(CTerrorPlayer **)(this + 0x810));
if (cVar8 == '\0') {
pCVar14 = *(CBaseEntity **)(this + 0x810);
uVar6 = *(uint *)(pCVar14 + 0x33c4);
if ((((uVar6 == 0xffffffff) ||
(puVar15 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar15 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar15 + 8) != uVar6 >> 0xc)) || (*(int *)(puVar15 + 4) == 0))
goto LAB_008e7190;
}
else {
pCVar14 = *(CBaseEntity **)(this + 0x810);
}
if (*(char *)(*(int *)(this + 4) + 0x186) == '\b') {
LAB_008e7190:
CTerrorPlayer::ClearGrabTarget((CTerrorPlayer *)pCVar14);
return;
}
iVar9 = CBaseEntity::GetTeamNumber(pCVar14);
cVar8 = IsASurvivorTeam(iVar9);
*(uint *)(this + 0x7e4) = (-(uint)(cVar8 == '\0') & 0xfffffffe) + 3;
if (*(CTerrorPlayer **)(this + 0x810) == (CTerrorPlayer *)0x0) {
fVar17 = 0.0;
this_00 = (CTerrorPlayer *)0x0;
LAB_008e71db:
CTerrorPlayer::ClearGrabTarget(this_00);
*(undefined4 *)(this + 0x7e4) = 1;
}
else {
lVar16 = (longdouble)CTerrorPlayer::EstimateFallingDamage(*(CTerrorPlayer **)(this + 0x810));
fVar17 = (float)lVar16;
if (fVar17 < 95.0) {
this_00 = *(CTerrorPlayer **)(this + 0x810);
goto LAB_008e71db;
}
}
if ((1.0 <= fVar17) &&
((iVar9 = *(int *)(this + 0x810), *(float *)(iVar9 + 0x28c8) <= 0.0 ||
(lVar16 = (longdouble)IntervalTimer::Now(), 1.0 <= (float)lVar16 - *(float *)(iVar9 + 0x28c8))
))) {
if ((*(int *)(this + 0x7e4) != 1) &&
(iVar9 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(this + 4)), iVar9 == 2)) {
local_70 = 1;
local_6c = 0;
ForEachPlayer<LiveSurvivorCounter>((LiveSurvivorCounter *)&local_70);
if ((local_6c < 2) && (*(int *)(ZombieGrabLedgesSolo._28_4_ + 0x30) == 0)) {
CTerrorPlayer::ClearGrabTarget(*(CTerrorPlayer **)(this + 0x810));
*(undefined4 *)(this + 0x7e4) = 1;
}
}
CTerrorPlayer::ClearGrabTarget(*(CTerrorPlayer **)(this + 0x810));
iVar9 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(this + 0x810));
cVar8 = IsASurvivorTeam(iVar9);
if (cVar8 == '\0') {
pCVar14 = *(CBaseEntity **)(this + 0x810);
iVar9 = CBaseEntity::GetTeamNumber(pCVar14);
if (iVar9 != 3) {
return;
}
iVar9 = (**(code **)(*(int *)pCVar14 + 0x544))(pCVar14);
if (iVar9 != 2) {
return;
}
}
local_130[0] = 0;
local_130[1] = 0;
local_130[2] = 0;
local_14c = vec3_angle;
local_130[3] = 0;
local_130[4] = 0;
local_70 = 0x3f800000;
local_148 = (float)DAT_01053d40;
local_6c = 0;
local_68 = 0;
local_144 = DAT_01053d44;
/* try { // try from 008e66c6 to 008e7141 has its CatchHandler @ 008e730f */
CUtlVector<Vector,CUtlMemory<Vector,int>>::InsertBefore
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)local_130,0,(Vector *)&local_70);
local_70 = 0xbf800000;
local_6c = 0;
local_68 = 0;
CUtlVector<Vector,CUtlMemory<Vector,int>>::InsertBefore
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)local_130,local_130[3],
(Vector *)&local_70);
local_70 = 0;
local_6c = 0x3f800000;
local_68 = 0;
CUtlVector<Vector,CUtlMemory<Vector,int>>::InsertBefore
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)local_130,local_130[3],
(Vector *)&local_70);
local_70 = 0;
local_6c = 0xbf800000;
local_68 = 0;
CUtlVector<Vector,CUtlMemory<Vector,int>>::InsertBefore
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)local_130,local_130[3],
(Vector *)&local_70);
lVar16 = (longdouble)AngleNormalizePositive(*(float *)(*(int *)(this + 8) + 0x50));
local_148 = (float)lVar16;
AngleVectors((QAngle *)&local_14c,local_158);
CUtlVector<Vector,CUtlMemory<Vector,int>>::InsertBefore
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)local_130,local_130[3],local_158);
lVar16 = (longdouble)AngleNormalizePositive(*(float *)(*(int *)(this + 8) + 0x50) + 90.0);
local_148 = (float)lVar16;
AngleVectors((QAngle *)&local_14c,local_158);
CUtlVector<Vector,CUtlMemory<Vector,int>>::InsertBefore
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)local_130,local_130[3],local_158);
lVar16 = (longdouble)AngleNormalizePositive(*(float *)(*(int *)(this + 8) + 0x50) + 180.0);
local_148 = (float)lVar16;
AngleVectors((QAngle *)&local_14c,local_158);
CUtlVector<Vector,CUtlMemory<Vector,int>>::InsertBefore
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)local_130,local_130[3],local_158);
lVar16 = (longdouble)AngleNormalizePositive(*(float *)(*(int *)(this + 8) + 0x50) + 270.0);
local_148 = (float)lVar16;
AngleVectors((QAngle *)&local_14c,local_158);
CUtlVector<Vector,CUtlMemory<Vector,int>>::InsertBefore
((CUtlVector<Vector,CUtlMemory<Vector,int>> *)local_130,local_130[3],local_158);
pfVar10 = (float *)(**(code **)(*(int *)this + 0x7c))(this);
fVar17 = *pfVar10;
fVar19 = pfVar10[1];
fVar23 = pfVar10[2];
pfVar10 = (float *)(**(code **)(*(int *)this + 0x80))(this);
fVar21 = *pfVar10;
fVar27 = pfVar10[1];
fVar24 = pfVar10[2];
uVar11 = (**(code **)(*(int *)this + 0x40))(this,0,0);
uVar12 = (**(code **)(*(int *)this + 0xb4))(this);
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)local_140,*(IHandleEntity **)(this + 4),8,
(_func_bool_IHandleEntity_ptr_int *)0x0);
local_140[0] = &PTR_ShouldHitEntity_00c54558;
iVar9 = *(int *)(this + 8);
fVar1 = *(float *)(iVar9 + 0x9c);
fVar2 = *(float *)(iVar9 + 0xa0);
fVar3 = *(float *)(iVar9 + 0xa4);
if ((*(byte *)(iVar9 + 0x24) & 2) == 0) {
if (*(int *)(ZombieDebugLedges._28_4_ + 0x30) < 0) {
ConVar::SetValue(0x100bca0);
}
if (0 < local_130[3]) {
fVar20 = (fVar27 - fVar19) * 0.5;
fVar26 = (fVar24 - fVar23) * 0.5;
fVar18 = (fVar21 - fVar17) * 0.5;
fVar21 = (fVar21 + fVar17) * 0.5;
bVar7 = fVar26 * fVar26 + fVar18 * fVar18 + fVar20 * fVar20 < 1e-06;
fVar22 = fVar1 + fVar21;
fVar19 = (fVar19 + fVar27) * 0.5;
fVar17 = (fVar23 + fVar24) * 0.5;
fVar27 = fVar2 + fVar19;
fVar21 = -fVar21;
fVar19 = -fVar19;
fVar23 = fVar3 + fVar17;
fVar17 = -fVar17;
iVar9 = 0;
do {
pfVar10 = (float *)(local_130[0] + iVar9 * 0xc);
local_10c = *pfVar10 * 64.0;
local_108 = pfVar10[1] * 64.0;
local_104 = pfVar10[2] * 64.0;
local_dc = 0;
*(int *)(this + 2000) = *(int *)(this + 2000) + 1;
local_d7 = local_108 * local_108 + local_10c * local_10c + local_104 * local_104 != 0.0;
piVar4 = *(int **)(this + 0x7cc);
local_11c = fVar22;
local_118 = fVar27;
local_114 = fVar23;
local_fc = fVar21;
local_f8 = fVar19;
local_f4 = fVar17;
local_ec = fVar18;
local_e8 = fVar20;
local_e4 = fVar26;
local_d8 = bVar7;
if ((piVar4 == (int *)0x0) ||
(cVar8 = (**(code **)(*piVar4 + 0x10))(piVar4,&local_11c), cVar8 == '\0')) {
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_11c,uVar11,local_140,&local_70);
}
else {
(**(code **)(*enginetrace + 0x20))
(enginetrace,&local_11c,*(undefined4 *)(this + 0x7cc),uVar11,local_140,
&local_70);
}
cVar8 = (**(code **)(*(int *)this + 0xac))(this,&local_70);
if (cVar8 != '\0') {
LAB_008e6cb9:
CBaseEntity::SetMoveType(*(CBaseEntity **)(this + 4),9,0);
iVar9 = *(int *)(this + 4);
if (*(char *)(iVar9 + 0x187) != '\0') {
if (*(char *)(iVar9 + 0x6c) == '\0') {
pCVar5 = *(CBaseEdict **)(iVar9 + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar13 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar13 + 2) = 0;
}
}
else {
*(byte *)(iVar9 + 0x70) = *(byte *)(iVar9 + 0x70) | 1;
}
*(undefined1 *)(iVar9 + 0x187) = 0;
iVar9 = *(int *)(this + 4);
}
if (((local_58 != *(float *)(iVar9 + 0x2000)) ||
(local_54 != *(float *)(iVar9 + 0x2004))) ||
(local_50 != *(float *)(iVar9 + 0x2008))) {
if (*(char *)(iVar9 + 0x6c) == '\0') {
pCVar5 = *(CBaseEdict **)(iVar9 + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
/* try { // try from 008e72a6 to 008e72f1 has its CatchHandler @ 008e730f */
iVar13 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar13 + 2) = 0;
}
}
else {
*(byte *)(iVar9 + 0x70) = *(byte *)(iVar9 + 0x70) | 1;
}
*(float *)(iVar9 + 0x2008) = local_50;
*(float *)(iVar9 + 0x2000) = local_58;
*(float *)(iVar9 + 0x2004) = local_54;
iVar9 = *(int *)(this + 4);
}
if ((int)local_30 != *(int *)(iVar9 + 0x1ffc)) {
if (*(char *)(iVar9 + 0x6c) == '\0') {
pCVar5 = *(CBaseEdict **)(iVar9 + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar13 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar13 + 2) = 0;
}
}
else {
*(byte *)(iVar9 + 0x70) = *(byte *)(iVar9 + 0x70) | 1;
}
*(int *)(iVar9 + 0x1ffc) = (int)local_30;
}
iVar9 = *(int *)(this + 8);
*(undefined4 *)(iVar9 + 0x40) = 0;
*(undefined4 *)(iVar9 + 0x44) = 0;
*(undefined4 *)(iVar9 + 0x48) = 0;
iVar9 = *(int *)(this + 8);
*(float *)(iVar9 + 0x9c) = local_64;
*(float *)(iVar9 + 0xa0) = local_60;
*(float *)(iVar9 + 0xa4) = local_5c;
goto LAB_008e6dd2;
}
pfVar10 = (float *)(iVar9 * 0xc + local_130[0]);
fVar25 = *pfVar10 + *pfVar10 + local_64;
fVar28 = pfVar10[1] + pfVar10[1] + local_60;
fVar24 = pfVar10[2] + pfVar10[2] + local_5c;
if ((((local_34 == "TOOLS/TOOLSCLIP") ||
(iVar13 = _V_stricmp(local_34,"TOOLS/TOOLSCLIP"), iVar13 == 0)) ||
(local_34 == "TOOLS/TOOLSPLAYERCLIP")) ||
(iVar13 = _V_stricmp(local_34,"TOOLS/TOOLSPLAYERCLIP"), iVar13 == 0)) {
local_8c = 0;
local_bc = fVar25 - fVar1;
local_b8 = fVar28 - fVar2;
local_b4 = fVar24 - fVar3;
piVar4 = *(int **)(this + 0x7cc);
*(int *)(this + 2000) = *(int *)(this + 2000) + 1;
local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
local_cc = fVar22;
local_c8 = fVar27;
local_c4 = fVar23;
local_ac = fVar21;
local_a8 = fVar19;
local_a4 = fVar17;
local_9c = fVar18;
local_98 = fVar20;
local_94 = fVar26;
local_88 = bVar7;
if (piVar4 == (int *)0x0) {
LAB_008e71a0:
/* try { // try from 008e71c9 to 008e71cb has its CatchHandler @ 008e730f */
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,uVar12,local_140,&local_70);
}
else {
cVar8 = (**(code **)(*piVar4 + 0x10))(piVar4,&local_cc);
if (cVar8 == '\0') goto LAB_008e71a0;
(**(code **)(*enginetrace + 0x20))
(enginetrace,&local_cc,*(undefined4 *)(this + 0x7cc),uVar12,local_140,
&local_70);
}
cVar8 = (**(code **)(*(int *)this + 0xac))(this,&local_70);
if (cVar8 != '\0') goto LAB_008e6cb9;
}
iVar9 = iVar9 + 1;
} while (iVar9 < local_130[3]);
}
if ((*(int *)(this + 0x7e4) != 1) && (0 < local_130[3])) {
local_160 = 0;
iVar9 = 0;
do {
local_cc = *(float *)(local_130[0] + iVar9);
local_c8 = *(float *)(local_130[0] + 4 + iVar9);
local_c4 = *(float *)(*(int *)(this + 8) + 0x48);
iVar13 = CheckForLedge(this,(Vector *)&local_cc,40.0,64.0);
if (iVar13 == 2) {
CTerrorPlayer::OnLedgeGrabbed
(*(CTerrorPlayer **)(this + 0x810),(Vector *)(*(int *)(this + 8) + 0x9c));
break;
}
local_160 = local_160 + 1;
iVar9 = iVar9 + 0xc;
} while (local_160 < local_130[3]);
}
}
LAB_008e6dd2:
local_130[3] = 0;
CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)local_130);
local_130[4] = local_130[0];
CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)local_130);
return;
}
LAB_008e64ef:
CTerrorPlayer::ClearGrabTarget(*(CTerrorPlayer **)(this + 0x810));
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.