L L4D2node

CMeleeWeaponInfo::Parse

0x00544220 · 1758 bytes · __thiscall

_ZN16CMeleeWeaponInfo5ParseEPKcP9KeyValues

Decompiled

undefined (3 params)

/* CMeleeWeaponInfo::Parse(char const*, KeyValues*) */

void __thiscall CMeleeWeaponInfo::Parse(CMeleeWeaponInfo *this,char *param_1,KeyValues *param_2)

{
  char *pcVar1;
  int iVar2;
  uint uVar3;
  undefined4 uVar4;
  KeyValues *pKVar5;
  CMeleeWeaponInfo *pCVar6;
  byte bVar7;
  longdouble lVar8;
  melee_anim_t local_4c [32];
  undefined1 local_2c;
  undefined1 local_2b;
  
  bVar7 = 0;
  V_strncpy((char *)(this + 0xc50),param_1,0x50);
  lVar8 = (longdouble)KeyValues::GetFloat(param_2,"refire_delay",1.0);
  *(float *)(this + 4) = (float)lVar8;
  pcVar1 = (char *)KeyValues::GetString(param_2,"viewmodel","");
  V_strncpy((char *)(this + 8),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"playermodel","");
  V_strncpy((char *)(this + 0x58),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"addon_attachment","melee");
  V_strncpy((char *)(this + 0xa8),pcVar1,0x50);
  ParseVector(param_2,"addon_offset",(Vector *)(this + 0xf8));
  ParseAngles(param_2,"addon_angles",(QAngle *)(this + 0x104));
  pcVar1 = (char *)KeyValues::GetString(param_2,"anim_prefix","");
  V_strncpy((char *)(this + 0x110),pcVar1,0x50);
  iVar2 = KeyValues::GetInt(param_2,"damage",1);
  *(float *)(this + 0x120) = (float)iVar2;
  uVar3 = KeyValues::GetInt(param_2,"damage_flags",0);
  *(uint *)(this + 0x124) = uVar3 | 0x200000;
  uVar4 = KeyValues::GetInt(param_2,"rumble_effect",-1);
  *(undefined4 *)(this + 0x128) = uVar4;
  iVar2 = KeyValues::GetInt(param_2,"decapitates",0);
  this[300] = (CMeleeWeaponInfo)(iVar2 != 0);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_idle","");
  V_strncpy((char *)(this + 0x12d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_walk","");
  V_strncpy((char *)(this + 0x17d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_run","");
  V_strncpy((char *)(this + 0x1cd),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_crouchidle","");
  V_strncpy((char *)(this + 0x21d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_crouchwalk","");
  V_strncpy((char *)(this + 0x26d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_crouchwalk","");
  V_strncpy((char *)(this + 0x2bd),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_idleinjured","");
  V_strncpy((char *)(this + 0x30d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_walkinjured","");
  V_strncpy((char *)(this + 0x35d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_runinjured","");
  V_strncpy((char *)(this + 0x3ad),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_idlecalm","");
  V_strncpy((char *)(this + 0x3fd),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_walkcalm","");
  V_strncpy((char *)(this + 0x44d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_runcalm","");
  V_strncpy((char *)(this + 0x49d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_jump","");
  V_strncpy((char *)(this + 0x4ed),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_deploy","");
  V_strncpy((char *)(this + 0x53d),pcVar1,0x50);
  pcVar1 = (char *)KeyValues::GetString(param_2,"activity_shove","");
  V_strncpy((char *)(this + 0x58d),pcVar1,0x50);
  pCVar6 = this + 0x5dd;
  for (iVar2 = 400; iVar2 != 0; iVar2 = iVar2 + -1) {
    *(undefined4 *)pCVar6 = 0;
    pCVar6 = pCVar6 + (uint)bVar7 * -8 + 4;
  }
  iVar2 = 0;
  pKVar5 = (KeyValues *)KeyValues::FindKey(param_2,"SoundData",false);
  pCVar6 = this + 0x5dd;
  if (pKVar5 != (KeyValues *)0x0) {
    do {
      while ((pcVar1 = (char *)KeyValues::GetString(pKVar5,(&pWeaponSoundCategories)[iVar2],""),
             pcVar1 == (char *)0x0 || (*pcVar1 == '\0'))) {
        iVar2 = iVar2 + 1;
        pCVar6 = pCVar6 + 0x50;
        if (iVar2 == 0x14) goto LAB_005447b1;
      }
      iVar2 = iVar2 + 1;
      V_strncpy((char *)pCVar6,pcVar1,0x50);
      pCVar6 = pCVar6 + 0x50;
    } while (iVar2 != 0x14);
  }
LAB_005447b1:
  uVar4 = KeyValues::GetInt(param_2,"player_anim_event",0x21);
  *(undefined4 *)(this + 0xc48) = uVar4;
  lVar8 = (longdouble)KeyValues::GetFloat(param_2,"weapon_idle_time",2.0);
  *(float *)(this + 0xc4c) = (float)lVar8;
  pKVar5 = (KeyValues *)KeyValues::FindKey(param_2,"primaryattacks",false);
  if (pKVar5 != (KeyValues *)0x0) {
    pKVar5 = (KeyValues *)KeyValues::GetFirstTrueSubKey(pKVar5);
    for (; pKVar5 != (KeyValues *)0x0; pKVar5 = (KeyValues *)KeyValues::GetNextTrueSubKey(pKVar5)) {
      ParseSwing(this,local_4c,pKVar5);
      local_2c = 1;
      local_2b = 0;
      CUtlVector<melee_anim_t,CUtlMemory<melee_anim_t,int>>::InsertBefore
                ((CUtlVector<melee_anim_t,CUtlMemory<melee_anim_t,int>> *)(this + 0xc20),
                 *(int *)(this + 0xc2c),local_4c);
    }
  }
  pKVar5 = (KeyValues *)KeyValues::FindKey(param_2,"secondaryattacks",false);
  if (pKVar5 != (KeyValues *)0x0) {
    pKVar5 = (KeyValues *)KeyValues::GetFirstTrueSubKey(pKVar5);
    for (; pKVar5 != (KeyValues *)0x0; pKVar5 = (KeyValues *)KeyValues::GetNextTrueSubKey(pKVar5)) {
      ParseSwing(this,local_4c,pKVar5);
      local_2c = 0;
      local_2b = 0;
      CUtlVector<melee_anim_t,CUtlMemory<melee_anim_t,int>>::InsertBefore
                ((CUtlVector<melee_anim_t,CUtlMemory<melee_anim_t,int>> *)(this + 0xc34),
                 *(int *)(this + 0xc40),local_4c);
    }
  }
  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)