CCharge::UpdateChargeTarget
0x004d54e0 · 910 bytes · __thiscall
_ZN7CCharge18UpdateChargeTargetEv
Decompiled
undefined (1 param)
/* CCharge::UpdateChargeTarget() */
void __thiscall CCharge::UpdateChargeTarget(CCharge *this)
{
undefined *puVar1;
int *piVar2;
CBaseEdict *this_00;
int *piVar3;
char cVar4;
QAngle *pQVar5;
undefined4 *puVar6;
uint *puVar7;
uint uVar8;
undefined *puVar9;
int iVar10;
uint uVar11;
float fVar12;
int local_8c;
int local_80;
undefined **local_7c;
int *local_78;
Vector local_74 [12];
undefined4 local_68;
undefined4 local_64;
undefined4 local_60;
float local_5c;
undefined4 local_58;
undefined1 local_54;
int *local_50;
undefined4 local_4c;
undefined4 local_48;
undefined4 local_44;
undefined4 local_40;
undefined4 local_3c;
float local_38;
undefined4 local_34;
undefined4 local_30;
undefined4 local_2c;
undefined1 local_28 [24];
uVar8 = *(uint *)(this + 0x44c);
if (uVar8 == 0xffffffff) {
return;
}
puVar9 = g_pEntityList + (uVar8 & 0xfff) * 0x10;
if (puVar9 == (undefined *)0xfffffffc) {
return;
}
if (*(uint *)(puVar9 + 8) != uVar8 >> 0xc) {
return;
}
piVar2 = *(int **)(puVar9 + 4);
if (piVar2 == (int *)0x0) {
return;
}
cVar4 = (**(code **)(*piVar2 + 0x558))(piVar2);
piVar3 = mdlcache;
if (cVar4 != '\0') {
return;
}
if (this[0x464] != (CCharge)0x0) {
return;
}
(**(code **)(*mdlcache + 0x68))(mdlcache);
local_7c = &PTR_operator___00c22340;
local_4c = 0;
local_48 = 0;
local_44 = 0;
local_40 = 0;
fVar12 = *(float *)(z_charge_max_speed._28_4_ + 0x2c) *
*(float *)(z_charge_duration._28_4_ + 0x2c) * 0.9;
local_3c = 0;
/* try { // try from 004d55b3 to 004d55c7 has its CatchHandler @ 004d58d1 */
local_78 = piVar2;
pQVar5 = (QAngle *)(**(code **)(*piVar2 + 0x238))(piVar2);
AngleVectors(pQVar5,local_74);
local_68 = 2;
local_64 = 0x3f800000;
local_60 = 0x3f800000;
local_50 = (int *)0x0;
local_58 = 0x42480000;
local_54 = 0;
local_7c = &PTR_operator___00c22358;
/* try { // try from 004d560a to 004d564e has its CatchHandler @ 004d58cf */
local_5c = fVar12;
local_38 = fVar12;
puVar6 = (undefined4 *)(**(code **)(*piVar2 + 0x288))(piVar2);
local_34 = *puVar6;
local_30 = puVar6[1];
local_2c = puVar6[2];
(**(code **)(*piVar2 + 0x24c))(piVar2,local_28,0,0);
/* try { // try from 004d5655 to 004d577d has its CatchHandler @ 004d58a8 */
ForEachSurvivor<ChargeTargetScan<CTerrorPlayer>>((ChargeTargetScan *)&local_7c);
local_8c = 0;
uVar8 = *(uint *)(this + 0x468);
if (((uVar8 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar8 >> 0xc)) {
local_8c = *(int *)(puVar9 + 4);
}
if (local_50 == (int *)0x0) {
uVar11 = 0xffffffff;
local_80 = 0;
}
else {
puVar7 = (uint *)(**(code **)(*local_50 + 0xc))(local_50);
uVar11 = *puVar7;
if (((uVar11 == 0xffffffff) ||
(puVar9 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar9 + 8) != uVar11 >> 0xc)) {
uVar8 = *(uint *)(this + 0x468);
local_80 = 0;
}
else {
local_80 = *(int *)(puVar9 + 4);
uVar8 = *(uint *)(this + 0x468);
}
}
puVar9 = g_pEntityList;
if (((uVar8 == 0xffffffff) ||
(puVar1 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar1 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar1 + 8) != uVar8 >> 0xc)) {
iVar10 = 0;
}
else {
iVar10 = *(int *)(puVar1 + 4);
}
if (local_80 != iVar10) {
if (this[0x6c] == (CCharge)0x0) {
this_00 = *(CBaseEdict **)(this + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
/* try { // try from 004d580a to 004d5884 has its CatchHandler @ 004d58a8 */
iVar10 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar10 + 2) = 0;
puVar9 = g_pEntityList;
}
}
else {
this[0x70] = (CCharge)((byte)this[0x70] | 1);
}
*(uint *)(this + 0x468) = uVar11;
uVar8 = uVar11;
}
if ((uVar8 == 0xffffffff) ||
(puVar9 = puVar9 + (uVar8 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) {
if (local_8c == 0) goto LAB_004d5780;
}
else {
if (*(uint *)(puVar9 + 8) == uVar8 >> 0xc) {
iVar10 = *(int *)(puVar9 + 4);
}
else {
iVar10 = 0;
}
if (local_8c == iVar10) goto LAB_004d5780;
if ((*(uint *)(puVar9 + 8) == uVar8 >> 0xc) && (*(int *)(puVar9 + 4) != 0)) {
(**(code **)(*(int *)this + 0x394))(this,local_50,"Charge targeting new victim.");
goto LAB_004d5780;
}
}
(**(code **)(*(int *)this + 0x390))(this,"Charge not targeting anyone.");
LAB_004d5780:
local_7c = &PTR_operator___00c22340;
local_40 = 0;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)&local_4c);
local_3c = local_4c;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)&local_4c);
(**(code **)(*piVar3 + 0x6c))(piVar3);
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.