CFriendlyFireAwardTemplate::FireGameEvent
0x00850440 · 2475 bytes · __thiscall
_ZN26CFriendlyFireAwardTemplate13FireGameEventEP10IGameEvent
Decompiled
undefined (2 params)
/* CFriendlyFireAwardTemplate::FireGameEvent(IGameEvent*) */
void __thiscall
CFriendlyFireAwardTemplate::FireGameEvent(CFriendlyFireAwardTemplate *this,IGameEvent *param_1)
{
CUtlLinkedList<CFriendlyFireIncident,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CFriendlyFireIncident,unsigned_short>,unsigned_short>>
*this_00;
code *pcVar1;
bool bVar2;
char *pcVar3;
CTerrorPlayer *pCVar4;
int iVar5;
CTerrorPlayer *pCVar6;
int *piVar7;
CTerrorPlayer *pCVar8;
uint uVar9;
int iVar10;
undefined4 uVar11;
longdouble lVar12;
longdouble lVar13;
longdouble lVar14;
longdouble lVar15;
pcVar3 = (char *)(**(code **)(*(int *)param_1 + 8))(param_1);
if (((pcVar3 != (char *)0x0) &&
(pCVar4 = (CTerrorPlayer *)CAwardTemplate::GetOwner((CAwardTemplate *)this),
pCVar4 != (CTerrorPlayer *)0x0)) &&
(iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)pCVar4), iVar5 == 2)) {
if ((pcVar3 == "player_hurt") || (iVar5 = _V_stricmp(pcVar3,"player_hurt"), iVar5 == 0)) {
uVar9 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"type",0);
if ((uVar9 != 0x808) &&
(((uVar9 & 0x20000002) == 0 ||
(iVar5 = *(int *)(this + 0x10), iVar10 = CCSPlayer::GetBulletGroup(), iVar5 != iVar10))))
{
iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
pCVar6 = (CTerrorPlayer *)UTIL_PlayerByUserId(iVar5);
iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker",0);
pCVar8 = (CTerrorPlayer *)UTIL_PlayerByUserId(iVar5);
if ((pCVar6 != (CTerrorPlayer *)0x0) &&
((pCVar8 != (CTerrorPlayer *)0x0 &&
(bVar2 = pCVar4 != pCVar6 && pCVar4 == pCVar8, pCVar4 != pCVar6 && pCVar4 == pCVar8))))
{
iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)pCVar6);
iVar10 = CBaseEntity::GetTeamNumber((CBaseEntity *)pCVar8);
if ((iVar5 == iVar10) && (piVar7 = (int *)GetGlobalTeam(2), piVar7 != (int *)0x0)) {
lVar15 = (longdouble)CTerrorPlayer::GetStillTime(pCVar6,1);
lVar12 = (longdouble)CTerrorPlayer::GetStillTime(pCVar8,0);
lVar13 = (longdouble)CTerrorPlayer::GetTimeSinceLastFiredWeapon(pCVar8);
iVar5 = CTerrorPlayer::GetOtherResponsibleForMovement(pCVar6);
if (iVar5 == 0) {
pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x28))(param_1,"weapon",&DAT_00d539c2)
;
if ((((pcVar3 == "boomer") || (iVar5 = _V_stricmp(pcVar3,"boomer"), iVar5 == 0)) ||
(pcVar3 = (char *)(**(code **)(*(int *)param_1 + 0x28))
(param_1,"weapon",&DAT_00d539c2),
pcVar3 == "env_explosion")) ||
(iVar5 = _V_stricmp(pcVar3,"env_explosion"), iVar5 == 0)) {
CTerrorPlayer::GetTimeFriendInFOV(pCVar8,pCVar6);
}
else {
lVar14 = (longdouble)CTerrorPlayer::GetTimeFriendInFOV(pCVar8,pCVar6);
if ((float)lVar12 <= 1.0) {
bVar2 = false;
}
else if ((0.0 <= (float)lVar14) && ((float)lVar14 < 1.0)) {
return;
}
if ((((float)lVar15 < 1.0) && (bVar2)) && ((float)lVar13 < 2.0)) {
if ((0.0 < *(float *)(this + 0x88)) &&
(lVar15 = (longdouble)IntervalTimer::Now(),
(float)lVar15 - *(float *)(this + 0x88) < 2.0)) {
return;
}
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"friendly_fire",0,0);
if (piVar7 != (int *)0x0) {
pcVar1 = *(code **)(*piVar7 + 0x30);
uVar11 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar8 + 0x30));
(*pcVar1)(piVar7,"attacker",uVar11);
pcVar1 = *(code **)(*piVar7 + 0x30);
uVar11 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar6 + 0x30));
(*pcVar1)(piVar7,"victim",uVar11);
pcVar1 = *(code **)(*piVar7 + 0x30);
uVar11 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar6 + 0x30));
(*pcVar1)(piVar7,"guilty",uVar11);
(**(code **)(*piVar7 + 0x30))(piVar7,"type",uVar9);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
}
(**(code **)(*(int *)pCVar6 + 0x928))(pCVar6,0x58,pCVar4);
this = this + 0x84;
goto LAB_008508cf;
}
}
iVar5 = 0;
while( true ) {
iVar10 = (**(code **)(*piVar7 + 0x354))(piVar7);
if (iVar10 <= iVar5) {
return;
}
if (iVar5 == 4) {
return;
}
pCVar4 = (CTerrorPlayer *)(**(code **)(*piVar7 + 0x358))(piVar7,iVar5);
if (pCVar6 == pCVar4) break;
iVar5 = iVar5 + 1;
}
this_00 = (CUtlLinkedList<CFriendlyFireIncident,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CFriendlyFireIncident,unsigned_short>,unsigned_short>>
*)(this + iVar5 * 0x1c + 0x14);
if (this_00 !=
(CUtlLinkedList<CFriendlyFireIncident,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CFriendlyFireIncident,unsigned_short>,unsigned_short>>
*)0x0) {
IntervalTimer::Start((IntervalTimer *)(this + 0x84));
PruneOldIncidents(this,(CUtlLinkedList *)this_00);
iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"dmg_health",0);
AddIncidentToList(this,(CUtlLinkedList *)this_00,iVar5);
if ((*(short *)(this_00 + 0xc) != -1) &&
((*(float *)(this + 0x90) <= 0.0 ||
(lVar15 = (longdouble)IntervalTimer::Now(),
2.0 <= (float)lVar15 - *(float *)(this + 0x90))))) {
(**(code **)(*(int *)this + 0x14))(this,0x57,0);
piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"friendly_fire",0,0);
if (piVar7 != (int *)0x0) {
pcVar1 = *(code **)(*piVar7 + 0x30);
uVar11 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar8 + 0x30));
(*pcVar1)(piVar7,"attacker",uVar11);
pcVar1 = *(code **)(*piVar7 + 0x30);
uVar11 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar6 + 0x30));
(*pcVar1)(piVar7,"victim",uVar11);
pcVar1 = *(code **)(*piVar7 + 0x30);
uVar11 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar8 + 0x30));
(*pcVar1)(piVar7,"guilty",uVar11);
(**(code **)(*piVar7 + 0x30))(piVar7,"type",uVar9);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
}
uVar11 = CCSPlayer::GetBulletGroup();
*(undefined4 *)(this + 0x10) = uVar11;
CUtlLinkedList<CFriendlyFireIncident,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<CFriendlyFireIncident,unsigned_short>,unsigned_short>>
::RemoveAll(this_00);
CTerrorPlayer::OnFriendlyFire(pCVar6,pCVar8,param_1);
this = this + 0x8c;
goto LAB_008508cf;
}
}
}
}
}
}
}
else if ((pcVar3 == "player_incapacitated") ||
(iVar5 = _V_stricmp(pcVar3,"player_incapacitated"), iVar5 == 0)) {
iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
pCVar6 = (CTerrorPlayer *)UTIL_PlayerByUserId(iVar5);
iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"attacker",0);
pCVar8 = (CTerrorPlayer *)UTIL_PlayerByUserId(iVar5);
uVar9 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"type",0);
if ((((uVar9 & 0x20000002) == 0) ||
(iVar5 = *(int *)(this + 0x10), iVar10 = CCSPlayer::GetBulletGroup(), iVar5 != iVar10)) &&
((((pCVar6 != (CTerrorPlayer *)0x0 && (pCVar8 != (CTerrorPlayer *)0x0)) &&
(pCVar4 != pCVar6)) && (pCVar4 == pCVar8)))) {
iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)pCVar6);
iVar10 = CBaseEntity::GetTeamNumber((CBaseEntity *)pCVar4);
if (iVar5 == iVar10) {
lVar15 = (longdouble)CTerrorPlayer::GetStillTime(pCVar6,1);
if (((1.0 <= (float)lVar15) ||
(lVar15 = (longdouble)CTerrorPlayer::GetStillTime(pCVar4,0), (float)lVar15 <= 1.0)) ||
(lVar15 = (longdouble)CTerrorPlayer::GetTimeSinceLastFiredWeapon(pCVar4),
2.0 <= (float)lVar15)) {
if ((*(float *)(this + 0x90) <= 0.0) ||
(lVar15 = (longdouble)IntervalTimer::Now(),
2.0 <= (float)lVar15 - *(float *)(this + 0x90))) {
(**(code **)(*(int *)this + 0x14))(this,0x57,0);
lVar15 = (longdouble)IntervalTimer::Now();
if ((float)lVar15 != *(float *)(this + 0x90)) {
(**(code **)(*(int *)(this + 0x8c) + 4))(this + 0x8c,this + 0x90);
*(float *)(this + 0x90) = (float)lVar15;
}
}
uVar11 = CCSPlayer::GetBulletGroup();
*(undefined4 *)(this + 0x10) = uVar11;
}
else if ((*(float *)(this + 0x88) <= 0.0) ||
(lVar15 = (longdouble)IntervalTimer::Now(),
2.0 <= (float)lVar15 - *(float *)(this + 0x88))) {
(**(code **)(*(int *)pCVar6 + 0x928))(pCVar6,0x58,pCVar4);
this = this + 0x84;
LAB_008508cf:
IntervalTimer::Start((IntervalTimer *)this);
return;
}
}
}
}
else {
if ((pcVar3 == "map_transition") || (iVar5 = _V_stricmp(pcVar3,"map_transition"), iVar5 == 0))
{
LAB_00850560:
Reset(this);
return;
}
if (((pcVar3 == "player_first_spawn") ||
(iVar5 = _V_stricmp(pcVar3,"player_first_spawn"), iVar5 == 0)) &&
(iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0), iVar5 != 0)) {
iVar5 = (**(code **)(*(int *)param_1 + 0x1c))(param_1,"userid",0);
pCVar6 = (CTerrorPlayer *)UTIL_PlayerByUserId(iVar5);
if (pCVar4 == pCVar6) goto LAB_00850560;
}
}
}
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.