L L4D2node

CTerrorPlayer::UpdateActiveSet

0x009de450 · 2570 bytes · __thiscall

_ZN13CTerrorPlayer15UpdateActiveSetEP8CNavAreaS1_

Decompiled

undefined (3 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CTerrorPlayer::UpdateActiveSet(CNavArea*, CNavArea*) */

void __thiscall
CTerrorPlayer::UpdateActiveSet(CTerrorPlayer *this,CNavArea *param_1,CNavArea *param_2)

{
  byte *pbVar1;
  ushort uVar2;
  uint uVar3;
  TerrorNavArea *pTVar4;
  int iVar5;
  int *piVar6;
  char cVar7;
  int iVar8;
  undefined4 uVar9;
  int iVar10;
  int iVar11;
  bool bVar12;
  longdouble lVar13;
  float local_54;
  int local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  int local_3c;
  CTerrorPlayer *local_34;
  void *local_30;
  int local_2c;
  undefined4 local_28;
  int local_24;
  void *local_20;
  
  if (param_1 == (CNavArea *)0x0) {
    local_44 = 0;
    local_40 = 0;
    if (___atan2f_finite == 0) {
      local_2c = 0;
    }
    else {
      (**(code **)(___atan2f_finite + 0x50))
                (___atan2f_finite,&local_44,0,0,0,0,"/data/src/game/server/terror/terrorplayer.cpp",
                 0x556d,&UpdateActiveSet(CNavArea*,CNavArea*)::tm_fmt,"(%s)%s","Unaccounted",
                 "CTerrorPlayer::OnNavAreaChanged -- Outside Mesg");
      local_2c = ___atan2f_finite;
    }
    iVar8 = _DAT_0105db00;
    local_34 = (CTerrorPlayer *)local_44;
    local_30 = (void *)local_40;
                    /* try { // try from 009deca4 to 009decf2 has its CatchHandler @ 009dee8a */
    if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
       (iVar11 = ThreadGetCurrentId(), iVar8 == iVar11)) {
      if ((char *)*_DAT_0105d15c != "CTerrorPlayer::OnNavAreaChanged -- Outside Mesg") {
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd19ad0,(char *)0x1,0xbfafa1);
      }
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
    iVar8 = 0;
    if (0 < DAT_00fe6000) {
      do {
        piVar6 = *(int **)(TheNavAreas + iVar8 * 4);
        iVar11 = *(int *)(this + 0x2ba0);
        uVar3 = piVar6[0x57];
        if (iVar11 != 8) {
          uVar3 = uVar3 & 1 << ((byte)iVar11 & 0x1f);
        }
        if (uVar3 != 0) {
                    /* try { // try from 009dec90 to 009dec95 has its CatchHandler @ 009dee9f */
          (**(code **)(*piVar6 + 0x80))(piVar6,iVar11);
          iVar11 = *(int *)(this + 0x2ba0);
        }
        iVar8 = iVar8 + 1;
        *(byte *)((int)piVar6 + 0x7d) =
             *(byte *)((int)piVar6 + 0x7d) & ~(byte)(1 << ((byte)iVar11 & 0x1f));
        *(byte *)((int)piVar6 + 0x7e) =
             *(byte *)((int)piVar6 + 0x7e) &
             ~(byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f));
      } while (iVar8 < DAT_00fe6000);
    }
    bVar12 = DAT_0105d158 == '\0';
    *(undefined4 *)(this + 0x30f4) = 0;
    iVar8 = _DAT_0105db00;
    if (((bVar12) || (_DAT_0105d154 != 0)) && (iVar11 = ThreadGetCurrentId(), iVar8 == iVar11)) {
      cVar7 = CVProfNode::ExitScope();
      if (cVar7 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_2c != 0) {
      (**(code **)(local_2c + 0x54))(local_2c,local_34,local_30,0,0,0);
    }
  }
  else {
    cVar7 = (**(code **)(*(int *)this + 300))(this);
    if (cVar7 != '\0') {
      iVar8 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      cVar7 = IsASurvivorTeam(iVar8);
      if (cVar7 != '\0') {
        local_4c = 0;
        local_48 = 0;
        if (___atan2f_finite == 0) {
          local_3c = 0;
        }
        else {
          iVar8 = ___atan2f_finite;
          (**(code **)(___atan2f_finite + 0x50))
                    (___atan2f_finite,&local_4c,0,0,0,0,
                     "/data/src/game/server/terror/terrorplayer.cpp",0x5539,
                     &UpdateActiveSet(CNavArea*,CNavArea*)::tm_fmt,"(%s)%s","Unaccounted",
                     "CTerrorPlayer::OnNavAreaChanged -- UpdateActiveSet");
          local_3c = ___atan2f_finite;
        }
        iVar11 = _DAT_0105db00;
        local_44 = local_4c;
        local_40 = local_48;
                    /* try { // try from 009de538 to 009de53c has its CatchHandler @ 009dee75 */
        if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
           (iVar8 = ThreadGetCurrentId(iVar8), iVar11 == iVar8)) {
          if ((char *)*_DAT_0105d15c != "CTerrorPlayer::OnNavAreaChanged -- UpdateActiveSet") {
                    /* try { // try from 009dee10 to 009dee21 has its CatchHandler @ 009dee75 */
            _DAT_0105d15c =
                 (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd19a6c,(char *)0x1,0xbfafa1);
          }
          CVProfNode::EnterScope();
          DAT_0105d158 = '\0';
        }
        local_50 = *(int *)(this + 0x30f4);
                    /* try { // try from 009de54e to 009de552 has its CatchHandler @ 009deedf */
        TerrorNavArea::MakeNewTerrorMarker();
        local_28 = 0;
        local_24 = 0;
        local_34 = this;
        local_2c = 0x100;
        local_30 = malloc(0x400);
        local_20 = local_30;
                    /* try { // try from 009de585 to 009dead9 has its CatchHandler @ 009deeaf */
        lVar13 = (longdouble)ZombieManager::GetZombieSpawnRange();
        SearchSurroundingAreas<CollectActiveAreas>
                  (param_1,(Vector *)(param_1 + 0x2c),(CollectActiveAreas *)&local_34,(float)lVar13,
                   1,-1);
        iVar8 = local_24;
        iVar11 = 0;
        if (0 < local_24) {
          do {
            while( true ) {
              pTVar4 = *(TerrorNavArea **)((int)local_30 + iVar11 * 4);
              uVar3 = *(uint *)(pTVar4 + 0x15c);
              if (*(int *)(local_34 + 0x2ba0) != 8) {
                uVar3 = uVar3 & 1 << ((byte)*(int *)(local_34 + 0x2ba0) & 0x1f);
              }
              if ((uVar3 == 0) &&
                 (AddToActiveSet(local_34,pTVar4), 2 < *(int *)(developer._28_4_ + 0x30))) break;
              iVar11 = iVar11 + 1;
              if (iVar11 == iVar8) goto LAB_009de660;
            }
            uVar9 = (**(code **)(*(int *)local_34 + 0xb8))(local_34);
            DevMsg("%s: area %d entered AAS\n",uVar9);
            iVar11 = iVar11 + 1;
          } while (iVar11 != iVar8);
        }
LAB_009de660:
        local_50 = local_50 + -1;
        if (-1 < local_50) {
          iVar8 = local_50 * 4;
          do {
            while( true ) {
              pTVar4 = *(TerrorNavArea **)(*(int *)(this + 0x30e8) + iVar8);
              cVar7 = TerrorNavArea::IsTerrorMarked(pTVar4);
              if (cVar7 == '\0') break;
LAB_009de680:
              local_50 = local_50 + -1;
              iVar8 = iVar8 + -4;
              if (local_50 == -1) goto LAB_009de730;
            }
            if (0 < *(int *)(this + 0x30f4)) {
              iVar11 = *(int *)(this + 0x30f4) + -1;
              if (local_50 != iVar11) {
                *(undefined4 *)(*(int *)(this + 0x30e8) + iVar8) =
                     *(undefined4 *)(*(int *)(this + 0x30e8) + iVar11 * 4);
                iVar11 = *(int *)(this + 0x30f4) + -1;
              }
              *(int *)(this + 0x30f4) = iVar11;
            }
            (**(code **)(*(int *)pTVar4 + 0x80))(pTVar4,*(undefined4 *)(this + 0x2ba0));
            if (*(int *)(developer._28_4_ + 0x30) < 3) goto LAB_009de680;
            uVar9 = (**(code **)(*(int *)this + 0xb8))(this);
            DevMsg("%s: area %d left AAS\n",uVar9);
            local_50 = local_50 + -1;
            iVar8 = iVar8 + -4;
          } while (local_50 != -1);
        }
LAB_009de730:
        iVar8 = TheNavAreas;
        if (param_2 != (CNavArea *)0x0) {
          TerrorNavArea::s_nCurrVisTestCounter = TerrorNavArea::s_nCurrVisTestCounter + 1;
          iVar11 = 0;
          if (0 < *(int *)(param_2 + 0x13c)) {
            do {
              iVar10 = *(int *)(iVar8 + ((int)(uint)*(ushort *)
                                                     (*(int *)(param_2 + 0x134) + iVar11 * 2) >> 2)
                                        * 4);
              if ((iVar10 != 0) &&
                 (*(int *)(iVar10 + 0x170) = TerrorNavArea::s_nCurrVisTestCounter,
                 (*(byte *)(*(int *)(param_2 + 0x134) + iVar11 * 2) & 3) != 0)) {
                *(byte *)(iVar10 + 0x7d) =
                     *(byte *)(iVar10 + 0x7d) &
                     ~(byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f));
                *(byte *)(iVar10 + 0x7e) =
                     *(byte *)(iVar10 + 0x7e) &
                     ~(byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f));
              }
              iVar11 = iVar11 + 1;
            } while (iVar11 < *(int *)(param_2 + 0x13c));
          }
          iVar11 = TheNavAreas;
          iVar8 = *(int *)(param_2 + 0x130);
          if ((iVar8 != 0) && (0 < *(int *)(iVar8 + 0x13c))) {
            iVar10 = 0;
            do {
              iVar5 = *(int *)(iVar11 + ((int)(uint)*(ushort *)
                                                     (*(int *)(iVar8 + 0x134) + iVar10 * 2) >> 2) *
                                        4);
              if ((iVar5 != 0) && (TerrorNavArea::s_nCurrVisTestCounter != *(int *)(iVar5 + 0x170)))
              {
                *(int *)(iVar5 + 0x170) = TerrorNavArea::s_nCurrVisTestCounter;
                uVar2 = *(ushort *)(*(int *)(iVar8 + 0x134) + iVar10 * 2);
                if ((uVar2 & 3) != 0) {
                  iVar5 = *(int *)((uVar2 & 0xfffc) + iVar11);
                  pbVar1 = (byte *)(iVar5 + 0x7d);
                  *pbVar1 = *pbVar1 & ~(byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f));
                  pbVar1 = (byte *)(iVar5 + 0x7e);
                  *pbVar1 = *pbVar1 & ~(byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f));
                }
              }
              iVar10 = iVar10 + 1;
            } while (iVar10 < *(int *)(iVar8 + 0x13c));
          }
        }
        TerrorNavArea::s_nCurrVisTestCounter = TerrorNavArea::s_nCurrVisTestCounter + 1;
        if (*(int *)(param_1 + 0x13c) < 1) {
          local_54 = 0.0;
        }
        else {
          iVar8 = 0;
          local_54 = 0.0;
          do {
            while ((pTVar4 = *(TerrorNavArea **)
                              (TheNavAreas +
                              ((int)(uint)*(ushort *)(*(int *)(param_1 + 0x134) + iVar8 * 2) >> 2) *
                              4), pTVar4 == (TerrorNavArea *)0x0 ||
                   (*(int *)(pTVar4 + 0x170) = TerrorNavArea::s_nCurrVisTestCounter,
                   (*(byte *)(*(int *)(param_1 + 0x134) + iVar8 * 2) & 3) == 0))) {
LAB_009de8b0:
              iVar8 = iVar8 + 1;
              if (*(int *)(param_1 + 0x13c) <= iVar8) goto LAB_009de980;
            }
            pTVar4[0x7d] = (TerrorNavArea)
                           ((byte)pTVar4[0x7d] |
                           (byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f)));
            cVar7 = TerrorNavArea::IsCompletelyVisible((TerrorNavArea *)param_1,pTVar4);
            if (cVar7 == '\0') goto LAB_009de8b0;
            pTVar4[0x7e] = (TerrorNavArea)
                           ((byte)pTVar4[0x7e] |
                           (byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f)));
            cVar7 = TerrorNavArea::IsCleared(pTVar4,this);
            if (cVar7 == '\0') {
              local_54 = (*(float *)(pTVar4 + 0x14) - *(float *)(pTVar4 + 8)) *
                         (*(float *)(pTVar4 + 0x10) - *(float *)(pTVar4 + 4)) + local_54;
            }
            TerrorNavArea::MarkAreaCleared(pTVar4,this);
            iVar8 = iVar8 + 1;
          } while (iVar8 < *(int *)(param_1 + 0x13c));
        }
