CBaseEntity::SetParentAttachment
0x0060cb40 · 505 bytes · __thiscall
_ZN11CBaseEntity19SetParentAttachmentEPKcS1_b
Decompiled
undefined (4 params)
/* CBaseEntity::SetParentAttachment(char const*, char const*, bool) */
void __thiscall
CBaseEntity::SetParentAttachment(CBaseEntity *this,char *param_1,char *param_2,bool param_3)
{
int *piVar1;
CBaseEdict *this_00;
uint uVar2;
CBaseAnimating *this_01;
uint uVar3;
int iVar4;
undefined4 uVar5;
undefined *puVar6;
undefined1 *puVar7;
uVar3 = *(uint *)(this + 0x180);
if ((((uVar3 == 0xffffffff) ||
(puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar6 + 8) != uVar3 >> 0xc)) ||
(piVar1 = *(int **)(puVar6 + 4), piVar1 == (int *)0x0)) {
GetDebugName(this);
Warning();
return;
}
this_01 = (CBaseAnimating *)(**(code **)(*piVar1 + 0xf0))(piVar1);
if (this_01 == (CBaseAnimating *)0x0) {
GetDebugName(this);
Warning();
return;
}
uVar3 = CBaseAnimating::LookupAttachment(this_01,param_2);
if (uVar3 != 0) {
if (this[0x185] != SUB41(uVar3,0)) {
if (this[0x6c] == (CBaseEntity)0x0) {
this_00 = *(CBaseEdict **)(this + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar4 + 2) = 0;
}
}
else {
this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
}
this[0x185] = SUB41(uVar3,0);
}
uVar5 = 0;
uVar2 = *(uint *)(this + 0x180);
if (((uVar2 != 0xffffffff) &&
(puVar6 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar6 + 8) == uVar2 >> 0xc)) {
uVar5 = *(undefined4 *)(puVar6 + 4);
}
(**(code **)(*(int *)this + 0x98))(this,uVar5,uVar3 & 0xff);
SetMoveType(this,0,0);
if (param_3) {
return;
}
SetLocalOrigin(this,(Vector *)&vec3_origin);
SetLocalAngles(this,(QAngle *)&vec3_angle);
return;
}
uVar5 = GetDebugName(this);
puVar7 = &DAT_00d539c2;
if (*(undefined1 **)(this + 0x7c) != (undefined1 *)0x0) {
puVar7 = *(undefined1 **)(this + 0x7c);
}
Warning("ERROR: Tried to %s for entity %s (%s), but it has no attachment named %s.\n",param_1,
puVar7,uVar5,param_2);
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.