CHLTVDirector::CreateShotFromEvent
0x006d9bf0 · 794 bytes · __thiscall
_ZN13CHLTVDirector19CreateShotFromEventEP10CGameEvent
Decompiled
undefined (2 params)
/* CHLTVDirector::CreateShotFromEvent(CGameEvent*) */
void __thiscall CHLTVDirector::CreateShotFromEvent(CHLTVDirector *this,CGameEvent *param_1)
{
code *pcVar1;
char *pcVar2;
int iVar3;
int iVar4;
int iVar5;
int iVar6;
undefined4 uVar7;
longdouble lVar8;
float fVar9;
int local_28;
undefined4 local_24;
pcVar2 = (char *)(**(code **)(**(int **)(param_1 + 8) + 8))(*(int **)(param_1 + 8));
iVar3 = _V_strcmp("player_hurt",pcVar2);
iVar4 = _V_strcmp("player_death",pcVar2);
iVar5 = _V_strcmp("round_start",pcVar2);
iVar6 = _V_strcmp("round_end",pcVar2);
if ((iVar4 == 0) || (iVar3 == 0)) {
iVar5 = (**(code **)(**(int **)(param_1 + 8) + 0x1c))(*(int **)(param_1 + 8),"userid",0);
iVar5 = UTIL_PlayerByUserId(iVar5);
iVar6 = (**(code **)(**(int **)(param_1 + 8) + 0x1c))(*(int **)(param_1 + 8),"attacker",0);
local_28 = UTIL_PlayerByUserId(iVar6);
if (iVar5 != 0) {
if ((local_28 == 0) || (iVar5 == local_28)) {
if (*(int *)(iVar5 + 0x30) == 0) {
iVar3 = 0;
}
else {
iVar3 = *(int *)(iVar5 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
(**(code **)(*(int *)this + 0x60))(this,iVar3,0,0x60,0x14,0,0);
}
else {
if (((iVar4 == 0) && (lVar8 = (longdouble)RandomFloat(0,0x3f800000), 0.33 < (float)lVar8))
|| ((iVar3 == 0 && (lVar8 = (longdouble)RandomFloat(0,0x3f800000), 0.66 < (float)lVar8)))
) {
lVar8 = (longdouble)RandomFloat(0,0x3f800000);
local_24 = 1;
fVar9 = 0.3;
}
else {
lVar8 = (longdouble)RandomFloat(0,0x3f800000);
fVar9 = 0.7;
local_24 = 0;
}
iVar3 = iVar5;
if ((float)lVar8 <= fVar9) {
iVar3 = local_28;
local_28 = iVar5;
}
pcVar1 = *(code **)(*(int *)this + 0x60);
lVar8 = (longdouble)RandomFloat(0,0x3f800000);
uVar7 = 0xffffffe2;
if (0.5 < (float)lVar8) {
uVar7 = 0x1e;
}
if (*(int *)(iVar3 + 0x30) == 0) {
iVar3 = 0;
}
else {
iVar3 = *(int *)(iVar3 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
if (*(int *)(local_28 + 0x30) == 0) {
iVar4 = 0;
}
else {
iVar4 = *(int *)(local_28 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
(*pcVar1)(this,iVar4,iVar3,0x60,0xffffffec,uVar7,local_24);
}
iVar3 = (int)(2.0 / *(float *)(gpGlobals + 0x1c) + 0.5) + *(int *)param_1;
if (*(int *)(this + 0x38) < iVar3) {
iVar3 = *(int *)(this + 0x38);
}
*(int *)(this + 0x38) = iVar3;
}
return;
}
if ((iVar6 != 0) && (iVar5 != 0)) {
DevMsg("No known TV shot for event %s\n");
return;
}
/* WARNING: Could not recover jumptable at 0x006d9ca6. Too many branches */
/* WARNING: Treating indirect jump as call */
(**(code **)(*(int *)this + 0x54))();
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.