L L4D2node

CTerrorPlayer::FindNextObserverTarget

0x009ca280 · 275 bytes · __thiscall

_ZN13CTerrorPlayer22FindNextObserverTargetEb

Decompiled

undefined (2 params)

/* CTerrorPlayer::FindNextObserverTarget(bool) */

int __thiscall CTerrorPlayer::FindNextObserverTarget(CTerrorPlayer *this,bool param_1)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  undefined *puVar4;
  int iVar5;
  int *local_30;
  undefined4 local_2c;
  undefined4 local_28;
  int local_24;
  int *local_20;
  
  local_30 = (int *)0x0;
  local_2c = 0;
  local_28 = 0;
  local_24 = 0;
  local_20 = (int *)0x0;
                    /* try { // try from 009ca2bf to 009ca2c3 has its CatchHandler @ 009ca39f */
  CollectValidObserverTargets(this,(CUtlVector *)&local_30);
  if (local_24 == 0) {
    iVar3 = 0;
  }
  else {
    uVar2 = *(uint *)(this + 0x1d7c);
    if ((((uVar2 == 0xffffffff) ||
         (puVar4 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar4 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar4 + 8) != uVar2 >> 0xc)) || ((*(int *)(puVar4 + 4) == 0 || (local_24 < 1))))
    {
      iVar3 = *local_30;
    }
    else {
      iVar5 = 0;
      iVar3 = *local_30;
      iVar1 = iVar3;
      while (*(int *)(puVar4 + 4) != iVar1) {
        iVar5 = iVar5 + 1;
        if (iVar5 == local_24) goto LAB_009ca308;
        iVar1 = local_30[iVar5];
      }
      if (param_1) {
        iVar3 = (iVar5 + -1) * 4;
        if (iVar5 + -1 == -1) {
          iVar3 = local_24 * 4 + -4;
        }
      }
      else {
        iVar3 = 0;
        if (iVar5 + 1 < local_24) {
          iVar3 = (iVar5 + 1) * 4;
        }
      }
      iVar3 = *(int *)((int)local_30 + iVar3);
    }
  }
LAB_009ca308:
  local_24 = 0;
  CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_30);
  local_20 = local_30;
  CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_30);
  return iVar3;
}

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)