L L4D2node

SurvivorBehavior::SelectCloserThreat

0x00928090 · 302 bytes · __thiscall

_ZNK16SurvivorBehavior18SelectCloserThreatEPK13CTerrorPlayerP20CBaseCombatCharacterS4_

Decompiled

undefined (4 params)

/* SurvivorBehavior::SelectCloserThreat(CTerrorPlayer const*, CBaseCombatCharacter*,
   CBaseCombatCharacter*) const */

CBaseCombatCharacter * __thiscall
SurvivorBehavior::SelectCloserThreat
          (SurvivorBehavior *this,CTerrorPlayer *param_1,CBaseCombatCharacter *param_2,
          CBaseCombatCharacter *param_3)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  CTerrorPlayer CVar7;
  
  if (((byte)param_2[0x14d] & 8) == 0) {
    CVar7 = param_1[0x14d];
  }
  else {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
    CVar7 = param_1[0x14d];
  }
  if (((byte)CVar7 & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  fVar1 = *(float *)(param_1 + 0x2e4);
  fVar2 = *(float *)(param_1 + 0x2e8);
  fVar3 = *(float *)(param_2 + 0x2e4);
  fVar4 = *(float *)(param_2 + 0x2e8);
  fVar5 = *(float *)(param_1 + 0x2e0);
  fVar6 = *(float *)(param_2 + 0x2e0);
  if (((byte)param_3[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_3);
  }
  if (((byte)param_1[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  if ((fVar1 - fVar3) * (fVar1 - fVar3) + (fVar2 - fVar4) * (fVar2 - fVar4) +
      (fVar5 - fVar6) * (fVar5 - fVar6) <
      (*(float *)(param_1 + 0x2e4) - *(float *)(param_3 + 0x2e4)) *
      (*(float *)(param_1 + 0x2e4) - *(float *)(param_3 + 0x2e4)) +
      (*(float *)(param_1 + 0x2e0) - *(float *)(param_3 + 0x2e0)) *
      (*(float *)(param_1 + 0x2e0) - *(float *)(param_3 + 0x2e0)) +
      (*(float *)(param_1 + 0x2e8) - *(float *)(param_3 + 0x2e8)) *
      (*(float *)(param_1 + 0x2e8) - *(float *)(param_3 + 0x2e8))) {
    param_3 = param_2;
  }
  return param_3;
}

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)