L L4D2node

CBasePlayer::HandleFuncTrain

0x007addd0 · 1126 bytes · __thiscall

_ZN11CBasePlayer15HandleFuncTrainEv

Decompiled

undefined (1 param)

/* CBasePlayer::HandleFuncTrain() */

void __thiscall CBasePlayer::HandleFuncTrain(CBasePlayer *this)

{
  CBasePlayer CVar1;
  char cVar2;
  int *piVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  float fVar7;
  undefined4 uVar8;
  CTraceFilterSimple local_dc [16];
  float local_cc;
  float local_c8;
  float local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  Vector local_64 [32];
  float local_44;
  int *local_24;
  
  cVar2 = CDirector::IsFinale(TheDirector);
  if (cVar2 != '\0') {
    return;
  }
  if (((byte)this[0x1d20] & 1) == 0) {
    CBaseEntity::RemoveFlag((CBaseEntity *)this,8);
    CVar1 = this[0x1d20];
  }
  else {
    CBaseEntity::AddFlag((CBaseEntity *)this,8);
    CVar1 = this[0x1d20];
  }
  if (((byte)CVar1 & 1) == 0) {
    if (((byte)this[0x1d18] & 0x80) == 0) {
      return;
    }
  }
  else {
    piVar3 = (int *)CBaseEntity::GetGroundEntity((CBaseEntity *)this);
    if ((piVar3 == (int *)0x0) ||
       (uVar4 = (**(code **)(*piVar3 + 0xa4))(piVar3), (uVar4 & 0x80) == 0)) {
      piVar3 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
      uVar4 = (**(code **)(*piVar3 + 0xa4))(piVar3);
      if ((uVar4 & 0x80) != 0) {
        *(undefined4 *)(this + 0x1d18) = 0xc0;
        if ((*(uint *)(this + 0x1cb0) & 8) != 0) {
          *(undefined4 *)(this + 0x1d18) = 0xc4;
          return;
        }
        *(uint *)(this + 0x1d18) =
             (-(uint)((*(uint *)(this + 0x1cb0) & 0x10) == 0) & 0xfffffffc) + 0xc5;
        return;
      }
      uVar8 = (**(code **)(*(int *)this + 0x7a0))(this,1);
      if (((byte)this[0x14d] & 8) == 0) {
        local_c4 = *(float *)(this + 0x2e8);
        local_bc = 0.0;
        local_b4 = local_c4 - 38.0;
        fVar7 = local_bc;
        local_cc = *(float *)(this + 0x2e0);
        local_c8 = *(float *)(this + 0x2e4);
        local_b8 = local_bc;
      }
      else {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        local_c4 = *(float *)(this + 0x2e8);
        local_cc = *(float *)(this + 0x2e0);
        local_c8 = *(float *)(this + 0x2e4);
        local_b4 = local_c4 - 38.0;
        if (((byte)this[0x14d] & 8) == 0) {
          local_bc = 0.0;
          fVar7 = local_bc;
          local_b8 = local_bc;
        }
        else {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          local_bc = local_cc - *(float *)(this + 0x2e0);
          local_c4 = *(float *)(this + 0x2e8);
          local_b8 = local_c8 - *(float *)(this + 0x2e4);
          fVar7 = local_bc * local_bc + local_b8 * local_b8;
          local_cc = *(float *)(this + 0x2e0);
          local_c8 = *(float *)(this + 0x2e4);
        }
      }
      local_b4 = local_b4 - local_c4;
      local_87 = local_b4 * local_b4 + fVar7 != 0.0;
      local_94 = 0;
      local_98 = 0;
      local_9c = 0;
      local_88 = 1;
      local_8c = 0;
      local_a4 = 0;
      local_a8 = 0;
      local_ac = 0;
      CTraceFilterSimple::CTraceFilterSimple
                (local_dc,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
      (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,uVar8,local_dc,local_70);
      if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
        DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
      }
      if ((((local_44 != 1.0) && (local_24 != (int *)0x0)) &&
          (uVar4 = (**(code **)(*local_24 + 0xa4))(local_24), (uVar4 & 0x80) != 0)) &&
         (cVar2 = (**(code **)(*local_24 + 0x164))(local_24,this), piVar3 = local_24, cVar2 != '\0')
         ) goto LAB_007ade8d;
    }
    else if (((((byte)this[0x150] & 1) != 0) && ((*(byte *)(piVar3 + 0x52) & 2) == 0)) &&
            ((*(uint *)(this + 0x1cb0) & 0x600) == 0)) {
LAB_007ade8d:
      CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&vec3_origin);
      if ((*(uint *)(this + 0x1cb4) & 8) == 0) {
        if ((*(uint *)(this + 0x1cb4) & 0x10) == 0) {
          return;
        }
        iVar5 = *piVar3;
        uVar8 = 0xbf800000;
      }
      else {
        iVar5 = *piVar3;
        uVar8 = 0x3f800000;
      }
      (**(code **)(iVar5 + 0x1ac))(piVar3,this,this,2,uVar8);
      iVar5 = 0xc5;
      iVar6 = (int)(float)piVar3[0x47];
      if ((-1 < iVar6) && (iVar5 = 0xc1, iVar6 != 0)) {
        iVar5 = 0xc2;
        if (0.33 <= (float)iVar6 / (float)(int)(float)piVar3[0x121]) {
          iVar5 = (0.66 <= (float)iVar6 / (float)(int)(float)piVar3[0x121]) + 0xc3;
        }
      }
      *(int *)(this + 0x1d18) = iVar5;
      return;
    }
    *(uint *)(this + 0x1d20) = *(uint *)(this + 0x1d20) & 0xfffffffe;
  }
  *(undefined4 *)(this + 0x1d18) = 0xc0;
  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)