L L4D2node

CFuncTrain::Next

0x00b11150 · 1584 bytes · __thiscall

_ZN10CFuncTrain4NextEv

Decompiled

undefined (1 param)

/* WARNING: Removing unreachable block (ram,0x00b113d0) */
/* WARNING: Removing unreachable block (ram,0x00b112bb) */
/* WARNING: Removing unreachable block (ram,0x00b117a1) */
/* WARNING: Removing unreachable block (ram,0x00b117a9) */
/* CFuncTrain::Next() */

void __thiscall CFuncTrain::Next(CFuncTrain *this)

{
  CBaseEdict *this_00;
  int *piVar1;
  undefined4 *puVar2;
  undefined4 uVar3;
  int iVar4;
  undefined *puVar5;
  uint uVar6;
  bool bVar7;
  longdouble lVar8;
  float fVar9;
  float fVar10;
  undefined **local_80 [8];
  float local_60;
  undefined1 *local_5c;
  float local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined1 local_3c;
  undefined1 local_3b;
  undefined1 local_3a;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined2 local_20;
  
  piVar1 = (int *)CBaseEntity::GetNextTarget((CBaseEntity *)this);
  if (piVar1 == (int *)0x0) {
    CBasePlatTrain::StopMovingSound((CBasePlatTrain *)this);
    if (*(int *)(this + 0x4bc) != 0) {
      (**(code **)(*(int *)this + 0x28c))((Vector *)&local_60,this);
      CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_80);
      local_80[0] = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 00b11614 to 00b11618 has its CatchHandler @ 00b117dd */
      CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)local_80,(Vector *)&local_60);
      local_80[0] = &PTR__CPASAttenuationFilter_00c08ec8;
                    /* try { // try from 00b11629 to 00b11645 has its CatchHandler @ 00b117d9 */
      (**(code **)(*(int *)this + 0x28c))((Vector *)&local_60,this);
      CPASAttenuationFilter::Filter((CPASAttenuationFilter *)local_80,(Vector *)&local_60,0.8);
      local_58 = *(float *)(this + 0x4c4);
      local_50 = 0;
      local_4c = 100;
      local_48 = 0;
      local_44 = 0;
      local_5c = &DAT_00d539c2;
      if (*(undefined1 **)(this + 0x4bc) != (undefined1 *)0x0) {
        local_5c = *(undefined1 **)(this + 0x4bc);
      }
      local_40 = 0;
      local_3c = 1;
      local_3b = 0;
      local_3a = 0;
      local_38 = 0xffffffff;
      local_34 = 0;
      local_30 = 0;
      local_2c = 0;
      local_28 = 0;
      local_24 = 0;
      local_20 = 0xffff;
      local_60 = 2.8026e-45;
      local_54 = 0x4b;
      if (*(int *)(this + 0x30) == 0) {
        iVar4 = 0;
      }
      else {
        iVar4 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
                    /* try { // try from 00b116f8 to 00b116fc has its CatchHandler @ 00b117b5 */
      CBaseEntity::EmitSound((IRecipientFilter *)local_80,iVar4,(EmitSound_t *)&local_60);
      local_28 = 0;
      CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_34);
      local_24 = local_34;
      CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_34);
      local_80[0] = &PTR__CPASFilter_00bfaf28;
      CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_80);
      return;
    }
  }
  else {
    *(undefined4 *)(this + 0x4e4) = *(undefined4 *)(this + 0xf8);
    *(int *)(this + 0xf8) = piVar1[0x3e];
    lVar8 = (longdouble)(**(code **)(*piVar1 + 0x150))(piVar1);
    puVar5 = g_pEntityList;
    uVar6 = *(uint *)(this + 0x4d0);
    *(float *)(this + 0x448) = (float)lVar8;
    if ((((uVar6 != 0xffffffff) &&
         (puVar5 = puVar5 + (uVar6 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar5 + 8) == uVar6 >> 0xc)) &&
       ((*(int *)(puVar5 + 4) != 0 &&
        (fVar10 = *(float *)(*(int *)(puVar5 + 4) + 0x11c), fVar10 != 0.0)))) {
      *(float *)(this + 0x11c) = fVar10;
      uVar3 = CBaseEntity::GetDebugName((CBaseEntity *)this);
      DevMsg(2,"Train %s speed to %4.2f\n",uVar3,(double)fVar10);
    }
    puVar2 = (undefined4 *)(**(code **)(*piVar1 + 0xc))(piVar1);
    *(undefined4 *)(this + 0x4d0) = *puVar2;
    puVar2 = (undefined4 *)(**(code **)(*piVar1 + 0xc))(piVar1);
    puVar5 = g_pEntityList;
    iVar4 = 0;
    *(undefined4 *)(this + 0x4d8) = *puVar2;
    uVar6 = *(uint *)(this + 0x4d0);
    if (((uVar6 != 0xffffffff) &&
        (puVar5 = puVar5 + (uVar6 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar5 + 8) == uVar6 >> 0xc)) {
      iVar4 = *(int *)(puVar5 + 4);
    }
    if ((*(byte *)(iVar4 + 0x148) & 2) != 0) {
      CBaseEntity::AddEffects((CBaseEntity *)this,8);
      if ((AllocTempVector()::s_vecTemp == '\0') &&
         (iVar4 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar4 != 0)) {
        __cxa_guard_release(&AllocTempVector()::s_vecTemp);
      }
      if ((AllocTempVector()::s_nIndex == '\0') &&
         (iVar4 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar4 != 0)) {
        AllocTempVector()::s_nIndex = 0;
        __cxa_guard_release(&AllocTempVector()::s_nIndex);
      }
      AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
      LOCK();
      UNLOCK();
      iVar4 = AllocTempVector()::s_nIndex * 0xc;
      local_60 = (*(float *)(this + 0x1a8) - *(float *)(this + 0x19c)) * 0.5 +
                 *(float *)(this + 0x19c);
      *(float *)(AllocTempVector()::s_vecTemp + iVar4) = local_60;
      fVar10 = (*(float *)(this + 0x1ac) - *(float *)(this + 0x1a0)) * 0.5 +
               *(float *)(this + 0x1a0);
      *(float *)(AllocTempVector()::s_vecTemp + iVar4 + 4) = fVar10;
      local_58 = (*(float *)(this + 0x1b0) - *(float *)(this + 0x1a4)) * 0.5 +
                 *(float *)(this + 0x1a4);
      *(float *)(AllocTempVector()::s_vecTemp + iVar4 + 8) = local_58;
      local_60 = (float)piVar1[0xe7] - local_60;
      local_5c = (undefined1 *)((float)piVar1[0xe8] - fVar10);
      local_58 = (float)piVar1[0xe9] - local_58;
      UTIL_SetOrigin((CBaseEntity *)this,(Vector *)&local_60,false);
      Wait(this);
      return;
    }
    CBasePlatTrain::PlayMovingSound((CBasePlatTrain *)this);
    uVar6 = *(uint *)(this + 0xd4) & 0xfffffff7;
    if (*(uint *)(this + 0xd4) != uVar6) {
      if (this[0x6c] == (CFuncTrain)0x0) {
        this_00 = *(CBaseEdict **)(this + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar4 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar4 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CFuncTrain)((byte)this[0x70] | 1);
      }
      *(uint *)(this + 0xd4) = uVar6;
    }
    bVar7 = AllocTempVector()::s_vecTemp == '\0';
    *(code **)(this + 0x14) = Wait;
    *(undefined4 *)(this + 0x18) = 0;
    fVar10 = *(float *)(this + 0x11c);
    if ((bVar7) && (iVar4 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar4 != 0)) {
      __cxa_guard_release(&AllocTempVector()::s_vecTemp);
    }
    if ((AllocTempVector()::s_nIndex == '\0') &&
       (iVar4 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar4 != 0)) {
      AllocTempVector()::s_nIndex = 0;
      __cxa_guard_release(&AllocTempVector()::s_nIndex);
    }
    AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
    LOCK();
    UNLOCK();
    iVar4 = AllocTempVector()::s_nIndex * 0xc;
    local_60 = (*(float *)(this + 0x1a8) - *(float *)(this + 0x19c)) * 0.5 +
               *(float *)(this + 0x19c);
    *(float *)(AllocTempVector()::s_vecTemp + iVar4) = local_60;
    fVar9 = (*(float *)(this + 0x1ac) - *(float *)(this + 0x1a0)) * 0.5 + *(float *)(this + 0x1a0);
    *(float *)(AllocTempVector()::s_vecTemp + iVar4 + 4) = fVar9;
    local_58 = (*(float *)(this + 0x1b0) - *(float *)(this + 0x1a4)) * 0.5 +
               *(float *)(this + 0x1a4);
    *(float *)(AllocTempVector()::s_vecTemp + iVar4 + 8) = local_58;
    local_60 = (float)piVar1[0xe7] - local_60;
    local_5c = (undefined1 *)((float)piVar1[0xe8] - fVar9);
    local_58 = (float)piVar1[0xe9] - local_58;
    CBaseToggle::LinearMove((CBaseToggle *)this,(Vector *)&local_60,fVar10);
  }
  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)