CHLTVDirector::FindBestGameEvent
0x006db9c0 · 436 bytes · __thiscall
_ZN13CHLTVDirector17FindBestGameEventEv
Decompiled
undefined (1 param)
/* CHLTVDirector::FindBestGameEvent() */
int __thiscall CHLTVDirector::FindBestGameEvent(CHLTVDirector *this)
{
int iVar1;
uint uVar2;
uint uVar3;
int iVar4;
int iVar5;
int iVar6;
uint local_3c;
ushort local_38;
ushort local_34;
int local_2c [7];
iVar5 = 0;
_V_memset(&local_3c,0,0x10);
_V_memset(local_2c,0,0x10);
uVar2 = FindFirstEvent(this,*(int *)(this + 0x1c));
do {
iVar1 = *(int *)(this + 0x1c);
local_2c[iVar5] = 0;
(&local_3c)[iVar5] = 0;
iVar1 = (int)(((float)iVar5 + 1.0 + (float)iVar5 + 1.0) / *(float *)(gpGlobals + 0x1c) + 0.5) +
iVar1;
if (*(int *)(this + 0x38) < iVar1) break;
if (uVar2 == 0xffff) {
LAB_006dbad2:
uVar2 = 0xffff;
}
else {
iVar4 = *(int *)(this + 0x1d4) + (uVar2 & 0xffff) * 0x14;
if (*(int *)(iVar4 + 8) <= iVar1) {
iVar6 = 0;
uVar3 = uVar2 & 0xffff;
while( true ) {
iVar4 = *(int *)(iVar4 + 0xc);
if (iVar6 < iVar4) {
(&local_3c)[iVar5] = uVar2;
local_2c[iVar5] = iVar4;
}
uVar2 = CUtlRBTree<CGameEvent,unsigned_short,bool(*)(CGameEvent_const&,CGameEvent_const&),CUtlMemory<UtlRBTreeNode_t<CGameEvent,unsigned_short>,unsigned_short>>
::NextInorder((CUtlRBTree<CGameEvent,unsigned_short,bool(*)(CGameEvent_const&,CGameEvent_const&),CUtlMemory<UtlRBTreeNode_t<CGameEvent,unsigned_short>,unsigned_short>>
*)(this + 0x1d0),(ushort)uVar3);
uVar2 = uVar2 & 0xffff;
if (uVar2 == 0xffff) goto LAB_006dbad2;
iVar4 = *(int *)(this + 0x1d4) + uVar2 * 0x14;
if (iVar1 < *(int *)(iVar4 + 8)) break;
iVar6 = local_2c[iVar5];
uVar3 = uVar2;
}
}
}
iVar5 = iVar5 + 1;
} while (iVar5 != 4);
if ((local_2c[0] == 0) && (local_2c[1] == 0)) {
if (local_2c[2] == 0) {
return 0;
}
LAB_006dbaf8:
if (local_2c[2] <= local_2c[1]) {
if (local_2c[3] <= local_2c[1]) {
return *(int *)(this + 0x1d4) + 8 + (uint)local_38 * 0x14;
}
goto LAB_006dbb01;
}
}
else {
if (local_2c[0] <= local_2c[1]) goto LAB_006dbaf8;
if (local_2c[2] < local_2c[0]) {
return *(int *)(this + 0x1d4) + 8 + (local_3c & 0xffff) * 0x14;
}
}
if (local_2c[3] < local_2c[2]) {
return *(int *)(this + 0x1d4) + 8 + (uint)local_34 * 0x14;
}
LAB_006dbb01:
if (local_3c == 0) {
return 0;
}
return *(int *)(this + 0x1d4) + 8 + (local_3c & 0xffff) * 0x14;
}
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.