CRagdoll::Init
0x0049e960 · 746 bytes · __cdecl
_ZN8CRagdoll4InitEP11CBaseEntityS1_P10CStudioHdrRK6VectoriPK11matrix3x4_tS9_S9_ff
Decompiled
undefined (10 params)
/* CRagdoll::Init(CBaseEntity*, CBaseEntity*, CStudioHdr*, Vector const&, int, matrix3x4_t const*,
matrix3x4_t const*, matrix3x4_t const*, float, float) */
void CRagdoll::Init(CBaseEntity *param_1,CBaseEntity *param_2,CStudioHdr *param_3,Vector *param_4,
int param_5,matrix3x4_t *param_6,matrix3x4_t *param_7,matrix3x4_t *param_8,
float param_9,float param_10)
{
ragdoll_t *prVar1;
int *piVar2;
code *pcVar3;
IPhysicsEnvironment *pIVar4;
char cVar5;
ushort uVar6;
undefined4 uVar7;
CBaseEntity *pCVar8;
int iVar9;
int iVar10;
longdouble lVar11;
CBaseEntity *local_54;
vcollide_t *local_50;
Vector *local_4c;
undefined4 local_48;
undefined4 local_44;
undefined4 local_40;
undefined4 local_3c;
float local_38;
float local_34;
float local_30;
matrix3x4_t *local_2c;
float local_28;
undefined4 local_24;
undefined1 local_20;
local_54 = param_2;
local_48 = (**(code **)(*(int *)param_2 + 0x1c))(param_2);
local_50 = (vcollide_t *)(**(code **)(*modelinfo + 0x18))(modelinfo,local_48);
if (local_50 != (vcollide_t *)0x0) {
local_44 = 0;
local_40 = 0;
local_3c = 0;
local_4c = param_4;
local_38 = *(float *)(phys_ragdoll_force_magnitude._28_4_ + 0x2c);
local_24 = 0x3f800000;
local_20 = 0;
local_34 = *(float *)(param_5 + 4) * local_38;
local_30 = *(float *)(param_5 + 8) * local_38;
local_38 = local_38 * *(float *)param_5;
local_2c = param_6;
local_28 = param_9;
prVar1 = (ragdoll_t *)(param_1 + 4);
cVar5 = RagdollCreate(prVar1,(ragdollparams_t *)&local_54,physenv);
if (cVar5 == '\0') {
DevWarning("Failed to create ragdoll for %s\n",*(int *)local_4c + 0xc);
return;
}
pCVar8 = param_1 + 0x1c;
CBaseEntity::VPhysicsSetObject(param_2,(IPhysicsObject *)0x0);
CBaseEntity::VPhysicsSetObject(param_2,*(IPhysicsObject **)(param_1 + 0x1c));
CBaseEntity::SetCollisionGroup(param_2,1);
if (0 < *(int *)(param_1 + 4)) {
iVar9 = 0;
do {
(**(code **)(**(int **)pCVar8 + 0x150))(*(int **)pCVar8,1);
if ((*(int *)(ragdoll_self_collision._28_4_ + 0x30) == 0) &&
(*(int *)(ragdoll_collide._28_4_ + 0x30) == 0)) {
piVar2 = *(int **)pCVar8;
uVar6 = (**(code **)(*piVar2 + 0x50))(piVar2);
(**(code **)(*piVar2 + 0x4c))(piVar2,uVar6 | 0x8000);
(**(code **)(**(int **)pCVar8 + 0x154))(*(int **)pCVar8,1);
}
iVar9 = iVar9 + 1;
pCVar8 = pCVar8 + 0x54;
} while (iVar9 < *(int *)(param_1 + 4));
}
RagdollApplyAnimationAsVelocity(prVar1,param_7,param_8,param_10);
iVar9 = (**(code **)(*(int *)param_2 + 0x1c))(param_2);
RagdollActivate(prVar1,local_50,iVar9,(CCallQueue *)0x0,true);
(**(code **)(**(int **)(param_1 + 0x1c) + 0xc4))(*(int **)(param_1 + 0x1c),param_1 + 0x87c,0);
lVar11 = (longdouble)(**(code **)(*(int *)physenv + 0x9c))(physenv);
pIVar4 = physenv;
*(float *)(param_1 + 0x89c) = (float)lVar11;
lVar11 = (longdouble)(**(code **)(*(int *)pIVar4 + 0x9c))(pIVar4);
*(float *)(param_1 + 0x8a0) = (float)lVar11;
*(uint *)(param_2 + 0x14c) = *(uint *)(param_2 + 0x14c) | 0x40000;
if (*(int *)(param_1 + 4) != 0) {
(**(code **)(*(int *)param_1 + 0x28))(param_1,param_2);
iVar9 = *(int *)(param_1 + 4);
if (0 < iVar9) {
iVar10 = 0;
pCVar8 = param_1 + 0x1c;
do {
iVar10 = iVar10 + 1;
pcVar3 = *(code **)(*g_pPhysSaveRestoreManager + 4);
uVar7 = (**(code **)(*(int *)param_2 + 0x1c))(param_2);
(*pcVar3)(g_pPhysSaveRestoreManager,*(undefined4 *)pCVar8,uVar7);
iVar9 = *(int *)(param_1 + 4);
pCVar8 = pCVar8 + 0x54;
} while (iVar10 < iVar9);
}
if (iVar9 != 0) {
s_globalCount = s_globalCount + 1;
}
}
}
return;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.