L L4D2node

CHLTVDirector::SetCameraMan

0x006dc3a0 · 583 bytes · __thiscall

_ZN13CHLTVDirector12SetCameraManEi

Decompiled

undefined (2 params)

/* CHLTVDirector::SetCameraMan(int) */

undefined4 __thiscall CHLTVDirector::SetCameraMan(CHLTVDirector *this,int param_1)

{
  char cVar1;
  int *piVar2;
  CBaseEntity *this_00;
  int iVar3;
  undefined4 uVar4;
  int iVar5;
  int in_GS_OFFSET;
  CBaseEntity *local_110;
  CRecipientFilter local_108 [32];
  char local_e8 [200];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)(tv_allow_camera_man._28_4_ + 0x30) == 0) goto LAB_006dc591;
  if (*(int *)(this + 0x1cc) == param_1) {
    uVar4 = 1;
    goto LAB_006dc593;
  }
  if (*(int *)(this + 0x1cc) == 0) {
    if (param_1 < 1) goto LAB_006dc3ec;
    local_110 = (CBaseEntity *)UTIL_PlayerByIndex(param_1);
    if (local_110 == (CBaseEntity *)0x0) {
LAB_006dc591:
      uVar4 = 0;
      goto LAB_006dc593;
    }
    iVar5 = CBaseEntity::GetTeamNumber(local_110);
    if (iVar5 != 1) goto LAB_006dc591;
  }
  else {
    if (param_1 != 0) goto LAB_006dc591;
LAB_006dc3ec:
    local_110 = (CBaseEntity *)0x0;
  }
  *(int *)(this + 0x1cc) = param_1;
  piVar2 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"hltv_cameraman",0,0);
  if (piVar2 != (int *)0x0) {
    (**(code **)(*piVar2 + 0x30))(piVar2,"index",param_1);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar2,0);
  }
  CRecipientFilter::CRecipientFilter(local_108);
  if (0 < *(int *)(gpGlobals + 0x14)) {
    iVar5 = 1;
LAB_006dc48d:
    do {
                    /* try { // try from 006dc490 to 006dc549 has its CatchHandler @ 006dc5f3 */
      this_00 = (CBaseEntity *)UTIL_PlayerByIndex(iVar5);
      if (this_00 != (CBaseEntity *)0x0) {
        iVar3 = CBaseEntity::GetTeamNumber(this_00);
        if (iVar3 == 1) {
          cVar1 = (**(code **)(*(int *)this_00 + 0x5a8))(this_00);
          if (cVar1 == '\0') {
            CRecipientFilter::AddRecipient(local_108,(CBasePlayer *)this_00);
            iVar5 = iVar5 + 1;
            if (*(int *)(gpGlobals + 0x14) < iVar5) break;
            goto LAB_006dc48d;
          }
        }
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 <= *(int *)(gpGlobals + 0x14));
  }
  CRecipientFilter::MakeReliable(local_108);
  if (param_1 < 1) {
                    /* try { // try from 006dc5e4 to 006dc5e8 has its CatchHandler @ 006dc5f3 */
    UTIL_ClientPrintFilter
              ((IRecipientFilter *)local_108,3,"SourceTV camera switched to auto-director mode.",
               (char *)0x0,(char *)0x0,(char *)0x0,(char *)0x0);
  }
  else {
    uVar4 = (**(code **)(*(int *)local_110 + 0xb8))(local_110);
    V_snprintf(local_e8,200,"SourceTV camera is now controlled by %s.",uVar4);
    UTIL_ClientPrintFilter
              ((IRecipientFilter *)local_108,3,local_e8,(char *)0x0,(char *)0x0,(char *)0x0,
               (char *)0x0);
  }
  CRecipientFilter::~CRecipientFilter(local_108);
  uVar4 = 1;
LAB_006dc593:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar4;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)