L L4D2node

INextBot::OnStuck

0x00754aa0 · 1293 bytes · __thiscall

_ZN8INextBot7OnStuckEv

Decompiled

undefined (1 param)

/* INextBot::OnStuck() */

void __thiscall INextBot::OnStuck(INextBot *this)

{
  float fVar1;
  float fVar2;
  code *pcVar3;
  char cVar4;
  int *piVar5;
  int iVar6;
  CTerrorPlayer *pCVar7;
  undefined4 uVar8;
  void *pvVar9;
  CBaseEntity *pCVar10;
  float *pfVar11;
  longdouble lVar12;
  double dVar13;
  
  for (piVar5 = (int *)(**(code **)(*(int *)this + 8))(this); piVar5 != (int *)0x0;
      piVar5 = (int *)(**(code **)(*(int *)this + 0xc))(this,piVar5)) {
    (**(code **)(*piVar5 + 0x28))(piVar5);
  }
  if (0.0 < *(float *)(nb_stuck_dump_threshold._28_4_ + 0x2c) ||
      *(float *)(nb_stuck_dump_threshold._28_4_ + 0x2c) == 0.0) {
    piVar5 = (int *)(**(code **)(*(int *)this + 0xc0))(this);
    lVar12 = (longdouble)(**(code **)(*piVar5 + 0x16c))(piVar5);
    if (*(float *)(nb_stuck_dump_threshold._28_4_ + 0x2c) <= (float)lVar12) {
      pcVar3 = *(code **)(*(int *)(filesystem + 4) + 8);
      uVar8 = GetUniqueStuckLogFilename();
      pvVar9 = (void *)(*pcVar3)(filesystem + 4,uVar8,"at",0);
      PrintAndLog(pvVar9,"\n");
      piVar5 = (int *)(**(code **)(*(int *)this + 0xc0))(this);
      lVar12 = (longdouble)(**(code **)(*piVar5 + 0x16c))(piVar5);
      uVar8 = (**(code **)(*(int *)this + 0x13c))(this);
      dVar13 = (double)(float)lVar12;
      PrintAndLog(pvVar9,"STUCK: %s for %2.2f seconds\n",uVar8,SUB84(dVar13,0),
                  (int)((ulonglong)dVar13 >> 0x20));
      iVar6 = (**(code **)(*(int *)this + 0xb4))(this);
      if (*(int *)(iVar6 + 0x30) == 0) {
        iVar6 = 0;
      }
      else {
        iVar6 = *(int *)(iVar6 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      PrintAndLog(pvVar9,"   Entindex: %d\n",iVar6,SUB84(dVar13,0),(int)((ulonglong)dVar13 >> 0x20))
      ;
      pCVar10 = (CBaseEntity *)(**(code **)(*(int *)this + 0xb4))(this);
      if (((byte)pCVar10[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar10);
      }
      fVar1 = *(float *)(pCVar10 + 0x2e8);
      pCVar10 = (CBaseEntity *)(**(code **)(*(int *)this + 0xb4))(this);
      if (((byte)pCVar10[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar10);
      }
      fVar2 = *(float *)(pCVar10 + 0x2e4);
      pCVar10 = (CBaseEntity *)(**(code **)(*(int *)this + 0xb4))(this);
      if (((byte)pCVar10[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar10);
      }
      PrintAndLog(pvVar9,"   Origin: %2.2f %2.2f %2.2f\n",
                  SUB84((double)*(float *)(pCVar10 + 0x2e0),0),
                  (int)((ulonglong)(double)*(float *)(pCVar10 + 0x2e0) >> 0x20),
                  SUB84((double)fVar2,0),(int)((ulonglong)(double)fVar2 >> 0x20),(double)fVar1);
      pCVar10 = (CBaseEntity *)(**(code **)(*(int *)this + 0xb4))(this);
      if (((byte)pCVar10[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar10);
      }
      fVar1 = *(float *)(pCVar10 + 0x380);
      pCVar10 = (CBaseEntity *)(**(code **)(*(int *)this + 0xb4))(this);
      if (((byte)pCVar10[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar10);
      }
      fVar2 = *(float *)(pCVar10 + 0x37c);
      pCVar10 = (CBaseEntity *)(**(code **)(*(int *)this + 0xb4))(this);
      if (((byte)pCVar10[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar10);
      }
      PrintAndLog(pvVar9,"   Angles: %2.2f %2.2f %2.2f\n",SUB84((double)*(float *)(pCVar10 + 900),0)
                  ,(int)((ulonglong)(double)*(float *)(pCVar10 + 900) >> 0x20),
                  SUB84((double)fVar2,0),(int)((ulonglong)(double)fVar2 >> 0x20),(double)fVar1);
      piVar5 = (int *)(**(code **)(*(int *)this + 200))(this);
      uVar8 = (**(code **)(*piVar5 + 0x10))(piVar5);
      PrintAndLog(pvVar9,"   Behavior: %s\n",uVar8);
      piVar5 = (int *)(**(code **)(*(int *)this + 0xc0))(this);
      iVar6 = (**(code **)(*piVar5 + 0x178))(piVar5);
      fVar1 = *(float *)(iVar6 + 8);
      piVar5 = (int *)(**(code **)(*(int *)this + 0xc0))(this);
      iVar6 = (**(code **)(*piVar5 + 0x178))(piVar5);
      fVar2 = *(float *)(iVar6 + 4);
      piVar5 = (int *)(**(code **)(*(int *)this + 0xc0))(this);
      pfVar11 = (float *)(**(code **)(*piVar5 + 0x178))(piVar5);
      PrintAndLog(pvVar9,"   Approaching: %2.2f %2.2f %2.2f\n",SUB84((double)*pfVar11,0),
                  (int)((ulonglong)(double)*pfVar11 >> 0x20),SUB84((double)fVar2,0),
                  (int)((ulonglong)(double)fVar2 >> 0x20),(double)fVar1);
      PrintAndLog(pvVar9,"   Time: %3.2f\n",SUB84((double)*(float *)(gpGlobals + 0xc),0),
                  (int)((ulonglong)(double)*(float *)(gpGlobals + 0xc) >> 0x20));
      if (pvVar9 != (void *)0x0) {
        (**(code **)(*(int *)(filesystem + 4) + 0xc))(filesystem + 4,pvVar9);
      }
    }
  }
  piVar5 = (int *)(**(code **)(*(int *)this + 0xc0))(this);
  lVar12 = (longdouble)(**(code **)(*piVar5 + 0x16c))(piVar5);
  if ((((3.0 <= (float)lVar12) &&
       (pCVar7 = (CTerrorPlayer *)(**(code **)(*(int *)this + 0xb4))(this),
       pCVar7 != (CTerrorPlayer *)0x0)) &&
      (cVar4 = (**(code **)(*(int *)pCVar7 + 0x16c))(pCVar7), cVar4 != '\0')) &&
     (((iVar6 = (**(code **)(*(int *)pCVar7 + 0x544))(pCVar7), iVar6 - 1U < 6 || (iVar6 == 8)) &&
      (pCVar7[0x3ab2] == (CTerrorPlayer)0x0)))) {
    pCVar7[0x3ab2] = (CTerrorPlayer)0x1;
    CL4DGameStats::AddStuckPlayerData((CL4DGameStats *)CL4D_GameStats,pCVar7);
  }
  cVar4 = CTerrorGameRules::IsSurvivalMode();
  if ((cVar4 != '\0') && (cVar4 = CTerrorGameRules::HasPlayerControlledZombies(), cVar4 == '\0')) {
    piVar5 = (int *)(**(code **)(*(int *)this + 0xc0))(this);
    lVar12 = (longdouble)(**(code **)(*piVar5 + 0x16c))(piVar5);
    if ((120.0 <= (float)lVar12) &&
       (((piVar5 = (int *)(**(code **)(*(int *)this + 0xb4))(this), piVar5 != (int *)0x0 &&
         (cVar4 = (**(code **)(*piVar5 + 0x16c))(piVar5), cVar4 != '\0')) &&
        (iVar6 = (**(code **)(*piVar5 + 0x544))(piVar5), iVar6 - 1U < 6)))) {
      (**(code **)(*piVar5 + 0x8e0))(piVar5,0);
    }
  }
  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)