L L4D2node

CNetChan::FlowUpdate

0x001af880 · 540 bytes · __thiscall

_ZN8CNetChan10FlowUpdateEii

Decompiled

undefined (3 params)

/* CNetChan::FlowUpdate(int, int) */

void __thiscall CNetChan::FlowUpdate(CNetChan *this,int param_1,int param_2)

{
  float fVar1;
  double dVar2;
  int iVar3;
  CNetChan *pCVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  int local_18;
  
  dVar2 = net_time;
  iVar3 = param_1 * 0x1e2c;
  *(int *)(this + iVar3 + 0x56c) = *(int *)(this + iVar3 + 0x56c) + param_2;
  if ((double)*(float *)(this + iVar3 + 0x54c) <= dVar2) {
    fVar10 = 0.0;
    pCVar4 = this + iVar3 + 0x574;
    iVar6 = 0x80;
    fVar11 = 3.4028235e+38;
    iVar8 = 0;
    local_18 = 0;
    iVar9 = 0;
    iVar5 = 0;
    iVar7 = 0;
    *(float *)(this + iVar3 + 0x54c) = (float)(dVar2 + 0.25);
    fVar12 = fVar10;
    do {
      while (pCVar4[0x38] == (CNetChan)0x0) {
        iVar5 = iVar5 + 1;
        pCVar4 = pCVar4 + 0x3c;
        iVar6 = iVar6 + -1;
        if (iVar6 == 0) goto LAB_001af950;
      }
      fVar1 = *(float *)pCVar4;
      iVar7 = iVar7 + 1;
      iVar8 = iVar8 + (int)*(float *)(pCVar4 + 8);
      if (fVar1 <= fVar11) {
        fVar11 = fVar1;
      }
      iVar9 = iVar9 + (int)*(float *)(pCVar4 + 4);
      if (fVar10 <= fVar1) {
        fVar10 = fVar1;
      }
      if (-1.0 < *(float *)(pCVar4 + 0x10)) {
        local_18 = local_18 + 1;
        fVar12 = fVar12 + *(float *)(pCVar4 + 0x10);
      }
      pCVar4 = pCVar4 + 0x3c;
      iVar6 = iVar6 + -1;
    } while (iVar6 != 0);
LAB_001af950:
    fVar10 = fVar10 - fVar11;
    if (0.0 < fVar10) {
      *(float *)(this + iVar3 + 0x550) =
           ((float)iVar9 / fVar10) * 0.25 + *(float *)(this + iVar3 + 0x550) * 0.75;
      *(float *)(this + iVar3 + 0x554) =
           ((float)iVar7 / fVar10) * 0.25 + *(float *)(this + iVar3 + 0x554) * 0.75;
    }
    if (iVar7 + iVar5 != 0) {
      fVar11 = (float)(iVar7 + iVar5);
      fVar10 = ((float)(iVar5 - iVar8) / fVar11) * 0.25 + *(float *)(this + iVar3 + 0x558) * 0.75;
      if (fVar10 < 0.0) {
        *(undefined4 *)(this + iVar3 + 0x558) = 0;
      }
      else {
        *(float *)(this + iVar3 + 0x558) = fVar10;
      }
      *(float *)(this + iVar3 + 0x55c) =
           ((float)iVar8 / fVar11) * 0.25 + *(float *)(this + iVar3 + 0x55c) * 0.75;
    }
    if (local_18 != 0) {
      *(float *)(this + iVar3 + 0x564) = fVar12 / (float)local_18;
      *(float *)(this + iVar3 + 0x560) =
           (fVar12 / (float)local_18) * 0.25 + *(float *)(this + iVar3 + 0x560) * 0.75;
    }
  }
  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)