L L4D2node

CTerrorPlayer::UpdateWeaponEquipage

0x009fb310 · 840 bytes · __thiscall

_ZN13CTerrorPlayer20UpdateWeaponEquipageEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::UpdateWeaponEquipage() */

void __thiscall CTerrorPlayer::UpdateWeaponEquipage(CTerrorPlayer *this)

{
  uint uVar1;
  CBaseEntity *this_00;
  char cVar2;
  CBaseCombatWeapon *pCVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  int iVar6;
  CBaseCombatWeapon *pCVar7;
  int *piVar8;
  undefined *puVar9;
  int iVar10;
  
  pCVar3 = (CBaseCombatWeapon *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
  if (pCVar3 == (CBaseCombatWeapon *)0x0) {
    uVar1 = *(uint *)(this + 0x3ee0);
    if (((((uVar1 != 0xffffffff) &&
          (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar9 + 4) != 0)) ||
       (cVar2 = CBaseCombatCharacter::SwitchToNextBestWeapon
                          ((CBaseCombatCharacter *)this,(CBaseCombatWeapon *)0x0), cVar2 != '\0'))
    goto LAB_009fb456;
    piVar8 = (int *)(**(code **)(*(int *)this + 0x484))(this,1);
joined_r0x009fb60c:
    if (piVar8 == (int *)0x0) goto LAB_009fb456;
  }
  else {
    if (*(int *)(l4d_show_weaponequip._28_4_ + 0x30) != 0) {
      iVar10 = 0;
      do {
        while (((uVar1 = *(uint *)(this + iVar10 * 4 + 0x18f4), uVar1 == 0xffffffff ||
                (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)
                ) || ((*(uint *)(puVar9 + 8) != uVar1 >> 0xc ||
                      (this_00 = *(CBaseEntity **)(puVar9 + 4), this_00 == (CBaseEntity *)0x0))))) {
          iVar10 = iVar10 + 1;
          if (iVar10 == 0x38) goto LAB_009fb414;
        }
        uVar4 = (**(code **)(*(int *)this_00 + 0x53c))(this_00);
        uVar5 = (**(code **)(*(int *)this + 0x5ac))(this);
        iVar6 = iVar10;
        Msg("%s weapon %d: %s",uVar5,iVar10,uVar4);
        if (pCVar3 == (CBaseCombatWeapon *)this_00) {
          Msg(", IsActive",uVar5,iVar6,uVar4);
        }
        cVar2 = (**(code **)(*(int *)this_00 + 0x434))(this_00);
        if (cVar2 != '\0') {
          Msg(", IsVisible",uVar5,iVar6,uVar4);
        }
        cVar2 = (**(code **)(*(int *)this_00 + 0x420))(this_00);
        if (cVar2 != '\0') {
          Msg(", CanDeploy");
        }
        iVar6 = CBaseEntity::IsDormant(this_00);
        if (iVar6 != 0) {
          Msg(", Dormant");
        }
        iVar10 = iVar10 + 1;
        Msg(&DAT_00cff71e);
      } while (iVar10 != 0x38);
    }
LAB_009fb414:
    cVar2 = (**(code **)(*(int *)pCVar3 + 0x434))(pCVar3);
    if ((cVar2 == '\0') && (cVar2 = (**(code **)(*(int *)pCVar3 + 0x420))(pCVar3), cVar2 != '\0')) {
      (**(code **)(*(int *)pCVar3 + 0x424))(pCVar3);
      goto LAB_009fb456;
    }
    cVar2 = (**(code **)(*(int *)pCVar3 + 0x434))(pCVar3);
    if ((cVar2 != '\0') && (cVar2 = (**(code **)(*(int *)pCVar3 + 0x420))(pCVar3), cVar2 == '\0')) {
      (**(code **)(*(int *)pCVar3 + 0x428))(pCVar3,0);
      goto LAB_009fb456;
    }
    cVar2 = (**(code **)(*(int *)pCVar3 + 0x434))(pCVar3);
    if ((cVar2 != '\0') || (iVar10 = (**(code **)(*(int *)pCVar3 + 0x638))(pCVar3), iVar10 == 1))
    goto LAB_009fb456;
    cVar2 = (**(code **)(*(int *)this + 0x7e8))(this);
    if (cVar2 == '\0') {
      CBaseCombatCharacter::SwitchToNextBestWeapon((CBaseCombatCharacter *)this,pCVar3);
      goto LAB_009fb456;
    }
    piVar8 = (int *)GetTerrorWeapon(this,1);
    if (piVar8 == (int *)0x0) {
      piVar8 = (int *)GetTerrorWeapon(this,0x20);
      goto joined_r0x009fb60c;
    }
  }
  cVar2 = (**(code **)(*piVar8 + 0x420))(piVar8);
  if (cVar2 != '\0') {
    (**(code **)(*(int *)this + 0x474))(this,piVar8,0);
  }
LAB_009fb456:
  pCVar7 = (CBaseCombatWeapon *)(**(code **)(*(int *)this + 0x484))(this,5);
  if ((pCVar3 != pCVar7) && (pCVar7 != (CBaseCombatWeapon *)0x0)) {
    CCSPlayer::DropWeapon((CCSPlayer *)this,pCVar7,true,(Vector *)0x0);
    return;
  }
  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)