L L4D2node

CCharge::BeginCharge

0x004d3710 · 866 bytes · __thiscall

_ZN7CCharge11BeginChargeEv

Decompiled

undefined (1 param)

/* CCharge::BeginCharge() */

void __thiscall CCharge::BeginCharge(CCharge *this)

{
  CBaseEdict *this_00;
  code *pcVar1;
  int iVar2;
  uint uVar3;
  undefined4 uVar4;
  CTerrorPlayer *this_01;
  undefined *puVar5;
  int *piVar6;
  CBaseEntity *this_02;
  CBaseEntity *this_03;
  longdouble lVar7;
  
  if (this[0x464] != (CCharge)0x1) {
    if (this[0x6c] == (CCharge)0x0) {
      this_00 = *(CBaseEdict **)(this + 0x30);
      if (this_00 != (CBaseEdict *)0x0) {
        *(uint *)this_00 = *(uint *)this_00 | 0x101;
        iVar2 = CBaseEdict::GetChangeAccessor(this_00);
        *(undefined2 *)(iVar2 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CCharge)((byte)this[0x70] | 1);
    }
    this[0x464] = (CCharge)0x1;
  }
  iVar2 = 0;
  do {
    this[iVar2 + 0x49c] = (CCharge)0x0;
    iVar2 = iVar2 + 1;
  } while (iVar2 != 8);
  uVar3 = *(uint *)(this + 0x44c);
  this_02 = (CBaseEntity *)0x0;
  if (uVar3 != 0xffffffff) {
    puVar5 = g_pEntityList + (uVar3 & 0xfff) * 0x10;
    if ((puVar5 != (undefined *)0xfffffffc) && (*(uint *)(puVar5 + 8) == uVar3 >> 0xc)) {
      this_02 = *(CBaseEntity **)(puVar5 + 4);
    }
  }
  if (((byte)this_02[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(this_02);
    uVar3 = *(uint *)(this + 0x44c);
  }
  puVar5 = g_pEntityList;
  *(undefined4 *)(this + 0x46c) = *(undefined4 *)(this_02 + 0x2e0);
  *(undefined4 *)(this + 0x470) = *(undefined4 *)(this_02 + 0x2e4);
  this_03 = (CBaseEntity *)0x0;
  *(undefined4 *)(this + 0x474) = *(undefined4 *)(this_02 + 0x2e8);
  if (((uVar3 != 0xffffffff) &&
      (puVar5 = puVar5 + (uVar3 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar5 + 8) == uVar3 >> 0xc)) {
    this_03 = *(CBaseEntity **)(puVar5 + 4);
  }
  CBaseEntity::AddFlag(this_03,0x20);
  uVar3 = *(uint *)(this + 0x44c);
  piVar6 = (int *)0x0;
  if (((uVar3 != 0xffffffff) &&
      (puVar5 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar5 + 8) == uVar3 >> 0xc)) {
    piVar6 = *(int **)(puVar5 + 4);
  }
  (**(code **)(*piVar6 + 0x7fc))(piVar6,0x47,0);
  lVar7 = (longdouble)CountdownTimer::Now();
  if ((float)lVar7 + 0.1 != *(float *)(this + 0x498)) {
    (**(code **)(*(int *)(this + 0x490) + 4))(this + 0x490,this + 0x498);
    *(float *)(this + 0x498) = (float)lVar7 + 0.1;
  }
  if (*(float *)(this + 0x494) != 0.1) {
    (**(code **)(*(int *)(this + 0x490) + 4))(this + 0x490,this + 0x494);
    *(undefined4 *)(this + 0x494) = 0x3dcccccd;
  }
  uVar4 = vec3_origin;
  this[0x4a4] = (CCharge)0x0;
  piVar6 = gameeventmanager;
  *(undefined4 *)(this + 0x478) = uVar4;
  *(undefined4 *)(this + 0x47c) = DAT_01053d4c;
  *(undefined4 *)(this + 0x480) = DAT_01053d50;
  piVar6 = (int *)(**(code **)(*piVar6 + 0x1c))(piVar6,"charger_charge_start",0,0);
  if (piVar6 != (int *)0x0) {
    iVar2 = 0;
    pcVar1 = *(code **)(*piVar6 + 0x30);
    uVar3 = *(uint *)(this + 0x44c);
    if (((uVar3 != 0xffffffff) &&
        (puVar5 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar5 + 8) == uVar3 >> 0xc)) {
      iVar2 = *(int *)(puVar5 + 4);
    }
    uVar4 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(iVar2 + 0x30));
    (*pcVar1)(piVar6,"userid",uVar4);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar6,0);
  }
  uVar3 = *(uint *)(this + 0x44c);
  if (((uVar3 == 0xffffffff) ||
      (puVar5 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar5 + 8) != uVar3 >> 0xc)) {
    this_01 = (CTerrorPlayer *)0x0;
  }
  else {
    this_01 = *(CTerrorPlayer **)(puVar5 + 4);
  }
  CTerrorPlayer::Vocalize(this_01,"ChargerZombie.Charge",0.0,0.0);
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)