L L4D2node

CWeaponSpawnConfigurable::CalculateSpawnCriteria

0x008d7fc0 · 562 bytes · __thiscall

_ZN24CWeaponSpawnConfigurable22CalculateSpawnCriteriaEv

Decompiled

undefined (1 param)

/* WARNING: Removing unreachable block (ram,0x008d819f) */
/* CWeaponSpawnConfigurable::CalculateSpawnCriteria() */

void __thiscall CWeaponSpawnConfigurable::CalculateSpawnCriteria(CWeaponSpawnConfigurable *this)

{
  int iVar1;
  char *pcVar2;
  uint uVar3;
  char *pcVar4;
  undefined *puVar5;
  int iVar6;
  undefined **ppuVar7;
  int in_GS_OFFSET;
  uint local_44;
  char local_40 [32];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  *(undefined4 *)(this + 0x146c) = 0;
  *(undefined4 *)(this + 0x1470) = 0;
  *(undefined4 *)(this + 0x1474) = 0x10;
  *(undefined4 *)(this + 0x1478) = 0xffffffff;
  pcVar4 = "";
  if (*(char **)(this + 0x1468) != (char *)0x0) {
    pcVar4 = *(char **)(this + 0x1468);
  }
  iVar1 = _V_strlen(pcVar4);
  if (iVar1 == 0) {
    UTIL_Remove((CBaseEntity *)this);
    goto LAB_008d80d0;
  }
  iVar1 = V_strncmp(pcVar4,"any_",4);
  if (iVar1 == 0) {
    pcVar4 = pcVar4 + 4;
    iVar1 = _V_strcmp(pcVar4,"pistol");
    if (iVar1 == 0) {
      *(undefined4 *)(this + 0x1478) = 1;
      *(undefined4 *)(this + 0x1474) = 0;
    }
    else {
      iVar1 = _V_strcmp(pcVar4,"primary");
      if (iVar1 != 0) {
        pcVar2 = "pistol";
        ppuVar7 = &s_weaponTypeInfo;
        do {
          if ((pcVar4 != (char *)0x0) && (iVar1 = _V_stricmp(pcVar4,pcVar2), iVar1 == 0)) break;
          ppuVar7 = ppuVar7 + 2;
          pcVar2 = *ppuVar7;
        } while (pcVar2 != (char *)0x0);
        puVar5 = ppuVar7[1];
        goto LAB_008d81c4;
      }
      *(undefined4 *)(this + 0x1478) = 0;
    }
  }
  else {
    iVar6 = 1;
    iVar1 = V_strncmp(pcVar4,"tier",4);
    if (iVar1 == 0) {
      local_44 = 0;
      iVar1 = sscanf(pcVar4,"tier%d_%s",&local_44,local_40);
      if (iVar1 == 2) {
        if (local_44 < 3) {
          *(uint *)(this + 0x1470) = local_44;
        }
        pcVar4 = "pistol";
        ppuVar7 = &s_weaponTypeInfo;
        do {
          iVar1 = _V_stricmp(local_40,pcVar4);
          if (iVar1 == 0) break;
          ppuVar7 = ppuVar7 + 2;
          pcVar4 = *ppuVar7;
        } while (pcVar4 != (char *)0x0);
        puVar5 = ppuVar7[1];
LAB_008d81c4:
        *(undefined **)(this + 0x1474) = puVar5;
      }
    }
    else {
      do {
        pcVar2 = (char *)WeaponIDToClassname(iVar6);
        if ((pcVar2 != (char *)0x0) && (iVar1 = _V_strcmp(pcVar2,pcVar4), iVar1 == 0)) {
          *(int *)(this + 0x146c) = iVar6;
        }
        iVar6 = iVar6 + 1;
      } while (iVar6 != 0x38);
    }
  }
  uVar3 = 4;
  if (*(int *)(this + 0x146c) == 0) {
    if (*(int *)(this + 0x1470) == 0) {
      uVar3 = (uint)(*(int *)(this + 0x1474) != 0x10);
    }
    else {
      uVar3 = (*(int *)(this + 0x1474) != 0x10) + 2;
    }
  }
  *(uint *)(this + 0x147c) = uVar3;
LAB_008d80d0:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)