NextBotManager::Update
0x00759cd0 · 980 bytes · __thiscall
_ZN14NextBotManager6UpdateEv
Decompiled
undefined (1 param)
/* NextBotManager::Update() */
void __thiscall NextBotManager::Update(NextBotManager *this)
{
int iVar1;
ushort uVar2;
char cVar3;
uint uVar4;
int iVar5;
int *piVar6;
int iVar7;
int *piVar8;
int iVar9;
float fVar10;
uint local_34;
int local_30;
int local_28;
uVar4 = (uint)*(ushort *)(this + 0x10);
if (uVar4 != 0xffff) {
iVar9 = *(int *)(this + 4);
do {
piVar6 = *(int **)(iVar9 + uVar4 * 8);
(**(code **)(*piVar6 + 0xac))(piVar6);
iVar9 = *(int *)(this + 4);
uVar4 = (uint)*(ushort *)(iVar9 + 6 + uVar4 * 8);
} while (uVar4 != 0xffff);
}
iVar9 = gpGlobals;
if (*(short *)(this + 0x16) != 0) {
iVar7 = *(int *)(gpGlobals + 4);
if (iVar7 == Update()::iCurFrame) {
return;
}
*(undefined8 *)(this + 0x2c) = 0;
fVar10 = *(float *)(iVar9 + 0x1c);
iVar5 = (int)(*(float *)(nb_update_frequency._28_4_ + 0x2c) / fVar10 + 0.5);
iVar9 = 0;
if (-1 < iVar5) {
iVar9 = iVar5;
}
iVar5 = *(int *)(this + 0x20);
Update()::iCurFrame = iVar7;
if (iVar5 != iVar9) {
Msg("NextBot tickrate changed from %d (%.3fms) to %d (%.3fms)\n",iVar5,
(double)((float)iVar5 * fVar10),iVar9,(double)((float)iVar9 * fVar10));
*(int *)(this + 0x20) = iVar9;
}
if (iVar9 < 1) {
local_34 = (uint)*(ushort *)(this + 0x16);
local_30 = 0;
local_28 = 0;
uVar4 = 0;
}
else {
uVar4 = (uint)*(ushort *)(this + 0x10);
if (uVar4 == 0xffff) {
local_30 = 0;
local_28 = 0;
local_34 = 0;
uVar4 = 0xffff;
}
else {
iVar9 = *(int *)(this + 4);
local_30 = 0;
do {
while( true ) {
piVar6 = *(int **)(iVar9 + uVar4 * 8);
piVar6 = (int *)(**(code **)(*piVar6 + 0xb4))(piVar6);
if ((piVar6 == (int *)0x0) ||
((((cVar3 = (**(code **)(*piVar6 + 0x16c))(piVar6), cVar3 == '\0' ||
((char)piVar6[0x41] != '\x02')) && ((*(byte *)(piVar6 + 0x53) & 1) == 0)) &&
(((code *)piVar6[7] != CBaseEntity::SUB_Remove || (piVar6[8] != 0)))))) break;
local_30 = local_30 + 1;
iVar9 = *(int *)(this + 4);
uVar4 = (uint)*(ushort *)(iVar9 + 6 + uVar4 * 8);
if (uVar4 == 0xffff) goto LAB_00759e43;
}
iVar9 = *(int *)(this + 4);
uVar4 = (uint)*(ushort *)(iVar9 + 6 + uVar4 * 8);
} while (uVar4 != 0xffff);
LAB_00759e43:
local_28 = 0;
local_34 = 0;
fVar10 = (float)(int)((uint)*(ushort *)(this + 0x16) - local_30) /
(float)*(int *)(this + 0x20);
iVar7 = (int)fVar10;
if ((float)iVar7 < fVar10) {
iVar7 = iVar7 + 1;
}
iVar5 = *(int *)(gpGlobals + 0x18);
uVar4 = (uint)*(ushort *)(this + 0x10);
if ((iVar7 != 0) && (uVar4 != 0xffff)) {
do {
iVar1 = uVar4 * 8;
piVar8 = (int *)(iVar1 + iVar9);
piVar6 = (int *)*piVar8;
if ((char)piVar6[3] == '\0') {
if (iVar5 - piVar6[4] < *(int *)(this + 0x20)) break;
piVar8 = (int *)(**(code **)(*piVar6 + 0xb4))(piVar6);
if ((piVar8 != (int *)0x0) &&
((((cVar3 = (**(code **)(*piVar8 + 0x16c))(piVar8), cVar3 != '\0' &&
((char)piVar8[0x41] == '\x02')) || ((*(byte *)(piVar8 + 0x53) & 1) != 0)) ||
(((code *)piVar8[7] == CBaseEntity::SUB_Remove && (piVar8[8] == 0)))))) {
iVar9 = *(int *)(this + 4);
piVar8 = (int *)(iVar1 + iVar9);
goto LAB_00759eb4;
}
*(undefined1 *)(piVar6 + 3) = 1;
iVar7 = iVar7 + -1;
iVar9 = *(int *)(this + 4);
local_34 = local_34 + 1;
uVar2 = *(ushort *)(iVar1 + iVar9 + 6);
}
else {
local_28 = local_28 + 1;
LAB_00759eb4:
uVar2 = *(ushort *)((int)piVar8 + 6);
}
uVar4 = (uint)uVar2;
if ((iVar7 == 0) || (uVar4 == 0xffff)) break;
} while( true );
}
}
}
if (*(int *)(nb_update_debug._28_4_ + 0x30) != 0) {
if ((*(int *)(this + 0x20) < 1) || (uVar4 == 0xffff)) {
iVar7 = 0;
iVar9 = *(int *)(gpGlobals + 0x18);
}
else {
iVar7 = 0;
iVar9 = *(int *)(gpGlobals + 0x18);
do {
piVar6 = (int *)(*(int *)(this + 4) + uVar4 * 8);
uVar4 = (uint)*(ushort *)((int)piVar6 + 6);
iVar7 = iVar7 + (uint)(*(int *)(this + 0x20) <= iVar9 - *(int *)(*piVar6 + 0x10));
} while (uVar4 != 0xffff);
}
Msg("Frame %8d/tick %8d: %3d run of %3d, %3d sliders, %3d blocked slides, scheduled %3d for next tick, %3d intentional sliders, %d nonresponsive, %d dead\n"
,*(int *)(gpGlobals + 4) + -1,iVar9 + -1,g_nRun,(uint)*(ushort *)(this + 0x16) - local_30,
g_nSlid,g_nBlockedSlides,local_34,iVar7,local_28,local_30);
g_nBlockedSlides = 0;
g_nSlid = 0;
g_nRun = 0;
}
}
DisplayStuckDump();
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.