CEarlyMourningAwardTemplate::FireGameEvent
0x0084e410 · 1231 bytes · __thiscall
_ZN27CEarlyMourningAwardTemplate13FireGameEventEP10IGameEvent
Decompiled
undefined (2 params)
/* CEarlyMourningAwardTemplate::FireGameEvent(IGameEvent*) */
void __thiscall
CEarlyMourningAwardTemplate::FireGameEvent(CEarlyMourningAwardTemplate *this,IGameEvent *param_1)
{
float fVar1;
float fVar2;
float fVar3;
int *piVar4;
char cVar5;
char *pcVar6;
CBaseEntity *this_00;
int iVar7;
int iVar8;
CBaseEntity *this_01;
CBaseEntity *this_02;
uint uVar9;
CBaseEntity *pCVar10;
float *pfVar11;
float fVar12;
float fVar13;
float fVar14;
float local_28;
CBaseEntity *local_24;
CBaseEntity *local_20;
pcVar6 = (char *)(**(code **)(*(int *)param_1 + 8))(param_1);
if (((pcVar6 != (char *)0x0) &&
(this_00 = (CBaseEntity *)CAwardTemplate::GetOwner((CAwardTemplate *)this),
this_00 != (CBaseEntity *)0x0)) && (iVar7 = CBaseEntity::GetTeamNumber(this_00), iVar7 == 2))
{
if ((pcVar6 == "player_death") || (iVar7 = _V_stricmp(pcVar6,"player_death"), iVar7 == 0)) {
iVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
if (iVar7 == 0) {
iVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"entityid",0);
if (iVar7 == 0) {
return;
}
iVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"entityid",0);
local_20 = (CBaseEntity *)UTIL_EntityByIndex(iVar7);
}
else {
iVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
local_20 = (CBaseEntity *)UTIL_PlayerByUserId(iVar7);
}
if (local_20 != (CBaseEntity *)0x0) {
iVar7 = CBaseEntity::GetTeamNumber(local_20);
iVar8 = CBaseEntity::GetTeamNumber(this_00);
if (iVar7 == iVar8) {
cVar5 = (**(code **)(*(int *)this_00 + 0x7e8))(this_00);
if ((cVar5 == '\0') &&
(cVar5 = (**(code **)(*(int *)this_00 + 300))(this_00), cVar5 != '\0')) {
iVar7 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker",0);
this_01 = (CBaseEntity *)UTIL_PlayerByUserId(iVar7);
if ((local_20 != this_01) &&
(5.0 <= *(float *)(gpGlobals + 0xc) - *(float *)(this + 0x10))) {
if (((byte)local_20[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(local_20);
}
fVar1 = *(float *)(local_20 + 0x2e0);
fVar2 = *(float *)(local_20 + 0x2e4);
fVar3 = *(float *)(local_20 + 0x2e8);
if (*(int *)(gpGlobals + 0x14) < 1) {
local_24 = (CBaseEntity *)0x0;
local_28 = 250000.0;
}
else {
local_24 = (CBaseEntity *)0x0;
iVar7 = 1;
local_28 = 250000.0;
do {
this_02 = (CBaseEntity *)UTIL_PlayerByIndex(iVar7);
fVar12 = local_28;
pCVar10 = local_24;
if (this_02 == (CBaseEntity *)0x0) {
LAB_0084e6a0:
fVar12 = local_28;
pCVar10 = local_24;
}
else if ((*(int *)(this_02 + 0x30) != 0) &&
(*(int *)(this_02 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0)) {
cVar5 = (**(code **)(*(int *)this_02 + 0x16c))(this_02);
if ((cVar5 != '\0') &&
((((*(int *)(this_02 + 0x1f6c) != 2 &&
(iVar8 = (**(code **)(*(int *)this_02 + 0x148))(this_02), iVar8 == 0)) &&
(cVar5 = (**(code **)(*(int *)this_02 + 300))(this_02), cVar5 != '\0')) &&
(iVar8 = CBaseEntity::GetTeamNumber(this_02), iVar8 == 3)))) {
pfVar11 = (float *)(**(code **)(*(int *)this_02 + 0x288))(this_02);
fVar12 = *pfVar11 - fVar1;
fVar14 = pfVar11[1] - fVar2;
fVar13 = pfVar11[2] - fVar3;
fVar12 = fVar12 * fVar12 + fVar14 * fVar14 + fVar13 * fVar13;
pCVar10 = this_02;
if (fVar12 < local_28) goto LAB_0084e6a6;
}
goto LAB_0084e6a0;
}
LAB_0084e6a6:
local_24 = pCVar10;
local_28 = fVar12;
iVar7 = iVar7 + 1;
} while (iVar7 <= *(int *)(gpGlobals + 0x14));
}
iVar7 = TheNextBots();
uVar9 = (uint)*(ushort *)(iVar7 + 0x10);
if (uVar9 != 0xffff) {
iVar8 = *(int *)(iVar7 + 4);
do {
piVar4 = *(int **)(iVar8 + uVar9 * 8);
pCVar10 = (CBaseEntity *)(**(code **)(*piVar4 + 0xb4))(piVar4);
if (((pCVar10 != (CBaseEntity *)0x0) &&
(cVar5 = (**(code **)(*(int *)pCVar10 + 300))(pCVar10), cVar5 != '\0')) &&
(iVar8 = CBaseEntity::GetTeamNumber(pCVar10), iVar8 == 3)) {
pfVar11 = (float *)(**(code **)(*(int *)pCVar10 + 0x288))(pCVar10);
fVar14 = *pfVar11 - fVar1;
fVar12 = pfVar11[1] - fVar2;
fVar13 = pfVar11[2] - fVar3;
fVar12 = fVar12 * fVar12 + fVar14 * fVar14 + fVar13 * fVar13;
if (fVar12 < local_28) {
local_28 = fVar12;
local_24 = pCVar10;
}
}
iVar8 = *(int *)(iVar7 + 4);
uVar9 = (uint)*(ushort *)(iVar8 + 6 + uVar9 * 8);
} while (uVar9 != 0xffff);
}
if (local_24 == (CBaseEntity *)0x0) {
if (((byte)local_20[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(local_20);
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
if (SQRT((*(float *)(this_00 + 0x2e4) - *(float *)(local_20 + 0x2e4)) *
(*(float *)(this_00 + 0x2e4) - *(float *)(local_20 + 0x2e4)) +
(*(float *)(this_00 + 0x2e0) - *(float *)(local_20 + 0x2e0)) *
(*(float *)(this_00 + 0x2e0) - *(float *)(local_20 + 0x2e0)) +
(*(float *)(this_00 + 0x2e8) - *(float *)(local_20 + 0x2e8)) *
(*(float *)(this_00 + 0x2e8) - *(float *)(local_20 + 0x2e8))) <= 300.0) {
if (this_01 != (CBaseEntity *)0x0) {
iVar7 = CBaseEntity::GetTeamNumber(this_01);
iVar8 = CBaseEntity::GetTeamNumber(local_20);
if (iVar7 == iVar8) {
return;
}
}
(**(code **)(*(int *)this + 0x14))(this,0x62,0);
}
}
}
}
}
else {
*(undefined4 *)(this + 0x10) = *(undefined4 *)(gpGlobals + 0xc);
}
}
}
else if ((pcVar6 == "map_transition") ||
(iVar7 = _V_stricmp(pcVar6,"map_transition"), iVar7 == 0)) {
*(undefined4 *)(this + 0x10) = 0;
return;
}
}
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.