CDefaultResponseSystem::BuildCustomResponseSystemGivenCriteria
0x005be400 · 552 bytes · __thiscall
_ZN22CDefaultResponseSystem38BuildCustomResponseSystemGivenCriteriaEPKcS1_R14AI_CriteriaSetf
Decompiled
undefined (5 params)
/* CDefaultResponseSystem::BuildCustomResponseSystemGivenCriteria(char const*, char const*,
AI_CriteriaSet&, float) */
CResponseSystem * __thiscall
CDefaultResponseSystem::BuildCustomResponseSystemGivenCriteria
(CDefaultResponseSystem *this,char *param_1,char *param_2,AI_CriteriaSet *param_3,
float param_4)
{
byte bVar1;
Rule *pRVar2;
int iVar3;
CResponseSystem *this_00;
int iVar4;
char *pcVar5;
byte *pbVar6;
uint uVar7;
int iVar8;
longdouble lVar9;
float fVar10;
uint local_44;
uint local_40;
uint local_3c;
int local_24;
CResponseSystem *local_20;
this_00 = ::operator_new(0x3e44);
/* try { // try from 005be420 to 005be424 has its CatchHandler @ 005be633 */
CResponseSystem::CResponseSystem(this_00);
*(undefined ***)this_00 = &PTR__CInstancedResponseSystem_00c58788;
*(undefined4 *)(this_00 + 0x3e3c) = 0;
*(undefined1 **)(this_00 + 0x3e40) = g_ExpresserRRScriptBridge;
/* try { // try from 005be445 to 005be46d has its CatchHandler @ 005be648 */
iVar4 = _V_strlen(param_2);
pcVar5 = operator_new__(iVar4 + 1U);
*(char **)(this_00 + 0x3e3c) = pcVar5;
V_strncpy(pcVar5,param_2,iVar4 + 1U);
CResponseSystem::Clear(this_00);
local_40 = 0;
local_3c = 0;
local_44 = 0;
do {
iVar4 = local_44 * 0x38;
uVar7 = (uint)*(ushort *)(this + iVar4 + 0x8e);
if (uVar7 <= local_3c) break;
pRVar2 = *(Rule **)(local_3c * 0x10 + *(int *)(this + local_44 * 0x38 + 0x80) + 0xc);
if ((pRVar2 != (Rule *)0x0) && (iVar3 = *(int *)(pRVar2 + 8), 0 < iVar3)) {
fVar10 = 0.0;
iVar8 = 0;
do {
lVar9 = (longdouble)
CResponseSystem::LookForCriteria
((CResponseSystem *)this,param_3,(uint)*(ushort *)(*(int *)pRVar2 + iVar8)
);
fVar10 = fVar10 + (float)lVar9;
if (param_4 <= fVar10) {
CResponseSystem::CopyRuleFrom((CResponseSystem *)this,pRVar2,local_40,this_00);
uVar7 = (uint)*(ushort *)(this + iVar4 + 0x8e);
goto LAB_005be552;
}
iVar8 = iVar8 + 2;
} while (iVar8 != iVar3 * 2);
uVar7 = (uint)*(ushort *)(this + iVar4 + 0x8e);
}
LAB_005be552:
if (local_3c + 1 < uVar7) {
local_40 = local_40 + 1;
if (local_40 == 0xffffffff) break;
}
else {
if (0xff < local_44 + 1) break;
local_40 = (local_44 + 1) * 0x10000;
}
local_3c = local_40 & 0xffff;
local_44 = local_40 >> 0x10;
} while (local_44 < 0x100);
this[0x3d7e] = (CDefaultResponseSystem)0x1;
local_20 = (CResponseSystem *)ResponseCopyString(param_2);
bVar1 = *(byte *)local_20;
if (bVar1 == 0) {
iVar4 = -0x55555556;
}
else {
iVar4 = -0x55555556;
pbVar6 = (byte *)local_20;
do {
pbVar6 = pbVar6 + 1;
iVar4 = (uint)bVar1 + iVar4 * 0x21;
bVar1 = *pbVar6;
} while (bVar1 != 0);
}
local_24 = iVar4;
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>>
::Insert((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 + 0x3e64),(Node_t *)&local_24);
local_24 = iVar4;
local_20 = this_00;
CUtlRBTree<CUtlMap<unsigned_int,CInstancedResponseSystem*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,CInstancedResponseSystem*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,CInstancedResponseSystem*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
::Insert((CUtlRBTree<CUtlMap<unsigned_int,CInstancedResponseSystem*,unsigned_short>::Node_t,unsigned_short,CUtlMap<unsigned_int,CInstancedResponseSystem*,unsigned_short>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<unsigned_int,CInstancedResponseSystem*,unsigned_short>::Node_t,unsigned_short>,unsigned_short>>
*)(this + 0x3e48),(Node_t *)&local_24);
return this_00;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.