Test_RandomizeInPVS
0x00af4120 · 353 bytes · __cdecl
_Z19Test_RandomizeInPVSRK8CCommand
Decompiled
undefined (1 param)
/* Test_RandomizeInPVS(CCommand const&) */
void Test_RandomizeInPVS(CCommand *param_1)
{
uint uVar1;
CBaseEntity *this;
CBaseEdict *this_00;
long lVar2;
undefined *puVar3;
int iVar4;
uint *puVar5;
char *__nptr;
uint uVar6;
int iVar7;
if ((*(int *)param_1 < 2) &&
(Error("Test_RandomizeInPVS <percentage chance to change>"), *(int *)param_1 < 2)) {
__nptr = "";
}
else {
__nptr = *(char **)(param_1 + 0x40c);
}
iVar7 = 0;
lVar2 = strtol(__nptr,(char **)0x0,10);
if (DAT_0102ca10 < 1) {
return;
}
do {
while ((((uVar1 = *(uint *)(g_StressEntities + iVar7 * 4), uVar1 == 0xffffffff ||
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 == (undefined *)0xfffffffc))
|| (*(uint *)(puVar3 + 8) != uVar1 >> 0xc)) ||
((this = *(CBaseEntity **)(puVar3 + 4), this == (CBaseEntity *)0x0 ||
(iVar4 = RandomInt(0,100), lVar2 <= iVar4))))) {
LAB_00af4170:
iVar7 = iVar7 + 1;
if (DAT_0102ca10 <= iVar7) {
return;
}
}
uVar1 = *(uint *)(this + 0xd4);
if ((uVar1 & 0x20) == 0) {
CBaseEntity::AddEffects(this,0x20);
goto LAB_00af4170;
}
uVar6 = uVar1 & 0xffffffdf;
if (uVar1 == uVar6) {
puVar5 = *(uint **)(this + 0x30);
}
else if (this[0x6c] == (CBaseEntity)0x0) {
this_00 = *(CBaseEdict **)(this + 0x30);
puVar5 = (uint *)0x0;
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar4 + 2) = 0;
puVar5 = *(uint **)(this + 0x30);
}
*(uint *)(this + 0xd4) = uVar6;
}
else {
this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
*(uint *)(this + 0xd4) = uVar6;
puVar5 = *(uint **)(this + 0x30);
}
if (puVar5 != (uint *)0x0) {
*puVar5 = *puVar5 | 0x80;
}
iVar7 = iVar7 + 1;
CBaseEntity::DispatchUpdateTransmitState(this);
if (DAT_0102ca10 <= iVar7) {
return;
}
} while( true );
}
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.