L L4D2node

CBaseEntity::GetKeyValue

0x0040d810 · 982 bytes · __thiscall

_ZN11CBaseEntity11GetKeyValueEPKcPci

Decompiled

undefined (4 params)

/* CBaseEntity::GetKeyValue(char const*, char*, int) */

undefined4 __thiscall
CBaseEntity::GetKeyValue(CBaseEntity *this,char *param_1,char *param_2,int param_3)

{
  float fVar1;
  float fVar2;
  float fVar3;
  int iVar4;
  undefined4 *puVar5;
  undefined4 uVar6;
  undefined1 *puVar7;
  undefined1 *puVar8;
  char *pcVar9;
  undefined8 in_stack_ffffffc0;
  ulonglong uVar10;
  
  uVar6 = (undefined4)((ulonglong)in_stack_ffffffc0 >> 0x20);
  if ((((param_1 == "rendercolor") || (iVar4 = _V_stricmp(param_1,"rendercolor"), iVar4 == 0)) ||
      (param_1 == "rendercolor32")) || (iVar4 = _V_stricmp(param_1,"rendercolor32"), iVar4 == 0)) {
    V_snprintf(param_2,param_3,"%d %d %d %d",(uint)(byte)this[0x124],(uint)(byte)this[0x125],
               (uint)(byte)this[0x126],(uint)(byte)this[0x127]);
    return 1;
  }
  if ((param_1 == "renderamt") || (iVar4 = _V_stricmp(param_1,"renderamt"), iVar4 == 0)) {
    pcVar9 = "%d";
    uVar10 = CONCAT44(uVar6,(uint)(byte)this[0x127]);
  }
  else if ((param_1 == "disableshadows") ||
          (iVar4 = _V_stricmp(param_1,"disableshadows"), iVar4 == 0)) {
    pcVar9 = "%d";
    uVar10 = CONCAT44(uVar6,*(uint *)(this + 0xd4) >> 4) & 0xffffffff00000001;
  }
  else {
    if ((((param_1 == "mins") || (iVar4 = _V_stricmp(param_1,"mins"), iVar4 == 0)) ||
        (param_1 == "maxs")) || (iVar4 = _V_stricmp(param_1,"maxs"), iVar4 == 0)) {
      return 0;
    }
    if ((param_1 == "disablereceiveshadows") ||
       (iVar4 = _V_stricmp(param_1,"disablereceiveshadows"), iVar4 == 0)) {
      pcVar9 = "%d";
      uVar10 = CONCAT44(uVar6,*(uint *)(this + 0xd4) >> 6) & 0xffffffff00000001;
    }
    else {
      if ((param_1 != "nodamageforces") &&
         (iVar4 = _V_stricmp(param_1,"nodamageforces"), iVar4 != 0)) {
        if (param_1 == "angle") {
          return 0;
        }
        iVar4 = _V_stricmp(param_1,"angle");
        if (iVar4 == 0) {
          return 0;
        }
        if ((param_1 == "angles") || (iVar4 = _V_stricmp(param_1,"angles"), iVar4 == 0)) {
          if (((byte)this[0x14d] & 8) != 0) {
            CalcAbsolutePosition(this);
          }
          fVar1 = *(float *)(this + 900);
          fVar2 = *(float *)(this + 0x380);
          fVar3 = *(float *)(this + 0x37c);
        }
        else {
          if ((param_1 != "origin") && (iVar4 = _V_stricmp(param_1,"origin"), iVar4 != 0)) {
            if ((param_1 == "targetname") || (iVar4 = _V_stricmp(param_1,"targetname"), iVar4 == 0))
            {
              puVar8 = *(undefined1 **)(this + 0x154);
            }
            else {
              if ((param_1 != "classname") && (iVar4 = _V_stricmp(param_1,"classname"), iVar4 != 0))
              {
                puVar5 = (undefined4 *)(**(code **)(*(int *)this + 0x30))(this);
                while( true ) {
                  if (puVar5 == (undefined4 *)0x0) {
                    return 0;
                  }
                  uVar6 = ExtractKeyvalue(this,(typedescription_t *)*puVar5,puVar5[1],param_1,
                                          param_2,param_3);
                  if ((char)uVar6 != '\0') break;
                  puVar5 = (undefined4 *)puVar5[3];
                }
                return uVar6;
              }
              puVar8 = *(undefined1 **)(this + 0x7c);
            }
            pcVar9 = "%s";
            puVar7 = &DAT_00d539c2;
            if (puVar8 != (undefined1 *)0x0) {
              puVar7 = puVar8;
            }
            uVar10 = CONCAT44(uVar6,puVar7);
            goto LAB_0040dab8;
          }
          if (((byte)this[0x14d] & 8) != 0) {
            CalcAbsolutePosition(this);
          }
          fVar1 = *(float *)(this + 0x2e8);
          fVar2 = *(float *)(this + 0x2e4);
          fVar3 = *(float *)(this + 0x2e0);
        }
        V_snprintf(param_2,param_3,"%f %f %f",(double)fVar3,(double)fVar2,(double)fVar1);
        return 1;
      }
      pcVar9 = "%d";
      uVar10 = CONCAT44(uVar6,*(uint *)(this + 0xd4) >> 0x1f);
    }
  }
LAB_0040dab8:
  V_snprintf(param_2,param_3,pcVar9,uVar10);
  return 1;
}

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)