CTerrorWeapon::UpdateHelpingHand
0x0053d820 · 1705 bytes · __thiscall
_ZN13CTerrorWeapon17UpdateHelpingHandEv
Decompiled
undefined (1 param)
/* CTerrorWeapon::UpdateHelpingHand() */
void __thiscall CTerrorWeapon::UpdateHelpingHand(CTerrorWeapon *this)
{
CBaseEdict *pCVar1;
char cVar2;
int *piVar3;
int iVar4;
undefined4 *puVar5;
undefined *puVar6;
uint uVar7;
int *piVar8;
bool bVar9;
longdouble lVar10;
float fVar11;
bool local_20;
piVar3 = (int *)GetPlayerOwner(this);
if (piVar3 == (int *)0x0) {
return;
}
if (piVar3[0x7f9] == 0) {
LAB_0053da70:
bVar9 = true;
if (this[0x1459] != (CTerrorWeapon)0x0) goto LAB_0053d8ac;
LAB_0053da81:
cVar2 = (**(code **)(*(int *)this + 0x6cc))(this);
if (cVar2 != '\0') goto LAB_0053da94;
LAB_0053d8cf:
SuppressHelpingHands(this,0.0);
}
else {
iVar4 = 0;
if (*(int *)(this + 0x30) != 0) {
iVar4 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
if ((iVar4 + *(int *)(piVar3[0x7f9] + 4)) % (int)(0.5 / *(float *)(gpGlobals + 0x1c) + 0.5) == 0
) goto LAB_0053da70;
if ((*(int *)(this + 0x151c) != 2) && (*(int *)(this + 0x151c) != 4)) {
return;
}
bVar9 = false;
if (this[0x1459] == (CTerrorWeapon)0x0) goto LAB_0053da81;
LAB_0053d8ac:
SuppressHelpingHands(this,2.5);
cVar2 = (**(code **)(*(int *)this + 0x6cc))(this);
if (cVar2 == '\0') goto LAB_0053d8cf;
LAB_0053da94:
uVar7 = piVar3[0xb59];
if ((((uVar7 != 0xffffffff) &&
(puVar6 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar6 + 8) == uVar7 >> 0xc)) && (*(int *)(puVar6 + 4) != 0)) goto LAB_0053d8cf;
}
if ((0.0 < *(float *)(this + 0x1544)) &&
(lVar10 = (longdouble)CountdownTimer::Now(), (float)lVar10 < *(float *)(this + 0x1544))) {
uVar7 = *(uint *)(this + 0x1520);
if ((((uVar7 != 0xffffffff) &&
(puVar6 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar6 + 8) == uVar7 >> 0xc)) && (*(int *)(puVar6 + 4) != 0)) {
if (this[0x6c] == (CTerrorWeapon)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar4 + 2) = 0;
}
}
else {
this[0x70] = (CTerrorWeapon)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x1520) = 0xffffffff;
}
if (*(float *)(this + 0x154c) != -1.0) {
(**(code **)(*(int *)(this + 0x1548) + 4))(this + 0x1548,this + 0x154c);
*(undefined4 *)(this + 0x154c) = 0xbf800000;
}
goto LAB_0053d958;
}
uVar7 = piVar3[0xb8a];
if (((uVar7 == 0xffffffff) ||
((puVar6 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc ||
(*(uint *)(puVar6 + 8) != uVar7 >> 0xc)))) ||
(piVar8 = *(int **)(puVar6 + 4), piVar8 == (int *)0x0)) {
cVar2 = (**(code **)(*piVar3 + 0x840))(piVar3);
if ((cVar2 == '\0') ||
(((*(float *)(gpGlobals + 0xc) < *(float *)(this + 0x13fc) ||
*(float *)(gpGlobals + 0xc) == *(float *)(this + 0x13fc) ||
((piVar3[0x72c] & 0x2800U) != 0)) && (*(int *)(this + 0x151c) == 0)))) {
piVar8 = (int *)0x0;
local_20 = false;
uVar7 = *(uint *)(this + 0x1520);
goto LAB_0053dbb1;
}
if (bVar9) {
piVar8 = (int *)DetermineHelpTarget(this);
uVar7 = *(uint *)(this + 0x1520);
local_20 = piVar8 != (int *)0x0;
goto LAB_0053dbb1;
}
uVar7 = *(uint *)(this + 0x1520);
if (uVar7 != 0xffffffff) {
puVar6 = g_pEntityList + (uVar7 & 0xfff) * 0x10;
if ((puVar6 == (undefined *)0xfffffffc) || (*(uint *)(puVar6 + 8) != uVar7 >> 0xc)) {
local_20 = false;
piVar8 = (int *)0x0;
}
else {
piVar8 = *(int **)(puVar6 + 4);
local_20 = piVar8 != (int *)0x0;
}
goto LAB_0053dbb1;
}
local_20 = false;
piVar8 = (int *)0x0;
LAB_0053dbd6:
bVar9 = false;
}
else {
uVar7 = *(uint *)(this + 0x1520);
local_20 = true;
LAB_0053dbb1:
if (((uVar7 == 0xffffffff) ||
(puVar6 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar6 + 8) != uVar7 >> 0xc)) goto LAB_0053dbd6;
bVar9 = *(int *)(puVar6 + 4) != 0;
}
if (local_20 == bVar9) {
lVar10 = (longdouble)IntervalTimer::Now();
if ((float)lVar10 != *(float *)(this + 0x154c)) {
(**(code **)(*(int *)(this + 0x1548) + 4))(this + 0x1548,this + 0x154c);
*(float *)(this + 0x154c) = (float)lVar10;
}
}
if (local_20 == false) {
LAB_0053d958:
switch(*(undefined4 *)(this + 0x151c)) {
default:
return;
case 1:
SetHelpingHandState(this,0);
return;
case 2:
case 3:
SetHelpingHandState(this,6);
return;
case 4:
case 5:
SetHelpingHandState(this,7);
return;
}
}
cVar2 = (**(code **)(*piVar8 + 0x16c))(piVar8);
switch(*(undefined4 *)(this + 0x151c)) {
case 0:
uVar7 = piVar3[0xb8a];
if (((uVar7 == 0xffffffff) ||
(((puVar6 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc ||
(*(uint *)(puVar6 + 8) != uVar7 >> 0xc)) || (*(int *)(puVar6 + 4) == 0)))) &&
((*(float *)(this + 0x154c) <= 0.0 ||
(lVar10 = (longdouble)IntervalTimer::Now(), 0.5 <= (float)lVar10 - *(float *)(this + 0x154c)
)))) {
SetHelpingHandState(this,1);
break;
}
goto LAB_0053dde0;
case 1:
if ((0.0 < *(float *)(this + 0x1518)) &&
(lVar10 = (longdouble)IntervalTimer::Now(), (float)lVar10 - *(float *)(this + 0x1518) <= 0.5)
) break;
LAB_0053dde0:
if (cVar2 == '\0') {
LAB_0053dd88:
SetHelpingHandState(this,2);
}
else {
LAB_0053dde4:
SetHelpingHandState(this,4);
}
break;
case 2:
fVar11 = 99999.9;
if (0.0 < *(float *)(this + 0x1518)) {
lVar10 = (longdouble)IntervalTimer::Now();
fVar11 = (float)lVar10 - *(float *)(this + 0x1518);
}
if (*(float *)(this + 0x1524) <= fVar11 && fVar11 != *(float *)(this + 0x1524)) {
SetHelpingHandState(this,3);
}
break;
case 3:
if (cVar2 == '\0') break;
goto LAB_0053dde4;
case 4:
fVar11 = 99999.9;
if (0.0 < *(float *)(this + 0x1518)) {
lVar10 = (longdouble)IntervalTimer::Now();
fVar11 = (float)lVar10 - *(float *)(this + 0x1518);
}
if (*(float *)(this + 0x1524) <= fVar11 && fVar11 != *(float *)(this + 0x1524)) {
SetHelpingHandState(this,5);
}
break;
case 5:
if (cVar2 != '\0') break;
goto LAB_0053dd88;
}
uVar7 = *(uint *)(this + 0x1520);
if (((uVar7 != 0xffffffff) &&
(puVar6 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar6 + 8) == uVar7 >> 0xc && (piVar8 == *(int **)(puVar6 + 4))))) {
return;
}
if (this[0x6c] == (CTerrorWeapon)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar4 + 2) = 0;
}
}
else {
this[0x70] = (CTerrorWeapon)((byte)this[0x70] | 1);
}
puVar5 = (undefined4 *)(**(code **)(*piVar8 + 0xc))(piVar8);
*(undefined4 *)(this + 0x1520) = *puVar5;
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.