CBreakable::Die
0x006b4730 · 3013 bytes · __thiscall
_ZN10CBreakable3DieEv
Decompiled
undefined (1 param)
/* WARNING: Removing unreachable block (ram,0x006b495f) */
/* WARNING: Removing unreachable block (ram,0x006b535a) */
/* CBreakable::Die() */
void __thiscall CBreakable::Die(CBreakable *this)
{
CBreakable *pCVar1;
float fVar2;
char cVar3;
uint uVar4;
char *pcVar5;
code *pcVar6;
char cVar7;
int iVar8;
undefined4 *puVar9;
undefined1 *puVar10;
int iVar11;
int *piVar12;
char *pcVar13;
undefined *puVar14;
undefined1 *puVar15;
uint uVar16;
code *pcVar17;
undefined1 *puVar18;
int *piVar19;
int iVar20;
int in_GS_OFFSET;
longdouble lVar21;
longdouble lVar22;
int local_168;
undefined ***local_160;
undefined1 local_154 [16];
float local_144;
float local_140;
float local_13c;
undefined4 local_138;
undefined4 local_134;
undefined4 local_130;
undefined **local_12c;
float local_128;
float local_124;
undefined **local_10c;
undefined1 *local_108;
float local_104;
undefined4 local_100;
undefined4 local_fc;
int local_f8;
undefined4 local_f4;
undefined4 local_f0;
undefined4 local_ec;
undefined1 local_e8;
undefined1 local_e7;
undefined1 local_e6;
undefined4 local_e4;
undefined4 local_e0;
undefined4 local_dc;
undefined4 local_d8;
undefined4 local_d4;
undefined4 local_d0;
undefined2 local_cc;
undefined **local_c8;
undefined4 local_c4;
undefined4 local_c0;
undefined4 local_bc;
undefined4 local_b8;
undefined4 local_b4;
undefined1 local_b0;
undefined4 local_ac;
undefined1 local_a8 [128];
undefined4 local_28;
undefined4 local_24;
int local_20;
piVar19 = (int *)&stack0xfffffe64;
piVar12 = (int *)&stack0xfffffe64;
puVar18 = &stack0xfffffe64;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
(**(code **)(*TheNavMesh + 0x58))();
iVar8 = (**(code **)(*random_valve + 8))();
iVar20 = iVar8 + 0x5f;
if (iVar8 - 3U < 5) {
iVar20 = 100;
}
lVar21 = (longdouble)(**(code **)(*random_valve + 4))();
uVar4 = *(uint *)(this + 0x100);
uVar16 = *(uint *)(this + 0x44c);
if (uVar16 < 10) {
cVar3 = CSWTCH_2015[uVar16];
pcVar5 = *(char **)(CSWTCH_2016 + uVar16 * 4);
if (pcVar5 == (char *)0x0) goto LAB_006b4dcf;
uVar16 = *(uint *)(this + 0x450);
if ((((uVar16 != 0xffffffff) &&
(puVar14 = g_pEntityList + (uVar16 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar14 + 8) == uVar16 >> 0xc)) &&
(((*(int **)(puVar14 + 4) != (int *)0x0 &&
(cVar7 = (**(code **)(**(int **)(puVar14 + 4) + 0x16c))(), cVar7 != '\0')) &&
(piVar12 = (int *)(**(code **)(*gameeventmanager + 0x1c))(), piVar12 != (int *)0x0)))) {
pcVar17 = *(code **)(*piVar12 + 0x30);
uVar16 = *(uint *)(this + 0x450);
if (((uVar16 != 0xffffffff) &&
(puVar14 = g_pEntityList + (uVar16 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar14 + 8) == uVar16 >> 0xc && (*(int **)(puVar14 + 4) != (int *)0x0)))) {
(**(code **)(**(int **)(puVar14 + 4) + 0x16c))();
}
(**(code **)(*engine + 0x40))();
(*pcVar17)();
(**(code **)(*piVar12 + 0x30))();
(**(code **)(*piVar12 + 0x30))();
if (((byte)this[0x149] & 0x10) != 0) {
(**(code **)(*piVar12 + 0x2c))();
}
pcVar13 = *(char **)(this + 0x154);
if (pcVar13 == (char *)0x0) {
pcVar13 = "";
LAB_006b520c:
iVar8 = _V_stricmp(pcVar13,"ee_door");
if (iVar8 == 0) goto LAB_006b5220;
}
else {
if (pcVar13 != "ee_door") goto LAB_006b520c;
LAB_006b5220:
(**(code **)(*piVar12 + 0x30))();
}
(**(code **)(*gameeventmanager + 0x20))();
}
local_c8 = (undefined **)0x0;
local_c4 = 0x3f800000;
local_c0 = 100;
local_bc = 100;
local_b8 = 100;
local_b4 = 0x4b;
local_a8[0] = 0;
local_b0 = 0;
local_ac = 0;
local_28 = 0;
local_24 = 0;
cVar7 = CBaseEntity::GetParametersForSound(pcVar5,(CSoundParameters *)&local_c8,(char *)0x0);
if (cVar7 != '\0') {
(**(code **)(*(int *)this + 0x28c))();
CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_12c);
local_12c = &PTR__CPASFilter_00bfaf28;
/* try { // try from 006b4f4a to 006b4f4e has its CatchHandler @ 006b5317 */
CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)&local_12c,(Vector *)&local_10c);
local_12c = &PTR__CPASAttenuationFilter_00c08ec8;
/* try { // try from 006b4f68 to 006b4f8a has its CatchHandler @ 006b5329 */
(**(code **)(*(int *)this + 0x28c))();
puVar18 = &stack0xfffffe5c;
CPASAttenuationFilter::Filter((CPASAttenuationFilter *)&local_12c,(Vector *)&local_10c,0.8);
local_cc = 0xffff;
local_fc = 0;
local_f4 = 0;
local_f0 = 0;
local_10c = local_c8;
local_108 = local_a8;
local_ec = 0;
local_e8 = 1;
local_e7 = 0;
local_e6 = 0;
local_e4 = 0xffffffff;
uVar16 = (int)uVar4 >> 0x1f;
local_e0 = 0;
local_dc = 0;
local_d8 = 0;
local_d4 = 0;
local_d0 = 0;
local_100 = local_b4;
local_104 = (float)lVar21 + (float)(int)((uVar4 ^ uVar16) - uVar16) * 0.01;
if (1.0 <= local_104) {
local_104 = 1.0;
}
if (*(int *)(this + 0x30) == 0) {
iVar8 = 0;
}
else {
iVar8 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
local_f8 = iVar20;
/* try { // try from 006b50a4 to 006b50a8 has its CatchHandler @ 006b52ed */
CBaseEntity::EmitSound((IRecipientFilter *)&local_12c,iVar8,(EmitSound_t *)&local_10c);
local_d4 = 0;
CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_e0);
local_d0 = local_e0;
CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_e0);
local_12c = &PTR__CPASFilter_00bfaf28;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)&local_12c);
}
iVar20 = *(int *)(this + 0x454);
piVar12 = (int *)puVar18;
piVar19 = (int *)puVar18;
if (iVar20 == 1) goto LAB_006b4dea;
LAB_006b48bf:
piVar12 = piVar19;
if (iVar20 == 2) {
piVar19[3] = 0;
piVar19[1] = (int)&local_144;
piVar19[2] = 0;
*piVar19 = (int)(this + 0x458);
piVar19[-1] = 0x6b4ece;
AngleVectors((QAngle *)*piVar19,(Vector *)piVar19[1],(Vector *)piVar19[2],(Vector *)piVar19[3]
);
local_144 = local_144 * 200.0;
local_140 = local_140 * 200.0;
local_13c = local_13c * 200.0;
}
else if (iVar20 == 0) {
local_144 = 0.0;
local_140 = 0.0;
local_13c = 0.0;
}
else {
*piVar19 = (int)"**ERROR - Unspecified gib dir method in func_breakable!\n";
piVar19[-1] = 0x6b48dc;
DevMsg((char *)*piVar19);
}
}
else {
cVar3 = '\0';
LAB_006b4dcf:
iVar20 = *(int *)(this + 0x454);
if (iVar20 != 1) goto LAB_006b48bf;
LAB_006b4dea:
local_140 = DAT_00fe36b8 * -200.0;
local_13c = DAT_00fe36bc * -200.0;
local_144 = g_vecAttackDir * -200.0;
}
local_160 = &local_10c;
iVar20 = *(int *)this;
*piVar12 = (int)this;
pcVar17 = *(code **)(iVar20 + 0x288);
piVar12[-1] = 0x6b48e7;
puVar9 = (undefined4 *)(*pcVar17)();
local_138 = *puVar9;
local_134 = puVar9[1];
local_130 = puVar9[2];
*piVar12 = (int)local_160;
piVar12[-1] = 0x6b490f;
CRecipientFilter::CRecipientFilter((CRecipientFilter *)*piVar12);
*piVar12 = (int)local_160;
piVar12[1] = (int)&local_138;
local_10c = &PTR__CPVSFilter_00c09bc8;
/* try { // try from 006b4926 to 006b492a has its CatchHandler @ 006b5354 */
piVar12[-1] = 0x6b492b;
CRecipientFilter::AddRecipientsByPVS((CRecipientFilter *)*piVar12,(Vector *)piVar12[1]);
pCVar1 = this + 0x194;
if (AllocTempVector()::s_vecTemp == '\0') {
*piVar12 = (int)&AllocTempVector()::s_vecTemp;
piVar12[-1] = 0x6b4e8d;
iVar20 = __cxa_guard_acquire();
if (iVar20 != 0) {
*piVar12 = (int)&AllocTempVector()::s_vecTemp;
piVar12[-1] = 0x6b4ea1;
__cxa_guard_release();
}
}
if (AllocTempVector()::s_nIndex == '\0') {
*piVar12 = (int)&AllocTempVector()::s_nIndex;
piVar12[-1] = 0x6b4e5e;
iVar20 = __cxa_guard_acquire();
if (iVar20 != 0) {
*piVar12 = (int)&AllocTempVector()::s_nIndex;
AllocTempVector()::s_nIndex = 0;
piVar12[-1] = 0x6b4e7c;
__cxa_guard_release();
}
}
AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
LOCK();
UNLOCK();
iVar20 = AllocTempVector()::s_nIndex * 0xc;
*(float *)(AllocTempVector()::s_vecTemp + iVar20) =
*(float *)(this + 0x1a8) - *(float *)(this + 0x19c);
*(float *)(AllocTempVector()::s_vecTemp + iVar20 + 4) =
*(float *)(this + 0x1ac) - *(float *)(this + 0x1a0);
*(float *)(AllocTempVector()::s_vecTemp + iVar20 + 8) =
*(float *)(this + 0x1b0) - *(float *)(this + 0x1a4);
local_12c = *(undefined ***)(AllocTempVector()::s_vecTemp + iVar20);
local_128 = *(float *)(AllocTempVector()::s_vecTemp + iVar20 + 4);
local_124 = *(float *)(AllocTempVector()::s_vecTemp + iVar20 + 8);
iVar20 = (int)(((local_124 + (float)local_12c) * local_128 + (float)local_12c * local_124) *
0.0023148148);
local_168 = *(int *)(func_break_max_pieces._28_4_ + 0x30);
if (iVar20 <= *(int *)(func_break_max_pieces._28_4_ + 0x30)) {
local_168 = iVar20;
}
if (*(int *)(breakable_disable_gib_limit._28_4_ + 0x30) == 0) {
if ((local_168 == 0) || (*(int *)(this + 0x4e8) == 1)) goto LAB_006b4b84;
if ((*(int *)(this + 0x4e8) == 3) &&
(local_168 = (int)((float)local_168 * *(float *)(func_break_reduction_factor._28_4_ + 0x2c)),
local_168 < 1)) {
local_168 = 1;
}
}
if ((*(undefined1 **)(this + 0x484) != (undefined1 *)0x0) && (0 < local_168)) {
iVar20 = 0;
pcVar17 = *(code **)(*modelinfo + 0xc);
puVar10 = *(undefined1 **)(this + 0x484);
while( true ) {
piVar12[2] = -1;
piVar12[1] = (int)puVar10;
*piVar12 = (int)g_PropDataSystem;
/* try { // try from 006b4abd to 006b4d8a has its CatchHandler @ 006b5332 */
piVar12[-1] = 0x6b4ac2;
iVar8 = CPropData::GetRandomChunkModel((CPropData *)*piVar12,(char *)piVar12[1],piVar12[2]);
piVar12[1] = iVar8;
*piVar12 = (int)modelinfo;
piVar12[-1] = 0x6b4ad0;
iVar11 = (*pcVar17)();
pcVar17 = *(code **)(*(int *)te + 0x38);
iVar8 = *(int *)(this + 0x194);
*piVar12 = (int)pCVar1;
pcVar6 = *(code **)(iVar8 + 0x24);
piVar12[-1] = 0x6b4b0b;
iVar8 = (*pcVar6)();
piVar12[4] = iVar8;
piVar12[3] = (int)&local_138;
piVar12[0xb] = ~-(uint)(iVar20 == 0) & 0x80 | (int)cVar3;
piVar12[6] = (int)&local_144;
piVar12[10] = 0x40200000;
piVar12[1] = (int)local_160;
piVar12[9] = 1;
piVar12[8] = 100;
piVar12[7] = iVar11;
piVar12[5] = (int)&local_12c;
piVar12[2] = 0;
*piVar12 = (int)te;
piVar12[-1] = 0x6b4b75;
(*pcVar17)();
iVar20 = iVar20 + 1;
if (iVar20 == local_168) break;
pcVar17 = *(code **)(*modelinfo + 0xc);
puVar10 = &DAT_00d539c2;
if (*(undefined1 **)(this + 0x484) != (undefined1 *)0x0) {
puVar10 = *(undefined1 **)(this + 0x484);
}
}
}
LAB_006b4b84:
*piVar12 = (int)this;
piVar12[-1] = 0x6b4b8c;
ResetOnGroundFlags((CBreakable *)*piVar12);
*(undefined4 *)(this + 0x154) = 0;
piVar12[1] = (uint)(*(ushort *)(this + 0x1b4) | 4);
*piVar12 = (int)pCVar1;
piVar12[-1] = 0x6b4bb5;
CCollisionProperty::SetSolidFlags((CCollisionProperty *)*piVar12,piVar12[1]);
uVar4 = *(uint *)(this + 0x450);
iVar20 = 0;
if (((uVar4 != 0xffffffff) &&
(puVar14 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar14 + 8) == uVar4 >> 0xc)) {
iVar20 = *(int *)(puVar14 + 4);
}
piVar12[3] = 0;
piVar12[2] = (int)this;
piVar12[1] = iVar20;
*piVar12 = (int)(this + 0x48c);
piVar12[-1] = 0x6b4c06;
COutputEvent::FireOutput
((COutputEvent *)*piVar12,(CBaseEntity *)piVar12[1],(CBaseEntity *)piVar12[2],
(float)piVar12[3]);
iVar20 = *(int *)this;
*piVar12 = (int)this;
pcVar17 = *(code **)(iVar20 + 0x298);
piVar12[-1] = 0x6b4c11;
(*pcVar17)();
piVar12[5] = 0;
piVar12[4] = 0;
piVar12[2] = (int)CBaseEntity::SUB_Remove;
piVar12[3] = 0;
piVar12[1] = (int)this;
*piVar12 = (int)local_154;
piVar12[-1] = 0x6b4c43;
CBaseEntity::ThinkSet((_func_void *)*piVar12,(float)piVar12[1],(char *)piVar12[2]);
piVar12[2] = 0;
fVar2 = *(float *)(gpGlobals + 0xc);
*piVar12 = (int)this;
piVar12[1] = (int)(fVar2 + 0.1);
piVar12[-1] = 0x6b4c6e;
CBaseEntity::SetNextThink((CBaseEntity *)*piVar12,(float)piVar12[1],(char *)piVar12[2]);
if (*(int *)(this + 0x468) != 0) {
iVar20 = *(int *)(this + 0x194);
*piVar12 = (int)pCVar1;
pcVar17 = *(code **)(iVar20 + 0x24);
piVar12[-1] = 0x6b4c8a;
iVar20 = (*pcVar17)();
puVar10 = *(undefined1 **)(this + 0x468);
piVar12[2] = iVar20;
piVar12[3] = (int)this;
piVar12[1] = (int)&local_138;
puVar15 = &DAT_00d539c2;
if (puVar10 != (undefined1 *)0x0) {
puVar15 = puVar10;
}
*piVar12 = (int)puVar15;
piVar12[-1] = 0x6b4cb4;
CBaseEntity::Create((char *)*piVar12,(Vector *)piVar12[1],(QAngle *)piVar12[2],
(CBaseEntity *)piVar12[3]);
}
iVar20 = *(int *)this;
*piVar12 = (int)this;
pcVar17 = *(code **)(iVar20 + 0x350);
piVar12[-1] = 0x6b4cbf;
lVar21 = (longdouble)(*pcVar17)();
if (0.0 < (float)lVar21) {
iVar20 = *(int *)this;
*piVar12 = (int)this;
pcVar17 = *(code **)(iVar20 + 0x350);
piVar12[-1] = 0x6b4ce5;
lVar21 = (longdouble)(*pcVar17)();
iVar20 = *(int *)this;
*piVar12 = (int)this;
pcVar17 = *(code **)(iVar20 + 0x354);
piVar12[-1] = 0x6b4d02;
lVar22 = (longdouble)(*pcVar17)();
iVar20 = *(int *)(this + 0x194);
*piVar12 = (int)pCVar1;
pcVar17 = *(code **)(iVar20 + 0x24);
piVar12[-1] = 0x6b4d26;
iVar20 = (*pcVar17)();
piVar12[1] = iVar20;
piVar12[9] = -1;
piVar12[8] = 0;
piVar12[7] = 0;
piVar12[6] = 0;
piVar12[5] = 1;
piVar12[4] = (int)lVar21;
piVar12[3] = (int)lVar22;
piVar12[2] = (int)this;
*piVar12 = (int)&local_138;
piVar12[-1] = 0x6b4d6c;
ExplosionCreate((Vector *)*piVar12,(QAngle *)piVar12[1],(CBaseEntity *)piVar12[2],piVar12[3],
piVar12[4],SUB41(piVar12[5],0),(float)piVar12[6],SUB41(piVar12[7],0),
SUB41(piVar12[8],0),piVar12[9]);
}
if (*(int *)(this + 0x100) != 0) {
iVar20 = *(int *)this;
*piVar12 = (int)this;
piVar12[1] = (int)(this + 0x100);
pcVar17 = *(code **)(iVar20 + 0x214);
piVar12[-1] = 0x6b4d8b;
(*pcVar17)();
*(undefined4 *)(this + 0x100) = 0;
}
local_10c = &PTR__CPVSFilter_00c09bc8;
*piVar12 = (int)local_160;
piVar12[-1] = 0x6b4dad;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)*piVar12);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
piVar12[-1] = (int)&LAB_006b5332;
__stack_chk_fail();
}
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.