L L4D2node

CMultiplayRules::VoiceCommand

0x004701a0 · 705 bytes · __thiscall

_ZN15CMultiplayRules12VoiceCommandEP22CBaseMultiplayerPlayerii

Decompiled

undefined (4 params)

/* CMultiplayRules::VoiceCommand(CBaseMultiplayerPlayer*, int, int) */

undefined4 * __thiscall
CMultiplayRules::VoiceCommand
          (CMultiplayRules *this,CBaseMultiplayerPlayer *param_1,int param_2,int param_3)

{
  int *piVar1;
  char cVar2;
  CMultiplayer_Expresser *this_00;
  Vector *pVVar3;
  int iVar4;
  Vector *pVVar5;
  Vector *pVVar6;
  CBaseMultiplayerPlayer *pCVar7;
  float *pfVar8;
  float *pfVar9;
  CTeam *pCVar10;
  int in_GS_OFFSET;
  undefined4 *local_98;
  CRecipientFilter local_80 [32];
  undefined1 local_60 [64];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((((param_1 != (CBaseMultiplayerPlayer *)0x0) && (-1 < param_2)) &&
      (param_2 < *(int *)(this + 0x30))) &&
     ((-1 < param_3 &&
      (piVar1 = (int *)(*(int *)(this + 0x24) + param_2 * 0x14), param_3 < piVar1[3])))) {
    local_98 = (undefined4 *)(*piVar1 + param_3 * 0x48);
    cVar2 = (**(code **)(*(int *)param_1 + 0x7bc))(param_1);
    if (cVar2 != '\0') {
      this_00 = (CMultiplayer_Expresser *)(**(code **)(*(int *)param_1 + 0x7cc))(param_1);
      CMultiplayer_Expresser::AllowMultipleScenes(this_00);
      pVVar3 = (Vector *)*local_98;
      cVar2 = (**(code **)(*(int *)param_1 + 0x7b8))(param_1,pVVar3,0,local_60,0x40,0);
      if (cVar2 == '\0') {
        local_98 = (undefined4 *)0x0;
      }
      else {
        if (*(char *)(local_98 + 1) != '\0') {
          CRecipientFilter::CRecipientFilter(local_80);
          if (*(char *)((int)local_98 + 5) == '\0') {
            CRecipientFilter::AddAllPlayers(local_80);
          }
          else {
                    /* try { // try from 004702a5 to 00470429 has its CatchHandler @ 00470475 */
            pVVar3 = (Vector *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
            CRecipientFilter::AddRecipientsByPAS(local_80,pVVar3);
            iVar4 = CRecipientFilter::GetRecipientCount(local_80);
            pVVar5 = (Vector *)(iVar4 + -1);
            if (-1 < (int)pVVar5) {
              do {
                pVVar3 = pVVar5;
                pVVar6 = (Vector *)CRecipientFilter::GetRecipientIndex(local_80,(int)pVVar5);
                pCVar7 = (CBaseMultiplayerPlayer *)UTIL_PlayerByIndex((int)pVVar6);
                if ((param_1 != pCVar7) && (pCVar7 != (CBaseMultiplayerPlayer *)0x0)) {
                  pfVar8 = (float *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
                  pfVar9 = (float *)(**(code **)(*(int *)pCVar7 + 0x288))(pCVar7);
                  if (1900.0 < SQRT((pfVar9[1] - pfVar8[1]) * (pfVar9[1] - pfVar8[1]) +
                                    (*pfVar9 - *pfVar8) * (*pfVar9 - *pfVar8))) {
                    CRecipientFilter::RemoveRecipientByPlayerIndex((int)local_80);
                    pVVar3 = pVVar6;
                  }
                }
                pVVar5 = pVVar5 + -1;
              } while (pVVar5 != (Vector *)&DAT_ffffffff);
            }
          }
          cVar2 = (**(code **)(*(int *)param_1 + 0x7c0))(param_1,pVVar3);
          if (cVar2 == '\0') {
            pCVar10 = (CTeam *)CBaseEntity::GetTeam((CBaseEntity *)param_1);
            CRecipientFilter::RemoveRecipientsNotOnTeam(local_80,pCVar10);
          }
          UserMessageBegin((IRecipientFilter *)local_80,"VoiceSubtitle");
          if (*(int *)(param_1 + 0x30) == 0) {
            iVar4 = 0;
          }
          else {
            iVar4 = *(int *)(param_1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          MessageWriteByte(iVar4);
          MessageWriteByte(param_2);
          MessageWriteByte(param_3);
          MessageEnd();
          CRecipientFilter::~CRecipientFilter(local_80);
        }
        (**(code **)(*(int *)param_1 + 0x7c4))(param_1,local_60);
      }
      CMultiplayer_Expresser::DisallowMultipleScenes(this_00);
      goto LAB_00470392;
    }
  }
  local_98 = (undefined4 *)0x0;
LAB_00470392:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return local_98;
}

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)