L L4D2node

CDirector::PlayerAvatarUnpack

0x00872ee0 · 274 bytes · __thiscall

_ZN9CDirector18PlayerAvatarUnpackEP9KeyValuesRiR21SurvivorCharacterType

Decompiled

undefined (4 params)

/* CDirector::PlayerAvatarUnpack(KeyValues*, int&, SurvivorCharacterType&) */

void __thiscall
CDirector::PlayerAvatarUnpack
          (CDirector *this,KeyValues *param_1,int *param_2,SurvivorCharacterType *param_3)

{
  char *pcVar1;
  long lVar2;
  int iVar3;
  undefined4 uVar4;
  
  *param_2 = 0;
  *(undefined4 *)param_3 = 8;
  if (param_1 == (KeyValues *)0x0) {
    return;
  }
  pcVar1 = (char *)KeyValues::GetString(param_1,"team","");
  lVar2 = strtol(pcVar1,(char **)0x0,10);
  *param_2 = lVar2;
  if (lVar2 == 0) {
    if ((pcVar1 == "Survivor") || (iVar3 = _V_stricmp(pcVar1,"Survivor"), iVar3 == 0)) {
      *param_2 = 2;
    }
    else if ((pcVar1 == "Infected") || (iVar3 = _V_stricmp(pcVar1,"Infected"), iVar3 == 0)) {
      *param_2 = 3;
    }
    else if ((pcVar1 == "Spectator") || (iVar3 = _V_stricmp(pcVar1,"Spectator"), iVar3 == 0)) {
      *param_2 = 1;
    }
  }
  pcVar1 = (char *)KeyValues::GetString(param_1,"avatar","");
  if (*pcVar1 == '\0') {
    return;
  }
  uVar4 = GetCharacterFromName(pcVar1);
  *(undefined4 *)param_3 = uVar4;
  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)