L L4D2node

CIKContext::AddAutoplayLocks

0x00b8a4b0 · 769 bytes · __thiscall

_ZN10CIKContext16AddAutoplayLocksEP6VectorP10Quaternion

Decompiled

undefined (3 params)

/* CIKContext::AddAutoplayLocks(Vector*, Quaternion*) */

void __thiscall CIKContext::AddAutoplayLocks(CIKContext *this,Vector *param_1,Quaternion *param_2)

{
  matrix3x4_t *pmVar1;
  char cVar2;
  int iVar3;
  matrix3x4_t *pmVar4;
  int iVar5;
  int *piVar6;
  CStudioHdr *this_00;
  int iVar7;
  int iVar8;
  int local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  iVar3 = CStudioHdr::GetNumIKAutoplayLocks(*(CStudioHdr **)(this + 0xff8));
  if (iVar3 == 0) {
    return;
  }
  do {
    pmVar4 = g_MatrixPool;
    if (g_MatrixPool == (matrix3x4_t *)0x0) {
      pmVar4 = (matrix3x4_t *)memalign(0x10,0x1800);
      if (((uint)pmVar4 & 0xf) != 0) {
        raise(5);
      }
      break;
    }
    cVar2 = ThreadInterlockedAssignIf64
                      (&g_MatrixPool,*(undefined4 *)g_MatrixPool,DAT_01047874 + -1,g_MatrixPool,
                       DAT_01047874);
  } while (cVar2 == '\0');
  local_2c = 0;
  local_28 = 0;
  local_24 = 0;
  local_20 = 0;
  iVar3 = CStudioHdr::GetNumIKAutoplayLocks(*(CStudioHdr **)(this + 0xff8));
  local_30 = *(int *)(this + 0x101c);
  if (iVar3 != 0) {
    CUtlVector<ikcontextikrule_t,CUtlMemory<ikcontextikrule_t,int>>::GrowVector
              ((CUtlVector<ikcontextikrule_t,CUtlMemory<ikcontextikrule_t,int>> *)(this + 0x1010),
               iVar3);
    CUtlVector<ikcontextikrule_t,CUtlMemory<ikcontextikrule_t,int>>::ShiftElementsRight
              ((CUtlVector<ikcontextikrule_t,CUtlMemory<ikcontextikrule_t,int>> *)(this + 0x1010),
               local_30,iVar3);
  }
  iVar3 = CStudioHdr::GetNumIKAutoplayLocks(*(CStudioHdr **)(this + 0xff8));
  local_30 = local_30 * 0x84;
  memset((void *)(*(int *)(this + 0x1010) + local_30),0,iVar3 * 0x84);
  this_00 = *(CStudioHdr **)(this + 0xff8);
  for (iVar3 = 0; iVar5 = CStudioHdr::GetNumIKAutoplayLocks(this_00), iVar3 < iVar5;
      iVar3 = iVar3 + 1) {
    piVar6 = (int *)CStudioHdr::pIKAutoplayLock(*(CStudioHdr **)(this + 0xff8),iVar3);
    this_00 = *(CStudioHdr **)(this + 0xff8);
    iVar8 = *(int *)this_00 + *piVar6 * 0x10 + *(int *)(*(int *)this_00 + 0x120);
    iVar5 = *(int *)(iVar8 + 0x38 + *(int *)(iVar8 + 0xc));
    if ((*(uint *)(this + 0x105c) & *(uint *)(*(int *)(this_00 + 0x2c) + iVar5 * 4)) != 0) {
      ::BuildBoneChain(this_00,(matrix3x4_t *)(this + 0x1024),param_1,param_2,iVar5,pmVar4,
                       (CBoneBitList *)&local_2c);
      iVar7 = local_30 + *(int *)(this + 0x1010);
      *(int *)(iVar7 + 8) = *piVar6;
      *(int *)(iVar7 + 0x10) = iVar3;
      *(undefined4 *)(iVar7 + 4) = 2;
      MatrixAngles(pmVar4 + iVar5 * 0x30,(Quaternion *)(iVar7 + 0x2c),(Vector *)(iVar7 + 0x20));
      piVar6 = (int *)(*(int *)(iVar8 + 0xc) + iVar8);
      if ((float)piVar6[1] * (float)piVar6[1] + (float)piVar6[2] * (float)piVar6[2] +
          (float)piVar6[3] * (float)piVar6[3] <= 0.0) {
        *(undefined4 *)(iVar7 + 0x6c) = 0;
        *(undefined4 *)(iVar7 + 0x70) = 0;
        *(undefined4 *)(iVar7 + 0x74) = 0;
        this_00 = *(CStudioHdr **)(this + 0xff8);
      }
      else {
        VectorRotate((float *)(piVar6 + 1),pmVar4 + *piVar6 * 0x30,(float *)(iVar7 + 0x6c));
        iVar5 = *(int *)(iVar8 + 0x1c + *(int *)(iVar8 + 0xc));
        *(undefined4 *)(iVar7 + 0x78) = *(undefined4 *)(pmVar4 + iVar5 * 0x30 + 0xc);
        *(undefined4 *)(iVar7 + 0x7c) = *(undefined4 *)(pmVar4 + iVar5 * 0x30 + 0x1c);
        *(undefined4 *)(iVar7 + 0x80) = *(undefined4 *)(pmVar4 + iVar5 * 0x30 + 0x2c);
        this_00 = *(CStudioHdr **)(this + 0xff8);
      }
    }
    local_30 = local_30 + 0x84;
  }
  do {
    iVar3 = DAT_01047874;
    pmVar1 = g_MatrixPool;
    iVar5 = DAT_01047874 + 0x10001;
    *(matrix3x4_t **)pmVar4 = g_MatrixPool;
    cVar2 = ThreadInterlockedAssignIf64(&g_MatrixPool,pmVar4,iVar5,pmVar1,iVar3);
  } while (cVar2 == '\0');
  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)