L L4D2node

SurvivorBot::LookAround

0x0093da80 · 937 bytes · __thiscall

_ZN11SurvivorBot10LookAroundEv

Decompiled

undefined (1 param)

/* SurvivorBot::LookAround() */

void __thiscall SurvivorBot::LookAround(SurvivorBot *this)

{
  float fVar1;
  float fVar2;
  float fVar3;
  code *pcVar4;
  char cVar5;
  TerrorNavArea *this_00;
  int *piVar6;
  float *pfVar7;
  int *piVar8;
  int iVar9;
  int iVar10;
  longdouble lVar11;
  longdouble lVar12;
  float fVar13;
  int aiStackY_94 [2];
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  cVar5 = IsAvailable(this);
  if ((cVar5 != '\0') &&
     (cVar5 = CTerrorPlayer::IsInCombat((CTerrorPlayer *)this,false), cVar5 == '\0')) {
    this_00 = (TerrorNavArea *)(**(code **)(*(int *)this + 0x52c))();
    if (this_00 != (TerrorNavArea *)0x0) {
      if (*(int *)(this + 0x1aa90) == 0) goto LAB_0093dadc;
      lVar12 = (longdouble)CountdownTimer::Now();
      if (*(float *)(this + 0x8b50) <= (float)lVar12) {
        iVar9 = 0;
        if (0 < *(int *)(this + 0x1aa90)) {
          do {
            cVar5 = TerrorNavArea::IsPotentiallyVisible
                              (this_00,*(TerrorNavArea **)(*(int *)(this + 0x1aa84) + iVar9 * 4),
                               false);
            iVar10 = iVar9;
            if (cVar5 == '\0') {
              iVar10 = iVar9 + -1;
              CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::FastRemove
                        ((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)
                         (this + 0x1aa84),iVar9);
            }
            iVar9 = iVar10 + 1;
          } while (iVar9 < *(int *)(this + 0x1aa90));
        }
        lVar12 = (longdouble)CountdownTimer::Now();
        if ((float)lVar12 + 1.0 != *(float *)(this + 0x8b50)) {
          (**(code **)(*(int *)(this + 0x8b48) + 4))();
          *(float *)(this + 0x8b50) = (float)lVar12 + 1.0;
        }
        if (*(float *)(this + 0x8b4c) != 1.0) {
          (**(code **)(*(int *)(this + 0x8b48) + 4))();
          *(undefined4 *)(this + 0x8b4c) = 0x3f800000;
        }
      }
    }
    if (*(int *)(this + 0x1aa90) == 0) {
LAB_0093dadc:
      LookAtRandomSpot(this);
      return;
    }
    iVar9 = *(int *)(*(int *)(this + 0x1aa84) + -4 + *(int *)(this + 0x1aa90) * 4);
    piVar6 = (int *)(**(code **)(*(int *)this + 0x9a4))();
    lVar12 = (longdouble)(**(code **)(*piVar6 + 0x120))();
    fVar13 = SQRT((*(float *)(iVar9 + 0x14) - *(float *)(iVar9 + 8)) *
                  (*(float *)(iVar9 + 0x10) - *(float *)(iVar9 + 4))) * 0.005;
    if (fVar13 <= 0.0) {
      fVar13 = 0.0;
    }
    if (1.0 <= fVar13) {
      fVar13 = 1.0;
    }
    piVar6 = (int *)(**(code **)(*(int *)this + 0x9a4))();
    (**(code **)(*piVar6 + 0xc0))();
    piVar6 = (int *)(**(code **)(*(int *)this + 0x9a4))();
    pfVar7 = (float *)(**(code **)(*piVar6 + 0xbc))();
    if (0 < *(int *)(this + 0x1aa90)) {
      iVar9 = 0;
      piVar6 = (int *)&stack0xffffff74;
      do {
        iVar10 = *(int *)(*(int *)(this + 0x1aa84) + iVar9 * 4);
        fVar1 = *(float *)(iVar10 + 0x2c);
        fVar2 = *(float *)(iVar10 + 0x30);
        fVar3 = *(float *)(iVar10 + 0x34);
        iVar10 = *(int *)this;
        *piVar6 = (int)&local_28;
        piVar6[1] = (int)this;
        pcVar4 = *(code **)(iVar10 + 0x234);
        piVar6[-1] = 0x93dce2;
        (*pcVar4)();
        local_30 = fVar2 - local_24;
        piVar6[-1] = (int)&local_34;
        local_34 = fVar1 - local_28;
        local_2c = ((float)lVar12 * 0.75 - local_20) + fVar3;
        piVar6[-2] = 0x93dd22;
        lVar11 = (longdouble)VectorNormalize((Vector *)piVar6[-1]);
        if (100.0 <= (float)lVar11) {
          if (0.8 < local_30 * pfVar7[1] + local_34 * *pfVar7 + local_2c * pfVar7[2]) {
            iVar10 = *(int *)this;
            piVar6[-1] = (int)this;
            pcVar4 = *(code **)(iVar10 + 0x9a4);
            piVar6[-2] = 0x93dd63;
            piVar8 = (int *)(*pcVar4)();
            iVar10 = *piVar8;
            piVar6[-1] = (int)piVar8;
            pcVar4 = *(code **)(iVar10 + 0xd0);
            piVar6[-2] = 0x93dd6e;
            lVar11 = (longdouble)(*pcVar4)();
            if (fVar13 < (float)lVar11) goto LAB_0093dd3b;
          }
        }
        else {
LAB_0093dd3b:
          *piVar6 = iVar9;
          iVar9 = iVar9 + -1;
          piVar6[-1] = (int)(this + 0x1aa84);
          piVar6[-2] = 0x93dd4d;
          CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::FastRemove
                    ((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)piVar6[-1],*piVar6
                    );
        }
        iVar9 = iVar9 + 1;
        piVar6 = piVar6 + -1;
      } while (iVar9 < *(int *)(this + 0x1aa90));
    }
  }
  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)