L L4D2node

CBasePlayerAnimState::DebugShowAnimState

0x00422050 · 2756 bytes · __thiscall

_ZN20CBasePlayerAnimState18DebugShowAnimStateEi

Decompiled

undefined (2 params)

/* CBasePlayerAnimState::DebugShowAnimState(int) */

int __thiscall CBasePlayerAnimState::DebugShowAnimState(CBasePlayerAnimState *this,int param_1)

{
  int iVar1;
  float fVar2;
  float fVar3;
  CBaseEntity *pCVar4;
  uint uVar5;
  code *pcVar6;
  undefined4 uVar7;
  CBaseAnimatingOverlay *this_00;
  uint *puVar8;
  undefined *puVar9;
  int iVar10;
  CStudioHdr *pCVar11;
  int iVar12;
  int *piVar13;
  int iVar14;
  uint uVar15;
  uint uVar16;
  CStudioHdr *pCVar17;
  int *piVar18;
  CBaseEntity *this_01;
  longdouble lVar19;
  double dVar20;
  double dVar21;
  float fVar22;
  double local_9c;
  int local_80;
  float local_7c;
  float local_78;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  Vector local_4c [12];
  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;
  
  GetOuterAbsVelocity(this,(Vector *)&local_7c);
  pCVar4 = *(CBaseEntity **)(this + 0x14);
  fVar2 = *(float *)(pCVar4 + 0x528);
  if (fVar2 < 0.0) {
    local_9c = (double)*(float *)(pCVar4 + 0x468);
  }
  else if (fVar2 <= 1.0) {
    local_9c = (double)((1.0 - fVar2) * *(float *)(pCVar4 + 0x468));
  }
  else {
    local_9c = 0.0;
  }
  pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
  iVar12 = *(int *)(pCVar4 + 0x494);
  this_01 = pCVar4;
  if (pCVar11 == (CStudioHdr *)0x0) {
    iVar14 = CBaseEntity::GetModel(pCVar4);
    if (iVar14 == 0) {
      this_01 = *(CBaseEntity **)(this + 0x14);
      pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar4);
      this_01 = *(CBaseEntity **)(this + 0x14);
      pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
    }
    pCVar17 = (CStudioHdr *)0x0;
    if (pCVar11 != (CStudioHdr *)0x0) goto LAB_004220c1;
  }
  else {
LAB_004220c1:
    pCVar17 = (CStudioHdr *)0x0;
    if (*(int *)pCVar11 != 0) {
      pCVar17 = pCVar11;
    }
  }
  lVar19 = (longdouble)
           CBaseAnimating::GetSequenceCycleRate((CBaseAnimating *)this_01,pCVar17,iVar12);
  pCVar4 = *(CBaseEntity **)(this + 0x14);
  fVar2 = *(float *)(pCVar4 + 0x490);
  iVar12 = *(int *)(pCVar4 + 0x494);
  pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
  if (*(int *)(showanimstate_activities._28_4_ + 0x30) == 0) {
    if (pCVar11 == (CStudioHdr *)0x0) {
      iVar14 = CBaseEntity::GetModel(pCVar4);
      if (iVar14 == 0) {
        pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
      }
      else {
        CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar4);
        pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
      }
      pCVar17 = (CStudioHdr *)0x0;
      if (pCVar11 != (CStudioHdr *)0x0) goto LAB_00422148;
    }
    else {
LAB_00422148:
      pCVar17 = (CStudioHdr *)0x0;
      if (*(int *)pCVar11 != 0) {
        pCVar17 = pCVar11;
      }
    }
    uVar7 = GetSequenceName(pCVar17,iVar12);
  }
  else {
    if (pCVar11 == (CStudioHdr *)0x0) {
      iVar14 = CBaseEntity::GetModel(pCVar4);
      if (iVar14 == 0) {
        pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
      }
      else {
        CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar4);
        pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
      }
      pCVar17 = (CStudioHdr *)0x0;
      if (pCVar11 != (CStudioHdr *)0x0) goto LAB_00422126;
    }
    else {
LAB_00422126:
      pCVar17 = (CStudioHdr *)0x0;
      if (*(int *)pCVar11 != 0) {
        pCVar17 = pCVar11;
      }
    }
    uVar7 = GetSequenceActivityName(pCVar17,iVar12);
  }
  AnimStatePrintf(this,param_1,"main: %s(%d), cycle: %.2f cyclerate: %.2f playbackrate: %.2f\n",
                  uVar7,iVar12,SUB84((double)fVar2,0),(int)((ulonglong)(double)fVar2 >> 0x20),
                  SUB84((double)(float)lVar19,0),(int)((ulonglong)(double)(float)lVar19 >> 0x20),
                  SUB84(local_9c,0),(int)((ulonglong)local_9c >> 0x20));
  local_80 = param_1 + 1;
  if (*(int *)(this + 0xc) == 1) {
    iVar12 = CBaseAnimatingOverlay::GetAnimOverlay(*(CBaseAnimatingOverlay **)(this + 0x14),0);
    pCVar4 = *(CBaseEntity **)(this + 0x14);
    fVar2 = *(float *)(iVar12 + 0x14);
    iVar12 = *(int *)(iVar12 + 8);
    pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
    if (pCVar11 == (CStudioHdr *)0x0) {
      iVar14 = CBaseEntity::GetModel(pCVar4);
      if (iVar14 == 0) {
        pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
      }
      else {
        CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar4);
        pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
      }
      pCVar17 = (CStudioHdr *)0x0;
      if (pCVar11 != (CStudioHdr *)0x0) goto LAB_00422867;
    }
    else {
LAB_00422867:
      pCVar17 = (CStudioHdr *)0x0;
      if (*(int *)pCVar11 != 0) {
        pCVar17 = pCVar11;
      }
    }
    uVar7 = GetSequenceName(pCVar17,iVar12);
    local_80 = param_1 + 2;
    AnimStatePrintf(this,param_1 + 1,"idle: %s, weight: %.2f\n",uVar7,SUB84((double)fVar2,0),
                    (int)((ulonglong)(double)fVar2 >> 0x20));
  }
  this_00 = *(CBaseAnimatingOverlay **)(this + 0x14);
  if (1 < *(int *)(this_00 + 0x1400)) {
    iVar12 = local_80;
    iVar14 = 0;
    do {
      iVar1 = iVar14 + 1;
      puVar8 = (uint *)CBaseAnimatingOverlay::GetAnimOverlay(this_00,iVar1);
      uVar15 = *puVar8;
      if ((uVar15 & 1) == 0) {
        dVar20 = 0.0;
        uVar16 = 0;
        uVar15 = 0;
        puVar9 = &DAT_00c0af50;
        uVar5 = 0;
        dVar21 = dVar20;
      }
      else {
        uVar5 = puVar8[0xf];
        uVar16 = puVar8[2];
        dVar21 = (double)(float)puVar8[3];
        dVar20 = (double)(float)puVar8[5];
        if (uVar16 == 0) {
          uVar16 = 0;
          puVar9 = &DAT_00c0af50;
        }
        else {
          pCVar4 = *(CBaseEntity **)(this + 0x14);
          pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
          if (*(int *)(showanimstate_activities._28_4_ + 0x30) == 0) {
            if (pCVar11 == (CStudioHdr *)0x0) {
              iVar10 = CBaseEntity::GetModel(pCVar4);
              if (iVar10 == 0) {
                pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
              }
              else {
                CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar4);
                pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
              }
              pCVar17 = (CStudioHdr *)0x0;
              if (pCVar11 != (CStudioHdr *)0x0) goto LAB_00422328;
            }
            else {
LAB_00422328:
              pCVar17 = (CStudioHdr *)0x0;
              if (*(int *)pCVar11 != 0) {
                pCVar17 = pCVar11;
              }
            }
            puVar9 = (undefined *)GetSequenceName(pCVar17,uVar16);
          }
          else {
            if (pCVar11 == (CStudioHdr *)0x0) {
              iVar10 = CBaseEntity::GetModel(pCVar4);
              if (iVar10 == 0) {
                pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
              }
              else {
                CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar4);
                pCVar11 = *(CStudioHdr **)(pCVar4 + 0x13e0);
              }
              pCVar17 = (CStudioHdr *)0x0;
              if (pCVar11 != (CStudioHdr *)0x0) goto LAB_0042222a;
            }
            else {
LAB_0042222a:
              pCVar17 = (CStudioHdr *)0x0;
              if (*(int *)pCVar11 != 0) {
                pCVar17 = pCVar11;
              }
            }
            puVar9 = (undefined *)GetSequenceActivityName(pCVar17,uVar16);
          }
        }
      }
      local_80 = iVar12 + 1;
      AnimStatePrintf(this,iVar12,
                      "%s(%d), flags (%d), weight: %.2f, cycle: %.2f, order (%d), aim (%d)",puVar9,
                      uVar16,uVar15,SUB84(dVar20,0),(int)((ulonglong)dVar20 >> 0x20),SUB84(dVar21,0)
                      ,(int)((ulonglong)dVar21 >> 0x20),uVar5,iVar14);
      this_00 = *(CBaseAnimatingOverlay **)(this + 0x14);
      iVar12 = local_80;
      iVar14 = iVar1;
    } while (iVar1 < *(int *)(this_00 + 0x1400) + -1);
  }
  uVar7 = *(undefined4 *)(this_00 + 0x494);
  pcVar6 = *(code **)(*(int *)this_00 + 0x33c);
  piVar13 = *(int **)(this_00 + 0x13e0);
  if (piVar13 == (int *)0x0) {
    iVar12 = CBaseEntity::GetModel((CBaseEntity *)this_00);
    if (iVar12 == 0) {
      piVar13 = *(int **)(this_00 + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this_00);
      piVar13 = *(int **)(this_00 + 0x13e0);
    }
    piVar18 = (int *)0x0;
    if (piVar13 == (int *)0x0) goto LAB_00422399;
  }
  piVar18 = (int *)0x0;
  if (*piVar13 != 0) {
    piVar18 = piVar13;
  }
