CTerrorPlayer::AllowDamage
0x009b6d20 · 1596 bytes · __thiscall
_ZN13CTerrorPlayer11AllowDamageERK15CTakeDamageInfo
Decompiled
undefined (2 params)
/* CTerrorPlayer::AllowDamage(CTakeDamageInfo const&) */
undefined4 __thiscall CTerrorPlayer::AllowDamage(CTerrorPlayer *this,CTakeDamageInfo *param_1)
{
uint uVar1;
int *piVar2;
CCSPlayer *pCVar3;
code *pcVar4;
bool bVar5;
char cVar6;
undefined4 uVar7;
int iVar8;
undefined4 uVar9;
int iVar10;
int iVar11;
CBaseEntity *pCVar12;
char *pcVar13;
CBaseEntity *this_00;
undefined *puVar14;
longdouble lVar15;
float local_20;
uVar7 = (**(code **)(*(int *)this + 300))(this);
if (((char)uVar7 != '\0') &&
((cVar6 = IsPlayingDeathAnim(this), cVar6 == '\0' || (*(int *)(param_1 + 0x48) == 0x20000)))) {
cVar6 = (**(code **)(*(int *)this + 0x7e8))(this);
if (cVar6 != '\0') {
iVar8 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
cVar6 = IsASurvivorTeam(iVar8);
if (((((cVar6 != '\0') && (((byte)param_1[0x48] & 0x40) != 0)) &&
(uVar1 = *(uint *)(param_1 + 0x30), uVar1 != 0xffffffff)) &&
((puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc &&
(*(uint *)(puVar14 + 8) == uVar1 >> 0xc)))) &&
((pCVar12 = *(CBaseEntity **)(puVar14 + 4), pCVar12 != (CBaseEntity *)0x0 &&
(cVar6 = (**(code **)(*(int *)pCVar12 + 0x16c))(pCVar12), cVar6 != '\0')))) {
cVar6 = (**(code **)(*(int *)pCVar12 + 0x16c))(pCVar12);
this_00 = (CBaseEntity *)0x0;
if (cVar6 != '\0') {
this_00 = pCVar12;
}
iVar8 = CBaseEntity::GetTeamNumber(this_00);
if ((iVar8 == 3) && (iVar8 = (**(code **)(*(int *)this_00 + 0x544))(this_00), iVar8 == 2)) {
return 0;
}
}
}
local_20 = (float)*(int *)(this + 0x100);
if ((this[0x32fc] != (CTerrorPlayer)0x0) &&
(cVar6 = (**(code **)(*(int *)this + 0x7e8))(this), cVar6 == '\0')) {
local_20 = local_20 - 1.0;
}
if (((*(int *)(this + 0x2984) < 1) ||
(lVar15 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this),
0.0 < (local_20 - (float)*(int *)(this + 0x2984)) + (float)(int)lVar15)) &&
(((byte)param_1[0x49] & 0x80) == 0)) {
return uVar7;
}
iVar8 = GetDifficulty();
if ((iVar8 == 3) ||
((*(int *)(ZombieWitchAlwaysKills._28_4_ + 0x30) != 0 &&
(iVar8 = GetDifficulty(), iVar8 != 0)))) {
uVar1 = *(uint *)(param_1 + 0x34);
if ((uVar1 == 0xffffffff) ||
(((puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 == (undefined *)0xfffffffc ||
(*(uint *)(puVar14 + 8) != uVar1 >> 0xc)) ||
((piVar2 = *(int **)(puVar14 + 4), piVar2 == (int *)0x0 ||
(((pCVar12 = (CBaseEntity *)(**(code **)(*piVar2 + 0x144))(piVar2),
pCVar12 == (CBaseEntity *)0x0 ||
(iVar8 = CBaseEntity::GetTeamNumber(pCVar12), iVar8 != 3)) ||
(iVar8 = (**(code **)(*(int *)pCVar12 + 0x544))(pCVar12), iVar8 != 7)))))))) {
bVar5 = true;
}
else {
bVar5 = false;
}
}
else {
bVar5 = true;
}
uVar1 = *(uint *)(this + 0x2a4c);
if (((uVar1 != 0xffffffff) &&
(puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar14 + 8) == uVar1 >> 0xc &&
((*(CTerrorPlayer **)(puVar14 + 4) != (CTerrorPlayer *)0x0 &&
(((byte)param_1[0x49] & 0x80) != 0)))))) {
AddSurvivorDamage(*(CTerrorPlayer **)(puVar14 + 4),(int)(100.0 - *(float *)(param_1 + 0x3c)),0
,*(undefined4 *)(this + 0x2ba0));
}
if (!bVar5) {
return uVar7;
}
iVar8 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
uVar9 = IsASurvivorTeam(iVar8);
if ((char)uVar9 != '\0') {
cVar6 = (**(code **)(*(int *)this + 0x7e8))(this);
if (cVar6 != '\0') {
return uVar7;
}
if (this[0x39f2] != (CTerrorPlayer)0x0) {
return uVar7;
}
lVar15 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this);
iVar10 = (int)((float)lVar15 + local_20);
iVar8 = *(int *)(this + 0x2e54);
iVar11 = CDirector::GetScriptValue
(TheDirector,"SurvivorMaxIncapacitatedCount",
*(int *)(DirectorPrivate_DirectorSurvivorMaxIncapacitatedCount._28_4_ +
0x30));
if (iVar8 < iVar11) {
if ((*(int *)(SurvivorIncapacitatedMaxFallDamage._28_4_ + 0x30) <= *(int *)(this + 0x2984))
&& (((byte)param_1[0x48] & 0x20) != 0)) {
IncapLog("%s is dying instead of incapping because they fell too far.",this,
(CTerrorPlayer *)0x0);
return uVar9;
}
uVar1 = *(uint *)(param_1 + 0x34);
if ((((uVar1 == 0xffffffff) ||
(puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 == (undefined *)0xfffffffc))
|| (*(uint *)(puVar14 + 8) != uVar1 >> 0xc)) ||
((pCVar3 = *(CCSPlayer **)(puVar14 + 4), pCVar3 == (CCSPlayer *)0x0 ||
(cVar6 = (**(code **)(*(int *)pCVar3 + 0x16c))(pCVar3), cVar6 == '\0')))) {
(**(code **)(*(int *)this + 0x8b4))(this,"world",iVar10);
}
else {
pcVar13 = (char *)(**(code **)(*(int *)this + 0xb8))(this);
CCSPlayer::RecordDamageGiven(pCVar3,pcVar13,iVar10);
pcVar4 = *(code **)(*(int *)this + 0x8b4);
uVar7 = (**(code **)(*(int *)pCVar3 + 0xb8))(pCVar3);
(*pcVar4)(this,uVar7,iVar10);
}
OnIncapacitatedAsSurvivor(this,param_1);
return 0;
}
pcVar13 = (char *)UTIL_VarArgs("%s is dying instead of incapping because they have been revived %d times already."
,"%s",*(undefined4 *)(this + 0x2e54));
IncapLog(pcVar13,this,(CTerrorPlayer *)0x0);
cVar6 = StartSurvivorDeathAnim(this,param_1);
if (cVar6 == '\0') {
iVar8 = *(int *)(this + 0x100);
lVar15 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this);
if ((int)lVar15 + iVar8 == *(int *)(this + 0x2984) ||
((int)lVar15 + iVar8) - *(int *)(this + 0x2984) < 0) {
return uVar7;
}
if (*(int *)(this + 0x100) != 0) {
CBaseEntity::NetworkVar_m_iHealth::NetworkStateChanged(this + 0x100);
*(undefined4 *)(this + 0x100) = 0;
return uVar9;
}
return uVar7;
}
uVar1 = *(uint *)(param_1 + 0x34);
if (((uVar1 != 0xffffffff) &&
(puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar14 + 8) == uVar1 >> 0xc &&
((pCVar3 = *(CCSPlayer **)(puVar14 + 4), pCVar3 != (CCSPlayer *)0x0 &&
(cVar6 = (**(code **)(*(int *)pCVar3 + 0x16c))(pCVar3), cVar6 != '\0')))))) {
pcVar13 = (char *)(**(code **)(*(int *)this + 0xb8))(this);
CCSPlayer::RecordDamageGiven(pCVar3,pcVar13,iVar10);
pcVar4 = *(code **)(*(int *)this + 0x8b4);
uVar7 = (**(code **)(*(int *)pCVar3 + 0xb8))(pCVar3);
(*pcVar4)(this,uVar7,iVar10);
return 0;
}
(**(code **)(*(int *)this + 0x8b4))(this,"world",iVar10);
return 0;
}
iVar8 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
if (iVar8 != 3) {
return uVar7;
}
iVar8 = (**(code **)(*(int *)this + 0x544))(this);
if (iVar8 != 8) {
return uVar7;
}
cVar6 = (**(code **)(*(int *)this + 0x7e8))(this);
if (cVar6 != '\0') {
return uVar7;
}
OnIncapacitatedAsTank(this,param_1);
}
return 0;
}
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.