CDirectorItemManager::FixedConvertPillsToKits
0x008a59e0 · 1075 bytes · __thiscall
_ZN20CDirectorItemManager23FixedConvertPillsToKitsEf
Decompiled
undefined (2 params)
/* CDirectorItemManager::FixedConvertPillsToKits(float) */
void __thiscall
CDirectorItemManager::FixedConvertPillsToKits(CDirectorItemManager *this,float param_1)
{
undefined4 uVar1;
uint uVar2;
CBaseEntity *pCVar3;
undefined4 uVar4;
CBaseEdict *this_00;
int *piVar5;
int iVar6;
int iVar7;
int iVar8;
int iVar9;
CBaseEntity *this_01;
undefined *puVar10;
undefined4 *puVar11;
int iVar12;
int iVar13;
float fVar14;
double dVar15;
float fVar16;
double dVar17;
int local_30;
int local_20;
iVar12 = 0;
piVar5 = (int *)CollectHealingItems(this);
local_20 = 0;
if (0 < piVar5[3]) {
do {
while ((((uVar2 = *(uint *)(*piVar5 + iVar12 * 8), uVar2 == 0xffffffff ||
(puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc
)) || (*(uint *)(puVar10 + 8) != uVar2 >> 0xc)) ||
((pCVar3 = *(CBaseEntity **)(puVar10 + 4), pCVar3 == (CBaseEntity *)0x0 ||
(iVar6 = (**(code **)(*(int *)pCVar3 + 0x3cc))(pCVar3), iVar6 != 0xf))))) {
iVar6 = piVar5[3];
iVar12 = iVar12 + 1;
if (iVar6 <= iVar12) goto LAB_008a5a96;
}
if (((byte)pCVar3[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar3);
}
iVar7 = TerrorNavMesh::GetCheckpoint(TheNavMesh,(Vector *)(pCVar3 + 0x2e0));
iVar6 = piVar5[3];
local_20 = local_20 + (uint)(iVar7 == 0);
iVar12 = iVar12 + 1;
} while (iVar12 < iVar6);
LAB_008a5a96:
fVar14 = (float)local_20;
fVar16 = param_1 * fVar14;
if ((fVar16 <= fVar14) && (fVar14 = fVar16, fVar16 <= 0.0)) {
fVar14 = 0.0;
}
local_30 = (int)fVar14;
iVar8 = iVar6 + -1;
iVar12 = iVar8 * 8;
iVar7 = iVar8;
if (-1 < iVar8) {
do {
iVar13 = iVar7 + -1;
iVar9 = RandomInt(iVar7,iVar8);
iVar7 = *piVar5;
puVar11 = (undefined4 *)(iVar7 + iVar12);
iVar12 = iVar12 + -8;
uVar4 = *puVar11;
uVar1 = puVar11[1];
*puVar11 = *(undefined4 *)(iVar7 + iVar9 * 8);
puVar11[1] = *(undefined4 *)(iVar7 + 4 + iVar9 * 8);
puVar11 = (undefined4 *)(iVar9 * 8 + *piVar5);
*puVar11 = uVar4;
puVar11[1] = uVar1;
iVar7 = iVar13;
} while (iVar13 != -1);
}
iVar12 = 0;
if (0 < local_30 && 0 < iVar6) {
do {
uVar2 = *(uint *)(*piVar5 + iVar12 * 8);
if ((((uVar2 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar10 + 8) == uVar2 >> 0xc)) &&
((pCVar3 = *(CBaseEntity **)(puVar10 + 4), pCVar3 != (CBaseEntity *)0x0 &&
(iVar7 = (**(code **)(*(int *)pCVar3 + 0x3cc))(pCVar3), iVar7 == 0xf)))) {
if (((byte)pCVar3[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar3);
}
iVar7 = TerrorNavMesh::GetCheckpoint(TheNavMesh,(Vector *)(pCVar3 + 0x2e0));
if (((iVar7 == 0) &&
(iVar7 = CreateEntityByName("weapon_first_aid_kit_spawn",-1,true), iVar7 != 0)) &&
(this_01 = (CBaseEntity *)
__dynamic_cast(iVar7,&CBaseEntity::typeinfo,&CWeaponSpawn::typeinfo,0),
this_01 != (CBaseEntity *)0x0)) {
if (((byte)pCVar3[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar3);
}
CBaseEntity::SetAbsOrigin(this_01,(Vector *)(pCVar3 + 0x2e0));
if (((byte)pCVar3[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar3);
}
CBaseEntity::SetAbsAngles(this_01,(QAngle *)(pCVar3 + 0x37c));
uVar2 = *(uint *)(this_01 + 0x148);
if (uVar2 != (uVar2 | 0x8000)) {
if (this_01[0x6c] == (CBaseEntity)0x0) {
this_00 = *(CBaseEdict **)(this_01 + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this_01[0x70] = (CBaseEntity)((byte)this_01[0x70] | 1);
}
*(uint *)(this_01 + 0x148) = uVar2 | 0x8000;
}
*(undefined4 *)(this_01 + 0x144c) = 1;
DispatchSpawn(this_01,true);
UTIL_Remove(pCVar3);
iVar7 = *piVar5;
puVar11 = (undefined4 *)(**(code **)(*(int *)this_01 + 0xc))(this_01);
*(undefined4 *)(iVar12 * 8 + iVar7) = *puVar11;
CL4DGameStats::Event_ConvertedPills((CL4DGameStats *)CL4D_GameStats);
if (((byte)this_01[0x14d] & 8) == 0) {
dVar17 = (double)*(float *)(this_01 + 0x2e8);
LAB_008a5d21:
dVar15 = (double)*(float *)(this_01 + 0x2e4);
}
else {
CBaseEntity::CalcAbsolutePosition(this_01);
dVar17 = (double)*(float *)(this_01 + 0x2e8);
if (((byte)this_01[0x14d] & 8) == 0) goto LAB_008a5d21;
CBaseEntity::CalcAbsolutePosition(this_01);
dVar15 = (double)*(float *)(this_01 + 0x2e4);
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
}
DevMsg("Vs mode converted Pain Pills to First Aid Kit at ( %3.2f, %3.2f, %3.2f )\n",
(double)*(float *)(this_01 + 0x2e0),dVar15,dVar17);
local_30 = local_30 + -1;
}
}
iVar12 = iVar12 + 1;
} while ((0 < local_30) && (iVar12 < iVar6));
}
}
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.