CDamageModifier::AddModifierToEntity
0x00665e00 · 597 bytes · __thiscall
_ZN15CDamageModifier19AddModifierToEntityEP11CBaseEntity
Decompiled
undefined (2 params)
/* CDamageModifier::AddModifierToEntity(CBaseEntity*) */
void __thiscall CDamageModifier::AddModifierToEntity(CDamageModifier *this,CBaseEntity *param_1)
{
int iVar1;
undefined4 *puVar2;
void *pvVar3;
int iVar4;
int iVar5;
int iVar6;
RemoveModifier(this);
iVar5 = *(int *)(param_1 + 0x16c);
if (iVar5 == -1) {
iVar4 = *(int *)(param_1 + 0x178);
iVar6 = *(int *)(param_1 + 0x15c);
if ((iVar4 < 0) || (iVar6 <= iVar4)) {
iVar5 = 0;
if (iVar6 < 1) goto LAB_00665f40;
}
else {
iVar5 = iVar4 + 1;
if ((iVar5 < 0) || (iVar6 <= iVar5)) {
LAB_00665f40:
iVar5 = *(int *)(param_1 + 0x160);
if (iVar5 < 0) {
pvVar3 = *(void **)(param_1 + 0x158);
}
else {
iVar1 = iVar6 + 1;
if (iVar5 == 0) {
iVar5 = 3;
if (iVar6 != 0) {
iVar5 = iVar6;
}
while (iVar6 = iVar5, iVar6 < iVar1) {
iVar5 = iVar6 * 2;
}
}
else {
for (iVar6 = iVar5 * (iVar6 / iVar5 + 1); iVar6 < iVar1; iVar6 = (iVar6 + iVar1) / 2) {
}
}
*(int *)(param_1 + 0x15c) = iVar6;
if (*(void **)(param_1 + 0x158) == (void *)0x0) {
pvVar3 = malloc(iVar6 * 0xc);
*(void **)(param_1 + 0x158) = pvVar3;
}
else {
pvVar3 = realloc(*(void **)(param_1 + 0x158),iVar6 * 0xc);
iVar4 = *(int *)(param_1 + 0x178);
iVar6 = *(int *)(param_1 + 0x15c);
*(void **)(param_1 + 0x158) = pvVar3;
}
}
*(void **)(param_1 + 0x17c) = pvVar3;
if ((iVar4 < 0) || (iVar6 <= iVar4)) {
iVar5 = 0;
if (iVar6 < 1) goto LAB_00665fd6;
}
else {
iVar5 = iVar4 + 1;
if (iVar6 <= iVar5) {
LAB_00665fd6:
if (CUtlLinkedList<CDamageModifier*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CDamageModifier*,int>,int>>
::AllocInternal(bool)::__executeCount < 10) {
CUtlLinkedList<CDamageModifier*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CDamageModifier*,int>,int>>
::AllocInternal(bool)::__executeCount =
CUtlLinkedList<CDamageModifier*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CDamageModifier*,int>,int>>
::AllocInternal(bool)::__executeCount + 1;
Warning("CUtlLinkedList overflow! (exhausted memory allocator)\n");
}
goto LAB_00665ea6;
}
}
}
else if (iVar5 == -1) {
if (CUtlLinkedList<CDamageModifier*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CDamageModifier*,int>,int>>
::AllocInternal(bool)::__executeCount < 10) {
CUtlLinkedList<CDamageModifier*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CDamageModifier*,int>,int>>
::AllocInternal(bool)::__executeCount =
CUtlLinkedList<CDamageModifier*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CDamageModifier*,int>,int>>
::AllocInternal(bool)::__executeCount + 1;
Warning("CUtlLinkedList overflow! (exhausted index range)\n");
}
goto LAB_00665ea6;
}
}
*(int *)(param_1 + 0x178) = iVar5;
*(int *)(param_1 + 0x174) = *(int *)(param_1 + 0x174) + 1;
iVar6 = iVar5 * 0xc;
iVar4 = *(int *)(param_1 + 0x158) + iVar6;
}
else {
iVar6 = iVar5 * 0xc;
iVar4 = *(int *)(param_1 + 0x158) + iVar6;
*(undefined4 *)(param_1 + 0x16c) = *(undefined4 *)(iVar4 + 8);
}
*(int *)(iVar4 + 8) = iVar5;
*(int *)(*(int *)(param_1 + 0x158) + 4 + iVar6) = iVar5;
CUtlLinkedList<CDamageModifier*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CDamageModifier*,int>,int>>
::Unlink((CUtlLinkedList<CDamageModifier*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CDamageModifier*,int>,int>>
*)(param_1 + 0x158),iVar5);
iVar4 = *(int *)(param_1 + 0x158);
*(undefined4 *)(iVar4 + iVar6 + 8) = 0xffffffff;
iVar1 = *(int *)(param_1 + 0x168);
*(int *)(iVar4 + iVar6 + 4) = iVar1;
*(int *)(param_1 + 0x168) = iVar5;
if (iVar1 == -1) {
*(int *)(param_1 + 0x164) = iVar5;
}
else {
*(int *)(*(int *)(param_1 + 0x158) + iVar1 * 0xc + 8) = iVar5;
}
*(int *)(param_1 + 0x170) = *(int *)(param_1 + 0x170) + 1;
if ((undefined4 *)(iVar6 + *(int *)(param_1 + 0x158)) != (undefined4 *)0x0) {
*(undefined4 *)(iVar6 + *(int *)(param_1 + 0x158)) = this;
}
LAB_00665ea6:
puVar2 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
*(undefined4 *)(this + 4) = *puVar2;
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.