L L4D2node

CHLTVDirector::StartBestPlayerCameraShot

0x006db2d0 · 548 bytes · __thiscall

_ZN13CHLTVDirector25StartBestPlayerCameraShotEv

Decompiled

undefined (1 param)

/* CHLTVDirector::StartBestPlayerCameraShot() */

void __thiscall CHLTVDirector::StartBestPlayerCameraShot(CHLTVDirector *this)

{
  code *pcVar1;
  ushort uVar2;
  uint uVar3;
  char *pcVar4;
  int iVar5;
  undefined4 uVar6;
  int iVar7;
  float *pfVar8;
  longdouble lVar9;
  float fVar10;
  undefined4 local_ac;
  float local_a8;
  int local_a4;
  float local_9c [35];
  
  pfVar8 = local_9c;
  for (iVar7 = 0x20; iVar7 != 0; iVar7 = iVar7 + -1) {
    *pfVar8 = 0.0;
    pfVar8 = pfVar8 + 1;
  }
  uVar3 = FindFirstEvent(this,*(int *)(this + 0x1c));
  if (uVar3 != 0xffff) {
    uVar3 = uVar3 & 0xffff;
    iVar7 = *(int *)(this + 0x1d4) + uVar3 * 0x14;
    if (*(int *)(iVar7 + 8) < *(int *)(this + 0x38)) {
      local_ac = 0xffffffff;
      local_a4 = -1;
      local_a8 = -1.0;
      do {
        pcVar4 = (char *)(**(code **)(**(int **)(iVar7 + 0x10) + 8))(*(int **)(iVar7 + 0x10));
        iVar5 = _V_strcmp(pcVar4,"hltv_rank_entity");
        if (iVar5 == 0) {
          iVar5 = (**(code **)(**(int **)(iVar7 + 0x10) + 0x1c))(*(int **)(iVar7 + 0x10),"index",0);
          if (iVar5 < 0x20) {
            lVar9 = (longdouble)
                    (**(code **)(**(int **)(iVar7 + 0x10) + 0x24))
                              (*(int **)(iVar7 + 0x10),&DAT_00c9394f,0);
            fVar10 = (float)lVar9 + local_9c[iVar5];
            local_9c[iVar5] = fVar10;
            if (local_a8 < fVar10) {
              local_ac = (**(code **)(**(int **)(iVar7 + 0x10) + 0x1c))
                                   (*(int **)(iVar7 + 0x10),"target",0);
              local_a8 = fVar10;
              local_a4 = iVar5;
            }
          }
        }
        uVar2 = CUtlRBTree<CGameEvent,unsigned_short,bool(*)(CGameEvent_const&,CGameEvent_const&),CUtlMemory<UtlRBTreeNode_t<CGameEvent,unsigned_short>,unsigned_short>>
                ::NextInorder((CUtlRBTree<CGameEvent,unsigned_short,bool(*)(CGameEvent_const&,CGameEvent_const&),CUtlMemory<UtlRBTreeNode_t<CGameEvent,unsigned_short>,unsigned_short>>
                               *)(this + 0x1d0),(ushort)uVar3);
        if (uVar2 == 0xffff) break;
        uVar3 = (uint)uVar2;
        iVar7 = *(int *)(this + 0x1d4) + uVar3 * 0x14;
      } while (*(int *)(iVar7 + 8) < *(int *)(this + 0x38));
      if (local_a4 != -1) {
        pcVar1 = *(code **)(*(int *)this + 0x60);
        lVar9 = (longdouble)RandomFloat(0,0x3f800000);
        uVar6 = 0xffffffec;
        if (0.5 < (float)lVar9) {
          uVar6 = 0x14;
        }
        (*pcVar1)(this,local_a4,local_ac,0x70,0x14,uVar6,0);
        return;
      }
    }
  }
  (**(code **)(*(int *)this + 0x54))(this,1);
  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)