L L4D2node

CCarriedProp::ConvertToPhysObject

0x0052ffd0 · 764 bytes · __thiscall

_ZN12CCarriedProp19ConvertToPhysObjectEb

Decompiled

undefined (2 params)

/* CCarriedProp::ConvertToPhysObject(bool) */

undefined4 __thiscall CCarriedProp::ConvertToPhysObject(CCarriedProp *this,bool param_1)

{
  code *pcVar1;
  CBasePlayer *this_00;
  undefined4 uVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int *piVar7;
  char *pcVar8;
  longdouble lVar9;
  float fVar10;
  undefined4 uVar11;
  undefined4 uVar12;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  this_00 = (CBasePlayer *)CBaseCombatWeapon::GetOwner((CBaseCombatWeapon *)this);
  if (this_00 != (CBasePlayer *)0x0) {
    uVar2 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
    if ((char)uVar2 != '\0') {
      iVar3 = CreatePhysObject(this);
      if (iVar3 != 0) {
        if (param_1) {
          piVar7 = *(int **)(iVar3 + 0x238);
          if (piVar7 != (int *)0x0) {
            uVar12 = 0;
            uVar11 = 0;
            CBasePlayer::EyeVectors(this_00,(Vector *)&local_34,(Vector *)0x0,(Vector *)0x0);
            lVar9 = (longdouble)(**(code **)(*piVar7 + 0x78))(piVar7);
            local_20 = 4.0;
            if ((float)lVar9 <= 15.0) {
              lVar9 = (longdouble)(**(code **)(*piVar7 + 0x78))(piVar7);
              local_20 = 0.5;
              if (0.5 <= (float)lVar9) {
                lVar9 = (longdouble)(**(code **)(*piVar7 + 0x78))(piVar7);
                local_20 = ((float)lVar9 + -0.5) * 0.2413793 + 0.5;
              }
            }
            fVar10 = local_20 * *(float *)(player_throwforce._28_4_ + 0x2c);
            local_34 = local_34 * fVar10;
            local_30 = local_30 * fVar10;
            local_2c = fVar10 * local_2c;
            (**(code **)(*piVar7 + 0xf4))(piVar7,(Vector *)&local_34,uVar11,uVar12,local_20);
            iVar4 = rand();
            iVar5 = rand();
            iVar6 = rand();
            local_28 = ((float)iVar4 * 0.0006103702 + -10.0) * local_20;
            local_24 = ((float)iVar5 * 0.0006103702 + -10.0) * local_20;
            local_20 = ((float)iVar6 * 0.0006103702 + -10.0) * local_20;
            (**(code **)(*piVar7 + 0xfc))(piVar7,&local_28);
          }
          piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                    (gameeventmanager,"weapon_drop_to_prop",0,0);
          if (piVar7 != (int *)0x0) {
            pcVar1 = *(code **)(*piVar7 + 0x30);
            uVar11 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
            (*pcVar1)(piVar7,"userid",uVar11);
            pcVar8 = *(char **)(this + 0x7c);
            if (pcVar8 == (char *)0x0) {
              pcVar8 = "";
            }
            iVar4 = StringAfterPrefix(pcVar8,"weapon_");
            if (iVar4 != 0) {
              pcVar8 = pcVar8 + 7;
            }
            (**(code **)(*piVar7 + 0x3c))(piVar7,"item",pcVar8);
            if (*(int *)(iVar3 + 0x30) == 0) {
              iVar4 = 0;
            }
            else {
              iVar4 = *(int *)(iVar3 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
            }
            (**(code **)(*piVar7 + 0x30))(piVar7,"propid",iVar4);
            (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
          }
        }
        CGlowProperty::SetGlowState((CGlowProperty *)(iVar3 + 0x1f0),*(int *)(this + 0x17f4));
      }
      UnequipAndDestroySelf(this);
      return uVar2;
    }
  }
  return 0;
}

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)