L L4D2node

CResponseSystem::ScoreCriteriaAgainstRuleCriteria

0x005b8550 · 549 bytes · __thiscall

_ZN15CResponseSystem32ScoreCriteriaAgainstRuleCriteriaERK14AI_CriteriaSetiRbb

Decompiled

undefined (5 params)

/* CResponseSystem::ScoreCriteriaAgainstRuleCriteria(AI_CriteriaSet const&, int, bool&, bool) */

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

{
  char cVar1;
  ushort uVar2;
  char *pcVar3;
  undefined1 *puVar4;
  int iVar5;
  int iVar6;
  longdouble lVar7;
  longdouble lVar8;
  longdouble lVar9;
  float fVar10;
  undefined4 local_24 [5];
  
  iVar6 = (param_2 & 0xffffU) * 0x34;
  iVar5 = *(int *)(this + 0x48) + iVar6;
  if (*(int *)(iVar5 + 0x2a) < 1) {
    if (param_4) {
      local_24[0] = CONCAT22(local_24[0]._2_2_,*(undefined2 *)(iVar5 + 0xc));
      CUtlSymbolTable::String
                ((CUtlSymbolTable *)AI_CriteriaSet::sm_CriteriaSymbols,(Node_t *)local_24);
      local_24[0] = *(undefined4 *)(*(int *)(this + 0x48) + 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((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>>
                      *)(this + 0x60),(Node_t *)local_24);
      if (uVar2 == 0xffff) {
        puVar4 = &DAT_00d539c2;
      }
      else {
        puVar4 = *(undefined1 **)((uint)uVar2 * 0x10 + *(int *)(this + 100) + 0xc);
      }
      DevMsg("  criterion \'%25s\':\'%15s\' ",puVar4);
    }
    *param_3 = false;
    local_24[0] = CONCAT22(local_24[0]._2_2_,*(undefined2 *)(iVar5 + 0xc));
    iVar6 = AI_CriteriaSet::FindCriterionIndex(param_1,(Node_t *)local_24);
    if (iVar6 == -1) {
      pcVar3 = "";
    }
    else {
      pcVar3 = (char *)AI_CriteriaSet::GetValue(param_1,iVar6);
      if (pcVar3 == (char *)0x0) goto LAB_005b8650;
    }
    cVar1 = Compare(this,pcVar3,(Criteria *)(iVar5 + 0xc),param_4);
    if (cVar1 == '\0') {
      if (*(char *)(iVar5 + 0x14) == '\0') {
        if (param_4) {
          DevMsg("failed");
        }
      }
      else {
        *param_3 = true;
        if (param_4) {
          DevMsg("failed (+exclude rule)");
          return (longdouble)0;
        }
      }
LAB_005b8650:
      return (longdouble)0;
    }
    lVar7 = (longdouble)AI_CriteriaSet::GetWeight(param_1,iVar6);
    lVar8 = (longdouble)float16::Convert16bitFloatTo32bits(*(ushort *)(iVar5 + 0x12));
    fVar10 = (float)lVar8 * (float)lVar7;
    lVar9 = (longdouble)fVar10;
    if (param_4) {
      DevMsg("matched, weight %4.2f (s %4.2f x c %4.2f)",(double)fVar10,(double)(float)lVar7,
             (double)(float)lVar8);
      lVar9 = (longdouble)fVar10;
    }
  }
  else {
    lVar9 = (longdouble)
            RecursiveScoreSubcriteriaAgainstRule
                      (this,param_1,(Criteria *)(iVar5 + 0xc),param_3,param_4);
  }
  return lVar9;
}

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)