L L4D2node

CGib::InitGib

0x006d5440 · 828 bytes · __thiscall

_ZN4CGib7InitGibEP11CBaseEntityff

Decompiled

undefined (4 params)

/* CGib::InitGib(CBaseEntity*, float, float) */

void __thiscall CGib::InitGib(CGib *this,CBaseEntity *param_1,float param_2,float param_3)

{
  float fVar1;
  int *piVar2;
  undefined4 uVar3;
  int iVar4;
  longdouble lVar5;
  Vector local_4c [8];
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  undefined4 local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  if (param_1 != (CBaseEntity *)0x0) {
    local_28 = 1.0;
    local_24 = 1.0;
    local_20 = 1.0;
    CCollisionProperty::RandomPointInBounds
              ((CCollisionProperty *)(param_1 + 0x194),(Vector *)&vec3_origin,(Vector *)&local_28,
               local_4c);
    local_44 = local_44 + 1.0;
    CBaseEntity::SetAbsOrigin((CBaseEntity *)this,local_4c);
    local_40 = -g_vecAttackDir;
    local_3c = -DAT_00fe36b8;
    local_38 = -DAT_00fe36bc;
    lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbe800000,0x3e800000);
    local_40 = (float)lVar5 + local_40;
    lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbe800000,0x3e800000);
    local_3c = (float)lVar5 + local_3c;
    lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0xbe800000,0x3e800000);
    local_38 = (float)lVar5 + local_38;
    lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,param_3,param_2);
    local_34 = *(float *)(this + 0x280);
    fVar1 = (float)lVar5;
    local_30 = *(float *)(this + 0x284);
    local_40 = local_40 * fVar1;
    local_2c = *(undefined4 *)(this + 0x288);
    local_3c = local_3c * fVar1;
    local_38 = fVar1 * local_38;
    lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x42c80000,0x43480000);
    local_34 = (float)lVar5;
    lVar5 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x42c80000,0x43960000);
    local_30 = (float)lVar5;
    CBaseEntity::SetLocalAngularVelocity((CBaseEntity *)this,(QAngle *)&local_34);
    uVar3 = (**(code **)(*(int *)param_1 + 0x138))(param_1);
    *(undefined4 *)(this + 0x1410) = uVar3;
    AdjustVelocityBasedOnHealth(this,*(int *)(param_1 + 0x100),(Vector *)&local_40);
    iVar4 = CBaseEntity::VPhysicsInitNormal((CBaseEntity *)this,2,0,0,0);
    if (iVar4 == 0) {
      CCollisionProperty::SetSolid((CCollisionProperty *)(this + 0x194),2);
      CBaseEntity::SetCollisionBounds
                ((CBaseEntity *)this,(Vector *)&vec3_origin,(Vector *)&vec3_origin);
      CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&local_40);
    }
    else {
      piVar2 = *(int **)(this + 0x238);
      if (piVar2 != (int *)0x0) {
        iVar4 = rand();
        local_28 = (float)iVar4 * 0.03051851 - 500.0;
        iVar4 = rand();
        local_24 = (float)iVar4 * 0.03051851 - 500.0;
        iVar4 = rand();
        local_20 = (float)iVar4 * 0.03051851 - 500.0;
        (**(code **)(*piVar2 + 0xd8))(piVar2,(Vector *)&local_40,&local_28);
      }
    }
    CBaseEntity::SetCollisionGroup((CBaseEntity *)this,1);
  }
  LimitVelocity(this);
  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)