L L4D2node

CParticleCollection::Init

0x00bd0270 · 2756 bytes · __thiscall

_ZN19CParticleCollection4InitEP25CParticleSystemDefinitionfi

Decompiled

undefined (4 params)

/* CParticleCollection::Init(CParticleSystemDefinition*, float, int) */

void __thiscall
CParticleCollection::Init
          (CParticleCollection *this,CParticleSystemDefinition *param_1,float param_2,int param_3)

{
  CParticleCollection *pCVar1;
  int iVar2;
  undefined4 *puVar3;
  byte bVar4;
  char cVar5;
  CParticleSystemDefinition *pCVar6;
  int *piVar7;
  int iVar8;
  undefined4 uVar9;
  int iVar10;
  uint uVar11;
  UniqueId_t *pUVar12;
  int *piVar13;
  int iVar14;
  int iVar15;
  bool bVar16;
  float fVar17;
  float fVar18;
  int local_4c;
  int *local_34;
  int local_30;
  int local_2c;
  int local_28;
  int local_24;
  int local_20;
  
  pCVar6 = *(CParticleSystemDefinition **)(this + 0x48);
  pCVar1 = this + 0x40;
  if (param_1 != pCVar6) {
    if (pCVar6 != (CParticleSystemDefinition *)0x0) {
      if (*(undefined4 **)(this + 0x44) == (undefined4 *)0x0) {
        if (pCVar1 == *(CParticleCollection **)pCVar6) {
          iVar15 = *(int *)(this + 0x40);
          *(int *)pCVar6 = iVar15;
          if (iVar15 != 0) {
            *(undefined4 *)(iVar15 + 4) = 0;
          }
        }
      }
      else {
        **(undefined4 **)(this + 0x44) = *(undefined4 *)(this + 0x40);
        if (*(int *)(this + 0x40) != 0) {
          *(undefined4 *)(*(int *)(this + 0x40) + 4) = *(undefined4 *)(this + 0x44);
        }
      }
      *(undefined4 *)(this + 0x44) = 0;
      *(undefined4 *)(this + 0x40) = 0;
    }
    *(CParticleSystemDefinition **)(this + 0x48) = param_1;
    pCVar6 = (CParticleSystemDefinition *)0x0;
    if (param_1 != (CParticleSystemDefinition *)0x0) {
      *(undefined4 *)(this + 0x40) = *(undefined4 *)param_1;
      if (*(int *)param_1 != 0) {
        *(CParticleCollection **)(*(int *)param_1 + 4) = pCVar1;
      }
      *(undefined4 *)(this + 0x44) = 0;
      *(CParticleCollection **)param_1 = pCVar1;
      pCVar6 = *(CParticleSystemDefinition **)(this + 0x48);
    }
  }
  *(int *)(pCVar6 + 0x274) = *(int *)(pCVar6 + 0x274) + 1;
  *(undefined4 *)(this + 0x37c) = 0;
  *(undefined4 *)(this + 0x378) = *(undefined4 *)(*(int *)(this + 0x48) + 0x158);
  *(CParticleCollection **)(*(int *)(this + 0x48) + 0x158) = this;
  if (*(int *)(this + 0x378) != 0) {
    *(CParticleCollection **)(*(int *)(this + 0x378) + 0x37c) = this;
  }
  InitStorage(this,param_1);
  piVar7 = (int *)CParticleSystemMgr::FindOrLoadSheet
                            ((CParticleSystemMgr *)g_pParticleSystemMgr,param_1);
  piVar13 = *(int **)(this + 8);
  if (piVar7 != piVar13) {
    if (piVar13 != (int *)0x0) {
      if (*(undefined4 **)(this + 4) == (undefined4 *)0x0) {
        if (this == (CParticleCollection *)*piVar13) {
          iVar15 = *(int *)this;
          *piVar13 = iVar15;
          if (iVar15 != 0) {
            *(undefined4 *)(iVar15 + 4) = 0;
          }
        }
      }
      else {
        **(undefined4 **)(this + 4) = *(undefined4 *)this;
        if (*(int *)this != 0) {
          *(undefined4 *)(*(int *)this + 4) = *(undefined4 *)(this + 4);
        }
      }
      *(undefined4 *)(this + 4) = 0;
      *(undefined4 *)this = 0;
    }
    *(int **)(this + 8) = piVar7;
    if (piVar7 != (int *)0x0) {
      *(int *)this = *piVar7;
      if (*piVar7 != 0) {
        *(CParticleCollection **)(*piVar7 + 4) = this;
      }
      *(undefined4 *)(this + 4) = 0;
      *piVar7 = (int)this;
    }
  }
  this[0x32c] = (CParticleCollection)((byte)this[0x32c] & 0xfe | param_3 != 0);
  if (param_3 != 0) {
    *(int *)(this + 0x348) = param_3;
  }
  else {
    *(CParticleCollection **)(this + 0x348) = this;
    iVar15 = Plat_MSTime();
    *(int *)(this + 0x348) = *(int *)(this + 0x348) + iVar15;
  }
  puVar3 = *(undefined4 **)(this + 0x314);
  puVar3[3] = 0;
  puVar3[2] = 0;
  puVar3[1] = 0;
  *puVar3 = 0;
  puVar3[7] = 0;
  puVar3[6] = 0;
  puVar3[5] = 0;
  puVar3[4] = 0;
  puVar3[0xb] = 0;
  puVar3[10] = 0;
  puVar3[9] = 0;
  puVar3[8] = 0;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x6c) = 0;
  *(undefined4 *)(iVar15 + 0x68) = 0;
  *(undefined4 *)(iVar15 + 100) = 0;
  *(undefined4 *)(iVar15 + 0x60) = 0;
  *(undefined4 *)(iVar15 + 0x7c) = 0;
  *(undefined4 *)(iVar15 + 0x78) = 0;
  *(undefined4 *)(iVar15 + 0x74) = 0;
  *(undefined4 *)(iVar15 + 0x70) = 0;
  *(undefined4 *)(iVar15 + 0x8c) = 0;
  *(undefined4 *)(iVar15 + 0x88) = 0;
  *(undefined4 *)(iVar15 + 0x84) = 0;
  *(undefined4 *)(iVar15 + 0x80) = 0;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x3c) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x38) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x34) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x30) = 0x3f800000;
  uVar9 = *(undefined4 *)(param_1 + 0x288);
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x9c) = uVar9;
  *(undefined4 *)(iVar15 + 0x98) = uVar9;
  *(undefined4 *)(iVar15 + 0x94) = uVar9;
  *(undefined4 *)(iVar15 + 0x90) = uVar9;
  uVar9 = *(undefined4 *)(param_1 + 0x28c);
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0xcc) = uVar9;
  *(undefined4 *)(iVar15 + 200) = uVar9;
  *(undefined4 *)(iVar15 + 0xc4) = uVar9;
  *(undefined4 *)(iVar15 + 0xc0) = uVar9;
  uVar9 = *(undefined4 *)(param_1 + 0x290);
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0xfc) = uVar9;
  *(undefined4 *)(iVar15 + 0xf8) = uVar9;
  *(undefined4 *)(iVar15 + 0xf4) = uVar9;
  *(undefined4 *)(iVar15 + 0xf0) = uVar9;
  fVar17 = (float)(byte)param_1[0x285] * 0.003921569;
  iVar15 = *(int *)(this + 0x314);
  fVar18 = (float)(byte)param_1[0x284] * 0.003921569;
  *(float *)(iVar15 + 0x13c) = fVar17;
  *(float *)(iVar15 + 0x138) = fVar17;
  *(float *)(iVar15 + 0x134) = fVar17;
  *(float *)(iVar15 + 0x130) = fVar17;
  *(float *)(iVar15 + 300) = fVar18;
  *(float *)(iVar15 + 0x128) = fVar18;
  *(float *)(iVar15 + 0x124) = fVar18;
  *(float *)(iVar15 + 0x120) = fVar18;
  *(float *)(iVar15 + 0x14c) = fVar17;
  *(float *)(iVar15 + 0x148) = fVar17;
  *(float *)(iVar15 + 0x144) = fVar17;
  *(float *)(iVar15 + 0x140) = fVar17;
  iVar15 = *(int *)(this + 0x314);
  fVar17 = (float)(byte)param_1[0x287] * 0.003921569;
  *(float *)(iVar15 + 0x15c) = fVar17;
  *(float *)(iVar15 + 0x158) = fVar17;
  *(float *)(iVar15 + 0x154) = fVar17;
  *(float *)(iVar15 + 0x150) = fVar17;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x18c) = 0;
  *(undefined4 *)(iVar15 + 0x188) = 0;
  *(undefined4 *)(iVar15 + 0x184) = 0;
  *(undefined4 *)(iVar15 + 0x180) = 0;
  fVar17 = (float)*(int *)(param_1 + 0x294);
  iVar15 = *(int *)(this + 0x314);
  *(float *)(iVar15 + 0x1bc) = fVar17;
  *(float *)(iVar15 + 0x1b8) = fVar17;
  *(float *)(iVar15 + 0x1b4) = fVar17;
  *(float *)(iVar15 + 0x1b0) = fVar17;
  fVar17 = (float)*(int *)(param_1 + 0x298);
  iVar15 = *(int *)(this + 0x314);
  *(float *)(iVar15 + 0x27c) = fVar17;
  *(float *)(iVar15 + 0x278) = fVar17;
  *(float *)(iVar15 + 0x274) = fVar17;
  *(float *)(iVar15 + 0x270) = fVar17;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x1ec) = 0x3dcccccd;
  *(undefined4 *)(iVar15 + 0x1e8) = 0x3dcccccd;
  *(undefined4 *)(iVar15 + 0x1e4) = 0x3dcccccd;
  *(undefined4 *)(iVar15 + 0x1e0) = 0x3dcccccd;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x21c) = 0;
  *(undefined4 *)(iVar15 + 0x218) = 0;
  *(undefined4 *)(iVar15 + 0x214) = 0;
  *(undefined4 *)(iVar15 + 0x210) = 0;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x24c) = 0;
  *(undefined4 *)(iVar15 + 0x248) = 0;
  *(undefined4 *)(iVar15 + 0x244) = 0;
  *(undefined4 *)(iVar15 + 0x240) = 0;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x30c) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x308) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x304) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x300) = 0x3f800000;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x3fc) = 0;
  *(undefined4 *)(iVar15 + 0x3f8) = 0;
  *(undefined4 *)(iVar15 + 0x3f4) = 0;
  *(undefined4 *)(iVar15 + 0x3f0) = 0;
  *(undefined4 *)(iVar15 + 0x40c) = 0;
  *(undefined4 *)(iVar15 + 0x408) = 0;
  *(undefined4 *)(iVar15 + 0x404) = 0;
  *(undefined4 *)(iVar15 + 0x400) = 0;
  *(undefined4 *)(iVar15 + 0x41c) = 0;
  *(undefined4 *)(iVar15 + 0x418) = 0;
  *(undefined4 *)(iVar15 + 0x414) = 0;
  *(undefined4 *)(iVar15 + 0x410) = 0;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x42c) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x428) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x424) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x420) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x43c) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x438) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x434) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x430) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x44c) = 0x3f800000;
  fVar17 = -param_2;
  *(undefined4 *)(iVar15 + 0x448) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x444) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x440) = 0x3f800000;
  iVar15 = *(int *)(this + 0x314);
  *(undefined4 *)(iVar15 + 0x45c) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x458) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x454) = 0x3f800000;
  *(undefined4 *)(iVar15 + 0x450) = 0x3f800000;
  *(float *)(this + 0x24) = fVar17;
  *(float *)(this + 0x10) = fVar17;
  *(float *)(this + 0x14) = fVar17;
  *(float *)(this + 0x18) = fVar17;
  *(float *)(this + 0x1c) = fVar17;
  if (*(int *)(*(int *)(this + 0x48) + 0x2c4) != 0) {
    uVar9 = memalign(0x10,*(int *)(*(int *)(this + 0x48) + 0x2c4));
    *(undefined4 *)(this + 0x6c) = uVar9;
  }
  pUVar12 = (UniqueId_t *)g_pParticleSystemMgr;
  *(float *)(this + 0x3c) = *(float *)(g_pParticleSystemMgr + 0x10c) + *(float *)(param_1 + 0x2dc);
  uVar9 = *(undefined4 *)(param_1 + 0x18);
  *(undefined4 *)(this + 0x31c) = *(undefined4 *)(param_1 + 0x1c);
  *(undefined4 *)(this + 0x318) = uVar9;
  uVar9 = *(undefined4 *)(param_1 + 0x20);
  *(undefined4 *)(this + 0x324) = *(undefined4 *)(param_1 + 0x24);
  iVar14 = 0;
  *(undefined4 *)(this + 800) = uVar9;
  iVar15 = *(int *)(param_1 + 0x38c);
  if (0 < iVar15) {
    do {
      if (param_3 != 0) {
        param_3 = param_3 + 0x81;
      }
      fVar17 = (float)(iVar14 * 0x1c + *(int *)(param_1 + 0x380));
      fVar18 = *(float *)((int)fVar17 + 0x18) - *(float *)(this + 0x24);
      if (*(char *)((int)fVar17 + 0x14) == '\0') {
        iVar8 = CParticleSystemMgr::CreateParticleCollection(pUVar12,fVar17,(int)fVar18);
      }
      else {
        iVar8 = CParticleSystemMgr::CreateParticleCollection
                          ((int)pUVar12,*(float *)((int)fVar17 + 0x10),(int)fVar18);
      }
      if (iVar8 != 0) {
        *(CParticleCollection **)(iVar8 + 0x8c) = this;
        *(undefined4 *)(iVar8 + 0x70) = 0;
        iVar2 = *(int *)(this + 0x90);
        if (*(int *)(this + 0x90) == 0) {
          *(int *)(this + 0x90) = iVar8;
          *(undefined4 *)(iVar8 + 0x74) = 0;
          *(undefined4 *)(iVar8 + 0x70) = 0;
        }
        else {
          do {
            iVar10 = iVar2;
            iVar2 = *(int *)(iVar10 + 0x70);
          } while (*(int *)(iVar10 + 0x70) != 0);
          *(int *)(iVar10 + 0x70) = iVar8;
          *(int *)(iVar8 + 0x74) = iVar10;
          *(undefined4 *)(iVar8 + 0x70) = 0;
        }
        *(uint *)(this + 0x318) = *(uint *)(this + 0x318) | *(uint *)(iVar8 + 0x318);
        *(uint *)(this + 0x31c) = *(uint *)(this + 0x31c) | *(uint *)(iVar8 + 0x31c);
        *(uint *)(this + 800) = *(uint *)(this + 800) | *(uint *)(iVar8 + 800);
        *(uint *)(this + 0x324) = *(uint *)(this + 0x324) | *(uint *)(iVar8 + 0x324);
      }
      iVar14 = iVar14 + 1;
      pUVar12 = (UniqueId_t *)g_pParticleSystemMgr;
    } while (iVar14 != iVar15);
  }
  if (*(int *)(this + 0x48) != 0) {
    bVar4 = ComputeIsTranslucent(this);
    this[0x32c] = (CParticleCollection)((byte)this[0x32c] & 0xf7 | (bVar4 & 1) * '\b');
    bVar4 = ComputeIsTwoPass(this);
    this[0x32c] = (CParticleCollection)((byte)this[0x32c] & 0xef | (bVar4 & 1) << 4);
    cVar5 = ComputeIsBatchable(this);
    this[0x32c] = (CParticleCollection)((byte)this[0x32c] & 0x7f | cVar5 << 7);
    LabelTextureUsage(this);
    bVar4 = ComputeUsesPowerOfTwoFrameBufferTexture(this);
    this[0x32c] = (CParticleCollection)((byte)this[0x32c] & 0xdf | (bVar4 & 1) << 5);
    bVar4 = ComputeUsesFullFrameBufferTexture(this);
    uVar11 = 0x3f;
    this[0x32c] = (CParticleCollection)((byte)this[0x32c] & 0xbf | (bVar4 & 1) << 6);
    do {
      bVar16 = (uVar11 & 0x20) == 0;
      if (((uint)!bVar16 << ((byte)uVar11 & 0x1f) & *(uint *)(this + 0x31c)) != 0 ||
          ((uint)bVar16 << ((byte)uVar11 & 0x1f) & *(uint *)(this + 0x318)) != 0) {
        if (uVar11 == 0x3f) {
          iVar14 = 0x3f;
          uVar11 = 0x1704;
          iVar15 = 0x40;
        }
        else {
          iVar15 = uVar11 + 2;
          iVar14 = uVar11 + 1;
          uVar11 = iVar15 * 0x5c + 4;
        }
        goto LAB_00bd0afc;
      }
      uVar11 = uVar11 - 1;
    } while (uVar11 != 0);
    iVar14 = 1;
    uVar11 = 0xbc;
    iVar15 = 2;
LAB_00bd0afc:
    *(int *)(this + 100) = iVar15;
    piVar7 = operator_new__(uVar11);
    iVar8 = 0;
    *piVar7 = iVar15;
    piVar13 = piVar7 + 0x12;
    do {
      iVar8 = iVar8 + 1;
      *piVar13 = -0x40800000;
      piVar13[2] = 0;
      piVar13[3] = 0;
      piVar13[4] = 0;
      piVar13[5] = 0;
      piVar13 = piVar13 + 0x17;
    } while (iVar8 != iVar14 + 1);
    *(int **)(this + 0x68) = piVar7 + 1;
    memset(piVar7 + 1,0,*(int *)(this + 100) * 0x5c);
    iVar15 = *(int *)(this + 100);
    iVar14 = 0;
    if (0 < iVar15) {
      do {
        iVar8 = iVar15 + -1;
        if (iVar14 <= iVar15 + -1) {
          iVar8 = iVar14;
        }
        *(undefined4 *)(iVar8 * 0x5c + *(int *)(this + 0x68) + 0x1c) = 0x3f800000;
        iVar15 = *(int *)(this + 100) + -1;
        if (iVar14 <= *(int *)(this + 100) + -1) {
          iVar15 = iVar14;
        }
        *(undefined4 *)(iVar15 * 0x5c + *(int *)(this + 0x68) + 0x2c) = 0x3f800000;
        iVar15 = *(int *)(this + 100) + -1;
        if (iVar14 <= *(int *)(this + 100) + -1) {
          iVar15 = iVar14;
        }
        iVar14 = iVar14 + 1;
        *(undefined4 *)(iVar15 * 0x5c + *(int *)(this + 0x68) + 0x30) = 0x3f800000;
        iVar15 = *(int *)(this + 100);
      } while (iVar14 < iVar15);
    }
    iVar15 = *(int *)(this + 0x48);
    local_4c = 0;
    local_30 = iVar15 + 0x31c;
    local_2c = iVar15 + 0x330;
    local_28 = iVar15 + 0x344;
    piVar13 = (int *)(iVar15 + 0x308);
    local_24 = iVar15 + 0x358;
    local_34 = piVar13;
    local_20 = iVar15 + 0x36c;
    while( true ) {
      iVar14 = piVar13[3];
      if (0 < iVar14) {
        iVar8 = 0;
        do {
          piVar7 = *(int **)(*piVar13 + iVar8 * 4);
          iVar2 = iVar8 * 4;
          iVar8 = iVar8 + 1;
          (**(code **)(*piVar7 + 8))
                    (piVar7,this,
                     *(int *)(this + 0x6c) +
                     *(int *)(*(int *)(iVar15 + 0x394 + local_4c * 0x14) + iVar2));
        } while (iVar8 != iVar14);
      }
      local_4c = local_4c + 1;
      if (local_4c == 6) break;
      piVar13 = (&local_34)[local_4c];
    }
  }
  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)