CBreakableProp::OnTakeDamage
0x007e8e10 · 3168 bytes · __thiscall
_ZN14CBreakableProp12OnTakeDamageERK15CTakeDamageInfo
Decompiled
undefined (2 params)
/* CBreakableProp::OnTakeDamage(CTakeDamageInfo const&) */
undefined4 __thiscall CBreakableProp::OnTakeDamage(CBreakableProp *this,CTakeDamageInfo *param_1)
{
int *piVar1;
code *pcVar2;
bool bVar3;
char cVar4;
int iVar5;
undefined4 *puVar6;
undefined4 uVar7;
undefined4 uVar8;
float *pfVar9;
float *pfVar10;
undefined *puVar11;
uint uVar12;
int *piVar13;
CBreakableProp CVar14;
CBaseEntity *pCVar15;
longdouble lVar16;
float fVar17;
float fVar18;
float fVar19;
undefined1 local_a4 [16];
float local_94;
undefined4 local_90;
undefined4 local_8c;
undefined4 local_88;
undefined4 local_84;
undefined4 local_80;
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;
uint local_4c;
uint local_48;
undefined4 local_44;
float local_40;
undefined4 local_3c;
undefined4 local_38;
uint local_34;
undefined4 local_30;
undefined4 local_2c;
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
local_7c = *(undefined4 *)param_1;
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 = *(uint *)(param_1 + 0x30);
local_48 = *(uint *)(param_1 + 0x34);
local_44 = *(undefined4 *)(param_1 + 0x38);
local_3c = *(undefined4 *)(param_1 + 0x40);
local_38 = *(undefined4 *)(param_1 + 0x44);
local_34 = *(uint *)(param_1 + 0x48);
local_40 = *(float *)(param_1 + 0x3c);
local_24 = *(undefined4 *)(param_1 + 0x58);
local_30 = *(undefined4 *)(param_1 + 0x4c);
local_2c = *(undefined4 *)(param_1 + 0x50);
local_28 = *(undefined4 *)(param_1 + 0x54);
local_20 = *(undefined4 *)(param_1 + 0x5c);
if (*(int *)(this + 0x1530) == 0) {
LAB_007e8f30:
if (local_40 < (float)*(int *)(this + 0x1448)) {
return 0;
}
}
else {
if ((((local_48 != 0xffffffff) &&
(puVar11 = g_pEntityList + (local_48 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar11 + 8) == local_48 >> 0xc)) &&
(((piVar13 = *(int **)(puVar11 + 4), piVar13 != (int *)0x0 &&
(cVar4 = (**(code **)(*piVar13 + 0x16c))(piVar13), cVar4 != '\0')) &&
(cVar4 = (**(code **)(*piVar13 + 0x778))(piVar13), cVar4 != '\0')))) {
local_40 = 0.0;
}
iVar5 = (**(code **)(*(int *)this + 0x2c4))(this,0x3f800000);
if ((iVar5 != 0) && (piVar13 = *(int **)(this + 0x238), piVar13 != (int *)0x0)) {
cVar4 = (**(code **)(*piVar13 + 0xc))(piVar13);
if (cVar4 == '\0') {
return 0;
}
goto LAB_007e8f30;
}
if (local_40 < (float)*(int *)(this + 0x1448)) {
return 0;
}
}
cVar4 = (**(code **)(*(int *)this + 0x118))(this,(CTakeDamageInfo *)&local_7c);
if (cVar4 == '\0') {
return 1;
}
uVar12 = *(uint *)(this + 0x153c);
if (((((((uVar12 == 0xffffffff) ||
(puVar11 = g_pEntityList + (uVar12 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc))
|| (*(uint *)(puVar11 + 8) != uVar12 >> 0xc)) ||
((*(int *)(puVar11 + 4) == 0 || (*(float *)(this + 0x1534) <= 0.0)))) ||
(*(code **)(this + 0x1c) != BreakThink)) || (*(int *)(this + 0x20) != 0)) &&
(local_48 != 0xffffffff)) {
uVar12 = local_48 & 0xfff;
piVar13 = (int *)(g_pEntityList + uVar12 * 0x10 + 4);
if (piVar13 != (int *)0x0) {
if ((*(uint *)(g_pEntityList + uVar12 * 0x10 + 8) == local_48 >> 0xc) &&
(piVar1 = *(int **)(g_pEntityList + uVar12 * 0x10 + 4), piVar1 != (int *)0x0)) {
iVar5 = (**(code **)(*piVar1 + 0x144))(piVar1);
if (iVar5 == 0) {
if ((local_48 != 0xffffffff) &&
(piVar13 = (int *)(g_pEntityList + (local_48 & 0xfff) * 0x10 + 4),
piVar13 != (int *)0x0)) goto LAB_007e8fe9;
}
else if (((local_48 == 0xffffffff) ||
(puVar11 = g_pEntityList + (local_48 & 0xfff) * 0x10,
puVar11 == (undefined *)0xfffffffc)) ||
((*(uint *)(puVar11 + 8) != local_48 >> 0xc ||
(piVar13 = *(int **)(puVar11 + 4), piVar13 == (int *)0x0)))) {
*(undefined4 *)(this + 0x153c) = 0xffffffff;
}
else {
puVar6 = (undefined4 *)(**(code **)(*piVar13 + 0xc))(piVar13);
*(undefined4 *)(this + 0x153c) = *puVar6;
}
}
else {
LAB_007e8fe9:
if (((piVar13[1] == local_48 >> 0xc) &&
(((*piVar13 != 0 && (uVar12 = *(uint *)(*piVar13 + 0x220), uVar12 != 0xffffffff)) &&
(puVar11 = g_pEntityList + (uVar12 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)
))) && (((*(uint *)(puVar11 + 8) == uVar12 >> 0xc &&
(piVar13 = *(int **)(puVar11 + 4), piVar13 != (int *)0x0)) &&
(iVar5 = (**(code **)(*piVar13 + 0x144))(piVar13), iVar5 != 0)))) {
puVar6 = (undefined4 *)(**(code **)(*piVar13 + 0xc))(piVar13);
*(undefined4 *)(this + 0x153c) = *puVar6;
}
}
}
}
lVar16 = (longdouble)
GetBreakableDamage((CTakeDamageInfo *)&local_7c,(IBreakableWithPropData *)(this + 0x13f4)
);
local_40 = (float)lVar16;
if (local_40 < (float)*(int *)(this + 0x1448)) {
return 0;
}
if (*(int *)(this + 0x145c) == *(int *)(gpGlobals + 0x18)) {
CVar14 = this[0x105];
if (CVar14 != (CBreakableProp)0x1) {
(**(code **)(*(int *)this + 0x224))(this,this + 0x105);
this[0x105] = (CBreakableProp)0x1;
}
LAB_007e9278:
uVar7 = CBaseEntity::OnTakeDamage((CBaseEntity *)this,(CTakeDamageInfo *)&local_7c);
if (CVar14 != this[0x105]) {
(**(code **)(*(int *)this + 0x224))(this,this + 0x105);
this[0x105] = CVar14;
return uVar7;
}
return uVar7;
}
if (((((byte)this[0x153] & 8) != 0) && ((*(uint *)(param_1 + 0x48) & 8) != 0)) &&
((*(uint *)(param_1 + 0x48) & 0x10000000) == 0)) {
return 0;
}
cVar4 = CDirector::IsFinale(TheDirector);
if (((cVar4 == '\0') && (local_48 != 0xffffffff)) &&
((((puVar11 = g_pEntityList + (local_48 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc &&
((*(uint *)(puVar11 + 8) == local_48 >> 0xc &&
(*(CBaseEntity **)(puVar11 + 4) != (CBaseEntity *)0x0)))) &&
(iVar5 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar11 + 4)), iVar5 == 3)) &&
(((((local_48 != 0xffffffff &&
(puVar11 = g_pEntityList + (local_48 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar11 + 8) == local_48 >> 0xc)) &&
((pCVar15 = *(CBaseEntity **)(puVar11 + 4), pCVar15 != (CBaseEntity *)0x0 &&
(cVar4 = (**(code **)(*(int *)pCVar15 + 0x16c))(pCVar15), cVar4 != '\0')))) &&
((cVar4 = (**(code **)(*(int *)pCVar15 + 0x778))(pCVar15), cVar4 == '\0' &&
((iVar5 = CBaseEntity::GetTeamNumber(pCVar15), iVar5 != 3 ||
(iVar5 = (**(code **)(*(int *)pCVar15 + 0x544))(pCVar15), iVar5 != 8)))))))))) {
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
iVar5 = CNavMesh::GetNearestNavArea
(TheNavMesh,(Vector *)(this + 0x2e0),false,10000.0,false,true,false);
if (((iVar5 != 0) && ((*(byte *)(iVar5 + 300) & 0x40) != 0)) &&
(*(int *)(DebugZombieBreakables._28_4_ + 0x30) == 0)) {
return 0;
}
}
fVar17 = local_40;
iVar5 = *(int *)(this + 0x100);
if (((local_34 & 0x84) != 0) &&
(cVar4 = (**(code **)(*(int *)this + 0x440))(this,0x10), cVar4 != '\0')) {
CVar14 = this[0x105];
if (CVar14 != (CBreakableProp)0x1) {
(**(code **)(*(int *)this + 0x224))(this,this + 0x105);
this[0x105] = (CBreakableProp)0x1;
}
goto LAB_007e9278;
}
if ((float)iVar5 <= fVar17) {
if ((0.0 < *(float *)(this + 0x1534)) &&
((*(code **)(this + 0x1c) != BreakThink || (*(int *)(this + 0x20) != 0)))) {
if (*(char **)(this + 0x1538) != (char *)0x0) {
CBaseEntity::EmitSound((CBaseEntity *)this,*(char **)(this + 0x1538),0.0,(float *)0x0);
}
if ((((local_4c == 0xffffffff) ||
(puVar11 = g_pEntityList + (local_4c & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)
) || (*(uint *)(puVar11 + 8) != local_4c >> 0xc)) ||
(piVar13 = *(int **)(puVar11 + 4), piVar13 == (int *)0x0)) {
*(undefined4 *)(this + 0x1464) = 0xffffffff;
}
else {
puVar6 = (undefined4 *)(**(code **)(*piVar13 + 0xc))(piVar13);
*(undefined4 *)(this + 0x1464) = *puVar6;
}
if (*(int *)(this + 0xfc) != 100) {
(**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
*(undefined4 *)(this + 0xfc) = 100;
}
if (*(int *)(this + 0x100) != 100) {
(**(code **)(*(int *)this + 0x214))(this,this + 0x100);
*(undefined4 *)(this + 0x100) = 100;
}
local_40 = 1.0;
CBaseEntity::ThinkSet((_func_void *)local_a4,(float)this,(char *)BreakThink);
CBaseEntity::SetNextThink
((CBaseEntity *)this,*(float *)(this + 0x1534) + *(float *)(gpGlobals + 0xc),
(char *)0x0);
goto LAB_007e957f;
}
bVar3 = true;
if (((((local_34 & 0x40) != 0) &&
(cVar4 = (**(code **)(*(int *)this + 0x440))(this,10), cVar4 != '\0')) &&
((local_4c != 0xffffffff &&
((puVar11 = g_pEntityList + (local_4c & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc
&& (*(uint *)(puVar11 + 8) == local_4c >> 0xc)))))) &&
(piVar13 = *(int **)(puVar11 + 4), piVar13 != (int *)0x0)) {
pfVar9 = (float *)(**(code **)(*piVar13 + 0x288))(piVar13);
pfVar10 = (float *)(**(code **)(*(int *)this + 0x288))(this);
fVar17 = SQRT((*pfVar10 - *pfVar9) * (*pfVar10 - *pfVar9) +
(pfVar10[2] - pfVar9[2]) * (pfVar10[2] - pfVar9[2]) +
(pfVar10[1] - pfVar9[1]) * (pfVar10[1] - pfVar9[1]));
if (fVar17 < 32.0) {
lVar16 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x3dcccccd,0x3e4ccccd);
fVar18 = (float)lVar16;
}
else {
fVar18 = 256.0;
if (fVar17 <= 256.0) {
fVar18 = fVar17;
}
fVar18 = fVar18 * 0.01953125;
if (fVar18 <= 0.5) {
fVar18 = 0.5;
}
lVar16 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0,0x3f000000);
fVar18 = (float)lVar16 + fVar18;
}
fVar19 = (float)*(int *)(this + 0x100);
fVar17 = fVar18 * 5.0;
if (fVar19 <= fVar18 * 5.0) {
fVar17 = fVar19;
}
local_40 = ((fVar19 - fVar17) / local_40) * local_40;
bVar3 = fVar19 <= local_40;
}
if (bVar3) goto LAB_007e957f;
}
if (((local_34 & 0x40) == 0) && ((local_34 & 8) == 0)) {
if (((local_34 & 2) == 0) ||
(cVar4 = (**(code **)(*(int *)this + 0x440))(this,0xb), cVar4 == '\0')) goto LAB_007e957f;
iVar5 = *(int *)(this + 0xfc);
fVar17 = (float)*(int *)(this + 0x100);
if ((float)(iVar5 / 2) < fVar17 - local_40) {
if (((byte)this[0x153] & 8) == 0) goto LAB_007e957f;
}
else if (((byte)this[0x153] & 8) == 0) {
if (*(int *)(this + 0x100) != iVar5) {
(**(code **)(*(int *)this + 0x214))(this,this + 0x100);
*(int *)(this + 0x100) = iVar5;
}
goto LAB_007e97b9;
}
local_40 = (fVar17 / local_40) * local_40;
}
else {
LAB_007e97b9:
pcVar2 = *(code **)(*(int *)this + 0x380);
lVar16 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x41200000,0x41700000);
(*pcVar2)(this,(float)lVar16,0,0,0);
}
LAB_007e957f:
uVar7 = 0;
uVar8 = CBaseEntity::OnTakeDamage((CBaseEntity *)this,(CTakeDamageInfo *)&local_7c);
local_94 = (float)*(int *)(this + 0x100) / (float)*(int *)(this + 0xfc);
if ((float)*(int *)(this + 0x100) / (float)*(int *)(this + 0xfc) <= 0.0) {
local_94 = 0.0;
}
if (1.0 <= local_94) {
local_94 = 1.0;
}
if (((local_48 != 0xffffffff) &&
(puVar11 = g_pEntityList + (local_48 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == local_48 >> 0xc)) {
uVar7 = *(undefined4 *)(puVar11 + 4);
}
variant_t::Set((variant_t *)(this + 0x1414),1,&local_94);
local_90 = *(undefined4 *)(this + 0x1414);
local_8c = *(undefined4 *)(this + 0x1418);
local_88 = *(undefined4 *)(this + 0x141c);
local_84 = *(undefined4 *)(this + 0x1420);
local_80 = *(undefined4 *)(this + 0x1424);
pCVar15 = (CBaseEntity *)0x0;
CBaseEntityOutput::FireOutput((CBaseEntityOutput *)(this + 0x1414),&local_90,uVar7,this,0);
if (((local_48 != 0xffffffff) &&
(puVar11 = g_pEntityList + (local_48 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == local_48 >> 0xc)) {
pCVar15 = *(CBaseEntity **)(puVar11 + 4);
}
COutputEvent::FireOutput((COutputEvent *)(this + 0x142c),pCVar15,(CBaseEntity *)this,0.0);
return uVar8;
}
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.