L L4D2node

CPistol::Drop

0x00555000 · 565 bytes · __thiscall

_ZN7CPistol4DropERK6Vector

Decompiled

undefined (2 params)

/* CPistol::Drop(Vector const&) */

void __thiscall CPistol::Drop(CPistol *this,Vector *param_1)

{
  CBaseEdict *this_00;
  int *piVar1;
  code *pcVar2;
  char cVar3;
  CBaseEntity *this_01;
  int iVar4;
  float *pfVar5;
  float *pfVar6;
  int iVar7;
  int iVar8;
  undefined4 uVar9;
  undefined4 *puVar10;
  uint uVar11;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  puVar10 = (undefined4 *)&stack0xffffffb4;
  cVar3 = (**(code **)(*(int *)this + 0x674))();
  if (cVar3 != '\0') {
    this_01 = (CBaseEntity *)CreateEntityByName("weapon_pistol",-1,true);
    puVar10 = (undefined4 *)&stack0xffffffb4;
    if (this_01 != (CBaseEntity *)0x0) {
      (**(code **)(*(int *)this + 0x234))();
      CBaseEntity::SetLocalOrigin(this_01,(Vector *)&local_28);
      uVar11 = *(uint *)(this_01 + 0x148) | 0x40000000;
      if (*(uint *)(this_01 + 0x148) != uVar11) {
        if (this_01[0x6c] == (CBaseEntity)0x0) {
          this_00 = *(CBaseEdict **)(this_01 + 0x30);
          if (this_00 != (CBaseEdict *)0x0) {
            *(uint *)this_00 = *(uint *)this_00 | 0x101;
            iVar4 = CBaseEdict::GetChangeAccessor(this_00);
            *(undefined2 *)(iVar4 + 2) = 0;
          }
        }
        else {
          this_01[0x70] = (CBaseEntity)((byte)this_01[0x70] | 1);
        }
        *(uint *)(this_01 + 0x148) = uVar11;
      }
      (**(code **)(*(int *)this_01 + 0x50))();
      DispatchSpawn(this_01,true);
      puVar10 = (undefined4 *)&stack0xffffffb0;
      if (*(int **)(this_01 + 0x238) != (int *)0x0) {
        local_28 = 0x43480000;
        local_24 = 0x43480000;
        local_20 = 0x43480000;
        (**(code **)(**(int **)(this_01 + 0x238) + 0xd8))();
        puVar10 = (undefined4 *)&stack0xffffffb0;
      }
    }
    if (0 < DAT_0100486c) {
      iVar4 = 0;
      do {
        piVar1 = *(int **)(TheWeaponSpawns + iVar4 * 4);
        iVar8 = *(int *)this;
        *puVar10 = this;
        pcVar2 = *(code **)(iVar8 + 0x288);
        puVar10[-1] = 0x55515d;
        pfVar5 = (float *)(*pcVar2)();
        iVar8 = *piVar1;
        *puVar10 = piVar1;
        pcVar2 = *(code **)(iVar8 + 0x288);
        puVar10[-1] = 0x55516a;
        pfVar6 = (float *)(*pcVar2)();
        if ((*pfVar6 - *pfVar5) * (*pfVar6 - *pfVar5) +
            (pfVar6[1] - pfVar5[1]) * (pfVar6[1] - pfVar5[1]) +
            (pfVar6[2] - pfVar5[2]) * (pfVar6[2] - pfVar5[2]) < 40000.0) {
          iVar8 = *piVar1;
          *puVar10 = piVar1;
          pcVar2 = *(code **)(iVar8 + 0x3cc);
          puVar10[-1] = 0x5551b4;
          iVar7 = (*pcVar2)();
          iVar8 = *(int *)this;
          *puVar10 = this;
          pcVar2 = *(code **)(iVar8 + 0x638);
          puVar10[-1] = 0x5551c4;
          iVar8 = (*pcVar2)();
          if (iVar7 == iVar8) {
            if (this_01 == (CBaseEntity *)0x0) {
              uVar9 = 0;
            }
            else {
              puVar10[3] = 0;
              puVar10[2] = &CWeaponCSBase::typeinfo;
              puVar10[1] = &CBaseEntity::typeinfo;
              *puVar10 = this_01;
              puVar10[-1] = 0x5551f6;
              uVar9 = __dynamic_cast();
            }
            puVar10[1] = uVar9;
            *puVar10 = piVar1;
            puVar10[-1] = 0x555208;
            cVar3 = CWeaponSpawn::AbsorbWeapon((CWeaponSpawn *)*puVar10,(CWeaponCSBase *)puVar10[1])
            ;
            if (cVar3 != '\0') break;
          }
        }
        iVar4 = iVar4 + 1;
      } while (iVar4 < DAT_0100486c);
    }
    iVar4 = *(int *)this;
    puVar10[1] = 1;
    *puVar10 = this;
    pcVar2 = *(code **)(iVar4 + 0x720);
    puVar10[-1] = 0x55522d;
    (*pcVar2)();
  }
  *puVar10 = this;
  puVar10[1] = param_1;
  puVar10[-1] = 0x55502a;
  CTerrorWeapon::Drop((CTerrorWeapon *)*puVar10,(Vector *)puVar10[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)