L L4D2node

WitchWander::FindWanderArea

0x00a446a0 · 426 bytes · __thiscall

_ZNK11WitchWander14FindWanderAreaEP8Infected

Decompiled

undefined (2 params)

/* WitchWander::FindWanderArea(Infected*) const */

int __thiscall WitchWander::FindWanderArea(WitchWander *this,Infected *param_1)

{
  undefined4 *puVar1;
  float fVar2;
  undefined4 uVar3;
  CNavArea *pCVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  NavAreaCollector local_34 [4];
  void *local_30;
  undefined4 local_2c;
  undefined4 local_28;
  int local_24;
  void *local_20;
  
  local_28 = 0;
  local_24 = 0;
  local_34[0] = (NavAreaCollector)0x0;
  local_2c = 1000;
  local_30 = malloc(4000);
  local_20 = local_30;
  if (((byte)param_1[0x14d] & 8) != 0) {
                    /* try { // try from 00a446e3 to 00a44847 has its CatchHandler @ 00a4484a */
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  pCVar4 = (CNavArea *)(**(code **)(*(int *)param_1 + 0x52c))(param_1);
  SearchSurroundingAreas<NavAreaCollector>(pCVar4,(Vector *)(param_1 + 0x2e0),local_34,960.0,0,-1);
  if (0 < local_24) {
    iVar7 = 0;
    do {
      iVar5 = RandomInt(0,local_24 + -1);
      puVar1 = (undefined4 *)((int)local_30 + iVar5 * 4);
      uVar3 = *puVar1;
      *puVar1 = *(undefined4 *)((int)local_30 + iVar7 * 4);
      *(undefined4 *)((int)local_30 + iVar7 * 4) = uVar3;
      iVar7 = iVar7 + 1;
    } while (iVar7 < local_24);
    if (0 < local_24) {
      iVar7 = 0;
      do {
        iVar5 = *(int *)((int)local_30 + iVar7 * 4);
        if ((((iVar5 != 0) &&
             (iVar6 = (**(code **)(*(int *)param_1 + 0x52c))(param_1), iVar5 != iVar6)) &&
            (*(int *)(iVar5 + 0x70) < *(int *)(gpGlobals + 0x18))) &&
           ((36.0 <= *(float *)(iVar5 + 0x10) - *(float *)(iVar5 + 4) &&
            (36.0 <= *(float *)(iVar5 + 0x14) - *(float *)(iVar5 + 8))))) {
          fVar2 = *(float *)(iVar5 + 0x34);
          if (((byte)param_1[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
          }
          if ((ABS(fVar2 - *(float *)(param_1 + 0x2e8)) <= 120.0) &&
             ((*(byte *)(iVar5 + 0x12e) & 8) == 0)) goto LAB_00a44816;
        }
        iVar7 = iVar7 + 1;
      } while (iVar7 < local_24);
    }
  }
  iVar5 = 0;
LAB_00a44816:
  local_24 = 0;
  CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_30);
  local_20 = local_30;
  CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_30);
  return iVar5;
}

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)