LAB_00422399:
  lVar19 = (longdouble)(*pcVar6)(this_00,piVar18,uVar7);
  dVar21 = (double)SQRT(local_78 * local_78 + local_7c * local_7c);
  AnimStatePrintf(this,local_80,"vel: %.2f, time: %.2f, max: %.2f, animspeed: %.2f",SUB84(dVar21,0),
                  (int)((ulonglong)dVar21 >> 0x20),SUB84((double)*(float *)(gpGlobals + 0xc),0),
                  (int)((ulonglong)(double)*(float *)(gpGlobals + 0xc) >> 0x20),
                  SUB84((double)*(float *)(this + 0x90),0),
                  (int)((ulonglong)(double)*(float *)(this + 0x90) >> 0x20),
                  SUB84((double)(float)lVar19,0),(int)((ulonglong)(double)(float)lVar19 >> 0x20));
  if (*(int *)(this + 0xc) == 1) {
    AnimStatePrintf(this,local_80 + 1,
                    "ent yaw: %.2f, body_yaw: %.2f, move_yaw: %.2f, gait_yaw: %.2f, body_pitch: %.2f"
                    ,SUB84((double)*(float *)(this + 0x70),0),
                    (int)((ulonglong)(double)*(float *)(this + 0x70) >> 0x20),
                    SUB84((double)g_flLastBodyYaw,0),
                    (int)((ulonglong)(double)g_flLastBodyYaw >> 0x20),
                    SUB84((double)*(float *)(this + 0x8c),0),
                    (int)((ulonglong)(double)*(float *)(this + 0x8c) >> 0x20),
                    SUB84((double)*(float *)(this + 0xa4),0),
                    (int)((ulonglong)(double)*(float *)(this + 0xa4) >> 0x20),
                    (double)g_flLastBodyPitch);
  }
  else {
    AnimStatePrintf(this,local_80 + 1,
                    "ent yaw: %.2f, body_yaw: %.2f, body_pitch: %.2f, move_x: %.2f, move_y: %.2f",
                    SUB84((double)*(float *)(this + 0x70),0),
                    (int)((ulonglong)(double)*(float *)(this + 0x70) >> 0x20),
                    SUB84((double)g_flLastBodyYaw,0),
                    (int)((ulonglong)(double)g_flLastBodyYaw >> 0x20),
                    SUB84((double)g_flLastBodyPitch,0),
                    (int)((ulonglong)(double)g_flLastBodyPitch >> 0x20),
                    SUB84((double)*(float *)(this + 0x78),0),
                    (int)((ulonglong)(double)*(float *)(this + 0x78) >> 0x20),
                    (double)*(float *)(this + 0x7c));
  }
  pCVar4 = *(CBaseEntity **)(this + 0x14);
  if (((byte)pCVar4[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(pCVar4);
  }
  local_70 = 0;
  local_6c = *(undefined4 *)(this + 0x1c);
  local_68 = 0;
  fVar2 = *(float *)(pCVar4 + 0x2e0);
  fVar3 = *(float *)(pCVar4 + 0x2e4);
  fVar22 = *(float *)(pCVar4 + 0x2e8) + 3.0;
  AngleVectors((QAngle *)&local_70,(Vector *)&local_64,(Vector *)&local_58,local_4c);
  local_20 = local_5c * 80.0 + fVar22;
  local_28 = local_64 * 80.0 + fVar2;
  local_24 = local_60 * 80.0 + fVar3;
  local_34 = fVar2 - local_58 * 5.0;
  local_40 = local_58 * 5.0 + fVar2;
  local_30 = fVar3 - local_54 * 5.0;
  local_3c = local_54 * 5.0 + fVar3;
  local_2c = fVar22 - local_50 * 5.0;
  local_38 = local_50 * 5.0 + fVar22;
  (**(code **)(*debugoverlay + 8))
            (debugoverlay,&local_40,&local_34,&local_28,0xff,0,0,0xff,0,0x3c23d70a);
  local_6c = *(undefined4 *)(this + 0x70);
  AngleVectors((QAngle *)&local_70,(Vector *)&local_64,(Vector *)&local_58,local_4c);
  fVar22 = fVar22 + 0.5;
  local_20 = local_5c * 80.0 + fVar22;
  local_28 = local_64 * 80.0 + fVar2;
  local_24 = local_60 * 80.0 + fVar3;
  local_34 = fVar2 - local_58 * 5.0;
  local_40 = fVar2 + local_58 * 5.0;
  local_3c = fVar3 + local_54 * 5.0;
  local_30 = fVar3 - local_54 * 5.0;
  local_38 = fVar22 + local_50 * 5.0;
  local_2c = fVar22 - local_50 * 5.0;
  (**(code **)(*debugoverlay + 8))
            (debugoverlay,&local_40,&local_34,&local_28,0,0,0xff,0xff,0,0x3c23d70a);
  return local_80 + 2;
}

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)