InfectedAttack::OnPunch
0x00a2da20 · 2483 bytes · __thiscall
_ZN14InfectedAttack7OnPunchEP8InfectedP11CBaseEntity
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* InfectedAttack::OnPunch(Infected*, CBaseEntity*) */
void __thiscall InfectedAttack::OnPunch(InfectedAttack *this,Infected *param_1,CBaseEntity *param_2)
{
uint *puVar1;
code *pcVar2;
char cVar3;
float *pfVar4;
int iVar5;
QAngle *pQVar6;
int *piVar7;
int iVar8;
CBasePropDoor *this_00;
int iVar9;
int iVar10;
CTerrorPlayer *pCVar11;
int in_GS_OFFSET;
longdouble lVar12;
float fVar13;
int iStackY_1f8;
undefined **local_198;
float local_194;
float local_190;
undefined **local_18c [4];
undefined **local_17c [4];
float local_16c;
float local_168;
float local_164;
undefined4 local_15c;
undefined4 local_158;
undefined4 local_154;
undefined4 local_14c;
undefined4 local_148;
undefined4 local_144;
undefined4 local_13c;
undefined1 local_138;
undefined1 local_137;
Vector local_128 [12];
Vector local_11c [32];
float local_fc;
char local_f1;
undefined4 local_e0;
undefined4 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;
undefined4 local_28;
undefined4 local_24;
int local_20;
piVar7 = (int *)&stack0xfffffe14;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (_towlower == 0) {
iVar9 = 0;
}
else {
(**(code **)(_towlower + 0x50))();
iVar9 = _towlower;
}
iVar5 = _DAT_0105db00;
/* try { // try from 00a2e026 to 00a2e086 has its CatchHandler @ 00a2e406 */
if (((_DAT_0105d154 != 0) || (iVar8 = _DAT_0105db00, DAT_0105d158 == '\0')) &&
(iVar10 = ThreadGetCurrentId(), iVar8 = _DAT_0105db00, iVar5 == iVar10)) {
if ((char *)*_DAT_0105d15c != "InfectedAttack::OnPunch") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd2261c,(char *)0x0,0xca8906);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
iVar8 = _DAT_0105db00;
}
_DAT_0105db00 = iVar8;
if (param_2 == (CBaseEntity *)0x0) {
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar5 = ThreadGetCurrentId(), iVar8 == iVar5)) {
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
piVar7 = (int *)&stack0xfffffe14;
if (iVar9 != 0) {
(**(code **)(iVar9 + 0x54))();
piVar7 = (int *)&stack0xfffffe14;
}
goto LAB_00a2e182;
}
/* try { // try from 00a2db11 to 00a2dcd9 has its CatchHandler @ 00a2e472 */
DestroyAttractGoal(param_1);
cVar3 = (**(code **)(*(int *)(param_1 + 0x1a3c) + 0x114))();
if (cVar3 == '\0') {
/* try { // try from 00a2e11b to 00a2e11f has its CatchHandler @ 00a2e472 */
CBaseEntity::EmitSound((CBaseEntity *)param_1,"Zombie.AttackMiss",0.0,(float *)0x0);
}
else {
(**(code **)(*(int *)param_1 + 0x234))();
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)local_18c,(IHandleEntity *)param_2,0,
IgnoreActorsTraceFilterFunction);
local_18c[0] = &PTR_ShouldHitEntity_00c23430;
pfVar4 = (float *)(**(code **)(*(int *)param_2 + 0x288))();
local_16c = *pfVar4 - (float)local_198;
local_168 = pfVar4[1] - local_194;
local_138 = 1;
local_164 = pfVar4[2] - local_190;
local_13c = 0;
local_144 = 0;
local_148 = 0;
local_14c = 0;
local_137 = local_16c * local_16c + local_168 * local_168 + local_164 * local_164 != 0.0;
local_154 = 0;
local_158 = 0;
local_15c = 0;
local_17c[0] = local_198;
(**(code **)(*enginetrace + 0x14))();
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_128,local_11c,0xff,0,0,true,-1.0);
}
piVar7 = (int *)&stack0xfffffe10;
if ((1.0 <= local_fc) && (piVar7 = (int *)&stack0xfffffe10, local_f1 == '\0')) {
/* try { // try from 00a2dcff to 00a2dd7c has its CatchHandler @ 00a2e46e */
iVar5 = CBaseEntity::GetGender(param_2);
if ((iVar5 == 0x10) || (iVar5 = CBaseEntity::GetGender(param_2), iVar5 == 0x11)) {
/* try { // try from 00a2e2ad to 00a2e2af has its CatchHandler @ 00a2e46e */
(**(code **)(*(int *)(param_1 + 0x1a3c) + 0x74))();
}
pQVar6 = (QAngle *)(**(code **)(*(int *)param_1 + 0x238))();
AngleVectors(pQVar6,(Vector *)local_18c);
if ((((*(char **)(param_2 + 0x7c) == "func_door*") ||
(cVar3 = CBaseEntity::ClassMatchesComplex(param_2,"func_door*"), cVar3 != '\0')) ||
(*(char **)(param_2 + 0x7c) == "prop_door*")) ||
(cVar3 = CBaseEntity::ClassMatchesComplex(param_2,"prop_door*"), cVar3 != '\0')) {
this_00 = (CBasePropDoor *)__dynamic_cast();
if (this_00 == (CBasePropDoor *)0x0) {
/* try { // try from 00a2e35a to 00a2e35e has its CatchHandler @ 00a2e46e */
CBaseEntity::EmitSound(param_2,"WoodenDoor.Pound",0.0,(float *)0x0);
}
else {
/* try { // try from 00a2e1db to 00a2e263 has its CatchHandler @ 00a2e46e */
CBasePropDoor::OnInfectedAttack(this_00);
}
CTakeDamageInfo::CTakeDamageInfo
((CTakeDamageInfo *)local_128,(CBaseEntity *)param_1,(CBaseEntity *)param_1,
*(float *)(ZombieDoorPoundDamage._28_4_ + 0x2c),0x80,0);
(**(code **)(*(int *)param_1 + 0x478))();
piVar7 = (int *)&stack0xfffffe0c;
CalculateMeleeDamageForce
((CTakeDamageInfo *)local_128,(Vector *)local_18c,(Vector *)local_17c,1.0);
CBaseEntity::TakeDamage(param_2,(CTakeDamageInfo *)local_128);
}
else {
/* try { // try from 00a2dd8a to 00a2de78 has its CatchHandler @ 00a2e46c */
piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x14c))();
if (piVar7 == (int *)0x0) {
cVar3 = (**(code **)(*(int *)param_2 + 0x16c))();
if (cVar3 == '\0') goto LAB_00a2e368;
cVar3 = (**(code **)(*(int *)param_2 + 0x16c))();
pCVar11 = (CTerrorPlayer *)0x0;
if (cVar3 != '\0') {
pCVar11 = (CTerrorPlayer *)param_2;
}
lVar12 = (longdouble)CDirector::GetZombieAttackDamage(TheDirector,pCVar11);
LAB_00a2e375:
fVar13 = (float)lVar12;
}
else {
cVar3 = (**(code **)(*piVar7 + 0x550))();
if (cVar3 == '\0') {
LAB_00a2e368:
/* try { // try from 00a2e370 to 00a2e3fb has its CatchHandler @ 00a2e46c */
lVar12 = (longdouble)CDirector::GetZombieBreakableDamage();
goto LAB_00a2e375;
}
fVar13 = *(float *)(z_attack_infected_it_damage._28_4_ + 0x2c);
}
CTakeDamageInfo::CTakeDamageInfo
((CTakeDamageInfo *)local_128,(CBaseEntity *)param_1,(CBaseEntity *)param_1,fVar13
,0x80,0);
(**(code **)(*(int *)param_1 + 0x478))();
piVar7 = (int *)&stack0xfffffe0c;
CalculateMeleeDamageForce
((CTakeDamageInfo *)local_128,(Vector *)local_18c,(Vector *)local_17c,1.0);
if ((*(char **)(param_2 + 0x7c) == "func_breakable_surf") ||
(cVar3 = CBaseEntity::ClassMatchesComplex(param_2,"func_breakable_surf"), cVar3 != '\0'))
{
local_e0 = 4;
}
CBaseEntity::TakeDamage(param_2,(CTakeDamageInfo *)local_128);
cVar3 = (**(code **)(*(int *)param_2 + 0x16c))();
if (cVar3 == '\0') {
/* try { // try from 00a2e2f5 to 00a2e322 has its CatchHandler @ 00a2e46c */
iVar5 = (**(code **)(*(int *)param_2 + 0x144))();
if (iVar5 == 0) {
CBaseEntity::EmitSound((CBaseEntity *)param_1,"Zombie.ClawScrape",0.0,(float *)0x0);
}
else {
CBaseEntity::EmitSound(param_2,"Zombie.Punch",0.0,(float *)0x0);
piVar7 = (int *)&stack0xfffffe0c;
}
}
else {
cVar3 = IsUnderground(this,param_1);
if (cVar3 == '\0') {
piVar7 = (int *)&stack0xfffffe0c;
if (*(int *)(god._28_4_ + 0x30) == 0) {
/* try { // try from 00a2de96 to 00a2df38 has its CatchHandler @ 00a2e41e */
cVar3 = (**(code **)(*(int *)param_2 + 0x16c))();
if (cVar3 == '\0') {
param_2 = (CBaseEntity *)0x0;
}
local_c8 = 0;
local_c4 = 0x3f800000;
local_c0 = 100;
local_bc = 100;
local_b8 = 100;
local_b4 = 0x4b;
local_a8 = 0;
local_b0 = 0;
local_ac = 0;
local_28 = 0;
local_24 = 0;
cVar3 = CBaseEntity::GetParametersForSound
("Zombie.Punch",(CSoundParameters *)&local_c8,(char *)0x0);
if (cVar3 != '\0') {
CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_17c);
local_17c[0] = &PTR__CEveryoneExceptUserFilter_00d233e8;
/* try { // try from 00a2df4c to 00a2df62 has its CatchHandler @ 00a2e458 */
CRecipientFilter::AddAllPlayers((CRecipientFilter *)local_17c);
CRecipientFilter::RemoveRecipient
((CRecipientFilter *)local_17c,(CBasePlayer *)param_2);
iVar5 = 0;
if (*(int *)(param_2 + 0x30) != 0) {
iVar5 = *(int *)(param_2 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
/* try { // try from 00a2dfa5 to 00a2dfa9 has its CatchHandler @ 00a2e43a */
CBaseEntity::EmitSound
((IRecipientFilter *)local_17c,iVar5,"Zombie.Punch",(Vector *)0x0,0.0,
(float *)0x0);
local_17c[0] = &PTR__CEveryoneExceptUserFilter_00d233e8;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_17c);
}
/* try { // try from 00a2dfcd to 00a2e012 has its CatchHandler @ 00a2e41e */
CCSPlayer::EmitPrivateSound((CCSPlayer *)param_2,"Player.HitInternal");
iVar5 = CBaseEntity::GetGender((CBaseEntity *)param_1);
if ((iVar5 == 0xc) ||
(iVar5 = CBaseEntity::GetGender((CBaseEntity *)param_1),
piVar7 = (int *)&stack0xfffffe0c, iVar5 == 0x11)) {
(**(code **)(*(int *)param_2 + 0x8f0))();
piVar7 = (int *)&stack0xfffffe0c;
}
}
}
else {
iVar5 = (**(code **)(*(int *)param_1 + 0x52c))();
if (iVar5 != 0) {
iVar10 = *(int *)(iVar5 + 0x128) + 1;
iVar8 = 0;
if (-1 < iVar10) {
iVar8 = iVar10;
}
*(int *)(iVar5 + 0x128) = iVar8;
}
UTIL_Remove((CBaseEntity *)param_1);
piVar7 = (int *)&stack0xfffffe0c;
}
}
}
}
}
iVar5 = _DAT_0105db00;
if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
piVar7[-1] = 0xa2e13e;
iVar8 = ThreadGetCurrentId();
if (iVar5 == iVar8) {
*piVar7 = (int)_DAT_0105d15c;
piVar7[-1] = 0xa2e27d;
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
}
if (iVar9 != 0) {
piVar7[5] = 0;
piVar7[4] = 0;
piVar7[3] = 0;
*piVar7 = iVar9;
piVar7[1] = 0;
piVar7[2] = 0;
pcVar2 = *(code **)(iVar9 + 0x54);
piVar7[-1] = 0xa2e182;
(*pcVar2)();
}
LAB_00a2e182:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
*(undefined1 **)((int)piVar7 + -4) = &LAB_00a2e406;
__stack_chk_fail();
}
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.