L L4D2node

CResponseSystem::ScoreCriteriaAgainstRule

0x005b88a0 · 616 bytes · __thiscall

_ZN15CResponseSystem24ScoreCriteriaAgainstRuleERK14AI_CriteriaSetR13CResponseDictIP4RuletEib

Decompiled

undefined (5 params)

/* CResponseSystem::ScoreCriteriaAgainstRule(AI_CriteriaSet const&, CResponseDict<Rule*, unsigned
   short>&, int, bool) */

longdouble __thiscall
CResponseSystem::ScoreCriteriaAgainstRule
          (CResponseSystem *this,AI_CriteriaSet *param_1,CResponseDict *param_2,int param_3,
          bool param_4)

{
  int *piVar1;
  ushort uVar2;
  int iVar3;
  char *pcVar4;
  undefined1 *puVar5;
  int iVar6;
  char *pcVar7;
  longdouble lVar8;
  Node_t *local_3c;
  bool local_35;
  CUtlRBTree<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,char_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
  *local_34;
  float local_30;
  uint local_24 [5];
  
  iVar6 = (param_3 & 0xffffU) * 0x10;
  iVar3 = *(int *)(param_2 + 4) + iVar6;
  piVar1 = *(int **)(iVar3 + 0xc);
  pcVar7 = "FCVAR_NEVER_AS_STRING";
  if ((rr_debugrule[0x15] & 0x10) == 0) {
    pcVar7 = "";
    if (*(char **)(rr_debugrule._28_4_ + 0x24) != (char *)0x0) {
      pcVar7 = *(char **)(rr_debugrule._28_4_ + 0x24);
    }
  }
  if (*pcVar7 == '\0') {
LAB_005b88eb:
    local_35 = param_4;
    if ((*(byte *)((int)piVar1 + 0x25) & 4) != 0) {
      if (param_4) {
LAB_005b8a64:
        local_34 = (CUtlRBTree<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,char_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                    *)(param_2 + 0x1c);
        local_3c = (Node_t *)local_24;
        local_24[0] = *(uint *)(*(int *)(param_2 + 4) + 8 + iVar6);
        uVar2 = CUtlRBTree<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,char_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                ::Find(local_34,local_3c);
        if (uVar2 == 0xffff) {
          puVar5 = &DAT_00d539c2;
        }
        else {
          puVar5 = *(undefined1 **)((uint)uVar2 * 0x10 + *(int *)(param_2 + 0x20) + 0xc);
        }
        DevMsg("Scoring rule \'%s\' (%i)\n{\n",puVar5);
        local_35 = true;
      }
      iVar3 = piVar1[2];
      if (iVar3 < 1) {
        local_30 = 0.0;
      }
      else {
        iVar6 = 0;
        local_30 = 0.0;
        do {
          local_24[0] = local_24[0] & 0xffffff00;
          lVar8 = (longdouble)
                  ScoreCriteriaAgainstRuleCriteria
                            (this,param_1,(uint)*(ushort *)(*piVar1 + iVar6),(bool *)local_24,
                             local_35);
          local_30 = (float)lVar8 + local_30;
          if (local_35 == false) {
          }
          else {
            DevMsg(", score %4.2f\n",(double)local_30);
          }
          if (local_24[0]._0_1_ != (Node_t)0x0) {
            local_30 = 0.0;
            break;
          }
          iVar6 = iVar6 + 2;
        } while (iVar6 != iVar3 * 2);
      }
      if (local_35 != false) {
        DevMsg("}\n");
      }
      if (*(byte *)(piVar1 + 9) == 0) goto LAB_005b89eb;
      if (1.1754944e-38 <= local_30) {
        return (longdouble)*(byte *)(piVar1 + 9);
      }
    }
  }
  else {
    local_24[0] = *(uint *)(iVar3 + 8);
    uVar2 = CUtlRBTree<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,char_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
            ::Find((CUtlRBTree<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,char_const*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,char_const*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
                    *)(param_2 + 0x1c),(Node_t *)local_24);
    if (uVar2 == 0xffff) {
      pcVar4 = "";
    }
    else {
      pcVar4 = *(char **)((uint)uVar2 * 0x10 + *(int *)(param_2 + 0x20) + 0xc);
    }
    iVar3 = _V_stricmp(pcVar7,pcVar4);
    if (iVar3 != 0) goto LAB_005b88eb;
    if ((*(byte *)((int)piVar1 + 0x25) & 4) != 0) goto LAB_005b8a64;
    DevMsg("Rule is disabled.\n");
  }
  local_30 = 0.0;
LAB_005b89eb:
  return (longdouble)local_30;
}

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)