CBaseEntity::KeyValue
0x0040cf20 · 1903 bytes · __thiscall
_ZN11CBaseEntity8KeyValueEPKcS1_
Decompiled
undefined (3 params)
/* CBaseEntity::KeyValue(char const*, char const*) */
undefined4 __thiscall CBaseEntity::KeyValue(CBaseEntity *this,char *param_1,char *param_2)
{
CBaseEntity CVar1;
CBaseEdict *pCVar2;
bool bVar3;
char cVar4;
char *pcVar5;
int iVar6;
char *pcVar7;
undefined4 *puVar8;
undefined4 uVar9;
Vector *pVVar10;
long lVar11;
undefined1 *puVar12;
double dVar13;
undefined1 *local_34;
undefined4 local_30 [2];
CBaseEntity local_28;
CBaseEntity local_27;
CBaseEntity local_26;
CBaseEntity local_25;
pcVar5 = strchr(param_1,0x23);
if (pcVar5 != (char *)0x0) {
*pcVar5 = '\0';
}
if ((((param_1 == "rendercolor") || (iVar6 = _V_stricmp(param_1,"rendercolor"), iVar6 == 0)) ||
(param_1 == "rendercolor32")) || (iVar6 = _V_stricmp(param_1,"rendercolor32"), iVar6 == 0)) {
V_StringToColor32((color32_s *)&local_28,param_2);
if (local_28 != this[0x124]) {
if (this[0x6c] == (CBaseEntity)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
}
this[0x124] = local_28;
}
if (local_27 != this[0x125]) {
if (this[0x6c] == (CBaseEntity)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
}
this[0x125] = local_27;
}
if (local_26 != this[0x126]) {
if (this[0x6c] == (CBaseEntity)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
}
this[0x126] = local_26;
}
if (local_25 == this[0x127]) {
return 1;
}
CVar1 = this[0x6c];
joined_r0x0040d2ea:
if (CVar1 == (CBaseEntity)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
}
this[0x127] = local_25;
return 1;
}
if ((param_1 == "renderamt") || (iVar6 = _V_stricmp(param_1,"renderamt"), iVar6 == 0)) {
local_25 = (CBaseEntity)V_atoi(param_2);
if (local_25 == this[0x127]) {
return 1;
}
CVar1 = this[0x6c];
goto joined_r0x0040d2ea;
}
if ((param_1 == "disableshadows") || (iVar6 = _V_stricmp(param_1,"disableshadows"), iVar6 == 0)) {
lVar11 = strtol(param_2,(char **)0x0,10);
if (lVar11 != 0) {
AddEffects(this,0x10);
return 1;
}
return 1;
}
if ((param_1 == "mins") || (iVar6 = _V_stricmp(param_1,"mins"), iVar6 == 0)) {
UTIL_StringToVector((float *)&local_28,param_2);
pVVar10 = (Vector *)
(**(code **)(*(int *)(this + 0x194) + 8))((CCollisionProperty *)(this + 0x194));
CCollisionProperty::SetCollisionBounds
((CCollisionProperty *)(this + 0x194),(Vector *)&local_28,pVVar10);
return 1;
}
if ((param_1 == "maxs") || (iVar6 = _V_stricmp(param_1,"maxs"), iVar6 == 0)) {
UTIL_StringToVector((float *)&local_28,param_2);
pVVar10 = (Vector *)
(**(code **)(*(int *)(this + 0x194) + 4))((CCollisionProperty *)(this + 0x194));
CCollisionProperty::SetCollisionBounds
((CCollisionProperty *)(this + 0x194),pVVar10,(Vector *)&local_28);
return 1;
}
if ((param_1 == "disablereceiveshadows") ||
(iVar6 = _V_stricmp(param_1,"disablereceiveshadows"), iVar6 == 0)) {
lVar11 = strtol(param_2,(char **)0x0,10);
if (lVar11 != 0) {
AddEffects(this,0x40);
return 1;
}
return 1;
}
if ((param_1 == "nodamageforces") || (iVar6 = _V_stricmp(param_1,"nodamageforces"), iVar6 == 0)) {
lVar11 = strtol(param_2,(char **)0x0,10);
if (lVar11 != 0) {
*(uint *)(this + 0x14c) = *(uint *)(this + 0x14c) | 0x80000000;
return 1;
}
return 1;
}
if ((param_1 == "angle") || (iVar6 = _V_stricmp(param_1,"angle"), iVar6 == 0)) {
dVar13 = strtod(param_2,(char **)0x0);
if ((float)dVar13 < 0.0) {
if ((int)dVar13 == -1) {
V_strncpy(KeyValue(char_const*,char_const*)::szBuf,"-90 0 0",0x40);
}
else {
V_strncpy(KeyValue(char_const*,char_const*)::szBuf,"90 0 0",0x40);
}
}
else {
V_snprintf(KeyValue(char_const*,char_const*)::szBuf,0x40,"%f %f %f",
(double)*(float *)(this + 0x3a8),(double)(float)dVar13,
(double)*(float *)(this + 0x3b0));
}
uVar9 = (**(code **)(*(int *)this + 0x84))
(this,param_1,KeyValue(char_const*,char_const*)::szBuf);
return uVar9;
}
if ((param_1 == "angles") || (iVar6 = _V_stricmp(param_1,"angles"), iVar6 == 0)) {
UTIL_StringToVector((float *)&local_28,param_2);
SetAbsAngles(this,(QAngle *)&local_28);
return 1;
}
if ((param_1 == "origin") || (iVar6 = _V_stricmp(param_1,"origin"), iVar6 == 0)) {
UTIL_StringToVector((float *)&local_28,param_2);
SetAbsOrigin(this,(Vector *)&local_28);
return 1;
}
if ((param_1 == "targetname") || (iVar6 = _V_stricmp(param_1,"targetname"), iVar6 == 0)) {
AllocPooledString((char *)local_30);
*(undefined4 *)(this + 0x154) = local_30[0];
return 1;
}
if ((ent_debugkeys._20_4_ & 0x1000) == 0) {
pcVar5 = *(char **)(ent_debugkeys._28_4_ + 0x24);
if ((pcVar5 == (char *)0x0) || (*pcVar5 == '\0')) {
puVar8 = (undefined4 *)(**(code **)(*(int *)this + 0x30))(this);
while( true ) {
if (puVar8 == (undefined4 *)0x0) {
return 0;
}
cVar4 = ParseKeyvalue(this,(typedescription_t *)*puVar8,puVar8[1],param_1,param_2);
if (cVar4 != '\0') break;
puVar8 = (undefined4 *)puVar8[3];
}
return 1;
}
}
else {
pcVar5 = "FCVAR_NEVER_AS_STRING";
}
if (*pcVar5 != '\0') {
pcVar5 = *(char **)(this + 0x7c);
pcVar7 = "FCVAR_NEVER_AS_STRING";
if (pcVar5 == (char *)0x0) {
pcVar5 = "";
}
if (((ent_debugkeys._20_4_ & 0x1000) == 0) &&
(pcVar7 = *(char **)(ent_debugkeys._28_4_ + 0x24), pcVar7 == (char *)0x0)) {
pcVar7 = "";
}
iVar6 = _V_stricmp(pcVar7,pcVar5);
if (iVar6 == 0) {
bVar3 = true;
local_34 = &DAT_00d539c2;
if (*(undefined1 **)(this + 0x7c) != (undefined1 *)0x0) {
local_34 = *(undefined1 **)(this + 0x7c);
}
goto LAB_0040d169;
}
}
local_34 = &DAT_00d539c2;
bVar3 = false;
LAB_0040d169:
puVar8 = (undefined4 *)(**(code **)(*(int *)this + 0x30))(this);
do {
if (puVar8 == (undefined4 *)0x0) {
if (bVar3) {
puVar12 = &DAT_00d539c2;
if (*(undefined1 **)(this + 0x7c) != (undefined1 *)0x0) {
puVar12 = *(undefined1 **)(this + 0x7c);
}
Msg("!! (%s) key not handled: \"%s\" \"%s\"\n",puVar12,param_1,param_2);
}
return 0;
}
if (!bVar3) {
if ((ent_debugkeys._20_4_ & 0x1000) == 0) {
pcVar5 = *(char **)(ent_debugkeys._28_4_ + 0x24);
if ((pcVar5 == (char *)0x0) || (*pcVar5 == '\0')) goto LAB_0040d1b8;
}
else {
pcVar5 = "FCVAR_NEVER_AS_STRING";
}
iVar6 = _V_stricmp((char *)puVar8[2],pcVar5);
if (iVar6 == 0) {
local_34 = (undefined1 *)puVar8[2];
bVar3 = true;
}
}
LAB_0040d1b8:
uVar9 = ParseKeyvalue(this,(typedescription_t *)*puVar8,puVar8[1],param_1,param_2);
if ((char)uVar9 != '\0') {
if (bVar3) {
Msg("(%s) key: %-16s value: %s\n",local_34,param_1,param_2);
return uVar9;
}
return 1;
}
puVar8 = (undefined4 *)puVar8[3];
} while( true );
}
SourceMod gamedata
paste intoaddons/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.
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.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.