L L4D2node

CBasePlayer::PlayerUse

0x00418360 · 936 bytes · __thiscall

_ZN11CBasePlayer9PlayerUseEP11CBaseEntity

Decompiled

undefined (2 params)

/* CBasePlayer::PlayerUse(CBaseEntity*) */

void __thiscall CBasePlayer::PlayerUse(CBasePlayer *this,CBaseEntity *param_1)

{
  char cVar1;
  uint uVar2;
  int *piVar3;
  code *pcVar4;
  undefined *puVar5;
  undefined4 uVar6;
  undefined4 local_30 [3];
  undefined4 local_24;
  undefined4 local_20;
  
  uVar2 = *(uint *)(this + 0x1cb4);
  if (((*(uint *)(this + 0x1cb0) | uVar2 | *(uint *)(this + 0x1cb8)) & 0x20) == 0) {
    return;
  }
  if (((byte)this[0x1d20] & 8) != 0) {
    if ((uVar2 & 0x20) != 0) {
      (**(code **)(*(int *)this + 0x650))(this,1);
      return;
    }
    if ((*(uint *)(this + 0x1cb8) & 0x20) == 0) {
      return;
    }
    (**(code **)(*(int *)this + 0x650))(this,0);
    return;
  }
  if ((uVar2 & 0x20) != 0) {
    cVar1 = ClearUseEntity(this);
    if (cVar1 != '\0') {
      return;
    }
    if ((*(uint *)(this + 0x1d20) & 1) != 0) {
      *(undefined4 *)(this + 0x1d18) = 0xc0;
      *(uint *)(this + 0x1d20) = *(uint *)(this + 0x1d20) & 0xfffffffe;
      return;
    }
    piVar3 = (int *)CBaseEntity::GetGroundEntity((CBaseEntity *)this);
    if ((((piVar3 != (int *)0x0) && (((byte)this[0x1cb0] & 2) == 0)) &&
        (((byte)this[0x150] & 1) != 0)) &&
       ((uVar2 = (**(code **)(*piVar3 + 0xa4))(piVar3), (uVar2 & 0x80) != 0 &&
        (cVar1 = (**(code **)(*piVar3 + 0x164))(piVar3,this), cVar1 != '\0')))) {
      *(uint *)(this + 0x1d20) = *(uint *)(this + 0x1d20) | 1;
      uVar2 = TrainSpeed((int)(float)piVar3[0x47],(int)(float)piVar3[0x121]);
      *(uint *)(this + 0x1d18) = uVar2 | 0xc0;
      CBaseEntity::EmitSound((CBaseEntity *)this,"Player.UseTrain",0.0,(float *)0x0);
      return;
    }
  }
  if ((param_1 == (CBaseEntity *)0x0) &&
     (param_1 = (CBaseEntity *)
                (**(code **)(*(int *)this + 0x6e0))
                          (this,*(undefined4 *)(player_use_radius._28_4_ + 0x2c),0,0,0,0),
     param_1 == (CBaseEntity *)0x0)) {
    if (((byte)this[0x1cb4] & 0x20) == 0) {
      return;
    }
    (**(code **)(*(int *)this + 0x6dc))(this);
    return;
  }
  uVar2 = (**(code **)(*(int *)param_1 + 0xa4))(param_1);
  if ((((byte)this[0x1cb0] & 0x20) == 0) || ((uVar2 & 0x20) == 0)) {
    if ((((byte)this[0x1cb4] & 0x20) == 0) || ((uVar2 & 0x50) == 0)) {
      if ((((byte)this[0x1cb8] & 0x20) != 0) &&
         (uVar2 = (**(code **)(*(int *)param_1 + 0xa4))(param_1), (uVar2 & 0x40) != 0)) {
        local_30[0] = 0;
        local_24 = 0xffffffff;
        local_20 = 0;
        (**(code **)(*(int *)param_1 + 0xb4))(param_1,"Use",this,this,local_30,0);
        (**(code **)(*(int *)this + 0x6e8))(this,param_1,0);
        return;
      }
      uVar2 = *(uint *)(param_1 + 0x118);
      if (uVar2 == 0xffffffff) {
        return;
      }
      puVar5 = g_pEntityList + (uVar2 & 0xfff) * 0x10;
      if (puVar5 == (undefined *)0xfffffffc) {
        return;
      }
      if (*(uint *)(puVar5 + 8) != uVar2 >> 0xc) {
        return;
      }
      if (*(int *)(puVar5 + 4) == 0) {
        return;
      }
      pcVar4 = *(code **)(*(int *)param_1 + 0xb4);
      uVar6 = 0;
      goto LAB_0041858f;
    }
    if ((uVar2 & 0x20) != 0) goto LAB_00418550;
  }
  else {
LAB_00418550:
    *(uint *)(this + 0x1d20) = *(uint *)(this + 0x1d20) | 4;
  }
  uVar2 = (**(code **)(*(int *)param_1 + 0xa4))(param_1);
  pcVar4 = *(code **)(*(int *)param_1 + 0xb4);
  local_30[0] = 0;
  local_24 = 0xffffffff;
  local_20 = 0;
  if ((uVar2 & 0x40) == 0) {
    (*pcVar4)(param_1,"Use",this,this,local_30,3);
    (**(code **)(*(int *)this + 0x6e8))(this,param_1,3);
    return;
  }
  uVar6 = 1;
LAB_0041858f:
  local_20 = 0;
  local_24 = 0xffffffff;
  local_30[0] = 0;
  (*pcVar4)(param_1,"Use",this,this,local_30,uVar6);
  (**(code **)(*(int *)this + 0x6e8))(this,param_1,1);
  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)