L L4D2node

Music::Play

0x008eed00 · 1436 bytes · __thiscall

_ZN5Music4PlayEPKcifbb

Decompiled

undefined (6 params)

/* Music::Play(char const*, int, float, bool, bool) */

void __thiscall
Music::Play(Music *this,char *param_1,int param_2,float param_3,bool param_4,bool param_5)

{
  char cVar1;
  int iVar2;
  CBasePlayer *this_00;
  int *piVar3;
  int iVar4;
  int *piVar5;
  uint uVar6;
  char *pcVar7;
  byte bVar8;
  uint uVar9;
  int in_GS_OFFSET;
  bool bVar10;
  uint local_100;
  CBaseEntity *local_f8;
  CRecipientFilter local_e8 [32];
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc;
  undefined4 local_b8;
  undefined4 local_b4;
  undefined1 local_b0;
  undefined4 local_ac;
  undefined1 local_a8;
  undefined4 local_28;
  KeyValues *local_24;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)(MusicManagerOn._28_4_ + 0x30) != 0) {
    if (*(CBaseEntity **)(this + 0x378) == (CBaseEntity *)0x0) {
      MusicMsg("!m_me\n");
    }
    else {
      iVar2 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(this + 0x378));
      if ((iVar2 != 4) && (param_1 != (char *)0x0)) {
        if (param_2 < 0) {
          MusicMsg("Invalid emit entity index: %i\n",param_2);
        }
        else {
          if (*(int *)(*(int *)(this + 0x378) + 0x30) == 0) {
            local_100 = 0;
          }
          else {
            local_100 = *(int *)(*(int *)(this + 0x378) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
            if ((int)local_100 < 0) {
              MusicMsg("Invalid play entity index: %i\n",local_100);
              goto LAB_008eef40;
            }
          }
          iVar2 = V_stristr(param_1,"Checkpoint");
          if (iVar2 == 0) {
            local_c8 = 0;
            local_c4 = 0x3f800000;
            local_c0 = 100;
            local_bc = 100;
            local_b8 = 100;
            local_b4 = 0x4b;
            local_a8 = 0;
            local_b0 = 0;
            local_ac = 0;
            local_28 = 0;
            local_24 = (KeyValues *)0x0;
            cVar1 = CBaseEntity::GetParametersForSound
                              (param_1,(CSoundParameters *)&local_c8,(char *)0x0);
            if (cVar1 == '\0') {
              MusicMsg("PlayCommand: Unable to find sound %s\n",param_1);
              goto LAB_008eef40;
            }
            if (local_24 != (KeyValues *)0x0) {
              bVar8 = 0;
              bVar10 = false;
              pcVar7 = (char *)KeyValues::GetString(local_24,"MusicParameters","");
              if ((pcVar7 != (char *)0x0) && (*pcVar7 != '\0')) {
                iVar2 = V_stristr(pcVar7,"AFTER_DEATH");
                iVar4 = V_stristr(pcVar7,"AFTER_MISSION_END");
                bVar8 = ~-(iVar2 == 0) & 8;
                bVar10 = iVar4 != 0;
              }
              cVar1 = (**(code **)(**(int **)(this + 0x378) + 300))(*(int **)(this + 0x378));
              if (((cVar1 == '\0') && (bVar8 == 0)) ||
                 ((0.0 < *(float *)(TheDirector + 0x270) && (!bVar10)))) goto LAB_008eef40;
            }
          }
          CRecipientFilter::CRecipientFilter(local_e8);
          if (0 < *(int *)(gpGlobals + 0x14)) {
            iVar2 = 1;
            do {
                    /* try { // try from 008eee08 to 008eef2f has its CatchHandler @ 008ef2b2 */
              while (((this_00 = (CBasePlayer *)UTIL_PlayerByIndex(iVar2),
                      this_00 == (CBasePlayer *)0x0 ||
                      (cVar1 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar1 == '\0')) ||
                     (cVar1 = CBasePlayer::IsSplitScreenPlayer(this_00), cVar1 != '\0'))) {
                iVar2 = iVar2 + 1;
                if (*(int *)(gpGlobals + 0x14) < iVar2) goto LAB_008eee50;
              }
              CRecipientFilter::AddRecipient(local_e8,this_00);
              iVar2 = iVar2 + 1;
            } while (iVar2 <= *(int *)(gpGlobals + 0x14));
          }
LAB_008eee50:
          CRecipientFilter::MakeReliable(local_e8);
          local_f8 = (CBaseEntity *)0x0;
          if (param_5) {
            local_f8 = (CBaseEntity *)UTIL_EntityByIndex(param_2);
          }
          if (param_4) {
                    /* try { // try from 008eef77 to 008ef0da has its CatchHandler @ 008ef2b2 */
            piVar3 = (int *)GetGlobalTeam(2);
            for (iVar2 = 0; iVar4 = (**(code **)(*piVar3 + 0x354))(piVar3), iVar2 < iVar4;
                iVar2 = iVar2 + 1) {
              piVar5 = (int *)(**(code **)(*piVar3 + 0x358))(piVar3,iVar2);
              cVar1 = (**(code **)(*piVar5 + 300))(piVar5);
              if (cVar1 != '\0') {
                iVar4 = (**(code **)(*piVar3 + 0x358))(piVar3,iVar2);
                if (*(int *)(iVar4 + 0x30) == 0) {
                  uVar9 = 0;
                }
                else {
                  uVar9 = *(int *)(iVar4 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
                }
                if (*(int *)(*(int *)(this + 0x378) + 0x30) == 0) {
                  uVar6 = 0;
                }
                else {
                  uVar6 = *(int *)(*(int *)(this + 0x378) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
                }
                if (uVar9 != uVar6) {
                  UserMessageBegin((IRecipientFilter *)local_e8,"MusicCmd");
                  MessageWriteUBitLong((uint)(local_f8 != (CBaseEntity *)0x0),3);
                  MessageWriteUBitLong(uVar9,*(int *)(this + 0x37c));
                  WriteSong(param_1);
                  MessageWriteFloat(param_3);
                  MessageWriteUBitLong(param_2 + 1,0xb);
                  if (local_f8 != (CBaseEntity *)0x0) {
                    if (((byte)local_f8[0x14d] & 8) != 0) {
                      CBaseEntity::CalcAbsolutePosition(local_f8);
                    }
                    MessageWriteBitVecIntegral((Vector *)(local_f8 + 0x2e0));
                  }
                  MessageEnd();
                }
              }
            }
          }
          else {
            UserMessageBegin((IRecipientFilter *)local_e8,"MusicCmd");
            MessageWriteUBitLong((uint)(local_f8 != (CBaseEntity *)0x0),3);
            MessageWriteUBitLong(local_100,*(int *)(this + 0x37c));
            WriteSong(param_1);
            MessageWriteFloat(param_3);
            MessageWriteUBitLong(param_2 + 1,0xb);
            if (local_f8 != (CBaseEntity *)0x0) {
              if (((byte)local_f8[0x14d] & 8) != 0) {
                    /* try { // try from 008ef115 to 008ef138 has its CatchHandler @ 008ef2b2 */
                CBaseEntity::CalcAbsolutePosition(local_f8);
              }
              MessageWriteBitVecIntegral((Vector *)(local_f8 + 0x2e0));
            }
            MessageEnd();
          }
          CRecipientFilter::~CRecipientFilter(local_e8);
        }
      }
    }
  }
LAB_008eef40:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)