L L4D2node

CFuncTrackTrain::Blocked

0x00b12040 · 1674 bytes · __thiscall

_ZN15CFuncTrackTrain7BlockedEP11CBaseEntity

Decompiled

undefined (2 params)

/* CFuncTrackTrain::Blocked(CBaseEntity*) */

void __thiscall CFuncTrackTrain::Blocked(CFuncTrackTrain *this,CBaseEntity *param_1)

{
  int *piVar1;
  float fVar2;
  float fVar3;
  char cVar4;
  int iVar5;
  undefined4 uVar6;
  CBaseEntity *pCVar7;
  int *piVar8;
  int *piVar9;
  CBaseEntity *pCVar10;
  uint uVar11;
  undefined1 *puVar12;
  longdouble lVar13;
  float fVar14;
  float fVar15;
  int local_ac;
  CBaseEntity *local_98;
  float local_88;
  float local_84;
  float local_80;
  float local_7c;
  float local_78;
  float local_74;
  int local_70;
  float local_6c;
  
  iVar5 = CBaseEntity::GetTeamNumber(param_1);
  if (iVar5 == 3) {
    CTakeDamageInfo::CTakeDamageInfo
              ((CTakeDamageInfo *)&local_7c,(CBaseEntity *)this,(CBaseEntity *)this,500.0,1,2);
    CBaseEntity::TakeDamage(param_1,(CTakeDamageInfo *)&local_7c);
    return;
  }
  if ((((byte)param_1[0x150] & 1) != 0) &&
     (pCVar7 = (CBaseEntity *)CBaseEntity::GetGroundEntity(param_1), pCVar7 == (CBaseEntity *)this))
  {
    puVar12 = &DAT_00d539c2;
    if (*(undefined1 **)(param_1 + 0x7c) != (undefined1 *)0x0) {
      puVar12 = *(undefined1 **)(param_1 + 0x7c);
    }
    uVar6 = CBaseEntity::GetDebugName(pCVar7);
    DevMsg(1,"TRAIN(%s): Blocked by %s\n",uVar6,puVar12);
    fVar15 = *(float *)(pCVar7 + 0x11c);
    (**(code **)(*(int *)param_1 + 0x25c))(param_1,&local_88,0);
    if (local_80 != 0.0) {
      return;
    }
    local_7c = 0.0;
    local_78 = 0.0;
    local_74 = ABS(fVar15);
    if (50.0 <= local_74) {
      local_74 = 50.0;
    }
    CBaseEntity::ApplyAbsVelocityImpulse(param_1,(Vector *)&local_7c);
    return;
  }
  if (((byte)this[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  if (((byte)param_1[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(param_1);
  }
  local_78 = *(float *)(param_1 + 0x2e4) - *(float *)(this + 0x2e4);
  local_74 = *(float *)(param_1 + 0x2e8) - *(float *)(this + 0x2e8);
  local_7c = *(float *)(param_1 + 0x2e0) - *(float *)(this + 0x2e0);
  VectorNormalize((Vector *)&local_7c);
  fVar15 = *(float *)(this + 0x47c);
  local_7c = local_7c * fVar15;
  local_78 = local_78 * fVar15;
  local_74 = fVar15 * local_74;
  CBaseEntity::SetAbsVelocity(param_1,(Vector *)&local_7c);
  if (((byte)this[0x149] & 2) == 0) goto LAB_00b1212c;
  local_7c = 0.0;
  local_78 = 0.0;
  local_74 = 0.0;
  local_70 = 0;
  local_6c = 0.0;
                    /* try { // try from 00b122e2 to 00b1247c has its CatchHandler @ 00b126cf */
  GetAllInHierarchy((CBaseEntity *)this,(CUtlVector *)&local_7c);
  if (local_70 < 1) {
    local_70 = 0;
    CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_7c);
    local_6c = local_7c;
    CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_7c);
  }
  else {
    local_98 = (CBaseEntity *)0x0;
    local_ac = 0;
    fVar15 = 0.0;
    do {
      piVar1 = *(int **)(*(int *)((int)local_7c + local_ac * 4) + 0x238);
      if (piVar1 != (int *)0x0) {
        piVar8 = (int *)(**(code **)(*piVar1 + 0x144))(piVar1);
        while (cVar4 = (**(code **)(*piVar8 + 8))(piVar8), cVar4 != '\0') {
          piVar9 = (int *)(**(code **)(*piVar8 + 0xc))(piVar8,1);
          pCVar10 = (CBaseEntity *)(**(code **)(*piVar9 + 0x48))(piVar9);
          pCVar7 = local_98;
          fVar14 = fVar15;
          if (pCVar10[0x186] == (CBaseEntity)0x6) {
            (**(code **)(*piVar8 + 0x18))(piVar8,&local_88);
            lVar13 = (longdouble)(**(code **)(*piVar8 + 0x1c))(piVar8);
            fVar3 = local_80;
            fVar2 = local_84;
            fVar14 = local_88;
            if (((byte)this[0x14d] & 0x10) != 0) {
              CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
            }
            fVar14 = (fVar2 * *(float *)(this + 0x278) + fVar14 * *(float *)(this + 0x274) +
                     fVar3 * *(float *)(this + 0x27c)) * (float)lVar13;
            pCVar7 = pCVar10;
            if ((fVar14 <= fVar15) && (local_98 != (CBaseEntity *)0x0)) {
              pCVar7 = local_98;
              fVar14 = fVar15;
            }
          }
          fVar15 = fVar14;
          local_98 = pCVar7;
          (**(code **)(*piVar8 + 0x34))(piVar8);
        }
        (**(code **)(*piVar1 + 0x148))(piVar1,piVar8);
      }
      local_ac = local_ac + 1;
    } while (local_ac < local_70);
    local_70 = 0;
    CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_7c);
    local_6c = local_7c;
    CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_7c);
    if (local_98 != (CBaseEntity *)0x0) {
      iVar5 = *(int *)(this + 0x46c);
      if (*(int *)(gpGlobals + 0x18) - iVar5 < 0xb) {
LAB_00b124d6:
        if (-1 < iVar5) goto LAB_00b124de;
      }
      else {
        uVar11 = *(uint *)(this + 0x14c);
        if ((uVar11 & 0x800) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          uVar11 = *(uint *)(this + 0x14c);
        }
        fVar15 = SQRT((*(float *)(this + 0x2e4) - *(float *)(this + 0x464)) *
                      (*(float *)(this + 0x2e4) - *(float *)(this + 0x464)) +
                      (*(float *)(this + 0x2e0) - *(float *)(this + 0x460)) *
                      (*(float *)(this + 0x2e0) - *(float *)(this + 0x460)) +
                      (*(float *)(this + 0x2e8) - *(float *)(this + 0x468)) *
                      (*(float *)(this + 0x2e8) - *(float *)(this + 0x468)));
        if ((uVar11 & 0x1000) != 0) {
          CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
        }
        if (fVar15 < SQRT(*(float *)(this + 0x278) * *(float *)(this + 0x278) +
                          *(float *)(this + 0x274) * *(float *)(this + 0x274) +
                          *(float *)(this + 0x27c) * *(float *)(this + 0x27c)) *
                     *(float *)(gpGlobals + 0x1c)) {
          EntityPhysics_CreateSolver((CBaseEntity *)this,local_98,true,4.0);
        }
        if (fVar15 <= 1.0) {
          iVar5 = *(int *)(this + 0x46c);
          goto LAB_00b124d6;
        }
      }
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      iVar5 = gpGlobals;
      *(undefined4 *)(this + 0x460) = *(undefined4 *)(this + 0x2e0);
      *(undefined4 *)(this + 0x464) = *(undefined4 *)(this + 0x2e4);
      *(undefined4 *)(this + 0x468) = *(undefined4 *)(this + 0x2e8);
      *(undefined4 *)(this + 0x46c) = *(undefined4 *)(iVar5 + 0x18);
    }
  }
LAB_00b124de:
  cVar4 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
  if (cVar4 != '\0') {
    return;
  }
LAB_00b1212c:
  fVar15 = *(float *)(this + 0x47c);
  puVar12 = &DAT_00d539c2;
  if (*(undefined1 **)(param_1 + 0x7c) != (undefined1 *)0x0) {
    puVar12 = *(undefined1 **)(param_1 + 0x7c);
  }
  uVar6 = CBaseEntity::GetDebugName((CBaseEntity *)this);
  DevWarning(2,"TRAIN(%s): Blocked by %s (dmg:%.2f)\n",uVar6,puVar12,(double)fVar15);
  if (0.0 < *(float *)(this + 0x47c)) {
    CTakeDamageInfo::CTakeDamageInfo
              ((CTakeDamageInfo *)&local_7c,(CBaseEntity *)this,(CBaseEntity *)this,
               *(float *)(this + 0x47c),1,0);
    CBaseEntity::TakeDamage(param_1,(CTakeDamageInfo *)&local_7c);
  }
  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)