CGameWeaponManager::Think
0x006d1d90 · 830 bytes · __thiscall
_ZN18CGameWeaponManager5ThinkEv
Decompiled
undefined (1 param)
/* CGameWeaponManager::Think() */
void __thiscall CGameWeaponManager::Think(CGameWeaponManager *this)
{
CBaseEntity CVar1;
uint uVar2;
char cVar3;
char *pcVar4;
CBaseEntity *this_00;
int iVar5;
CBaseEntity *pCVar6;
undefined *puVar7;
int iVar8;
int iVar9;
CUtlMemory<CBaseEntity*,int> *local_40;
CBaseEntity *local_34;
void *local_30;
undefined4 local_2c;
undefined4 local_28;
int local_24;
void *local_20;
CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 2.0,(char *)0x0);
pcVar4 = *(char **)(this + 0x440);
local_2c = 0x40;
local_28 = 0;
if (pcVar4 == (char *)0x0) {
pcVar4 = "";
}
local_30 = malloc(0x100);
local_24 = 0;
local_20 = local_30;
if (this[0x44c] == (CGameWeaponManager)0x0) {
iVar8 = 0;
if (*(int *)(this + 0x45c) < 1) goto LAB_006d1ee0;
LAB_006d1e5b:
do {
uVar2 = *(uint *)(*(int *)(this + 0x450) + iVar8 * 4);
if (((uVar2 == 0xffffffff) ||
(puVar7 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar7 + 8) != uVar2 >> 0xc)) {
local_34 = (CBaseEntity *)0x0;
LAB_006d1e37:
iVar9 = iVar8 + -1;
CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>>::FastRemove
((CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>> *)
(this + 0x450),iVar8);
}
else {
local_34 = *(CBaseEntity **)(puVar7 + 4);
if (local_34 == (CBaseEntity *)0x0) goto LAB_006d1e37;
iVar9 = iVar8;
if (((byte)local_34[0xd4] & 0x20) == 0) {
/* try { // try from 006d1eaf to 006d20d1 has its CatchHandler @ 006d20dd */
CUtlVector<CBaseEntity*,CUtlMemory<CBaseEntity*,int>>::InsertBefore
((CUtlVector<CBaseEntity*,CUtlMemory<CBaseEntity*,int>> *)&local_30,local_24,
&local_34);
iVar8 = iVar8 + 1;
if (*(int *)(this + 0x45c) <= iVar8) break;
goto LAB_006d1e5b;
}
}
iVar8 = iVar9 + 1;
} while (iVar8 < *(int *)(this + 0x45c));
}
else {
pCVar6 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,pcVar4);
for (; pCVar6 != (CBaseEntity *)0x0;
pCVar6 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,pCVar6,pcVar4)) {
local_40 = (CUtlMemory<CBaseEntity*,int> *)&local_30;
if ((((byte)pCVar6[0xd4] & 0x20) == 0) && (pCVar6[0x1458] != (CBaseEntity)0x0)) {
local_34 = pCVar6;
CUtlVector<CBaseEntity*,CUtlMemory<CBaseEntity*,int>>::InsertBefore
((CUtlVector<CBaseEntity*,CUtlMemory<CBaseEntity*,int>> *)local_40,local_24,
&local_34);
}
}
}
if (0 < local_24) {
iVar8 = local_24 - *(int *)(this + 0x444);
iVar9 = 0;
do {
if (iVar8 < 1) break;
pCVar6 = *(CBaseEntity **)((int)local_30 + iVar9 * 4);
if (*(int *)(gpGlobals + 0x14) == 1) {
this_00 = (CBaseEntity *)UTIL_GetLocalPlayer();
iVar5 = UTIL_FindClientInPVS(*(edict_t **)(pCVar6 + 0x30));
if ((iVar5 == 0) ||
(cVar3 = (**(code **)(*(int *)this_00 + 0x3c8))(this_00,pCVar6), cVar3 == '\0'))
goto LAB_006d1f1d;
if (((byte)pCVar6[0x14d] & 8) == 0) {
CVar1 = this_00[0x14d];
}
else {
CBaseEntity::CalcAbsolutePosition(pCVar6);
CVar1 = this_00[0x14d];
}
if (((byte)CVar1 & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
if (360.0 < ABS(*(float *)(this_00 + 0x2e4) - *(float *)(pCVar6 + 0x2e4)) +
ABS(*(float *)(this_00 + 0x2e0) - *(float *)(pCVar6 + 0x2e0)) +
ABS(*(float *)(this_00 + 0x2e8) - *(float *)(pCVar6 + 0x2e8)))
goto LAB_006d1f1d;
}
else {
LAB_006d1f1d:
CBaseEntity::AddEffects(pCVar6,0x20);
UTIL_Remove(pCVar6);
DevMsg(2,"Surplus %s removed\n",pcVar4);
iVar8 = iVar8 + -1;
}
iVar9 = iVar9 + 1;
} while (iVar9 < local_24);
}
LAB_006d1ee0:
local_40 = (CUtlMemory<CBaseEntity*,int> *)&local_30;
local_24 = 0;
CUtlMemory<CBaseEntity*,int>::Purge(local_40);
local_20 = local_30;
CUtlMemory<CBaseEntity*,int>::Purge(local_40);
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.