L L4D2node

ReadDamageCutoutDataFromFile

0x005204e0 · 2302 bytes · __regparm3

_Z28ReadDamageCutoutDataFromFileR10CUtlVectorI17sDamageCutoutInfo10CUtlMemoryIS0_iEERS_IiS1_IiiEEP11IFileSystemPKcPKh.part.122

Decompiled

undefined (5 params)

/* ReadDamageCutoutDataFromFile(CUtlVector<sDamageCutoutInfo, CUtlMemory<sDamageCutoutInfo, int> >&,
   CUtlVector<int, CUtlMemory<int, int> >&, IFileSystem*, char const*, unsigned char const*) [clone
   .part.122] */

undefined4 __regparm3
ReadDamageCutoutDataFromFile
          (CUtlVector *param_1,CUtlVector *param_2,IFileSystem *param_3,char *param_4,uchar *param_5
          )

{
  int iVar1;
  KeyValues *this;
  KeyValues *pKVar2;
  KeyValues *pKVar3;
  undefined4 uVar4;
  char *pcVar5;
  int iVar6;
  sDamageCutoutInfo *psVar7;
  int iVar8;
  int in_GS_OFFSET;
  bool bVar9;
  int local_10b4;
  int local_10a8;
  int local_10a0;
  int local_1090;
  char local_108c [256];
  sDamageCutoutInfo local_f8c [20];
  undefined4 local_f78;
  char local_f74 [1320];
  undefined4 local_a4c;
  char local_a48 [128];
  uint local_9c8;
  undefined4 local_9c4;
  undefined4 local_9c0;
  undefined1 local_9bc;
  char local_9bb [1024];
  char local_5bb [131];
  undefined4 local_538;
  char local_534 [1024];
  int local_134 [8];
  int local_114;
  int local_110;
  undefined4 local_10c;
  undefined1 local_108;
  char local_107 [131];
  undefined4 local_84;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  this = (KeyValues *)ReadEncryptedKVFile(param_3,param_4,param_5);
  if (this == (KeyValues *)0x0) {
    uVar4 = 0;
  }
  else {
    iVar8 = 0;
    do {
      iVar8 = iVar8 + 1;
      V_snprintf(local_108c,0x100,"DamageCutout%d",iVar8);
      pKVar2 = (KeyValues *)KeyValues::FindKey(this,local_108c,false);
      if ((pKVar2 != (KeyValues *)0x0) &&
         (pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"Model",false), pKVar3 != (KeyValues *)0x0
         )) {
        uVar4 = KeyValues::GetString(pKVar3,(char *)0x0,"");
        V_snprintf(local_107,0x80,"models/infected/%s.mdl",uVar4);
        pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"HitBoxes",false);
        if (pKVar3 != (KeyValues *)0x0) {
          pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
          local_f78 = ParseStringToIntArray(pcVar5,(int *)local_f8c,5);
          pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"ExclusionList",false);
          if (pKVar3 != (KeyValues *)0x0) {
            pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
            local_a4c = ParseStringToExclusionArray(pcVar5,local_f74,10);
            local_a48[0] = '\0';
            pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"DeathThroes",false);
            if (pKVar3 != (KeyValues *)0x0) {
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              V_strncpy(local_a48,pcVar5,0x80);
            }
            pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"Type",false);
            if (pKVar3 != (KeyValues *)0x0) {
              local_9c8 = 0;
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              iVar6 = V_stristr(pcVar5,"gunshot");
              if (iVar6 != 0) {
                local_9c8 = local_9c8 | 1;
              }
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              iVar6 = V_stristr(pcVar5,"explosion");
              if (iVar6 != 0) {
                local_9c8 = local_9c8 | 2;
              }
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              iVar6 = V_stristr(pcVar5,"dismember");
              if (iVar6 != 0) {
                local_9c8 = local_9c8 | 4;
              }
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              iVar6 = V_stristr(pcVar5,"slash");
              if (iVar6 != 0) {
                local_9c8 = local_9c8 | 8;
              }
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              iVar6 = V_stristr(pcVar5,"blunt");
              if (iVar6 != 0) {
                local_9c8 = local_9c8 | 0x10;
              }
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              iVar6 = V_stristr(pcVar5,"chainsaw");
              if (iVar6 != 0) {
                local_9c8 = local_9c8 | 0x20;
              }
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              iVar6 = V_stristr(pcVar5,"decapitate");
              if (iVar6 != 0) {
                local_9c8 = local_9c8 | 0x40;
              }
              pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
              iVar6 = V_stristr(pcVar5,"headshot");
              if (iVar6 != 0) {
                local_9c8 = local_9c8 | 0x80;
              }
              pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"Fatal",false);
              if (pKVar3 != (KeyValues *)0x0) {
                iVar6 = KeyValues::GetInt(pKVar3,(char *)0x0,0);
                local_108 = iVar6 != 0;
                local_9c4 = 0xffffffff;
                local_9c0 = 0xffffffff;
                pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"SwingStart",false);
                if (pKVar3 != (KeyValues *)0x0) {
                  pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
                  local_9c4 = ParseStringToSwingDirection(pcVar5);
                }
                pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"SwingEnd",false);
                if (pKVar3 != (KeyValues *)0x0) {
                  pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
                  local_9c0 = ParseStringToSwingDirection(pcVar5);
                }
                pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"Back",false);
                bVar9 = false;
                if (pKVar3 != (KeyValues *)0x0) {
                  iVar6 = KeyValues::GetInt(pKVar3,(char *)0x0,0);
                  bVar9 = iVar6 != 0;
                }
                local_9bc = bVar9;
                pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"Gibs",false);
                pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
                local_10c = ParseStringToGibArray(pcVar5,local_9bb,8);
                pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"ParticleAttach",false);
                local_5bb[0] = '\0';
                if (pKVar3 != (KeyValues *)0x0) {
                  pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
                  V_strncpy(local_5bb,pcVar5,0x80);
                }
                pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"ParticleAttachHitbox",false);
                local_538 = 0xffffffff;
                if (pKVar3 != (KeyValues *)0x0) {
                  local_538 = KeyValues::GetInt(pKVar3,(char *)0x0,0);
                }
                pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"ParticleEffect",false);
                pcVar5 = (char *)KeyValues::GetString(pKVar3,(char *)0x0,"");
                local_110 = ParseStringToEffectArray(pcVar5,local_534,local_134,8);
                local_114 = 0;
                if (0 < local_110) {
                  local_114 = 0;
                  psVar7 = local_f8c;
                  do {
                    local_114 = local_114 + *(int *)(psVar7 + 0xe58);
                    psVar7 = psVar7 + 4;
                  } while (psVar7 != local_f8c + local_110 * 4);
                }
                pKVar3 = (KeyValues *)KeyValues::FindKey(pKVar2,"Primary",false);
                if (pKVar3 != (KeyValues *)0x0) {
                  ReadMaterialValues(pKVar3,0,local_f8c);
                  pKVar2 = (KeyValues *)KeyValues::FindKey(pKVar2,"Secondary",false);
                  if (pKVar2 == (KeyValues *)0x0) {
                    local_84 = 1;
                  }
                  else {
                    ReadMaterialValues(pKVar2,1,local_f8c);
                    local_84 = 2;
                  }
                  if ((local_9c8 & 2) != 0) {
                    local_1090 = *(int *)(param_1 + 0xc);
                    CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
                              ((CUtlVector<int,CUtlMemory<int,int>> *)param_2,
                               *(int *)(param_2 + 0xc),&local_1090);
                  }
                  CUtlVector<sDamageCutoutInfo,CUtlMemory<sDamageCutoutInfo,int>>::InsertBefore
                            ((CUtlVector<sDamageCutoutInfo,CUtlMemory<sDamageCutoutInfo,int>> *)
                             param_1,*(int *)(param_1 + 0xc),local_f8c);
                }
              }
            }
          }
        }
      }
    } while (iVar8 != 0x32);
    if (0 < *(int *)(param_1 + 0xc)) {
      iVar8 = *(int *)param_1;
      local_10a0 = 0;
      local_10b4 = 0;
      do {
        iVar6 = local_10a0 + iVar8;
        if (0 < *(int *)(iVar6 + 0x540)) {
          local_10a8 = 0;
          do {
            iVar8 = 0;
            iVar1 = local_10a8 + 0x144;
            *(undefined4 *)(iVar6 + 8 + iVar1 * 4) = 0xffffffff;
            if (0 < *(int *)(param_1 + 0xc)) {
              do {
                V_snprintf((char *)local_f8c,0x80,"models/infected/%s.mdl",
                           local_10a0 + *(int *)param_1 + local_10a8 * 0x80 + 0x18);
                iVar6 = _V_stricmp((char *)local_f8c,
                                   (char *)(iVar8 * 0xf6c + *(int *)param_1 + 0xe85));
                if (iVar6 == 0) {
                  *(int *)(local_10a0 + 8 + *(int *)param_1 + iVar1 * 4) = iVar8;
                  break;
                }
                iVar8 = iVar8 + 1;
              } while (iVar8 < *(int *)(param_1 + 0xc));
            }
            iVar8 = *(int *)param_1;
            iVar6 = local_10a0 + iVar8;
            if (*(int *)(iVar6 + 8 + iVar1 * 4) == -1) {
              Warning("Unable to find cutout model for \'%s\' on wound exclusion list!",
                      iVar6 + 0x18 + local_10a8 * 0x80);
              iVar8 = *(int *)param_1;
              iVar6 = local_10a0 + iVar8;
            }
            local_10a8 = local_10a8 + 1;
          } while (local_10a8 < *(int *)(iVar6 + 0x540));
        }
        local_10b4 = local_10b4 + 1;
        local_10a0 = local_10a0 + 0xf6c;
      } while (local_10b4 < *(int *)(param_1 + 0xc));
    }
    KeyValues::deleteThis();
    uVar4 = 1;
    param_3 = (IFileSystem *)this;
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar4;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(param_3);
}

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)