LAB_009de980:
        iVar8 = *(int *)(param_1 + 0x130);
        if ((iVar8 != 0) && (0 < *(int *)(iVar8 + 0x13c))) {
          iVar11 = 0;
          do {
            while( true ) {
              iVar5 = TheNavAreas;
              iVar10 = *(int *)(TheNavAreas +
                               ((int)(uint)*(ushort *)(*(int *)(iVar8 + 0x134) + iVar11 * 2) >> 2) *
                               4);
              if ((iVar10 != 0) &&
                 (*(int *)(iVar10 + 0x170) != TerrorNavArea::s_nCurrVisTestCounter)) break;
LAB_009de9a8:
              iVar11 = iVar11 + 1;
              if (*(int *)(iVar8 + 0x13c) <= iVar11) goto LAB_009deaa0;
            }
            *(int *)(iVar10 + 0x170) = TerrorNavArea::s_nCurrVisTestCounter;
            uVar2 = *(ushort *)(*(int *)(iVar8 + 0x134) + iVar11 * 2);
            if ((uVar2 & 3) == 0) goto LAB_009de9a8;
            pTVar4 = *(TerrorNavArea **)((uVar2 & 0xfffc) + iVar5);
            pTVar4[0x7d] = (TerrorNavArea)
                           ((byte)pTVar4[0x7d] |
                           (byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f)));
            cVar7 = TerrorNavArea::IsCompletelyVisible((TerrorNavArea *)param_1,pTVar4);
            if (cVar7 == '\0') goto LAB_009de9a8;
            pTVar4[0x7e] = (TerrorNavArea)
                           ((byte)pTVar4[0x7e] |
                           (byte)(1 << ((byte)*(undefined4 *)(this + 0x2ba0) & 0x1f)));
            cVar7 = TerrorNavArea::IsCleared(pTVar4,this);
            if (cVar7 == '\0') {
              local_54 = (*(float *)(pTVar4 + 0x14) - *(float *)(pTVar4 + 8)) *
                         (*(float *)(pTVar4 + 0x10) - *(float *)(pTVar4 + 4)) + local_54;
            }
            TerrorNavArea::MarkAreaCleared(pTVar4,this);
            iVar11 = iVar11 + 1;
          } while (iVar11 < *(int *)(iVar8 + 0x13c));
        }
