L L4D2node

CBaseAnimating::SetupBones

0x005e60a0 · 1890 bytes · __thiscall

_ZN14CBaseAnimating10SetupBonesEP11matrix3x4_ti

Decompiled

undefined (3 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBaseAnimating::SetupBones(matrix3x4_t*, int) */

uint __thiscall CBaseAnimating::SetupBones(CBaseAnimating *this,matrix3x4_t *param_1,int param_2)

{
  CBaseAnimating *pCVar1;
  uint *puVar2;
  float fVar3;
  int *piVar4;
  int *piVar5;
  char cVar6;
  uint uVar7;
  undefined4 *puVar8;
  int iVar9;
  CBaseAnimating *this_00;
  CBoneCache *pCVar10;
  int iVar11;
  uint uVar12;
  undefined *puVar13;
  CStudioHdr *pCVar14;
  Quaternion *local_e94;
  Vector *local_e90;
  undefined4 local_e8c;
  undefined4 local_e88;
  undefined4 local_e80;
  undefined4 local_e7c;
  int local_e78;
  undefined4 local_e74;
  undefined4 local_e70;
  float local_e6c;
  undefined4 local_e68;
  undefined4 local_e64;
  undefined4 local_e60;
  undefined4 local_e5c;
  undefined4 local_e58;
  undefined4 local_e54;
  undefined4 local_e50;
  matrix3x4_t local_e4c [48];
  Vector local_e1c [1536];
  Quaternion local_81c [2060];
  
  pCVar1 = this + 0x13ec;
  uVar7 = ThreadGetCurrentId();
  if (uVar7 == *(uint *)(this + 0x13ec)) {
LAB_005e60da:
    *(int *)(this + 0x13f0) = *(int *)(this + 0x13f0) + 1;
  }
  else {
    LOCK();
    uVar12 = *(uint *)pCVar1;
    if (uVar12 == 0) {
      *(uint *)pCVar1 = uVar7;
    }
    UNLOCK();
    if (uVar12 == 0) goto LAB_005e60da;
    CThreadFastMutex::Lock((uint)pCVar1,uVar7);
  }
  local_e8c = 0;
  local_e88 = 0;
  if (_towlower == 0) {
    local_e78 = 0;
  }
  else {
                    /* try { // try from 005e6167 to 005e6169 has its CatchHandler @ 005e6847 */
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_e8c,0,0,0,0,"/data/src/game/server/baseanimating.cpp",0x6e2,
               &SetupBones(matrix3x4_t*,int)::tm_fmt,"(%s)%s","Server Animation",
               "CBaseAnimating::SetupBones");
    local_e78 = _towlower;
  }
  iVar11 = _DAT_0105db00;
  local_e80 = local_e8c;
  local_e7c = local_e88;
                    /* try { // try from 005e651e to 005e657e has its CatchHandler @ 005e68a2 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar9 = ThreadGetCurrentId(), iVar11 == iVar9)) {
    if ((char *)*_DAT_0105d15c != "CBaseAnimating::SetupBones") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc59956,(char *)0x0,0xc59971);
    }
    puVar2 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
    *puVar2 = *puVar2 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  piVar5 = mdlcache;
                    /* try { // try from 005e61ba to 005e61bc has its CatchHandler @ 005e6870 */
  (**(code **)(*mdlcache + 0x68))(mdlcache);
  pCVar14 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar14 == (CStudioHdr *)0x0) {
    iVar11 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar11 != 0) {
      LockStudioHdr(this);
    }
    pCVar14 = *(CStudioHdr **)(this + 0x13e0);
    if (pCVar14 != (CStudioHdr *)0x0) goto LAB_005e61cb;
  }
  else {
LAB_005e61cb:
    if (*(int *)pCVar14 != 0) {
      uVar7 = *(uint *)(this + 0x14c);
      fVar3 = *(float *)(this + 0x47c);
      uVar12 = uVar7 | 8;
      *(uint *)(this + 0x14c) = uVar12;
      if ((uVar7 & 0x800) != 0) {
                    /* try { // try from 005e67a3 to 005e6833 has its CatchHandler @ 005e6890 */
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        uVar12 = *(uint *)(this + 0x14c);
      }
      local_e74 = *(undefined4 *)(this + 0x2e0);
      local_e70 = *(undefined4 *)(this + 0x2e4);
      local_e6c = fVar3 + *(float *)(this + 0x2e8);
      if ((uVar12 & 0x800) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      local_e68 = *(undefined4 *)(this + 0x37c);
      local_e64 = *(undefined4 *)(this + 0x380);
      local_e60 = *(undefined4 *)(this + 900);
                    /* try { // try from 005e625b to 005e6478 has its CatchHandler @ 005e6890 */
      cVar6 = (**(code **)(*(int *)this + 0x16c))(this);
      if (cVar6 != '\0') {
                    /* try { // try from 005e6599 to 005e659d has its CatchHandler @ 005e6890 */
        puVar8 = (undefined4 *)
                 CMultiPlayerAnimState::GetRenderAngles(*(CMultiPlayerAnimState **)(this + 0x2910));
        local_e68 = *puVar8;
        local_e64 = puVar8[1];
        local_e60 = puVar8[2];
      }
      AngleMatrix((QAngle *)&local_e68,(Vector *)&local_e74,local_e4c);
      if (*(CIKContext **)(this + 0x480) == (CIKContext *)0x0) {
        (**(code **)(*(int *)this + 0x354))(this,pCVar14,local_e4c,local_e1c,local_81c,param_2);
      }
      else {
        local_e5c = 0;
        iVar11 = *(int *)(this + 0x484);
        local_e58 = 0;
        local_e54 = 0;
        local_e50 = 0;
        *(int *)(this + 0x484) = iVar11 + 1;
        CIKContext::Init(*(CIKContext **)(this + 0x480),pCVar14,local_e4c,
                         *(float *)(gpGlobals + 0xc),iVar11 + 1,param_2);
        (**(code **)(*(int *)this + 0x354))(this,pCVar14,local_e4c,local_e1c,local_81c,param_2);
        CIKContext::UpdateTargets
                  (*(CIKContext **)(this + 0x480),local_e1c,local_81c,param_1,
                   (CBoneBitList *)&local_e5c);
        (**(code **)(*(int *)this + 0x360))(this,*(undefined4 *)(gpGlobals + 0xc));
        CIKContext::SolveDependencies
                  (*(CIKContext **)(this + 0x480),local_e1c,local_81c,param_1,
                   (CBoneBitList *)&local_e5c);
      }
      local_e90 = local_e1c;
      local_e94 = local_81c;
      uVar7 = *(uint *)(this + 0x188);
                    /* try { // try from 005e6650 to 005e66ed has its CatchHandler @ 005e6890 */
      if ((((uVar7 == 0xffffffff) ||
           (puVar13 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar13 == (undefined *)0xfffffffc))
          || ((*(uint *)(puVar13 + 8) != uVar7 >> 0xc ||
              ((piVar4 = *(int **)(puVar13 + 4), piVar4 == (int *)0x0 ||
               (this_00 = (CBaseAnimating *)(**(code **)(*piVar4 + 0xf0))(piVar4),
               this_00 == (CBaseAnimating *)0x0)))))) ||
         (pCVar10 = (CBoneCache *)GetBoneCache(this_00), pCVar10 == (CBoneCache *)0x0)) {
        AdjustTransformForScale(local_e4c,(Vector *)&local_e74,*(float *)(this + 0x464));
        Studio_BuildMatrices(pCVar14,local_e4c,local_e90,local_e94,-1,param_1,param_2);
        if (*(int *)(ai_setupbones_debug._28_4_ + 0x30) != 0) {
          DrawRawSkeleton(this,param_1,param_2,true,0.11,false);
        }
        *(uint *)(this + 0x14c) = *(uint *)(this + 0x14c) & 0xfffffff7;
        (**(code **)(*piVar5 + 0x6c))(piVar5);
        iVar11 = _DAT_0105db00;
        if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
           (iVar9 = ThreadGetCurrentId(), iVar11 == iVar9)) {
          cVar6 = CVProfNode::ExitScope();
          if (cVar6 != '\0') {
            _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
          }
          DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
        }
        if (local_e78 != 0) {
          (**(code **)(local_e78 + 0x54))(local_e78,local_e80,local_e7c,0,0,0);
        }
        goto LAB_005e64e5;
      }
      BuildMatricesWithBoneMerge(this,pCVar14,local_e4c,local_e90,local_e94,param_1,this_00,pCVar10)
      ;
      *(uint *)(this + 0x14c) = *(uint *)(this + 0x14c) & 0xfffffff7;
      if (*(int *)(ai_setupbones_debug._28_4_ + 0x30) != 0) {
        DrawRawSkeleton(this,param_1,param_2,true,0.11,false);
      }
    }
  }
  (**(code **)(*piVar5 + 0x6c))(piVar5);
  iVar11 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar9 = ThreadGetCurrentId(), iVar11 == iVar9)) {
    cVar6 = CVProfNode::ExitScope();
    if (cVar6 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_e78 != 0) {
    (**(code **)(local_e78 + 0x54))(local_e78,local_e80,local_e7c,0,0,0);
  }
LAB_005e64e5:
  *(int *)(this + 0x13f0) = *(int *)(this + 0x13f0) + -1;
  uVar7 = *(uint *)(this + 0x13f0);
  if (uVar7 == 0) {
    LOCK();
    uVar7 = *(uint *)pCVar1;
    *(uint *)pCVar1 = 0;
    UNLOCK();
  }
  return uVar7;
}

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)