L L4D2node

CTerrorPlayer::GiveDefaultItems

0x0099d690 · 1003 bytes · __thiscall

_ZN13CTerrorPlayer16GiveDefaultItemsEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CTerrorPlayer::GiveDefaultItems() */

void __thiscall CTerrorPlayer::GiveDefaultItems(CTerrorPlayer *this)

{
  code *pcVar1;
  int iVar2;
  char cVar3;
  CTerrorPlayer *pCVar4;
  undefined4 *puVar5;
  CAmmoDef *pCVar6;
  undefined4 uVar7;
  char *pcVar8;
  int iVar9;
  undefined4 uVar10;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_34 = 0;
  local_30 = 0;
  if (___atan2f_finite == 0) {
    local_20 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_34,0,0,0,0,"/data/src/game/server/terror/terrorplayer.cpp",
               0x11e3,&GiveDefaultItems()::tm_fmt,"(%s)%s","Unaccounted",
               "CTerrorPlayer::GiveDefaultItems");
    local_20 = ___atan2f_finite;
  }
  iVar2 = _DAT_0105db00;
  local_28 = local_34;
  local_24 = local_30;
                    /* try { // try from 0099d8c6 to 0099d914 has its CatchHandler @ 0099dab6 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar9 = ThreadGetCurrentId(), iVar2 == iVar9)) {
    if ((char *)*_DAT_0105d15c != "CTerrorPlayer::GiveDefaultItems") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd163f4,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 0099d747 to 0099d859 has its CatchHandler @ 0099da95 */
  pCVar4 = (CTerrorPlayer *)CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  cVar3 = IsASurvivorTeam((int)pCVar4);
  if (cVar3 != '\0') {
    cVar3 = CDirectorChallengeMode::GiveDefaultItems
                      (*(CDirectorChallengeMode **)(TheDirector + 0x648),this);
    iVar2 = _DAT_0105db00;
    if (cVar3 != '\0') {
      if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
         (iVar9 = ThreadGetCurrentId(), iVar2 == iVar9)) {
        cVar3 = CVProfNode::ExitScope();
        if (cVar3 != '\0') {
          _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
        }
        DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
      }
      if (local_20 == 0) {
        return;
      }
      (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
      return;
    }
    (**(code **)(*(int *)this + 0x6c0))(this,"weapon_pistol",0,1,0);
    cVar3 = CTerrorGameRules::IsSurvivalMode();
                    /* try { // try from 0099da80 to 0099da84 has its CatchHandler @ 0099da95 */
    if (((cVar3 != '\0') || (cVar3 = CTerrorGameRules::IsScavengeMode(), cVar3 != '\0')) &&
       (this[0x4000] == (CTerrorPlayer)0x0)) {
                    /* try { // try from 0099d9ed to 0099da48 has its CatchHandler @ 0099da95 */
      (**(code **)(*(int *)this + 0x6c0))(this,"weapon_pistol",0,1,0);
      (**(code **)(*(int *)this + 0x6c0))(this,"first_aid_kit",0,1,0);
      (**(code **)(*(int *)this + 0x6c0))(this,"pain_pills",0,1,0);
    }
    CBaseCombatCharacter::RemoveAllAmmo((CBaseCombatCharacter *)this);
    puVar5 = (undefined4 *)GetAmmoDef();
    pcVar1 = *(code **)*puVar5;
    pCVar6 = (CAmmoDef *)GetAmmoDef();
    uVar7 = CAmmoDef::Index(pCVar6,"AMMO_TYPE_PISTOL");
    pcVar8 = (char *)(*pcVar1)(puVar5,uVar7,this);
    uVar10 = 0;
    CBaseCombatCharacter::GiveAmmo((int)this,pcVar8,true);
    puVar5 = (undefined4 *)GetAmmoDef();
    pcVar1 = *(code **)*puVar5;
    pCVar6 = (CAmmoDef *)GetAmmoDef();
    uVar7 = CAmmoDef::Index(pCVar6,"AMMO_TYPE_PISTOL_MAGNUM");
    pcVar8 = (char *)(*pcVar1)(puVar5,uVar7,this,uVar10);
    CBaseCombatCharacter::GiveAmmo((int)this,pcVar8,true);
    pCVar4 = this;
  }
  iVar2 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar9 = ThreadGetCurrentId(pCVar4), iVar2 == iVar9)) {
    cVar3 = CVProfNode::ExitScope();
    if (cVar3 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_20 != 0) {
    (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
  }
  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)