L L4D2node

CGibShooter::SpawnGib

0x00670270 · 1001 bytes · __thiscall

_ZN11CGibShooter8SpawnGibERK6Vectorf

Decompiled

undefined (3 params)

/* CGibShooter::SpawnGib(Vector const&, float) */

CGib * __thiscall CGibShooter::SpawnGib(CGibShooter *this,Vector *param_1,float param_2)

{
  float fVar1;
  float fVar2;
  int iVar3;
  CBaseEntity *this_00;
  char *pcVar4;
  CGib *pCVar5;
  uint uVar6;
  int *piVar7;
  longdouble lVar8;
  undefined1 local_4c [12];
  char *local_40 [3];
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  iVar3 = *(int *)(this + 0x46c);
  if (iVar3 == 1) {
    this_00 = (CBaseEntity *)(**(code **)(*(int *)this + 0x324))(this);
    if (this_00 == (CBaseEntity *)0x0) {
      return (CGib *)0x0;
    }
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    CBaseEntity::SetAbsOrigin(this_00,(Vector *)(this + 0x2e0));
    CBaseEntity::SetAbsAngles(this_00,(QAngle *)(this + 0x454));
    fVar1 = *(float *)(this + 0x468);
    lVar8 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x3f733333,0x3f866666);
    *(float *)(this_00 + 0x1400) = (float)lVar8 * fVar1;
    CBaseEntity::SetCollisionGroup(this_00,1);
    uVar6 = (**(code **)(*(int *)(this_00 + 0x194) + 0x30))(this_00 + 0x194);
    piVar7 = (int *)CBaseEntity::VPhysicsInitNormal(this_00,6,uVar6 | 0x1000,0,0);
    CBaseEntity::SetMoveType(this_00,6,0);
    if (piVar7 != (int *)0x0) {
      local_34 = param_2 * *(float *)param_1;
      local_30 = param_2 * *(float *)(param_1 + 4);
      local_2c = param_2 * *(float *)(param_1 + 8);
      (**(code **)(*piVar7 + 0xd8))(piVar7,&local_34,0);
      fVar1 = *(float *)(this + 0x460);
      lVar8 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x3dcccccd,0x3f800000);
      fVar2 = *(float *)(this + 0x460);
      local_28 = (float)lVar8 * fVar1;
      lVar8 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x3dcccccd,0x3f800000);
      local_20 = 0.0;
      local_24 = (float)lVar8 * fVar2;
      lVar8 = (longdouble)(**(code **)(*piVar7 + 0x78))(piVar7);
      fVar1 = (float)lVar8;
      local_28 = local_28 * fVar1;
      local_24 = local_24 * fVar1;
      local_20 = fVar1 * local_20;
      (**(code **)(*piVar7 + 0xfc))(piVar7,&local_28);
      iVar3 = gpGlobals;
      if (((byte)this[0x148] & 4) == 0) {
        return (CGib *)this_00;
      }
      this_00[0x1404] = (CBaseEntity)0x1;
      CBaseEntity::SetNextThink
                (this_00,*(float *)(this_00 + 0x1400) + *(float *)(iVar3 + 0xc),(char *)0x0);
      CBaseEntity::ThinkSet((_func_void *)local_4c,(float)this_00,(char *)CGib::DieThink);
      return (CGib *)this_00;
    }
  }
  else {
    if (iVar3 == 2) {
      fVar1 = *(float *)(this + 0x468);
      local_24 = *(float *)(param_1 + 4) * 200.0 * param_2;
      local_20 = *(float *)(param_1 + 8) * 200.0 * param_2;
      local_28 = *(float *)param_1 * 200.0 * param_2;
      if ((((byte)this[0x14d] & 8) != 0) &&
         (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this), ((byte)this[0x14d] & 8) != 0)) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      (**(code **)(*(int *)this + 0x20))(local_40,this);
      pcVar4 = "";
      if (local_40[0] != (char *)0x0) {
        pcVar4 = local_40[0];
      }
      pCVar5 = (CGib *)CreateRagGib(pcVar4,(Vector *)(this + 0x2e0),(QAngle *)(this + 0x37c),
                                    (Vector *)&local_28,fVar1,false);
      return pCVar5;
    }
    if ((iVar3 != 0) ||
       (this_00 = (CBaseEntity *)(**(code **)(*(int *)this + 0x324))(this),
       this_00 == (CBaseEntity *)0x0)) {
      return (CGib *)0x0;
    }
    CBaseEntity::SetAbsAngles(this_00,(QAngle *)(this + 0x454));
  }
  InitPointGib(this,(CGib *)this_00,param_1,param_2);
  return (CGib *)this_00;
}

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)