L L4D2node

CEnvWeaponfire::WeaponfireThink

0x008cd790 · 586 bytes · __thiscall

_ZN14CEnvWeaponfire15WeaponfireThinkEv

Decompiled

undefined (1 param)

/* CEnvWeaponfire::WeaponfireThink() */

void __thiscall CEnvWeaponfire::WeaponfireThink(CEnvWeaponfire *this)

{
  float fVar1;
  float fVar2;
  uint uVar3;
  CBaseEdict *pCVar4;
  char cVar5;
  int iVar6;
  int iVar7;
  CBaseEntity *pCVar8;
  undefined *puVar9;
  longdouble lVar10;
  
  cVar5 = EstablishTarget(this);
  if (cVar5 == '\0') {
    fVar1 = *(float *)(gpGlobals + 0xc);
    lVar10 = (longdouble)RandomFloat(0x3e800000,0x3f000000);
    CBaseEntity::SetNextThink((CBaseEntity *)this,(float)lVar10 + fVar1,(char *)0x0);
    if (*(int *)(this + 0x484) == 0) {
      return;
    }
    if (this[0x6c] == (CEnvWeaponfire)0x0) {
      pCVar4 = *(CBaseEdict **)(this + 0x30);
      if (pCVar4 != (CBaseEdict *)0x0) {
        *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
        iVar7 = CBaseEdict::GetChangeAccessor(pCVar4);
        *(undefined2 *)(iVar7 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CEnvWeaponfire)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x484) = 0;
    return;
  }
  iVar7 = *(int *)(this + 0x484);
  if (this[0x6c] == (CEnvWeaponfire)0x0) {
    pCVar4 = *(CBaseEdict **)(this + 0x30);
    if (pCVar4 != (CBaseEdict *)0x0) {
      *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
      iVar6 = CBaseEdict::GetChangeAccessor(pCVar4);
      *(undefined2 *)(iVar6 + 2) = 0;
    }
  }
  else {
    this[0x70] = (CEnvWeaponfire)((byte)this[0x70] | 1);
  }
  *(int *)(this + 0x484) = iVar7 + 1;
  FireShot(this);
  iVar7 = CTerrorWeaponInfo::GetWeaponInfo(*(undefined4 *)(this + 0x478));
  fVar1 = *(float *)(iVar7 + 0x9dc);
  if (*(int *)(this + 0x484) < *(int *)(this + 0x480)) {
    uVar3 = *(uint *)(this + 0x45c);
    pCVar8 = (CBaseEntity *)0x0;
    if (((uVar3 != 0xffffffff) &&
        (puVar9 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar9 + 8) == uVar3 >> 0xc)) {
      pCVar8 = *(CBaseEntity **)(puVar9 + 4);
    }
    cVar5 = IsValidTarget(this,pCVar8);
    if (cVar5 == '\0') {
      fVar1 = *(float *)(gpGlobals + 0xc);
      lVar10 = (longdouble)RandomFloat(0x3e800000,0x3f000000);
      CBaseEntity::SetNextThink((CBaseEntity *)this,(float)lVar10 + fVar1,(char *)0x0);
      return;
    }
    CBaseEntity::SetNextThink((CBaseEntity *)this,fVar1 + *(float *)(gpGlobals + 0xc),(char *)0x0);
    return;
  }
  ResetBurst(this);
  fVar2 = *(float *)(gpGlobals + 0xc);
  lVar10 = (longdouble)RandomFloat(fVar1 + fVar1,0x3f800000);
  CBaseEntity::SetNextThink((CBaseEntity *)this,(float)lVar10 + fVar2,(char *)0x0);
  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)