L L4D2node

CBaseCombatCharacter::UpdateLastKnownArea

0x005f0780 · 695 bytes · __thiscall

_ZN20CBaseCombatCharacter19UpdateLastKnownAreaEv

Decompiled

undefined (1 param)

/* CBaseCombatCharacter::UpdateLastKnownArea() */

void __thiscall CBaseCombatCharacter::UpdateLastKnownArea(CBaseCombatCharacter *this)

{
  int *piVar1;
  char cVar2;
  int iVar3;
  int *piVar4;
  undefined4 uVar5;
  float fVar6;
  
  if (*(int *)(TheNavMesh + 0x528) != 0) {
                    /* WARNING: Could not recover jumptable at 0x005f095e. Too many branches */
                    /* WARNING: Treating indirect jump as call */
    (**(code **)(*(int *)this + 0x534))();
    return;
  }
  if ((0.0 < *(float *)(z_last_area_update_tolerance._28_4_ + 0x2c)) &&
     ((iVar3 = CBaseEntity::GetGroundEntity((CBaseEntity *)this), iVar3 == 0 ||
      (iVar3 = CBaseEntity::GetGroundEntity((CBaseEntity *)this), iVar3 == g_WorldEntity)))) {
    if ((*(int *)(this + 0x1a14) == 0) || (fVar6 = *(float *)(this + 0x1a24), fVar6 == -1.0)) {
      uVar5 = *(undefined4 *)(z_last_area_update_tolerance._28_4_ + 0x2c);
      if (this == (CBaseCombatCharacter *)0x0) goto LAB_005f07d6;
    }
    else {
      if (this == (CBaseCombatCharacter *)0x0) {
        return;
      }
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        fVar6 = *(float *)(this + 0x1a24);
        if (fVar6 == -1.0) {
          return;
        }
      }
      if (SQRT((*(float *)(this + 0x1a18) - *(float *)(this + 0x2e0)) *
               (*(float *)(this + 0x1a18) - *(float *)(this + 0x2e0)) +
               (*(float *)(this + 0x1a1c) - *(float *)(this + 0x2e4)) *
               (*(float *)(this + 0x1a1c) - *(float *)(this + 0x2e4)) +
               (*(float *)(this + 0x1a20) - *(float *)(this + 0x2e8)) *
               (*(float *)(this + 0x1a20) - *(float *)(this + 0x2e8))) <= fVar6) {
        return;
      }
      uVar5 = *(undefined4 *)(z_last_area_update_tolerance._28_4_ + 0x2c);
    }
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    *(undefined4 *)(this + 0x1a24) = uVar5;
    *(undefined4 *)(this + 0x1a18) = *(undefined4 *)(this + 0x2e0);
    *(undefined4 *)(this + 0x1a1c) = *(undefined4 *)(this + 0x2e4);
    *(undefined4 *)(this + 0x1a20) = *(undefined4 *)(this + 0x2e8);
  }
LAB_005f07d6:
  piVar4 = (int *)CNavMesh::GetNearestNavArea(TheNavMesh,(CBaseEntity *)this,5,50.0);
  if (((piVar4 != (int *)0x0) &&
      (cVar2 = (**(code **)(*(int *)this + 0x530))(this,piVar4), cVar2 != '\0')) &&
     (piVar1 = *(int **)(this + 0x1a14), piVar4 != piVar1)) {
    if (piVar1 != (int *)0x0) {
      cVar2 = *(char *)((int)piVar1 + *(int *)(this + 0x1a28) % 2 + 0x38);
      if (cVar2 == '\0') {
        DevMsg("CNavArea::IncrementPlayerCount: Underflow\n");
      }
      else {
        *(char *)((int)piVar1 + *(int *)(this + 0x1a28) % 2 + 0x38) = cVar2 + -1;
      }
      (**(code **)(**(int **)(this + 0x1a14) + 0x18))(*(int **)(this + 0x1a14),this,piVar4);
    }
    iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    *(int *)(this + 0x1a28) = iVar3;
    cVar2 = *(char *)((int)piVar4 + iVar3 % 2 + 0x38);
    if (cVar2 == -1) {
      DevMsg("CNavArea::IncrementPlayerCount: Overflow\n");
    }
    else {
      *(char *)((int)piVar4 + iVar3 % 2 + 0x38) = cVar2 + '\x01';
    }
    (**(code **)(*piVar4 + 0x14))(piVar4,this,*(undefined4 *)(this + 0x1a14));
    (**(code **)(*(int *)this + 0x53c))(this,piVar4,*(undefined4 *)(this + 0x1a14));
    *(int **)(this + 0x1a14) = piVar4;
  }
  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)