CAmbientGeneric::RampThink
0x005dbf90 · 1387 bytes · __thiscall
_ZN15CAmbientGeneric9RampThinkEv
Decompiled
undefined (1 param)
/* CAmbientGeneric::RampThink() */
void __thiscall CAmbientGeneric::RampThink(CAmbientGeneric *this)
{
uint uVar1;
CBaseEntity *this_00;
int iVar2;
undefined4 uVar3;
int iVar4;
int iVar5;
uint uVar6;
int iVar7;
int iVar8;
undefined *puVar9;
int iVar10;
int iVar11;
undefined1 *puVar12;
bool bVar13;
uint local_24;
iVar2 = *(int *)(this + 0x458);
iVar10 = *(int *)(this + 0x488);
iVar11 = *(int *)(this + 0x498);
if (iVar2 == 0) {
iVar2 = *(int *)(this + 0x45c);
if (iVar2 != 0) {
iVar8 = *(int *)(this + 0x494);
iVar4 = iVar8 >> 8;
LAB_005dbfcf:
iVar10 = iVar4;
if (0 < iVar2) {
*(int *)(this + 0x494) = iVar8 - iVar2;
iVar10 = iVar8 - iVar2 >> 8;
}
goto LAB_005dbfe8;
}
iVar2 = *(int *)(this + 0x468);
if (iVar2 == 0) {
if ((*(int *)(this + 0x46c) == 0) && (*(int *)(this + 0x470) == 0)) {
return;
}
bVar13 = false;
local_24 = 0;
goto LAB_005dc270;
}
bVar13 = false;
local_24 = 0;
LAB_005dc045:
iVar8 = *(int *)(this + 0x4a4);
iVar4 = iVar8 >> 8;
if (iVar2 < 1) {
iVar2 = *(int *)(this + 0x46c);
LAB_005dc289:
iVar11 = iVar4;
if (0 < iVar2) {
*(int *)(this + 0x4a4) = iVar8 - iVar2;
iVar11 = iVar8 - iVar2 >> 8;
}
}
else {
*(int *)(this + 0x4a4) = iVar8 + iVar2;
iVar11 = iVar8 + iVar2 >> 8;
}
iVar2 = *(int *)(this + 0x460);
if (iVar2 < iVar11) {
*(undefined4 *)(this + 0x468) = 0;
*(int *)(this + 0x4a4) = iVar2 << 8;
iVar11 = iVar2;
}
iVar2 = *(int *)(this + 0x464);
if (iVar11 < iVar2) {
*(int *)(this + 0x498) = iVar2;
*(int *)(this + 0x4a4) = iVar2 << 8;
*(undefined4 *)(this + 0x46c) = 0;
(**(code **)(*(int *)this + 0x328))(this,4);
return;
}
if (iVar11 < 0x65) {
if (iVar11 < 1) {
*(undefined4 *)(this + 0x4a4) = 0x100;
iVar11 = 1;
}
}
else {
*(undefined4 *)(this + 0x4a4) = 0x6400;
iVar11 = 100;
}
*(int *)(this + 0x498) = iVar11;
bVar13 = (bool)(bVar13 | iVar4 != iVar11);
local_24 = local_24 | 1;
}
else {
iVar8 = *(int *)(this + 0x494);
iVar4 = iVar8 >> 8;
if (iVar2 < 1) {
iVar2 = *(int *)(this + 0x45c);
goto LAB_005dbfcf;
}
*(int *)(this + 0x494) = iVar2 + iVar8;
iVar10 = iVar2 + iVar8 >> 8;
LAB_005dbfe8:
if (*(int *)(this + 0x450) < iVar10) {
*(undefined4 *)(this + 0x458) = 0;
iVar10 = *(int *)(this + 0x450);
}
if (iVar10 < *(int *)(this + 0x454)) {
*(undefined4 *)(this + 0x45c) = 0;
(**(code **)(*(int *)this + 0x328))(this,4);
return;
}
if (iVar10 < 0x100) {
if (iVar10 < 1) {
iVar10 = 1;
}
}
else {
iVar10 = 0xff;
}
bVar13 = iVar4 != iVar10;
*(int *)(this + 0x488) = iVar10;
local_24 = 2;
iVar2 = *(int *)(this + 0x468);
if (iVar2 != 0) goto LAB_005dc045;
LAB_005dc270:
iVar2 = *(int *)(this + 0x46c);
if (iVar2 != 0) {
iVar8 = *(int *)(this + 0x4a4);
iVar4 = iVar8 >> 8;
goto LAB_005dc289;
}
}
iVar2 = *(int *)(this + 0x470);
iVar8 = iVar10;
iVar4 = iVar11;
if (iVar2 == 0) goto LAB_005dc1c0;
iVar5 = *(int *)(this + 0x4a8);
if (0x6fffffff < iVar5) {
*(undefined4 *)(this + 0x4a8) = 0;
iVar5 = 0;
}
uVar1 = *(uint *)(this + 0x474);
iVar5 = iVar5 + uVar1;
uVar6 = (int)uVar1 >> 0x1f;
if (iVar5 < 0) {
*(undefined4 *)(this + 0x4a8) = 0;
*(uint *)(this + 0x474) = uVar1 ^ uVar6;
*(uint *)(this + 0x474) = *(int *)(this + 0x474) - uVar6;
iVar7 = 0;
LAB_005dc107:
if (iVar2 != 1) goto LAB_005dc110;
LAB_005dc342:
uVar3 = 0xff;
if (0x7f < iVar7) {
uVar3 = 0;
}
*(undefined4 *)(this + 0x4ac) = uVar3;
}
else {
iVar7 = iVar5 >> 8;
if (iVar7 < 0x100) {
*(int *)(this + 0x4a8) = iVar5;
goto LAB_005dc107;
}
*(undefined4 *)(this + 0x4a8) = 0xff00;
*(uint *)(this + 0x474) = uVar6 - (uVar1 ^ uVar6);
iVar7 = 0xff;
if (iVar2 == 1) goto LAB_005dc342;
LAB_005dc110:
if (iVar2 == 3) {
if (iVar7 == 0xff) {
uVar3 = (**(code **)(*random_valve + 8))(random_valve,0,0xff);
*(undefined4 *)(this + 0x4ac) = uVar3;
}
}
else {
*(int *)(this + 0x4ac) = iVar7;
}
}
if (*(int *)(this + 0x478) != 0) {
iVar8 = ((*(int *)(this + 0x4ac) + -0x80) * *(int *)(this + 0x478)) / 100 + iVar10;
if (iVar8 < 0x100) {
if (iVar8 < 1) {
iVar8 = 1;
}
}
else {
iVar8 = 0xff;
}
bVar13 = (bool)(bVar13 | iVar10 != iVar8);
local_24 = local_24 | 2;
}
if (*(int *)(this + 0x47c) != 0) {
iVar4 = ((*(int *)(this + 0x4ac) + -0x80) * *(int *)(this + 0x47c)) / 100 + iVar11;
if (iVar4 < 0x65) {
if (iVar4 < 0) {
iVar4 = 0;
}
}
else {
iVar4 = 100;
}
bVar13 = (bool)(bVar13 | iVar11 != iVar4);
local_24 = local_24 | 1;
}
LAB_005dc1c0:
if ((bVar13) && (local_24 != 0)) {
if (iVar8 == 100) {
iVar8 = 0x65;
}
uVar1 = *(uint *)(this + 0x4bc);
if ((((uVar1 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) &&
(this_00 = *(CBaseEntity **)(puVar9 + 4), this_00 != (CBaseEntity *)0x0)) {
uVar3 = *(undefined4 *)(this + 0x448);
puVar12 = &DAT_00d539c2;
if (*(undefined1 **)(this + 0x4b4) != (undefined1 *)0x0) {
puVar12 = *(undefined1 **)(this + 0x4b4);
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
if (*(int *)(this_00 + 0x30) == 0) {
iVar2 = 0;
}
else {
iVar2 = *(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
UTIL_EmitAmbientSound
(iVar2,this_00 + 0x2e0,puVar12,(float)iVar4 * 0.01,uVar3,local_24,iVar8,0,0);
}
}
CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.2,(char *)0x0);
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.