L L4D2node

CWeaponScavengeItemSpawn::InputSpawnScavengeItem

0x008d7120 · 660 bytes · __cdecl

_ZN24CWeaponScavengeItemSpawn22InputSpawnScavengeItemER11inputdata_t

Decompiled

undefined (1 param)

/* CWeaponScavengeItemSpawn::InputSpawnScavengeItem(inputdata_t&) */

void CWeaponScavengeItemSpawn::InputSpawnScavengeItem(inputdata_t *param_1)

{
  CGlowProperty *this;
  CBaseEdict *this_00;
  undefined4 uVar1;
  int iVar2;
  char *pcVar3;
  CBaseEntity *this_01;
  undefined4 *puVar4;
  int iVar5;
  float fVar6;
  float fVar7;
  undefined1 local_40 [8];
  float local_38;
  undefined1 local_34 [12];
  undefined4 local_28;
  undefined4 local_24;
  float local_20;
  
  uVar1 = (**(code **)(*(int *)param_1 + 0x3cc))(param_1);
  iVar2 = GetWeaponInfo(uVar1);
  if (iVar2 != 0) {
    pcVar3 = (char *)WeaponIDToClassname(uVar1);
    this_01 = (CBaseEntity *)CreateEntityByName(pcVar3,-1,true);
    if (this_01 == (CBaseEntity *)0x0) {
      *(undefined4 *)(param_1 + 0x146c) = 0xffffffff;
      Msg("Failed to spawn item by class %s\n",pcVar3);
      UTIL_Remove((CBaseEntity *)param_1);
      return;
    }
    puVar4 = (undefined4 *)(**(code **)(*(int *)this_01 + 0xc))(this_01);
    *(undefined4 *)(param_1 + 0x146c) = *puVar4;
    if (((byte)param_1[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
    }
    CBaseEntity::SetAbsOrigin(this_01,(Vector *)(param_1 + 0x2e0));
    if (((byte)param_1[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
    }
    CBaseEntity::SetAbsAngles(this_01,(QAngle *)(param_1 + 0x37c));
    (**(code **)(*(int *)this_01 + 0x6c))(this_01);
    if (((byte)this_01[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this_01);
    }
    local_28 = *(undefined4 *)(this_01 + 0x2e0);
    this = (CGlowProperty *)(this_01 + 0x1f0);
    local_24 = *(undefined4 *)(this_01 + 0x2e4);
    local_20 = *(float *)(this_01 + 0x2e8) + 12.0;
    CBaseEntity::SetAbsOrigin(this_01,(Vector *)&local_28);
    DispatchSpawn(this_01,true);
    CGlowProperty::SetGlowState(this,*(int *)(param_1 + 0x1468));
    CGlowProperty::SetGlowRange(this,0);
    CGlowProperty::SetGlowColorOverride(this,0xffffff);
    (**(code **)(*(int *)this_01 + 0x728))(this_01,param_1);
    iVar2 = *(int *)(param_1 + 0x1450);
    if ((-1 < iVar2) && (iVar2 != *(int *)(this_01 + 0x458))) {
      if (this_01[0x6c] == (CBaseEntity)0x0) {
        this_00 = *(CBaseEdict **)(this_01 + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this_01[0x70] = (CBaseEntity)((byte)this_01[0x70] | 1);
      }
      *(int *)(this_01 + 0x458) = iVar2;
    }
    (**(code **)(*(int *)(this_01 + 0x194) + 0xc))(this_01 + 0x194,local_40,local_34);
    if (((byte)this_01[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this_01);
    }
    fVar7 = *(float *)(this_01 + 0x2e8);
    fVar6 = fVar7 - local_38;
    if (0.0 < fVar6) {
      if (((byte)this_01[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(this_01);
        fVar7 = *(float *)(this_01 + 0x2e8);
      }
      local_28 = *(undefined4 *)(this_01 + 0x2e0);
      local_20 = fVar7 + fVar6;
      local_24 = *(undefined4 *)(this_01 + 0x2e4);
      CBaseEntity::SetAbsOrigin(this_01,(Vector *)&local_28);
    }
  }
  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)