L L4D2node

CExpressionCalculator::SetVariable

0x0026ed00 · 208 bytes · __thiscall

_ZN21CExpressionCalculator11SetVariableEPKcf

Decompiled

undefined (3 params)

/* CExpressionCalculator::SetVariable(char const*, float) */

void __thiscall
CExpressionCalculator::SetVariable(CExpressionCalculator *this,char *param_1,float param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  CUtlString local_2c [28];
  
  iVar1 = FindString((CUtlVector *)(this + 0x10),param_1);
  if (iVar1 < 0) {
    CUtlString::CUtlString(local_2c,param_1);
                    /* try { // try from 0026ed5d to 0026ed61 has its CatchHandler @ 0026edd9 */
    CUtlVector<CUtlString,CUtlMemory<CUtlString,int>>::InsertBefore
              ((CUtlVector<CUtlString,CUtlMemory<CUtlString,int>> *)(this + 0x10),
               *(int *)(this + 0x1c),local_2c);
    CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_2c);
    iVar3 = *(int *)(this + 0x30);
    iVar1 = iVar3 + 1;
    if (*(int *)(this + 0x28) < iVar1) {
      CUtlMemory<float,int>::Grow
                ((CUtlMemory<float,int> *)(this + 0x24),iVar1 - *(int *)(this + 0x28));
      iVar1 = *(int *)(this + 0x30) + 1;
    }
    iVar2 = *(int *)(this + 0x24);
    *(int *)(this + 0x30) = iVar1;
    iVar1 = (iVar1 - iVar3) + -1;
    iVar3 = iVar3 * 4;
    *(int *)(this + 0x34) = iVar2;
    if (0 < iVar1) {
      _V_memmove((void *)(iVar2 + 4 + iVar3),(void *)(iVar2 + iVar3),iVar1 * 4);
      iVar2 = *(int *)(this + 0x24);
    }
    if ((float *)(iVar3 + iVar2) != (float *)0x0) {
      *(float *)(iVar3 + iVar2) = param_2;
      return;
    }
  }
  else {
    *(float *)(*(int *)(this + 0x24) + iVar1 * 4) = param_2;
  }
  return;
}

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)