IsBreakableEntity
0x00470a30 · 980 bytes · __cdecl
_Z17IsBreakableEntityP11CBaseEntitybbP15CTakeDamageInfo
Decompiled
undefined (4 params)
/* IsBreakableEntity(CBaseEntity*, bool, bool, CTakeDamageInfo*) */
undefined4
IsBreakableEntity(CBaseEntity *param_1,bool param_2,bool param_3,CTakeDamageInfo *param_4)
{
int *piVar1;
char cVar2;
undefined4 uVar3;
undefined4 *puVar4;
int iVar5;
int *piVar6;
undefined *puVar7;
code *pcVar8;
uint uVar9;
undefined4 uVar10;
longdouble lVar11;
float local_24;
if (param_1 == (CBaseEntity *)0x0) {
return 0;
}
if (param_1[0x105] != (CBaseEntity)0x2) {
return 0;
}
iVar5 = *(int *)(param_1 + 0x234);
if (((iVar5 != 0x11) && (iVar5 != 6)) && (iVar5 != 0)) {
return 0;
}
if (199 < *(int *)(param_1 + 0x100) - 1U) {
return 0;
}
if (((byte)param_1[0x1b4] & 4) != 0) {
return 0;
}
if (*(char **)(param_1 + 0x7c) == "func_door") {
return 0;
}
cVar2 = CBaseEntity::ClassMatchesComplex(param_1,"func_door");
if (cVar2 != '\0') {
return 0;
}
if (*(char **)(param_1 + 0x7c) == "func_door_rotating") {
return 0;
}
uVar3 = CBaseEntity::ClassMatchesComplex(param_1,"func_door_rotating");
if ((char)uVar3 != '\0') {
return 0;
}
if ((!param_2) && (!param_3)) {
if (*(char **)(param_1 + 0x7c) == "prop_fuel_barrel") {
return 0;
}
cVar2 = CBaseEntity::ClassMatchesComplex(param_1,"prop_fuel_barrel");
if (cVar2 != '\0') {
return 0;
}
}
if ((param_4 != (CTakeDamageInfo *)0x0) &&
(cVar2 = (**(code **)(*(int *)param_1 + 0x118))(param_1,param_4), cVar2 == '\0')) {
return 0;
}
puVar4 = (undefined4 *)
__dynamic_cast(param_1,&CBaseEntity::typeinfo,&IMultiplayerPhysics::typeinfo,0xfffffffe);
if (puVar4 == (undefined4 *)0x0) {
if (*(char **)(param_1 + 0x7c) == "func_breakable") {
LAB_00470d40:
cVar2 = CBaseEntity::ClassMatchesComplex(param_1,"func_breakable_surf");
if (cVar2 == '\0') goto LAB_00470b70;
}
else {
cVar2 = CBaseEntity::ClassMatchesComplex(param_1,"func_breakable");
if (cVar2 == '\0') {
if (*(char **)(param_1 + 0x7c) != "func_breakable_surf") {
cVar2 = CBaseEntity::ClassMatchesComplex(param_1,"func_breakable_surf");
if (cVar2 == '\0') {
uVar9 = (**(code **)(*(int *)param_1 + 0x2c8))(param_1);
if ((uVar9 & 0x10000) != 0) {
return 0;
}
goto LAB_00470b70;
}
goto LAB_00470d37;
}
}
else {
LAB_00470d37:
if (*(char **)(param_1 + 0x7c) != "func_breakable_surf") goto LAB_00470d40;
}
}
if (param_1[0x524] != (CBaseEntity)0x0) {
return 0;
}
}
else {
iVar5 = (**(code **)*puVar4)(puVar4);
if (iVar5 != 1) {
return 0;
}
}
LAB_00470b70:
piVar6 = (int *)__dynamic_cast(param_1,&CBaseEntity::typeinfo,&IBreakableWithPropData::typeinfo,
0xfffffffe);
if (piVar6 == (int *)0x0) goto LAB_00470c90;
lVar11 = (longdouble)(**(code **)(*piVar6 + 0x14))(piVar6);
if ((float)lVar11 <= 0.0) {
return 0;
}
if ((!param_2) && (cVar2 = (**(code **)(*piVar6 + 0x7c))(piVar6,0x11), cVar2 != '\0')) {
return 0;
}
if ((!param_3) && (cVar2 = (**(code **)(*piVar6 + 0x7c))(piVar6,0x12), cVar2 != '\0')) {
return 0;
}
if (param_4 == (CTakeDamageInfo *)0x0) goto LAB_00470c90;
uVar9 = *(uint *)(param_4 + 0x34);
local_24 = *(float *)(param_4 + 0x3c);
if (uVar9 == 0xffffffff) {
LAB_00470db0:
uVar10 = 0;
pcVar8 = *(code **)(*(int *)param_1 + 0x274);
}
else {
iVar5 = (uVar9 & 0xfff) * 0x10;
puVar7 = g_pEntityList + iVar5;
if (puVar7 == (undefined *)0xfffffffc) goto LAB_00470db0;
if ((*(uint *)(puVar7 + 8) == uVar9 >> 0xc) &&
(piVar1 = *(int **)(puVar7 + 4), piVar1 != (int *)0x0)) {
lVar11 = (longdouble)(**(code **)(*piVar1 + 0x270))(piVar1,param_1);
pcVar8 = *(code **)(*(int *)param_1 + 0x274);
local_24 = (float)lVar11 * local_24;
puVar4 = (undefined4 *)(g_pEntityList + iVar5 + 4);
if (puVar4 != (undefined4 *)0x0) goto LAB_00470c48;
LAB_00470c53:
uVar10 = 0;
}
else {
pcVar8 = *(code **)(*(int *)param_1 + 0x274);
puVar4 = (undefined4 *)(g_pEntityList + (uVar9 & 0xfff) * 0x10 + 4);
LAB_00470c48:
if (puVar4[1] != uVar9 >> 0xc) goto LAB_00470c53;
uVar10 = *puVar4;
}
}
lVar11 = (longdouble)(*pcVar8)(param_1,uVar10);
iVar5 = (**(code **)(*piVar6 + 0x98))(piVar6);
if ((float)lVar11 * local_24 < (float)iVar5) {
return uVar3;
}
LAB_00470c90:
iVar5 = __dynamic_cast(param_1,&CBaseEntity::typeinfo,&CBreakableProp::typeinfo,0);
if ((iVar5 != 0) && (0x31 < *(int *)(iVar5 + 0x1448))) {
return 0;
}
return 1;
}
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.