L L4D2node

CBaseAnimating::DispatchAnimEvents

0x005e3bc0 · 851 bytes · __thiscall

_ZN14CBaseAnimating18DispatchAnimEventsEPS_

Decompiled

undefined (2 params)

/* CBaseAnimating::DispatchAnimEvents(CBaseAnimating*) */

void __thiscall CBaseAnimating::DispatchAnimEvents(CBaseAnimating *this,CBaseAnimating *param_1)

{
  undefined4 uVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  CStudioHdr *pCVar5;
  undefined4 uVar6;
  CStudioHdr *pCVar7;
  CStudioHdr *this_00;
  longdouble lVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  float local_4c;
  float local_48;
  animevent_t local_34 [8];
  float local_2c;
  float local_28;
  CBaseAnimating *local_20;
  
  fVar11 = *(float *)(this + 0x528);
  if (fVar11 < 0.0) {
    fVar11 = 1.0;
  }
  else {
    if (1.0 < fVar11) {
      return;
    }
    fVar11 = 1.0 - fVar11;
  }
  if (*(float *)(this + 0x468) * fVar11 == 0.0) {
    return;
  }
  this_00 = *(CStudioHdr **)(this + 0x13e0);
  if (this_00 == (CStudioHdr *)0x0) {
    iVar3 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar3 == 0) {
      this_00 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      LockStudioHdr(this);
      this_00 = *(CStudioHdr **)(this + 0x13e0);
    }
    if (this_00 == (CStudioHdr *)0x0) {
      return;
    }
  }
  if (*(int *)this_00 == 0) {
    return;
  }
  cVar2 = CStudioHdr::SequencesAvailable(this_00);
  if (cVar2 == '\0') {
    return;
  }
  iVar3 = CStudioHdr::pSeqdesc(this_00,*(int *)(this + 0x494));
  if (*(int *)(iVar3 + 0x18) == 0) {
    return;
  }
  pCVar5 = *(CStudioHdr **)(this + 0x13e0);
  iVar3 = *(int *)(this + 0x494);
  if (pCVar5 == (CStudioHdr *)0x0) {
    iVar4 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar4 == 0) {
      pCVar5 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      LockStudioHdr(this);
      pCVar5 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar7 = (CStudioHdr *)0x0;
    if (pCVar5 != (CStudioHdr *)0x0) goto LAB_005e3c70;
  }
  else {
LAB_005e3c70:
    pCVar7 = (CStudioHdr *)0x0;
    if (*(int *)pCVar5 != 0) {
      pCVar7 = pCVar5;
    }
  }
  lVar8 = (longdouble)SequenceDuration(this,pCVar7,iVar3);
  if ((float)lVar8 <= 0.0) {
    local_4c = 10.0;
  }
  else {
    local_4c = 1.0 / (float)lVar8;
  }
  fVar11 = *(float *)(this + 0x528);
  fVar10 = *(float *)(this + 0x468);
  if (0.0 <= fVar11) {
    if (1.0 < fVar11) {
      local_4c = 0.0;
      goto LAB_005e3cda;
    }
    fVar10 = fVar10 * (1.0 - fVar11);
  }
  local_4c = local_4c * fVar10;
LAB_005e3cda:
  fVar11 = *(float *)(this + 0x444);
  local_48 = *(float *)(this + 0x490);
  if ((this[0x489] == (CBaseAnimating)0x0) && (this[0x488] != (CBaseAnimating)0x0)) {
    local_48 = 1.01;
  }
  iVar3 = 0;
  *(float *)(this + 0x444) = local_48;
  do {
    iVar3 = GetAnimationEvent(this_00,*(int *)(this + 0x494),local_34,fVar11,local_48,iVar3);
    if (iVar3 == 0) {
      return;
    }
    local_20 = this;
    if (0.0 < local_4c) {
      fVar10 = *(float *)(this + 0x490);
      fVar9 = local_2c;
      if (fVar10 < local_2c) {
        fVar9 = local_2c - 1.0;
      }
      lVar8 = (longdouble)GetAnimTimeInterval(this);
      local_28 = (float)lVar8 + *(float *)(this + 0x90) + (fVar9 - fVar10) * (1.0 / local_4c);
    }
    (**(code **)(*(int *)param_1 + 0x368))(param_1,local_34);
    pCVar5 = *(CStudioHdr **)(this + 0x13e0);
    if (pCVar5 == (CStudioHdr *)0x0) {
      iVar4 = CBaseEntity::GetModel((CBaseEntity *)this);
      if (iVar4 == 0) {
        pCVar5 = *(CStudioHdr **)(this + 0x13e0);
      }
      else {
        LockStudioHdr(this);
        pCVar5 = *(CStudioHdr **)(this + 0x13e0);
      }
      if (pCVar5 == (CStudioHdr *)0x0) {
LAB_005e3e36:
        uVar1 = *(undefined4 *)(this + 0x494);
        uVar6 = CBaseEntity::GetDebugName((CBaseEntity *)this);
        Warning("%s has changed its model while processing AnimEvents on sequence %d. Aborting dispatch.\n"
                ,uVar6,uVar1);
        return;
      }
    }
    if ((*(int *)pCVar5 == 0) || (pCVar5 != this_00)) goto LAB_005e3e36;
  } while( true );
}

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)