L L4D2node

CTerrorPlayer::UpdateCommonDPSMeter

0x009bad50 · 294 bytes · __thiscall

_ZN13CTerrorPlayer20UpdateCommonDPSMeterEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::UpdateCommonDPSMeter() */

void __thiscall CTerrorPlayer::UpdateCommonDPSMeter(CTerrorPlayer *this)

{
  float *pfVar1;
  float fVar2;
  undefined4 uVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  float fVar7;
  float fVar8;
  
  fVar8 = 0.0;
  fVar2 = *(float *)(common_dps_window._28_4_ + 0x2c);
  if (fVar2 <= 0.0) {
    *(undefined4 *)(this + 0x3aac) = 0;
    return;
  }
  iVar4 = *(int *)(this + 0x3aa4) + -1;
  if (-1 < iVar4) {
    iVar6 = iVar4 * 8;
    do {
      while (fVar7 = *(float *)(gpGlobals + 0xc) - fVar2,
            pfVar1 = (float *)(*(int *)(this + 15000) + iVar6) + 1,
            fVar7 < *pfVar1 || fVar7 == *pfVar1) {
        iVar4 = iVar4 + -1;
        fVar8 = fVar8 + *(float *)(*(int *)(this + 15000) + iVar6);
        iVar6 = iVar6 + -8;
        if (iVar4 == -1) goto LAB_009bae0b;
      }
      iVar5 = iVar4 + -1;
      iVar6 = iVar6 + -8;
      CUtlVector<CTerrorPlayer::InfectedDamageEvent,CUtlMemory<CTerrorPlayer::InfectedDamageEvent,int>>
      ::ShiftElementsLeft((CUtlVector<CTerrorPlayer::InfectedDamageEvent,CUtlMemory<CTerrorPlayer::InfectedDamageEvent,int>>
                           *)(this + 15000),iVar4,1);
      *(int *)(this + 0x3aa4) = *(int *)(this + 0x3aa4) + -1;
      iVar4 = iVar5;
    } while (iVar5 != -1);
  }
LAB_009bae0b:
  uVar3 = common_dps_spew._28_4_;
  *(float *)(this + 0x3aac) = fVar8 / fVar2;
  if (*(int *)(this + 0x30) == 0) {
    if (*(int *)(uVar3 + 0x30) == 0) goto LAB_009bae60;
  }
  else if (*(int *)(uVar3 + 0x30) == *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4) {
LAB_009bae60:
    DevMsg("common dps  = %.2f\n",(double)(fVar8 / fVar2));
    return;
  }
  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)