Music::Update
0x008f2bd0 · 1973 bytes · __thiscall
_ZN5Music6UpdateEv
Decompiled
undefined (1 param)
/* Music::Update() */
void __thiscall Music::Update(Music *this)
{
Music *pMVar1;
Music *pMVar2;
undefined4 uVar3;
char cVar4;
int iVar5;
int in_GS_OFFSET;
longdouble lVar6;
float fVar7;
char local_a0 [128];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (*(int *)(MusicManagerOn._28_4_ + 0x30) == 0) goto LAB_008f2bf6;
pMVar1 = this + 0x1bc;
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 < *(float *)(this + 0x1c4)) goto LAB_008f2bf6;
fVar7 = *(float *)(MusicDynamicUpdateInterval._28_4_ + 0x2c);
lVar6 = (longdouble)CountdownTimer::Now();
pMVar2 = this + 0x1c4;
if ((float)lVar6 + fVar7 != *(float *)(this + 0x1c4)) {
(**(code **)(*(int *)(this + 0x1bc) + 4))(pMVar1,pMVar2);
*(float *)(this + 0x1c4) = (float)lVar6 + fVar7;
}
if (fVar7 != *(float *)(this + 0x1c0)) {
(**(code **)(*(int *)(this + 0x1bc) + 4))(pMVar1,this + 0x1c0);
*(float *)(this + 0x1c0) = fVar7;
}
if (*(int *)(TheDirector + 0x1c0) < 1) {
if (this[0x2f4] != (Music)0x0) {
this[0x2f4] = (Music)0x0;
(**(code **)(*(int *)this + 0x48))(this,8);
}
}
else {
this[0x2f4] = (Music)0x1;
if (this[0x1b0] == (Music)0x0) {
(**(code **)(*(int *)this + 0x44))(this);
}
}
iVar5 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(this + 0x378));
if (iVar5 != 2) {
cVar4 = CTerrorGameRules::HasPlayerControlledZombies();
if (cVar4 == '\0') goto LAB_008f2bf6;
}
CollectZombieData(this);
if (this[0x1e0] != (Music)0x0) {
this[0x1e0] = (Music)0x0;
cVar4 = CTerrorGameRules::HasPlayerControlledZombies();
iVar5 = *(int *)(*(int *)(this + 0x378) + 0x30);
if (cVar4 == '\0') {
fVar7 = 0.0;
if (iVar5 != 0) {
fVar7 = *(float *)(MusicDynamicUpdateInterval._28_4_ + 0x2c) * 0.25 *
(float)(iVar5 - *(int *)(gpGlobals + 0x58) >> 4);
}
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 + fVar7 != *(float *)(this + 0x1c4)) {
(**(code **)(*(int *)(this + 0x1bc) + 4))(pMVar1,pMVar2);
*(float *)(this + 0x1c4) = (float)lVar6 + fVar7;
}
}
else {
fVar7 = 0.0;
if (iVar5 != 0) {
fVar7 = *(float *)(MusicDynamicUpdateInterval._28_4_ + 0x2c) * 0.125 *
(float)(iVar5 - *(int *)(gpGlobals + 0x58) >> 4);
}
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 + fVar7 != *(float *)(this + 0x1c4)) {
(**(code **)(*(int *)(this + 0x1bc) + 4))(pMVar1,pMVar2);
*(float *)(this + 0x1c4) = (float)lVar6 + fVar7;
}
}
if (fVar7 != *(float *)(this + 0x1c0)) {
(**(code **)(*(int *)(this + 0x1bc) + 4))(pMVar1,this + 0x1c0);
*(float *)(this + 0x1c0) = fVar7;
}
}
UpdateMeters(this);
if (*(char *)(*(int *)(this + 0x378) + 0x39e4) == '\0') goto LAB_008f2bf6;
if ((*(float *)(this + 0xac) == 0.0) || (*(int *)(TheDirector + 0x194) == 3)) {
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 < *(float *)(this + 0x208)) goto LAB_008f2d58;
this[0x20c] = (Music)0x1;
}
else {
LAB_008f2d58:
this[0x20c] = (Music)0x0;
}
if (*(float *)(this + 0x1b4) <= 0.0) {
LAB_008f2d94:
this[0x1fc] = (Music)0x0;
}
else {
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 < *(float *)(this + 0x1f8)) goto LAB_008f2d94;
cVar4 = CTerrorGameRules::IsSurvivalMode();
if (cVar4 != '\0') goto LAB_008f2d94;
cVar4 = CTerrorGameRules::IsScavengeMode();
if (cVar4 != '\0') goto LAB_008f2d94;
this[0x1fc] = (Music)0x1;
}
if ((this[0x1b8] != (Music)0x0) && (*(float *)(this + 0x1b4) == 0.0)) {
this[0x1b8] = (Music)0x0;
(**(code **)(*(int *)this + 0x18))(this,"Event.DangerAtmosphere",local_a0);
StopPlaying(this,local_a0,0.0,false);
}
if (this[0x20c] == (Music)0x0) {
if (this[0x1fc] != (Music)0x0) {
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 < *(float *)(this + 0x1ec)) goto LAB_008f2bf6;
(**(code **)(*(int *)this + 0x18))(this,"Event.DangerAtmosphere",local_a0);
Play(this,local_a0,0,-1.0,false,false);
uVar3 = MusicCalmMinInterval._28_4_;
this[0x1b8] = (Music)0x1;
fVar7 = *(float *)(uVar3 + 0x2c);
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 + fVar7 != *(float *)(this + 0x1f8)) {
(**(code **)(*(int *)(this + 0x1f0) + 4))(this + 0x1f0,this + 0x1f8);
*(float *)(this + 0x1f8) = (float)lVar6 + fVar7;
}
if (fVar7 != *(float *)(this + 500)) {
(**(code **)(*(int *)(this + 0x1f0) + 4))(this + 0x1f0,this + 500);
*(float *)(this + 500) = fVar7;
}
this[0x1fc] = (Music)0x0;
}
}
else {
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 < *(float *)(this + 0x1ec)) goto LAB_008f2bf6;
(**(code **)(*(int *)this + 0x18))(this,"Event.SafeAtmosphere",local_a0);
Play(this,local_a0,0,-1.0,false,false);
fVar7 = *(float *)(MusicCalmMinInterval._28_4_ + 0x2c) + 10.0;
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 + fVar7 != *(float *)(this + 0x208)) {
(**(code **)(*(int *)(this + 0x200) + 4))(this + 0x200,this + 0x208);
*(float *)(this + 0x208) = (float)lVar6 + fVar7;
}
if (fVar7 != *(float *)(this + 0x204)) {
(**(code **)(*(int *)(this + 0x200) + 4))(this + 0x200,this + 0x204);
*(float *)(this + 0x204) = fVar7;
}
this[0x20c] = (Music)0x0;
}
lVar6 = (longdouble)CountdownTimer::Now();
if ((float)lVar6 + 3.0 != *(float *)(this + 0x1ec)) {
(**(code **)(*(int *)(this + 0x1e4) + 4))(this + 0x1e4,this + 0x1ec);
*(float *)(this + 0x1ec) = (float)lVar6 + 3.0;
}
if (*(float *)(this + 0x1e8) != 3.0) {
(**(code **)(*(int *)(this + 0x1e4) + 4))(this + 0x1e4,this + 0x1e8);
*(undefined4 *)(this + 0x1e8) = 0x40400000;
}
LAB_008f2bf6:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.