CBasePlayer::OnTakeDamage_Alive
0x007bdbd0 · 1279 bytes · __thiscall
_ZN11CBasePlayer18OnTakeDamage_AliveERK15CTakeDamageInfo
Decompiled
undefined (2 params)
/* WARNING: Removing unreachable block (ram,0x007bde98) */
/* WARNING: Removing unreachable block (ram,0x007be0f6) */
/* CBasePlayer::OnTakeDamage_Alive(CTakeDamageInfo const&) */
undefined4 __thiscall CBasePlayer::OnTakeDamage_Alive(CBasePlayer *this,CTakeDamageInfo *param_1)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
int *piVar7;
code *pcVar8;
char cVar9;
int iVar10;
uint uVar11;
undefined4 uVar12;
float *pfVar13;
float *pfVar14;
uint uVar15;
int *piVar16;
int *piVar17;
undefined *puVar18;
float fVar19;
float local_34;
float local_30;
float local_2c;
float local_28;
float local_24;
float local_20;
*(uint *)(this + 0x1d54) = *(uint *)(this + 0x1d54) | *(uint *)(param_1 + 0x48);
iVar10 = CBaseCombatCharacter::OnTakeDamage_Alive((CBaseCombatCharacter *)this,param_1);
if (iVar10 == 0) {
return 0;
}
uVar11 = *(uint *)(param_1 + 0x34);
if (uVar11 == 0xffffffff) {
return 0;
}
puVar18 = g_pEntityList + (uVar11 & 0xfff) * 0x10;
if (puVar18 == (undefined *)0xfffffffc) {
return 0;
}
if (*(uint *)(puVar18 + 8) != uVar11 >> 0xc) {
return 0;
}
piVar7 = *(int **)(puVar18 + 4);
if (piVar7 == (int *)0x0) {
return 0;
}
local_34 = vec3_origin;
local_30 = DAT_01053d4c;
local_2c = DAT_01053d50;
uVar11 = *(uint *)(param_1 + 0x30);
if (uVar11 != 0xffffffff) {
uVar15 = uVar11 & 0xfff;
piVar16 = (int *)(g_pEntityList + uVar15 * 0x10 + 4);
if (piVar16 != (int *)0x0) {
if ((*(uint *)(g_pEntityList + uVar15 * 0x10 + 8) == uVar11 >> 0xc) &&
(*(int *)(g_pEntityList + uVar15 * 0x10 + 4) != 0)) {
pfVar13 = (float *)(**(code **)(*(int *)this + 0x288))(this);
uVar11 = *(uint *)(param_1 + 0x30);
piVar16 = (int *)0x0;
if (uVar11 != 0xffffffff) {
puVar18 = g_pEntityList + (uVar11 & 0xfff) * 0x10;
if ((puVar18 == (undefined *)0xfffffffc) || (*(uint *)(puVar18 + 8) != uVar11 >> 0xc)) {
piVar16 = (int *)0x0;
}
else {
piVar16 = *(int **)(puVar18 + 4);
}
}
pfVar14 = (float *)(**(code **)(*piVar16 + 0x288))(piVar16);
local_34 = *pfVar14 - *pfVar13;
local_30 = pfVar14[1] - pfVar13[1];
local_2c = (pfVar14[2] - 10.0) - pfVar13[2];
VectorNormalize((Vector *)&local_34);
uVar11 = *(uint *)(param_1 + 0x30);
if ((uVar11 == 0xffffffff) ||
(piVar16 = (int *)(g_pEntityList + (uVar11 & 0xfff) * 0x10 + 4), piVar16 == (int *)0x0))
goto LAB_007bdc8b;
}
if ((piVar16[1] == uVar11 >> 0xc) &&
(((*piVar16 != 0 && (this[0x186] == (CBasePlayer)0x2)) &&
((*(byte *)(piVar7 + 0x6d) & 8) == 0)))) {
fVar19 = *(float *)(param_1 + 0x44);
if (fVar19 == 3.4028235e+38) {
fVar19 = *(float *)(param_1 + 0x3c);
}
if ((AllocTempVector()::s_vecTemp == '\0') &&
(iVar10 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar10 != 0)) {
__cxa_guard_release(&AllocTempVector()::s_vecTemp);
}
if ((AllocTempVector()::s_nIndex == '\0') &&
(iVar10 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar10 != 0)) {
AllocTempVector()::s_nIndex = 0;
__cxa_guard_release(&AllocTempVector()::s_nIndex);
}
AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
LOCK();
UNLOCK();
fVar1 = *(float *)(this + 0x1a8);
iVar10 = AllocTempVector()::s_nIndex * 0xc;
fVar2 = *(float *)(this + 0x19c);
*(float *)(AllocTempVector()::s_vecTemp + iVar10) = fVar1 - fVar2;
fVar3 = *(float *)(this + 0x1ac);
fVar4 = *(float *)(this + 0x1a0);
*(float *)(AllocTempVector()::s_vecTemp + iVar10 + 4) = fVar3 - fVar4;
fVar5 = *(float *)(this + 0x1b0);
fVar6 = *(float *)(this + 0x1a4);
*(float *)(AllocTempVector()::s_vecTemp + iVar10 + 8) = fVar5 - fVar6;
local_20 = (73728.0 / ((fVar1 - fVar2) * (fVar3 - fVar4) * (fVar5 - fVar6))) * 5.0 * fVar19;
if (1000.0 <= local_20) {
local_20 = 1000.0;
}
local_20 = -local_20;
local_28 = local_34 * local_20;
local_24 = local_30 * local_20;
local_20 = local_20 * local_2c;
if (250.0 < local_20) {
local_20 = 250.0;
}
CBaseEntity::ApplyAbsVelocityImpulse((CBaseEntity *)this,(Vector *)&local_28);
}
}
}
LAB_007bdc8b:
piVar16 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"player_hurt",0,&g_PlayerHurtEvent);
if (piVar16 != (int *)0x0) {
pcVar8 = *(code **)(*piVar16 + 0x30);
uVar12 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
(*pcVar8)(piVar16,"userid",uVar12);
uVar12 = 0;
if (-1 < *(int *)(this + 0x100)) {
uVar12 = *(undefined4 *)(this + 0x100);
}
(**(code **)(*piVar16 + 0x30))(piVar16,"health",uVar12);
(**(code **)(*piVar16 + 0x30))(piVar16,"priority",5);
cVar9 = (**(code **)(*piVar7 + 0x16c))(piVar7);
if (cVar9 == '\0') {
(**(code **)(*piVar16 + 0x30))(piVar16,"attacker",0);
}
else {
cVar9 = (**(code **)(*piVar7 + 0x16c))(piVar7);
piVar17 = (int *)0x0;
if (cVar9 != '\0') {
piVar17 = piVar7;
}
pcVar8 = *(code **)(*piVar16 + 0x30);
uVar12 = (**(code **)(*engine + 0x40))(engine,piVar17[0xc]);
(*pcVar8)(piVar16,"attacker",uVar12);
}
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar16,0);
}
cVar9 = (**(code **)(*piVar7 + 0x140))(piVar7);
if (cVar9 == '\0') {
return 1;
}
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
CSoundEnt::InsertSound
(1,(Vector *)(this + 0x2e0),0x200,0.5,(CBaseEntity *)this,0,(CBaseEntity *)0x0);
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.