L L4D2node

CTeam::AddPlayer

0x008394a0 · 329 bytes · __thiscall

_ZN5CTeam9AddPlayerEP11CBasePlayer

Decompiled

undefined (2 params)

/* CTeam::AddPlayer(CBasePlayer*) */

void __thiscall CTeam::AddPlayer(CTeam *this,CBasePlayer *param_1)

{
  undefined4 uVar1;
  int iVar2;
  CBaseEdict *this_00;
  int iVar3;
  void *pvVar4;
  int iVar5;
  int iVar6;
  
  iVar2 = *(int *)(this + 0x460);
  iVar6 = *(int *)(this + 0x458);
  iVar5 = iVar2 + 1;
  if (iVar6 < iVar5) {
    iVar3 = *(int *)(this + 0x45c);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar6 == 0) {
          if (iVar5 < 9) {
            iVar3 = 8;
            goto LAB_0083958f;
          }
          iVar6 = 8;
        }
        do {
          iVar3 = iVar6 * 2;
          if (iVar5 <= iVar3) break;
          iVar3 = iVar6 * 4;
          iVar6 = iVar3;
        } while (iVar3 < iVar5);
      }
      else {
        for (iVar3 = (iVar2 / iVar3 + 1) * iVar3; iVar3 < iVar5; iVar3 = (iVar3 + iVar5) / 2) {
        }
      }
LAB_0083958f:
      *(int *)(this + 0x458) = iVar3;
      if (*(void **)(this + 0x454) == (void *)0x0) {
        pvVar4 = malloc(iVar3 << 2);
        *(void **)(this + 0x454) = pvVar4;
      }
      else {
        pvVar4 = realloc(*(void **)(this + 0x454),iVar3 << 2);
        *(void **)(this + 0x454) = pvVar4;
        iVar5 = *(int *)(this + 0x460) + 1;
      }
      goto LAB_008394c9;
    }
  }
  pvVar4 = *(void **)(this + 0x454);
LAB_008394c9:
  *(int *)(this + 0x460) = iVar5;
  iVar6 = iVar2 * 4;
  iVar5 = (iVar5 - iVar2) + -1;
  *(void **)(this + 0x464) = pvVar4;
  if (0 < iVar5) {
    _V_memmove((void *)((int)pvVar4 + iVar6 + 4),(void *)((int)pvVar4 + iVar6),iVar5 * 4);
    pvVar4 = *(void **)(this + 0x454);
  }
  if ((undefined4 *)(iVar6 + (int)pvVar4) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar6 + (int)pvVar4) = param_1;
  }
  if (this[0x6c] == (CTeam)0x0) {
    this_00 = *(CBaseEdict **)(this + 0x30);
    if (this_00 != (CBaseEdict *)0x0) {
      *(uint *)this_00 = *(uint *)this_00 | 0x101;
      iVar5 = CBaseEdict::GetChangeAccessor(this_00);
      *(undefined2 *)(iVar5 + 2) = 0;
    }
  }
  else {
    this[0x70] = (CTeam)((byte)this[0x70] | 1);
  }
  uVar1 = *(undefined4 *)(gpGlobals + 0xc);
  *(undefined4 *)(this + 0x78) = 0;
  *(undefined4 *)(this + 0x74) = uVar1;
  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)