L L4D2node

CTerrorPlayer::UpdateTeamDesired

0x009b7650 · 435 bytes · __thiscall

_ZN13CTerrorPlayer17UpdateTeamDesiredEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::UpdateTeamDesired() */

void __thiscall CTerrorPlayer::UpdateTeamDesired(CTerrorPlayer *this)

{
  code *pcVar1;
  char cVar2;
  KeyValues *this_00;
  int iVar3;
  char *pcVar4;
  undefined4 uVar5;
  int local_30;
  int local_28;
  int local_24;
  FindUsedTeamDesiredSurvivorSlots local_20 [16];
  
  cVar2 = (**(code **)(*(int *)this + 0x778))(this);
  if (cVar2 == '\0') {
    local_28 = 0;
    local_24 = 8;
    this_00 = (KeyValues *)CDirector::PlayerAvatarGet(TheDirector,*(edict_t **)(this + 0x30));
    CDirector::PlayerAvatarUnpack(TheDirector,this_00,&local_28,(SurvivorCharacterType *)&local_24);
    iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    local_30 = *(int *)(this + 0x2ba0);
    cVar2 = CDirector::AreTeamsFlipped(TheDirector);
    if (cVar2 != '\0') {
      if (iVar3 == 2) {
        iVar3 = 3;
      }
      else if (iVar3 == 3) {
        local_20[0] = (FindUsedTeamDesiredSurvivorSlots)0x1;
        local_30 = 0;
        local_20[1] = (FindUsedTeamDesiredSurvivorSlots)0x1;
        local_20[2] = (FindUsedTeamDesiredSurvivorSlots)0x1;
        local_20[3] = (FindUsedTeamDesiredSurvivorSlots)0x1;
        ForEachTerrorPlayer<FindUsedTeamDesiredSurvivorSlots>(local_20);
        do {
          if (local_20[local_30] != (FindUsedTeamDesiredSurvivorSlots)0x0) goto LAB_009b7800;
          local_30 = local_30 + 1;
        } while (local_30 != 4);
        local_30 = 8;
LAB_009b7800:
        iVar3 = 2;
      }
    }
    if (((iVar3 != local_28) || (local_30 != local_24)) && (this_00 != (KeyValues *)0x0)) {
      pcVar4 = (char *)GetTeamName(iVar3);
      KeyValues::SetString(this_00,"team",pcVar4);
      if (iVar3 != 3) {
        if ((local_30 == 8) || (iVar3 != 2)) {
          DevWarning("CTerrorPlayer::UpdateTeamDesired error ( team %d : character %d )\n",iVar3,
                     local_30);
          return;
        }
        pcVar4 = (char *)SurvivorCharacterName(local_30);
        KeyValues::SetString(this_00,"avatar",pcVar4);
      }
      cVar2 = CTerrorGameRules::IsTeamOnTeamMode();
      if (cVar2 == '\0') {
        pcVar1 = *(code **)(*engine + 0x21c);
        uVar5 = KeyValues::MakeCopy(this_00);
        (*pcVar1)(engine,*(undefined4 *)(this + 0x30),uVar5);
      }
    }
  }
  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)