LAB_009deaa0:
        uVar9 = developer._28_4_;
        *(float *)(this + 0x310c) = local_54;
        if (2 < *(int *)(uVar9 + 0x30)) {
                    /* try { // try from 009ded38 to 009ded3c has its CatchHandler @ 009deeaf */
          DevMsg("%3.2f: AAS newly exposed area = %3.2f , %3.2f\n",
                 (double)*(float *)(gpGlobals + 0xc),(double)local_54,(double)local_54);
        }
        if (*(float *)(MusicLargeAreaRevealThreshold._28_4_ + 0x2c) <= local_54 &&
            local_54 != *(float *)(MusicLargeAreaRevealThreshold._28_4_ + 0x2c)) {
          Music::OnLargeAreaRevealed((Music *)(this + 0x3ab4));
        }
        local_24 = 0;
        CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)&local_30);
        local_20 = local_30;
        CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)&local_30);
        iVar8 = _DAT_0105db00;
        if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
           (iVar11 = ThreadGetCurrentId(), iVar8 == iVar11)) {
          cVar7 = CVProfNode::ExitScope();
          if (cVar7 != '\0') {
            _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
          }
          DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
        }
        if (local_3c != 0) {
          (**(code **)(local_3c + 0x54))(local_3c,local_44,local_40,0,0,0);
          return;
        }
      }
    }
  }
  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)