CBaseEntity::TakeDamage
0x006053d0 · 843 bytes · __thiscall
_ZN11CBaseEntity10TakeDamageERK15CTakeDamageInfo
Decompiled
undefined (2 params)
/* CBaseEntity::TakeDamage(CTakeDamageInfo const&) */
void __thiscall CBaseEntity::TakeDamage(CBaseEntity *this,CTakeDamageInfo *param_1)
{
int iVar1;
int *piVar2;
float fVar3;
char cVar4;
undefined4 uVar5;
code *pcVar6;
uint uVar7;
undefined4 *puVar8;
longdouble lVar9;
float fVar10;
float fVar11;
float fVar12;
undefined4 local_7c;
undefined4 local_78;
undefined4 local_74;
undefined4 local_70;
undefined4 local_6c;
undefined4 local_68;
undefined4 local_64;
undefined4 local_60;
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c;
uint local_48;
undefined4 local_44;
float local_40;
undefined4 local_3c;
undefined4 local_38;
int local_34;
undefined4 local_30;
undefined4 local_2c;
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
if (g_pGameRules == (int *)0x0) {
return;
}
cVar4 = (**(code **)(*g_pGameRules + 0x50))(g_pGameRules,*(undefined4 *)(param_1 + 0x48));
fVar3 = vec3_origin;
local_34 = *(int *)(param_1 + 0x48);
iVar1 = TakeDamage(CTakeDamageInfo_const&)::warningCount;
if ((cVar4 == '\0') && (local_34 != 0)) {
if ((*(float *)param_1 == vec3_origin) &&
((*(float *)(param_1 + 4) == DAT_01053d4c && (*(float *)(param_1 + 8) == DAT_01053d50)))) {
iVar1 = TakeDamage(CTakeDamageInfo_const&)::warningCount + 1;
if (TakeDamage(CTakeDamageInfo_const&)::warningCount + 1 < 10) {
LAB_00605487:
TakeDamage(CTakeDamageInfo_const&)::warningCount =
TakeDamage(CTakeDamageInfo_const&)::warningCount + 1;
if (*(float *)(param_1 + 8) == DAT_01053d50) {
DevWarning("CBaseEntity::TakeDamage: with inputInfo.GetDamageForce() == vec3_origin\n");
fVar12 = *(float *)(param_1 + 0x14);
fVar11 = *(float *)(param_1 + 0x10);
fVar10 = *(float *)(param_1 + 0xc);
iVar1 = TakeDamage(CTakeDamageInfo_const&)::warningCount;
}
else {
fVar12 = *(float *)(param_1 + 0x14);
fVar11 = *(float *)(param_1 + 0x10);
fVar10 = *(float *)(param_1 + 0xc);
iVar1 = TakeDamage(CTakeDamageInfo_const&)::warningCount;
}
LAB_006054a3:
TakeDamage(CTakeDamageInfo_const&)::warningCount = iVar1;
iVar1 = TakeDamage(CTakeDamageInfo_const&)::warningCount;
if (fVar10 == fVar3) goto LAB_00605660;
LAB_006054ac:
local_34 = *(int *)(param_1 + 0x48);
iVar1 = TakeDamage(CTakeDamageInfo_const&)::warningCount;
}
}
else {
fVar10 = *(float *)(param_1 + 0xc);
fVar11 = *(float *)(param_1 + 0x10);
fVar12 = *(float *)(param_1 + 0x14);
if ((fVar10 == vec3_origin) &&
(((fVar11 == DAT_01053d4c && (fVar12 == DAT_01053d50)) &&
(iVar1 = TakeDamage(CTakeDamageInfo_const&)::warningCount + 1, iVar1 < 10)))) {
if (fVar10 == *(float *)param_1) {
if (*(float *)(param_1 + 4) == fVar11) goto LAB_00605487;
goto LAB_006054a3;
}
LAB_00605660:
TakeDamage(CTakeDamageInfo_const&)::warningCount = iVar1;
if ((fVar11 == DAT_01053d4c) && (fVar12 == DAT_01053d50)) {
DevWarning("CBaseEntity::TakeDamage: with inputInfo.GetDamagePosition() == vec3_origin\n"
);
}
goto LAB_006054ac;
}
}
}
TakeDamage(CTakeDamageInfo_const&)::warningCount = iVar1;
local_7c = *(undefined4 *)param_1;
local_40 = *(float *)(param_1 + 0x3c);
local_3c = *(undefined4 *)(param_1 + 0x40);
local_78 = *(undefined4 *)(param_1 + 4);
local_74 = *(undefined4 *)(param_1 + 8);
local_70 = *(undefined4 *)(param_1 + 0xc);
local_6c = *(undefined4 *)(param_1 + 0x10);
local_68 = *(undefined4 *)(param_1 + 0x14);
local_64 = *(undefined4 *)(param_1 + 0x18);
local_60 = *(undefined4 *)(param_1 + 0x1c);
local_5c = *(undefined4 *)(param_1 + 0x20);
local_58 = *(undefined4 *)(param_1 + 0x24);
local_54 = *(undefined4 *)(param_1 + 0x28);
local_50 = *(undefined4 *)(param_1 + 0x2c);
local_4c = *(undefined4 *)(param_1 + 0x30);
local_48 = *(uint *)(param_1 + 0x34);
local_44 = *(undefined4 *)(param_1 + 0x38);
local_38 = *(undefined4 *)(param_1 + 0x44);
local_30 = *(undefined4 *)(param_1 + 0x4c);
local_24 = *(undefined4 *)(param_1 + 0x58);
local_2c = *(undefined4 *)(param_1 + 0x50);
local_28 = *(undefined4 *)(param_1 + 0x54);
local_20 = *(undefined4 *)(param_1 + 0x5c);
cVar4 = CDirectorChallengeMode::ScriptAllowDamage
(*(CDirectorChallengeMode **)(TheDirector + 0x648),this,
(CTakeDamageInfo *)&local_7c);
if (cVar4 == '\0') {
return;
}
cVar4 = (**(code **)(*(int *)this + 0x118))(this,(CTakeDamageInfo *)&local_7c);
if (cVar4 == '\0') {
return;
}
cVar4 = (**(code **)(*g_pGameRules + 0x10c))(g_pGameRules,this,(CTakeDamageInfo *)&local_7c);
if (cVar4 == '\0') {
return;
}
cVar4 = PhysIsInCallback();
if (cVar4 != '\0') {
PhysCallbackDamage(this,(CTakeDamageInfo *)&local_7c);
return;
}
if (local_48 == 0xffffffff) {
pcVar6 = *(code **)(*(int *)this + 0x274);
uVar5 = 0;
goto LAB_00605606;
}
uVar7 = local_48 & 0xfff;
puVar8 = (undefined4 *)(g_pEntityList + uVar7 * 0x10 + 4);
if (((puVar8 == (undefined4 *)0x0) ||
(*(uint *)(g_pEntityList + uVar7 * 0x10 + 8) != local_48 >> 0xc)) ||
(piVar2 = *(int **)(g_pEntityList + uVar7 * 0x10 + 4), piVar2 == (int *)0x0)) {
pcVar6 = *(code **)(*(int *)this + 0x274);
LAB_006055f8:
if ((puVar8 != (undefined4 *)0x0) && (puVar8[1] == local_48 >> 0xc)) {
uVar5 = *puVar8;
goto LAB_00605606;
}
}
else {
lVar9 = (longdouble)(**(code **)(*piVar2 + 0x270))(piVar2,this);
pcVar6 = *(code **)(*(int *)this + 0x274);
local_40 = (float)lVar9 * local_40;
if (local_48 != 0xffffffff) {
puVar8 = (undefined4 *)(g_pEntityList + (local_48 & 0xfff) * 0x10 + 4);
goto LAB_006055f8;
}
}
uVar5 = 0;
LAB_00605606:
lVar9 = (longdouble)(*pcVar6)(this,uVar5);
local_40 = (float)lVar9 * local_40;
(**(code **)(*(int *)this + 0x124))(this,(CTakeDamageInfo *)&local_7c);
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.