L L4D2node

CChoreoScene::Merge

0x00bb3210 · 673 bytes · __thiscall

_ZN12CChoreoScene5MergeEPS_

Decompiled

undefined (2 params)

/* CChoreoScene::Merge(CChoreoScene*) */

undefined4 __thiscall CChoreoScene::Merge(CChoreoScene *this,CChoreoScene *param_1)

{
  CChoreoActor *this_00;
  int iVar1;
  char *pcVar2;
  CChoreoChannel *this_01;
  CChoreoEvent *pCVar3;
  CChoreoEvent *pCVar4;
  uint uVar5;
  int iVar6;
  uint local_40;
  uint local_3c;
  int local_38;
  int local_30;
  CChoreoActor *local_2c;
  uint local_28;
  CChoreoEvent *local_20;
  
  if (*(int *)(param_1 + 0x10) < 1) {
    local_28 = 0;
    iVar6 = *(int *)(param_1 + 0x24);
  }
  else {
    iVar6 = 0;
    local_28 = 0;
    do {
      pCVar3 = *(CChoreoEvent **)(*(int *)(param_1 + 4) + iVar6 * 4);
      iVar1 = CChoreoEvent::GetActor(pCVar3);
      if (iVar1 == 0) {
        pCVar4 = (CChoreoEvent *)AllocEvent(this);
        CChoreoEvent::operator=(pCVar4,pCVar3);
        CChoreoEvent::SetScene(pCVar4,this);
        local_28 = local_28 + 1;
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 < *(int *)(param_1 + 0x10));
    iVar6 = *(int *)(param_1 + 0x24);
  }
  if (iVar6 < 1) {
    uVar5 = 0;
    local_3c = 0;
    local_40 = 0;
  }
  else {
    local_38 = 0;
    local_3c = 0;
    local_40 = 0;
    do {
      this_00 = *(CChoreoActor **)(*(int *)(param_1 + 0x18) + local_38 * 4);
      pcVar2 = (char *)CChoreoActor::GetName(this_00);
      local_2c = (CChoreoActor *)FindActor(this,pcVar2);
      if (local_2c == (CChoreoActor *)0x0) {
        local_2c = (CChoreoActor *)AllocActor(this);
        CChoreoActor::operator=(local_2c,this_00);
        CChoreoActor::RemoveAllChannels(local_2c);
        local_40 = local_40 + 1;
      }
      local_30 = 0;
      iVar6 = CChoreoActor::GetNumChannels(this_00);
      if (0 < iVar6) {
        do {
          this_01 = (CChoreoChannel *)CChoreoActor::GetChannel(this_00,local_30);
          pcVar2 = (char *)CChoreoChannel::GetName(this_01);
          local_20 = (CChoreoEvent *)CChoreoActor::FindChannel(local_2c,pcVar2);
          uVar5 = local_28;
          if (local_20 == (CChoreoEvent *)0x0) {
            local_20 = (CChoreoEvent *)AllocChannel(this);
            CChoreoChannel::operator=((CChoreoChannel *)local_20,this_01);
            CChoreoChannel::RemoveAllEvents((CChoreoChannel *)local_20);
            local_3c = local_3c + 1;
            CChoreoActor::AddChannel((CChoreoChannel *)local_2c);
            CChoreoChannel::SetActor((CChoreoChannel *)local_20,local_2c);
          }
          while( true ) {
            iVar6 = CChoreoChannel::GetNumEvents(this_01);
            if (iVar6 <= (int)(uVar5 - local_28)) break;
            pCVar3 = (CChoreoEvent *)CChoreoChannel::GetEvent(this_01,uVar5 - local_28);
            pCVar4 = (CChoreoEvent *)AllocEvent(this);
            CChoreoEvent::operator=(pCVar4,pCVar3);
            CChoreoEvent::SetScene(pCVar4,this);
            CChoreoChannel::AddEvent(local_20);
            CChoreoEvent::SetChannel(pCVar4,(CChoreoChannel *)local_20);
            CChoreoEvent::SetActor(pCVar4,local_2c);
            uVar5 = uVar5 + 1;
          }
          local_30 = local_30 + 1;
          iVar6 = CChoreoActor::GetNumChannels(this_00);
          local_28 = uVar5;
        } while (local_30 < iVar6);
      }
      local_38 = local_38 + 1;
    } while (local_38 < *(int *)(param_1 + 0x24));
    uVar5 = local_40 | local_3c;
  }
  Msg("Merged in (%i) actors, (%i) channels, and (%i) events\n",local_40,local_3c,local_28);
  return CONCAT31((int3)((local_28 | uVar5) >> 8),(local_28 | uVar5) != 0);
}

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)