L L4D2node

CTestEffect::Think

0x0066eae0 · 1639 bytes · __thiscall

_ZN11CTestEffect5ThinkEv

Decompiled

undefined (1 param)

/* CTestEffect::Think() */

void __thiscall CTestEffect::Think(CTestEffect *this)

{
  float fVar1;
  undefined4 uVar2;
  CBaseEdict *pCVar3;
  int iVar4;
  CBeam *this_00;
  char cVar5;
  int iVar6;
  CTestEffect *pCVar7;
  longdouble lVar8;
  longdouble lVar9;
  longdouble lVar10;
  float fVar11;
  int local_100;
  undefined4 local_f4;
  undefined4 local_f0;
  undefined4 local_ec;
  float local_e8;
  float local_e4;
  float local_e0;
  CTraceFilterSimple local_dc [16];
  undefined4 local_cc;
  undefined4 local_c8;
  undefined4 local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  Vector local_64 [84];
  
  iVar6 = *(int *)(this + 0x444);
  fVar11 = *(float *)(gpGlobals + 0xc);
  fVar1 = *(float *)(this + 0x508);
  local_100 = gpGlobals;
  if (iVar6 < 0x18) {
    this_00 = (CBeam *)CBeam::BeamCreate("sprites/lgtning.vmt",10.0);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    local_f4 = *(undefined4 *)(this + 0x2e0);
    local_f0 = *(undefined4 *)(this + 0x2e4);
    local_ec = *(undefined4 *)(this + 0x2e8);
    lVar8 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbf800000,0x3f800000);
    lVar9 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbf800000,0x3f800000);
    lVar10 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbf800000,0x3f800000);
    local_e8 = (float)lVar10;
    local_e4 = (float)lVar9;
    local_e0 = (float)lVar8;
    VectorNormalize((Vector *)&local_e8);
    local_bc = local_e8 * 128.0;
    local_b8 = local_e4 * 128.0;
    local_88 = 1;
    local_b4 = local_e0 * 128.0;
    local_8c = 0;
    local_94 = 0;
    local_98 = 0;
    local_9c = 0;
    local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
    local_a4 = 0;
    local_a8 = 0;
    local_ac = 0;
    local_cc = local_f4;
    local_c8 = local_f0;
    local_c4 = local_ec;
    CTraceFilterSimple::CTraceFilterSimple
              (local_dc,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
    (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x400b,local_dc,local_70);
    if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
      DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
    }
    CBeam::PointsInit(this_00,(Vector *)&local_f4,local_64);
    if (this_00[0x124] != (CBeam)0xff) {
      if (this_00[0x6c] == (CBeam)0x0) {
        pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this_00[0x70] = (CBeam)((byte)this_00[0x70] | 1);
      }
      this_00[0x124] = (CBeam)0xff;
    }
    if (this_00[0x125] != (CBeam)0xb4) {
      if (this_00[0x6c] == (CBeam)0x0) {
        pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this_00[0x70] = (CBeam)((byte)this_00[0x70] | 1);
      }
      this_00[0x125] = (CBeam)0xb4;
    }
    if (this_00[0x126] != (CBeam)0x64) {
      if (this_00[0x6c] == (CBeam)0x0) {
        pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this_00[0x70] = (CBeam)((byte)this_00[0x70] | 1);
      }
      this_00[0x126] = (CBeam)0x64;
    }
    if (*(float *)(this_00 + 0x4b0) != 10.0) {
      if (this_00[0x6c] == (CBeam)0x0) {
        pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this_00[0x70] = (CBeam)((byte)this_00[0x70] | 1);
      }
      *(undefined4 *)(this_00 + 0x4b0) = 0x41200000;
    }
    if (*(float *)(this_00 + 0x4c8) != 12.0) {
      if (this_00[0x6c] == (CBeam)0x0) {
        pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this_00[0x70] = (CBeam)((byte)this_00[0x70] | 1);
      }
      *(undefined4 *)(this_00 + 0x4c8) = 0x41400000;
    }
    local_100 = gpGlobals;
    iVar4 = *(int *)(this + 0x444);
    iVar6 = iVar4 + 1;
    *(undefined4 *)(this + iVar4 * 4 + 0x4a8) = *(undefined4 *)(gpGlobals + 0xc);
    *(CBeam **)(this + iVar4 * 4 + 0x448) = this_00;
    *(int *)(this + 0x444) = iVar6;
  }
  if (fVar11 - fVar1 < 3.0) {
    if (iVar6 < 1) {
      fVar11 = *(float *)(local_100 + 0xc);
    }
    else {
      pCVar7 = this + 0x4a8;
      fVar11 = *(float *)(local_100 + 0xc);
      iVar6 = 0;
      do {
        fVar1 = *(float *)(pCVar7 + -0x60);
        cVar5 = (char)(int)(((fVar11 - *(float *)pCVar7) /
                            ((*(float *)(this + 0x508) + 3.0) - *(float *)pCVar7)) * 255.0);
        if (cVar5 != *(char *)((int)fVar1 + 0x127)) {
          if (*(char *)((int)fVar1 + 0x6c) == '\0') {
            pCVar3 = *(CBaseEdict **)((int)fVar1 + 0x30);
            if (pCVar3 != (CBaseEdict *)0x0) {
              *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
              iVar4 = CBaseEdict::GetChangeAccessor(pCVar3);
              *(undefined2 *)(iVar4 + 2) = 0;
              local_100 = gpGlobals;
            }
          }
          else {
            *(byte *)((int)fVar1 + 0x70) = *(byte *)((int)fVar1 + 0x70) | 1;
          }
          *(char *)((int)fVar1 + 0x127) = cVar5;
          fVar11 = *(float *)(local_100 + 0xc);
        }
        iVar6 = iVar6 + 1;
        pCVar7 = pCVar7 + 4;
      } while (iVar6 < *(int *)(this + 0x444));
    }
    CBaseEntity::SetNextThink((CBaseEntity *)this,fVar11 + 0.1,(char *)0x0);
    return;
  }
  if (0 < iVar6) {
    iVar6 = 0;
    do {
      iVar4 = iVar6 * 4;
      iVar6 = iVar6 + 1;
      UTIL_Remove(*(CBaseEntity **)(this + iVar4 + 0x448));
      local_100 = gpGlobals;
    } while (iVar6 < *(int *)(this + 0x444));
  }
  uVar2 = *(undefined4 *)(local_100 + 0xc);
  *(undefined4 *)(this + 0x444) = 0;
  *(undefined4 *)(this + 0x508) = uVar2;
  CBaseEntity::SetNextThink((CBaseEntity *)this,-1.0,(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)