L L4D2node

CGib::SpawnStickyGibs

0x006d59c0 · 997 bytes · __cdecl

_ZN4CGib15SpawnStickyGibsEP11CBaseEntity6Vectori

Decompiled

undefined (3 params)

/* CGib::SpawnStickyGibs(CBaseEntity*, Vector, int) */

void CGib::SpawnStickyGibs(int *param_1,float param_2,float param_3,float param_4,int param_5)

{
  CBaseEdict *this;
  int iVar1;
  undefined4 uVar2;
  CBaseEntity *this_00;
  int iVar3;
  int iVar4;
  longdouble lVar5;
  longdouble lVar6;
  longdouble lVar7;
  undefined1 local_44 [16];
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  if ((*(int *)(g_Language._28_4_ + 0x30) != 1) && (0 < param_5)) {
    iVar4 = 0;
    do {
      this_00 = (CBaseEntity *)CreateEntityByName("gib",-1,true);
      Spawn((CGib *)this_00,"models/stickygib.mdl");
      iVar3 = (**(code **)(*random_valve + 8))(random_valve,0,2);
      if (iVar3 != *(int *)(this_00 + 0x45c)) {
        if (this_00[0x6c] == (CBaseEntity)0x0) {
          this = *(CBaseEdict **)(this_00 + 0x30);
          if (this != (CBaseEdict *)0x0) {
            *(uint *)this = *(uint *)this | 0x101;
            iVar1 = CBaseEdict::GetChangeAccessor(this);
            *(undefined2 *)(iVar1 + 2) = 0;
          }
        }
        else {
          this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
        }
        *(int *)(this_00 + 0x45c) = iVar3;
      }
      if (param_1 != (int *)0x0) {
        lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xc0400000,0x40400000);
        lVar6 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xc0400000,0x40400000);
        lVar7 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xc0400000,0x40400000);
        local_28 = (float)lVar7 + param_2;
        local_24 = (float)lVar6 + param_3;
        local_20 = (float)lVar5 + param_4;
        CBaseEntity::SetLocalOrigin(this_00,(Vector *)&local_28);
        local_34 = -g_vecAttackDir;
        local_30 = -DAT_00fe36b8;
        local_2c = -DAT_00fe36bc;
        lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbe19999a,0x3e19999a);
        local_34 = (float)lVar5 + local_34;
        lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbe19999a,0x3e19999a);
        local_30 = (float)lVar5 + local_30;
        lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbe19999a,0x3e19999a);
        local_34 = local_34 * 900.0;
        local_2c = ((float)lVar5 + local_2c) * 900.0;
        local_30 = local_30 * 900.0;
        lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x437a0000,0x43c80000);
        lVar6 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x437a0000,0x43c80000);
        local_28 = (float)lVar6;
        local_20 = 0.0;
        local_24 = (float)lVar5;
        CBaseEntity::SetLocalAngularVelocity(this_00,(QAngle *)&local_28);
        uVar2 = (**(code **)(*param_1 + 0x138))(param_1);
        *(undefined4 *)(this_00 + 0x1410) = uVar2;
        AdjustVelocityBasedOnHealth((CGib *)this_00,param_1[0x40],(Vector *)&local_34);
        CBaseEntity::SetAbsVelocity(this_00,(Vector *)&local_34);
        CBaseEntity::SetMoveType(this_00,5,0);
        CCollisionProperty::SetSolidFlags
                  ((CCollisionProperty *)(this_00 + 0x194),*(ushort *)(this_00 + 0x1b4) & 0xfffffffb
                  );
        CBaseEntity::SetCollisionBounds(this_00,(Vector *)&vec3_origin,(Vector *)&vec3_origin);
        *(code **)(this_00 + 0xd8) = StickyGibTouch;
        *(undefined4 *)(this_00 + 0xdc) = 0;
        CBaseEntity::ThinkSet((_func_void *)local_44,(float)this_00,(char *)0x0);
      }
      iVar4 = iVar4 + 1;
      LimitVelocity((CGib *)this_00);
    } while (iVar4 != param_5);
  }
  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)