L L4D2node

CCommentaryDummy::AnimThink

0x003e0ec0 · 1612 bytes · __thiscall

_ZN16CCommentaryDummy9AnimThinkEv

Decompiled

undefined (1 param)

/* CCommentaryDummy::AnimThink() */

void __thiscall CCommentaryDummy::AnimThink(CCommentaryDummy *this)

{
  CCommentaryDummy CVar1;
  code *pcVar2;
  CBaseEdict *this_00;
  char cVar3;
  int *piVar4;
  int iVar5;
  CStudioHdr *pCVar6;
  int *piVar7;
  CStudioHdr *pCVar8;
  int iVar9;
  int *piVar10;
  longdouble lVar11;
  uint uVar12;
  float fVar13;
  float fVar14;
  float fVar15;
  float fVar16;
  float fVar17;
  undefined4 local_90;
  float local_70;
  int *local_60;
  float local_58;
  float local_54;
  float local_50;
  float local_4c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  if ((this[0x488] != (CCommentaryDummy)0x0) && (this[0x489] == (CCommentaryDummy)0x0)) {
    if (*(float *)(this + 0x490) == 0.0) {
      local_90 = 0x3e10a8;
      CBaseAnimating::ResetSequenceInfo((CBaseAnimating *)this);
    }
    else {
      if (this[0x6c] == (CCommentaryDummy)0x0) {
        this_00 = *(CBaseEdict **)(this + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          local_90 = 0x3e130e;
          iVar9 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar9 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CCommentaryDummy)((byte)this[0x70] | 1);
      }
      *(undefined4 *)(this + 0x490) = 0;
      local_90 = 0x3e1324;
      CBaseAnimating::ResetSequenceInfo((CBaseAnimating *)this);
    }
  }
  pCVar6 = *(CStudioHdr **)(this + 0x13e0);
  fVar13 = *(float *)(this + 0x490);
  iVar9 = *(int *)(this + 0x494);
  if (pCVar6 == (CStudioHdr *)0x0) {
    local_90 = 0x3e143d;
    iVar5 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar5 == 0) {
      pCVar6 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      local_90 = 0x3e144d;
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar6 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar8 = (CStudioHdr *)0x0;
    if (pCVar6 != (CStudioHdr *)0x0) goto LAB_003e0f0b;
  }
  else {
LAB_003e0f0b:
    pCVar8 = (CStudioHdr *)0x0;
    if (*(int *)pCVar6 != 0) {
      pCVar8 = pCVar6;
    }
  }
  local_90 = 0x3e0f24;
  lVar11 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar8,iVar9);
  fVar13 = (float)lVar11 * (1.0 - fVar13);
  if (0.1 <= fVar13) {
    fVar13 = 0.1;
  }
  local_90 = 0x3e0f59;
  CBaseEntity::SetNextThink((CBaseEntity *)this,fVar13 + *(float *)(gpGlobals + 0xc),(char *)0x0);
  local_90 = 0x3e0f64;
  (**(code **)(*(int *)this + 0x32c))();
  local_90 = 0x3e0f73;
  (**(code **)(*(int *)this + 0x364))();
  local_90 = 0x3e0f95;
  (**(code **)(*(int *)this + 0x24c))();
  local_90 = 0x3e0fa7;
  (**(code **)(*(int *)this + 0x234))();
  piVar10 = &local_90;
  if (*(int *)(gpGlobals + 0x14) < 1) {
LAB_003e10b0:
    CVar1 = this[0x1a64];
    local_54 = local_48 * 64.0 + local_3c;
    local_50 = local_44 * 64.0 + local_38;
    local_58 = local_4c * 64.0 + local_40;
  }
  else {
    local_60 = (int *)0x0;
    iVar9 = 1;
    local_70 = 3.4028235e+38;
    piVar7 = &local_90;
    do {
      *piVar7 = iVar9;
      piVar7[-1] = 0x3e1000;
      piVar4 = (int *)UTIL_PlayerByIndex(*piVar7);
      piVar10 = piVar7;
      if (((piVar4 != (int *)0x0) && (piVar4[0xc] != 0)) &&
         (piVar4[0xc] - *(int *)(gpGlobals + 0x58) >> 4 != 0)) {
        iVar5 = *piVar4;
        *piVar7 = (int)piVar4;
        pcVar2 = *(code **)(iVar5 + 0x16c);
        piVar7[-1] = 0x3e1028;
        cVar3 = (*pcVar2)();
        if ((cVar3 != '\0') && (piVar4[0x7db] != 2)) {
          *piVar7 = (int)piVar4;
          piVar7[-1] = 0x3e103d;
          iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)*piVar7);
          if (iVar5 == 2) {
            iVar5 = *piVar4;
            piVar7[1] = (int)piVar4;
            *piVar7 = (int)&local_28;
            pcVar2 = *(code **)(iVar5 + 0x234);
            piVar7[-1] = 0x3e133b;
            (*pcVar2)();
            fVar13 = (local_20 - local_38) * (local_20 - local_38) +
                     (local_24 - local_3c) * (local_24 - local_3c) +
                     (local_28 - local_40) * (local_28 - local_40);
            piVar10 = piVar7 + -1;
            if (fVar13 < local_70) {
              iVar5 = *piVar4;
              *piVar7 = (int)piVar4;
              piVar7[-1] = (int)&local_28;
              pcVar2 = *(code **)(iVar5 + 0x234);
              piVar7[-2] = 0x3e1395;
              (*pcVar2)();
              piVar7[-2] = (int)&local_34;
              local_34 = local_28 - local_40;
              local_30 = local_24 - local_3c;
              local_2c = local_20 - local_38;
              piVar7[-3] = 0x3e13d0;
              VectorNormalize((Vector *)piVar7[-2]);
              fVar14 = local_48 * local_30 + local_4c * local_34 + local_44 * local_2c;
              uVar12 = -(uint)(fVar14 < 0.2);
              if (fVar14 < 0.2) {
                piVar4 = local_60;
              }
              local_70 = (float)(~uVar12 & (uint)fVar13 | (uint)local_70 & uVar12);
              piVar10 = piVar7 + -2;
              local_60 = piVar4;
            }
          }
        }
      }
      iVar9 = iVar9 + 1;
      piVar7 = piVar10;
    } while (iVar9 <= *(int *)(gpGlobals + 0x14));
    if (local_60 == (int *)0x0) goto LAB_003e10b0;
    iVar9 = *local_60;
    piVar10[1] = (int)local_60;
    *piVar10 = (int)&local_58;
    pcVar2 = *(code **)(iVar9 + 0x234);
    piVar10[-1] = 0x3e1077;
    (*pcVar2)();
    piVar10 = piVar10 + -1;
    CVar1 = this[0x1a64];
  }
  if (CVar1 == (CCommentaryDummy)0x0) {
    return;
  }
  iVar9 = *(int *)this;
  piVar10[1] = (int)this;
  *piVar10 = (int)&local_34;
  pcVar2 = *(code **)(iVar9 + 0x234);
  piVar10[-1] = 0x3e1108;
  (*pcVar2)();
  fVar16 = local_30;
  fVar14 = local_34;
  fVar13 = local_58;
  piVar10[-1] = (int)&local_28;
  fVar17 = local_2c;
  local_28 = fVar13 - fVar14;
  local_24 = local_54 - fVar16;
  local_20 = local_50 - local_2c;
  piVar10[-2] = 0x3e115e;
  lVar11 = (longdouble)UTIL_VecToYaw((Vector *)piVar10[-1]);
  fVar13 = (float)lVar11 - *(float *)(this + 0x3ac);
  if (180.0 < fVar13) {
    fVar13 = fVar13 - 360.0;
  }
  if (fVar13 < -180.0) {
    fVar13 = fVar13 + 360.0;
  }
  iVar9 = *(int *)(this + 0x1a4c);
  piVar7 = *(int **)(this + 0x13e0);
  fVar15 = *(float *)(gpGlobals + 0xc) - *(float *)(this + 0x1a48);
  *(float *)(this + 0x1a48) = *(float *)(gpGlobals + 0xc);
  fVar15 = fVar15 + fVar15;
  if (1.0 <= fVar15) {
    fVar15 = 1.0;
  }
  fVar13 = (fVar13 - *(float *)(this + 0x1a40)) * fVar15 + *(float *)(this + 0x1a40);
  *(float *)(this + 0x1a40) = fVar13;
  if (piVar7 == (int *)0x0) {
    piVar10[-1] = (int)this;
    piVar10[-2] = 0x3e147d;
    iVar5 = CBaseEntity::GetModel((CBaseEntity *)piVar10[-1]);
    if (iVar5 == 0) {
      piVar7 = *(int **)(this + 0x13e0);
    }
    else {
      piVar10[-1] = (int)this;
      piVar10[-2] = 0x3e149d;
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)piVar10[-1]);
      piVar7 = *(int **)(this + 0x13e0);
    }
    piVar4 = (int *)0x0;
    if (piVar7 != (int *)0x0) goto LAB_003e11e9;
  }
  else {
LAB_003e11e9:
    piVar4 = (int *)0x0;
    if (*piVar7 != 0) {
      piVar4 = piVar7;
    }
  }
  piVar10[2] = (int)fVar13;
  piVar10[1] = iVar9;
  *piVar10 = (int)piVar4;
  piVar10[-1] = (int)this;
  piVar10[-2] = 0x3e120d;
  CBaseAnimating::SetPoseParameter
            ((CBaseAnimating *)piVar10[-1],(CStudioHdr *)*piVar10,piVar10[1],(float)piVar10[2]);
  fVar17 = local_50 - fVar17;
  fVar14 = local_58 - fVar14;
  fVar16 = local_54 - fVar16;
  piVar10[-1] = (int)(fVar17 / SQRT(fVar14 * fVar14 + fVar17 * fVar17 + fVar16 * fVar16));
  piVar10[-2] = 0x3e1260;
  fVar13 = atanf((float)piVar10[-1]);
  piVar7 = *(int **)(this + 0x13e0);
  iVar9 = *(int *)(this + 0x1a50);
  fVar13 = *(float *)(this + 0x1a44) - (fVar13 * 57.295776 + *(float *)(this + 0x1a44)) * fVar15;
  *(float *)(this + 0x1a44) = fVar13;
  if (piVar7 == (int *)0x0) {
    piVar10[-1] = (int)this;
    piVar10[-2] = 0x3e14c9;
    iVar5 = CBaseEntity::GetModel((CBaseEntity *)piVar10[-1]);
    if (iVar5 == 0) {
      piVar7 = *(int **)(this + 0x13e0);
    }
    else {
      piVar10[-1] = (int)this;
      piVar10[-2] = 0x3e14df;
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)piVar10[-1]);
      piVar7 = *(int **)(this + 0x13e0);
    }
    piVar4 = (int *)0x0;
    if (piVar7 == (int *)0x0) goto LAB_003e12ae;
  }
  piVar4 = (int *)0x0;
  if (*piVar7 != 0) {
    piVar4 = piVar7;
  }
LAB_003e12ae:
  piVar10[2] = (int)fVar13;
  piVar10[1] = iVar9;
  *piVar10 = (int)piVar4;
  piVar10[-1] = (int)this;
  piVar10[-2] = 0x3e12c4;
  CBaseAnimating::SetPoseParameter
            ((CBaseAnimating *)piVar10[-1],(CStudioHdr *)*piVar10,piVar10[1],(float)piVar10[2]);
  iVar9 = *(int *)this;
  piVar10[-1] = (int)this;
  *piVar10 = (int)&local_58;
  pcVar2 = *(code **)(iVar9 + 0x3a4);
  piVar10[-2] = 0x3e12d8;
  (*pcVar2)();
  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)