Music::CollectZombieData
0x008ee100 · 2950 bytes · __thiscall
_ZN5Music17CollectZombieDataEv
Decompiled
undefined (1 param)
/* Music::CollectZombieData() */
void __thiscall Music::CollectZombieData(Music *this)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
CBaseEntity *pCVar5;
code *pcVar6;
undefined4 uVar7;
undefined4 uVar8;
undefined4 uVar9;
float fVar10;
undefined4 *puVar11;
undefined4 *puVar12;
char cVar13;
int iVar14;
uint uVar15;
int *piVar16;
size_t __size;
void *pvVar17;
int iVar18;
CRecipientFilter *this_00;
undefined4 *puVar19;
int iVar20;
int iVar21;
longdouble lVar22;
float fVar23;
CUtlMemory<Infected*,int> *local_60;
int local_54;
CBaseEntity *local_4c;
Infected *local_48;
void *local_44;
undefined4 local_40;
undefined4 local_3c;
int local_38;
void *local_34;
undefined4 *local_30;
int local_2c;
int local_28;
int local_24;
undefined4 *local_20;
local_40 = 0x20;
local_3c = 0;
fVar1 = *(float *)(MusicDynamicAttackCIRangeMax._28_4_ + 0x2c);
fVar2 = *(float *)(MusicDynamicAttackCINearMax._28_4_ + 0x2c);
fVar3 = *(float *)(MusicDynamicAttackCICloseMax._28_4_ + 0x2c);
fVar4 = *(float *)(MusicDynamicAttackCIVeryCloseMax._28_4_ + 0x2c);
fVar23 = 1.0 / *(float *)(MusicDynamicAttackCIRangeNum._28_4_ + 0x2c);
*(undefined4 *)(this + 0x298) = 0;
*(undefined4 *)(this + 0x2cc) = 0;
*(undefined4 *)(this + 0x24c) = 0;
*(undefined4 *)(this + 0x238) = 0;
local_44 = malloc(0x80);
local_38 = 0;
local_34 = local_44;
/* try { // try from 008ee1b7 to 008ee22c has its CatchHandler @ 008eecf0 */
iVar14 = TheNextBots();
uVar15 = (uint)*(ushort *)(iVar14 + 0x10);
if (uVar15 != 0xffff) {
iVar21 = *(int *)(iVar14 + 4);
do {
piVar16 = *(int **)(iVar21 + uVar15 * 8);
piVar16 = (int *)(**(code **)(*piVar16 + 0xb4))(piVar16);
if (((piVar16 != (int *)0x0) &&
(local_48 = (Infected *)(**(code **)(*piVar16 + 0x14c))(piVar16),
local_48 != (Infected *)0x0)) && (((byte)local_48[0x14c] & 1) == 0)) {
CUtlVector<Infected*,CUtlMemory<Infected*,int>>::InsertBefore
((CUtlVector<Infected*,CUtlMemory<Infected*,int>> *)&local_44,local_38,&local_48);
}
iVar21 = *(int *)(iVar14 + 4);
uVar15 = (uint)*(ushort *)(iVar21 + 6 + uVar15 * 8);
} while (uVar15 != 0xffff);
}
local_60 = (CUtlMemory<Infected*,int> *)&local_44;
*(undefined4 *)(this + 0x2e4) = 0;
*(undefined4 *)(this + 0x2e8) = 0;
*(undefined4 *)(this + 0x2dc) = 0;
*(undefined4 *)(this + 0x2e0) = 0;
*(int *)(this + 0x228) = local_38;
*(undefined4 *)(this + 0x2d4) = 0;
*(undefined4 *)(this + 0x2d8) = 0;
*(undefined4 *)(this + 0x2ec) = 0;
*(undefined4 *)(this + 0x2f0) = 0;
*(undefined4 *)(this + 0x254) = 0;
*(undefined4 *)(this + 0x288) = 0;
*(undefined4 *)(this + 700) = 0;
*(undefined4 *)(this + 0x284) = 0;
*(undefined4 *)(this + 0x2b8) = 0;
local_30 = (undefined4 *)0x0;
local_2c = 0;
local_28 = 0;
local_24 = 0;
local_20 = (undefined4 *)0x0;
if (local_38 < 1) {
local_20 = (undefined4 *)0x0;
}
else {
local_2c = local_38;
local_30 = malloc(local_38 << 3);
local_54 = 0;
local_20 = local_30;
do {
iVar14 = *(int *)((int)local_44 + local_54 * 4);
if (*(char *)(iVar14 + 0x1d09) == '\0') {
pCVar5 = *(CBaseEntity **)(this + 0x378);
pcVar6 = *(code **)(*(int *)(iVar14 + 0x1a3c) + 0x128);
if (((byte)pCVar5[0x14d] & 8) != 0) {
/* try { // try from 008ee381 to 008eec66 has its CatchHandler @ 008eecbb */
CBaseEntity::CalcAbsolutePosition(pCVar5);
}
lVar22 = (longdouble)(*pcVar6)(iVar14 + 0x1a3c,pCVar5 + 0x2e0);
iVar18 = local_24;
iVar21 = local_24 + 1;
if ((local_2c < iVar21) && (-1 < local_28)) {
if (local_28 == 0) {
if (local_2c == 0) {
if (iVar21 < 5) {
local_2c = 4;
goto LAB_008ee3e7;
}
local_2c = 4;
}
do {
iVar20 = local_2c;
local_2c = iVar20 * 2;
} while (local_2c < iVar21);
__size = iVar20 << 4;
}
else {
for (local_2c = (local_24 / local_28 + 1) * local_28; local_2c < iVar21;
local_2c = (local_2c + iVar21) / 2) {
}
LAB_008ee3e7:
__size = local_2c << 3;
}
if (local_30 == (undefined4 *)0x0) {
local_30 = malloc(__size);
}
else {
local_30 = realloc(local_30,__size);
iVar21 = local_24 + 1;
}
}
iVar20 = (iVar21 - iVar18) + -1;
local_24 = iVar21;
local_20 = local_30;
if (0 < iVar20) {
_V_memmove(local_30 + iVar18 * 2 + 2,local_30 + iVar18 * 2,iVar20 * 8);
}
local_30[iVar18 * 2] = iVar14;
(local_30 + iVar18 * 2)[1] = (float)lVar22;
}
puVar11 = local_30;
local_54 = local_54 + 1;
} while (local_54 < *(int *)(this + 0x228));
if (local_24 != 0) {
if (0xf < local_24 * 8) {
iVar14 = local_24 * 8 >> 3;
for (iVar21 = iVar14 + -2 >> 1;
std::__adjust_heap<CIEntry*,int,CIEntry,bool(*)(CIEntry_const&,CIEntry_const&)>
(puVar11,iVar21,iVar14,puVar11[iVar21 * 2],puVar11[iVar21 * 2 + 1],
InfectedDistLessFunc), puVar12 = local_30, iVar21 != 0; iVar21 = iVar21 + -1)
{
}
iVar14 = (int)(local_30 + local_24 * 2) - (int)local_30;
puVar11 = local_30 + local_24 * 2;
while (0xf < iVar14) {
puVar19 = puVar11 + -2;
uVar7 = *puVar19;
uVar8 = puVar11[-1];
uVar9 = puVar12[1];
*puVar19 = *puVar12;
iVar14 = (int)puVar19 - (int)puVar12;
puVar11[-1] = uVar9;
std::__adjust_heap<CIEntry*,int,CIEntry,bool(*)(CIEntry_const&,CIEntry_const&)>
(puVar12,0,iVar14 >> 3,uVar7,uVar8,InfectedDistLessFunc);
puVar11 = puVar19;
}
}
iVar14 = local_24;
if ((*(int *)(this + 0x230) < local_24) && (-1 < *(int *)(this + 0x234))) {
*(int *)(this + 0x230) = local_24;
if (*(void **)(this + 0x22c) == (void *)0x0) {
pvVar17 = malloc(local_24 * 4);
*(void **)(this + 0x22c) = pvVar17;
}
else {
pvVar17 = realloc(*(void **)(this + 0x22c),local_24 << 2);
*(void **)(this + 0x22c) = pvVar17;
iVar14 = local_24;
}
*(void **)(this + 0x23c) = pvVar17;
if (iVar14 <= *(int *)(this + 0x244)) goto LAB_008eea8c;
LAB_008ee6dd:
if (*(int *)(this + 0x248) < 0) goto LAB_008eea8c;
*(int *)(this + 0x244) = iVar14;
if (*(void **)(this + 0x240) == (void *)0x0) {
pvVar17 = malloc(iVar14 * 4);
*(void **)(this + 0x240) = pvVar17;
}
else {
pvVar17 = realloc(*(void **)(this + 0x240),iVar14 << 2);
*(void **)(this + 0x240) = pvVar17;
iVar14 = local_24;
}
}
else {
*(undefined4 *)(this + 0x23c) = *(undefined4 *)(this + 0x22c);
if (*(int *)(this + 0x244) < local_24) goto LAB_008ee6dd;
LAB_008eea8c:
pvVar17 = *(void **)(this + 0x240);
}
*(void **)(this + 0x250) = pvVar17;
if (0 < iVar14) {
iVar14 = 0;
iVar21 = 0;
do {
local_4c = (CBaseEntity *)local_30[iVar14 * 2];
local_48 = (Infected *)local_30[iVar14 * 2 + 1];
CUtlVector<Infected*,CUtlMemory<Infected*,int>>::InsertBefore
((CUtlVector<Infected*,CUtlMemory<Infected*,int>> *)(this + 0x22c),
*(int *)(this + 0x238),(Infected **)&local_4c);
CUtlVector<float,CUtlMemory<float,int>>::InsertBefore
((CUtlVector<float,CUtlMemory<float,int>> *)(this + 0x240),
*(int *)(this + 0x24c),(float *)&local_48);
iVar18 = (**(code **)(*(int *)local_4c + 0x544))(local_4c);
if (iVar18 == 0) {
piVar16 = (int *)(**(code **)(*(int *)local_4c + 0x594))(local_4c);
cVar13 = (**(code **)(*piVar16 + 0x114))(piVar16,2);
if (cVar13 == '\0') {
*(int *)(this + 0x2b8) = *(int *)(this + 0x2b8) + 1;
if ((float)local_48 < fVar1) {
CUtlVector<Infected*,CUtlMemory<Infected*,int>>::InsertBefore
((CUtlVector<Infected*,CUtlMemory<Infected*,int>> *)(this + 0x2c0),
*(int *)(this + 0x2cc),(Infected **)&local_4c);
pCVar5 = local_4c;
*(int *)(this + 700) = *(int *)(this + 700) + 1;
if (((0 < *(int *)(MixDynamicDebugCI._28_4_ + 0x30)) &&
(*(int *)(*(int *)(this + 0x378) + 0x30) != 0)) &&
(*(int *)(*(int *)(this + 0x378) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 == 1))
{
if (((byte)local_4c[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(local_4c);
}
NDebugOverlay::Cross3D((Vector *)(pCVar5 + 0x2e0),24.0,0,0xff,0,true,0.02);
}
}
}
else {
*(int *)(this + 0x284) = *(int *)(this + 0x284) + 1;
if ((float)local_48 < fVar1) {
CUtlVector<Infected*,CUtlMemory<Infected*,int>>::InsertBefore
((CUtlVector<Infected*,CUtlMemory<Infected*,int>> *)(this + 0x28c),
*(int *)(this + 0x298),(Infected **)&local_4c);
pCVar5 = local_4c;
*(int *)(this + 0x288) = *(int *)(this + 0x288) + 1;
if (((0 < *(int *)(MixDynamicDebugCI._28_4_ + 0x30)) &&
(*(int *)(*(int *)(this + 0x378) + 0x30) != 0)) &&
(*(int *)(*(int *)(this + 0x378) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 == 1))
{
if (((byte)local_4c[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(local_4c);
}
NDebugOverlay::Cross3D((Vector *)(pCVar5 + 0x2e0),24.0,0xff,0,0xff,true,0.02);
}
if ((float)local_48 <= fVar2) {
*(int *)(this + 0x2d8) = *(int *)(this + 0x2d8) + 1;
if (fVar2 == 0.0) {
fVar10 = 0.0;
if ((float)local_48 < 0.0) {
fVar10 = fVar23;
}
}
else {
fVar10 = (1.0 - (1.0 / fVar2) * (float)local_48) * fVar23;
}
*(float *)(this + 0x2d4) = *(float *)(this + 0x2d4) + fVar10;
}
if ((float)local_48 <= fVar3) {
*(int *)(this + 0x2e0) = *(int *)(this + 0x2e0) + 1;
if (fVar3 == 0.0) {
fVar10 = 0.0;
if ((float)local_48 < 0.0) {
fVar10 = fVar23;
}
}
else {
fVar10 = (1.0 - (1.0 / fVar3) * (float)local_48) * fVar23;
}
*(float *)(this + 0x2dc) = *(float *)(this + 0x2dc) + fVar10;
}
if ((float)local_48 <= fVar4) {
*(int *)(this + 0x2e8) = *(int *)(this + 0x2e8) + 1;
if (fVar4 == 0.0) {
fVar10 = fVar23;
if (0.0 <= (float)local_48) {
fVar10 = 0.0;
}
}
else {
fVar10 = (1.0 - (float)local_48 * (1.0 / fVar4)) * fVar23;
}
*(float *)(this + 0x2e4) = *(float *)(this + 0x2e4) + fVar10;
}
piVar16 = (int *)(**(code **)(*(int *)local_4c + 0x59c))(local_4c);
iVar18 = (**(code **)(*piVar16 + 0xb4))(piVar16);
if (iVar18 != 0) {
*(int *)(this + 0x2f0) = *(int *)(this + 0x2f0) + 1;
*(float *)(this + 0x2ec) = *(float *)(this + 0x2ec) + 0.033333335;
}
if (iVar21 < *(int *)(MixDynamicMaxCIEmitters._28_4_ + 0x30)) {
CRecipientFilter::AddRecipient
((CRecipientFilter *)(local_4c + 0x1c7c),*(CBasePlayer **)(this + 0x378)
);
pCVar5 = local_4c;
iVar21 = iVar21 + 1;
if (((0 < *(int *)(MixDynamicDebugCI._28_4_ + 0x30)) &&
(*(int *)(*(int *)(this + 0x378) + 0x30) != 0)) &&
(*(int *)(*(int *)(this + 0x378) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 == 1
)) {
if (((byte)local_4c[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(local_4c);
}
NDebugOverlay::Cross3D((Vector *)(pCVar5 + 0x2e0),48.0,0,0,0xff,true,0.02);
}
}
else {
CRecipientFilter::RemoveRecipient
((CRecipientFilter *)(local_4c + 0x1c7c),*(CBasePlayer **)(this + 0x378)
);
}
}
}
}
iVar14 = iVar14 + 1;
} while (iVar14 < local_24);
goto LAB_008ee48d;
}
}
}
iVar21 = 0;
LAB_008ee48d:
iVar14 = 0;
if (0 < *(int *)(this + 0x2cc)) {
do {
while( true ) {
this_00 = (CRecipientFilter *)(*(int *)(*(int *)(this + 0x2c0) + iVar14 * 4) + 0x1c7c);
if (iVar21 <= *(int *)(MixDynamicMaxCIEmitters._28_4_ + 0x30)) break;
CRecipientFilter::RemoveRecipient(this_00,*(CBasePlayer **)(this + 0x378));
iVar14 = iVar14 + 1;
if (*(int *)(this + 0x2cc) <= iVar14) goto LAB_008ee4e9;
}
CRecipientFilter::AddRecipient(this_00,*(CBasePlayer **)(this + 0x378));
iVar14 = iVar14 + 1;
iVar21 = iVar21 + 1;
} while (iVar14 < *(int *)(this + 0x2cc));
}
LAB_008ee4e9:
if ((-1 < *(int *)(MixDynamicNumAttackVoxCI._28_4_ + 0x30)) && (0 < *(int *)(this + 0x298))) {
iVar14 = 0;
do {
Infected::Vocalize(*(Infected **)(*(int *)(this + 0x28c) + iVar14 * 4),"Zombie.RageAtVictim",
false);
iVar14 = iVar14 + 1;
if (*(int *)(MixDynamicNumAttackVoxCI._28_4_ + 0x30) < iVar14) break;
} while (iVar14 < *(int *)(this + 0x298));
}
local_24 = 0;
*(float *)(this + 0x280) = (float)*(int *)(this + 0x288) * fVar23;
*(float *)(this + 0x2b4) = (float)*(int *)(this + 700) * fVar23;
CUtlMemory<CIEntry,int>::Purge((CUtlMemory<CIEntry,int> *)&local_30);
local_20 = local_30;
CUtlMemory<CIEntry,int>::Purge((CUtlMemory<CIEntry,int> *)&local_30);
local_38 = 0;
CUtlMemory<Infected*,int>::Purge(local_60);
local_34 = local_44;
CUtlMemory<Infected*,int>::Purge(local_60);
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.