L L4D2node

CDirector::OnForceSurvivorPositions

0x0088a5a0 · 1051 bytes · __thiscall

_ZN9CDirector24OnForceSurvivorPositionsERK10CUtlVectorIP13CTerrorPlayer10CUtlMemoryIS2_iEE

Decompiled

undefined (2 params)

/* CDirector::OnForceSurvivorPositions(CUtlVector<CTerrorPlayer*, CUtlMemory<CTerrorPlayer*, int> >
   const&) */

void __thiscall CDirector::OnForceSurvivorPositions(CDirector *this,CUtlVector *param_1)

{
  int iVar1;
  CTerrorPlayer *pCVar2;
  code *pcVar3;
  bool bVar4;
  char cVar5;
  int iVar6;
  char *pcVar7;
  char *pcVar8;
  int iVar9;
  CStudioHdr *pCVar10;
  float fVar11;
  CStudioHdr *pCVar12;
  CBaseEntity *pCVar13;
  int local_7c;
  int local_78;
  int local_68 [5];
  void *local_54;
  undefined4 local_50;
  undefined4 local_4c;
  size_t local_48;
  void *local_44;
  CSurvivorPosition *local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  int local_30 [8];
  
  pCVar13 = (CBaseEntity *)0x0;
  local_68[0] = 0;
  local_68[1] = 0;
  local_68[2] = 0;
  local_68[3] = 0;
  local_68[4] = 0;
  local_54 = (void *)0x0;
  local_50 = 0;
  local_4c = 0;
  local_48 = 0;
  local_44 = (void *)0x0;
                    /* try { // try from 0088a613 to 0088a821 has its CatchHandler @ 0088a9d1 */
  while (pCVar13 = (CBaseEntity *)
                   CGlobalEntityList::FindEntityByClassname
                             ((CGlobalEntityList *)gEntList,pCVar13,"info_survivor_position"),
        pCVar13 != (CBaseEntity *)0x0) {
    local_40 = (CSurvivorPosition *)
               __dynamic_cast(pCVar13,&CBaseEntity::typeinfo,&CSurvivorPosition::typeinfo,0);
    if (local_40 != (CSurvivorPosition *)0x0) {
      iVar6 = CSurvivorPosition::GetSurvivorName(local_40);
      if (iVar6 == 0) {
        CUtlVector<CSurvivorPosition*,CUtlMemory<CSurvivorPosition*,int>>::InsertBefore
                  ((CUtlVector<CSurvivorPosition*,CUtlMemory<CSurvivorPosition*,int>> *)&local_54,
                   local_48,&local_40);
      }
      else {
        CUtlVector<CSurvivorPosition*,CUtlMemory<CSurvivorPosition*,int>>::InsertBefore
                  ((CUtlVector<CSurvivorPosition*,CUtlMemory<CSurvivorPosition*,int>> *)local_68,
                   local_68[3],&local_40);
      }
    }
  }
  if ((1 < (int)local_48) && (local_54 != (void *)0x0)) {
    qsort(local_54,local_48,4,PositionSort);
  }
  if (0 < *(int *)(param_1 + 0xc)) {
    local_78 = 0;
    local_7c = 0;
    do {
      pCVar2 = *(CTerrorPlayer **)(*(int *)param_1 + local_78 * 4);
      pcVar7 = (char *)(**(code **)(*(int *)pCVar2 + 0x5ac))(pCVar2);
      if (local_68[3] < 1) {
LAB_0088a7e9:
        if (local_7c < (int)local_48) {
          CTerrorPlayer::SetPlayerPositionEntity
                    (pCVar2,*(CSurvivorPosition **)((int)local_54 + local_7c * 4));
          local_7c = local_7c + 1;
        }
      }
      else {
        iVar6 = 0;
        bVar4 = false;
        do {
          while( true ) {
            iVar1 = iVar6 * 4;
            pcVar8 = (char *)CSurvivorPosition::GetSurvivorName
                                       (*(CSurvivorPosition **)(local_68[0] + iVar6 * 4));
            iVar9 = _V_stricmp(pcVar7,pcVar8);
            if (iVar9 != 0) break;
            CTerrorPlayer::SetPlayerPositionEntity
                      (pCVar2,*(CSurvivorPosition **)(local_68[0] + iVar1));
            iVar9 = CSurvivorPosition::GetSurvivorIntroSequence
                              (*(CSurvivorPosition **)(local_68[0] + iVar1));
            if (iVar9 == 0) {
                    /* try { // try from 0088a930 to 0088a9bb has its CatchHandler @ 0088a9d1 */
              iVar9 = CSurvivorPosition::GetSurvivorConcept
                                (*(CSurvivorPosition **)(local_68[0] + iVar1));
              if (iVar9 != 0) {
                pcVar3 = *(code **)(*(int *)pCVar2 + 0x7b4);
                pcVar8 = (char *)CSurvivorPosition::GetSurvivorConcept
                                           (*(CSurvivorPosition **)(local_68[0] + iVar1));
                CAI_Concept::CAI_Concept((CAI_Concept *)&local_40,pcVar8);
                (*pcVar3)(pCVar2,&local_40,3,0,0,0,0);
              }
            }
            else {
              pcVar8 = (char *)CSurvivorPosition::GetSurvivorIntroSequence
                                         (*(CSurvivorPosition **)(local_68[0] + iVar1));
              pCVar10 = *(CStudioHdr **)(pCVar2 + 0x13e0);
              if (pCVar10 == (CStudioHdr *)0x0) {
                iVar9 = CBaseEntity::GetModel((CBaseEntity *)pCVar2);
                if (iVar9 != 0) {
                  CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar2);
                }
                pCVar10 = *(CStudioHdr **)(pCVar2 + 0x13e0);
                pCVar12 = (CStudioHdr *)0x0;
                if (pCVar10 != (CStudioHdr *)0x0) goto LAB_0088a773;
              }
              else {
LAB_0088a773:
                pCVar12 = (CStudioHdr *)0x0;
                if (*(int *)pCVar10 != 0) {
                  pCVar12 = pCVar10;
                }
              }
              fVar11 = (float)LookupSequence(pCVar12,pcVar8);
              if (fVar11 != -NAN) {
                CTerrorPlayerAnimState::SetCustomSequence(*(int *)(pCVar2 + 0x2910),fVar11);
                pCVar13 = *(CBaseEntity **)(local_68[0] + iVar1);
                if (((byte)pCVar13[0x14d] & 8) != 0) {
                  CBaseEntity::CalcAbsolutePosition(pCVar13);
                }
                CBaseEntity::SetAbsAngles((CBaseEntity *)pCVar2,(QAngle *)(pCVar13 + 0x37c));
              }
            }
            iVar6 = iVar6 + 1;
            bVar4 = true;
            if (local_68[3] <= iVar6) goto LAB_0088a7e3;
          }
          iVar6 = iVar6 + 1;
        } while (iVar6 < local_68[3]);
LAB_0088a7e3:
        if (!bVar4) goto LAB_0088a7e9;
      }
      local_78 = local_78 + 1;
    } while (local_78 < *(int *)(param_1 + 0xc));
  }
  cVar5 = CTerrorGameRules::IsScavengeMode();
  if (cVar5 != '\0') {
    local_30[0] = 0;
    local_30[1] = 0;
    local_30[2] = 0;
    local_30[3] = 0;
    local_30[4] = 0;
    local_40 = (CSurvivorPosition *)0x3;
    local_3c = 4;
    local_38 = 3;
    local_34 = 9;
                    /* try { // try from 0088a86f to 0088a8ac has its CatchHandler @ 0088aa21 */
    ForEachPlayer<PlayerCollector>((PlayerCollector *)&local_40);
    iVar6 = 0;
    if (0 < local_30[3]) {
      do {
        while( true ) {
          pCVar2 = *(CTerrorPlayer **)(local_30[0] + iVar6 * 4);
          cVar5 = (**(code **)(*(int *)pCVar2 + 0x558))(pCVar2);
          if (cVar5 == '\0') break;
          CTerrorPlayer::WarpGhostToInitialPosition(pCVar2,false);
          iVar6 = iVar6 + 1;
          if (local_30[3] <= iVar6) goto LAB_0088a8b5;
        }
        iVar6 = iVar6 + 1;
      } while (iVar6 < local_30[3]);
    }
LAB_0088a8b5:
    local_30[3] = 0;
    CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
    local_30[4] = local_30[0];
    CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
  }
  local_48 = 0;
  CUtlMemory<CSurvivorPosition*,int>::Purge((CUtlMemory<CSurvivorPosition*,int> *)&local_54);
  local_44 = local_54;
  CUtlMemory<CSurvivorPosition*,int>::Purge((CUtlMemory<CSurvivorPosition*,int> *)&local_54);
  local_68[3] = 0;
  CUtlMemory<CSurvivorPosition*,int>::Purge((CUtlMemory<CSurvivorPosition*,int> *)local_68);
  local_68[4] = local_68[0];
  CUtlMemory<CSurvivorPosition*,int>::Purge((CUtlMemory<CSurvivorPosition*,int> *)local_68);
  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)