CTerrorWeapon::TestSwingCollision
0x00571590 · 2534 bytes · __thiscall
_ZN13CTerrorWeapon18TestSwingCollisionERK6Vector
Decompiled
undefined (2 params)
/* CTerrorWeapon::TestSwingCollision(Vector const&) */
undefined1 __thiscall CTerrorWeapon::TestSwingCollision(CTerrorWeapon *this,Vector *param_1)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
int *piVar5;
uint uVar6;
char cVar7;
CBaseEntity *this_00;
int iVar8;
IHandleEntity *pIVar9;
undefined *puVar10;
int iVar11;
CBaseEntity *pCVar12;
undefined1 local_12d;
float local_12c;
float local_128;
float local_124;
float local_120;
float local_11c;
float local_118;
float local_114;
float local_110;
float local_10c;
float local_108;
float local_104;
float local_100;
float local_fc;
float local_f8;
float local_f4;
undefined **local_f0 [4];
undefined4 local_e0 [3];
undefined4 local_d4;
undefined4 local_d0;
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
float local_b4;
float local_ac;
float local_a8;
float local_a4;
float local_9c;
float local_98;
float local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
float local_70;
float local_6c;
float local_68;
Vector local_64 [32];
float local_44;
char local_3a;
char local_39;
CBaseEntity *local_24;
this_00 = (CBaseEntity *)GetPlayerOwner(this);
if ((this_00 == (CBaseEntity *)0x0) || (this[0x1791] != (CTerrorWeapon)0x0)) {
return 0;
}
(**(code **)(*(int *)this_00 + 0x478))(&local_12c,this_00);
fVar1 = *(float *)(this + 0x157c);
fVar2 = *(float *)param_1;
fVar3 = *(float *)(param_1 + 4);
fVar4 = *(float *)(param_1 + 8);
(**(code **)(*(int *)this_00 + 0x478))(&local_70,this_00);
local_120 = fVar2 * fVar1 + local_70;
local_118 = fVar1 * fVar4 + local_68;
local_11c = fVar3 * fVar1 + local_6c;
local_114 = -3.0;
local_110 = -3.0;
local_10c = -3.0;
local_108 = 3.0;
local_104 = 3.0;
local_100 = 3.0;
CTraceFilterSimpleList::CTraceFilterSimpleList((CTraceFilterSimpleList *)local_f0,0);
local_f0[0] = &PTR_ShouldHitEntity_00c2e780;
/* try { // try from 005716ed to 00571a53 has its CatchHandler @ 00571fb5 */
CTraceFilterSimpleList::AddEntityToIgnore
((CTraceFilterSimpleList *)local_f0,(IHandleEntity *)this_00);
iVar11 = 0;
if (0 < *(int *)(this + 0x1788)) {
do {
while ((((uVar6 = *(uint *)(this + iVar11 * 4 + 0x1588), uVar6 == 0xffffffff ||
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc
)) || (*(uint *)(puVar10 + 8) != uVar6 >> 0xc)) ||
((piVar5 = *(int **)(puVar10 + 4), piVar5 == (int *)0x0 ||
(iVar8 = (**(code **)(*piVar5 + 0x144))(piVar5), iVar8 == 0))))) {
iVar11 = iVar11 + 1;
if (*(int *)(this + 0x1788) <= iVar11) goto LAB_005717b8;
}
uVar6 = *(uint *)(this + iVar11 * 4 + 0x1588);
pIVar9 = (IHandleEntity *)0x0;
if ((uVar6 != 0xffffffff) &&
((puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc &&
(*(uint *)(puVar10 + 8) == uVar6 >> 0xc)))) {
pIVar9 = *(IHandleEntity **)(puVar10 + 4);
}
CTraceFilterSimpleList::AddEntityToIgnore((CTraceFilterSimpleList *)local_f0,pIVar9);
iVar11 = iVar11 + 1;
} while (iVar11 < *(int *)(this + 0x1788));
}
LAB_005717b8:
local_8c = 0;
local_b8 = local_11c - local_128;
local_b4 = local_118 - local_124;
local_bc = local_120 - local_12c;
local_87 = local_b8 * local_b8 + local_b4 * local_b4 + local_bc * local_bc != 0.0;
local_9c = (local_108 - local_114) * 0.5;
local_98 = (local_104 - local_110) * 0.5;
local_94 = (local_100 - local_10c) * 0.5;
local_a8 = (local_104 + local_110) * 0.5;
local_ac = (local_108 + local_114) * 0.5;
local_a4 = (local_100 + local_10c) * 0.5;
local_c8 = local_128 + local_a8;
local_cc = local_12c + local_ac;
local_c4 = local_124 + local_a4;
local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
local_ac = -local_ac;
local_a8 = -local_a8;
local_a4 = -local_a4;
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x4600400b,local_f0,&local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,local_64,0xff,0xff,0,true,-1.0);
}
if (*(int *)(ZombieShowSwings._28_4_ + 0x30) != 0) {
if (*(int *)(ZombieShowSwings._28_4_ + 0x30) < 2) {
/* try { // try from 00571ba9 to 00571bad has its CatchHandler @ 00571fb5 */
NDebugOverlay::Line((Vector *)&local_12c,(Vector *)&local_120,0xff,0xff,0,true,1.0);
}
else {
NDebugOverlay::SweptBox
((Vector *)&local_12c,(Vector *)&local_120,(Vector *)&local_114,(Vector *)&local_108
,(QAngle *)&vec3_angle,0xff,0xff,0,0xff,3.0);
}
}
if (((1.0 <= local_44) && (local_3a == '\0')) && (local_39 == '\0')) {
local_12d = 0;
goto LAB_00571aeb;
}
local_12d = 0;
if (local_24 == (CBaseEntity *)0x0) goto LAB_00571aeb;
cVar7 = (**(code **)(*(int *)local_24 + 0x16c))(local_24);
iVar11 = IPredictionSystem::g_pPredictionSystems;
pCVar12 = (CBaseEntity *)0x0;
if (cVar7 != '\0') {
pCVar12 = local_24;
}
for (; iVar11 != 0; iVar11 = *(int *)(iVar11 + 4)) {
*(int *)(iVar11 + 0x10) = *(int *)(iVar11 + 0x10) + 1;
}
if (pCVar12 == (CBaseEntity *)0x0) {
LAB_00571a95:
cVar7 = HasBeenPreviouslyHit(this,local_24);
if (cVar7 == '\0') {
MarkAsHit(this,local_24);
iVar11 = *(int *)this;
}
else {
iVar11 = *(int *)this;
}
local_12d = (**(code **)(iVar11 + 0x6d8))(this,&local_70,param_1,cVar7 == '\0');
iVar11 = IPredictionSystem::g_pPredictionSystems;
}
else {
/* try { // try from 00571a80 to 00571b5e has its CatchHandler @ 00571ff5 */
iVar11 = CBaseEntity::GetTeamNumber(this_00);
cVar7 = IsASurvivorTeam(iVar11);
if (cVar7 == '\0') goto LAB_00571a95;
/* try { // try from 00571bb6 to 00571f4d has its CatchHandler @ 00571ff5 */
iVar11 = CBaseEntity::GetTeamNumber(local_24);
cVar7 = IsASurvivorTeam(iVar11);
if (cVar7 == '\0') goto LAB_00571a95;
if ((((((*(int *)(this + 0x1580) < 1) ||
(((uVar6 = *(uint *)(pCVar12 + 0x33c4), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar10 + 8) == uVar6 >> 0xc && (*(int *)(puVar10 + 4) != 0)))))) ||
((((uVar6 = *(uint *)(pCVar12 + 0x3e68), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar10 + 8) == uVar6 >> 0xc)) && (*(int *)(puVar10 + 4) != 0)))) ||
(((((uVar6 = *(uint *)(pCVar12 + 0x3e48), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar10 + 8) == uVar6 >> 0xc)) && (*(int *)(puVar10 + 4) != 0)) ||
(((uVar6 = *(uint *)(pCVar12 + 0x3ee0), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar10 + 8) == uVar6 >> 0xc && (*(int *)(puVar10 + 4) != 0)))))))) &&
((iVar11 = CBaseEntity::GetGroundEntity(local_24), iVar11 != 0 ||
(((uVar6 = *(uint *)(pCVar12 + 0x33c4), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar10 + 8) == uVar6 >> 0xc && (*(int *)(puVar10 + 4) != 0)))))))) &&
(((((((uVar6 = *(uint *)(pCVar12 + 0x3e68), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar10 + 8) == uVar6 >> 0xc)) && (*(int *)(puVar10 + 4) != 0)) ||
(((uVar6 = *(uint *)(pCVar12 + 0x3e48), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar10 + 8) == uVar6 >> 0xc && (*(int *)(puVar10 + 4) != 0)))))) ||
(((uVar6 = *(uint *)(pCVar12 + 0x33c4), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar10 + 8) == uVar6 >> 0xc &&
((*(int *)(puVar10 + 4) != 0 && (pCVar12[0x39f1] == (CBaseEntity)0x0)))))))) ||
(cVar7 = (**(code **)(*(int *)pCVar12 + 0x7e8))(pCVar12), cVar7 == '\0')))) {
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
if (((byte)local_24[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(local_24);
}
local_f4 = 0.0;
local_fc = *(float *)(local_24 + 0x2e0) - *(float *)(this_00 + 0x2e0);
local_f8 = *(float *)(local_24 + 0x2e4) - *(float *)(this_00 + 0x2e4);
VectorNormalize((Vector *)&local_fc);
CBasePlayer::EyeVectors
((CBasePlayer *)this_00,(Vector *)&local_cc,(Vector *)0x0,(Vector *)0x0);
local_c4 = 0.0;
VectorNormalize((Vector *)&local_cc);
if ((*(float *)(ZombieGunSurvivorShoveDot._28_4_ + 0x2c) <=
local_c8 * local_f8 + local_cc * local_fc + local_c4 * local_f4) ||
((((uVar6 = *(uint *)(pCVar12 + 0x33c4), uVar6 != 0xffffffff &&
(puVar10 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar10 + 8) == uVar6 >> 0xc)) && (*(int *)(puVar10 + 4) != 0))))
goto LAB_00571a95;
}
MarkAsHit(this,local_24);
iVar11 = IPredictionSystem::g_pPredictionSystems;
}
for (; iVar11 != 0; iVar11 = *(int *)(iVar11 + 4)) {
*(int *)(iVar11 + 0x10) = *(int *)(iVar11 + 0x10) + -1;
}
LAB_00571aeb:
local_f0[0] = &PTR_ShouldHitEntity_00c54590;
local_d4 = 0;
CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_e0);
local_d0 = local_e0[0];
CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_e0);
return local_12d;
}
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.