L L4D2node

CTerrorPlayer::CheckFriendSightings

0x009fff70 · 2010 bytes · __thiscall

_ZN13CTerrorPlayer20CheckFriendSightingsEv

Decompiled

undefined (1 param)

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

void __thiscall CTerrorPlayer::CheckFriendSightings(CTerrorPlayer *this)

{
  CUtlMemory<CTerrorPlayer*,int> *pCVar1;
  uint *puVar2;
  int iVar3;
  code *pcVar4;
  char cVar5;
  int iVar6;
  int iVar7;
  undefined4 uVar8;
  int in_GS_OFFSET;
  longdouble lVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  CUtlMemory<CTerrorPlayer*,int> *this_00;
  undefined4 local_194;
  undefined4 local_190;
  CAI_Concept local_188 [8];
  undefined4 local_180;
  undefined4 local_17c;
  CUtlMemory<CTerrorPlayer*,int> *local_178;
  int local_174 [5];
  int local_160 [5];
  int local_14c [5];
  CTerrorPlayer *local_138;
  float local_134;
  char local_130;
  undefined **local_12c;
  undefined1 local_128;
  undefined1 local_127 [259];
  undefined4 local_24;
  int local_20;
  
  local_194 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_190 = 0;
  if (_towlower == (CUtlMemory<CTerrorPlayer*,int> *)0x0) {
    local_178 = (CUtlMemory<CTerrorPlayer*,int> *)0x0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_194,0,0,0,0,"/data/src/game/server/terror/terrorplayerthinks.cpp",
               0x97c,&CheckFriendSightings()::tm_fmt,"(%s)%s","ZOMBIE",
               "CTerrorPlayer::CheckFriendSightings");
    local_178 = _towlower;
  }
  iVar6 = _DAT_0105db00;
  local_180 = local_194;
  local_17c = local_190;
                    /* try { // try from 00a000d6 to 00a00136 has its CatchHandler @ 00a007a1 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar7 = ThreadGetCurrentId(), iVar6 == iVar7)) {
    if (*(char **)_DAT_0105d15c != "CTerrorPlayer::CheckFriendSightings") {
      _DAT_0105d15c =
           (CUtlMemory<CTerrorPlayer*,int> *)
           CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd1c59c,(char *)0x0,0xc0db47);
    }
    puVar2 = (uint *)(_DAT_0105d1e8 + 4 + *(int *)(_DAT_0105d15c + 0x70) * 8);
    *puVar2 = *puVar2 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  this_00 = (CUtlMemory<CTerrorPlayer*,int> *)this;
                    /* try { // try from 00a0004c to 00a00050 has its CatchHandler @ 00a0077d */
  iVar6 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (iVar6 == 2) {
    pCVar1 = (CUtlMemory<CTerrorPlayer*,int> *)(this + 0x2f10);
    this_00 = pCVar1;
                    /* try { // try from 00a001a9 to 00a001d0 has its CatchHandler @ 00a0077d */
    lVar9 = (longdouble)CountdownTimer::Now();
    if (*(float *)(this + 0x2f18) <= (float)lVar9) {
      lVar9 = (longdouble)CountdownTimer::Now();
      if ((float)lVar9 + 0.5 != *(float *)(this + 0x2f18)) {
        (**(code **)(*(int *)(this + 0x2f10) + 4))(pCVar1,this + 0x2f18);
        *(float *)(this + 0x2f18) = (float)lVar9 + 0.5;
      }
      if (*(float *)(this + 0x2f14) != 0.5) {
                    /* try { // try from 00a006f9 to 00a00720 has its CatchHandler @ 00a0077d */
        (**(code **)(*(int *)(this + 0x2f10) + 4))(pCVar1,this + 0x2f14);
        *(undefined4 *)(this + 0x2f14) = 0x3f000000;
      }
      local_138 = this;
      local_14c[1] = 0;
      local_14c[2] = 0;
      local_14c[3] = 0;
      local_14c[4] = 0;
      local_130 = '\x01';
      local_174[0] = 0;
      local_174[1] = 0;
      local_134 = *(float *)(SurvivorBotNeighborRange._28_4_ + 0x2c) *
                  *(float *)(SurvivorBotNeighborRange._28_4_ + 0x2c);
      local_174[2] = 0;
      local_174[3] = 0;
      local_174[4] = 0;
      local_160[0] = 0;
      local_160[1] = 0;
      local_160[2] = 0;
      local_160[3] = 0;
      local_160[4] = 0;
      local_14c[0] = 0;
                    /* try { // try from 00a002d1 to 00a005a9 has its CatchHandler @ 00a007a5 */
      ForEachSurvivor<VisibleSurvivorScan>((VisibleSurvivorScan *)local_174);
      iVar6 = 0;
      if (0 < local_160[3]) {
        do {
          iVar7 = *(int *)(*(int *)(local_160[0] + iVar6 * 4) + 0x2ba0);
          if (iVar7 < 4) {
            iVar3 = iVar7 * 8;
            if (*(float *)(this + iVar3 + 0x2f20) != -1.0) {
              (**(code **)(*(int *)(this + iVar3 + 0x2f1c) + 4))
                        (this + iVar3 + 0x2f1c,this + iVar3 + 0x2f20);
              *(undefined4 *)(this + iVar3 + 0x2f20) = 0xbf800000;
            }
            this[iVar7 + 0x2f5c] = (CTerrorPlayer)0x0;
          }
          iVar6 = iVar6 + 1;
        } while (iVar6 < local_160[3]);
      }
      iVar6 = 0;
      if (0 < local_174[3]) {
        do {
          iVar7 = *(int *)(*(int *)(local_174[0] + iVar6 * 4) + 0x2ba0);
          if (iVar7 < 4) {
            iVar3 = iVar7 * 8;
            if (*(float *)(this + iVar3 + 0x2f20) <= 0.0) {
              lVar9 = (longdouble)IntervalTimer::Now();
              if ((float)lVar9 != *(float *)(this + iVar3 + 0x2f20)) {
                (**(code **)(*(int *)(this + iVar3 + 0x2f1c) + 4))
                          (this + iVar3 + 0x2f1c,this + iVar3 + 0x2f20);
                *(float *)(this + iVar3 + 0x2f20) = (float)lVar9;
              }
            }
            this[iVar7 + 0x2f5c] = (CTerrorPlayer)0x0;
          }
          iVar6 = iVar6 + 1;
        } while (iVar6 < local_174[3]);
      }
      if (local_130 == '\0') {
                    /* try { // try from 00a00735 to 00a0076c has its CatchHandler @ 00a007a5 */
        lVar9 = (longdouble)IntervalTimer::Now();
        if ((float)lVar9 != *(float *)(this + 0x2f64)) {
          (**(code **)(*(int *)(this + 0x2f60) + 4))(this + 0x2f60,this + 0x2f64);
          *(float *)(this + 0x2f64) = (float)lVar9;
        }
      }
      if (0 < local_14c[3]) {
        iVar6 = 0;
        do {
          iVar7 = *(int *)(local_14c[0] + iVar6 * 4);
          iVar3 = *(int *)(iVar7 + 0x2ba0);
          if ((iVar3 < 4) && (this[iVar3 + 0x2f5c] == (CTerrorPlayer)0x0)) {
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
              iVar7 = *(int *)(local_14c[0] + iVar6 * 4);
            }
            fVar12 = *(float *)(iVar7 + 0x2d40) - *(float *)(this + 0x2e4);
            fVar10 = *(float *)(iVar7 + 0x2d44) - *(float *)(this + 0x2e8);
            fVar11 = *(float *)(iVar7 + 0x2d3c) - *(float *)(this + 0x2e0);
            fVar10 = fVar10 * fVar10 + fVar12 * fVar12 + fVar11 * fVar11;
            if (fVar10 < 6400.0) {
              local_128 = 1;
              local_12c = &PTR_InitQuietTruncation_00c08ee8;
              local_127[0] = 0;
              local_24 = 0;
              uVar8 = SurvivorCharacterName(iVar3);
              CFmtStrN<256>::sprintf
                        ((CFmtStrN<256> *)&local_12c,"DeadCharacter:%s,Distance:%d",uVar8,
                         (int)SQRT(fVar10));
              pcVar4 = *(code **)(*(int *)this + 0x7b4);
              CAI_Concept::CAI_Concept(local_188,"PlayerSeeDeadPlayer");
              cVar5 = (*pcVar4)(this,local_188,1,local_127,0,0,0);
              if (cVar5 != '\0') {
                this[iVar3 + 0x2f5c] = (CTerrorPlayer)0x1;
              }
            }
          }
          iVar6 = iVar6 + 1;
        } while (iVar6 < local_14c[3]);
      }
      local_14c[3] = 0;
      CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_14c);
      local_14c[4] = local_14c[0];
      CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_14c);
      local_160[3] = 0;
      CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_160);
      local_160[4] = local_160[0];
      CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_160);
      local_174[3] = 0;
      CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_174);
      local_174[4] = local_174[0];
      this_00 = (CUtlMemory<CTerrorPlayer*,int> *)local_174;
      CUtlMemory<CTerrorPlayer*,int>::Purge(this_00);
      iVar6 = _DAT_0105db00;
      if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
         (iVar7 = ThreadGetCurrentId(), iVar6 == iVar7)) {
        this_00 = _DAT_0105d15c;
        cVar5 = CVProfNode::ExitScope();
        if (cVar5 != '\0') {
          _DAT_0105d15c = *(CUtlMemory<CTerrorPlayer*,int> **)(_DAT_0105d15c + 100);
        }
        DAT_0105d158 = _DAT_0105d15c == (CUtlMemory<CTerrorPlayer*,int> *)0x105d160;
      }
      if (local_178 != (CUtlMemory<CTerrorPlayer*,int> *)0x0) {
        this_00 = local_178;
        (**(code **)(local_178 + 0x54))(local_178,local_180,local_17c,0,0,0);
      }
      goto LAB_00a000b0;
    }
  }
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar7 = ThreadGetCurrentId(this_00), iVar6 == iVar7)) {
    this_00 = _DAT_0105d15c;
    cVar5 = CVProfNode::ExitScope();
    if (cVar5 != '\0') {
      _DAT_0105d15c = *(CUtlMemory<CTerrorPlayer*,int> **)(_DAT_0105d15c + 100);
    }
    DAT_0105d158 = _DAT_0105d15c == (CUtlMemory<CTerrorPlayer*,int> *)0x105d160;
  }
  if (local_178 != (CUtlMemory<CTerrorPlayer*,int> *)0x0) {
    this_00 = local_178;
    (**(code **)(local_178 + 0x54))(local_178,local_180,local_17c,0,0,0);
  }
LAB_00a000b0:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail(this_00);
  }
  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)