L L4D2node

CBaseFlex::HandleStartGestureSceneEvent

0x00624e10 · 2360 bytes · __thiscall

_ZN9CBaseFlex28HandleStartGestureSceneEventEP15CSceneEventInfoP12CChoreoSceneP12CChoreoEventP12CChoreoActor

Decompiled

undefined (5 params)

/* CBaseFlex::HandleStartGestureSceneEvent(CSceneEventInfo*, CChoreoScene*, CChoreoEvent*,
   CChoreoActor*) */

undefined4 __thiscall
CBaseFlex::HandleStartGestureSceneEvent
          (CBaseFlex *this,CSceneEventInfo *param_1,CChoreoScene *param_2,CChoreoEvent *param_3,
          CChoreoActor *param_4)

{
  code *pcVar1;
  char cVar2;
  char *pcVar3;
  int iVar4;
  KeyValues *pKVar5;
  KeyValues *pKVar6;
  CEventAbsoluteTag *pCVar7;
  int iVar8;
  CChoreoChannel *pCVar9;
  int iVar10;
  uint uVar11;
  undefined4 uVar12;
  CStudioHdr *pCVar13;
  CStudioHdr *pCVar14;
  int iVar15;
  undefined4 *puVar16;
  undefined4 *puVar17;
  int in_GS_OFFSET;
  byte bVar18;
  longdouble lVar19;
  longdouble lVar20;
  longdouble lVar21;
  float fVar22;
  undefined4 local_120;
  undefined4 local_11c;
  undefined4 local_118 [30];
  undefined4 local_a0;
  undefined4 local_9c [31];
  int local_20;
  
  bVar18 = 0;
  puVar17 = (undefined4 *)&stack0xfffffe74;
  puVar16 = (undefined4 *)&stack0xfffffe74;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar3 = (char *)CChoreoEvent::GetParameters(param_3);
  iVar4 = CBaseAnimating::LookupSequence((CBaseAnimating *)this,pcVar3);
  *(undefined4 *)(param_1 + 0x14) = 0xffffffff;
  *(int *)(param_1 + 0x1c) = iVar4;
  if (iVar4 < 0) {
    CChoreoEvent::GetParameters(param_3);
    CChoreoActor::GetName(param_4);
    Warning();
    uVar12 = 0;
    goto LAB_006255d6;
  }
  param_1[0x20] = (CSceneEventInfo)0x0;
  pKVar5 = (KeyValues *)CBaseAnimating::GetSequenceKeyValues((CBaseAnimating *)this,iVar4);
  if (pKVar5 != (KeyValues *)0x0) {
    pKVar5 = (KeyValues *)KeyValues::FindKey(pKVar5,"faceposer",false);
    if ((pKVar5 != (KeyValues *)0x0) &&
       (pKVar6 = (KeyValues *)KeyValues::FindKey(pKVar5,"type",false), pKVar6 != (KeyValues *)0x0))
    {
      pcVar3 = (char *)KeyValues::GetString(pKVar6,(char *)0x0,"");
      iVar4 = _V_stricmp(pcVar3,"gesture");
      param_1[0x20] = (CSceneEventInfo)(iVar4 == 0);
    }
    puVar17 = local_118;
    for (iVar4 = 0x1e; iVar4 != 0; iVar4 = iVar4 + -1) {
      *puVar17 = 0;
      puVar17 = puVar17 + (uint)bVar18 * -2 + 1;
    }
    local_120 = 0x706f6f6c;
    local_11c = 0;
    local_a0 = 0x646e65;
    puVar17 = local_9c;
    for (iVar4 = 0x1f; iVar4 != 0; iVar4 = iVar4 + -1) {
      *puVar17 = 0;
      puVar17 = puVar17 + (uint)bVar18 * -2 + 1;
    }
    for (pKVar6 = (KeyValues *)KeyValues::GetFirstSubKey(pKVar5); pKVar6 != (KeyValues *)0x0;
        pKVar6 = (KeyValues *)KeyValues::GetNextKey(pKVar6)) {
      pcVar3 = (char *)KeyValues::GetName(pKVar6);
      iVar4 = _V_stricmp(pcVar3,"startloop");
      if (iVar4 == 0) {
        pcVar3 = (char *)KeyValues::GetString(pKVar6,(char *)0x0,"");
        strcpy((char *)&local_120,pcVar3);
      }
      else {
        pcVar3 = (char *)KeyValues::GetName(pKVar6);
        iVar4 = _V_stricmp(pcVar3,"endloop");
        if (iVar4 == 0) {
          pcVar3 = (char *)KeyValues::GetString(pKVar6,(char *)0x0,"");
          strcpy((char *)&local_a0,pcVar3);
        }
      }
    }
    pCVar7 = (CEventAbsoluteTag *)CChoreoEvent::FindAbsoluteTag();
    if (pCVar7 != (CEventAbsoluteTag *)0x0) {
      CEventAbsoluteTag::SetLinear(pCVar7,true);
    }
    pCVar7 = (CEventAbsoluteTag *)CChoreoEvent::FindAbsoluteTag();
    if (pCVar7 != (CEventAbsoluteTag *)0x0) {
      CEventAbsoluteTag::SetLinear(pCVar7,true);
    }
    pCVar7 = (CEventAbsoluteTag *)CChoreoEvent::FindAbsoluteTag();
    if (pCVar7 != (CEventAbsoluteTag *)0x0) {
      CEventAbsoluteTag::SetLinear(pCVar7,true);
    }
    pCVar7 = (CEventAbsoluteTag *)CChoreoEvent::FindAbsoluteTag();
    if (pCVar7 != (CEventAbsoluteTag *)0x0) {
      CEventAbsoluteTag::SetLinear(pCVar7,true);
    }
    if (pKVar5 != (KeyValues *)0x0) {
      pCVar13 = *(CStudioHdr **)(this + 0x13e0);
      if (pCVar13 == (CStudioHdr *)0x0) {
        iVar4 = CBaseEntity::GetModel((CBaseEntity *)this);
        if (iVar4 == 0) {
          pCVar13 = *(CStudioHdr **)(this + 0x13e0);
        }
        else {
          CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
          pCVar13 = *(CStudioHdr **)(this + 0x13e0);
        }
        pCVar14 = (CStudioHdr *)0x0;
        if (pCVar13 != (CStudioHdr *)0x0) goto LAB_0062504a;
      }
      else {
LAB_0062504a:
        pCVar14 = (CStudioHdr *)0x0;
        if (*(int *)pCVar13 != 0) {
          pCVar14 = pCVar13;
        }
      }
      iVar8 = CStudioHdr::pSeqdesc(pCVar14,*(int *)(param_1 + 0x1c));
      iVar4 = *(int *)(iVar8 + 0x44);
      iVar10 = 0;
      if (iVar4 < 1) {
        iVar10 = iVar4 + -1;
      }
      iVar15 = 0;
      if (*(int *)(iVar8 + 0x48) < 1) {
        iVar15 = (*(int *)(iVar8 + 0x48) + -1) * iVar4;
      }
      iVar4 = CStudioHdr::iRelativeAnim
                        (pCVar14,*(int *)(param_1 + 0x1c),
                         (int)*(short *)(iVar8 + (iVar10 + iVar15) * 2 + *(int *)(iVar8 + 0x3c)));
      iVar4 = CStudioHdr::pAnimdesc(pCVar14,iVar4);
      for (pKVar5 = (KeyValues *)KeyValues::GetFirstSubKey(pKVar5); pKVar5 != (KeyValues *)0x0;
          pKVar5 = (KeyValues *)KeyValues::GetNextKey(pKVar5)) {
        pcVar3 = (char *)KeyValues::GetName(pKVar5);
        iVar10 = _V_stricmp(pcVar3,"tags");
        if (iVar10 == 0) {
          for (pKVar6 = (KeyValues *)KeyValues::GetFirstSubKey(pKVar5); pKVar6 != (KeyValues *)0x0;
              pKVar6 = (KeyValues *)KeyValues::GetNextKey(pKVar6)) {
            iVar10 = *(int *)(iVar4 + 0x10) + -2;
            if (0 < iVar10) {
              iVar8 = KeyValues::GetInt(pKVar6,(char *)0x0,0);
              KeyValues::GetName(pKVar6);
              pCVar7 = (CEventAbsoluteTag *)CChoreoEvent::FindAbsoluteTag();
              if (pCVar7 != (CEventAbsoluteTag *)0x0) {
                fVar22 = (float)iVar8 / (float)iVar10;
                lVar19 = (longdouble)CEventAbsoluteTag::GetPercentage(pCVar7);
                if (0.05 < ABS((float)lVar19 - fVar22)) {
                  CChoreoEvent::GetParameters(param_3);
                  CChoreoActor::GetName(param_4);
                  CChoreoScene::GetFilename(param_2);
                  CEventAbsoluteTag::GetPercentage(pCVar7);
                  KeyValues::GetName(pKVar6);
                  CChoreoScene::GetFilename(param_2);
                  DevWarning("%s repositioned tag: %s : %.3f -> %.3f (%s:%s:%s)\n");
                  CEventAbsoluteTag::SetPercentage(pCVar7,fVar22);
                }
              }
            }
          }
        }
      }
      cVar2 = CChoreoEvent::VerifyTagOrder(param_3);
      if (cVar2 == '\0') {
        CChoreoEvent::GetParameters(param_3);
        CChoreoEvent::GetName(param_3);
        CChoreoActor::GetName(param_4);
        CChoreoScene::GetFilename(param_2);
        DevWarning("out of order tags : %s : (%s:%s:%s)\n");
      }
    }
    KeyValues::deleteThis();
  }
  if ((param_1[0x20] == (CSceneEventInfo)0x0) &&
     (cVar2 = (**(code **)(*(int *)this + 0x154))(), cVar2 != '\0')) {
    *(undefined4 *)(param_1 + 0x24) = 0;
  }
  else {
    *(undefined4 *)(param_1 + 0x24) = 0x3f800000;
  }
  pCVar9 = (CChoreoChannel *)CChoreoEvent::GetChannel(param_3);
  iVar4 = CChoreoActor::FindChannelIndex(param_4,pCVar9);
  *(int *)(param_1 + 0x18) = iVar4;
  iVar10 = GetScenePriority(this,param_2);
  iVar4 = CBaseAnimatingOverlay::AddLayeredSequence
                    ((CBaseAnimatingOverlay *)this,*(int *)(param_1 + 0x1c),iVar4 + iVar10);
  *(int *)(param_1 + 0x14) = iVar4;
  CBaseAnimatingOverlay::SetLayerNoRestore((CBaseAnimatingOverlay *)this,iVar4,true);
  lVar19 = (longdouble)(*(code *)**(undefined4 **)param_3)();
  CBaseAnimatingOverlay::SetLayerDuration
            ((CBaseAnimatingOverlay *)this,*(int *)(param_1 + 0x14),(float)lVar19);
  CBaseAnimatingOverlay::SetLayerWeight((CBaseAnimatingOverlay *)this,*(int *)(param_1 + 0x14),0.0);
  pCVar13 = *(CStudioHdr **)(this + 0x13e0);
  iVar4 = *(int *)(param_1 + 0x1c);
  if (pCVar13 == (CStudioHdr *)0x0) {
    iVar10 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar10 == 0) {
      pCVar13 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar13 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar14 = (CStudioHdr *)0x0;
    if (pCVar13 != (CStudioHdr *)0x0) goto LAB_006254e0;
  }
  else {
LAB_006254e0:
    pCVar14 = (CStudioHdr *)0x0;
    if (*(int *)pCVar13 != 0) {
      pCVar14 = pCVar13;
    }
  }
  uVar11 = GetSequenceFlags(pCVar14,iVar4);
  if ((uVar11 & 1) != 0) {
    (**(code **)(*(int *)this + 0x20))();
    puVar16 = (undefined4 *)&stack0xfffffe70;
    CChoreoEvent::GetParameters(param_3);
    DevMsg();
  }
  puVar16[2] = 0;
  uVar12 = *(undefined4 *)(param_1 + 0x14);
  *puVar16 = this;
  puVar16[1] = uVar12;
  puVar16[-1] = 0x625520;
  CBaseAnimatingOverlay::SetLayerLooping
            ((CBaseAnimatingOverlay *)*puVar16,puVar16[1],*(bool *)(puVar16 + 2));
  puVar17 = *(undefined4 **)param_3;
  *puVar16 = param_3;
  pcVar1 = (code *)*puVar17;
  puVar16[-1] = 0x62552d;
  lVar19 = (longdouble)(*pcVar1)();
  *puVar16 = param_2;
  puVar16[-1] = 0x625541;
  lVar20 = (longdouble)CChoreoScene::GetTime((CChoreoScene *)*puVar16);
  *puVar16 = param_3;
  puVar16[-1] = 0x62555f;
  lVar21 = (longdouble)CChoreoEvent::GetStartTime((CChoreoEvent *)*puVar16);
  *puVar16 = param_3;
  puVar16[1] = ((float)lVar20 - (float)lVar21) / (float)lVar19;
  puVar16[-1] = 0x62558f;
  lVar19 = (longdouble)
           CChoreoEvent::GetOriginalPercentageFromPlaybackPercentage
                     ((CChoreoEvent *)*puVar16,(float)puVar16[1]);
  puVar16[3] = 0;
  puVar16[2] = (float)lVar19;
  uVar12 = *(undefined4 *)(param_1 + 0x14);
  *puVar16 = this;
  puVar16[1] = uVar12;
  puVar16[-1] = 0x6255ba;
  CBaseAnimatingOverlay::SetLayerCycle
            ((CBaseAnimatingOverlay *)*puVar16,puVar16[1],(float)puVar16[2],(float)puVar16[3]);
  puVar16[2] = 0;
  uVar12 = *(undefined4 *)(param_1 + 0x14);
  *puVar16 = this;
  puVar16[1] = uVar12;
  puVar16[-1] = 0x6255d1;
  CBaseAnimatingOverlay::SetLayerPlaybackRate
            ((CBaseAnimatingOverlay *)*puVar16,puVar16[1],(float)puVar16[2]);
  uVar12 = 1;
  puVar17 = puVar16;
LAB_006255d6:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    *(undefined **)((int)puVar17 + -4) = &UNK_00625761;
    __stack_chk_fail();
  }
  return uVar12;
}

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)