ParseRagdollIntoCache
0x004a2ea0 · 1310 bytes · __cdecl
_Z21ParseRagdollIntoCacheP10CStudioHdrP10vcollide_ti
Decompiled
undefined (3 params)
/* ParseRagdollIntoCache(CStudioHdr*, vcollide_t*, int) */
void ParseRagdollIntoCache(CStudioHdr *param_1,vcollide_t *param_2,int param_3)
{
int iVar1;
char cVar2;
short sVar3;
int *piVar4;
int iVar5;
ushort *puVar6;
uint uVar7;
char *pcVar8;
int iVar9;
uint uVar10;
int in_GS_OFFSET;
ushort local_1ab6;
int local_1ab0;
uint local_1aa0;
undefined4 local_1a94;
undefined1 local_1a90 [20];
undefined2 local_1a7c;
undefined2 local_1a7a;
ushort local_1a78;
undefined4 local_1a74;
undefined4 local_1a70;
int local_19fc;
int local_19f8;
undefined1 local_19f4 [52];
cache_ragdoll2bodypart_t local_19c0 [2];
undefined2 uStack_19be;
uint auStack_19bc [303];
cache_ragdollsolid_t local_1500 [4];
int aiStack_14fc [11];
int aiStack_14d0 [324];
cache_ragdollconstraint_t local_fc0 [48];
matrix3x4_t amStack_f90 [48];
undefined2 auStack_f60 [1152];
char local_660 [1024];
undefined1 local_260 [524];
undefined4 local_54;
undefined4 local_4c;
int local_48;
int local_44;
int local_40;
int local_3c;
int local_38;
int local_34;
int local_30;
int local_2c;
int local_28;
int local_24;
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
piVar4 = (int *)(**(code **)(*physcollision + 0xa0))(physcollision,param_2);
iVar5 = (**(code **)(*physprops + 0x10))(physprops,"default");
_V_memset(auStack_19bc + 0x2f,-1,0x400);
_V_memset(local_19c0,0,0xc0);
puVar6 = (ushort *)(**(code **)(*modelinfo + 0x1c))(modelinfo,param_3);
if (puVar6 != (ushort *)0x0) {
local_1ab6 = *puVar6;
if (local_1ab6 != 0) {
uVar10 = 0;
do {
pcVar8 = *(char **)(*(int *)(puVar6 + 0x10) + uVar10 * 4);
if (pcVar8 == (char *)0x0) {
*(undefined2 *)(local_19c0 + uVar10 * 8) = 0xffff;
}
else {
uVar7 = Studio_BoneIndexByName(param_1,pcVar8);
*(short *)(local_19c0 + uVar10 * 8) = (short)uVar7;
if (uVar7 < 0x100) {
auStack_19bc[uVar7 + 0x2f] = uVar10;
}
}
auStack_19bc[uVar10 * 2] = 0xffffffff;
*(short *)((int)auStack_19bc + uVar10 * 8 + -2) = (short)iVar5;
uVar10 = uVar10 + 1;
} while (uVar10 < *puVar6);
goto LAB_004a2ff4;
}
}
local_1ab6 = 0;
LAB_004a2ff4:
_V_memset(&local_1a94,0,0x20);
local_1aa0 = 0;
local_1ab0 = 0;
LAB_004a3030:
do {
cVar2 = (**(code **)(*piVar4 + 0xc))(piVar4);
while( true ) {
if (cVar2 != '\0') {
(**(code **)(*physcollision + 0xa4))(physcollision,piVar4);
local_1a7c = (undefined2)local_1aa0;
local_1a7a = (undefined2)local_1ab0;
local_1a78 = local_1ab6;
CreateRagdollCache(param_2,local_1500,local_fc0,local_19c0,(cache_ragdoll_t *)&local_1a94);
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
pcVar8 = (char *)(**(code **)(*piVar4 + 8))(piVar4);
iVar9 = _V_stricmp(pcVar8,"solid");
if (iVar9 != 0) {
iVar9 = _V_stricmp(pcVar8,"ragdollconstraint");
if (iVar9 == 0) {
(**(code **)(*piVar4 + 0x18))(piVar4,&local_1a74,0);
if (((local_19f8 != local_19fc) && (-1 < local_19f8)) && (-1 < local_19fc)) {
_V_memcpy(local_fc0 + local_1ab0 * 100,local_19f4,0x30);
auStack_f60[local_1ab0 * 0x32] = (short)local_19fc;
auStack_f60[local_1ab0 * 0x32 + 1] = (short)local_19f8;
Studio_CalcBoneToBoneTransform
(param_1,(int)(short)aiStack_14d0[local_19f8 * 0xe],
(int)(short)aiStack_14d0[local_19fc * 0xe],amStack_f90 + local_1ab0 * 100);
local_1ab0 = local_1ab0 + 1;
}
}
else {
iVar9 = _V_stricmp(pcVar8,"collisionrules");
if (iVar9 == 0) {
local_1a70 = (**(code **)(*physics + 0x28))(physics,param_3,*(ushort *)param_2 & 0x7fff)
;
local_1a74 = 1;
(**(code **)(*piVar4 + 0x2c))(piVar4,&local_1a74,0);
local_1a94 = local_1a70;
}
else {
iVar9 = _V_stricmp(pcVar8,"animatedfriction");
if (iVar9 == 0) {
(**(code **)(*piVar4 + 0x30))(piVar4,local_1a90,0);
}
else {
(**(code **)(*piVar4 + 0x28))(piVar4);
}
}
}
goto LAB_004a3030;
}
(**(code **)(*piVar4 + 0x10))(piVar4,local_660,&g_SolidSetup);
*(undefined2 *)(aiStack_14d0 + local_1aa0 * 0xe + 1) = 0;
sVar3 = Studio_BoneIndexByName(param_1,local_660);
*(short *)(aiStack_14d0 + local_1aa0 * 0xe) = sVar3;
if (sVar3 < 0) break;
*(short *)((int)aiStack_14d0 + (local_1aa0 * 0x1c + 1) * 2) = (short)local_54;
iVar9 = (**(code **)(*physprops + 0x10))(physprops,local_260);
if (iVar9 < 0) {
iVar9 = iVar5;
}
iVar1 = aiStack_14d0[local_1aa0 * 0xe];
aiStack_14d0[local_1aa0 * 0xe + -1] = iVar9;
if (((short)iVar1 < 0x100) && (uVar10 = auStack_19bc[(short)iVar1 + 0x2f], uVar10 < 0x18)) {
*(short *)((int)auStack_19bc + uVar10 * 8 + -2) = (short)iVar9;
*(short *)(aiStack_14d0 + local_1aa0 * 0xe + 1) = (short)uVar10;
auStack_19bc[uVar10 * 2] = local_1aa0;
}
*(undefined4 *)(local_1500 + local_1aa0 * 0x38) = local_4c;
aiStack_14fc[local_1aa0 * 0xe] = local_48;
aiStack_14fc[local_1aa0 * 0xe + 1] = local_44;
aiStack_14fc[local_1aa0 * 0xe + 2] = local_40;
aiStack_14fc[local_1aa0 * 0xe + 3] = local_3c;
aiStack_14fc[local_1aa0 * 0xe + 4] = local_38;
aiStack_14fc[local_1aa0 * 0xe + 5] = local_34;
aiStack_14d0[local_1aa0 * 0xe + -5] = local_30;
aiStack_14d0[local_1aa0 * 0xe + -4] = local_2c;
aiStack_14d0[local_1aa0 * 0xe + -3] = local_28;
aiStack_14d0[local_1aa0 * 0xe + -2] = local_24;
cVar2 = (**(code **)(*piVar4 + 0xc))(piVar4);
local_1aa0 = local_1aa0 + 1;
}
Msg("ParseRagdollIntoCache: Couldn\'t Lookup Bone %s\n",local_660);
} while( true );
}
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.