L L4D2node

CCSPlayer::CreateRagdollEntity

0x00653c80 · 2813 bytes · __thiscall

_ZN9CCSPlayer19CreateRagdollEntityERK15CTakeDamageInfo

Decompiled

undefined (2 params)

/* CCSPlayer::CreateRagdollEntity(CTakeDamageInfo const&) */

void __thiscall CCSPlayer::CreateRagdollEntity(CCSPlayer *this,CTakeDamageInfo *param_1)

{
  CCSPlayer CVar1;
  uint uVar2;
  CBaseEdict *pCVar3;
  code *pcVar4;
  uint uVar5;
  float fVar6;
  float fVar7;
  char cVar8;
  int iVar9;
  CBaseEntity *this_00;
  undefined4 *puVar10;
  int iVar11;
  CBaseEntity *pCVar12;
  CBaseEntity CVar13;
  undefined *puVar14;
  CCSPlayer *pCVar15;
  CBaseEntity *this_01;
  float fVar16;
  undefined4 uVar17;
  undefined4 uVar18;
  undefined4 uVar19;
  undefined4 uVar20;
  undefined4 uVar21;
  undefined1 local_24 [20];
  
  uVar2 = *(uint *)(this + 0x2894);
  if ((((uVar2 == 0xffffffff) ||
       (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar14 + 8) != uVar2 >> 0xc)) ||
     ((*(int *)(puVar14 + 4) == 0 ||
      (this_00 = (CBaseEntity *)
                 __dynamic_cast(*(int *)(puVar14 + 4),&CBaseEntity::typeinfo,&CCSRagdoll::typeinfo,0
                               ), this_00 == (CBaseEntity *)0x0)))) {
    iVar9 = CreateEntityByName("cs_ragdoll",-1,true);
    if (iVar9 == 0) {
      this_00 = (CBaseEntity *)0x0;
      goto LAB_00653d10;
    }
    this_00 = (CBaseEntity *)__dynamic_cast(iVar9,&CBaseEntity::typeinfo,&CCSRagdoll::typeinfo,0);
    if (this_00 == (CBaseEntity *)0x0) goto LAB_00653d10;
  }
  if (((byte)this[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  CBaseEntity::SetAbsOrigin(this_00,(Vector *)(this + 0x2e0));
  uVar21 = 0;
  uVar20 = 0;
  uVar19 = 0;
  CBaseEntity::ThinkSet((_func_void *)local_24,(float)this_00,(char *)CCSRagdoll::PruneThink);
  uVar18 = 0;
  uVar17 = 0x41200000;
  CBaseEntity::SetNextThink(this_00,10.0,(char *)0x0);
  uVar2 = *(uint *)(this_00 + 0x15f8);
  if (((uVar2 == 0xffffffff) ||
      (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 == (undefined *)0xfffffffc)) ||
     ((*(uint *)(puVar14 + 8) != uVar2 >> 0xc || (this != *(CCSPlayer **)(puVar14 + 4))))) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar9 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
    }
    puVar10 = (undefined4 *)
              (**(code **)(*(int *)this + 0xc))(this,uVar17,uVar18,uVar19,uVar20,uVar21);
    *(undefined4 *)(this_00 + 0x15f8) = *puVar10;
  }
  if (((byte)this[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  fVar16 = *(float *)(this + 0x2e0);
  if (((fVar16 == *(float *)(this_00 + 0x1608)) &&
      (*(float *)(this + 0x2e4) == *(float *)(this_00 + 0x160c))) &&
     (*(float *)(this + 0x2e8) == *(float *)(this_00 + 0x1610))) {
    CVar1 = this[0x14d];
  }
  else {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar9 + 2) = 0;
        fVar16 = *(float *)(this + 0x2e0);
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
      fVar16 = *(float *)(this + 0x2e0);
    }
    *(float *)(this_00 + 0x1608) = fVar16;
    *(undefined4 *)(this_00 + 0x160c) = *(undefined4 *)(this + 0x2e4);
    *(undefined4 *)(this_00 + 0x1610) = *(undefined4 *)(this + 0x2e8);
    CVar1 = this[0x14d];
  }
  if (((byte)CVar1 & 0x10) != 0) {
    CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
  }
  fVar16 = *(float *)(this + 0x274);
  if (((fVar16 != *(float *)(this_00 + 0x15fc)) ||
      (*(float *)(this + 0x278) != *(float *)(this_00 + 0x1600))) ||
     (*(float *)(this + 0x27c) != *(float *)(this_00 + 0x1604))) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar9 + 2) = 0;
        fVar16 = *(float *)(this + 0x274);
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
      fVar16 = *(float *)(this + 0x274);
    }
    *(float *)(this_00 + 0x15fc) = fVar16;
    *(undefined4 *)(this_00 + 0x1600) = *(undefined4 *)(this + 0x278);
    *(undefined4 *)(this_00 + 0x1604) = *(undefined4 *)(this + 0x27c);
  }
  *(undefined2 *)(this_00 + 0x122) = *(undefined2 *)(this + 0x122);
  *(undefined4 *)(this_00 + 0x448) = *(undefined4 *)(this + 0x448);
  fVar16 = *(float *)(this + 0x287c);
  if (((fVar16 != *(float *)(this_00 + 0x44c)) ||
      (*(float *)(this + 0x2880) != *(float *)(this_00 + 0x450))) ||
     (*(float *)(this + 0x2884) != *(float *)(this_00 + 0x454))) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar9 + 2) = 0;
        fVar16 = *(float *)(this + 0x287c);
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
      fVar16 = *(float *)(this + 0x287c);
    }
    *(float *)(this_00 + 0x44c) = fVar16;
    *(undefined4 *)(this_00 + 0x450) = *(undefined4 *)(this + 0x2880);
    *(undefined4 *)(this_00 + 0x454) = *(undefined4 *)(this + 0x2884);
  }
  cVar8 = (**(code **)(*(int *)this + 0x16c))(this);
  pCVar12 = (CBaseEntity *)0x0;
  if (cVar8 != '\0') {
    pCVar12 = (CBaseEntity *)this;
  }
  iVar9 = CBaseEntity::GetTeamNumber(pCVar12);
  if ((iVar9 == 3) && (iVar9 = (**(code **)(*(int *)pCVar12 + 0x544))(pCVar12), iVar9 == 8)) {
    if (*(int *)(this_00 + 0x448) != 0) {
      if (this_00[0x6c] == (CBaseEntity)0x0) {
        pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar9 + 2) = 0;
        }
      }
      else {
        this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
      }
      *(undefined4 *)(this_00 + 0x448) = 0;
    }
    fVar7 = DAT_01053d50;
    fVar6 = DAT_01053d4c;
    fVar16 = vec3_origin;
    if (((vec3_origin != *(float *)(this_00 + 0x44c)) ||
        (DAT_01053d4c != *(float *)(this_00 + 0x450))) ||
       (DAT_01053d50 != *(float *)(this_00 + 0x454))) {
      if (this_00[0x6c] == (CBaseEntity)0x0) {
        pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar9 + 2) = 0;
        }
      }
      else {
        this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
      }
      *(float *)(this_00 + 0x44c) = fVar16;
      *(float *)(this_00 + 0x450) = fVar6;
      *(float *)(this_00 + 0x454) = fVar7;
    }
  }
  iVar9 = *(int *)(this + 0x23d0);
  if (iVar9 != *(int *)(this_00 + 0x1614)) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
    }
    *(int *)(this_00 + 0x1614) = iVar9;
  }
  iVar9 = *(int *)(this + 0x23d4);
  if (iVar9 != *(int *)(this_00 + 0x1618)) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
    }
    *(int *)(this_00 + 0x1618) = iVar9;
  }
  CVar13 = (CBaseEntity)(((byte)(*(uint *)(param_1 + 0x48) >> 5) ^ 1) & 1);
  if (CVar13 != this_00[0x161d]) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar9 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
    }
    this_00[0x161d] = CVar13;
  }
  iVar9 = (**(code **)(*(int *)this + 0x8a4))(this);
  if (iVar9 != *(int *)(this_00 + 0x1620)) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
    }
    *(int *)(this_00 + 0x1620) = iVar9;
  }
  cVar8 = (**(code **)(*(int *)this + 0x16c))(this);
  pCVar15 = (CCSPlayer *)0x0;
  if (cVar8 != '\0') {
    pCVar15 = this;
  }
  iVar9 = (**(code **)(*(int *)pCVar15 + 0x544))(pCVar15);
  if (iVar9 != *(int *)(this_00 + 0x1624)) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
    }
    *(int *)(this_00 + 0x1624) = iVar9;
  }
  cVar8 = (**(code **)(*(int *)this + 0x16c))(this);
  pCVar15 = (CCSPlayer *)0x0;
  if (cVar8 != '\0') {
    pCVar15 = this;
  }
  iVar9 = *(int *)(pCVar15 + 0x2ba0);
  if (iVar9 != *(int *)(this_00 + 0x1628)) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
    }
    *(int *)(this_00 + 0x1628) = iVar9;
  }
  CCollisionProperty::SetSolid((CCollisionProperty *)(this_00 + 0x194),2);
  CBaseEntity::SetMoveType(this_00,3,0);
  CBaseEntity::SetFriction(this_00,1.0);
  iVar9 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
  iVar11 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
  CBaseEntity::SetCollisionBounds(this_00,(Vector *)(iVar11 + 0x24),(Vector *)(iVar9 + 0x30));
  if (this_00[0x105] != (CBaseEntity)0x0) {
    (**(code **)(*(int *)this_00 + 0x224))(this_00,this_00 + 0x105);
    this_00[0x105] = (CBaseEntity)0x0;
  }
  pCVar12 = (CBaseEntity *)0x0;
  CBaseEntity::SetCollisionGroup(this_00,1);
  uVar2 = *(uint *)(this_00 + 0x15f8);
  if (((uVar2 != 0xffffffff) &&
      (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar14 + 8) == uVar2 >> 0xc)) {
    pCVar12 = *(CBaseEntity **)(puVar14 + 4);
  }
  if (((byte)pCVar12[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(pCVar12);
  }
  this_01 = (CBaseEntity *)0x0;
  CBaseEntity::SetAbsOrigin(this_00,(Vector *)(pCVar12 + 0x2e0));
  uVar2 = *(uint *)(this_00 + 0x15f8);
  if (((uVar2 != 0xffffffff) &&
      (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar14 + 8) == uVar2 >> 0xc)) {
    this_01 = *(CBaseEntity **)(puVar14 + 4);
  }
  if (((byte)this_01[0x14d] & 0x10) != 0) {
    CBaseEntity::CalcAbsoluteVelocity(this_01);
  }
  CBaseEntity::SetAbsVelocity(this_00,(Vector *)(this_01 + 0x274));
  CCollisionProperty::SetSolidFlags
            ((CCollisionProperty *)(this_00 + 0x194),(uint)(*(ushort *)(this_00 + 0x1b4) | 4));
  pCVar12 = (CBaseEntity *)0x0;
  pcVar4 = *(code **)(*(int *)this_00 + 0x194);
  uVar2 = *(uint *)(this_00 + 0x15f8);
  if (((uVar2 != 0xffffffff) &&
      (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar14 + 8) == uVar2 >> 0xc)) {
    pCVar12 = *(CBaseEntity **)(puVar14 + 4);
  }
  uVar17 = CBaseEntity::GetTeamNumber(pCVar12);
  (*pcVar4)(this_00,uVar17);
  CBaseAnimating::UseClientSideAnimation((CBaseAnimating *)this_00);
  uVar2 = *(uint *)(this_00 + 0x15f8);
  if ((uVar2 == 0xffffffff) ||
     (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 == (undefined *)0xfffffffc)) {
    if ((DAT_00000153 & 8) == 0) goto LAB_00654844;
LAB_0065434c:
    iVar9 = 0;
LAB_0065434e:
    uVar5 = *(uint *)(iVar9 + 0x224);
    CVar13 = (CBaseEntity)0x0;
    if (((uVar5 != 0xffffffff) &&
        (puVar14 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar14 + 8) == uVar5 >> 0xc && (*(int *)(puVar14 + 4) != 0)))) {
      pCVar12 = (CBaseEntity *)0x0;
      if (((uVar2 != 0xffffffff) &&
          (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar14 + 8) == uVar2 >> 0xc)) {
        pCVar12 = *(CBaseEntity **)(puVar14 + 4);
      }
      iVar9 = CBaseEntity::GetTeamNumber(pCVar12);
      CVar13 = (CBaseEntity)(iVar9 == 3);
    }
  }
  else {
    if (*(uint *)(puVar14 + 8) == uVar2 >> 0xc) {
      iVar9 = *(int *)(puVar14 + 4);
    }
    else {
      iVar9 = 0;
    }
    if ((*(byte *)(iVar9 + 0x153) & 8) != 0) {
      if (*(uint *)(puVar14 + 8) != uVar2 >> 0xc) goto LAB_0065434c;
      iVar9 = *(int *)(puVar14 + 4);
      goto LAB_0065434e;
    }
LAB_00654844:
    CVar13 = (CBaseEntity)0x0;
  }
  if (this_00[0x161c] != CVar13) {
    if (this_00[0x6c] == (CBaseEntity)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar9 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
    }
    this_00[0x161c] = CVar13;
  }
LAB_00653d10:
  uVar2 = *(uint *)(this + 0x2894);
  pCVar12 = (CBaseEntity *)0x0;
  if (((uVar2 != 0xffffffff) &&
      (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar14 + 8) == uVar2 >> 0xc)) {
    pCVar12 = *(CBaseEntity **)(puVar14 + 4);
  }
  if (this_00 != pCVar12) {
    if (this[0x6c] == (CCSPlayer)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar9 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CCSPlayer)((byte)this[0x70] | 1);
    }
    if (this_00 == (CBaseEntity *)0x0) {
      *(undefined4 *)(this + 0x2894) = 0xffffffff;
      return;
    }
    puVar10 = (undefined4 *)(**(code **)(*(int *)this_00 + 0xc))(this_00);
    *(undefined4 *)(this + 0x2894) = *puVar10;
  }
  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)